12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687 |
-
- try {
- if (document.domain) {
-
- if (document.domain.indexOf("1473.cn") > -1) {
- document.domain = "1473.cn";
- }
- else {
- document.domain = "cocorobo.cn";
- }
- }
- }
- catch (e) { }
- window.Namespace = {};
- Namespace.register = function (namespace) {
- var i,
- _local = window,
- _namespacearr = namespace.split(".");
-
- for (i = 0; i < _namespacearr.length; i++) {
-
- if (!_local[_namespacearr[i]]) {
- _local[_namespacearr[i]] = {};
- }
-
- _local = _local[_namespacearr[i]];
- }
- }
- Namespace.register("U");
- Namespace.register("US");
- if (!US.disk) {
-
- US.userInfo = {};
- US.disk = {};
- US.blog = {};
- US.forum = {};
- US.friend = {};
- US.city = {};
-
- US.domain = "1473.cn";
- US.forum.news = null;
- US.systemId = 0;
- US.pageId = "";
-
- US.height = window.screen.availHeight;
- US.width = window.screen.availWidth;
-
- US.OFFICEFILEURL = "http://office.1473.cn/usoffice/";
- US.SCOKET = "//poll.cocorobo.cn";
- US.FILESYSTEMURL = "http://fs.1473.cn/";
- US.DOMAIN = "/";
- US.ERRORIMAGE = "/img/error.png";
- US.CD = "http://cd.1473.cn/net/ssh.ashx";
- US.AUTH = "http://main.1473.cn/Uses.ashx";
- US.FRIEND = "http://friend.1473.cn/friend.ashx";
- US.DISK = "http://disk.1473.cn/disk.ashx";
- US.USER = "http://user.1473.cn/user.ashx";
- US.ADMINAUTH = "http://main.1473.cn/admin.ashx";
- US.DB = "sqlserver.1473.cn";
- US.FORUMROOTID = "1e0742d8-737e-46e2-b03b-2f23ca8c1f17";
- US.MYDISK = "d8ae0266-481d-4064-86d2-fb52a4059793";
- US.PRIVATEFOLDERID = "9639aba6-03eb-443c-be4e-f0c8d24767f5";
- US.FTPFOLDERID = "f6d7a4b6-e34c-4964-beed-24187b2cb1ba";
- US.MYFOLDERID = "7aeaab56-485f-4150-b781-8ffd86d593ce";
- US.IMAGEFOLDERID = "93553847-e299-464c-a0e2-c15872efb6ae";
- US.MUSICEFOLDERID = "8a2135ff-746a-43a8-97b8-552d228a00bb";
- US.VIDEOFOLDERID = "bf21bf7a-1e95-4194-8e4a-e9334d7d998d";
- US.EMPTYGUID = "00000000-0000-0000-0000-000000000000";
- US.ZINDEX = 20;
- US.FEEDBACKID = "3c779543-bc1a-4851-af22-af9ba97a5f33"
- US.MAINDOMAIN = "http://" + ((window.location.host.indexOf("www.1473.cn") > -1 ||
- window.location.host == "1473.cn" ||
- window.location.host.indexOf("www.cocorobo.cn") > -1 ||
- window.location.host == "cocorobo.cn") ? window.location.host : "www.1473.cn");
- }
- US.permission = {};
- US.permission.disk = {
- "isopen": true,
- "isupadte": true,
- "isdelete": true,
- "iscopy": true,
- "isshear": true,
- "isencryption": false,
- "isreply": true,
- "isdownload": true,
- "isnew": true,
- "ispaste": true,
- "isrefresh": true,
- "isupload": true,
- "isview": true,
- "isedit": true
- };
- US.permission.getDiskPermission = function () {
- var i, _obj = {}, _p = US.permission.disk;
- for (i in _p) {
- _obj[i] = _p[i]
- }
- return _obj;
- }
- Namespace.register("U.MD.C");
- U.MD.C.imgError = function (imgel, type) {
- var _number,
- _url;
-
- imgel = imgel && !imgel.srcElement ? imgel : (event ? event.srcElement || this : this);
-
- if (imgel.src != "/img/error.png") {
- if (type == 2) {
- _url = imgel.src;
- _number = _url.indexOf("?&n=");
-
- if (_number < 0 || _url.length - _number < 10) {
- imgel.src += (_number == -1 ? "?&n=" : "") + 1;
- return
- }
- else {
- type = 1;
- }
- }
- if (type == 1) {
- U.selectEl(imgel).addAttrArray({ "src": "/img/error.png" });
- }
- else {
- imgel.src = type || "/img/UserHead/UseHead.jpg";
- }
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ;
- Namespace.register("U.A");
- U.A.allAjaxRequest =
- {
- requestNumber: 0,
- requestObject: [],
- forrequest: 0
- };
- var serverInfo = {
- affectRows: null,
- value: null,
- error: null,
- statusCode: null
- }
- var serverReturnObj = {
- httpRequest: null,
- status: 200,
- serverInfo: serverInfo,
- value: null,
- context: null
- };
- U.A.Request = function (url, params, cb, cbparams, header) {
-
- if (U.A.Request.ifAttack()) {
- var _isdomain = U.A.Request.isDomain(url);
-
- if (_isdomain == 1) {
- var _header = header || {},
- _ajaxtype = _header.type || "POST",
- _isasync = U.UF.C.isFunction(cb),
- _params = U.A.Request.toAjaxFormat(params);
-
- var _ajaxobject = U.A.Request.createAjaxObject(url);
-
- U.A.Request.attack(url, params, cb, cbparams, header, _ajaxobject);
-
- if (_ajaxtype.toUpperCase() == "GET") {
- url += "?" + _params;
- }
-
- _ajaxobject.open(_ajaxtype, url, _isasync);
-
- U.A.Request.writeHeader(_ajaxobject, _header);
-
- _ajaxobject.send(_params);
-
-
- if (_isasync) {
- U.A.Request.asyn(_ajaxobject, cb, cbparams);
- }
-
- else {
- return U.A.Request.getData(_ajaxobject, null);
- }
- }
- else {
- return U.A.Request.handleDomain(url, params, cb, cbparams, header, _isdomain);
- }
- }
- }
- U.A.Request.Post = function (url, params, cb, cbparams, header) {
-
- if (U.A.Request.ifAttack()) {
- var _isdomain = U.A.Request.isDomain(url);
-
- if (_isdomain == 1) {
- var _header = header || {},
- _ajaxtype = _header.type || "POST",
- _isasync = U.UF.C.isFunction(cb),
- _params = U.A.Request.Post.toAjaxFormat(params);
-
- var _ajaxobject = U.A.Request.createAjaxObject(url);
-
- U.A.Request.attack(url, params, cb, cbparams, header, _ajaxobject);
-
- _ajaxobject.open(_ajaxtype, url, _isasync);
-
- U.A.Request.writeHeader(_ajaxobject, _header);
-
- _ajaxobject.send(_params);
-
-
- if (_isasync) {
- U.A.Request.asyn(_ajaxobject, cb, cbparams);
- }
-
- else {
- return U.A.Request.getData(_ajaxobject, null);
- }
- }
- else {
- return U.A.Request.handleDomain(url, params, cb, cbparams, header, _isdomain);
- }
- }
- }
- U.A.Request.Post.toAjaxFormat = function (params) {
- var _key;
- var _params = '';
- for (_key in params) {
- _params += _key + '=' + encodeURIComponent(encodeURIComponent(params[_key])) + '&';
- }
- return _params.substr(0, _params.length - 1);
- }
- U.A.Request.attack = function (url, params, cb, cbparams, header, ajaxobject) {
- var _preajax = U.A.allAjaxRequest.requestObject[U.A.allAjaxRequest.requestObject.length - 1],
- _ajaxarray = {
- "win": window,
- "ajax": ajaxobject,
- "url": url,
- "params": params,
- "cb": cb,
- "cbparams": cbparams,
- "header": header,
- "time": new Date().getTime()
- };
- U.A.allAjaxRequest.requestNumber += 1;
- U.A.allAjaxRequest.requestObject.push(_ajaxarray);
-
- if (_preajax) {
-
- if (_ajaxarray.time - _preajax.time < 50) {
- U.A.allAjaxRequest.forrequest += 1;
- }
- else {
- U.A.allAjaxRequest.forrequest = 0;
- }
- }
- return _ajaxarray;
- }
- U.A.Request.toAjaxFormat = function (params) {
- params = params || [];
- var _userinfo,
- _params = "mode=" + U.UF.C.urlEncode(params.concat());
- try {
-
- if (parent && parent.US) {
- _userinfo = parent.US.userInfo;
-
- if (_userinfo && _userinfo.UserId) {
- _params += "&UserId=" + _userinfo.UserId + "&LoginId=" + _userinfo.LoginId;
- }
-
- _params += "&PageId=" + US.pageId + "&SystemId=" + US.systemId;
- }
- } catch (e) { }
- return _params;
- }
- U.A.Request.createAjaxObject = function (url) {
-
- var _locationurl = window.location ? (window.location.protocol + "//" + window.location.host) : "";
- if (url.indexOf(_locationurl) == -1 && window.XDomainRequest) {
- return new window.XDomainRequest();
- }
-
- try { return new XMLHttpRequest(); } catch (e) { }
-
-
- try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch (e) { }
- try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch (e) { }
- try { return new ActiveXObject('MSXML3.XMLHTTP'); } catch (e) { }
- try { return new ActiveXObject('MSXML.XMLHTTP'); } catch (e) { }
- try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { }
- try { return new ActiveXObject('MSXML2.ServerXMLHTTP'); } catch (e) { }
-
- }
- U.A.Request.writeHeader = function (ajax, header) {
- header["CONTENT-TYPE"] = header["CONTENT-TYPE"] || "application/x-www-form-urlencoded;charset=UTF-8";
-
- header["timeout"] = 10000;
- try {
- header["type"] = null;
- delete header["type"];
- }
- catch (e) { }
-
- for (var i in header) {
- try {
-
- if (i in ajax) {
- ajax[i] = header[i];
- }
-
- else {
- ajax.setRequestHeader(i, header[i]);
- }
- }
- catch (e) { }
- }
-
- if (ajax.overrideMimeType) {
- if (header["responseType"] == "blob") {
- ajax.overrideMimeType("text/plain; charset=x-user-defined");
- } else {
- ajax.overrideMimeType("text/html");
- }
- }
- }
- U.A.Request.asyn = function (ajaxobject, cb, params) {
-
- if (params && params[0] && U.UF.C.isElement(params[0])) {
- U.UF.DL.loading(params[0]);
- }
-
- if (ajaxobject.onreadystatechange !== undefined) {
-
- ajaxobject.onreadystatechange = function () {
- if (ajaxobject.readyState == 4) {
-
- if (params && params[0] && U.UF.C.isElement(params[0])) {
- U.UF.DL.uploading(params[0]);
- }
- var _data = U.A.Request.getData(ajaxobject, params);
- cb.call(cb, _data);
- }
- }
-
- ajaxobject.ontimeout = function () {
- return false;
- }
- }
-
- else {
- ajaxobject.ontimeout = function () { }
-
- ajaxobject.onerror = function () {
- ajaxobject.status = 500;
- cb.call(cb, {
- httpRequest: ajaxobject,
- status: {
- "status": ajaxobject.status,
- "statusText": ajaxobject.statusText
- },
- value: null,
- context: params
- });
- };
-
- ajaxobject.onload = function () {
-
- if (params && params[0] && U.UF.C.isElement(params[0])) {
- U.UF.DL.uploading(params[0]);
- }
- var _data = U.A.Request.getData(ajaxobject, params);
- cb.call(cb, _data);
- }
- }
- }
- U.A.Request.getData = function (ajaxobject, cbparams) {
- var _data,
- _returnobj = {
- httpRequest: ajaxobject,
- status: 200,
- value: null,
- context: cbparams
- };
-
- if (ajaxobject.status == 200 || ajaxobject.status == null) {
-
- if (ajaxobject.responseXML && ajaxobject.responseXML.xml) {
- _data = ajaxobject.responseXML.xml;
- }
-
- else {
- _data = U.UF.C.toJson(ajaxobject.responseText);
- }
- _returnobj.value = _data;
- }
-
- else {
-
- _returnobj.status = {
- "status": ajaxobject.status,
- "statusText": ajaxobject.statusText
- };
- }
-
- if (ajaxobject.abort) {
- ajaxobject.abort();
- }
-
- U.A.Request.timeSpan(ajaxobject, _returnobj);
-
- return _returnobj;
- }
- U.A.Request.isDomain = function (url) {
- var _frame,
- _a = $$("a", { "href": url })
- ;
-
- if (window.location) {
-
- if (url.indexOf(window.location.host) == 0) {
- return 1;
- }
-
- else if (window.location.host.split(".").slice(-2).join(".") == _a.hostname.split(".").slice(-2).join(".")) {
- _frame = window.frames;
-
- for (i = 0; i < _frame.length; i++) {
- try {
- if (_frame[i].location.host && _a.host.indexOf(_frame[i].location.host) == 0) {
- return 2;
- }
- }
- catch (e) {
- }
- }
- }
- }
-
-
-
-
- return 1;
- }
- U.A.Request.handleDomain = function (url, params, cb, arg, header, isdomain) {
- var _newsinfo,
- _a = $$("a", { "href": url }),
- _frame;
-
- if (isdomain == 2) {
- _frame = window.frames;
-
- for (i = 0; i < _frame.length; i++) {
- try {
- if (_a.hostname.indexOf(_frame[i].location.hostname) == 0) {
- return _frame[i].U.A.Request(url, params, cb ? function (data) { setTimeout(function () { cb.call(window, data) }); } : null, arg, header);
- }
- }
- catch (e) {
- }
- }
- }
-
- else if (isdomain == 3) {
-
- if (params && U.UF.C.isElement(params[0])) {
- U.UF.DL.uploading(params[0]);
- }
-
- _newsinfo = new U.UF.EV.message(
- function (data, id, cookie) {
-
- if (cookie == "") {
- U.UF.Cookie.del(cookie);
- }
-
- else {
- U.UF.Cookie.set(cookie);
- }
- var _data = {
- httpRequest: null,
- status: 200,
- value: data,
- context: arg
- };
- cb.call(cb, _data);
- }, true, "domain", "U_Domain");
-
- _newsinfo.post([url, params], "domain");
- }
- return false;
- }
- U.A.Request.ifAttack = function () {
- var _isfor = U.A.allAjaxRequest.forrequest < 50;
-
- if (!_isfor) {
- setTimeout(function () { U.A.allAjaxRequest.forrequest = 0; })
- }
- return _isfor;
- }
- U.A.Request.timeSpan = function (ajaxobject, request) {
- var i,
- _timespan,
- _arr = U.A.allAjaxRequest.requestObject;
-
- for (i = 0; i < _arr.length; i++) {
- try {
-
- if (_arr[i].ajax == ajaxobject) {
- _timespan = new Date().getTime() - _arr[i].time;
- U.UF.C.console({ "timespan": _timespan, "request": request });
- }
- } catch (e) { }
- }
- }
-
- ;
- Namespace.register("U.UF.CI");
- U.UF.CI.userAgent = navigator.userAgent.toLowerCase();
- U.UF.CI.getUserLocation = function (fun) {
-
- if (US.city["country"]) {
- fun();
- }
- else {
-
-
- U.UF.DL.asynLoadJs({ "src": "http://pv.sohu.com/cityjson?ie=utf-8" },
- function () {
- var _city = U.UF.CI.asyngetUserLocation();
- fun(_city);
- });
- }
- }
- U.UF.CI.asyngetUserLocation = function () {
- try {
- var _script = U.UF.DL.asynLoadJs({ "src": "http://pv.sohu.com/cityjson?ie=utf-8" }, function () { });
-
- var i,
- _locationinfo = returnCitySN,
-
- _locationarr = [
- "country",
- "province",
- "city",
- "district",
- "isp",
- "type"
- ];
- _locationinfo.userAllLocation = "";
-
- for (i = 0; i < _locationarr.length; i++) {
- _locationarr["userAllLocation"] += _locationarr[_locationinfo[i]];
- if (i != _locationarr.length - 1) {
- _locationarr["userAllLocation"] += ",";
- }
- }
-
-
- US.city = _locationinfo;
- cb(_locationinfo);
- }
- catch (e) { return; }
- }
- U.UF.CI.getBrowser = function () {
- var _browserobj = { "browser": "", "ver": "" },
- _bri = U.UF.CI.userAgent,
- _bro = U.UF.S.browser,
- _browserarr = _bri.match(_bro)
- ;
- _browserobj.browser = _browserarr[1];
- _browserobj.ver = _browserarr[2];
- return _browserobj;
- }
- U.UF.CI.getSystem = function () {
-
- var _ant = {
- "Apple series": "Mac68K,MacPPC,Macintosh",
- "Unix series": "X11",
- "Mac OS X 10_7": "OSX 10.7",
- "Mac OS X 10.8": "OSX 10.8",
- "Mac OS X 10_8": "OSX 10.8",
- "Linux": "Linux"
- };
- var _win = {
- "Windows NT 5.1": "WinXP",
- "Windows NT 6.1": "Win7",
- "Windows NT 6.0": "Windows Server 2008",
- "Windows NT 6.2": "Win8",
- "Windows NT 5.1": "winxp",
- "Windows NT 5.2": "Windows Server 2003",
- "Windows NT 5.0": "Win2000",
- "Win 9x 4.90": "WinME",
- "Windows NT 10.0": "Win10"
- };
- var _str = navigator.userAgent;
- var _left = _str.indexOf('(');
- var _right = _str.indexOf(';');
-
- var _result = _str.substring(_left + 1, _right);
- return _win[_result] || _ant[_result];
- }
- U.UF.CI.isSupportFlash = function () {
- if (typeof (Worker) !== "undefined")
- {
- return 'HTML5';
- }
- else if (navigator.plugins["Shockwave Flash"]) {
- return "Flash";
- }
- else {
- return false;
- }
- }
- U.UF.CI.getUserPort = function () {
- var _userAgentInfo = navigator.userAgent,
- _agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"],
- _flag = true,
- i;
-
- for (i = 0; i < _agents.length; i++) {
- if (_userAgentInfo.indexOf(_agents[i]) > 0) {
- _flag = false;
- break;
- }
- }
- return _flag;
- }
- U.UF.CI.getDPI = function () {
- var arrDPI = new Array();
- if (window.screen.deviceXDPI != undefined) {
- arrDPI[0] = window.screen.deviceXDPI;
- arrDPI[1] = window.screen.deviceYDPI;
- }
- else {
- var tmpNode = document.createElement("DIV");
- tmpNode.style.cssText = "width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden";
- document.body.appendChild(tmpNode);
- arrDPI[0] = parseInt(tmpNode.offsetWidth);
- arrDPI[1] = parseInt(tmpNode.offsetHeight);
- tmpNode.parentNode.removeChild(tmpNode);
- }
- return arrDPI;
- }
-
- ;
- Namespace.register("U.UF.C");
- U.UF.C.fullScreen = function () {
- var _funcname = U.UF.C.getFullSreeenName("requestFullScreen");
- if (_funcname != null) {
- document[_funcname] ? document[_funcname]() : document.documentElement[_funcname]();
- }
- }
- U.UF.C.cancelfullScreen = function () {
- var _funcname = U.UF.C.getFullSreeenName("cancelFullScreen") || U.UF.C.getFullSreeenName("exitFullScreen");
- if (_funcname != null) {
- document[_funcname] ? document[_funcname]() : document.documentElement[_funcname]();
- }
- }
- U.UF.C.getFullSreeenName = function (funcname) {
- var i, _functionname;
-
-
-
- var _full = ["", "webkit", "moz", "ms", "o"];
- for (i = 0; i < _full.length; i++) {
- if (_full[i]) {
- _functionname = _full[i] + funcname.capitalizeFirstLetter();
- }
- else {
- _functionname = funcname;
- }
-
- if (_functionname in document.documentElement || _functionname in document) {
- return _functionname;
- }
- }
- return null;
- }
- U.UF.C.toArray = function (obj) {
- try {
- return Array.prototype.slice.call(obj);
- }
- catch (e) {
- var i = 0,
- _arr = [];
- for (; obj[i]; i++) {
- _arr.push(obj[i]);
- }
- return _arr;
- }
- }
- U.UF.C.apply = function (scope, fun) {
-
- return function () {
- fun.call(scope || this);
- }
- }
- U.UF.C.closure = function (fun, parms) {
-
- return function () {
- return fun.apply(this, parms)
- }
- }
- U.UF.C.getColorByRGB = function (style) {
- var i,
- _color = "#",
- _grbarr = style.match(U.UF.S.rgb);
-
- if (_grbarr) {
- for (i = 1; i < _grbarr.length; i++) {
- _color += ("0" + _grbarr[i].toInt().toString(16)).slice(-2);
- }
- return _color;
- }
- return style;
- }
- U.UF.C.queryString = function (key, search) {
- var _search = (search || window.document.location.search).substr(1);
- var i, j,
- _return = "",
- _valuearr,
- _arr = _search.split("&");
- for (i = 0; i < _arr.length; i++) {
- _valuearr = _arr[i].split("=");
- if (_valuearr[0].toUpperCase() == key.toUpperCase()) {
- for (j = 1; j < _valuearr.length; j++) {
- _return += _valuearr[j] + (j == _valuearr.length - 1 ? "" : "=");
- }
- break;
- }
- }
- return _return;
- }
- U.UF.C.getUrlHash = function () {
- var _hash = document.location.hash;
- return _hash.split("/");
- }
- U.UF.C.isUrl = function (str) {
-
- var _str = str;
-
- var _String = /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/;
-
- var _objExp = new RegExp(_String);
-
- if (_objExp.test(str) == true) {
- return true;
- } else {
- return false;
- }
- }
- U.UF.C.iframeSameDomain = function (iframe, htmlstr, cb) {
-
- U.UF.DL.iframeLoad(iframe, function () {
- if (htmlstr) {
- iframe.contentWindow.document.body.innerHTML = htmlstr;
- }
- if (cb) {
- cb();
- }
- });
-
- iframe.src = document.domain ? "javascript:void((function(){document.open();document.domain='" + document.domain + "';document.close()})())" : "about:blank";
- return iframe;
- }
- U.UF.C.urlEncode = function (arr) {
- var i;
- for (i = 0; i < arr.length; i++) {
- arr[i] = encodeURIComponent(encodeURIComponent(arr[i]));
- }
- return arr.join(",");
- }
- U.UF.C.copy = function () {
- if (window.clipboardData) {
- window.clipboardData.setData("text", copystr);
- }
- else if (event && event.clipboardData) {
- event.clipboardData.setData("text/HTML", copystr);
- }
- else if (event && event.originalEvent && event.originalEvent.clipboardData) {
- event.originalEvent.clipboardData("Text", copystr);
- }
- else if (document.execCommand) {
- document.execCommand("copy");
- return document.execCommand("copy");
- }
- else {
- U.alert("请手动选择复制");
- }
- }
- U.UF.C.pasteText = function () {
- if (window.clipboardData) {
- return window.clipboardData.getData("text");
- }
- else if (event.clipboardData) {
- var _str = event.clipboardData.getData("text/HTML");
- if (!_str) {
- _str = event.clipboardData.getData("text/plain").replaceAngleBrackets();
- }
- return _str;
- }
- else if (event && event.originalEvent && event.originalEvent.clipboardData) {
- return event.originalEvent.clipboardData("Text")
- }
- else if (document.execCommand) {
- if (document.execCommand("paste") == true) {
- document.execCommand("paste");
- return document.execCommand("paste");
- } else {
- U.alert && U.alert("无法粘贴");
- return false;
- }
- }
- else {
- U.alert && U.alert("无法粘贴");
- }
- }
- U.UF.C.rightClickMenuLocation = function (el) {
-
- var _e = event || window.event,
- _elementposition = U.UF.EL.getElementPosition(el),
- _getmousex = _e.clientX - _elementposition[1],
- _getmousey = _e.clientY - _elementposition[0],
- _eloffsetp = U.selectEl(el).Parent(),
- _ellocationw = el.offsetWidth,
- _ellocationh = el.offsetHeight,
- _eloffsetpw = _eloffsetp.offsetWidth,
- _eloffsetph = _eloffsetp.offsetHeight;
-
- if ((_ellocationw + _getmousex) > _eloffsetpw) {
- _getmousex = _getmousex;
- }
- else {
- _getmousex = _getmousex;
- }
-
- if ((_ellocationh + _getmousey) > _eloffsetph) {
- _getmousey = _getmousey;
- }
- else {
- _getmousey = _getmousey;
- }
- U.selectEl(el)[0].style.top = _getmousey + "px";
- U.selectEl(el)[0].style.left = _getmousex + "px";
- }
- U.UF.C.jsonToStr = function (o) {
- var r = [];
- if (typeof o == "string") {
- return "\"" + o.replace(/([\'\"\\])/g, "\\$1").replace(/(\n)/g, "\\n").replace(/(\r)/g, "\\r").replace(/(\t)/g, "\\t") + "\"";
- }
- if (typeof o == "object") {
- if (!o.sort) {
- for (var i in o) {
- r.push(i + ":" + U.UF.C.jsonToStr(o[i]));
- }
- if (!!document.all && !/^\n?function\s*toString\(\)\s*\{\n?\s*\[native code\]\n?\s*\}\n?\s*$/.test(o.toString)) {
- r.push("toString:" + o.toString.toString());
- }
- r = "{" + r.join() + "}";
- }
- else {
- for (var i = 0; i < o.length; i++) {
- r.push(U.UF.C.jsonToStr(o[i]));
- }
- r = "[" + r.join() + "]";
- }
- return r;
- }
- if (o == null) {
- return "null";
- }
- else { return o.toString(); }
- }
- U.UF.C.objectToString = function (obj) {
- return Object.prototype.toString.call(obj);
- }
- U.UF.C.console = function (err) {
- try {
-
- return;
- }
- catch (e) { }
- }
- U.UF.C.loadJs = function (el, htmlstr) {
- if (htmlstr != null) {
- el.innerHTML = htmlstr;
- }
- var i,
- _head = U.selectEl("head"),
- _scripts = U.selectEl("script", el);
-
- for (i = 0; i < _scripts.length; i++) {
-
- if (_scripts[i].src) {
- U.UF.DL.asynLoadJs({ "src": _scripts[i].src });
- } else {
-
- $$("script", { "type": _scripts[i].type || 'text/javascript' }, _head[0]).text = _scripts[i].text;
- }
- }
- return htmlstr;
- }
- U.UF.C.toJson = function (str) {
- var i,
- _json = str;
-
- if (U.UF.C.isString(str)) {
- _json = str.parseJSON();
- }
- if (Array.isArray(_json)) {
-
- for (i = 0; i < _json.length; i++) {
- if (U.UF.C.isString(_json[i])) {
- _json[i] = _json[i].parseJSON();
- }
- else if (Array.isArray(_json[i])) {
- U.UF.C.toJson(_json[i]);
- }
- }
- }
-
- return _json;
- }
- U.UF.C.getBriefText = function (el, length, str) {
- if (el.length > length) {
- var _el = U.UF.C.isString(el) ? $$("div", { "innerHTML": el }) : el;
- var _length = length || 200;
- var _str = str || "";
- var _biretext = _el.innerText.substring(0, _length) + (_el.innerText._length > 200 ? _str : "") + str;
- return _biretext;
- }
- return el;
- }
- U.UF.C.shieldedSelect = function () {
- var _editel = U.UF.EL.getAncestorEditElement(event.srcElement);
-
- if (_editel && (_editel.nodeType == 3 || _editel.contentEditable == "true" ||
- "textarea,input".indexOf(_editel.tagName.toLocaleLowerCase()))) {
- return true;
- }
- U.UF.EV.stopBubble();
- U.UF.EV.stopDefault();
- return false;
- }
- U.UF.C.shieldedBackspace = function () {
- if (event.keyCode == 8) {
-
- if (U.UF.EL.getAncestorEditElement((event.srcElement)) == document.body && !document.body.isContentEditable) {
- U.UF.EV.stopDefault();
- }
- }
- }
- U.UF.C.isObject = function (obj) {
- return (typeof obj == "object" && obj !== null);
- }
- U.UF.C.isNumber = function (obj) {
- return typeof obj == "number";
- }
- U.UF.C.isString = function (str) {
- return typeof str == "string"
- }
- U.UF.C.isFunction = function (fun) {
- var _isfun = typeof fun == "function";
- var _isobjfun = U.UF.C.objectToString(fun) == "[object Function]";
- return _isfun || _isobjfun;
- }
- U.UF.C.isElement = function (el) {
- return el != null && el.nodeType != null;
- }
- U.UF.C.AddObj = function (obj1, obj2) {
- for (var i in obj2) {
- if (obj2.hasOwnProperty(i)) {
- obj1[i] = obj2[i];
- }
- }
- return obj2;
- }
- U.UF.C.computeFileSize = function (size) {
- var _s;
- if (size > 1024) {
- if (size / 1024 > 1024) {
- if (size / (1024 * 1024) > 1024) {
- _s = (size / (1024 * 1024 * 1024)).toFixed(2) + 'GB';
- }
- else {
- _s = (size / (1024 * 1024)).toFixed(2) + 'MB';
- }
- }
- else {
- _s = (size / 1024).toFixed(2) + 'KB';
- }
- }
- else {
- _s = size.toFixed(2) + 'B';
- }
- return _s;
- }
- U.UF.C.filterTag = function () {
- }
- ;
- Namespace.register("U.UF.CP");
- U.UF.CP.wheel = function (fun) {
- this.onwheel = fun;
- }
- U.UF.CP.wheelGet = function () {
- return this.onwheel;
- }
- U.UF.CP.setInnerText = function (str) {
- this.textContent = str;
- }
- U.UF.CP.setInnerTextGet = function () {
- return this.textContent;
- }
- U.UF.CP.outerHtml = function (str) {
- var i,
- _this = U.selectEl(this),
- _div = $$("div", { "innerHTML": str }).childNodes,
- _create = $$("frag");
-
- for (i = 0; i < _div.length; i++) {
- _create.appendChild(_div[i]);
- }
- _create.insertBefore(_create, this);
- _this.remove();
- }
- U.UF.CP.outerHtmlGet = function () {
- var _copy = this.cloneNode(true);
- var _div = $$("div", {});
- _div.appendChild(_copy);
- return _div.innerHTML;
- }
- U.UF.CP.getStyleGet = function () {
- return getComputedStyle(this, false);
- }
- U.UF.CP.setCapture = function () {
- return function () {
- window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);
- }
- }
- U.UF.CP.releaseCapture = function () {
- return function () {
- window.releaseEvents(Event.MOUSEMOVE | Event.MOUSEUP)
- }
- }
- U.UF.CP.onresize = function (fun) {
- if (this.tagName) {
-
- var _position,
- _sizeelement = this.__SizeElement__;
- if (!_sizeelement || U.selectEl(_sizeelement).Parent() != this && fun) {
- _position = U.UF.EL.getStyle(this, "position");
- if (_position == "" || _position == "static") { this.style.position = "relative"; }
- _sizeelement = this.__SizeElement__ = $$("object", {
- "onload": function () {
- if (fun) {
- _sizeelement.contentDocument.defaultView.onresize = function () {
- fun();
- }
-
-
-
- }
- else {
- try {
- delete this.__SizeElement__;
- } catch (e) { }
- }
- },
- "type": "text/html",
- "data": "about:blank",
- "style": {
- "cssText": "display:block;position:absolute;top:0;left:0;height:100%;width:100%;overflow:hidden;pointer-events:none;z-index:-1;visibility:hidden;margin:0;padding:0;"
- }
- }, this);
- }
- else {
- if (fun) {
- _sizeelement.contentDocument.defaultView.onresize = function () { fun(); }
- }
- else {
- try {
- delete this.__SizeElement__;
- } catch (e) { }
- }
- }
- }
- }
- U.UF.CP.onresizeGet = function () {
- try {
- return this.__SizeElement__.contentDocument.defaultView.onresize;
- }
- catch (e) {
- return null;
- }
- }
- U.UF.CP.eventGet = function () {
- var _currentfun = arguments.callee;
- while (_currentfun.caller) {
- _currentfun = _UDE.caller;
- }
- if (_currentfun.arguments[0]) {
- return _currentfun.arguments[0];
- }
- else {
- return null;
- }
- }
- U.UF.CP.targetGet = function () {
- return event.target;
- }
- U.UF.CP.keyCodeGet = function () {
- return event.which;
- }
- U.UF.CP.onreadystatechangeGet = function () {
- return this.onload;
- }
- U.UF.CP.onreadystatechange = function (cb) {
- this.onload = cb;
- }
- U.UF.CP.componentFromPoint = function () {
- return function () {
- var _position = U.UF.EL.getMousePosition();
- var _elinfo = U.UF.EL.getElementInfo(this);
- if ((_position["X"] > _elinfo["CW"] + _elinfo["TX"]) || (_position["Y"] > _elinfo["CH"] + _elinfo["TY"])) {
- return "outside";
- }
- return "";
- }
- }
- U.UF.CP.init = function () {
-
- if (window.HTMLElement) {
-
-
-
-
- if (!("onmousewheel" in HTMLElement.prototype)) {
-
- if ("onwheel" in HTMLElement.prototype) {
-
- HTMLElement.prototype.__defineGetter__("onmousewheel", U.UF.CP.wheelGet);
- HTMLElement.prototype.__defineSetter__("onmousewheel", U.UF.CP.wheel);
- }
-
- else {
- window.addEventListener("DOMMouseScroll", function (e) {
-
- var _fun = null,
- _currentevent = e.srcElement;
- do {
- _fun = U.selectEl(_currentevent).attr("onmousewheel") || _currentevent.onmousewheel;
- _currentevent = U.selectEl(_currentevent).Parent();
- }
- while (!(_fun || !_currentevent));
- if (_fun) {
- if (U.UF.C.isString(_fun)) {
- _currentevent.onmousewheel = new Function(_fun);
- }
- U.UF.EV.stopDefault();
-
- setTimeout(function () {
- obj.call(this, e);
- }, 0);
- }
- }, false);
- }
- }
-
-
-
-
-
-
-
-
- if (!("innerText" in HTMLElement.prototype)) {
- HTMLElement.prototype.__defineGetter__("innerText", U.UF.CP.setInnerTextGet);
- HTMLElement.prototype.__defineSetter__("innerText", U.UF.CP.setInnerText);
- }
-
-
- if (!("outerHTML" in HTMLElement.prototype)) {
- HTMLElement.prototype.__defineGetter__("outerHTML", U.UF.CP.outerHtmlGet);
- HTMLElement.prototype.__defineSetter__("outerHTML", U.UF.CP.outerHtml);
- }
-
-
- if (!("currentStyle" in HTMLElement.prototype)) {
- HTMLElement.prototype.__defineGetter__("currentStyle", U.UF.CP.getStyleGet);
- }
-
-
- if (!("setCapture" in HTMLElement.prototype)) {
- HTMLElement.prototype.__defineGetter__("setCapture", U.UF.CP.setCapture);
- }
-
-
- if (!("releaseCapture" in HTMLElement.prototype)) {
- HTMLElement.prototype.__defineGetter__("releaseCapture", U.UF.CP.releaseCapture);
- }
-
-
- if (!("onresize" in HTMLElement.prototype) || !(U.UF.CI.getBrowser().browser == "msie")) {
- HTMLElement.prototype.__defineGetter__("onresize", U.UF.CP.onresizeGet);
- HTMLElement.prototype.__defineSetter__("onresize", U.UF.CP.onresize);
- }
-
- if (!("componentFromPoint" in HTMLElement.prototype)) {
- HTMLElement.prototype.__defineGetter__("componentFromPoint", U.UF.CP.componentFromPoint);
- }
-
-
- if (!("event" in window.constructor.prototype)) {
- window.constructor.prototype.__defineGetter__("event", U.UF.CP.eventGet);
- }
-
- if (window.Event.prototype) {
-
-
- if (!("srcElement" in window.Event.prototype)) {
- window.Event.__defineGetter__("target", U.UF.CP.targetGet);
- }
-
-
- if (!("keyCode" in window.Event.prototype) && window.Event.__defineGetter__) {
- window.Event.__defineGetter__("keyCode", U.UF.CP.keyCodeGet);
- }
- }
- }
- }
- U.UF.C.style;
- document.querySelectorAll = document.querySelectorAll || function (str, el) {
- var _addstyle = U.UF.C.style,
- _returnarr = [],
- _firstchild = document.documentElement.firstChild,
- _arr = (el || document).all,
- i = _arr.length;
-
- try {
- _addstyle.styleSheet.cssText = str + "{q:1}";
- }
- catch (e) {
- U.UF.C.style = $$("style", {
- "type": "text/css",
- "styleSheet": {
- "cssText": str + "{q:1}"
- }
- }, _firstchild);
- }
-
- while (i--) {
- if (_arr[i].currentStyle.q) {
- _returnarr.unshift(_arr[i]);
- }
- }
- return _returnarr;
- };
- document.querySelector = document.querySelector || function (num) {
- var _num = document.querySelectorAll(num);
- if (_num.length) {
- return _num[0];
- }
- else {
- return null;
- }
- };
- U.UF.CP.selectorElement = function (str, el) {
- var _ishasid = (el.id === "" && el != document),
- _query = $$("div").querySelectorAll;
- if (_ishasid) {
- el.id = el.uniqueID;
- }
- try {
- if (_query) {
- return (el || document).querySelectorAll((el.id ? ("#" + el.id + " ") : " ") + str, el);
- }
-
- else {
- return document.querySelectorAll((el.id ? ("#" + el.id + " ") : " ") + str, el);
- }
- }
- catch (e) {
- return null;
- }
- finally {
- if (_ishasid) {
- el.id = "";
- }
- }
- }
- U.UF.CP.touch = function () {
-
- if (U.UF.C.touchstart) {
- U.UF.EV.delElementEvent("touchstart", document, U.UF.C.touchstart, true);
- }
-
- U.UF.EV.addElementEvent("touchstart", document, U.UF.C.touchstart, true);
- }
- U.UF.C.touchstart = function () {
- var i,
- _eventsrc = event.srcElement;
-
- U.UF.C.ismove = null;
-
- U.UF.EV.stopBubble();
-
- U.UF.EV.delElementEvent("touchstart", document, U.UF.C.touchstart, true);
-
- U.UF.EV.simulatePhoneTouch(_eventsrc, "touchstart");
-
- U.UF.EV.addElementEvent("touchstart", document, U.UF.C.touchstart, true);
-
- U.UF.EV.addElementEvent("touchmove", document, U.UF.C.touchmove);
-
- U.UF.EV.addElementEvent("touchend", document, U.UF.C.touchend, true);
- }
- U.UF.C.touchmove = function () {
- U.UF.C.ismove = true;
- U.UF.EV.delElementEvent("touchmove", document, U.UF.C.touchmove);
- U.UF.EV.simulatePhoneTouch(event.srcElement, "touchmove");
- U.UF.EV.stopBubble();
- }
- U.UF.C.touchend = function () {
- U.UF.EV.delElementEvent("touchend", document, U.UF.C.touchend, true);
- U.UF.EV.stopBubble();
-
- if (!U.UF.C.ismove) {
- U.UF.EV.simulatePhoneTouch(event.srcElement, "touchend");
- }
- }
- Namespace.register("U.UF.Cookie");
- U.UF.Cookie.crossDomain = function (url, cb) {
-
- U.UF.DL.asynLoadJs({ "src": url }, cb);
- }
- U.UF.Cookie.set = function (key, att) {
- var i,
- j,
- k = 0,
- _cookiestr = "";
-
- if (U.UF.C.isString(key)) {
- _cookiestr = key;
- document.cookie = U.UF.Cookie.setProperty(att, key);
- }
-
- else {
- for (i in key) {
- _cookiestr = i + "=";
- for (j in key[i]) {
-
-
- if (k > 0) {
- _cookiestr += "&";
- }
- _cookiestr += j + "=" + encodeURIComponent(key[i][j]);
- k++;
- }
-
- document.cookie = U.UF.Cookie.setProperty(att, _cookiestr);
- }
- }
- return document.cookie;
- }
- U.UF.Cookie.setProperty = function (key, val) {
- var i,
- _pj,
- _time,
- _cookie = {
- path: "/",
- domain: document.domain,
- expires: 365,
- secure: null
- };
-
- key = key || {};
- for (i in _cookie) {
-
- if (i == "expires" && (key[i] || _cookie[i])) {
- _time = new Date();
-
- var _etime = (key[i] || _cookie[i]) * 24 * 60 * 60 * 1000;
- _time.setTime(_time.getTime() + _etime);
- key[i] = _time.toUTCString();
- }
-
- if (key[i] || _cookie[i]) {
-
- if (key[i] == null) {
- _pj = _cookie[i];
- }
- else {
- _pj = key[i];
- }
-
- val += "; " + i + "=" + _pj;
- }
- };
- return val;
- }
- U.UF.Cookie.del = function (key) {
- var i,
- _array,
- _key = "",
- _cookies = document.cookie.split("; ");
-
- for (i = 0; i < _cookies.length; i++) {
- _array = _cookies[i].split("=");
-
- if (!key || _array[0] == key) {
-
- var _cut = _key.length ? "; " : "";
- _key += _cut + _array[0] + "=";
- }
- }
-
- if (_key) {
- U.UF.Cookie.set(_key, { expires: -1 });
- }
- else {
- console.log("not found cookie!");
- }
- }
- U.UF.Cookie.get = function (key, val) {
- var i,
- _valuearray,
- _value = "",
- _cookies = document.cookie.split("; ");
-
- for (i = 0; i < _cookies.length; i++) {
-
- _valuearray = _cookies[i].split("=");
-
- if (_valuearray[0] == key) {
- _valuearray.splice(0, 1);
- _value = _valuearray.join("=");
- break;
- }
- }
- if (val) {
- _cookies = _value.split("&");
- _value = [];
- for (i = 0; i < _cookies.length; i++) {
- _valuearray = _cookies[i].split("=");
-
- if (_valuearray[0] == val) {
- _value.push(decodeURIComponent(_valuearray[1]));
- }
-
- else if (_valuearray[1] == val) {
- return true;
- }
- }
- }
- return (_value.length ? _value : false);
- }
- ;
- Namespace.register("U.UF.CD");
- U.UF.CD.AJAXCROSSDOMAIN = "/DataCrossdomain.htm";
- U.UF.CD.PAGECROSSDOMAIN = "/PageCrossdomain.htm";
- U.UF.CD.FRIENDINDEX = "http://friend.1473.cn/friend.aspx";
- U.UF.CD.USERINDEX = "http://user.1473.cn/user.aspx";
- U.UF.CD.DISKINDEX = "http://disk.1473.cn/disk.aspx";
- U.UF.CD.OFFICEINDEX = "http://usoffice.1473.cn/office.aspx";
- U.UF.CD.AJAXIFRAMES = [
-
- {
- "id": "U_Main",
- "url": "http://main.1473.cn/Crossdomain.htm"
- },
-
- {
- "id": "U_Disk",
- "url": "http://disk.1473.cn/Crossdomain.htm"
- },
-
- {
- "id": "U_Friend",
- "url": "http://friend.1473.cn/Crossdomain.htm"
- },
-
- {
- "id": "U_User",
- "url": "http://user.1473.cn/Crossdomain.htm"
- },
-
- {
- "id": "U_CD",
- "url": "http://cd.1473.cn/Crossdomain.htm"
- }
- ];
- U.UF.CD.STATION = "/default.aspx";
- U.UF.CD.loadAjaxCrossDomain = function (cb, loadingel) {
- var i,
- _iframe,
- _iframeid,
- _len = { length: U.UF.CD.AJAXIFRAMES.length },
- _parentel = U.selectEl("#usestudio_server")[0] || U.selectEl("body")[0],
- _crossobj = U.UF.CD.AJAXIFRAMES;
-
- if (document.domain.indexOf("1473.cn") > -1) {
-
- for (i = 0; i < _crossobj.length; i++) {
- try {
- _iframeid = _crossobj[i].id;
-
- if (window[_iframeid] && window[_iframeid].location) {
-
- if (window[_iframeid].location.href == _crossobj[i].url) {
-
- U.UF.CD.asynLoadAjaxCrossDomain($("#" + _iframeid)[0], cb, _len);
- }
- }
-
- _iframe = $$("iframe", { "id": _iframeid, "name": _iframeid, "width": 0, "height": 0, "style": { "display": "none" }, "src": _crossobj[i].url });
-
- U.UF.DL.iframeLoad(_iframe, function () {
- U.UF.CD.asynLoadAjaxCrossDomain(_iframe, cb, _len);
- });
- _parentel.appendChild(_iframe);
-
- if (loadingel) {
- U.UF.DL.loading(loadingel);
- }
- }
- catch (e) { }
- }
- }
-
- else {
-
- U.UF.CD.thirdPartyLoadAjaxCrossDomain(cb, loadingel);
- }
- }
- U.UF.CD.asynLoadAjaxCrossDomain = function (iframe, cb, len) {
- var _window = iframe.contentWindow;
- try {
- _window.name = iframe.id;
- }
- catch (e) { }
- len.length--;
-
- if (U.UF.C.isFunction(cb) && len.length == 0) {
- cb();
- }
- }
- U.UF.CD.thirdPartyLoadAjaxCrossDomain = function (cb, loading) {
- var _el,
- _parentel = U.selectEl("#usestudio_server")[0] || U.selectEl("body")[0];
-
- if (window["U_Domain"]) {
-
- if (window["U_Domain"].location.href == U.UF.CD.AJAXCROSSDOMAIN && U.UF.C.isFunction(cb)) {
- cb();
- }
- }
-
- else {
-
- _el = $$("iframe", {
- "id": "U_Domain",
- "name": "U_Domain",
- "width": 0,
- "height": 0,
- "style": {
- "display": "none"
- }
- }, _parentel);
-
- U.UF.DL.iframeLoad(_el, function () {
-
- if (U.UF.C.isFunction(cb)) {
- cb();
- }
- });
-
- if (loading) {
- U.UF.DL.loading(loading);
- }
- _el.src = U.UF.CD.AJAXCROSSDOMAIN;
- }
- }
- U.UF.CD.loadPageCrossDomain = function (cb, loading, b) {
- var _iframe;
-
- if (!$("#usestudio_server")[0]) {
-
- var _el = $$("div", { "id": "usestudio_server", "className": "usestudio_server", "__top__": "false" }, document.body);
-
- if (document.domain == "1473.cn") {
-
- _iframe = $$("iframe", { "width": 0, "height": 0, "style": { "display": "none" } }, U.selectEl("body")[0]);
-
- if (loading) {
- U.UF.DL.loading(loading);
- }
-
- U.UF.DL.iframeLoad(_iframe, U.UF.C.apply(null, function () {
- U.UF.CD.asynLoadPageCrossDomain(_iframe, loading, cb, b);
- }));
- _iframe.src = U.UF.CD.STATION;
- }
-
- else {
-
- _iframe = $$("iframe", { "id": "U_CDomain", "name": "U_CDomain", "width": 0, "height": 0, "style": { "display": "none" } }, document.body);
-
- U.UF.DL.iframeLoad(_iframe, function () {
-
- new U.UF.EV.message(function (arr) {
-
- U.selectEl(_iframe).remove();
-
- var _content = U.selectEl("#usestudio_server")[0];
- _content.outerHTML = arr;
-
- if (U.MD.D) {
- U.MD.D.Load(cb);
- }
-
- else if (U.UF.C.isFunction(cb)) {
- cb();
- }
- }, true, "pagedomain", "U_CDomain").post("", "pagedomain");
- });
- _iframe.src = U.UF.CD.PAGECROSSDOMAIN;
- }
- }
- else {
- cb();
- }
- }
- U.UF.CD.asynLoadPageCrossDomain = function (iframe, loading, cb, b) {
- var i,
- _js,
- _document,
- _html,
- _windows = iframe.contentWindow,
- _cookie = _windows.document.cookie.split("=");
- ;
- if (_cookie[1] == "") {
- U.UF.Cookie.del(_cookie[0]);
- }
-
- else {
- U.UF.Cookie.set(_cookie[2]);
- }
- var _content = U.selectEl("#usestudio_server")[0];
- _html = U.selectEl("#U_MD_Home", _windows.document)[0].outerHTML;
-
- try {
-
- _document = _windows.document.open();
- }
-
- catch (e) {
- _document = _windows.document;
- }
-
- _document.write = "";
- _document.close();
- U.selectEl(iframe).remove();
- _content.innerHTML = _html;
-
- _js = U.selectEl("script", _content);
- for (i = 0; i < _js.length; i++) {
- U.UF.DL.asynLoadJs({ src: _js[i].src, "charset": "utf-8", "type": "text/javascript" })
- }
-
- if (U.MD.D) {
- U.MD.D.Load(cb)
- }
-
- else {
- U.UF.CD.loadApplication(cb);
- }
- }
- U.UF.CD.loadApplication = function (cb) {
- if (document.domain == "1473.cn") {
- var _len = 4;
-
- var _fun = function () {
- _len--;
- if (_len == 0) {
- if (U.UF.C.isFunction(cb)) {
- cb();
- }
- }
- };
-
- U.UF.CD.loadUser(_fun);
-
- U.UF.CD.loadDisk(_fun);
-
- U.UF.CD.loadFriend(_fun);
-
- U.UF.CD.loadOffice(_fun);
- }
- else if (U.UF.C.isFunction(cb)) {
- cb();
- }
- }
- U.UF.CD.loadUser = function (cb) {
-
-
- var _iframe = $$("iframe", { "width": 0, "height": 0, "style": { "display": "none" } }, document.body);
-
- U.UF.DL.iframeLoad(_iframe, U.UF.C.apply(null, function () {
- U.UF.CD.asynLoadUser(_iframe, cb);
- }));
- _iframe.src = U.UF.CD.USERINDEX;
- }
- U.UF.CD.asynLoadUser = function (iframe, cb) {
- var i,
- _document,
- _html,
- _windows = iframe.contentWindow
- ;
- _html = U.selectEl("body", _windows.document)[0].innerHTML;
-
- try {
-
- _document = _windows.document.open();
- }
-
- catch (e) {
- _document = _windows.document;
- }
-
- _document.write = "";
- _document.close();
- U.selectEl(iframe).remove();
-
- if ($("#U_MD_Home")[0]) {
- U.selectEl("#U_MD_Home")[0].innerHTML += _html;
- }
- else {
- U.selectEl("body")[0].innerHTML = _html;
- }
- if (U.UF.C.isFunction(cb)) {
- cb();
- }
- }
- U.UF.CD.loadDisk = function (cb) {
-
- var _iframe = $$("iframe", { "width": 0, "height": 0, "style": { "display": "none" } }, U.selectEl("body")[0]);
-
- U.UF.DL.iframeLoad(_iframe, U.UF.C.apply(null, function () {
- U.UF.CD.asynLoadDisk(_iframe, cb);
- }));
- _iframe.src = U.UF.CD.DISKINDEX;
- }
- U.UF.CD.asynLoadDisk = function (iframe, cb) {
- var i,
- _document,
- _html,
- _windows = iframe.contentWindow
- ;
- _html = U.selectEl("body", _windows.document)[0].innerHTML;
-
- try {
-
- _document = _windows.document.open();
- }
-
- catch (e) {
- _document = _windows.document;
- }
-
- _document.write = "";
- _document.close();
- U.selectEl(iframe).remove();
- if ($("#U_MD_Home")[0]) {
- U.selectEl("#U_MD_Home")[0].innerHTML += _html;
- }
- else {
- U.selectEl("body")[0].innerHTML = _html;
- }
- if (U.UF.C.isFunction(cb)) {
- cb();
- }
- }
- U.UF.CD.loadFriend = function (cb) {
-
- var _iframe = $$("iframe", { "width": 0, "height": 0, "style": { "display": "none" } }, U.selectEl("body")[0]);
-
- U.UF.DL.iframeLoad(_iframe, U.UF.C.apply(null, function () {
- U.UF.CD.asynLoadFriend(_iframe, cb);
- }));
- _iframe.src = U.UF.CD.FRIENDINDEX;
- }
- U.UF.CD.asynLoadFriend = function (iframe, cb) {
- var i,
- _document,
- _html,
- _windows = iframe.contentWindow
- ;
- _html = U.selectEl("body", _windows.document)[0].innerHTML;
-
- try {
-
- _document = _windows.document.open();
- }
-
- catch (e) {
- _document = _windows.document;
- }
-
- _document.write = "";
- _document.close();
- U.selectEl(iframe).remove();
- if ($("#U_MD_Home")[0]) {
- U.selectEl("#U_MD_Home")[0].innerHTML += _html;
- }
- else {
- U.selectEl("body")[0].innerHTML = _html;
- }
- if (U.UF.C.isFunction(cb)) {
- cb();
- }
- }
- U.UF.CD.loadOffice = function (cb) {
-
- var _iframe = $$("iframe", { "width": 0, "height": 0, "style": { "display": "none" } }, U.selectEl("body")[0]);
-
- U.UF.DL.iframeLoad(_iframe, U.UF.C.apply(null, function () {
- U.UF.CD.asynLoadOffice(_iframe, cb);
- }));
- _iframe.src = U.UF.CD.OFFICEINDEX;
- }
- U.UF.CD.asynLoadOffice = function (iframe, cb) {
- var i,
- _document,
- _html,
- _windows = iframe.contentWindow
- ;
- _html = U.selectEl("body", _windows.document)[0].innerHTML;
-
- try {
-
- _document = _windows.document.open();
- }
-
- catch (e) {
- _document = _windows.document;
- }
-
- _document.write = "";
- _document.close();
- U.selectEl(iframe).remove();
- if ($("#U_MD_Home")[0]) {
- U.selectEl("#U_MD_Home")[0].innerHTML += _html;
- }
- else {
- U.selectEl("body")[0].innerHTML = _html;
- }
- if (U.UF.C.isFunction(cb)) {
- cb();
- }
- }
-
- ;
- Namespace.register("U.UF.D");
- U.UF.D.formatDateToArray = function (date) {
- var _datearr = [];
-
- if (typeof date == "string") {
- if (date.indexOf("Date") > -1) {
- date = new Date(parseInt(date.match(/[0-9]+/g)[0]));
- }
- else {
- date = new Date(date);
- }
- }
- return [
- date.getFullYear(),
- date.getMonth() + 1,
- date.getDate(),
- date.getHours(),
- date.getMinutes(),
- date.getSeconds()
- ];
- }
- U.UF.D.getYearMonthDay = function (date) {
- if (date) {
- var _date = U.UF.D.formatDateToArray(date);
- var _dates = _date.slice(0, 3).join("-");
- return _dates;
- }
- return "";
- }
- U.UF.D.getHoursMinutesSecond = function (date) {
- var _date = U.UF.D.formatDateToArray(date, true);
- var _dates = _date.slice(3, 6).join(":");
- return _dates;
- }
- U.UF.D.getFullTime = function (date) {
- var _date = U.UF.D.formatDateToArray(date, true);
- var _dates = _date.slice(0, 3).join("-") + " " + _date.slice(3, 6).join(":");
- return _dates;
- }
- U.UF.D.getDateInterval = function (date) {
- var _return,
- _nowTime = U.UF.D.formatDateToArray(new Date(), "Array"),
- _pastTime = U.UF.D.formatDateToArray(date, "Array");
- if (_nowTime[0] == _pastTime[0]) {
- if (_nowTime[2] - _pastTime[2] < 3 && _nowTime[1] == _pastTime[1]) {
- if (_nowTime[2] == _pastTime[2]) {
- if (_nowTime[3] == _pastTime[3]) {
- _return = _nowTime[4] - _pastTime[4] + '分钟前';
- } else {
- _return = _nowTime[3] - _pastTime[3] + '小时前';
- }
- } else {
- _return = _nowTime[2] - _pastTime[2] + '天前';
- }
- } else {
- _return = _pastTime[1] + '-' + _pastTime[2] + ' ' + _pastTime[3] + ':' + _pastTime[4] + '';
- }
- } else {
- _return = _pastTime[0] + '-' + _pastTime[1] + '-' + _pastTime[2] + ' ' + _pastTime[3] + ':' + _pastTime[4] + '';
- }
- return _return;
- }
- U.UF.D.toTimeStamp = function (uod) {
- var _timestamp;
- if (U.UF.C.isString(uod)) {
- _timestamp = Date.parse(uod);
- }
- else if (Array.isArray(uod)) {
- _timestamp = Date.UTC(uod[0], uod[1] - 1 || 1, uod[2] || 1, uod[3] - 8 || 1, uod[4] || 1, uod[5] || 1);
- }
- else if (U.UF.D.isDate(uod) || !uod) {
- _timestamp = Date.parse(uod || new Date());
- }
- return "/Date(" + _timestamp + ")/";
- }
- U.UF.D.getDayOfMonth = function (date) {
- var _arrDate = U.UF.D.formatDateToArray(date);
- var _date = new Date(_arrDate[0], _arrDate[1], 0);
- return _date.getDate();
- }
- U.UF.D.sizeComparison = function (date, date1) {
- var _date = U.UF.D.formatDateToArray(date),
- _date1 = U.UF.D.formatDateToArray(date1);
- for (var _i = 0; _i < _date.length; _i++) {
- if (_date[_i] > _date1[_i]) return true;
- if (_date1[_i] > _date[_i]) return false;
- }
- return 'equal';
- }
- U.UF.D.lowerToUpper = function (date) {
- var _i, _j,
- _dateArr = "",
- _dateWord = "",
- _word = [["零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"],
- ["", "十", "百", "千", "万", "亿", "兆"],
- ["年", "月", "日", "点", "分", "秒"]];
- !date ? date = new Date() : '';
- date = U.UF.D.formatDateToArray(date);
- for (_i = 0; _i < date.length; _i++) {
- _dateArr = String(date[_i]);
- if (_i == 1) {
- for (_j = 0; _j < _dateArr.length; _j++) {
- _dateWord += _word[0][_dateArr[_j]];
- }
- } else {
- if (Number(_dateArr) > 10) {
- _dateWord += _word[0][_dateArr[0]] + _word[0][10] + (_dateArr[1] == '0' ? '' : _word[0][_dateArr[1]]);
- } else {
- _dateWord += _word[0][_dateArr[0]];
- }
- }
- _dateWord += _word[2][_i];
- }
- return _dateWord;
- }
- U.UF.D.isDate = function (date) {
- return U.UF.C.isObject(date) && U.UF.C.objectToString(date) == "[object Date]";
- }
- ;
- Namespace.register("U.UF.DL");
- U.UF.DL.asynLoadJs = function (obj, fun) {
- var _head = U.selectEl("head");
-
- var _script = $$("script", obj);
-
- U.UF.DL.fileElementLoaded(_script, fun);
-
- _head.append(_script, 0, _head[0].firstChild);
- return _script;
- }
- U.UF.DL.asynLoadCss = function (obj, fun) {
- var _head = U.selectEl("head");
-
- var _link = $$("link", obj);
-
- U.UF.DL.fileElementLoaded(_link, fun);
-
- _head.append(_link, 0, _head[0].firstChild);
- return _link;
- }
- U.UF.DL.iframeLoad = function (obj, fun) {
- U.UF.DL.fileElementLoaded(obj, fun);
- }
- U.UF.DL.fileElementLoaded = function (obj, fun) {
-
- if (obj.onreadystatechange !== undefined) {
-
- obj.onreadystatechange = function () {
-
- if (obj.readyState == "complete") {
-
- obj.onreadystatechange = null;
-
- if (U.UF.C.isFunction(fun)) {
-
- fun.call(obj)
- }
- }
- }
- }
-
- else {
-
- obj.onload = function () {
-
- obj.onload = null;
-
- if (U.UF.C.isFunction(fun)) {
-
- fun.call(obj)
- }
- }
- }
- }
- U.UF.DL.loadStyle = function (csstext) {
-
- var _head = U.selectEl("head")[0];
- var _style = $$("style", {});
-
- if (_style.styleSheet) {
- _style.styleSheet.cssText = csstext;
- }
- else {
-
- _style.appendChild(document.createTextNode(csstext));
- }
- _head.appendChild(_style);
- document.body.offsetHeight;
- return _style;
- }
- U.UF.DL.loading = function (el) {
-
- if (el) {
-
-
-
-
-
-
-
-
-
- if (el.loadingel) {
- el.loadingel["P"]++;
- }
- else {
- if (U.UF.EL.offsetParent(el, true) != el) {
- el.postion = el.style.position;
- el.style.position = "relative";
- }
- var _lodingel = el.loadingel = $$("div", {
- "P": 0,
- "style": {
- "width": "100%",
- "height": "100%",
- "left": 0,
- "top": 0,
- "position": "absolute",
- "background-color": "#fff"
- }
- });
- var _loginimg = $$("div", {
- "style": {
- "display": "block",
- "z-index": "1000",
- "width": "37px",
- "height": "17px",
- "position": "absolute"
- }
- }, _lodingel);
- var _img = $$("img", { "src": "/img/Loading.gif" }, _loginimg);
- el.appendChild(_lodingel);
- _loginimg.style.left = ($(el)[0].offsetWidth - _loginimg.offsetWidth) / 2 + 'px';
- _loginimg.style.top = ($(el)[0].offsetHeight - _loginimg.offsetHeight) / 2 + 'px';
-
- }
- return _lodingel;
-
- }
- }
- U.UF.DL.uploading = function (el) {
- if (el && el.loadingel && el.loadingel["P"]-- == 0) {
-
- U.selectEl(el.loadingel).remove();
- el.style.position = el.postion;
- el.loadingel = null;
- }
- }
-
- ;
- Namespace.register("U.UF.E");
- U.UF.E.initEditor = function (el, synergy, content, stylestate) {
-
-
-
- if (content) {
-
- el.innerHTML = content;
- el.focus();
-
- if (!$("div", el)[0] || U.selectEl("div", el)[0].id.length != "37") {
- el.innerHTML = "";
- U.UF.E.textFormat(content, el);
- U.selectEl("div", el)[0].focus();
- }
-
-
-
- }
-
- else {
-
- var _div = $$("div", { "id": "e" + Guid.newGuid(), "innerHTML": content || "<span><br /></span>" }, el);
- el.focus();
- }
-
- U.UF.E.variable(el, synergy, stylestate);
-
- U.UF.E.key(el);
-
- U.UF.E.formatBrush(el, false);
-
- U.UF.E.picture.stretch(el);
-
- el.idarr = U.UF.E.key.getLineIdArr(el);
-
- el.editor.recordOpera = { "line": el.idarr }
- return U.UF.E.getRangeAt();
- }
- U.UF.E.variable = function (el, synergy, stylestate) {
- var _range = U.UF.E.getRangeAt();
-
- el.editor = {
- "isrecord": true,
- "idarr": [],
-
- "brushStyle": {
- "font-family": {},
- "font-size": {},
- "font-weight": {},
- "font-style": {},
- "text-decoration": {},
- "color": {},
- "backgroundColor": {}
- },
-
- "recordRangeStyle": {
- "font-family": "",
- "font-size": "",
- "font-weight": "",
- "font-style": "",
- "text-decoration": "",
- "color": "",
- "backgroundColor": ""
- },
- "styleState": stylestate,
- "maxWidth": U.selectEl(el)[0].offsetWidth,
- "operaNotice": synergy,
- "recordRange": _range,
- "recordHTML": "",
- "recordOpera": {},
- "dpi": U.UF.CI.getDPI()[0],
- "log": true,
- "recordsEditor": [],
- "recordsEditorIndex": 0
- };
- }
- U.UF.E.onpaste = function (e, editor, text) {
- var _content, event = e || window.event;
- if (text != undefined) {
- _text = text;
- }
- else {
- _text = U.UF.C.pasteText();
- }
- _content = _text.SplitAngleBrackets();
- if (_content && _content.length < 2) {
-
- _text = "<div>" + _text.replaceAngleBrackets().replace(/\r\n/g, "</div><div>").replace(/ /g, " ") + "</div>";
- }
-
- _text = _text.replace(/<(BR)[^<>]*>/ig, "</div></br><div>").replace(/ /g, " ");
- _text.trim() != "" && U.UF.E.textFormat(_text, editor);
- U.UF.EV.stopDefault();
- return _text.trim();
- }
- U.UF.E.textFormat = function (text, editor) {
- var _editor = editor || this.editor;
- var _range = U.UF.E.getRangeAt(),
- _div = $$("div", { "innerHTML": text, "style": { "display": "none" } }, U.selectEl("body")[0]),
- _frag = U.UF.E.unifiedFormat(_div);
- U.UF.E.insertContent(_frag, _range, _editor);
-
- var _table = U.selectEl('table', _editor);
-
- for (var i = _table.length - 1; i >= 0; i--) {
- U.UF.E.table.load(_table[i]);
- }
- U.selectEl(_div).remove();
- }
- U.UF.E.insertContent = function (el, range, editor) {
- range = range || U.UF.E.getRangeAt();
-
- if (window.getSelection) {
-
- var _i,
- _frag,
- _stylecsstext,
- _span,
- _child = el.childNodes,
- _lastchild,
- _extractcontent,
- _record,
- _focusel,
- _frag = $$("frag"),
- _startline = range.startContainer == editor ? editor.children[0] : U.UF.E.getLineElement(range.startContainer),
- _endline = range.endContainer == editor ? editor.children[0] : U.UF.E.getLineElement(range.endContainer),
- _selection = window.getSelection()
- ;
- if (editor.innerHTML == "") {
- _record = { addLine: [] };
- for (_i = 0; _i < _child.length;) {
- _record.addLine.push(_child[_i].id);
-
- editor.appendChild(_child[_i]);
- }
- U.UF.E.elementFocus(range, editor.children[0], true);
- editor.editor.recordHTML = editor.children[editor.children.length - 1].outerHTML;
- }
- else {
- _record = { updateLine: [_startline.id], addLine: [] };
-
- range.deleteContents();
- _selection.removeAllRanges();
-
-
-
- _lastchild = _endline.lastChild;
-
- if (_lastchild && (_lastchild.innerHTML != undefined || _lastchild.data != undefined)) {
- _stylecsstext = (_lastchild.style || _lastchild.parentNode.style).cssText;
- _focusel = _child[_child.length - 1].childNodes[_child[_child.length - 1].childNodes.length - 1] || _child[_child.length - 1];
-
- try {
- range.setEnd(_lastchild, _lastchild.innerHTML != undefined ? 1 : _lastchild.data.length);
- }
- catch (e) {
- range.setEnd(_lastchild, 0);
- }
- _extractcontent = range.extractContents();
-
- if (_extractcontent.childNodes.length == 1) {
-
- _frag = $$("frag");
- _span = $$("span", { "style": { "cssText": _stylecsstext }, "innerHTML": _extractcontent.textContent }, _frag);
-
- _extractcontent = _frag;
- }
-
- if (_extractcontent.childNodes[0] && _extractcontent.childNodes[0].tagName == "DIV") {
-
- for (_i = 0; _i < _extractcontent.childNodes[0].childNodes.length; _i) {
-
- _extractcontent.childNodes[0].childNodes[_i].style.cssText = _extractcontent.childNodes[0].style.cssText + ";" + _extractcontent.childNodes[0].childNodes[_i].style.cssText;
- _child[_child.length - 1].appendChild(_extractcontent.childNodes[0].childNodes[_i]);
- }
- }
-
- else {
- _child[_child.length - 1].appendChild(_extractcontent);
- }
-
- for (_i = 0; _i < el.childNodes[0].childNodes.length; _i) {
- _startline.appendChild(el.childNodes[0].childNodes[_i]);
- }
- }
-
- else if (_child[0]) {
-
- _startline.style.cssText += " " + U.UF.E.getRemainAttr(_child[0]);
-
- _startline.innerHTML = _child[0].innerHTML;
- _focusel = _startline;
- }
-
- for (_i = 1; _i < _child.length;) {
- _record.addLine.push(_child[_i].id);
-
- _frag.appendChild(_child[_i]);
- }
- U.selectEl(_startline.parentNode).append(_frag, 0, U.selectEl(_startline).next()[0]);
- U.UF.E.elementFocus(range, _focusel, true);
- var _focusline = U.UF.E.getLineElement(_focusel);
- if (_focusline != _startline) {
- editor.editor.recordRange = range;
- }
- editor.editor.recordHTML = _focusline.outerHTML;
- }
- U.UF.E.operationNotice(_record, editor);
- clearTimeout(editor.editor.interval);
- }
-
- else {
- range.pasteHTML(el.outerHTML);
- }
- };
- U.UF.E.elementFocus = function (range, el, islast) {
-
- if (window.getSelection) {
- var _selection = window.getSelection();
- range.selectNodeContents(el);
- _selection.removeAllRanges();
- _selection.addRange(range);
-
- if (islast) {
- range.collapse(false);
- }
- }
-
- else {
- range.moveToElementText(el);
- range.select();
- }
- };
- U.UF.E.createRnage = function () {
-
- if (window.getSelection) {
- return document.createRange();
- }
-
- else {
- return document.body.createTextRange();
- }
- }
- U.UF.E.getRangeAt = function (win) {
- var _selection,
- _range
- ;
- win = win || window;
-
- if (win.getSelection) {
- _selection = win.getSelection();
-
- if (_selection.rangeCount) {
- _range = _selection.getRangeAt(0);
- }
- }
-
- else {
- _selection = win.document.selection;
- _range = _selection.createRange();
- }
- return _range;
- };
- U.UF.E.addRange = function (str, range, islast) {
- range = range || U.UF.E.getRangeAt();
-
- if (window.getSelection) {
- var _selection = window.getSelection(),
- _frag = range.createContextualFragment(str);
- range.deleteContents();
- _selection.removeAllRanges();
- range.insertNode(_frag);
-
- if (islast) {
- range.collapse(false);
- }
- _selection.addRange(range);
- }
-
- else {
- range.select();
- range.pasteHTML(str);
-
- if (islast) {
- range.collapse(false);
- }
- }
-
- return U.UF.E.getRangeAt();
- };
- U.UF.E.getRangeElement = function (range) {
-
- if (range.commonAncestorContainer) {
- return range.commonAncestorContainer;
- }
-
- else {
-
- if (range.parentElement) {
- return range.parentElement();
- }
-
- else {
- return range.commonParentElement();
- }
- }
- };
- U.UF.E.reSelectRange = function (range) {
-
- if (window.getSelection) {
- var _selection = window.getSelection();
- _selection.removeAllRanges();
- _selection.addRange(range);
- }
-
- else {
- range.select();
- }
- };
- U.UF.E.setRangeStyle = function (attr, range, editor) {
- range = range || U.UF.E.getRangeAt();
- if (range.startContainer == range.endContainer && range.startOffset == range.endOffset) {
- return true;
- }
- var _i,
- _textstyle,
- _isdel,
- _start = range.startContainer,
- _end = range.endContainer,
- _startoffset = range.startOffset,
- _endoffset = range.endOffset,
- _startline = U.UF.E.getLineElement(_start),
- _endline = U.UF.E.getLineElement(_end),
- _frag = $$("frag")
- ;
- editor = editor || _startline.parentNode;
- if (!editor.editor) { return; }
- var _record = U.UF.E.getUpdateLine(_startline, _endline, editor);
-
- if (_startline != _endline) {
-
- var _rangselect = range.extractContents().childNodes;
-
- _start = _rangselect[0].childNodes[0];
-
- _textstyle = attr["text-decoration"] || attr["textDecoration"];
-
- U.UF.E.setStyle(attr, _rangselect[0], true);
- if (attr.cssText == "") {
- _startline.style.cssText = "";
- }
-
- while (_rangselect[0].childNodes[0]) {
- _startline.appendChild(_rangselect[0].childNodes[0]);
- }
-
- if (_textstyle) {
-
- _isdel = (attr["text-decoration"] || attr["textDecoration"] || "").indexOf(_textstyle) > -1 ? 1 : 0;
- attr["text-decoration"] = _textstyle;
- }
-
- for (_i = 1; _i < _rangselect.length - 1;) {
-
- U.UF.E.setStyle(attr, _rangselect[_i], _isdel);
- if (_textstyle) {
- attr["text-decoration"] = _textstyle;
- }
- if (attr.cssText == "") {
- _rangselect[_i].style.cssText = "";
- }
-
- _frag.appendChild(_rangselect[_i]);
- }
-
- U.UF.E.setStyle(attr, _rangselect[_rangselect.length - 1], _isdel);
-
- var _end = _rangselect[_rangselect.length - 1].childNodes[_rangselect[_rangselect.length - 1].childNodes.length - 1];
-
- while (_rangselect[_rangselect.length - 1].childNodes[0]) {
- U.selectEl(_endline).append(_rangselect[_rangselect.length - 1].childNodes[_rangselect[_rangselect.length - 1].childNodes.length - 1], 0, _endline.firstChild);
- }
- if (attr.cssText == "") {
- _endline.style.cssText = "";
- }
- range.insertNode(_frag);
- U.UF.E.setRange(_start, _end || _start, 0, 1, range);
- }
-
-
- else if (_start == _end && (_start.parentNode.tagName.toLowerCase() == "span" || _start.parentNode.tagName.toLowerCase() == "a")) {
- var _parentspan = _start.parentNode;
- var _tagname = _parentspan.tagName.toLowerCase() == "a" ? "a" : "span";
- var _startsplitel = U.UF.E.splitText(_start, _startoffset);
- var _endsplitel = U.UF.E.splitText(_startsplitel, _endoffset - _startoffset);
-
- if (_start.data) {
-
- var _span = $$(_tagname, {
- "style": { "cssText": U.UF.E.getRemainAttr(_parentspan) },
- "innerHTML": _start.data
- });
-
- if (_tagname == "a") {
- _span.href = _parentspan.href;
- }
-
- _parentspan.replaceChild(_span, _start);
- }
-
- var _rangspan = $$(_tagname, {
- "style": { "cssText": U.UF.E.getRemainAttr(_parentspan) },
- "innerHTML": _startsplitel.data
- });
-
- U.selectEl(_rangspan).css(U.UF.E.setSpecialAttr(_rangspan, attr));
-
- if (_tagname == "a") {
- _rangspan.href = _parentspan.href;
- }
-
- _parentspan.replaceChild(_rangspan, _startsplitel);
-
- if (_endsplitel.data) {
-
- var _span1 = $$(_tagname, {
- "style": { "cssText": U.UF.E.getRemainAttr(_parentspan) },
- "innerHTML": _endsplitel.data
- });
-
- if (_tagname == "a") {
- _span1.href = _parentspan.href;
- }
-
- _parentspan.replaceChild(_span1, _endsplitel);
- }
-
- for (i = 0; i < _parentspan.childNodes.length;) {
- _frag.appendChild(_parentspan.childNodes[i]);
- }
-
- _parentspan.parentNode.replaceChild(_frag, _parentspan);
-
- U.UF.E.setRange(_rangspan, _rangspan, 0, _startsplitel.data ? 1 : 0, range);
- }
-
- else if (_end == _start && _start.tagName && (_start.tagName.toLowerCase() == "span" || _start.tagName.toLowerCase() == "a")) {
-
- U.UF.E.getRemainAttr(_start);
-
- U.selectEl(_start).css(U.UF.E.setSpecialAttr(_start, attr));
- }
-
- else {
- var _rangselect = range.extractContents();
- U.UF.E.setStyle(attr, _rangselect, true);
- range.insertNode(_rangselect);
- }
-
- U.UF.E.operationNotice(_record, editor);
- };
- U.UF.E.getUpdateLine = function (startline, endline, edit) {
- var _record = { updateLine: [] };
-
- while (startline) {
- _record.updateLine.push(startline.id);
-
- if (startline != endline) {
- startline = startline.nextElementSibling;
- }
- else {
- startline = false;
- }
- }
-
- return _record;
- };
- U.UF.E.setStyle = function (attr, el, istop) {
- var _nowattr,
- _nowspan,
- _newspan,
- _textstyle = attr["text-decoration"] || attr["textDecoration"],
- _span = U.UF.E.getTagNameElement(el);
- var _spanText = _span && _span.innerHTML;
-
- if (_span && _spanText == el.data) {
- _nowattr = U.UF.E.setSpecialAttr(_span, attr);
- U.selectEl(_span).css(_nowattr);
- }
-
- else {
- var _rangselect = el.childNodes;
-
- for (var i = 0; i < _rangselect.length; i++) {
-
- if (istop === true && !i) {
- U.UF.E.setSpecialAttr(_rangselect[i], attr);
-
- istop = (attr["text-decoration"] || attr["textDecoration"] || "").indexOf(_textstyle) > -1 ? 1 : 0;
- }
-
- if (attr["text-decoration"] || attr["textDecoration"]) {
-
- if (istop === 1) {
-
- if (_rangselect[i].style && _rangselect[i].style["text-decoration"] && _rangselect[i].style["text-decoration"] != "inherit" && _rangselect[i].style["text-decoration"] != "none") {
-
- attr["text-decoration"] = _rangselect[i].style["text-decoration"].replace(_textstyle, "") + " " + _textstyle;
- }
-
- else {
- attr["text-decoration"] = _textstyle;
- }
- }
-
- else if (istop === 0) {
-
-
- if (_rangselect[i].style) {
-
-
- if (_rangselect[i].style["text-decoration"].indexOf(_textstyle) > -1) {
-
- attr["text-decoration"] = _rangselect[i].style["text-decoration"].replace(_textstyle, "");
-
- if (attr["text-decoration"] == "") {
- attr["text-decoration"] = "inherit";
- }
- }
-
- else {
- attr["text-decoration"] = _rangselect[i].style["text-decoration"];
- }
- }
-
- else {
- attr["text-decoration"] = "inherit";
- }
- }
- }
-
-
- if (_rangselect[i].tagName) {
- U.selectEl(_rangselect[i]).css(attr);
- }
-
- else if (_rangselect[i].nodeValue) {
-
- _newspan = $$("span", {
- "innerHTML": _rangselect[i].nodeValue,
- "style": attr
- });
-
- _rangselect[i].parentNode.replaceChild(_newspan, _rangselect[i]);
- }
- }
- }
- };
- U.UF.E.setSpecialAttr = function (element, attr) {
- var _key,
- _newvalue,
- _value;
- if (element.style) {
-
- for (_key in attr) {
- if (attr[_key] == "") {
- attr[_key] = "";
- }
- else {
-
- if (_key == "text-decoration" || _key == "textDecoration") {
-
- _value = element.style[_key];
-
- if (_value && _value != "inherit" && _value != 'none') {
-
- _newvalue = _value.replace(attr[_key], "");
-
- if (_newvalue == "") {
- attr[_key] = "inherit";
- }
-
- else if (_newvalue == _value) {
- attr[_key] = attr[_key] + " " + _value;
- }
-
- else {
- attr[_key] = _newvalue;
- }
- }
- }
-
- else if (attr[_key] == element.style[_key] && "font-weight|fontWeight|font-style|fontStyle|".indexOf(_key) > -1) {
- attr[_key] = "inherit";
- }
- }
- }
- }
-
- return attr;
- };
- U.UF.E.splitText = function (node, offset) {
-
- if (offset == node.nodeValue.length) {
- var next = document.createTextNode('');
- U.selectEl(node.parentNode).append(next, null, node);
- return next;
- }
- var retval = node.splitText(offset);
- return retval;
- };
- U.UF.E.getLineElement = function (el) {
- var _mel = el,
- _tagname = el.tagName ? el.tagName.toLowerCase() : "";
-
- while (el && _tagname != "body" && (_tagname != "div" || !(el.id && el.id.length == "37"))) {
- el = el.parentNode;
- if (el) {
- _tagname = el.tagName ? el.tagName.toLowerCase() : "";
- }
- };
- return (el && el.id) ? el : null;
- };
- U.UF.E.getTagNameElement = function (node, tagname) {
- tagname = tagname || 'span';
- while (node) {
- if (node.nodeName.toLocaleLowerCase() === tagname) {
- return node;
- } else if (node.nodeName.toLocaleLowerCase() === 'div' && !node.inline) {
- return null;
- }
- node = node.parentNode;
- }
- };
- U.UF.E.setLineStyle = function (style, range) {
- if ($('.U_UF_E_Picture_dragDot')[0]) {
- U.selectEl('.U_UF_E_Picture_dragDot')[0].style.display = "none";
- }
- range = range || U.UF.E.getRangeAt();
- var _rangeline,
- _start = range.startContainer
- _td = U.selectEl(_start).Parent({ "tagName": "TD" });
-
- if (_td && _td.tagName == "TD") {
- _rangeline = [_td];
- }
- else {
- _rangeline = U.UF.E.getRangeLineElement(range);
- }
- var i = 0;
- for (i = 0; i < _rangeline.length; i++) {
- U.selectEl(_rangeline[i]).css(style);
- }
- U.UF.E.reSelectRange(range);
- return range;
- };
- U.UF.E.getRangeLineElement = function (range) {
- range = range || U.UF.E.getRangeAt();
- var _start = range.startContainer,
- _end = range.endContainer,
- _stratline = U.UF.E.getLineElement(_start),
- _endline = U.UF.E.getLineElement(_end),
- _nextline = U.selectEl(_stratline).next()[0],
- _rangeline = [_stratline];
- if (_stratline != _endline) {
- while (_nextline) {
- _rangeline.push(_nextline);
- if (_nextline != _endline) {
- _nextline = U.selectEl(_nextline).next()[0];
- } else {
- _nextline = false;
- }
- }
- }
- return _rangeline;
- }
- U.UF.E.textAlign = function (direction) {
- U.UF.E.setLineStyle({ 'text-align': direction });
- };
- U.UF.E.setRange = function (startel, endel, start, end, range) {
- range = range || U.UF.E.getRangeAt();
-
- if (window.getSelection) {
-
- if (startel == endel && range.startContainer != startel) {
- range.selectNodeContents(startel);
- }
- range.setStart(startel, start);
- range.setEnd(endel, end);
- }
-
- else {
- var _range1 = document.body.createTextRange(),
- _range2 = document.body.createTextRange();
- _range1.moveToElementText(startel);
- _range1.moveStart("character", startel);
- _range2.moveToElementText(endel);
- _range2.moveStart("character", end);
- _range1.setEndPoint("EndToStart", _range2);
- _range1.select();
- range = _range1;
- }
- return range;
- }
- U.UF.E.unifiedFormat = function (el) {
- var _i,
- _float,
- _tagname,
- _removeTagName = ['head', 'meta', 'script', 'link', 'style', 'title'],
- _frag = $$("frag"),
- _div,
- _child = el.childNodes;
-
- U.UF.E.unifiedFormat.remove(el);
-
- for (_i = 0; _i < _child.length; _i++) {
- _display = _child[_i].currentStyle ? _child[_i].currentStyle.display : "";
- _tagname = _child[_i].tagName ? _child[_i].tagName.toLowerCase() : "";
- _float = _child[_i].currentStyle ? _child[_i].currentStyle.float : "";
-
- if (_child[_i].className == "U_MD_O_attachment") {
- U.selectEl(_child[_i]).appendTo(_frag);
- continue;
- }
-
- if (!_div || (_display != "" && _display != "inline") && (_float != "left" || _float != "right")) {
-
-
- _div = $$("div", { "id": "e" + Guid.newGuid(), "style": { "cssText": U.UF.E.getRemainAttr(_child[_i]) } }, _frag);
- }
-
- U.UF.E.unifiedFormat.next(_child[_i], true, _div);
- if (!_div.childNodes.length && _frag.childNodes.length > 1) {
- U.selectEl(_div).remove();
- }
- }
-
- return _frag;
- };
- U.UF.E.unifiedFormat.remove = function (el) {
- var _i,
- _tagname,
- _removeTagName = ['head', 'meta', 'script', 'link', 'style', 'title'],
- _child = el.childNodes;
-
- for (_i = 0; _i < _child.length; _i++) {
- _tagname = _child[_i].tagName ? _child[_i].tagName.toLowerCase() : "";
-
- if (_child[_i].nodeType === 8 || (_child[_i].nodeType == 3 && _child[_i].data.trim() == "")) {
- _child[_i].remove();
- _i--;
- continue;
- }
-
- if (_removeTagName.indexOf(_tagname) >= 0) {
- U.selectEl(_child[_i]).remove();
- _i--;
- continue;
- }
- }
- }
- U.UF.E.unifiedFormat.next = function (el, top, fragel) {
- var _i, _j,
- _float,
- _display,
- _tagname,
- _nowspan,
- _tdchild,
- _fraga = $$("frag"),
- _frag = fragel,
- _span,
- _childcsstext,
- _child = el.childNodes,
- _tagname = el.tagName ? el.tagName.toLowerCase() : "",
- _cssText = (top.style ? top.style.cssText : "") + ";" + fragel.style.cssText + (_tagname == "img" ? "" : U.UF.E.getRemainAttr(el));
-
- U.UF.E.unifiedFormat.remove(el);
-
- if (_child.length) {
-
- for (_i = 0; _i < _child.length; _i++) {
- _span = null;
-
- _childcsstext = _cssText + ";" + (_child[_i].tagName == "IMG" ? "" : U.UF.E.getRemainAttr(_child[_i]));
- _display = _child[_i].currentStyle ? _child[_i].currentStyle.display : "";
- _float = _child[_i].currentStyle ? _child[_i].currentStyle.float : "";
-
-
- if (_tagname == "b") {
- _childcsstext += ";font-weight: bold;";
- }
-
- else if (_tagname == "i") {
- _childcsstext += ";font-style: italic;";
- }
-
- else if (_tagname == "u") {
- _childcsstext += ";text-decoration: underline;";
- }
-
- else if (_tagname == "s") {
- _childcsstext += ";text-decoration: line-through;";
- }
-
- if (el.className == "U_MD_O_attachment_wrapper") {
- }
-
- else if (_tagname == "a" || (U.UF.C.isElement(top) && top.tagName == "A")) {
-
-
-
- _child[_i].name = _child[_i].name || top.name || el.name || "";
-
- _child[_i].href = _child[_i].href || top.href || el.href;
-
- _span = $$("a", {
- "name": _child[_i].name,
- "href": _child[_i].href || "javascript:void(0)",
- "style": { "cssText": _childcsstext }
- }, _fraga);
- }
-
- else if (_tagname == "style") {
- el = U.selectEl(el).clone(true);
- el.appendTo(_frag);
-
- arguments[2] = _frag = fragel = $$("div", {
- "id": "e" + Guid.newGuid(),
- "style": { "cssText": _childcsstext }
- }, fragel.parentNode);
- break;
- }
-
- else if (_tagname == "table") {
- if (_frag.innerHTML) {
-
- _span = $$("div", {
- "id": "e" + Guid.newGuid(),
- "style": { "cssText": _childcsstext }
- }, fragel.parentNode);
- }
- else {
- _span = _frag;
- }
-
- el = U.selectEl(el).clone(true);
-
- el.appendTo(_span);
-
- _tdchild = U.selectEl("td", el[0]);
-
- for (_j = 0; _j < _tdchild.length; _j++) {
- _tdchild[_j].innerHTML = _tdchild[_j].innerText;
- }
-
- arguments[2] = _frag = fragel = $$("div", {
- "id": "e" + Guid.newGuid(),
- "style": { "cssText": _childcsstext }
- }, fragel.parentNode);
- break;
- }
-
- else if ((_display != "" && _display != "inline") && (_float != "left" || _float != "right") && _child[_i].innerHTML.trim() != "") {
- if (_frag.innerHTML) {
-
- arguments[2] = _frag = fragel = $$("div", {
- "id": "e" + Guid.newGuid(),
- "style": { "cssText": _childcsstext }
- }, fragel.parentNode);
- }
- else {
- fragel.style.cssText += _childcsstext;
- }
- }
-
- else {
- _span = $$("span", { "style": { "cssText": _childcsstext } }, _fraga);
- }
-
- var _nowspan = U.UF.E.unifiedFormat.next(_child[_i], _span || top, fragel);
-
- if (_span) {
- if (_nowspan.children.length) {
-
- _fraga.replaceChild(_nowspan, _span);
- _frag.appendChild(_fraga);
- }
-
- else if (_nowspan.childNodes.length) {
- _span.appendChild(_nowspan);
- _frag.appendChild(_fraga);
- }
- else {
- U.selectEl(_span).remove();
- }
- }
- else if (_nowspan) {
-
- _fraga.appendChild(_nowspan);
- _frag.appendChild(_fraga);
- }
- }
- }
-
- else {
-
- if (top == true) {
- if (_tagname == "img") {
- var _img = U.selectEl(el).clone(true)[0];
- _img.style.maxWidth = "100%";
- _img.onerror = function () {
- this.src = "/img/editorError.png";
- this.width = 150;
- this.height = 112;
- }
- _span = $$("span", {
- "style": { "cssText": top.style.cssText },
-
- "innerHTML": el.innerHTML != null ? el.innerHTML : el.data
- });
- _span.appendChild(_img);
- _frag.appendChild(_span);
- }
- else {
-
- $$("span", {
- "style": { "cssText": _cssText },
-
- "innerHTML": el.innerHTML != null ? el.innerHTML : el.data
- }, _frag);
- }
- }
-
- else {
-
- if (el.data) {
- _fraga.appendChild(document.createTextNode(el.data));
- }
-
- else if (_tagname == "img") {
- var _img = U.selectEl(el).clone(true)[0];
- _img.style.maxWidth = "100%";
- _img.onerror = function () {
- this.src = "/img/editorError.png";
- this.width = 150;
- this.height = 112;
- }
- _span = $$("span", {
- "style": { "cssText": top.style.cssText },
-
- "innerHTML": el.innerHTML != null ? el.innerHTML : el.data
- });
- _span.appendChild(_img);
- _fraga.appendChild(_span);
- }
- }
- }
-
- return _fraga;
- };
- U.UF.E.getRemainAttr = function (ele) {
-
- if (!ele || !ele.style) {
- return '';
- }
-
- var _removeattr = ['position', 'width', 'height', 'background-image', 'border', 'min-height', 'float', 'min-width', 'display', 'padding', 'margin'];
- var _i;
-
- for (_i = 0; _i < _removeattr.length; _i++) {
-
- ele.style[_removeattr[_i]] = "";
- }
-
- return ele.style.cssText;
- };
- U.UF.E.clearStyle = function (range) {
- range = range || U.UF.E.getRangeAt();
- var _start = range.startContainer,
- _end = range.endContainer,
- _startline = U.UF.E.getLineElement(_start),
- _endline = U.UF.E.getLineElement(_end);
-
- if (_startline == _endline && range.toString() == _startline.innerText) {
- for (var i = 0; i < _startline.childNodes.length; i++) {
- if (_startline.childNodes[i].nodeName !== "#text") {
- _startline.childNodes[i].style.cssText = "font-family: 微软雅黑; font-weight: normal; font-size: 10.5pt; line-height: 2;";
- }
- }
- } else {
- U.UF.E.setRangeStyle({ "cssText": "" }, range);
- }
- U.UF.E.reSelectRange(range);
- };
- U.UF.E.addHref = function (el, range) {
- U.selectEl("#U_UF_E_herfAlert").remove();
- range = range || U.UF.E.getRangeAt();
- var _start = range.startContainer,
- _end = range.endContainer,
- _selectel = range.cloneContents(),
- _startline = U.UF.E.getLineElement(_start),
- _endline = U.UF.E.getLineElement(_end);
- el = el || U.UF.E.getTagNameElement(range.startContainer, "a");
-
- if (_startline !== _endline || U.selectEl('img', _selectel)[0]) {
-
- U.UF.UI.alertClick('选择范围横跨多个段落或存在图片,因此无法编辑');
- } else {
- var _box = $$('div');
- if (el) {
- _text = el.innerHTML;
- _href = el.href;
- var _textinput = $$('div', { innerHTML: '<span style="margin-right:7px;">文本</span> <input class="U_MD_O_H_Inputactive" placeholder="输入文本" value="' + _text + '" style="width:210px;height:25px;border:1px solid rgba(169,169,169,1);border-radius:2px;text-indent: 3px;" />', "style": { "line-height": "25px", "margin": "40px 41px 17px" } }, _box);
- var _hrefinput = $$('div', { innerHTML: '<span style="margin-right:7px;">链接</span> <input class="U_MD_O_H_Inputactive" placeholder="请输入网页链接地址" value="' + _href + '" style="width:210px;height:25px;border:1px solid rgba(169,169,169,1);border-radius:2px;text-indent: 3px;"/>', "style": { "margin": "0px 41px 27px", "line-height": "25px" } }, _box);
- U.UF.UI.confirm(_box, U.UF.C.closure(U.UF.E.addHref.confirm, [range, _hrefinput, _textinput, _text, el]));
- } else {
-
- _a = U.selectEl('a', _selectel)[0],
- _href = _a ? _a.href : '',
- _text = range.toString();
- var _textinput = $$('div', { innerHTML: '<span style="margin-right:7px;">文本</span> <input class="U_MD_O_H_Inputactive" placeholder="输入文本" value="' + _text + '" style="width:210px;height:25px;border:1px solid rgba(169,169,169,1);border-radius:2px;text-indent: 3px;"/>', "style": { "line-height": "25px", "margin": "40px 41px 17px" } }, _box);
- var _hrefinput = $$('div', { innerHTML: '<span style="margin-right:7px;">链接</span> <input class="U_MD_O_H_Inputactive" placeholder="请输入网页链接地址" value="http://' + _href + '" style="width:210px;height:25px;border:1px solid rgba(169,169,169,1);border-radius:2px;text-indent: 3px;"/>', "style": { "margin": "0px 41px 27px", "line-height": "25px" } }, _box);
- U.UF.UI.confirm(_box, U.UF.C.closure(U.UF.E.addHref.confirm, [range, _hrefinput, _textinput, _text]));
- }
- }
- };
- U.UF.E.addHref.excelConfirm = function (_cellList, hrefinput, textinput, text) {
- href = U.selectEl('input', hrefinput)[0].value;
- if (U.UF.S.Url.test(href)) {
- var _newtext = U.selectEl('input', textinput)[0].value;
-
- if (_cellList[0]) {
- $$('a', { href: href, innerHTML: _newtext, target: "_blank" }, _cellList[0]);
- _cellList[0].removeChild(_cellList[0].children[0]);
- } else {
- $$('a', { href: href, innerHTML: _newtext, target: "_blank" }, _cellList[0]);
- }
- }
- else {
-
- U.alert('输入的链接有误,无法添加');
- }
- };
- U.UF.E.addHref.confirm = function (range, hrefinput, textinput, text, el) {
- href = U.selectEl('input', hrefinput)[0].value;
- if (new RegExp(/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/).test(href)) {
- var _newtext = U.selectEl('input', textinput)[0].value;
- var _start = range.startContainer,
- _end = range.endContainer,
- _startspan = U.UF.E.getTagNameElement(_start, 'span'),
- _endspan = U.UF.E.getTagNameElement(_end, 'span');
- if (el) {
- el.innerHTML = _newtext;
- el.href = href;
- } else {
- var _frag = $$('frag');
- if (_newtext !== text) {
-
- _frag = $$('a', { href: href, innerHTML: _newtext, target: "_blank" });
- } else {
- var _selectel = range.extractContents(),
- _rangselect = _selectel.childNodes;
- var _text = _rangselect.innerHTML || _rangselect.data;
- if (_newtext.trim() == "") {
- $$('a', { href: href, innerHTML: href, style: { cssText: _startspan.style.cssText }, target: "_blank" }, _frag);
- } else {
- var i, _csstext;
-
- for (i = 0; i < _rangselect.length; i++) {
- if (_rangselect[i].nodeType == 3) {
- _csstext = i == _rangselect.length ? U.UF.E.getTagNameElement(_startspan, 'span').style.cssText : U.UF.E.getTagNameElement(_end, 'span').style.cssText;
- $$("a", { href: href, innerHTML: _rangselect[i].data, style: { cssText: _csstext }, target: "_blank" }, _frag);
- } else {
- $$("a", { href: href, innerHTML: _rangselect[i].innerHTML, style: { cssText: _rangselect[i].style.cssText }, target: "_blank" }, _frag);
- }
- }
- }
- }
- _frag = U.UF.E.unifiedFormat(_frag);
- _frag.firstChild.firstChild.setAttribute("target", "_blank");
- if (_startspan.innerHTML == "") {
- U.selectEl(_startspan).remove();
- }
- if (_endspan.innerHTML == "") {
- U.selectEl(_startspan).remove();
- }
- U.UF.E.insertContent(_frag, range, U.selectEl('#U_MD_O_H_wordEditor')[0]);
- }
- }
- else {
-
- U.alert('输入的链接有误,无法添加');
- return false;
- }
- };
- U.UF.E.addHref.click = function (e) {
- if (document.getElementById('U_UF_E_herfAlert')) {
- document.getElementById('U_UF_E_herfAlert').remove();
- }
- U.UF.EV.stopBubble(e);
- var parent = U.selectEl("#U_MD_O_R_Parent")[0];
- var _hyperlinkalert = $$('div', {
- id: "U_UF_E_herfAlert",
- style: {
- "min-width": "250px", "max-width": "360px", height: "34px", background: "rgba(255,255,255,1)", border: "1px solid rgba(243,243,243,1)", "box-shadow": "0px 5px 5px 0px rgba(45,45,45,0.1)",
- "border-radius": "2px", "line-height": "34px", "font-size": "12px", "font-family": "MicrosoftYaHei", "font-weight": "400", color: "rgba(48,126,209,1)", width: "fit-content",
- width: "-webkit-fit-content", width: "-moz-fit-content", position: "absolute", zIndex: "999"
- }
- }, parent);
- var _link = $$('a', {
- innerHTML: e.target.href,
- style: {
- "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap", cursor: "pointer",
- "max-width": "212px", "float": "left", "margin-left": "10px", "font-size": "14px"
- }
- }, _hyperlinkalert);
- var _rightButton = $$('div', { classname: "out_2", style: { "float": "right" } }, _hyperlinkalert);
- var _unlink = $$('div', { innerHTML: "取消链接", style: { "float": "left", "margin-left": "20px", "margin-right": "10px", cursor: "pointer" } }, _rightButton);
- var _modify = $$('div', { innerHTML: "修改", style: { "float": "left", "margin-left": "10px", "margin-right": "10px", cursor: "pointer" } }, _rightButton);
- _link.onclick = function () {
- U.UF.EV.stopBubble(e);
- parent.blur();
- window.open(e.target.href);
- }
- _unlink.onclick = function () {
- U.UF.EV.stopBubble(e);
- e.target.parentElement.replaceChild($$('span', { innerText: e.target.innerText }), e.target);
- _hyperlinkalert.remove();
- parent.blur();
- }
- _modify.onclick = function () {
- U.UF.EV.stopBubble(e);
- U.UF.E.addHref(e.target);
- parent.blur();
- _hyperlinkalert.remove();
- }
-
-
- console.log("超链接的位置", e.target.offsetLeft, e.target.offsetTop);
- console.log("光标的位置", e.clientX, e.clientY);
- console.log("滚动过的高度", U.selectEl('#U_MD_O_W_E_body')[0].offsetTop);
- var EditorScrollTop = U.selectEl('#U_MD_O_R_Parent')[0].parentNode.scrollTop;
- var EditorOffsetTop = U.selectEl('#U_MD_O_W_E_body')[0].offsetTop;
- _hyperlinkalert.style.left = e.clientX + "px";
- _hyperlinkalert.style.top = e.clientY + EditorScrollTop - EditorOffsetTop + 12 + "px";
- }
- U.UF.E.key = function (editor) {
- editor.editor.idarr = U.UF.E.key.getLineIdArr(editor);
-
- editor.onkeydown = function (e) {
- if (!editor.editor.recordOpera.range) {
- U.UF.E.recordRangeIndex(editor);
- }
- U.UF.E.key.keyDown(e, editor);
- };
-
- editor.onblur = function (e) {
- U.UF.E.key.blur(e, editor);
- };
-
- editor.onkeyup = function (e) {
- U.UF.E.key.keyUp(e, editor);
- };
-
- editor.onmouseup = function (e) {
- U.UF.E.key.keyUp(e, editor, true);
- };
- editor.onclick = function (e) {
- setTimeout(function () {
- U.UF.E.key.click(e, editor);
- }, 0);
- };
-
- editor.onmousedown = function (e) {
- setTimeout(function () {
- U.UF.E.recordRangeIndex(editor);
- }, 0);
- };
-
- editor.onpaste = function (e) {
- var _text = U.UF.E.onpaste(e, editor);
-
- if (!_text) {
- U.UF.E.pasteImage(e, editor);
- }
- };
- editor.ondragenter = U.UF.E.pasteImage.ignoreDrag;
- editor.ondragover = U.UF.E.pasteImage.ignoreDrag;
- editor.ondrop = U.UF.E.pasteImage.drop;
-
- };
- U.UF.E.key.click = function (e, edit) {
- var _nowel, _range = U.UF.E.getRangeAt(),
- _startel = U.UF.E.getLineElement(_range.startContainer)
- if (_startel != (_nowel = U.UF.E.getLineElement(edit.editor.recordRange.startContainer))) {
- edit.editor.recordHTML = _startel.outerHTML;
- }
- edit.editor.recordRange = _range;
- U.selectEl('#U_UF_E_herfAlert').remove();
- if (e.target.tagName == "A") {
- if (e.ctrlKey == true) {
- window.open(e.target.href);
- } else {
- U.UF.E.addHref.click(e);
- }
- }
- else if (e.target.tagName == "IMG" && e.target.offsetParent.className != "U_MD_F_D") {
- edit.imgStretch.img = e.target;
- U.UF.E.picture.stretch.setPosition(edit.imgStretch, e);
- } else {
- edit.imgStretch.stretch.style.display = "none";
- }
- }
- U.UF.E.key.blur = function (e, edit) {
- var _range = U.UF.E.getRangeAt();
- if (_range) {
- var _startel = U.UF.E.getLineElement(_range.startContainer);
- _oldstartel = U.UF.E.getLineElement(edit.editor.recordRange.startContainer);
- if (_startel) {
- edit.editor.recordRange = _range;
- edit.editor.recordHTML = _startel.outerHTML;
- edit.editor.log && console.log({ updateLine: [_startel.id] }, "在哪行失焦的");
- if (_oldstartel && _oldstartel.id != "U_MD_O_H_wordEditor" && _startel == _oldstartel && _oldstartel.outerHTML != edit.editor.recordHTML) {
- U.UF.E.operationNotice({ updateLine: [_startel.id] }, edit);
- clearTimeout(edit.editor.interval);
- }
- }
- }
- }
- U.UF.E.key.keyDown = function (e, edit) {
- var _range = U.UF.E.getRangeAt();
- if (!_range) { return; }
- var _el,
- _oldstartel,
- _line,
- _result,
- _startel = U.UF.E.getLineElement(_range.startContainer),
- _endel = U.UF.E.getLineElement(_range.endContainer);
- var _code = e.keyCode || e.which || e.charCode;
- if (_startel && _endel) {
- if (e.ctrlKey || e.metaKey) {
- edit.editor.recordRange = _range;
- switch (_code) {
- case 90:
- U.UF.E.key.undo(e, edit);
- return;
- case 89:
- U.UF.E.key.redo(e, edit);
- return;
- }
- }
-
- clearTimeout(edit.editor.interval);
-
- if (edit.childNodes.length == 0) {
- _result = U.UF.E.key.addDelLine(edit, _range);
-
- edit.editor.idarr = U.UF.E.key.getLineIdArr(edit);
-
- edit.editor.log && console.log(_result, "内容被情况默认添加行");
-
- edit.editor.recordRange = _range;
- edit.editor.recordHTML = U.UF.E.getLineElement(_range.startContainer).outerHTML;
-
- U.UF.E.operationNotice(_result, edit);
- return;
- }
-
- if (_code == 9) {
- _range.deleteContents();
- var _frag = $$("frag");
- var _fragel = $$('div', { innerHTML: " " });
- _frag.appendChild(_fragel.childNodes[0]);
- U.selectEl(_fragel).remove();
- _range.insertNode(_frag);
- U.UF.E.setRange(_range.endContainer, _range.endContainer, _range.endOffset, _range.endOffset, _range);
- U.UF.EV.stopDefault();
- return;
- }
-
- if (_code === 13) {
- if (!U.UF.E.getTagNameElement(_range.commonAncestorContainer, 'table')) {
- _result = U.UF.E.key.addLine(_range);
-
- edit.editor.idarr = U.UF.E.key.getLineIdArr(edit);
- U.UF.EV.stopDefault();
-
- edit.editor.log && console.log(_result, "更新换行的行,添加新的行");
-
- edit.editor.recordRange = _range;
- edit.editor.recordHTML = U.UF.E.getLineElement(_range.startContainer).outerHTML;
-
- U.UF.E.operationNotice(_result, edit);
- }
- }
- else {
- edit.editor.recordDownHTML = _startel.outerHTML;
- if (_startel == _endel && edit.editor.recordRange.endOffset != edit.editor.recordRange.startOffset) {
- setTimeout(U.UF.C.closure(function (startel, edit) {
- if (edit.editor.recordHTML != startel.outerHTML) {
- var _result = { updateLine: [_startel.id] };
- U.UF.E.operationNotice(_result, edit);
- edit.editor.log && console.log(_result, "存在选区的输入,即时更新");
- edit.editor.recordHTML = startel.outerHTML;
- edit.editor.recordRange = U.UF.E.getRangeAt();
- }
- }, [_startel, edit]), 0);
- clearTimeout(edit.editor.interval);
- }
- _line = U.UF.E.key.getLineIdArr(edit);
- _result = U.UF.E.diff(_line, edit.editor.idarr);
- edit.editor.idarr = _line;
-
- if (_result.deleteLine.length) {
- U.UF.E.operationNotice(_result, edit);
- edit.editor.log && console.log(_result, "未松开删除按钮时,删除了行");
- if (_result.updateLine[0]) {
- edit.editor.recordHTML = U.selectEl("#" + _result.updateLine[0])[0].outerHTML;
- edit.editor.recordRange = _range;
- }
- }
-
- else {
-
- edit.editor.interval = setTimeout(function () {
- if (edit.editor.recordHTML != _startel.outerHTML) {
-
- U.UF.E.operationNotice({ updateLine: [_startel.id] }, edit);
- edit.editor.log && console.log({ updateLine: [_startel.id] }, "超时更新行");
-
- edit.editor.recordRange = _range;
- edit.editor.recordHTML = _startel.outerHTML;
- }
- }, 1000);
- }
- }
- }
- };
- U.UF.E.key.keyUp = function (e, edit, click) {
- var _range = U.UF.E.getRangeAt();
- var _code = e.keyCode || e.which || e.charCode;
- if (e.ctrlKey == false) {
- U.selectEl(edit).removeClass('U_MD_O_ctrlPress');
- }
- if (_range) {
- var _line,
- _result,
- _oldstartel,
- _startel = U.UF.E.getLineElement(_range.startContainer),
- _endel = U.UF.E.getLineElement(_range.startContainer);
-
- if (edit.childNodes.length == 0) {
- _result = U.UF.E.key.addDelLine(edit, _range);
-
- edit.editor.idarr = U.UF.E.key.getLineIdArr(edit);
-
- edit.editor.log && console.log(_result, "内容被情况默认添加行");
-
- edit.editor.recordRange = _range;
- edit.editor.recordHTML = U.UF.E.getLineElement(_range.startContainer).outerHTML;
-
- U.UF.E.operationNotice(_result, edit);
- return;
- }
- _oldstartel = U.UF.E.getLineElement(edit.editor.recordRange.startContainer);
-
- if (_oldstartel && (_oldstartel != edit && _oldstartel != _startel || (_startel == _oldstartel && _startel.outerHTML != edit.editor.recordDownHTML))) {
- if (edit.editor.recordHTML != _oldstartel.outerHTML) {
- var _result = { "updateLine": [_oldstartel.id] };
- U.UF.E.operationNotice(_result, edit);
- edit.editor.log && console.log(_result, "光标切换且内容发送变化时");
- clearTimeout(edit.editor.interval);
- }
- edit.editor.recordRange = _range;
- edit.editor.recordHTML = _startel.outerHTML;
- }
- if (_code > 36 && _code < 41) {
- U.UF.E.recordRangeIndex(edit);
- }
- _line = U.UF.E.key.getLineIdArr(edit);
- _result = U.UF.E.diff(_line, edit.editor.idarr);
- edit.editor.idarr = _line;
-
- if (_result.deleteLine.length) {
- U.UF.E.operationNotice(_result, edit);
- edit.editor.log && console.log(_result, "删除了行");
- var _range = U.UF.E.getRangeAt();
- edit.editor.recordRange = _range;
- edit.editor.recordHTML = U.UF.E.getLineElement(_range.commonAncestorContainer).outerHTML;
- clearTimeout(edit.editor.interval);
- }
- U.UF.E.formatBrush(edit, false);
- }
- };
- U.UF.E.key.getLineIdArr = function (edit) {
- var _i,
- _arr = [];
-
- for (_i = 0; _i < edit.childNodes.length; _i++) {
-
- if (edit.childNodes[_i].tagName && edit.childNodes[_i].tagName.toLowerCase() === "div") {
-
- _arr.push({ "id": edit.childNodes[_i].id, "innerHTML": edit.childNodes[_i].outerHTML });
- }
- }
- return _arr;
- };
- U.UF.E.diff = function (arr1, arr2) {
- var temp = [];
- var temparray = [];
- var _i, _j;
- var _updateLine = [];
- for (_i = 0; _i < arr1.length; _i++) {
- temp[arr1[_i].id] = true;
- }
- for (_j = 0; _j < arr2.length; _j++) {
-
- if (!temp[arr2[_j].id]) {
- if (_updateLine.length == 0) {
- _updateLine.push(arr2[_j - 1].id);
- }
- temparray.push(arr2[_j].id);
- }
- }
- return {
- updateLine: _updateLine,
- deleteLine: temparray
- };
- }
- U.UF.E.key.addDelLine = function (edit, range) {
- var _range = range || U.UF.E.getRangeAt(),
- _el = $$("div", { id: edit.editor.idarr[0] ? edit.editor.idarr[0].id : "e" + Guid.newGuid(), innerHTML: "<span><br></span>" }, edit);
- _range.selectNodeContents(_el);
- _range.collapse(true);
- return { addLine: [_el.id] };
- }
- U.UF.E.key.addLine = function (range) {
- var _txtnode,
- _range = range || U.UF.E.getRangeAt(),
- _startline = U.UF.E.getLineElement(_range.startContainer),
- _el = $$('div', { id: "e" + Guid.newGuid(), style: { cssText: _startline.style.cssText } }),
- _result = {}
- ;
-
- if (_range.startOffset != _range.endOffset && _range.startContainer.innerHTML !== "<br>") {
- _range.deleteContents();
- }
- _range.setEnd(_startline, _startline.childNodes.length);
- _txt = _range.extractContents();
- if ($("img", _txt)[0]) {
- _txtnode = _txt;
- }
-
- else if (_txt.textContent.trim() === '') {
- _txtnode = $$('span', { style: { cssText: (_startline.lastChild && _startline.lastChild.style) ? _startline.lastChild.style.cssText : "" }, innerHTML: "<br>" });
- }
-
- else {
- _txtnode = _txt;
- }
-
- if (_startline.innerText == '' && !U.UF.E.validElement(_startline)) {
- var _clone = _txtnode.nodeName == "SPAN" ? _txtnode : U.selectEl('span', _txtnode)[0];
- var _content = _clone ? U.selectEl(_clone).clone()[0] : $$('span', { innerHTML: "<br>" });
- _content.innerHTML = "<br>";
- U.selectEl(_content).appendTo(_startline);
- }
- _el.appendChild(_txtnode);
- U.UF.E.insertAfter(_el, _startline);
- _range.selectNodeContents(_el);
- _range.collapse(true);
- _result.addLine = [_el.id];
- _result.updateLine = [_startline.id];
- return _result;
- };
- U.UF.E.validElement = function (el) {
- var i,
- _children = el.children,
- _valid = false;
- for (i = 0; i < _children.length; i++) {
- if (_children[i].nodeName == "BR") {
- continue;
- }
- else if (_children[i].nodeName == "IMG" || _children[i].innerText.length > 0 || ($('img', _children[i])[0] && _children[i].innerText.length == 0)) {
- _valid = true;
- }
- else {
- U.selectEl(_children[i]).remove();
- i--;
- }
- }
- return _valid;
- }
- U.UF.E.insertAfter = function (newEl, targetEl) {
-
- var parentEl = targetEl.parentNode;
-
- if (parentEl.lastChild === targetEl) {
-
- parentEl.appendChild(newEl);
- } else {
-
- parentEl.insertBefore(newEl, targetEl.nextSibling);
- }
-
- return newEl;
- };
- U.UF.E.formatBrush = function (el, pattern) {
- el = el || U.selectEl('#U_MD_O_H_wordEditor')[0];
- if (U.UF.E.formatBrush.callBack && U.UF.E.formatBrush.pattern) {
- U.UF.E.formatBrush.pattern = undefined;
- U.selectEl(el).bind('mouseup', U.UF.E.formatBrush.callBack);
- return;
- }
- var _style = pattern == false ? el.editor.recordRangeStyle : el.editor.brushStyle;
- var range = U.UF.E.getRangeAt();
-
- var _start = range.startContainer;
-
- if (_start.nodeName == "DIV") {
-
- if (!range.cloneContents().children[0]) {
- _style = {
- "font-family": "",
- "font-size": "",
- "font-weight": "",
- "font-style": "",
- "text-decoration": "",
- "color": "",
- "background-color": ""
- };
- pattern == false && (_style["text-align"] = "", _style["name"] = "");
- return;
- }
-
-
- }
-
- var _value;
- _start = _start.nodeType == 1 ? _start : _start.parentElement;
- for (var name in _style) {
-
- if (name == "font-size") {
- _value = (parseFloat(_start.currentStyle[name]) * 72 / el.editor.dpi).toFixed(1) + "pt";
- } else {
- _value = _start.currentStyle[name];
- }
- _style[name] = _value;
- }
- if (pattern !== false) {
- U.UF.E.formatBrush.pattern = pattern;
- if (pattern !== true) {
- U.selectEl(el).unbind("mouseup", U.UF.E.formatBrush.callBack);
- U.UF.E.formatBrush.callBack = function () {
- U.UF.E.fomatBrushNext(el);
- U.UF.E.formatBrush.pattern == undefined && U.selectEl(el).unbind("mouseup", U.UF.E.formatBrush.callBack);
- };
- U.selectEl(el).bind('mouseup', U.UF.E.formatBrush.callBack);
- }
- }
- else {
- _style["text-align"] = U.UF.E.getLineElement(_start).currentStyle.textAlign;
- _style["name"] = U.UF.E.getLineElement(_start).getAttribute('name');
- U.UF.C.isFunction(el.editor.styleState) && el.editor.styleState(el.editor.recordRangeStyle);
- }
- };
- U.UF.E.fomatBrushNext = function (el) {
- U.UF.E.setRangeStyle({ "cssText": '' });
-
- U.UF.E.setRangeStyle(el.editor.brushStyle);
- };
- U.UF.E.attachment = function (input, editor) {
- if (input.files.length) {
- var _range = U.UF.E.getRangeAt();
- U.UF.UP.inputUpload([input], 'http://disk.1473.cn/USUpfile.ashx?typename=UseStudioEditor&UserId=FA92AAC5-4134-449F-9659-0DC12F4F68E9', function (r) {
- var _file, _filetype, _input = r.context[0];
- var _imgtype = /.*(jpg|png|gif|jpeg|JPG|PNG|GIF|JPEG|bmp|BMP)$/;
- var _filearray = [];
- if (Object.prototype.toString.call(r.value[0]) != "[object Array]") {
- _filearray = [r.value];
- } else {
- _filearray = r.value;
- }
- var _el, _frag = $$('frag');
- for (i = 0; i < _filearray.length; i++) {
- _file = _input.files[i];
- _filetype = _file.name.substring(_file.name.lastIndexOf('.') + 1, _file.name.length);
- if (_filetype.match(_imgtype)) {
- _el = $$("div", {}, _frag);;
- $$('span', { innerHTML: ' <img src="http://fs.1473.cn/' + _filearray[i][0] + '">' }, _el);
- }
- else {
- _el = U.UF.E.attachment.create(_file, _filearray[i][0], _filetype);
- U.selectEl(_el).appendTo(_frag);
- }
- }
- _frag = U.UF.E.unifiedFormat(_frag);
- U.UF.E.insertContent(_frag, _range, editor || U.selectEl('#U_MD_O_H_wordEditor')[0]);
- }, [input]);
- }
- }
- U.UF.E.attachment.create = function (file, fileinfo, type) {
-
- var _attachment = $$("div", { className: "U_MD_O_attachment", id: "e" + Guid.newGuid(), contenteditable: "false" }),
- _wrapper;
- var _imgtype = /.*(jpg|png|gif|jpeg|bmp)$/;
-
- if (type.match(_imgtype)) {
- $$('span', { innerHTML: ' <img src="http://fs.1473.cn/' + fileinfo[0] + '">' }, _attachment);
- } else {
- var _videotype = /.*(mp4|avi|wmv|ogg|webm|mpg|mpeg)$/;
- var _musictype = /.*(mp3|wav|mid|midi)$/;
- $$("span", { innerHTML: "​" }, _attachment);
- _wrapper = $$("span", { contenteditable: "false" }, _attachment);
-
- if (type.match(_videotype)) {
- $$('video', { src: "http://fs.1473.cn/" + fileinfo, controls: "controls", style: { "width": "530px", "height": "300px" } }, _wrapper);
- }
-
- else if (type.match(_musictype)) {
- $$('audio', { src: "http://fs.1473.cn/" + fileinfo, controls: "controls" }, _wrapper);
- }
-
- else {
- _wrapper.className = "U_MD_O_attachment_wrapper";
- $$('span', { "className": "U_MD_O_attachment_wrapper_img", contenteditable: "false" }, _wrapper);
- var _info = $$("span", { className: "U_MD_O_attachment_fileinfo", contenteditable: "false" }, _wrapper);
- $$("span", { innerHTML: U.UF.E.attachment.fileNameSplice(file.name), contenteditable: "false" }, _info);
- $$("span", { innerHTML: U.UF.C.computeFileSize(file.size), contenteditable: "false" }, _info);
- $$("a", {
- "href": "/Pages/Download.htm?id=" + fileinfo[2],
- fileid: fileinfo[2],
- name: file.name,
- type: file.name.substring(file.name.lastIndexOf('.') + 1, file.name.length),
- target: "_blank",
- innerHTML: "打开",
- contenteditable: "false"
- }, _wrapper);
- }
- $$("span", { innerHTML: "​" }, _attachment);
- }
- return _attachment;
- }
- U.UF.E.attachment.fileNameSplice = function (name, maxlength) {
- maxlength = maxlength || 30;
- var i, _index = 0, _gblen = 0, _start = "", _end = "";
- for (i = 0; i < name.length; i++) {
- if (name.charCodeAt(i) > 127 || name.charCodeAt(i) == 94) {
- _gblen += 2;
- } else {
- _gblen++;
- }
- _gblen < maxlength / 2 - 2 && (_start += name[i]);
- }
- if (_gblen > maxlength) {
- i = name.length;
- while (_index < maxlength / 2 - 2) {
- if (name.charCodeAt(i) > 127 || name.charCodeAt(i) == 94) {
- _index += 2;
- } else {
- _index++;
- }
- _end = name[name.length - _index] + _end;
- i--;
- }
- name = _start + "..." + _end;
- }
- return name;
- }
- U.UF.E.picture = function (input, editor) {
- if (input.files.length) {
- var _range = U.UF.E.getRangeAt();
- U.UF.UP.inputUpload([input], 'http://disk.1473.cn/USUpfile.ashx?typename=UseStudioEditor&UserId=FA92AAC5-4134-449F-9659-0DC12F4F68E9', function (r) {
- var _input = r.context[0];
- var _imgarray = [];
- if (Object.prototype.toString.call(r.value[0]) != "[object Array]") {
- _imgarray = [r.value];
- } else {
- _imgarray = r.value;
- }
-
- var _img = '';
- for (i = 0; i < _imgarray.length; i++) {
-
- _img += '<span> <img src="http://fs.1473.cn/' + _imgarray[i][0] + '"> </span>';
- }
- U.UF.E.textFormat(_img, editor || U.selectEl('#U_MD_O_H_wordEditor')[0]);
- }, [input]);
- }
- }
- U.UF.E.pasteImage = function (e, editor) {
- e.preventDefault();
- var files = e.clipboardData.files;
- if (files.length && e.clipboardData.types.indexOf('Files') > -1) {
- var filebtn = $$('input', { type: "file" })
- filebtn.files = files;
- U.UF.E.picture(filebtn);
- filebtn.remove();
- }
- else {
- return true;
- }
- }
- U.UF.E.pasteImage.ignoreDrag = function (e) {
-
- e.stopPropagation();
- e.preventDefault();
- }
- U.UF.E.pasteImage.drop = function (e) {
-
- e.stopPropagation();
- e.preventDefault();
-
- var data = e.dataTransfer;
- var files = data.files;
-
- var filebtn = $$('input', { type: "file" })
- filebtn.files = files;
- U.UF.E.picture(filebtn, this);
- filebtn.remove();
- }
- U.UF.E.picture.stretch = function (el) {
- var _breadth = 12;
- if (!el.imgStretch) {
- var _img = $$("div", {
- style: { display: "none", border: "1px dashed #535353", position: "absolute", minWidth: "30px", minHeight: "30px" }
- }, document.body);
- var _csstext = "width:" + _breadth + "px; height:" + _breadth + "px;position:absolute;z-index:999;background:url('/EditorImage/yuan1.png') no-repeat";
- var _deviant = -_breadth / 2;
-
- el.imgStretch = {
-
- stretch: _img,
-
- nw: $$("div", { name: "nw", style: { cssText: _csstext, top: _deviant + "px", left: _deviant + "px", cursor: "nw-resize" } }, _img),
-
- ne: $$("div", { name: "ne", style: { cssText: _csstext, top: _deviant + "px", right: _deviant + "px", cursor: "ne-resize" } }, _img),
-
- sw: $$("div", { name: "sw", style: { cssText: _csstext, bottom: _deviant + "px", left: _deviant + "px", cursor: "sw-resize" } }, _img),
-
- se: $$("div", { name: "se", style: { cssText: _csstext, bottom: _deviant + "px", right: _deviant + "px", cursor: "se-resize" } }, _img),
-
- n: $$("div", { name: "n", style: { cssText: _csstext, top: _deviant + "px", left: "calc(50% - " + -_deviant + "px)", cursor: "n-resize" } }, _img),
-
- s: $$("div", { name: "s", style: { cssText: _csstext, bottom: _deviant + "px", left: "calc(50% - " + -_deviant + "px)", cursor: "s-resize" } }, _img),
-
- w: $$("div", { name: "w", style: { cssText: _csstext, left: _deviant + "px", top: "calc(50% - " + -_deviant + "px)", cursor: "w-resize" } }, _img),
-
- e: $$("div", { name: "e", style: { cssText: _csstext, right: _deviant + "px", top: "calc(50% - " + -_deviant + "px)", cursor: "e-resize" } }, _img),
-
- l: $$("div", { name: "l", style: { position: "absolute", cursor: "e-resize", left: "-1px", width: "3px", height: "100%" } }, _img),
-
- r: $$("div", { name: "r", style: { position: "absolute", cursor: "e-resize", right: "-1px", width: "3px", height: "100%" } }, _img),
-
- t: $$("div", { name: "t", style: { position: "absolute", cursor: "n-resize", top: "-1px", width: "100%", height: "3px" } }, _img),
-
- b: $$("div", { name: "b", style: { position: "absolute", cursor: "n-resize", bottom: "-1px", width: "100%", height: "3px" } }, _img),
- maxWidth: U.selectEl(el)[0].offsetWidth
- };
- }
-
- new U.UF.E.picture.stretch.bindEvent(el);
- };
- U.UF.E.picture.stretch.bindEvent = function (el) {
- this.el = el;
- this.init();
- }
- U.UF.E.picture.stretch.bindEvent.prototype = {
-
- init: function () {
- for (key in this.el.imgStretch) {
- key !== "stretch" && key !== "maxWidth" && this.el.imgStretch[key].addEventListener('mousedown', this.mouseDown.bind(this));
- }
- document.body.addEventListener('mousemove', this.mouseMove.bind(this));
- document.body.addEventListener('mouseup', this.mouseUp.bind(this));
- },
-
- mouseDown: function (e) {
- this.name = e.target.name;
- this.stratX = e.clientX;
- this.stratY = e.clientY;
- this.down = true;
- },
-
- mouseMove: function (e) {
- if (this.down) {
-
- var _moveX = e.clientX - this.stratX;
- var _moveY = this.stratY - e.clientY;
- var _click = this.name;
-
- window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty();
-
- if (_click.length == 2 || _click == "w" || _click == "e" || _click == "l" || _click == "r") {
-
- (_click == "w" || _click == "sw" || _click == "nw" || _click == "l") && (_moveX = -_moveX);
-
- U.UF.E.picture.stretch.moveX(this.el, this.el.imgStretch, _moveX);
- }
- if (_click.length == 2 || _click == "n" || _click == "s" || _click == "t" || _click == "b") {
-
- (_click == "n" || _click == "nw" || _click == "ne" || _click == "t") && (_moveY = -_moveY)
-
- U.UF.E.picture.stretch.moveY(this.el.imgStretch, _moveY);
- }
-
- this.stratX = e.clientX;
- this.stratY = e.clientY;
- }
- },
-
- mouseUp: function (e) {
- if (this.down) {
- var _imgstretch = this.el.imgStretch;
- _imgstretch.img.style.width = _imgstretch.stretch.offsetWidth + "px";
- _imgstretch.img.style.height = _imgstretch.stretch.offsetHeight + "px";
- U.UF.E.picture.stretch.setPosition(_imgstretch, e);
- this.down = false;
- }
- }
- }
- U.UF.E.picture.stretch.setPosition = function (obj, event) {
- var _stretch = obj.stretch;
- var _imgel = obj.img;
-
- _stretch.style.display = "block";
- var _imgelattr = _imgel.getBoundingClientRect();
- if (event.clientX == event.pageX && event.clientY == event.pageY) {
- _stretch.style.left = _imgelattr.left + "px";
- _stretch.style.top = _imgelattr.top + U.selectEl('body')[0].scrollTop + "px";
- } else {
- var _offset = U.UF.E.picture.parentOfferset(_imgel, { "offsetLeft": 0, "offsetTop": 0 });
- _stretch.style.left = _imgel.offsetLeft + _offset.offsetLeft + parseInt($(_imgel).css("padding-left")) + "px";
- _stretch.style.top = _imgel.offsetTop + _offset.offsetTop + parseInt($(_imgel).css("padding-top")) + "px";
- }
- _stretch.style.width = _imgelattr.width - 2 + "px";
- _stretch.style.height = _imgelattr.height - 2 + "px";
- var _objattr = _stretch.getBoundingClientRect();
- var _breadth = obj.n.offsetWidth / 2;
- obj.n.style.left = _objattr.width / 2 - _breadth + "px";
- obj.w.style.top = _objattr.height / 2 - _breadth + "px";
- obj.s.style.left = _objattr.width / 2 - _breadth + "px";
- obj.e.style.top = _objattr.height / 2 - _breadth + "px";
- }
- U.UF.E.picture.stretch.moveX = function (el, obj, moveX) {
- var _stretch = obj.stretch;
- if ((parseInt(_stretch.style.width) + moveX < obj.maxWidth && parseInt(_stretch.style.width) + moveX > 30)) {
- var _align = el.editor ? el.editor.recordRangeStyle["text-align"] : "";
- switch (_align) {
- case "end":
- case "right":
- _stretch.style.left = _stretch.offsetLeft - moveX + 'px';
- U.selectEl(_stretch)[0].style.width = parseInt(_stretch.style.width) + moveX + "px";
- break;
- case "center":
- _stretch.style.width = parseInt(_stretch.style.width) + moveX + 'px';
- _stretch.style.left = parseFloat(_stretch.style.left) - moveX / 2 + 'px';
- break;
- default:
- _stretch.style.width = parseInt(_stretch.style.width) + moveX + "px";
- }
- obj.n.style.left = obj.s.style.left = _stretch.offsetWidth / 2 - obj.s.offsetWidth / 2 + "px";
- }
- };
- U.UF.E.picture.stretch.moveY = function (obj, moveY) {
- var _stretch = obj.stretch;
-
- _stretch.style.height = _stretch.offsetHeight - 2 - moveY + "px";
-
- obj.w.style.top = obj.e.style.top = _stretch.offsetHeight / 2 - obj.w.offsetWidth / 2 + 'px';
- };
- U.UF.E.picture.parentOfferset = function (obj, json) {
- var _offset = {};
-
- if (obj.offsetParent.offsetLeft != 0) {
-
- _offset.offsetLeft = obj.offsetParent.offsetLeft;
- } else {
-
- _offset.offsetLeft = 0;
- }
-
- if (obj.offsetParent.offsetTop != 0) {
-
- _offset.offsetTop = obj.offsetParent.offsetTop;
- } else {
-
- _offset.offsetTop = 0;
- }
- json.offsetLeft = _offset.offsetLeft + json.offsetLeft;
- json.offsetTop = _offset.offsetTop + json.offsetTop;
-
- if (_offset.offsetTop == 0 && _offset.offsetLeft == 0) {
- return json;
- } else {
- return U.UF.E.picture.parentOfferset(obj.offsetParent, json);
- }
- }
- U.UF.E.editInfo = function (id, content, next) {
- var _data = {
- id: id,
- content: content,
- nextId: next
- };
- return _data;
- };
- U.UF.E.operationNotice = function (operaRecord, editor) {
- var _opera = {};
-
- if (operaRecord.addLine) {
- _opera.addLine = U.UF.E.addLineMessage(operaRecord.addLine, editor);
- }
-
- if (operaRecord.updateLine) {
- _opera.updateLine = U.UF.E.updateLineMessage(operaRecord.updateLine, editor);
- }
-
- if (operaRecord.deleteLine) {
- _opera.deleteLine = U.UF.E.deleteLineMessage(operaRecord.deleteLine, editor);
- }
-
- U.UF.E.setRecord(operaRecord, editor);
-
- if (U.UF.C.isFunction(editor.editor.operaNotice)) {
- editor.editor.operaNotice(_opera);
- }
- }
- U.UF.E.addLineMessage = function (array, edit) {
- var _i,
- _nextlineid,
- _el,
- _editinfo,
- _message = []
- ;
-
- for (_i = 0; _i < array.length; _i++) {
- _el = U.selectEl('#' + array[_i])[0];
- _nextlineid = (_nextlineid = U.selectEl('#' + array[_i])[0].nextElementSibling) ? _nextlineid.id : null;
- _editinfo = U.UF.E.editInfo(array[_i], _el.outerHTML, _nextlineid);
- _message.push(_editinfo);
- }
- return _message;
- };
- U.UF.E.updateLineMessage = function (array, edit) {
- var _i,
- _el,
- _editinfo,
- _message = [];
- for (_i = 0; _i < array.length; _i++) {
- _el = U.selectEl('#' + array[_i])[0];
- _editinfo = U.UF.E.editInfo(array[_i], _el.outerHTML, null);
- _message.push(_editinfo);
- }
- return _message;
- };
- U.UF.E.deleteLineMessage = function (array, edit) {
- var _i,
- _editinfo,
- _message = []
- ;
- for (_i = 0; _i < array.length; _i++) {
- _editinfo = U.UF.E.editInfo(array[_i], "", null);
- _message.push(_editinfo);
- }
- return _message;
- };
- U.UF.E.setRecord = function (opera, editor) {
- if (editor.editor.isrecord && editor.editor.recordOpera && editor.editor.recordOpera.range) {
- editor.editor.recordsEditor.splice(editor.editor.recordsEditorIndex, editor.editor.recordsEditor.length - editor.editor.recordsEditorIndex);
- editor.editor.recordsEditorIndex = editor.editor.recordsEditor.length;
-
- editor.editor.recordsEditor.push({
- "opera": opera,
- "recordLine": editor.editor.recordOpera
- });
- editor.editor.recordsEditorIndex++;
-
- editor.editor.recordOpera = { "line": U.UF.E.key.getLineIdArr(editor) };
- U.UF.E.recordRangeIndex(editor);
- }
- editor.editor.isrecord = true;
- }
- U.UF.E.recordRangeIndex = function (editor) {
-
- var _range = U.UF.E.getRangeAt();
- if (_range) {
- var _startel = U.UF.E.getLineElement(_range.startContainer),
- _endel = U.UF.E.getLineElement(_range.endContainer)
- ;
- if (_startel && _endel) {
-
- editor.editor.recordOpera.range = {
- "startid": _startel.id,
- "endid": _endel.id,
- "endOffset": _range.endOffset,
- "startOffset": _range.startOffset,
- "start": U.UF.E.getElementByAncestorsIndex(_startel, _range.startContainer),
- "end": U.UF.E.getElementByAncestorsIndex(_endel, _range.endContainer)
- };
- }
- }
- }
- U.UF.E.getElementByAncestorsIndex = function (el, childel) {
- var i, j, _child, _cindex;
-
- if (el !== childel) {
- _child = el.childNodes;
- for (i = 0; i < _child.length; i++) {
-
- if (_child[i] == childel) {
- _cindex = i;
- break;
- }
-
- else if (U.UF.EL.isChild(_child[i], childel)) {
- _child = _child[i].childNodes;
-
- for (j = 0; j < _child.length; j++) {
- if (_child[j] == childel) {
- _cindex = [i, j];
- break;
- }
- }
- }
- }
- }
- return _cindex;
- }
- U.UF.E.key.undo = function (e, editor) {
- var i, j, k,
- _info,
- _operarecord = {},
- _index = editor.editor.recordsEditorIndex - 1,
- _record,
- _line;
- if (_index > -1 && editor.editor.recordsEditor.length >= _index) {
- _record = editor.editor.recordsEditor[_index];
- _line = _record.recordLine.line;
-
- if (_record.recordLine) {
- for (i in _record.opera) {
- switch (i) {
-
- case "addLine":
-
- for (j = 0; j < _record.opera[i].length; j++) {
- U.UF.E.deleteEditorLine(_record.opera[i][j]);
- }
- break;
- case "updateLine":
-
- for (j = 0; j < _record.opera[i].length; j++) {
- U.UF.E.updateEditorLine({ "id": _record.opera[i][j], "content": U.UF.E.getLineContentById(_line, _record.opera[i][j]) });
- }
- break;
- case "deleteLine":
-
- for (j = 0; j < _record.opera[i].length; j++) {
- _info = U.UF.E.getLineInfoById(_line, _record.opera[i][j]);
- U.UF.E.addEditorLine({ "nextId": _info.next ? _info.next.id : null, "content": _info.info.innerHTML }, editor);
- }
- break;
- }
- }
- U.UF.E.setRecordRange(_record.recordLine.range);
-
- if (editor.editor.recordsEditor.length == _index + 1) {
- U.UF.E.setRecord(_record.opera, editor);
- }
- editor.editor.recordsEditorIndex--;
- editor.editor.isrecord = false;
- }
- }
-
- U.UF.EV.stopDefault();
- }
- U.UF.E.key.redo = function (e, editor) {
- var i, j, k,
- _info,
- _operarecord = {},
- _index = editor.editor.recordsEditorIndex,
- _record,
- _line;
- if (_index > -1 && _index < editor.editor.recordsEditor.length) {
- _record = editor.editor.recordsEditor[_index];
- _line = _record.recordLine.line;
-
- if (_record.recordLine) {
- for (i in _record.opera) {
- switch (i) {
-
- case "addLine":
-
- for (j = 0; j < _record.opera[i].length; j++) {
- _info = U.UF.E.getLineInfoById(_line, _record.opera[i][j]);
- U.UF.E.addEditorLine({ "nextId": _info.next ? _info.next.id : null, "content": _info.info.innerHTML }, editor);
- }
- break;
- case "updateLine":
-
- for (j = 0; j < _record.opera[i].length; j++) {
- U.UF.E.updateEditorLine({ "id": _record.opera[i][j], "content": U.UF.E.getLineContentById(_line, _record.opera[i][j]) });
- }
- break;
- case "deleteLine":
-
- for (j = 0; j < _record.opera[i].length; j++) {
- U.UF.E.deleteEditorLine(_record.opera[i][j]);
- }
- break;
- }
- }
- U.UF.E.setRecordRange(_record.recordLine.range);
- editor.editor.isrecord = false;
- editor.editor.recordsEditorIndex++;
- }
- }
-
- U.UF.EV.stopDefault();
- }
- U.UF.E.setRecordRange = function (range) {
- var _startel,
- _start,
- _endel,
- _end;
-
- if (range.startid && U.selectEl("#" + range.startid)[0]) {
- _start = range.startOffset;
-
- if (range.start.length) {
- _startel = U.selectEl("#" + range.startid)[0].childNodes[range.start[0]].childNodes[range.start[1]];
- }
- else {
- _startel = U.selectEl("#" + range.startid)[0].childNodes[range.start];
- }
- }
-
- if (range.endid && U.selectEl("#" + range.endid)[0]) {
- _end = range.endOffset;
-
- if (range.start.length) {
- _endel = U.selectEl("#" + range.endid)[0].childNodes[range.end[0]].childNodes[range.end[1]];
- }
- else {
- _endel = U.selectEl("#" + range.endid)[0].childNodes[range.end];
- }
- }
-
- U.UF.E.setRange(_startel, _endel, _start, _end)
- }
- U.UF.E.getLineContentById = function (line, id) {
- for (var i = 0; i < line.length; i++) {
- if (line[i].id == id) {
- return line[i].innerHTML;
- }
- }
- return "";
- }
- U.UF.E.getLineInfoById = function (line, id) {
- for (var i = 0; i < line.length; i++) {
- if (line[i].id == id) {
- return { "pre": line[i - 1], "next": line[i + 1], "info": line[i] }
- }
- }
- return null;
- }
- U.UF.E.updateEditorLine = function (opera) {
-
- if ($('#' + opera.id)[0]) {
- U.selectEl('#' + opera.id)[0].outerHTML = opera.content;
- }
- else {
- console.log('updateError', opera.id);
- }
- };
- U.UF.E.deleteEditorLine = function (opera) {
-
- U.selectEl('#' + opera.id).remove();
- };
- U.UF.E.addEditorLine = function (opera, editor) {
- editor = editor || U.selectEl('#U_MD_O_H_wordEditor')[0];
- var _next,
- _line = $$("div", {}, editor);
-
- if (opera.nextId && (_next = U.selectEl('#' + opera.nextId))[0]) {
- _next.Parent().insertBefore(_line, _next[0]);
- }
- U.selectEl(_line)[0].outerHTML = opera.content;
- }
-
- ;
- Namespace.register("U.UF.EL");
- U.UF.EL.getElementPosition = function (el) {
- var _key,
- _arr = [0, 0]
- while (el && (el = el.offsetParent)) {
- _key = U.UF.EL.getStyle(el, "position");
-
- if (_key != "static") {
- _arr[0] += el.offsetTop;
- _arr[1] += el.offsetLeft;
- }
- }
- return _arr;
- }
- U.UF.EL.getElementRealWidth = function (el) {
- var _offset;
-
- _offset = parseInt(Math.min(el.offsetWidth, el.scrollWidth, el.clientWidth));
-
- if (_offset <= 0) {
- _offset = parseInt(el.style.height);
- }
-
- return _offset;
- }
- U.UF.EL.getElementRealHeight = function (el) {
- var _offset;
-
- _offset = parseInt(Math.min(el.offsetHeight, el.scrollHeight, el.clientHeight));
-
- if (_offset <= 0) {
- _offset = parseInt(el.style.height);
- }
-
- return _offset;
- }
- U.UF.EL.getElementInfo = function (el) {
- var _elgetbc = el.getBoundingClientRect(),
- _elp = U.UF.EL.offsetParent(el);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- return {
- ancestorscrollbartop: (document.documentElement.scrollTop) + _elp.scrollTop,
- ancestorscrollbarleft: (document.documentElement.scrollLeft) + _elp.scrollLeft,
- SH: el.scrollHeight,
- SW: el.scrollWidth,
- SL: el.scrollLeft,
- ST: el.scrollTop,
- CH: el.clientHeight,
- CW: el.clientWidth,
- CT: el.clientTop,
- CL: el.clientLeft,
- OH: el.offsetHeight,
- OW: el.offsetWidth,
- OL: el.offsetLeft,
- OT: el.offsetTop,
- BCRH: _elgetbc.bottom - _elgetbc.top,
- BCRW: _elgetbc.right - _elgetbc.left,
- BCRT: _elgetbc.top,
- BCRL: _elgetbc.left,
- BCRB: _elgetbc.bottom,
- BCRR: _elgetbc.right
- }
- }
- U.UF.EL.offsetParent = function (el1, b, str) {
- var _str,
- _el1 = document.body;
-
- while (el1 && el1 != _el1) {
- _str = U.UF.EL.getStyle(el1, "position");
-
- if ((!str && _str != "static") || (_str == str)) {
- break;
- }
- el1 = el1.offsetParent;
- }
- return el1;
- }
- U.UF.EL.getAncestor = function (el, str) {
-
- while (el && !(el == str || el.id == str)) {
- el = el.parentNode;
- }
- return el;
- }
- U.UF.EL.getChildrenNoText = function (el, str) {
- var i,
- _arr = [];
- for (i = 0; i < el.length; i++) {
-
-
- if (el[i].nodeType == 1 && (!str || str.indexOf(el[i].tagName.toLowerCase()) == -1)) {
- _arr.push(el[i]);
- }
- }
- return _arr;
- }
- U.UF.EL.getAncestorEditElement = function (el) {
- var _el1 = document.body;
- while (el && _el1 != el) {
- if (el.tagName) {
-
-
- if ("textarea,input".indexOf(el.tagName.toLocaleLowerCase()) > -1 || el.contentEditable == "true") {
- break;
- }
- }
- el = U.selectEl(el).Parent();
- }
- return el;
- }
- U.UF.EL.isChild = function (el1, el2) {
-
- if (el1 && el2) {
-
- if (el1.contains) {
-
- if (el1.contains(el2)) {
- return true;
- }
- }
-
- else if (el1.compareDocumentPosition) {
-
- if (!(!!(el1.compareDocumentPosition(el2)))) {
- return true;
- }
- }
- }
- return false;
- }
- U.UF.EL.indexOfParent = function (el) {
- var _el = U.selectEl(el).Parent();
- var _el2 = U.selectEl(_el).Child();
- return _el2.indexOf(el);
- }
- U.UF.EL.isCustomAttributes = function (el, str) {
- el = el || $$("div");
- var _att = el.attributes;
-
- if (_att) {
-
- if (_att[str]) {
- return _att[str].expando == true;
- } else {
-
- return el.getAttribute(str) !== null || el[str] === void 0;
- }
- }
- }
- U.UF.EL.addAttributes = function (el, name, value) {
-
- el.setAttribute(name, value)
- }
- U.UF.EL.delAttributes = function (el, name) {
-
- if (el.hasAttribute(name)) {
- el.removeAttribute(name)
- }
- }
- U.UF.EL.getStyle = function (el, str) {
-
- if (el && el.style) {
- var _str = U.UF.EL.styleConversion(str);
-
- if (el.style[_str] || _str == "cssText") {
- return el.style[_str];
- } else {
-
- if (el.currentStyle) {
- return el.currentStyle[_str];
- } else {
- return "";
- }
- }
- return "";
- }
- }
- U.UF.EL.addClass = function (el, str) {
- var _Reg = el.className.match(new RegExp("(\\s|^)" + str + "(\\s|$)"));
- var _b = !!(_Reg);
- if (!_b) {
- el.className += " " + str;
- }
- }
- U.UF.EL.removeClass = function (el, str) {
- var _Reg = el.className.match(new RegExp("(\\s|^)" + str + "(\\s|$)"));
- var _b = !!(_Reg);
- if (_b) {
- el.className = el.className.replace(new RegExp("(\\s|^)" + str + "(\\s|$)"), " ").trim();
- }
- }
- U.UF.EL.isHasClass = function (el, str) {
-
- if ((el.className).indexOf(str) > -1) {
- return true;
- }
- return false;
- }
- U.UF.EL.styleConversion = function (el, str) {
- if (str) {
- str = [/[A-Z]/g, "-", 0, "toLowerCase"];
- }
- else {
- str = [/-[a-z ]/g, "", 1, "toUpperCase"];
- }
- return el.replace(str[0], function (el2) {
- return str[1] + el2.charAt(str[2])[str[3]]();
- });
- }
- U.UF.EL.getMousePosition = function (el) {
- var _eltop = 0, _elleft = 0,
- _mouseevent = event || window.event;
-
- if (_mouseevent.touches && _mouseevent.touches[0]) {
- _mouseevent = _mouseevent.touches[0];
- }
-
- else {
- _mouseevent = _mouseevent;
- }
-
- var _mousex = _mouseevent.clientX || 0,
- _mousey = _mouseevent.clientY || 0;
-
- while (el) {
- _elleft += el.offsetLeft;
- _eltop += el.offsetTop;
- el = el.offsetParent;
- }
-
- _elx = _mousex - _elleft,
- _ely = _mousey - _eltop;
- return { x: _elx, y: _ely }
- }
- U.UF.EL.rightMenu = function (arr, el, e) {
- var i, _menu;
- if ($("#U_UF_EL_rightmenu")[0]) {
- U.selectEl("#U_UF_EL_rightmenu")[0].remove();
- }
- _menu = $$("div", { "style": { "position": "fixed", "width": "150px", "border": "1px solid #e4e4e4", "backgroundColor": "White", "left": "100px", "display": "none", "z-index": "999" }, "id": "U_UF_EL_rightmenu" }, U.selectEl(el)[0]);
- for (i = 0; i < arr.length; i++) {
- var _div = $$('div', { "style": { "height": "25px", "lineHeight": "25px", "textAlign": "center", "width": "100%", "cursor": "pointer", "padding": "5px 0", "border-bottom": "1px solid rgb(228,228,228)" }, "className": "rightlist" }, _menu);
- U.selectEl(_div).addAttrArray(arr[i]);
- }
- U.selectEl(_menu)[0].style.display = "block";
- U.UF.C.rightClickMenuLocation($(_menu)[0]);
- e = e || window.event;
- var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
- var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
- var x = e.pageX || (e.clientX + scrollX);
- var y = e.pageY || (e.clientY + scrollY);
- var _top = _menu.offsetHeight;
- var _left = _menu.offsetWidth;
- if (_top > y) {
- _menu.style.top = y + "px";
- }
- if (_left > x) {
- _menu.style.left = x + "px";
- }
- U.selectEl(_menu).bind('contextmenu', function (e) {
- U.UF.EV.stopBubble(e);
- });
- }
- ;
- ;
- Namespace.register("U.UF.EV");
- U.UF.EV.systemEventBind = function (fun) {
- U.selectEl('body').bind(fun);
- U.UF.EV.systemEventBind, Array.push(fun);
- }
- U.UF.EV.boundProperties = function (obj, str, fun1, fun2) {
-
- if (obj.__defineGetter__) {
- obj.__defineGetter__ = (obj, fun1);
- obj.__defineSetter__ = (obj, fun2);
- } else if (Object.defineProperty) {
-
-
-
-
-
-
-
-
- Object.defineProperty(obj, str, { configurable: true, get: fun1, set: fun2 });
- } else {
- obj[str] = fun1;
- obj[str].toString = fun1;
-
- obj.attachEvent("onpropertychange", function () {
- if (event.propertyName == obj) {
-
-
- var _str = arguments.caller.caller;
- obj.detachEvent("onpropertychange", _str);
- fun2(obj[str]);
- obj[str] = fun1;
- obj[str].toString = fun2;
- obj.attachEvent("onpropertychange", _str);
- }
- });
- }
- }
- U.UF.EV.addPrototype = function (obj, str, fun) {
-
- if (typeof str == "string") {
- obj.prototype[str] = fun;
- } else {
- var i;
- for (i in str) {
- obj.prototype[i] = str[i];
- }
- }
- }
- U.UF.EV.scrollLoad = function (obj, fun) {
- obj.onscroll = function () {
- clearTimeout(U.UF.EV.scrollLoad.time);
- if (U.UF.EV.scrollLoad.scrollTop(obj) + U.UF.EV.scrollLoad.windowHeight(obj) >= (U.UF.EV.scrollLoad.documentHeight(obj))) {
- U.UF.EV.scrollLoad.time = setTimeout(fun, 100);
- }
- }
- }
- U.UF.EV.scrollLoad.scrollTop = function (obj) {
- return Math.max(
-
- U.selectEl(obj)[0].scrollTop,
-
- document.documentElement.scrollTop
- );
- }
- U.UF.EV.scrollLoad.documentHeight = function (obj) {
-
- return Math.max($(obj)[0].scrollHeight, document.documentElement.scrollHeight);
- }
- U.UF.EV.scrollLoad.windowHeight = function (obj) {
- return U.selectEl(obj)[0].clientHeight;
- }
- U.UF.EV.IsActivity = function (fun1, fun2) {
- var _timer;
-
- if (fun1) {
-
- U.selectEl(document.body).mouseenter(function () {
-
- if (_timer) {
- window.clearTimeout(_timer);
- }
- _timer = window.setTimeout(fun1);
- });
-
- U.UF.EV.addElementEvent("focusin", document, function () {
-
- if (_timer) {
- window.clearTimeout(_timer);
- }
- _timer = window.setTimeout(fun1);
- });
- }
-
- if (fun2) {
-
- U.UF.EV.addElementEvent("focusout", document, function () {
- var _clientx = event.clientX;
- var _clienty = event.clientY;
-
- if ((!(U.UF.CI.getBrowser().browser == "msie") ||
- (_clientx < 0 || _clientx > US.width || _clienty < 0 || _clienty > US.height))) {
- fun2();
- }
- });
- }
- }
- U.UF.EV.scrollToPosition = function (str, fun1, fun2) {
- var _isnumber = U.UF.C.isNumber(str);
-
- if (_isnumber && fun2) {
- U.selectEl(fun1).animate({ "scrollTop": str }, fun2);
- }
- else {
-
- if (typeof str == "number") {
- fun1.scrollTop = str;
- }
- else {
- str.scrollIntoView();
- }
- }
- }
- U.UF.EV.simulateMouseClicks = function (el, str) {
-
- if (el.fireEvent) {
- return el.fireEvent("on" + str, window.event);
- }
-
- else if (document.createEvent) {
- var _mousevent = document.createEvent("MouseEvents"),
- _event = window.event;
-
- if (_event) {
-
- _mousevent.initMouseEvent(
- str,
- true,
- true,
- window,
- _event.detail,
- _event.screenX,
- _event.screenY,
- _event.clientX,
- _event.clientY,
- _event.ctrlKey,
- _event.altKey,
- _event.shiftKey,
- _event.metaKey,
- _event.button,
- _event.relatedTarget
- );
- }
- else {
-
- _mousevent.initMouseEvent(
- str,
- true,
- true,
- document.defaultView,
- 0,
- 0,
- 0,
- 0,
- 0,
- false,
- false,
- false,
- false,
- 0,
- el
- )
- }
-
- return el.dispatchEvent(_mousevent);
- }
- }
- U.UF.EV.simulatePhoneTouch = function (el, str, obj) {
- if (el.fireEvent) {
- el.fireEvent("on" + TF);
- }
- else if (document.createEvent) {
- var i,
- _arr,
- _event = obj || window.event;
-
- if (TouchEvent) {
- var _touchevent = new TouchEvent(str, _event);
- }
-
- else {
- var _touchevent = document.createEvent("TouchEvent");
- }
-
- if (_touchevent.initTouchEvent) {
- var _str = "initTouchEvent";
- }
- else {
- var _str = "initEvent";
- }
-
- _arr = [
-
- [
- event.touches,
- event.targetTouches,
- event.changedTouches,
- str,
- event.view,
- event.screenX,
- event.screenY,
- event.clientX,
- event.clientY,
- event.ctrlKey,
- event.alrKey,
- event.shiftKey,
- event.metaKey
- ],
-
- [
- str,
- true,
- event.cancelable,
- event.view,
- event.detail,
- event.screenX,
- event.screenY,
- event.clientX,
- event.clientY,
- event.ctrlKey,
- event.altKey,
- event.shiftKey,
- event.metaKey,
- event.touches,
- event.targetTouches,
- event.changedTouches,
- event.scale,
- event.rotation
- ],
-
- [
- str,
- true,
- event.cancelable,
- event.view,
- event.detail,
- event.ctrlKey,
- event.altKey,
- event.shiftKey,
- event.metaKey,
- event.touches,
- event.targetTouches,
- event.changedTouches
- ],
- ];
-
- for (i = 0; i < _arr.length; i++) {
-
- try {
- _touchevent[_str].apply(_touchevent, _arr[i]);
- }
- catch (e) {
- }
- if (_touchevent.type == str) {
- break;
- }
- }
- }
- return el.dispatchEvent(_touchevent);
- }
- U.UF.EV.addElementEvent = function (str, el, fun, isbubble) {
- if (el.addEventListener) {
- el.addEventListener(str, fun, isbubble || false);
- }
- else if (el.attachEvent) {
- el.attachEvent("on" + str, fun);
- }
- else {
- el["on" + str] = function () {
- el["on" + str]();
- fun();
- }
- }
- }
- U.UF.EV.delElementEvent = function (str, el, fun, isbubble) {
- if (el.removeEventListener) {
- el.removeEventListener(str, fun, isbubble || false);
- }
- else if (el.detachEvent) {
- el.detachEvent("on" + str, fun);
- }
- else { el["on" + str] = null; }
- }
- U.UF.EV.getEventSource = function () {
- var i,
- _data,
- _frames = window.frames;
- var _event = window.event;
- if (!_event) {
- for (i = 0; i < _frames.length; i++) {
- _data = _frames[i];
-
- try {
- _event = _data.event;
-
- if (_event) {
- break;
- }
- }
- catch (e) { continue; };
- }
- }
-
- return _event;
- }
- U.UF.EV.stopBubble = function () {
- var _event = U.UF.EV.getEventSource();
-
- if (_event) {
-
- if (_event.stopPropagation) {
- _event.stopPropagation();
- }
-
- else {
- _event.cancelBubble = true;
- }
- }
- }
- U.UF.EV.stopBubbleMouseOutOrOver = function (el, cb) {
- if (event && "mouseover,mouseout".indexOf(event.type) > -1) {
- var _target = (event.type == "mouseover" ? event.fromElement : event.toElement) || event.relatedTarget,
- _bool = U.UF.EL.isChild(el, _target);
- if (!_bool && U.UF.C.isFunction(cb)) {
- cb();
- }
- return _bool;
- }
- }
- U.UF.EV.stopDefault = function (e) {
- var _event = e || window.event;
- if (_event) {
-
- if (document.all) {
- _event.returnValue = false;
- }
-
- else {
- _event.preventDefault();
- }
- return false;
- }
- }
- U.UF.EV.eventDelegation = function (cb, params, isremove, id) {
- if (isremove == null) {
- isremove = true;
- }
- var _id = id || "a" + Guid.newGuid();
- window[_id] = function () {
- try {
-
- if (U.UF.C.isFunction(cb)) {
- cb.apply(null, arguments);
- }
-
- if (this.isremove) {
- window[_id] = null;
- delete window[_id];
- }
- }
- catch (e) { }
- }
- return _id;
- }
- U.UF.EV.message = function (fun, issender, id, iframeid) {
- this.fun = fun;
- this.id = id || Guid.guidNoDash();
- this.sender = issender;
- this.iframeid = iframeid;
- this.iframe = null;
- this.url = "";
- U.UF.EV.message.callbacks[this.id] = this;
-
- if ("onmessage" in window) {
- U.UF.EV.addElementEvent("message", window, U.UF.EV.message.getDataAndCallBack);
- }
-
- if (this.sender) {
- this.iframe = U.selectEl("#" + this.iframeid)[0];
- this.url = $$("a", { "src": this.iframe.src }).host;
- }
-
- else if (!("onmessage" in window)) {
- U.UF.EV.message.getDataAndCallBack();
- }
- }
- U.UF.EV.message.callbacks = [];
- U.UF.EV.message.getDataAndCallBack = function (message) {
- var _data;
-
- if ("onmessage" in window) {
- _data = message.data;
- }
-
- else {
- _data = window.name;
- }
- _data = _data.parseJSON();
- var _fun = U.UF.EV.message.callbacks[_data[1]];
-
- if (_fun) {
- _fun.message(_data[0], _data[1], _data[2]);
- }
- }
- U.UF.EV.message.prototype = {
-
- message: function (data, id, cookie) {
-
- if (U.UF.C.isFunction(this.fun)) {
- this.fun(data, id, cookie);
- }
-
- if (this.sender && !("onmessage" in window)) {
- var _doc = this.obj.contentWindow.document;
- _doc.open();
- _doc.write("");
- _doc.close();
- }
- },
-
- post: function (data, id, cookie) {
- var _win,
- _message = U.UF.C.jsonToStr([data, id || this.id, cookie]);
-
- if ("onmessage" in window) {
- if (this.sender) {
-
- try {
- _win = this.iframe.contentWindow || this.iframe;
- }
- catch (e) {
- _win = this.iframe;
- }
- }
- else {
- _win = parent;
- }
- _win.postMessage(_message, "*");
- }
-
- else {
-
- if (this.sender) {
-
- U.UF.DL.iframeLoad(this.iframe, U.UF.C.apply(this, function () {
- this.iframe.contentWindow.name = _message;
- this.iframe.contentWindow.location.href = this.url;
-
- U.UF.DL.iframeLoad(this.iframe, U.UF.C.apply(this, function () {
- U.UF.EV.message.getDataAndCallBack();
- }));
- }));
- this.iframe.src = "about:blank";
- }
-
- else {
- window.name = _message;
- window.src = "about:blank";
- }
- }
- }
- }
- U.UF.EV.print = function (el) {
-
-
-
-
-
- var iframe = document.createElement('iframe');
- var doc = null;
- iframe.setAttribute('style', 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;');
- document.body.appendChild(iframe);
- doc = iframe.contentWindow.document;
- doc.write('<div>' + el.innerHTML + '</div>');
- doc.close();
- iframe.contentWindow.focus();
- iframe.contentWindow.print();
- if (navigator.userAgent.indexOf("MSIE") > 0) {
- document.body.removeChild(iframe);
- }
- }
- ;
- Namespace.register("U.UF.IMG");
- U.UF.IMG.imgReady = function (url, URD, ULD, UE) {
- var _UW,
- _UH,
- _UNW,
- _UNH,
- _UIMG = new Image();
- _UOR = function () {
- _UIMG = _UIMG || this;
- _UNW = _UIMG.width;
- _UNH = _UIMG.height;
- if ((_UNW !== _UW || _UNH !== _UH) || _UNH !== 0) {
- if (URD) { URD.call(_UIMG) };
- _UOR.end = true;
- }
- };
- U.selectEl(_UIMG).addAttrArray({
- "src": url,
- "onload": function () {
- setTimeout(function () {
- if (!_UOR.end) { _UOR() };
- if (_UIMG) { _UIMG.onload = _UIMG.onerror = null };
- if (_UIMG && ULD) { ULD.call(_UIMG) };
- _UIMG = null;
- }, 0);
- },
- "onerror": function () {
- if (U.UF.C.IsNetwork()) {
- if (UE) { UE.call(_UIMG) };
- }
- }
- });
- if (_UIMG) {
- _UOR();
- if (_UIMG.complete == true) {
- _UIMG.onload(); return;
- }
- }
- if (!_UOR.end) {
- U.UF.IMG.imgReady._UL.push(_UOR);
- if (U.UF.IMG.imgReady._UIT == null) {
- U.UF.IMG.imgReady._UIT = setInterval(U.UF.IMG.imgReady._URT, 40);
- }
- }
- return _UIMG;
- }
- U.UF.IMG.imgReady._UIT;
- U.UF.IMG.imgReady._UL = [];
- U.UF.IMG.imgReady._US = function () {
- clearInterval(U.UF.IMG.imgReady._UIT);
- U.UF.IMG.imgReady._UIT = null;
- };
- U.UF.IMG.imgReady._URT = function () {
- for (var i = 0; i < U.UF.IMG.imgReady._UL.length; i++) {
- U.UF.IMG.imgReady._UL[i].end ? U.UF.IMG.imgReady._UL.splice(i--, 1) : U.UF.IMG.imgReady._UL[i]();
- }
- if (!U.UF.IMG.imgReady._UL.length) { U.UF.IMG.imgReady._US() };
- }
- ;
- Namespace.register("U.Json");
- U.Json.init = function () {
- if (!window.JSON) {
- window.JSON = {
- stringify: U.Json.stringify,
- parse: U.Json.parse
- };
- }
- }
- U.Json.stringify = function (json) {
- return U.UF.C.jsonToStr(json);
- }
- U.Json.parse = function (str) {
- return str.parseJSON();
- }
- U.Json.ifExists = function (key1, key2) {
- if (key2 === key1) {
- return true;
- }
- for (var i in key1) {
- if (key1[i] != key2[i]) {
- return false;
- }
- }
- return true;
- }
- U.Json.add = function (obj1, obj2) {
- var i;
-
- if (!Array.isArray(obj1)) {
- for (i in obj2) {
- obj1[i] = obj2[i];
- }
- }
-
- else {
- for (i = 0; i < obj1.length; i++) {
- U.UF.C.AddObj(obj1[i], obj2);
- }
- }
-
- return obj1;
- }
- U.Json.find = function (obj, key, value) {
- }
- U.Json.del = function (obj, key, data) {
- data = data || obj;
- var i,
- _deldata,
- _delarray = [];
-
- if (Array.isArray(data)) {
- for (i = 0; i < data.length; i++) {
-
- _deldata = U.Json.del(obj, key, data[i]);
- if (_deldata.length) {
- data.splice(i, 1);
- _delarray = _delarray.concat(_deldata);
- i--;
- }
- }
- }
- else if (typeof data == "object") {
- if (U.Json.ifExists(key, data)) {
- delete data;
- _delarray.push(data);
- }
- else if (key === true) {
- for (i in data) {
- _deldata = U.Json.del(obj, key, data[i]);
- _delarray = _delarray.concat(_deldata);
- }
- }
- else if (key && data[key]) {
- _deldata = U.Json.del(obj, key, data[key]);
- _delarray = data.concat(_deldata);
- }
- }
- return _delarray;
- }
- U.Json.select = function (arr, obj, num) {
- var i,
- _bool,
- _res = [];
-
- if (Array.isArray(arr)) {
-
- for (i = 0; i < arr.length; i++) {
-
- _bool = true;
-
- for (var j in obj) {
-
- if (arr[i][j] != obj[j]) {
- _bool = false;
- }
- }
-
- if (_bool) {
- _res.push(arr[i]);
- }
-
- if (_res.length == num) {
- break;
- };
- }
- }
-
- return _res;
- }
- U.Json.selectOne = function (arr, obj) {
- return (U.Json.select(arr, obj, 1))[0];
- }
- U.Json.sort = function (arr, key, isreverse) {
- isreverse = isreverse || 1;
-
- arr = arr.sort(function (obj1, obj2) {
- var _value,
- _type,
- _value1 = obj1[key],
- _value2 = obj2[key],
- _isobj = U.UF.C.isObject(obj1);
-
- if (_isobj) {
- _type = (typeof (obj1[key] || obj2[key])).capitalizeFirstLetter();
- }
-
- else {
- _type = (typeof obj1).capitalizeFirstLetter();
- }
-
- if (_type == "Number") {
- _value = _value1 > _value2;
- }
-
- else if (_type == "Date") {
- _value = U.UF.D.SizeComparison(_value1, _value2);
- }
-
- else if (_type == "String") {
- _value = _value1.localeCompare(_value2) == 1;
- }
-
- else {
- _value = true;
- }
-
- _value = isreverse * (_value ? 1 : -1);
- return _value;
- });
- return arr;
- }
- U.Json.toKeyArray = function (arr, key) {
- var i,
- _returnarr = [];
-
- for (i = 0; i < arr.length; i++) {
- _returnarr.push(arr[i][key]);
- }
-
- return _returnarr;
- }
- U.Json.like = function (arr, obj, num) {
- var i,
- _bool,
- _res = [];
-
- if (Array.isArray(arr)) {
-
- for (i = 0; i < arr.length; i++) {
-
- _bool = false;
-
- for (var j in obj) {
-
- if (arr[i][j] && (arr[i][j].indexOf(obj[j]) > -1 || obj[j].indexOf(arr[i][j]) > -1)) {
- _bool = true;
- }
- }
-
- if (_bool) {
- _res.push(arr[i]);
- }
-
- if (_res.length == num) {
- break;
- };
- }
-
- return _res;
- }
- }
-
- ;
- Namespace.register("U.UF.Math");
- U.UF.Math.getRandom = function (n) {
- return Math.floor(Math.random() * n + 1);
- }
- U.UF.Math.randomRange = function (m, n) {
- return Math.floor(Math.random() * Math.abs(n - m)) + (m > n ? n : m);
- }
- U.UF.Math.sequence = function (arr, str, fun, num) {
- if (arr) {
- var _num;
- arr = arr.sort(function (obj1, obj2) {
- if (fun(obj1[str], obj2[str])) {
- _num = (-1) * (num || 1);
- } else {
- _num = 1 * (num || 1);
- }
- return _num;
- });
- return arr;
- };
- }
- U.UF.Math.floatOperate = function (number1, number2, operator) {
- var i,
- _pow,
- _strarr = [String(number1), String(number2)];
-
- for (i = 0; i < 2; i++) {
- _strarr[i + 2] = _strarr[i].length - _strarr[i].indexOf(".") - 1;
- }
-
- _pow = Math.pow(10, Math.max(_strarr[2], _strarr[3]));
-
- return (eval("0," + _strarr[0] * _pow + operator + _strarr[1] * _pow)) / _pow;
- }
- ;
- Namespace.register("U.UF.N");
- U.UF.N.goList = {};
- U.UF.N.route = null
- U.UF.N.createNav = function (str, bool) {
- var _obj = U.UF.N.goList;
-
- if (_obj[str] && bool !== true) {
- return _obj[str].context;
- }
- else {
- return new U.UF.N.initNav(str);
- }
- }
- U.UF.N.initNav = function (str) {
-
- this.cb = [];
- this.length = 0;
- this.context = this;
- U.UF.N.goList[str] = this;
- }
- U.UF.N.addEvent = function (callback, str) {
- var _goList = U.UF.N.createNav(str);
- _goList.addHandleEvent(callback);
- callback();
- }
- U.UF.N.addHandleEvent = function (callback) {
- this.cb.splice(this.length, this.cb.length - this.length, callback);
-
- this.length++;
- }
- U.UF.N.handle = function (num) {
- var _callback = this.cb[this.length - num * 2];
-
-
- if (_callback) {
- _callback();
- this.length += ((-num * 2) + 1);
-
-
- }
- }
- U.UF.N.backOff = function (str) {
- U.UF.N.goList[str]["context"].handle(1);
- }
- U.UF.N.goAhead = function (str) {
- U.UF.N.goList[str]["context"].handle(0);
- }
- U.UF.N.getLocation = function (str) {
- return {
- count: U.UF.N.goList[str].cb.length,
- now: U.UF.N.goList[str].length
- }
- }
- U.UF.N.initNav.prototype = {
- addEvent: U.UF.N.addEvent,
- addHandleEvent: U.UF.N.addHandleEvent,
- handle: U.UF.N.handle,
- backOff: U.UF.N.backOff,
- goAhead: U.UF.N.goAhead
- }
- U.UF.N.isActive = false;
- U.UF.N.route = function (fun) {
-
- if (document.all && !document.documentMode) {
-
- setInterval(function () { U.UF.N.changeHashCallBack(fun) }, 100);
- }
- else {
- window.onhashchange = function () { U.UF.N.changeHashCallBack(fun) };
- }
- }
- U.UF.N.addHash = function (hashname) {
- U.UF.N.setHash(hashname);
- }
- U.UF.N.setHash = function (id) {
- U.UF.N.isActive = true;
- location.hash = id;
-
- setTimeout(function () {
-
- U.UF.N.isActive = false;
- }, 10)
- }
- U.UF.N.getHash = function () {
- var _nowhash = location.hash;
- if (!_nowhash) {
- return '';
- }
- else {
- return location.hash;
- }
- }
- U.UF.N.changeHashCallBack = function (fun) {
-
- if (!U.UF.N.isActive) {
- var _newhash = U.UF.N.getHash();
- var _hash = _newhash.substr('1');
- if (_hash != "") {
- fun(_hash);
- }
- else if (_hash == "") {
- window.history.forward(1);
- }
- }
- }
-
- ;
- Namespace.register("U.UF.QR");
- U.UF.QR.generate = function (w, h, d, l, v, g) {
-
- g.innerHTML = "";
-
- var qrcode = new QRCode(g, {
- width: w,
- height: h,
- colorDark: d,
- colorLight: l,
- correctLevel: QRCode.CorrectLevel.H
- });
- U.UF.QR.makeCode = function (v) {
-
- qrcode.makeCode(v);
- }
- U.UF.QR.makeCode(v);
- }
- var QRCode;
- (function () {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- function QR8bitByte(data) {
- this.mode = QRMode.MODE_8BIT_BYTE;
- this.data = data;
- this.parsedData = [];
-
- for (var i = 0, l = this.data.length; i < l; i++) {
- var byteArray = [];
- var code = this.data.charCodeAt(i);
- if (code > 0x10000) {
- byteArray[0] = 0xF0 | ((code & 0x1C0000) >>> 18);
- byteArray[1] = 0x80 | ((code & 0x3F000) >>> 12);
- byteArray[2] = 0x80 | ((code & 0xFC0) >>> 6);
- byteArray[3] = 0x80 | (code & 0x3F);
- } else if (code > 0x800) {
- byteArray[0] = 0xE0 | ((code & 0xF000) >>> 12);
- byteArray[1] = 0x80 | ((code & 0xFC0) >>> 6);
- byteArray[2] = 0x80 | (code & 0x3F);
- } else if (code > 0x80) {
- byteArray[0] = 0xC0 | ((code & 0x7C0) >>> 6);
- byteArray[1] = 0x80 | (code & 0x3F);
- } else {
- byteArray[0] = code;
- }
- this.parsedData.push(byteArray);
- }
- this.parsedData = Array.prototype.concat.apply([], this.parsedData);
- if (this.parsedData.length != this.data.length) {
- this.parsedData.unshift(191);
- this.parsedData.unshift(187);
- this.parsedData.unshift(239);
- }
- }
- QR8bitByte.prototype = {
- getLength: function (buffer) {
- return this.parsedData.length;
- },
- write: function (buffer) {
- for (var i = 0, l = this.parsedData.length; i < l; i++) {
- buffer.put(this.parsedData[i], 8);
- }
- }
- };
- function QRCodeModel(typeNumber, errorCorrectLevel) {
- this.typeNumber = typeNumber;
- this.errorCorrectLevel = errorCorrectLevel;
- this.modules = null;
- this.moduleCount = 0;
- this.dataCache = null;
- this.dataList = [];
- }
- QRCodeModel.prototype = {
- addData: function (data) { var newData = new QR8bitByte(data); this.dataList.push(newData); this.dataCache = null; }, isDark: function (row, col) {
- if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) { throw new Error(row + "," + col); }
- return this.modules[row][col];
- }, getModuleCount: function () { return this.moduleCount; }, make: function () { this.makeImpl(false, this.getBestMaskPattern()); }, makeImpl: function (test, maskPattern) {
- this.moduleCount = this.typeNumber * 4 + 17; this.modules = new Array(this.moduleCount); for (var row = 0; row < this.moduleCount; row++) { this.modules[row] = new Array(this.moduleCount); for (var col = 0; col < this.moduleCount; col++) { this.modules[row][col] = null; } }
- this.setupPositionProbePattern(0, 0); this.setupPositionProbePattern(this.moduleCount - 7, 0); this.setupPositionProbePattern(0, this.moduleCount - 7); this.setupPositionAdjustPattern(); this.setupTimingPattern(); this.setupTypeInfo(test, maskPattern); if (this.typeNumber >= 7) { this.setupTypeNumber(test); }
- if (this.dataCache == null) { this.dataCache = QRCodeModel.createData(this.typeNumber, this.errorCorrectLevel, this.dataList); }
- this.mapData(this.dataCache, maskPattern);
- }, setupPositionProbePattern: function (row, col) { for (var r = -1; r <= 7; r++) { if (row + r <= -1 || this.moduleCount <= row + r) continue; for (var c = -1; c <= 7; c++) { if (col + c <= -1 || this.moduleCount <= col + c) continue; if ((0 <= r && r <= 6 && (c == 0 || c == 6)) || (0 <= c && c <= 6 && (r == 0 || r == 6)) || (2 <= r && r <= 4 && 2 <= c && c <= 4)) { this.modules[row + r][col + c] = true; } else { this.modules[row + r][col + c] = false; } } } }, getBestMaskPattern: function () {
- var minLostPoint = 0; var pattern = 0; for (var i = 0; i < 8; i++) { this.makeImpl(true, i); var lostPoint = QRUtil.getLostPoint(this); if (i == 0 || minLostPoint > lostPoint) { minLostPoint = lostPoint; pattern = i; } }
- return pattern;
- }, createMovieClip: function (target_mc, instance_name, depth) {
- var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth); var cs = 1; this.make(); for (var row = 0; row < this.modules.length; row++) { var y = row * cs; for (var col = 0; col < this.modules[row].length; col++) { var x = col * cs; var dark = this.modules[row][col]; if (dark) { qr_mc.beginFill(0, 100); qr_mc.moveTo(x, y); qr_mc.lineTo(x + cs, y); qr_mc.lineTo(x + cs, y + cs); qr_mc.lineTo(x, y + cs); qr_mc.endFill(); } } }
- return qr_mc;
- }, setupTimingPattern: function () {
- for (var r = 8; r < this.moduleCount - 8; r++) {
- if (this.modules[r][6] != null) { continue; }
- this.modules[r][6] = (r % 2 == 0);
- }
- for (var c = 8; c < this.moduleCount - 8; c++) {
- if (this.modules[6][c] != null) { continue; }
- this.modules[6][c] = (c % 2 == 0);
- }
- }, setupPositionAdjustPattern: function () {
- var pos = QRUtil.getPatternPosition(this.typeNumber); for (var i = 0; i < pos.length; i++) {
- for (var j = 0; j < pos.length; j++) {
- var row = pos[i]; var col = pos[j]; if (this.modules[row][col] != null) { continue; }
- for (var r = -2; r <= 2; r++) { for (var c = -2; c <= 2; c++) { if (r == -2 || r == 2 || c == -2 || c == 2 || (r == 0 && c == 0)) { this.modules[row + r][col + c] = true; } else { this.modules[row + r][col + c] = false; } } }
- }
- }
- }, setupTypeNumber: function (test) {
- var bits = QRUtil.getBCHTypeNumber(this.typeNumber); for (var i = 0; i < 18; i++) { var mod = (!test && ((bits >> i) & 1) == 1); this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod; }
- for (var i = 0; i < 18; i++) { var mod = (!test && ((bits >> i) & 1) == 1); this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod; }
- }, setupTypeInfo: function (test, maskPattern) {
- var data = (this.errorCorrectLevel << 3) | maskPattern; var bits = QRUtil.getBCHTypeInfo(data); for (var i = 0; i < 15; i++) { var mod = (!test && ((bits >> i) & 1) == 1); if (i < 6) { this.modules[i][8] = mod; } else if (i < 8) { this.modules[i + 1][8] = mod; } else { this.modules[this.moduleCount - 15 + i][8] = mod; } }
- for (var i = 0; i < 15; i++) { var mod = (!test && ((bits >> i) & 1) == 1); if (i < 8) { this.modules[8][this.moduleCount - i - 1] = mod; } else if (i < 9) { this.modules[8][15 - i - 1 + 1] = mod; } else { this.modules[8][15 - i - 1] = mod; } }
- this.modules[this.moduleCount - 8][8] = (!test);
- }, mapData: function (data, maskPattern) {
- var inc = -1; var row = this.moduleCount - 1; var bitIndex = 7; var byteIndex = 0; for (var col = this.moduleCount - 1; col > 0; col -= 2) {
- if (col == 6) col--; while (true) {
- for (var c = 0; c < 2; c++) {
- if (this.modules[row][col - c] == null) {
- var dark = false; if (byteIndex < data.length) { dark = (((data[byteIndex] >>> bitIndex) & 1) == 1); }
- var mask = QRUtil.getMask(maskPattern, row, col - c); if (mask) { dark = !dark; }
- this.modules[row][col - c] = dark; bitIndex--; if (bitIndex == -1) { byteIndex++; bitIndex = 7; }
- }
- }
- row += inc; if (row < 0 || this.moduleCount <= row) { row -= inc; inc = -inc; break; }
- }
- }
- }
- }; QRCodeModel.PAD0 = 0xEC; QRCodeModel.PAD1 = 0x11; QRCodeModel.createData = function (typeNumber, errorCorrectLevel, dataList) {
- var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel); var buffer = new QRBitBuffer(); for (var i = 0; i < dataList.length; i++) { var data = dataList[i]; buffer.put(data.mode, 4); buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber)); data.write(buffer); }
- var totalDataCount = 0; for (var i = 0; i < rsBlocks.length; i++) { totalDataCount += rsBlocks[i].dataCount; }
- if (buffer.getLengthInBits() > totalDataCount * 8) {
- throw new Error("code length overflow. ("
- + buffer.getLengthInBits()
- + ">"
- + totalDataCount * 8
- + ")");
- }
- if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) { buffer.put(0, 4); }
- while (buffer.getLengthInBits() % 8 != 0) { buffer.putBit(false); }
- while (true) {
- if (buffer.getLengthInBits() >= totalDataCount * 8) { break; }
- buffer.put(QRCodeModel.PAD0, 8); if (buffer.getLengthInBits() >= totalDataCount * 8) { break; }
- buffer.put(QRCodeModel.PAD1, 8);
- }
- return QRCodeModel.createBytes(buffer, rsBlocks);
- }; QRCodeModel.createBytes = function (buffer, rsBlocks) {
- var offset = 0; var maxDcCount = 0; var maxEcCount = 0; var dcdata = new Array(rsBlocks.length); var ecdata = new Array(rsBlocks.length); for (var r = 0; r < rsBlocks.length; r++) {
- var dcCount = rsBlocks[r].dataCount; var ecCount = rsBlocks[r].totalCount - dcCount; maxDcCount = Math.max(maxDcCount, dcCount); maxEcCount = Math.max(maxEcCount, ecCount); dcdata[r] = new Array(dcCount); for (var i = 0; i < dcdata[r].length; i++) { dcdata[r][i] = 0xff & buffer.buffer[i + offset]; }
- offset += dcCount; var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount); var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1); var modPoly = rawPoly.mod(rsPoly); ecdata[r] = new Array(rsPoly.getLength() - 1); for (var i = 0; i < ecdata[r].length; i++) { var modIndex = i + modPoly.getLength() - ecdata[r].length; ecdata[r][i] = (modIndex >= 0) ? modPoly.get(modIndex) : 0; }
- }
- var totalCodeCount = 0; for (var i = 0; i < rsBlocks.length; i++) { totalCodeCount += rsBlocks[i].totalCount; }
- var data = new Array(totalCodeCount); var index = 0; for (var i = 0; i < maxDcCount; i++) { for (var r = 0; r < rsBlocks.length; r++) { if (i < dcdata[r].length) { data[index++] = dcdata[r][i]; } } }
- for (var i = 0; i < maxEcCount; i++) { for (var r = 0; r < rsBlocks.length; r++) { if (i < ecdata[r].length) { data[index++] = ecdata[r][i]; } } }
- return data;
- }; var QRMode = { MODE_NUMBER: 1 << 0, MODE_ALPHA_NUM: 1 << 1, MODE_8BIT_BYTE: 1 << 2, MODE_KANJI: 1 << 3 }; var QRErrorCorrectLevel = { L: 1, M: 0, Q: 3, H: 2 }; var QRMaskPattern = { PATTERN000: 0, PATTERN001: 1, PATTERN010: 2, PATTERN011: 3, PATTERN100: 4, PATTERN101: 5, PATTERN110: 6, PATTERN111: 7 }; var QRUtil = {
- PATTERN_POSITION_TABLE: [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], G15: (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0), G18: (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0), G15_MASK: (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1), getBCHTypeInfo: function (data) {
- var d = data << 10; while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) { d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15))); }
- return ((data << 10) | d) ^ QRUtil.G15_MASK;
- }, getBCHTypeNumber: function (data) {
- var d = data << 12; while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) { d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18))); }
- return (data << 12) | d;
- }, getBCHDigit: function (data) {
- var digit = 0; while (data != 0) { digit++; data >>>= 1; }
- return digit;
- }, getPatternPosition: function (typeNumber) { return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1]; }, getMask: function (maskPattern, i, j) { switch (maskPattern) { case QRMaskPattern.PATTERN000: return (i + j) % 2 == 0; case QRMaskPattern.PATTERN001: return i % 2 == 0; case QRMaskPattern.PATTERN010: return j % 3 == 0; case QRMaskPattern.PATTERN011: return (i + j) % 3 == 0; case QRMaskPattern.PATTERN100: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0; case QRMaskPattern.PATTERN101: return (i * j) % 2 + (i * j) % 3 == 0; case QRMaskPattern.PATTERN110: return ((i * j) % 2 + (i * j) % 3) % 2 == 0; case QRMaskPattern.PATTERN111: return ((i * j) % 3 + (i + j) % 2) % 2 == 0; default: throw new Error("bad maskPattern:" + maskPattern); } }, getErrorCorrectPolynomial: function (errorCorrectLength) {
- var a = new QRPolynomial([1], 0); for (var i = 0; i < errorCorrectLength; i++) { a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0)); }
- return a;
- }, getLengthInBits: function (mode, type) { if (1 <= type && type < 10) { switch (mode) { case QRMode.MODE_NUMBER: return 10; case QRMode.MODE_ALPHA_NUM: return 9; case QRMode.MODE_8BIT_BYTE: return 8; case QRMode.MODE_KANJI: return 8; default: throw new Error("mode:" + mode); } } else if (type < 27) { switch (mode) { case QRMode.MODE_NUMBER: return 12; case QRMode.MODE_ALPHA_NUM: return 11; case QRMode.MODE_8BIT_BYTE: return 16; case QRMode.MODE_KANJI: return 10; default: throw new Error("mode:" + mode); } } else if (type < 41) { switch (mode) { case QRMode.MODE_NUMBER: return 14; case QRMode.MODE_ALPHA_NUM: return 13; case QRMode.MODE_8BIT_BYTE: return 16; case QRMode.MODE_KANJI: return 12; default: throw new Error("mode:" + mode); } } else { throw new Error("type:" + type); } }, getLostPoint: function (qrCode) {
- var moduleCount = qrCode.getModuleCount(); var lostPoint = 0; for (var row = 0; row < moduleCount; row++) {
- for (var col = 0; col < moduleCount; col++) {
- var sameCount = 0; var dark = qrCode.isDark(row, col); for (var r = -1; r <= 1; r++) {
- if (row + r < 0 || moduleCount <= row + r) { continue; }
- for (var c = -1; c <= 1; c++) {
- if (col + c < 0 || moduleCount <= col + c) { continue; }
- if (r == 0 && c == 0) { continue; }
- if (dark == qrCode.isDark(row + r, col + c)) { sameCount++; }
- }
- }
- if (sameCount > 5) { lostPoint += (3 + sameCount - 5); }
- }
- }
- for (var row = 0; row < moduleCount - 1; row++) { for (var col = 0; col < moduleCount - 1; col++) { var count = 0; if (qrCode.isDark(row, col)) count++; if (qrCode.isDark(row + 1, col)) count++; if (qrCode.isDark(row, col + 1)) count++; if (qrCode.isDark(row + 1, col + 1)) count++; if (count == 0 || count == 4) { lostPoint += 3; } } }
- for (var row = 0; row < moduleCount; row++) { for (var col = 0; col < moduleCount - 6; col++) { if (qrCode.isDark(row, col) && !qrCode.isDark(row, col + 1) && qrCode.isDark(row, col + 2) && qrCode.isDark(row, col + 3) && qrCode.isDark(row, col + 4) && !qrCode.isDark(row, col + 5) && qrCode.isDark(row, col + 6)) { lostPoint += 40; } } }
- for (var col = 0; col < moduleCount; col++) { for (var row = 0; row < moduleCount - 6; row++) { if (qrCode.isDark(row, col) && !qrCode.isDark(row + 1, col) && qrCode.isDark(row + 2, col) && qrCode.isDark(row + 3, col) && qrCode.isDark(row + 4, col) && !qrCode.isDark(row + 5, col) && qrCode.isDark(row + 6, col)) { lostPoint += 40; } } }
- var darkCount = 0; for (var col = 0; col < moduleCount; col++) { for (var row = 0; row < moduleCount; row++) { if (qrCode.isDark(row, col)) { darkCount++; } } }
- var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5; lostPoint += ratio * 10; return lostPoint;
- }
- }; var QRMath = {
- glog: function (n) {
- if (n < 1) { throw new Error("glog(" + n + ")"); }
- return QRMath.LOG_TABLE[n];
- }, gexp: function (n) {
- while (n < 0) { n += 255; }
- while (n >= 256) { n -= 255; }
- return QRMath.EXP_TABLE[n];
- }, EXP_TABLE: new Array(256), LOG_TABLE: new Array(256)
- }; for (var i = 0; i < 8; i++) { QRMath.EXP_TABLE[i] = 1 << i; }
- for (var i = 8; i < 256; i++) { QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] ^ QRMath.EXP_TABLE[i - 5] ^ QRMath.EXP_TABLE[i - 6] ^ QRMath.EXP_TABLE[i - 8]; }
- for (var i = 0; i < 255; i++) { QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i; }
- function QRPolynomial(num, shift) {
- if (num.length == undefined) { throw new Error(num.length + "/" + shift); }
- var offset = 0; while (offset < num.length && num[offset] == 0) { offset++; }
- this.num = new Array(num.length - offset + shift); for (var i = 0; i < num.length - offset; i++) { this.num[i] = num[i + offset]; }
- }
- QRPolynomial.prototype = {
- get: function (index) { return this.num[index]; }, getLength: function () { return this.num.length; }, multiply: function (e) {
- var num = new Array(this.getLength() + e.getLength() - 1); for (var i = 0; i < this.getLength(); i++) { for (var j = 0; j < e.getLength(); j++) { num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i)) + QRMath.glog(e.get(j))); } }
- return new QRPolynomial(num, 0);
- }, mod: function (e) {
- if (this.getLength() - e.getLength() < 0) { return this; }
- var ratio = QRMath.glog(this.get(0)) - QRMath.glog(e.get(0)); var num = new Array(this.getLength()); for (var i = 0; i < this.getLength(); i++) { num[i] = this.get(i); }
- for (var i = 0; i < e.getLength(); i++) { num[i] ^= QRMath.gexp(QRMath.glog(e.get(i)) + ratio); }
- return new QRPolynomial(num, 0).mod(e);
- }
- }; function QRRSBlock(totalCount, dataCount) { this.totalCount = totalCount; this.dataCount = dataCount; }
- QRRSBlock.RS_BLOCK_TABLE = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]]; QRRSBlock.getRSBlocks = function (typeNumber, errorCorrectLevel) {
- var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel); if (rsBlock == undefined) { throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel); }
- var length = rsBlock.length / 3; var list = []; for (var i = 0; i < length; i++) { var count = rsBlock[i * 3 + 0]; var totalCount = rsBlock[i * 3 + 1]; var dataCount = rsBlock[i * 3 + 2]; for (var j = 0; j < count; j++) { list.push(new QRRSBlock(totalCount, dataCount)); } }
- return list;
- }; QRRSBlock.getRsBlockTable = function (typeNumber, errorCorrectLevel) { switch (errorCorrectLevel) { case QRErrorCorrectLevel.L: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0]; case QRErrorCorrectLevel.M: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1]; case QRErrorCorrectLevel.Q: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2]; case QRErrorCorrectLevel.H: return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3]; default: return undefined; } }; function QRBitBuffer() { this.buffer = []; this.length = 0; }
- QRBitBuffer.prototype = {
- get: function (index) { var bufIndex = Math.floor(index / 8); return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) == 1; }, put: function (num, length) { for (var i = 0; i < length; i++) { this.putBit(((num >>> (length - i - 1)) & 1) == 1); } }, getLengthInBits: function () { return this.length; }, putBit: function (bit) {
- var bufIndex = Math.floor(this.length / 8); if (this.buffer.length <= bufIndex) { this.buffer.push(0); }
- if (bit) { this.buffer[bufIndex] |= (0x80 >>> (this.length % 8)); }
- this.length++;
- }
- }; var QRCodeLimitLength = [[17, 14, 11, 7], [32, 26, 20, 14], [53, 42, 32, 24], [78, 62, 46, 34], [106, 84, 60, 44], [134, 106, 74, 58], [154, 122, 86, 64], [192, 152, 108, 84], [230, 180, 130, 98], [271, 213, 151, 119], [321, 251, 177, 137], [367, 287, 203, 155], [425, 331, 241, 177], [458, 362, 258, 194], [520, 412, 292, 220], [586, 450, 322, 250], [644, 504, 364, 280], [718, 560, 394, 310], [792, 624, 442, 338], [858, 666, 482, 382], [929, 711, 509, 403], [1003, 779, 565, 439], [1091, 857, 611, 461], [1171, 911, 661, 511], [1273, 997, 715, 535], [1367, 1059, 751, 593], [1465, 1125, 805, 625], [1528, 1190, 868, 658], [1628, 1264, 908, 698], [1732, 1370, 982, 742], [1840, 1452, 1030, 790], [1952, 1538, 1112, 842], [2068, 1628, 1168, 898], [2188, 1722, 1228, 958], [2303, 1809, 1283, 983], [2431, 1911, 1351, 1051], [2563, 1989, 1423, 1093], [2699, 2099, 1499, 1139], [2809, 2213, 1579, 1219], [2953, 2331, 1663, 1273]];
- function _isSupportCanvas() {
- return typeof CanvasRenderingContext2D != "undefined";
- }
-
- function _getAndroid() {
- var android = false;
- var sAgent = navigator.userAgent;
- if (/android/i.test(sAgent)) {
- android = true;
- var aMat = sAgent.toString().match(/android ([0-9]\.[0-9])/i);
- if (aMat && aMat[1]) {
- android = parseFloat(aMat[1]);
- }
- }
- return android;
- }
- var svgDrawer = (function () {
- var Drawing = function (el, htOption) {
- this._el = el;
- this._htOption = htOption;
- };
- Drawing.prototype.draw = function (oQRCode) {
- var _htOption = this._htOption;
- var _el = this._el;
- var nCount = oQRCode.getModuleCount();
- var nWidth = Math.floor(_htOption.width / nCount);
- var nHeight = Math.floor(_htOption.height / nCount);
- this.clear();
- function makeSVG(tag, attrs) {
- var el = document.createElementNS('http://www.w3.org/2000/svg', tag);
- for (var k in attrs)
- if (attrs.hasOwnProperty(k)) el.setAttribute(k, attrs[k]);
- return el;
- }
- var svg = makeSVG("svg", { 'viewBox': '0 0 ' + String(nCount) + " " + String(nCount), 'width': '100%', 'height': '100%', 'fill': _htOption.colorLight });
- svg.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink");
- _el.appendChild(svg);
- svg.appendChild(makeSVG("rect", { "fill": _htOption.colorLight, "width": "100%", "height": "100%" }));
- svg.appendChild(makeSVG("rect", { "fill": _htOption.colorDark, "width": "1", "height": "1", "id": "template" }));
- for (var row = 0; row < nCount; row++) {
- for (var col = 0; col < nCount; col++) {
- if (oQRCode.isDark(row, col)) {
- var child = makeSVG("use", { "x": String(col), "y": String(row) });
- child.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#template")
- svg.appendChild(child);
- }
- }
- }
- };
- Drawing.prototype.clear = function () {
- while (this._el.hasChildNodes())
- this._el.removeChild(this._el.lastChild);
- };
- return Drawing;
- })();
- var useSVG = document.documentElement.tagName.toLowerCase() === "svg";
-
- var Drawing = useSVG ? svgDrawer : !_isSupportCanvas() ? (function () {
- var Drawing = function (el, htOption) {
- this._el = el;
- this._htOption = htOption;
- };
-
- Drawing.prototype.draw = function (oQRCode) {
- var _htOption = this._htOption;
- var _el = this._el;
- var nCount = oQRCode.getModuleCount();
- var nWidth = Math.floor(_htOption.width / nCount);
- var nHeight = Math.floor(_htOption.height / nCount);
- var aHTML = ['<table style="border:0;border-collapse:collapse;">'];
- for (var row = 0; row < nCount; row++) {
- aHTML.push('<tr>');
- for (var col = 0; col < nCount; col++) {
- aHTML.push('<td style="border:0;border-collapse:collapse;padding:0;margin:0;width:' + nWidth + 'px;height:' + nHeight + 'px;background-color:' + (oQRCode.isDark(row, col) ? _htOption.colorDark : _htOption.colorLight) + ';"></td>');
- }
- aHTML.push('</tr>');
- }
- aHTML.push('</table>');
- _el.innerHTML = aHTML.join('');
-
- var elTable = _el.childNodes[0];
- var nLeftMarginTable = (_htOption.width - elTable.offsetWidth) / 2;
- var nTopMarginTable = (_htOption.height - elTable.offsetHeight) / 2;
- if (nLeftMarginTable > 0 && nTopMarginTable > 0) {
- elTable.style.margin = nTopMarginTable + "px " + nLeftMarginTable + "px";
- }
- };
-
- Drawing.prototype.clear = function () {
- this._el.innerHTML = '';
- };
- return Drawing;
- })() : (function () {
- function _onMakeImage() {
- this._elImage.src = this._elCanvas.toDataURL("image/png");
- this._elImage.style.display = "block";
- this._elCanvas.style.display = "none";
- }
-
-
- if (this._android && this._android <= 2.1) {
- var factor = 1 / window.devicePixelRatio;
- var drawImage = CanvasRenderingContext2D.prototype.drawImage;
- CanvasRenderingContext2D.prototype.drawImage = function (image, sx, sy, sw, sh, dx, dy, dw, dh) {
- if (("nodeName" in image) && /img/i.test(image.nodeName)) {
- for (var i = arguments.length - 1; i >= 1; i--) {
- arguments[i] = arguments[i] * factor;
- }
- } else if (typeof dw == "undefined") {
- arguments[1] *= factor;
- arguments[2] *= factor;
- arguments[3] *= factor;
- arguments[4] *= factor;
- }
- drawImage.apply(this, arguments);
- };
- }
-
- function _safeSetDataURI(fSuccess, fFail) {
- var self = this;
- self._fFail = fFail;
- self._fSuccess = fSuccess;
-
- if (self._bSupportDataURI === null) {
- var el = document.createElement("img");
- var fOnError = function () {
- self._bSupportDataURI = false;
- if (self._fFail) {
- self._fFail.call(self);
- }
- };
- var fOnSuccess = function () {
- self._bSupportDataURI = true;
- if (self._fSuccess) {
- self._fSuccess.call(self);
- }
- };
- el.onabort = fOnError;
- el.onerror = fOnError;
- el.onload = fOnSuccess;
- el.src = "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
- return;
- } else if (self._bSupportDataURI === true && self._fSuccess) {
- self._fSuccess.call(self);
- } else if (self._bSupportDataURI === false && self._fFail) {
- self._fFail.call(self);
- }
- };
-
- var Drawing = function (el, htOption) {
- this._bIsPainted = false;
- this._android = _getAndroid();
- this._htOption = htOption;
- this._elCanvas = document.createElement("canvas");
- this._elCanvas.width = htOption.width;
- this._elCanvas.height = htOption.height;
- el.appendChild(this._elCanvas);
- this._el = el;
- this._oContext = this._elCanvas.getContext("2d");
- this._bIsPainted = false;
- this._elImage = document.createElement("img");
- this._elImage.alt = "Scan me!";
- this._elImage.style.display = "none";
- this._el.appendChild(this._elImage);
- this._bSupportDataURI = null;
- };
-
- Drawing.prototype.draw = function (oQRCode) {
- var _elImage = this._elImage;
- var _oContext = this._oContext;
- var _htOption = this._htOption;
- var nCount = oQRCode.getModuleCount();
- var nWidth = _htOption.width / nCount;
- var nHeight = _htOption.height / nCount;
- var nRoundedWidth = Math.round(nWidth);
- var nRoundedHeight = Math.round(nHeight);
- _elImage.style.display = "none";
- this.clear();
- for (var row = 0; row < nCount; row++) {
- for (var col = 0; col < nCount; col++) {
- var bIsDark = oQRCode.isDark(row, col);
- var nLeft = col * nWidth;
- var nTop = row * nHeight;
- _oContext.strokeStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight;
- _oContext.lineWidth = 1;
- _oContext.fillStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight;
- _oContext.fillRect(nLeft, nTop, nWidth, nHeight);
-
- _oContext.strokeRect(
- Math.floor(nLeft) + 0.5,
- Math.floor(nTop) + 0.5,
- nRoundedWidth,
- nRoundedHeight
- );
- _oContext.strokeRect(
- Math.ceil(nLeft) - 0.5,
- Math.ceil(nTop) - 0.5,
- nRoundedWidth,
- nRoundedHeight
- );
- }
- }
- this._bIsPainted = true;
- };
-
- Drawing.prototype.makeImage = function () {
- if (this._bIsPainted) {
- _safeSetDataURI.call(this, _onMakeImage);
- }
- };
-
- Drawing.prototype.isPainted = function () {
- return this._bIsPainted;
- };
-
- Drawing.prototype.clear = function () {
- this._oContext.clearRect(0, 0, this._elCanvas.width, this._elCanvas.height);
- this._bIsPainted = false;
- };
-
- Drawing.prototype.round = function (nNumber) {
- if (!nNumber) {
- return nNumber;
- }
- return Math.floor(nNumber * 1000) / 1000;
- };
- return Drawing;
- })();
-
- function _getTypeNumber(sText, nCorrectLevel) {
- var nType = 1;
- var length = _getUTF8Length(sText);
- for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) {
- var nLimit = 0;
- switch (nCorrectLevel) {
- case QRErrorCorrectLevel.L:
- nLimit = QRCodeLimitLength[i][0];
- break;
- case QRErrorCorrectLevel.M:
- nLimit = QRCodeLimitLength[i][1];
- break;
- case QRErrorCorrectLevel.Q:
- nLimit = QRCodeLimitLength[i][2];
- break;
- case QRErrorCorrectLevel.H:
- nLimit = QRCodeLimitLength[i][3];
- break;
- }
- if (length <= nLimit) {
- break;
- } else {
- nType++;
- }
- }
- if (nType > QRCodeLimitLength.length) {
- throw new Error("Too long data");
- }
- return nType;
- }
- function _getUTF8Length(sText) {
- var replacedText = encodeURI(sText).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a');
- return replacedText.length + (replacedText.length != sText ? 3 : 0);
- }
-
- QRCode = function (el, vOption) {
- this._htOption = {
- width: 256,
- height: 256,
- typeNumber: 4,
- colorDark: "#000000",
- colorLight: "#ffffff",
- correctLevel: QRErrorCorrectLevel.H
- };
- if (typeof vOption === 'string') {
- vOption = {
- text: vOption
- };
- }
-
- if (vOption) {
- for (var i in vOption) {
- this._htOption[i] = vOption[i];
- }
- }
- if (typeof el == "string") {
- el = document.getElementById(el);
- }
- if (this._htOption.useSVG) {
- Drawing = svgDrawer;
- }
- this._android = _getAndroid();
- this._el = el;
- this._oQRCode = null;
- this._oDrawing = new Drawing(this._el, this._htOption);
- if (this._htOption.text) {
- this.makeCode(this._htOption.text);
- }
- };
-
- QRCode.prototype.makeCode = function (sText) {
- this._oQRCode = new QRCodeModel(_getTypeNumber(sText, this._htOption.correctLevel), this._htOption.correctLevel);
- this._oQRCode.addData(sText);
- this._oQRCode.make();
- this._el.title = sText;
- this._oDrawing.draw(this._oQRCode);
- this.makeImage();
- };
-
- QRCode.prototype.makeImage = function () {
- if (typeof this._oDrawing.makeImage == "function" && (!this._android || this._android >= 3)) {
- this._oDrawing.makeImage();
- }
- };
-
- QRCode.prototype.clear = function () {
- this._oDrawing.clear();
- };
-
- QRCode.CorrectLevel = QRErrorCorrectLevel;
- })();;
- U.quickCreate = window.$$ = function (str, obj, parentel, child) {
- var i, _element;
-
- var _obj = {
- "frag": "createDocumentFragment"
-
- };
-
- if (_obj[str]) {
- _element = document[_obj[str]]();
- }
-
- else {
- _element = document.createElement(str);
- }
-
- if (obj) {
- U.selectEl(_element).addAttrArray(obj);
- }
-
- if (parentel) {
-
- if (child) {
- parentel.insertBefore(_element, child);
- }
-
- else {
- parentel.appendChild(_element);
- }
- }
-
- return _element;
- }
- $ = U.selectEl = function (name, el) {
-
- return new U.select(name, el);
- }
- U.select = function (selector, el) {
-
- this.length = 0;
- this.context = el || document;
-
- this.select(selector, el);
- }
- U.select.EVENTS = [];
- U.select.prototype = {
-
- select: function (name, el) {
- var _selectel;
-
- if (U.UF.C.isString(name)) {
- var _r = name.substring(0, 1),
- _n = name.substring(1, name.length),
- _doc = el || document;
-
- try {
- switch (_r) {
- case "#":
- if (_doc == document && U.UF.S.EN.test(_n)) {
- _selectel = document.getElementById(_n);
- }
- break;
- case ".":
- if (U.UF.S.EN.test(_n)) {
- _selectel = _doc.getElementsByClassName(_n);
- }
- break;
- case "*":
-
- if (U.UF.S.EN.test(_n)) {
- _selectel = document[_n];
- if (!_selectel) {
- if (U.UF.CI.getBrowser().browser == "msie") {
- _selectel = document.getElementById(_n);
- }
-
- else {
- _selectel = document.embeds[_n];
- }
- }
- }
-
- else {
- _selectel = _doc.getElementsByTagName("*");
- }
- break;
- default:
- if (U.UF.S.EN.test(name)) {
- _selectel = _doc.getElementsByTagName(name);
- }
- break;
- }
- }
- catch (e) {
- }
-
- if (_selectel == null) {
- _selectel = U.UF.CP.selectorElement(name, _doc);
- }
- }
-
- else if (name) {
- _selectel = name;
- }
-
- if (_selectel) {
- this.addElement(_selectel);
- }
- return this;
- },
-
- addElement: function (els) {
-
- if ((U.UF.C.isElement(els) || els.length == null) || els.toString() == "[object Window]") {
- els = [els];
- }
-
- for (var i = 0; i < els.length; i++) {
-
- this[i] = els[i];
-
- if (els[i].id) {
- this[els[i].id] = els[i];
- }
- this.length++;
- }
- },
-
- find: function (name, item) {
- var i = item || 0,
- _length = item + 1 || this.length,
- _elements = new U.select();
- for (; i < _length; i++) {
- _elements.select(name, this[i]);
- }
- return _elements;
- },
-
- prev: function (item) {
- var _selectel,
- _selects = [],
- i = item || 0,
- _length = item + 1 || this.length,
- _elements = new U.select();
-
- for (; i < _length; i++) {
- _selectel = this[i];
- if (_selectel) {
-
- do {
- _selectel = _selectel.previousSibling;
- }
- while (_selectel && _selectel.nodeType !== 1)
- }
-
- if (_selectel) {
- _selects.push(_selectel);
- }
- }
-
- _elements.addElement(_selects);
- return _elements;
- },
-
- next: function (item) {
- var _selectel,
- _selects = [],
- i = item || 0,
- _length = item + 1 || this.length,
- _elements = new U.select();
-
- for (; i < _length; i++) {
- _selectel = this[i];
- if (_selectel) {
-
- do {
- _selectel = _selectel.nextSibling;
- }
- while (_selectel && _selectel.nodeType !== 1)
- }
-
- if (_selectel) {
- _selects.push(_selectel);
- }
- }
-
- _elements.addElement(_selects);
- return _elements;
- },
-
- Nodes: function (item) {
- item = item || 0;
-
- if (this[item]) {
- this[item].childNodes;
- }
- ;
- },
-
- Child: function (item) {
- item = item || 0;
-
- if (this[item]) {
- return U.UF.EL.getChildrenNoText(this[item].childNodes)
- }
- },
-
- Parent: function (obj) {
- var _while,
- _istrue,
- _el = this[0];
- obj = obj || 1;
- if (U.UF.C.isNumber(obj)) {
- for (i = 0; i < obj; i++) {
- if (_el) {
- _el = _el.parentNode;
- }
- }
- }
- else {
-
- _while: while (_el && _el != document) {
- _istrue = true;
-
- for (i in obj) {
-
- if (obj[i] != _el[i] && (!_el.getAttribute || _el.getAttribute(i) != obj[i])) {
- _istrue = false;
- break;
- }
- }
-
- if (_istrue) {
- break _while;
- }
-
- else {
- _el = _el.parentNode;
- }
- }
- }
-
- return _el;
- },
-
- childs: function (item) {
- return new U.select(this.Child(item));
- },
-
- parentElement: function (obj, item) {
- return new U.select(this.Parent(obj, item));
- },
-
- clone: function (deep, item) {
- var i = item || 0,
- _returnarr = [],
- _length = i + 1 || this.length;
-
- for (; i < _length; i++) {
- _returnarr.push(this[i].cloneNode(deep));
- }
-
- return new U.select(_returnarr);
- },
-
- appendTo: function (parentel, item, childel) {
- var i = item || 0,
- _length = item + 1 || this.length;
-
- for (; i < _length; i++) {
-
- if (childel) {
- parentel.insertBefore(this[i], childel);
- }
-
- else {
- parentel.appendChild(this[i]);
- }
- }
- return this;
- },
-
- append: function (el, item, childel) {
- item = item || 0;
-
- if (childel) {
- this[item].insertBefore(el, childel);
- }
-
- else {
- this[item].appendChild(el);
- }
- return this;
- },
-
- remove: function (item) {
- var i = item || 0,
- _length = item != null ? item + 1 : this.length;
-
- for (; i < _length; i++) {
-
- if (this[i] && this[i].parentNode) {
- this[i].parentNode.removeChild(this[i]);
- }
- }
- return this;
- },
-
- Center: function (item) {
- var i = item || 0,
- _length = item + 1 || this.length;
-
- for (; i < _length; i++) {
- U.UF.F.windowTopCenter(this[i]);
- }
- return this;
- },
-
- getElementInfo: function (item) {
- return U.UF.EL.getElementInfo(this[item || 0]);
- },
-
- css: function (obj, value, item) {
- var i = item || 0,
- _length = item + 1 || this.length,
- _isobject = U.UF.C.isObject(obj);
-
- if (_isobject) {
- this.addAttrArray({ "style": obj }, value);
- }
-
- else if (value != null) {
-
- for (i; i < _length; i++) {
- obj = U.UF.EL.styleConversion(obj);
- try {
- this[i].style[obj] = value;
- } catch (e) { }
- }
- }
-
- else {
- return U.UF.EL.getStyle(this[i], obj);
- }
- return this;
- },
-
- addClass: function (classname, item) {
- var i = item || 0,
- _length = item + 1 || this.length;
-
- for (; i < _length; i++) {
- U.UF.EL.addClass(this[i], classname);
- }
- return this;
- },
-
- removeClass: function (classname, item) {
- var i = item || 0,
- _length = item + 1 || this.length;
-
- for (; i < _length; i++) {
- U.UF.EL.removeClass(this[i], classname);
- }
- return this;
- },
-
- hasClass: function (classname, item) {
- item = item || 0;
- return U.UF.EL.isHasClass(this[item], classname);
- },
-
- attr: function (obj, value, item) {
- var j,
- i,
- _length,
- _isobject = U.UF.C.isObject(obj);
-
- if (_isobject) {
- i = value || 0;
- _length = value + 1 || this.length;
-
- for (; i < _length; i++) {
- for (j in obj) {
- U.UF.EL.addAttributes(this[i], j, obj[j]);
- }
- }
- }
-
- else if (value != null) {
- i = item || 0;
- _length = item + 1 || this.length;
-
- for (i; i < _length; i++) {
- U.UF.EL.addAttributes(this[i], obj, value);
- }
- }
-
- else {
- return this[item || 0].getAttribute(obj);
- }
- return this;
- },
-
- rmAttr: function (name, item) {
- U.UF.EL.delAttributes(this[item || 0], name);
- return this;
- },
-
- addAttrArray: function (obj, item) {
- var j, k,
- _newcsstext,
- _csstype,
- _csstext = "",
- i = item || 0,
- _length = item + 1 || this.length;
-
- for (; i < _length; i++) {
-
- for (j in obj) {
-
- if (j == "style") {
- _csstext = "";
- _newcsstext = obj[j]["cssText"];
- for (k in obj[j]) {
- _csstype = U.UF.EL.styleConversion(k, true);
-
- if (_csstype == "css-text") {
- continue;
- }
-
- else if (k in this[i][j]) {
- _csstext += _csstype + ":" + obj[j][k] + ";";
- }
-
- else {
- this[i][j][k] = obj[j][k];
- }
- }
-
- if (_newcsstext) {
- _csstext = this[i][j]["cssText"] + ";" + _newcsstext + ";" + _csstext;
- }
-
- else if (_newcsstext !== "") {
- _csstext = this[i][j]["cssText"] + ";" + _csstext;
- }
- this[i][j]["cssText"] = _csstext;
- }
-
- else {
-
- if (j.indexOf("on") == 0 && U.UF.C.isString(obj[j])) {
- this[i][j] = new Function(obj[j]);
- continue;
- }
-
-
- else if (U.UF.C.isString(obj[j]) && U.UF.EL.isCustomAttributes(this[i], j)) {
-
- try {
- this[i].setAttribute(j, obj[j]);
- }
- catch (e) {
- }
- }
- try {
- this[i][j] = obj[j];
- }
- catch (e) { }
- }
- }
- }
- return this;
- },
-
- hide: function (item) {
- this.css({ "display": "none" }, item);
- },
-
- show: function (item) {
- this.css({ "display": "block" }, item);
- },
-
- width: function () {
- return U.UF.EL.getElementRealWidth(this[0]);
- },
-
- height: function () {
- return U.UF.EL.getElementRealHeight(this[0]);
- },
-
- mouseenter: function (cb, item) {
-
- this.addAttrArray({
- "onmouseover": function () {
- U.UF.EV.stopBubbleMouseOutOrOver(this, cb);
- }
- }, item);
- return this;
- },
-
- mouseleave: function (cb, item) {
-
- this.addAttrArray({
- "onmouseout": function () {
- U.UF.EV.stopBubbleMouseOutOrOver(this, cb);
- }
- }, item);
- return this;
- },
-
- gt: function (item) {
- var i = item,
- _returnarr = [],
- _elements = new U.select();
-
- for (; i < this.length; i++) {
- _returnarr.push(this[i]);
- }
-
- _elements.addElement(_returnarr);
- return _elements;
- },
-
- lt: function (item) {
- var i = 0,
- _returnarr = [];
-
- for (; i < item; i++) {
- _returnarr.push(this[i]);
- }
-
- return new U.select(_returnarr);
- },
-
- bind: function (obj, value, item) {
- var j,
- i,
- _length,
- _isobject = U.UF.C.isObject(obj);
-
- if (_isobject) {
- i = value || 0;
- _length = value + 1 || this.length;
-
- for (; i < _length; i++) {
- for (j in obj) {
- U.UF.EV.addElementEvent(j, this[i], obj[j]);
-
- U.select.EVENTS.push({
- element: this[i],
- event: j,
- fun: obj[j]
- });
- }
- }
- }
-
- else if (value != null) {
- i = item || 0;
- _length = item + 1 || this.length;
-
- for (i; i < _length; i++) {
- U.UF.EV.addElementEvent(obj, this[i], value);
-
- U.select.EVENTS.push({
- element: this[i],
- event: obj,
- fun: value
- });
- }
- }
- return this;
- },
-
- unbind: function (obj, value, item) {
- var j,
- i,
- k,
- _length,
- _isobject = U.UF.C.isObject(obj);
-
- if (_isobject) {
- i = value || 0;
- _length = value + 1 || this.length;
-
- for (; i < _length; i++) {
- for (j in obj) {
- U.UF.EV.delElementEvent(j, this[i], obj[j]);
- for (k = 0; k < U.select.EVENTS.length; k++) {
- if (U.select.EVENTS[k].element == this[i] && U.select.EVENTS[k].event == j && U.select.EVENTS[k].fun == obj[j]) {
- U.select.EVENTS.splice(k, 1);
- k--;
- }
- }
- }
- }
- }
-
- else if (obj != null) {
- i = item || 0;
- _length = item + 1 || this.length;
-
- for (i; i < _length; i++) {
- for (k = 0; k < U.select.EVENTS.length; k++) {
- if (U.select.EVENTS[k].element == this[i] &&
- U.select.EVENTS[k].event == obj &&
- (value == null || U.select.EVENTS[k].fun == value)) {
- U.UF.EV.delElementEvent(obj, this[i], U.select.EVENTS[k].fun);
- U.select.EVENTS.splice(k, 1);
- k--;
- }
- }
- }
- }
-
- else {
- i = item || 0;
- _length = item + 1 || this.length;
- for (i; i < _length; i++) {
- for (k = 0; k < U.select.EVENTS.length; k++) {
- if (U.select.EVENTS[k].element == this[i]) {
- U.UF.EV.delElementEvent(U.select.EVENTS[k].event, this[i], U.select.EVENTS[k].fun);
- U.select.EVENTS.splice(k, 1);
- k--;
- }
- }
- }
- }
- return this;
- }
- }
-
- ;
- Namespace.register("U.UF.S");
- U.UF.S.browser = /(msie|firefox|chrome|ipad|iphone|safari|opera|version|rv).*?([\d.]+)/;
- U.UF.S.Event = /\[object (Keyboard|Mouse|Focus|Wheel|Composition|Storage|MS|)Event(Obj|)\]/;
- U.UF.S.Guid = /^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$/;
- U.UF.S.English = /^[A-Za-z]+$/;
- U.UF.S.RNum = /\d+/g;
- U.UF.S.Number = /^\d+$/;
- U.UF.S.Num = /^(-?\d+)(\.\d+)?$/;
- U.UF.S.EN = /^([a-zA-Z0-9_\-]+)$/;
- U.UF.S.Url = /^\w+\:\/\/([\w+]).*/;
- U.UF.S.FileName = /^([a-zA-Z0-9\u4e00-\u9fa5\s\._-]+)$/;
- U.UF.S.ZWFileName = /^[0-9a-zA-Z\u4e00-\u9fa5\._-]{1,40}\\*$/;
- U.UF.S.PBrief = /^.{0,100}$/;
- U.UF.S.FFZF = /^(\w|-|[\u4E00-\u9FA5])*$/;
- U.UF.S.ChineseIdCard = /\d{17}[\d|X]|\d{15}/;
- U.UF.S.TelephoneNumber = /^1[0-9]{10}$/;
- U.UF.S.Email = /^\w+([_+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
- U.UF.S.TrueName = /^[\u4e00-\u9fa5]{1,20}$|^[a-zA-Z]{1,20}$/;
- U.UF.S.UserName = /^\S{1,25}$/;
- U.UF.S.NickName = /^[0-9a-zA-Z\u4e00-\u9fa5_-]{1,40}\\*$/;
- U.UF.S.PassWord = /^[^\u4E00-\u9FA5\uF900-\uFA2D]{6,20}$/;
- U.UF.S.Visa = /^[45]\d{15}$/;
- U.UF.S.rgb = /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/
- U.UF.C.String = {
-
-
-
-
-
- escapeQuotes: function () {
- return this.replace(/'/ig, "''").replace(/"/ig, "\\\"");
- },
- unEscapeQuotes: function () {
- return this.replace(/\\'/ig, '\'').replace(/\\"/ig, "\"");
- },
- count: function () {
- return this.substrU();
- },
-
- substrU: function (start, end) {
- var i, _UTF, _num = 0, _UMS = "";
- if (end == null && start != null) { end = start, start = 0 };
- _UTF = (start == null && end == null);
- for (i = 0; i < this.length; i++) {
- _num += this.charCodeAt(i) < 255 ? 1 : 2;
- if (_num < start) { continue; }
- if (_num <= end || _UTF) {
- _UMS += this.charAt(i);
- continue;
- }
- break;
- }
- return (_UTF ? _num : _UMS);
- },
-
-
-
-
-
-
- isStrNull: function () {
- return this.trim() == "";
- },
-
- replaceRnToBr: function () {
- return this.replace(/\r\n/g, "<br />");
- },
-
- replaceBrToRn: function () {
- return this.replace(/<(BR)[^<>]*>/ig, "\r\n");
- },
- removeP: function () {
- return this.replace(/<(p)[^<>]*>/ig, "");
- },
- removeBr: function () {
- return this.replace(/<(BR)[^<>]*>/ig, "");
- },
- removeRn: function () {
- return this.replace(/\r\n/g, "");
- },
- replaceBrAndBlank: function () {
- return this.replaceBrToRn().replace(/ /g, '');
- },
-
- isHtmlNull: function () {
- return this.removeBr().removeP().trim() != "";
- },
-
- replaceLtAndGt: function () {
- return this.replace(/</g, "<").replace(/>/g, ">");
- },
-
- replaceAngleBrackets: function () {
- return this.replace(/</g, "<").replace(/>/g, ">");
- },
-
-
-
- replaceHtmlSign: function () {
- return this.replace(/&(?!#?[a-zA-Z0-9]+;)/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/'/g, "'").replace(/"/g, """);
- },
- replaceDoubleToAngleBrackets: function () {
- return this.replace(/\《/g, "<").replace(/\》/g, ">");
- },
- replaceAngleToDoubleBrackets: function () {
- return this.replace(/\</g, "《").replace(/\>/g, "》");
- },
- trim: String.prototype.trim || function (str) {
- return this.replace(/\ |\ |\s+|\n|\r|\t/g, str || "");
- },
- lTrim: function () {
- return this.replace(/(^\s*)/g, "");
- },
- rTrim: function () {
- return this.replace(/(\s*$)/g, '');
- },
- addPreSpace: function (n) {
- var i, k = "";
- for (i = 0; i < n; i++)
- k += " ";
- return k + this;
- },
- insertString: function (str, n) {
-
- var _pre = this.substr(0, n);
- var _back = this.substr(n, this.length);
- return _pre + str + _back;
- },
-
- addEllipsis: function (n) {
- var _str = this.substrU(0, n);
- if (_str != this) {
- _str = _str + "...";
- }
-
- return _str.valueOf();
- },
-
- toInt: function () {
- var _UTV = this.valueOf(), _UMS = _UTV.match(/^(-|\+)?\d+/g);
- return _UMS && _UMS.length == 1 ? Number(_UMS[0]) : _UTV;
- },
-
- replaceStr: function (source, target) {
- return this.replace(new RegExp(source, "gm"), target);
- },
- parseJSON: function () {
- var _obj = null, _str = this;
- try {
- _obj = eval("0,(" + _str + ")");
- } catch (e) { }
- return _obj == null ? _str.valueOf() : _obj;
- },
- capitalizeFirstLetter: function () {
- return this.replace(/\b(\w)|\s(\w)/g, function (UAE) { return UAE.toUpperCase(); });
- },
-
- SplitRN: function () {
- return this.replace(/\r\n/g, "\n").split("\n");
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SplitAngleBrackets: function () {
- return this.match(/(<(.[^>]*)>)|((|>)[^\<]*[^\<^\s])/g);
- },
-
- htmlToText: function () {
- return String(this).replace(/(<(.[^>]*)>)/g, "");
- },
-
- htmlToTextRn: function () {
- return this.replace(/(<(.[^>]*)>)/g, function (str) {
- return (/(<\/(div|DIV|p|P)([|^>]*)>)|<(BR)[^<>]*>/ig.test(str)) ? "\r\n" : "";
- });
- },
-
- getBodyHtml: function () {
- try {
- return /<body[^>]*>([\s\S]*)<\/body>/.exec(String(this))[1].unEscapeQuotes();
- }
- catch (e) {
- return "";
- }
- }
- };
- U.UF.C.Number = {
-
- formatMoney: function () {
- var _split;
- var _arr = [];
- var _str = this.toString();
- while (_str) {
- _split = _str.length - 3;
-
- _arr.unshift(_str.substr(_split < 0 ? 0 : _split));
- _str = _str.substr(0, _split);
- }
- return _arr.join(",");
- },
-
- prefixInteger: function (n) {
- return (this < 10 ? "0" + this : this).valueOf();
-
- return (Array(n).join(0) + this).slice(-n);
- },
-
- toRadians: function () {
- return this * Math.PI / 180;
- }
- };
- Array.isArray = Array.isArray || function (arr) {
- return Object.prototype.toString.call(arr) === "[object Array]";
- }
- U.UF.C.Array = {
-
- indexOf: Array.prototype.indexOf || function (val, startpoint) {
- var i = startpoint || 0,
- j;
-
- for (; i < this.length; i++) {
-
- if (this[i] == val) {
- return i;
- }
- }
-
- return -1;
- },
-
-
- objIndexOf: function (obj) {
- var i,
- j,
- _isfind;
- for (i = 0; i < this.length; i++) {
- _isfind = false;
-
- for (j in obj) {
-
- if (this[i][j] == obj[j]) {
- _isfind = true;
- }
-
- else {
- _isfind = false;
- break;
- }
- }
-
- if (_isfind) {
- return i;
- }
- }
-
- return -1;
- },
-
- unique: function () {
-
- var result = [];
- var obj = {};
- for (var i = 0; i < this.length; i++) {
- if (!obj[this[i]]) {
- result.push(this[i]);
- obj[this[i]] = true;
- }
- }
- return result;
- },
-
-
-
-
- forEach: Array.prototype.forEach || function (cb, thisArg) {
- var i = 0;
- var _length = this.length;
- while (i < _length) {
- cb.call(thisArg, this[i], i, this);
- i++;
- }
- },
-
- every: Array.prototype.every || function (cb, thisArg) {
-
- var i = 0, b;
- var _length = this.length;
- while (i < _length) {
- b = cb.call(thisArg, this[i], i, this);
- if (b == false) {
- return b;
- }
- i++;
- }
- return true;
- },
-
- some: Array.prototype.some || function (cb, thisArg) {
- var t = Object(this);
- var _len = t.length;
- for (var i = 0; i < _len; i++) {
- if (i in t && cb.call(thisArg, t[i], i, t))
-
- return true;
- }
- return false;
- },
-
- map: Array.prototype.map || function (cb, thisArg) {
-
-
- var i = 0;
-
- var _length = this.length;
-
- var _arr = [];
-
- if (typeof cb != "function")
- throw new TypeError();
-
- while (i < _length) {
-
- if (i in this) {
-
- _arr.push(cb.call(thisArg, this[i], i, this));
- }
-
- i++;
- }
-
- return _arr;
- },
-
- filter: Array.prototype.filter || function (cb, thisArg) {
-
-
- var i = 0;
-
- var _length = this.length;
-
- var _arr = [];
-
- if (typeof cb != "function")
- throw new TypeError();
- while (i < _length) {
-
- if (i in this && cb.call(thisArg, this[i], i, this))
- _arr.push(this[i]);
- i++;
- }
- return _arr;
- },
-
-
- findIndex: Array.prototype.findIndex || function (predicate) {
-
-
- var i = 0;
-
- var _length = this.length;
-
- if (typeof predicate != "function")
- throw new TypeError();
- while (i < _length) {
-
- if (predicate(this[i], i, this))
-
- return i;
- i++;
- }
- return -1;
- },
-
- lastIndexOf: Array.prototype.lastIndexOf || function (searchElement, fromIndex) {
- var n, k,
- t = Object(this),
- len = t.length;
- if (len === 0) {
-
- return -1;
- }
- n = len - 1;
- if (arguments.length > 1) {
- n = Number(arguments[1]);
- if (n != n) {
- n = 0;
- }
- else if (n != 0 && n != (1 / 0) && n != -(1 / 0)) {
- n = (n > 0 || -1) * Math.floor(Math.abs(n));
- }
- }
- for (k = n >= 0
- ? Math.min(n, len - 1)
- : len - Math.abs(n); k >= 0; k--) {
- if (k in t && t[k] === searchElement) {
-
- return k;
- }
- }
-
- return -1;
-
-
- },
-
-
-
- fill: Array.prototype.fill || function (value) {
- var O = Object(this);
-
- var _len = O.length;
- var _start = arguments[1];
- var _relativeStart = _start;
-
- var k = _relativeStart < 0 ?
- Math.max(_len + _relativeStart, 0) :
- Math.min(_relativeStart, _len);
- var _end = arguments[2];
- var _relativeEnd = _end === undefined ?
- _len : _end;
-
- var _final = _relativeEnd < 0 ?
- Math.max(_len + _relativeEnd, 0) :
- Math.min(_relativeEnd, _len);
-
- while (k < _final) {
- O[k] = value;
- k++;
- }
- return O;
- },
-
- copyWithin: Array.prototype.copyWithin || function (target, start, end) {
- var O = Object(this);
- var _len = O.length;
-
- var _relativeTarget = target;
-
- var _to = _relativeTarget < 0 ?
- Math.max(_len + _relativeTarget, 0) :
- Math.min(_relativeTarget, _len);
-
- var _relativeStart = start;
-
- var _from = _relativeStart < 0 ?
- Math.max(_len + _relativeStart, 0) :
- Math.min(_relativeStart, _len);
- var end = arguments[2];
- var _relativeEnd = end === undefined ? _len : end >> 0;
-
- var _final = _relativeEnd < 0 ?
- Math.max(_len + _relativeEnd, 0) :
- Math.min(_relativeEnd, _len);
- var _count = Math.min(_final - _from, _len - _to);
- var _direction = 1;
- if (_from < _to && _to < (_from + _count)) {
- _direction = -1;
- _from += _count - 1;
- _to += _count - 1;
- }
-
- while (_count > 0) {
- if (_from in O) {
- O[_to] = O[_from];
- } else {
- delete O[_to];
- }
- _from += _direction;
- _to += _direction;
- _count--;
- }
-
- return O;
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- deepCopy: function () {
- var i,
- _newarr = [];
- for (i = 0; i < this.length; i++) {
- if (Array.isArray(this[i])) {
-
- _newarr[i] = this[i].deepCopy(this[i]);
- }
- else {
- _newarr[i] = this[i];
- }
- }
- return _newarr;
- }
- };
- U.UF.S.ArrayBuffer = function () {
-
- if (typeof ArrayBuffer !== 'undefined' && !ArrayBuffer.prototype.slice) {
- (function () {
- function clamp(val, length) {
- val = (val | 0) || 0;
- if (val < 0) {
- return Math.max(val + length, 0);
- }
- return Math.min(val, length);
- }
- ArrayBuffer.prototype.slice = function (from, to) {
- var length = this.byteLength,
- begin = clamp(from, length),
- end = length,
- num,
- target,
- targetArray,
- sourceArray;
- if (to !== undefined) {
- end = clamp(to, length);
- }
- if (begin > end) {
- return new ArrayBuffer(0);
- }
- num = end - begin;
- target = new ArrayBuffer(num);
- targetArray = new Uint8Array(target);
- sourceArray = new Uint8Array(this, begin, num);
- targetArray.set(sourceArray);
- return target;
- };
- })();
- }
- }
- window.Guid = U.UF.C.Guid = {
-
- newGuid: function () {
- var _num, i, _guid = "";
- for (i = 0; i < 32; i++) {
- _guid += Math.floor(Math.random() * 16).toString(16);
- _num = Math.floor((i - 7) / 4);
- if (_num > -1 && _num < 4 && (i == (7 + 4 * _num))) {
- _guid += "-";
- }
- }
- return _guid;
- },
-
- emptyGuid: US.EMPTYGUID,
-
- guidNoDash: function () {
- return Guid.newGuid().replace(/-/g, "");
- },
-
- IsGuid: function (guid) {
- return U.UF.S.Guid.test(guid);
- }
- }
-
- ;
- Namespace.register("U.UF.UP");
- U.UF.UP.upload = function (inputarr, url, cb, params) {
-
-
-
- }
- U.UF.UP.inputUpload = function (inputarr, url, cb, params) {
- U.UF.UP.uploading(inputarr, cb, params, url);
- }
- U.UF.UP.uploading = function (inputarr, cb, params, url) {
- var _iframe,
- _body = document.body,
- _name = Guid.guidNoDash()
- ;
-
- _iframe = $$("iframe", { "id": _name, "name": _name, "width": 0, "height": 0, "style": { "display": "none" }, "frameBorder": 0 }, _body);
-
- U.UF.C.iframeSameDomain(_iframe, "", function () {
-
- U.UF.UP.inputUpload.submit(_iframe, inputarr, cb, params, url, _name);
- });
- }
- U.UF.UP.inputUpload.submit = function (iframe, inputarr, cb, params, url, name) {
-
- var i, _form, _cloneinput, _changefun, _isfile;
-
- iframe.contentWindow.name = name;
-
- _form = $$("form", { "action": url, "target": name, "encoding": "multipart/form-data", "enctype": "multipart/form-data", "method": "post", "name": "loading", "style": { "display": "none" } }, document.body);
-
- for (i = 0; i < inputarr.length; i++) {
-
- inputarr[i].name = inputarr[i].name || inputarr[i].id || Guid.newGuid();
-
- _cloneinput = inputarr[i].cloneNode();
-
-
- try {
-
- if (document.selection) {
- _cloneinput.select();
- document.selection.clear();
- }
- else {
- _cloneinput.value = "";
- }
- }
- catch (e) { }
-
- if (inputarr[i].parentNode) {
- inputarr[i].parentNode.replaceChild(_cloneinput, inputarr[i]);
- }
-
- _form.appendChild(inputarr[i]);
-
- if (inputarr[i].type == "file") {
- _isfile = true;
- }
- }
-
- if (_isfile !== true) {
- _form.encoding = _form.enctype = "application/x-www-form-urlencoded";
- }
-
- U.UF.DL.iframeLoad(iframe, function () {
- U.selectEl(_form).remove();
- U.UF.UP.inputUpload.asyn(iframe, inputarr, cb, params);
- });
-
- _form.submit();
-
-
-
-
- }
- U.UF.UP.inputUpload.asyn = function (iframe, inputarr, cb, params) {
-
- if (!(U.UF.CI.getBrowser().browser == "msie")) {
- iframe.src = "about:blank";
-
- setTimeout(function () {
- U.UF.UP.inputUpload.callback(iframe, inputarr, cb, params);
- }, 0);
- }
-
- else {
- U.UF.UP.inputUpload.callback(iframe, inputarr, cb, params);
- }
- }
- U.UF.UP.inputUpload.callback = function (iframe, inputarr, cb, params) {
- var _value = U.UF.UP.inputUpload.getData(iframe);
-
- U.selectEl(iframe).remove();
-
- if (U.UF.C.isFunction(cb)) {
-
- cb({
- "value": _value,
- "context": params,
- "inputs": inputarr
- });
- }
- }
- U.UF.UP.inputUpload.getData = function (iframe) {
- var _value = null;
-
- try {
- _value = iframe.contentWindow.document.body.innerHTML;
- }
- catch (e) { }
-
- if (!_value) {
- try {
- _value = iframe.contentWindow.name != iframe.id ? iframe.contentWindow.name : "";
- }
- catch (e) {
- }
- }
-
- if (_value == null) {
- U.alert("服务器处理繁忙,上传失败");
- }
- else {
-
- _value = U.UF.C.toJson(_value);
- }
- return _value;
- }
- U.UF.UP.html5Upload = function (fileinfo, succallback, callback) {
-
- U.UF.UP.html5Upload.fileMd5(fileinfo, function (progress, finish, filehash) {
- if (finish) {
-
- if (U.UF.C.isFunction(callback.getHashCallBack)) {
- callback.getHashCallBack(filehash, fileinfo, succallback, callback.error);
- }
- }
- });
- }
- U.UF.UP.html5Upload.fileMd5 = function (file, callback) {
- var blobSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice,
- chunkSize = 2097152,
- chunks = Math.ceil(file.size / chunkSize),
- currentChunk = 0,
- spark = new U.UF.EC.SparkMD5.ArrayBuffer(),
- fileReader = new FileReader()
- ;
- file.fileReader = fileReader;
-
- fileReader.onload = function (e) {
- spark.append(e.target.result);
- currentChunk++;
-
- if (currentChunk < chunks) {
- loadNext();
- callback({ 'Loaded': currentChunk, 'Total': chunks })
- }
- else {
- callback({ 'Loaded': 100, 'Total': 100 }, true, spark.end())
- }
- };
-
- fileReader.onerror = function () {
- callback(null, 'oops, something went wrong.')
- };
-
- var loadNext = function () {
- var start = currentChunk * chunkSize,
- end = ((start + chunkSize) >= file.size) ? file.size : start + chunkSize;
- fileReader.readAsArrayBuffer(blobSlice.call(file, start, end));
- }
- loadNext();
- }
- U.UF.UP.html5Upload.select = function (file, filehash, callback) {
- U.A.Request("http://upload.1473.cn/select", [file.name, filehash, file.size], function (r) {
- callback(r.value.fileServerName, r.value.filesize);
- });
- }
- U.UF.UP.html5Upload.loop = function (file, filehash, fileservername, filesize, callback) {
- var _xhr, _fd, _thunkto, _islast,
- _totalsize = file.size,
- _eachsize = 1024 * 500,
- _thunkfrom = filesize
- ;
-
- if (_eachsize + filesize >= _totalsize) {
- _thunkto = _totalsize;
- _islast = true;
- }
-
- else {
- _thunkto = _eachsize + filesize;
- }
-
- _fd = new FormData();
- _fd.append('theFile', file.slice(_thunkfrom, _thunkto));
- _fd.append('filehash', filehash);
- _fd.append('fileChunk', 0);
- _fd.append('isLastChunk', _islast);
- _fd.append('fileServerName', fileservername);
-
- _xhr = new XMLHttpRequest();
- file.xhr = _xhr;
- _xhr.open("post", "http://upload.1473.cn/upload", true);
- _xhr.onreadystatechange = function () {
- if (_xhr.readyState == 4 && _xhr.status == 200) {
- var _rs = JSON.parse(_xhr.responseText);
- if (_rs.status == 200) {
- callback({ 'Loaded': _thunkto, 'Total': _totalsize });
-
- if (!_rs.isLastChunk) {
-
- U.UF.UP.html5Upload.loop(file, filehash, fileservername, _thunkto, callback)
- }
- else {
- callback(true);
- }
- }
- }
- };
- _xhr.send(_fd);
- }
- U.UF.UP.html5Upload.deleteUploadFile = function (file) {
- if (file.fileReader) {
- file.fileReader.abort();
- }
- if (file.xhr) {
- file.xhr.abort();
- }
- }
- U.UF.UP.html5Upload.deleteUploadAllFile = function () {
- }
- U.UF.UP.flashbottom = {};
- U.UF.UP.addFlashUploadBottom = function (el, name, style, callback, uploadtype) {
- var _divel,
- _width = style._width,
- _height = style._height,
- _uploadbootom = U.selectEl("object", el)[0];
- _name = name || Guid.newGuid();
-
- if (!_uploadbootom) {
- _divel = $$("div", {
- "innerHTML": "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' class='U_MD_D_filePrew' _width='" + style._width + "' _height='" + style._height + "' id='" + _name + "' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0'>" +
- "<param name='movie' value='/img/upload.swf' />" +
- "<param name='menu' value='false' />" +
- "<param name='wmode' value='Opaque' />" +
- "<param name='quality' value='high' />" +
- "<param name='bgcolor' value='ffffff' />" +
- "<param name='allowScriptAccess' value='always' />" +
- "<embed src='/img/upload.swf' quality='high' bgcolor='ffffff' _width='" + style._width + "' _height='" + style._height + "' name='" + _name + "' align='middle' play='true' wmode='transparent' loop='false' quality='high' style='z-index: 0;' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.adobe.com/go/getflashplayer'>" +
- "</embed>" +
- "</object>"
- });
- _uploadbootom = _divel.firstChild;
- el.insertBefore(_uploadbootom, el.firstChild);
- }
-
- U.UF.UP.flashbottom[name] = {
- uploadtype: uploadtype || "*",
- flashbottom: U.selectEl("*" + name, el)[0],
- style: style || {},
- callback: callback || {}
- };
- return _uploadbootom;
- }
- U.UF.UP.flashLoad = function () {
- var i,
- _obj = U.UF.UP.flashbottom;
-
- for (i in _obj) {
-
- if (_obj[i].flashbottom.setUploadStyle) {
- _obj[i].flashbottom.setUploadStyle(i, _obj[i].style, {}, _obj[i].uploadtype);
- }
- }
- }
- U.UF.UP.error = function (e) {
- U.alert(e);
- }
- U.UF.UP.select = function (bottomid, filesarr) {
- var _obj = U.UF.UP.flashbottom[bottomid];
- _obj.callback.select(filesarr);
- }
- U.UF.UP.generateFileHash = function (flashbottom, fileid, i, j) {
- flashbottom.generateFileHash(fileid, 0, 0);
- }
- U.UF.UP.getHashCallBack = function (md5value, uploadid, fileid) {
- var _obj = U.UF.UP.flashbottom[uploadid];
- _obj.callback.getHashCallBack(md5value, fileid);
- }
- U.UF.UP.progress = function (speedobj, uploadid, fileid, str) {
- var _obj = U.UF.UP.flashbottom[uploadid];
- _obj.callback.progress(speedobj, fileid, str);
- }
- U.UF.UP.flashUpload = function (flashbottom, fileid, url, i, j) {
- flashbottom.upload(url, fileid, i, j);
- }
- U.UF.UP.uploadComplete = function (e, uploadid, fileid) {
- var _obj = U.UF.UP.flashbottom[uploadid];
- _obj.callback.uploadComplete(e, fileid);
- }
- U.UF.UP.getData = function (request, uploadid, fileid) {
- var _obj = U.UF.UP.flashbottom[uploadid];
- _obj.callback.getData(request, fileid);
- }
- U.UF.UP.endUpload = function (uploadid) {
- var _obj = U.UF.UP.flashbottom[uploadid];
- _obj.callback.endUpload();
- }
- U.UF.UP.deleteUploadFile = function (flashbottom, i, j) {
- flashbottom.deleteUploadFile(i, j);
- }
- U.UF.UP.deleteReferenceFile = function (flashbottom, i) {
- flashbottom.deleteReferenceFile(i);
- }
- U.UF.UP.deleteUploadAllFile = function (flashbottom) {
- flashbottom.deleteUploadAllFile();
- }
- U.UF.UP.download = function (filename, filepath, url) {
- var _filenameinput = $$("input", { "type": "text", "value": encodeURIComponent(filename), "name": "filename" }),
- _filepathinput = $$("input", { "type": "text", "value": filepath, "name": "filepath" });
-
- U.UF.UP.inputUpload([_filenameinput, _filepathinput], url);
- }
- U.UF.UP.getFileNameAndExtension = function (filename) {
- filename = filename.toLocaleLowerCase();
- var _num = filename.lastIndexOf("."),
- _index = filename.lastIndexOf("\\"),
- _xindex = filename.lastIndexOf("/"),
- _name = filename.substr((_index > _xindex ? _index : _xindex) + 1, _num),
- _extension = filename.substr(_num + 1)
- ;
- return [_name, _extension];
- }
- U.UF.UP.isImg = function (name) {
- var _extension = U.UF.UP.getFileNameAndExtension(name.toLowerCase())[1];
- return ["jpg", "gif", "png", "bmp", "jpeg"].indexOf(_extension) > -1;
- }
- U.UF.UP.minUnitToMaxUnit = function (filesize) {
- var _unitarr = ["B", "KB", "M", "G", "TB"],
- _unit = (filesize + "").replace(U.UF.S.Num, ""),
- i = _unitarr.indexOf(_unit) < 0 ? 0 : _unitarr.indexOf(_unit);
- filesize = parseFloat(filesize);
-
- while (filesize > 1024) {
- filesize /= 1024;
- i++;
- }
- return parseInt(filesize.toFixed(2)) + _unitarr[i];
- }
- U.UF.UP.maxUnitToByte = function (filesize) {
- var _unitarr = ["B", "KB", "M", "G", "TB"],
- _unit = (filesize + "").replace(U.UF.S.Num, ""),
- i = _unitarr.indexOf(_unit);
- i = i < 0 ? 0 : i;
- return parseFloat(filesize) * Math.pow(1024, i);
- }
-
- ;
- Namespace.register("U.UF.F");
- U.UF.F.isTop = false;
- U.UF.F.hisTory = true;
- U.UF.F.maskFrame = function () {
- return $$("div", { "style": { "cssText": "width:100%;height:100%;position:absolute;top:0;left:0;" } }, document.body);
- }
- U.UF.F.windowZooming = function (el) {
- var _csstext = el.initcsstext,
- _ismax = el.ismaximize;
-
- if (_ismax) {
- el.style.cssText = _csstext;
- el.ismaximize = false;
- }
-
- else {
- el.initcsstext = el.style.cssText;
- el.ismaximize = true;
-
- U.selectEl(el).css({
- "width": "100%",
- "height": "100%",
- "top": "0px",
- "left": "0px"
- });
- }
- U.MD.F.W.reSize();
- }
- U.UF.F.windowMinimize = function (el) {
-
- el.style.cssText += "display:none";
-
- }
- U.UF.F.closeWindow = function (el, str) {
- var _el = U.selectEl(el);
-
-
-
-
-
- _el.css("display", "none");
-
- }
- U.UF.F.windowTopCenter = function (el) {
-
-
-
- var _scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop,
-
- _iwidth = document.documentElement.clientWidth,
-
- _iheight = document.documentElement.clientHeight;
- el.style.display = "block";
- _zindex = (US || parent.US).ZINDEX++;
- U.selectEl(el).css({
- "zIndex": _zindex,
-
- "left": (_iwidth - el.clientWidth) / 2 + "px",
-
- "top": (_iheight - el.clientHeight) / 2 + "px"
- });
-
- }
- U.UF.F.topWindow = function (el) {
- var _zindex,
- _el1 = U.UF.F.getWindow(el),
- _el3;
- if (_el1 && _el1.length || el && el.length) {
- for (var i = 0; i < _el1.length; i++) {
- _el3 = U.selectEl(_el1[i]).Parent();
-
- if (_el3 && (_el3 == document.body || _el3.id == "usestudio_server" || _el3.id == "U_MD_Home") && ($(_el1[i]).attr("__top__") != "false" && _el1[i]["__top__"] != "false")) {
- _zindex = (US || parent.US).ZINDEX++;
-
- U.selectEl(_el1[i]).addAttrArray({ "style": { "cssText": _el1[i].style.cssText + ";z-index:" + _zindex + ";display:block" } });
- }
- }
- }
- }
- U.UF.F.getWindow = function (el) {
- var _arr = [],
- _el2 = el,
- _el3 = document.body,
- _el4 = U.selectEl("#U_MD_Home")[0] || U.selectEl("#usestudio_server")[0] || _el3;
-
- if (_el4) {
-
- while ((_el2 = U.UF.EL.offsetParent(_el2, true)) && (_el2 && (_el2 != _el4 && _el2 != _el3))) {
- if (_el2.style.position != "relative") {
- _arr.push(_el2);
- }
- _el2 = _el2.parentNode;
- }
- return _arr;
- }
- }
- U.UF.F.clickTopWindow = function (cb) {
-
- U.selectEl(document.body).bind({
- mousedown: function () {
-
- if (U.UF.C.isFunction(cb)) {
- cb(event.srcElement, true);
- }
-
- top.U.UF.F.topWindow(event.srcElement, true);
- }
- });
- }
- U.UF.F.stretching = function (obj1, str) {
- var e = window.event;
-
-
-
-
- var _disX, _disY, _dragMinWidth = 70, _dragMinHeight = 70;
-
-
-
- e.preventDefault();
- _disX = e.clientX;
- _disY = e.clientY;
- var _iparenttop = obj1.offsetTop;
- var _iparentleft = obj1.offsetLeft;
- var _iparentwidth = obj1.offsetWidth;
- var _iparentheight = obj1.offsetHeight;
- if (!$("#U_UF_F_drag_flag")[0]) {
- var _div = $$("div", { "style": { "cssText": "width: 100%;height: 100%;z-index: 99999;position: absolute;top:0;left:0;" }, "id": "U_UF_F_drag_flag" }, document.body);
-
-
- }
- var _windowfun = {
- "mousemove": function (e) {
- e = e || event;
- var _iL = e.clientX - _disX - 3;
-
- var _iT = e.clientY - _disY;
-
- var _maxw = document.documentElement.clientWidth - _iparentleft - 2;
- var _maxh = document.documentElement.clientHeight - _iparenttop - 2;
- if (str == "bottom") {
- var _ih = _iT + _iparentheight;
- if (_ih < _dragMinHeight) { _ih = _dragMinHeight } else if (_ih > _maxh) { _ih = _maxh; };
-
-
- obj1.style.height = _ih + 'px';
- }
- if (str == "right") {
- var _iw = _iL + _iparentwidth
- if (_iw < _dragMinWidth) {
- _iw = _dragMinWidth
- } else if (_iw > _maxw) {
- _iw = _maxw;
- };
-
- obj1.style.width = _iw + 'px';
- }
- if (str == "top") {
- var _ih = _iparentheight - _iT
- obj1.style.top = _iparenttop + _iT + 'px';
- if (obj1.style.top < '0') {
- obj1.style.top = '0px';
- document.onmousemove = null;
- }
- if (_ih < _dragMinHeight) {
- var _bh = _ih
- _ih = _dragMinHeight;
- obj1.style.top = (_iparenttop + _iT) - (_dragMinHeight - _bh) + 'px';
- }
- obj1.style.height = _ih - '2' + 'px';
- }
- if (str == "left") {
- var _iw = _iparentwidth - _iL
- obj1.style.left = _iparentleft + _iL + 'px';
- if (_iw < _dragMinWidth) {
- var _bl = _iw
- _iw = _dragMinWidth
- obj1.style.left = (_siparentleft + _iL) - (_dragMinWidth - _bl) + 'px';
- }
- obj1.style.width = _iw - '2' + 'px';
- }
- if (str == "rightBottom") {
- var _iw = _iL + _iparentwidth;
- var _ih = _iT + _iparentheight;
- if (_iw < _dragMinWidth) {
- _iw = _dragMinWidth
- } else if (_iw > _maxw) {
- _iw = _maxw;
- };
- obj1.style.width = _iw - '2' + 'px';
- if (_ih < _dragMinHeight) {
- _ih = _dragMinHeight;
- } else if (_ih > _maxh) {
- _ih = _maxh;
- };
- obj1.style.height = _ih + 'px';
- }
- if (str == "rightTop") {
- var _iw = _iL + _iparentwidth;
- var _ih = _iparentheight - _iT;
- obj1.style.top = _iparenttop + _iT + 'px';
- if (obj1.style.top < '0') { obj1.style.top = '0px'; document.onmousemove = null; }
- if (_iw < _dragMinWidth) {
- _iw = _dragMinWidth
- } else if (_iw > _maxw) { _iw = _maxw; };
- obj1.style.width = _iw + 'px';
- if (_ih < _dragMinHeight) {
- var _bh = _ih
- _ih = _dragMinHeight;
- obj1.style.top = (_iparenttop + _iT) - (_dragMinHeight - _bh) + 'px';
- } else if (_ih > (_iparenttop + _iparentheight)) {
- _ih = (_iparenttop + _iparentheight)
- };
- obj1.style.height = _ih - '2' + 'px';
- }
- if (str == "leftTop") {
- var _iw = _iparentwidth - _iL
- obj1.style.left = _iparentleft + _iL + 'px';
- var _ih = _iparentheight - _iT
- obj1.style.top = _iparenttop + _iT + 'px';
- if (obj1.style.top < '0') { obj1.style.top = '0px'; document.onmousemove = null; }
- if (_iw < _dragMinWidth) {
- var _bl = _iw;
- _iw = _dragMinWidth;
- obj1.style.left = (_iparentleft + _iL) - (_dragMinWidth - _bl) + 'px';
- } else if (_iw > (_iparentleft + _iparentwidth)) {
- _iw = (_iparentleft + _iparentwidth)
- };
- obj1.style.width = _iw - '2' + 'px';
- if (_ih < _dragMinHeight) {
- var _bh = _ih;
- _ih = _dragMinHeight;
- obj1.style.top = (_iparenttop + _iT) - (_dragMinHeight - _bh) + 'px';
- } else if (_ih > (_iparenttop + _iparentheight)) {
- _ih = (_iparenttop + _iparentheight)
- };
- obj1.style.height = _ih - '2' + 'px';
- }
- if (str == "leftBottom") {
- var _iw = _iparentwidth - _iL;
- obj1.style.left = _iparentleft + _iL + 'px';
- var _ih = _iT + _iparentheight;
- if (_iw < _dragMinWidth) {
- var _bl = _iw;
- _iw = _dragMinWidth;
- obj1.style.left = (_iparentleft + _iL) - (_dragMinWidth - _bl) + 'px';
- } else if (_iw > (_iparentleft + _iparentwidth)) {
- _iw = (_iparentleft + _iparentwidth)
- };
- obj1.style.width = _iw - '2' + 'px';
- if (_ih < _dragMinHeight) {
- _ih = _dragMinHeight;
- } else if (_ih > _maxh) {
- _ih = _maxh;
- };
- obj1.style.height = _ih - '2' + 'px';
- }
- if (((str == 'left' || str == 'leftTop' || str == 'leftBottom') && _iw == _dragMinWidth) || ((str == 'top' || str == 'rightTop' || str == 'leftTop') && _ih == _dragMinHeight)) {
- document.onmousemove = null;
- };
- return false;
- },
- "mouseup": function () {
- document.onmousemove = null;
- document.onmouseup = null;
- if ($("#U_UF_F_drag_flag")[0]) {
- U.selectEl("#U_UF_F_drag_flag").remove();
- }
- U.selectEl(document.body).unbind(_windowfun);
- }
- }
- U.selectEl(document.body).bind(_windowfun);
- }
- U.UF.F.drag = function (el, cb1, cb2) {
-
- var _x, _y, _l, _t, _drag;
- var _event = event || window.event;
-
- _drag = el;
- _x = _event.clientX;
- _y = _event.clientY;
- _l = _drag.offsetLeft;
- _t = _drag.offsetTop;
-
- var _windowfun = {
-
- "mousemove": function (event) {
-
- if (_drag) {
-
- var _event = event || window.event,
- _newx = _event.clientX - _x,
- _newy = _event.clientY - _y,
- _left = _newx + _l,
- _top = _newy + _t,
- _body = U.selectEl(document.body)[0];
-
-
-
-
-
- _drag.style.left = _left + 'px';
- _drag.style.top = _top + 'px';
- if (!$("#U_UF_F_drag_flag")[0] && (_newx != 0 || _newy != 0)) {
- var _div = $$("div", { "style": { "cssText": "width: 100%;height: 100%;z-index: 99999;position: absolute;top:0;left:0;" }, "id": "U_UF_F_drag_flag" }, document.body);
- }
- if (cb1 && typeof cb1 == "function" && _newx != 0 && _newy != 0) { cb1(); }
- }
- },
-
- "mouseup": function (event) {
-
- if (_drag && cb2 && typeof cb2 == "function") { cb2(el) };
- if ($("#U_UF_F_drag_flag")[0]) {
- U.selectEl("#U_UF_F_drag_flag").remove();
- }
-
- _drag = null;
- U.selectEl(document.body).unbind(_windowfun);
- }
- }
- U.selectEl(document.body).bind(_windowfun);
- }
- U.UF.F.dragSelect = function (el, fun) {
-
- if (event.button != 2) {
- var _x,
- _y,
- _dragel,
- _mousep = U.UF.EL.getMousePosition(el),
- _record = { x: _mousep.x, y: _mousep.y },
-
- _mousemove = function () {
-
- U.UF.F.dragSelect.drag(el, _mousep, _dragel, fun, _record);
- },
-
- _mouseup = function () {
- U.selectEl(_dragel).remove();
-
- U.selectEl(document).unbind({
- "mousemove": _mousemove,
- "mouseup": _mouseup
- });
- U.selectEl(el).unbind({
- "scroll": _mousemove
- });
- };
-
- _mousep.left = el.scrollLeft;
- _mousep.top = el.scrollTop;
- _x = _mousep.x;
- _y = _mousep.y;
-
- _dragel = $$("div", { "style": { "cssText": "position:absolute;width:0;height:0;font-size:0;margin:0;padding:0;border:1px solid #89b1e6;background-color:#c3d5ed;z-index:1000;filter:alpha(opacity:60);opacity:.6;background-image: url(/img/UXZT.png); display: inline-block; z-index: 1000; zoom: 1;" + "top:" + _y + "px;left:" + _x + "px;zIndex:" + US.ZINDEX + 1 } }, el);
-
- U.selectEl(document).bind({
- "mousemove": _mousemove,
- "mouseup": _mouseup
- });
- U.selectEl(el).bind({
- "scroll": _mousemove
- });
- }
- else {
- if (el.dragel) {
- el.dragel = null;
- }
- }
- }
- U.UF.F.dragSelect.drag = function (el, mouseup, dragel, fun, record) {
- var _m = event.type == "scroll" ? record : U.UF.EL.getMousePosition(el),
- _left = mouseup.x + mouseup.left,
- _top = mouseup.y + mouseup.top,
- _ctop = _m.y + el.scrollTop,
- _cleft = _m.x + el.scrollLeft,
- _w = Math.abs(_cleft - _left),
- _h = Math.abs(_ctop - _top),
- _l = Math.min(_cleft, _left),
- _t = Math.min(_ctop, _top)
- ;
-
- record.x = _m.x;
- record.y = _m.y;
-
- U.selectEl(dragel).addAttrArray({ "style": { "cssText": "width:" + _w + "px;height:" + _h + "px;top:" + _t + "px;left:" + _l + "px;" } });
-
- U.UF.F.dragSelect.isLocation(dragel, el, { "width": _w, "height": _h, "left": _l, "top": _t }, fun);
- }
- U.UF.F.dragSelect.isLocation = function (dragel, el, obj, fun) {
- var i,
- _left,
- _top,
- _width,
- _height,
- _arr = [],
- _child = U.selectEl(el).Child()
- ;
-
- for (i = 0; i < _child.length; i++) {
-
- if (_child[i] != dragel) {
- _left = _child[i].offsetLeft;
- _top = _child[i].offsetTop;
- _width = _child[i].offsetWidth;
- _height = _child[i].offsetHeight;
-
- if ((obj.left < _left + _width && obj.left + obj.width > _left) && (obj.top < _top + _height && obj.top + obj.height > _top)) {
- _arr.push(_child[i]);
- }
- }
- }
-
- if (fun) {
- fun(_arr);
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ;
- U.UF.C.start = function () {
-
- U.UF.EV.addPrototype(String, U.UF.C.String);
-
- U.UF.EV.addPrototype(Number, U.UF.C.Number);
-
- U.UF.EV.addPrototype(Array, U.UF.C.Array);
-
- U.Json.init()
-
- U.UF.CP.init();
-
- U.UF.S.ArrayBuffer();
-
- U.UF.C.loadControls();
-
-
- if ("ontouchstart" in document) {
- U.UF.CP.touch();
- }
- }
- U.UF.C.loadControls = function () {
- var _allscript = U.selectEl("script"),
- _flag = true,
- i;
-
- if (U.UF.CI.getUserPort()) {
-
- for (i = 0; i < _allscript.length; i++) {
-
- if ($(_allscript)[i].src == "/uform.js" && U.selectEl(_allscript).attr("include") === "complex") {
- U.UF.DL.asynLoadJs({ type: "text/javascript", src: "/js/Controls/Complex.js" });
- U.UF.DL.asynLoadCss({ "href": "/css/Controls/Complex.css", type: "text/css", rel: "stylesheet" });
- }
-
- if ($(_allscript)[i].src == "/uform.js" && U.selectEl(_allscript).attr("include") === "all") {
- U.UF.DL.asynLoadJs({ type: "text/javascript", src: "/js/Controls/index.js" });
- U.UF.DL.asynLoadCss({ "href": "/css/Controls/index.css", type: "text/css", rel: "stylesheet" });
- _flag = false;
- }
- }
-
- if (_flag) {
- U.UF.DL.asynLoadJs({ type: "text/javascript", src: "/js/Controls/Basic.js" });
- U.UF.DL.asynLoadCss({ "href": "/css/Controls/Basic.css", type: "text/css", rel: "stylesheet" });
- }
- }
-
- else {
-
- for (i = 0; i < _allscript.length; i++) {
-
- if ($(_allscript)[i].src == "/uform.js" && U.selectEl(_allscript).attr("include") === "mtcomplex") {
- U.UF.DL.asynLoadJs({ type: "text/javascript", src: "http://m.1473.cn/Js/Controls/Complex.js" });
- U.UF.DL.asynLoadCss({ "href": "http://m.1473.cn/Css/Controls/Complex.css", type: "text/css", rel: "stylesheet" });
- }
-
- if ($(_allscript)[i].src == "/uform.js" && U.selectEl(_allscript).attr("include") === "mtall") {
- U.UF.DL.asynLoadJs({ type: "text/javascript", src: "http://m.1473.cn/Js/Controls/index.js" });
- U.UF.DL.asynLoadCss({ "href": "http://m.1473.cn/Css/Controls/index.css", type: "text/css", rel: "stylesheet" });
- _flag = false;
- }
- }
-
- if (_flag) {
- U.UF.DL.asynLoadJs({ type: "text/javascript", src: "http://m.1473.cn/Js/Controls/Basic.js" });
- U.UF.DL.asynLoadCss({ "href": "http://m.1473.cn/Css/Controls/Basic.css", type: "text/css", rel: "stylesheet" });
- }
- }
- }
- U.UF.C.start();
- Namespace.register("U.MD.U.L");
- Namespace.register("U.MD.U.LO");
- U.MD.U.L.loginCallBack;
- U.MD.U.L.isLogining = false;
- U.MD.U.L.login = U.MD.U.L.DLTC = function (fun) {
- var _iframe = U.selectEl("#U_MD_HomeC_Pop iframe")[0];
- if ($("#U_MD_HomeC_Pop")[0]) {
- U.UF.F.windowTopCenter($("#U_MD_HomeC_Pop")[0]);
- try {
-
- if (U.UF.C.isFunction(fun)) {
- U.MD.U.L.loginCallBack = fun;
- }
- U.selectEl("input", _iframe.contentWindow.document)[0].focus();
- _iframe.contentWindow.U.MD.U.L.init();
- }
- catch (e) { }
- }
- else {
- var _iframe = $$("iframe", { "frameborder": "no", "border": "0", "scrolling ": "no", "style": { "cssText": "border:0; width:100%; height:100%;" }, "id": "UI_Login", "name": "UI_Login", "frameborder": "no", "border": "0", "scrolling ": "no", "width": "360px", "height": "480px", "src": "https://edu.cocorobo.cn/course/login?type=2" });
- new U.UF.UI.form("", _iframe,
- {
- "id": "U_MD_HomeC_Pop",
- "style": { "width": "36%", "height": "90%", "overflow": 'hidden' },
- },
- {
- isdrag: false,
- isstretching: false,
- isenlarge: false,
- isnarrow: false
- });
-
- U.UF.DL.iframeLoad(_iframe, function () {
-
- if (U.UF.C.isFunction(fun)) {
- U.MD.U.L.loginCallBack = fun;
- }
- _iframe.contentWindow.U.MD.U.L.loginCallBack = U.MD.U.L.defaultCallBack;
- });
- }
- return _iframe;
- }
- U.MD.U.L.register = function (fun) {
- var _iframe = U.MD.U.L.login();
- try {
- _iframe.contentWindow.U.MD.U.R.register();
- }
- catch (e) {
- U.UF.DL.iframeLoad(_iframe, function () {
-
- if (U.UF.C.isFunction(fun)) {
- U.MD.U.L.loginCallBack = fun;
- }
- _iframe.contentWindow.U.MD.U.L.loginCallBack = U.MD.U.L.defaultCallBack;
- _iframe.contentWindow.U.UF.N.addHash('register');
- });
- }
- }
- U.MD.U.L.retrieve = function () {
- var _iframe = U.MD.U.L.login();
- try {
- _iframe.contentWindow.U.MD.U.F.findPassword();
- }
- catch (e) {
- U.UF.DL.iframeLoad(_iframe, function () {
- _iframe.contentWindow.U.UF.N.addHash('findPassword');
- });
- }
- }
- U.MD.U.L.defaultCallBack = function (r, iscookie) {
- var _userinfo,
- _backgroudimage,
- _str,
- _context = r.context,
- _address = _context[1],
- _username = _context[2],
- _password = _context[3];
-
- r = r.value;
-
- switch (r) {
- case null:
- _str = "系统繁忙!请重试";
- break;
- case 0:
- _str = "帐号不存在!";
- break;
- case 1:
- _str = "密码错误!";
- break;
- case 2:
- _str = "该用户不允许被访问!请联系管理员";
- break;
- default:
- if (r) {
-
- U.MD.U.LO.emptyUserInfo();
-
- if (!_address) {
- U.UF.CI.getUserLocation(U.MD.U.L.addUserAccess);
- }
- _userinfo = U.MD.U.L.setUserInfo(r);
- U.MD.U.L.getLoginUserInfo(_username || US.userInfo.UserName);
- if ($("#U_MD_D_BDI")[0] && U.selectEl('#U_MD_D_BG')[0]) {
-
- U.MD.U.L.printUserInfo();
- _backgroudimage = U.MD.D.B.split(US.userInfo.UserBackGroundImage);
- U.MD.D.B.setBackgroundImage(_backgroudimage[0], _backgroudimage[1]);
- }
-
- if (_str && iscookie !== true) {
- U.alert(_str);
- }
-
- if ($("#U_MD_HomeC_Pop")[0]) {
-
- U.selectEl("#U_MD_HomeC_Pop")[0].close();
- }
- U.MD.O && U.MD.O.P.connect();
- }
-
- }
- if (_str) {
- U.alert(_str);
- }
- }
- U.MD.U.L.isLogin = function (fun) {
- if (!US.userInfo.userid) {
- U.MD.U.L.login(fun);
- return true;
- }
- return false;
- }
- U.MD.U.L.setLoginCallBack = function (fun) {
-
- if (U.MD.U.L.isLogin()) {
- U.MD.U.L.loginCallBack = fun;
- }
-
- else {
- fun();
- return true;
- }
- }
- U.MD.U.L.cookieLogin = function () {
- var _cookie = U.MD.U.L.getCookieByUserId(),
- _address = US.city.userAllLocation || "";
-
- if (_cookie && _cookie.userid && _cookie.userid.length == 36) {
- U.MD.U.L.isLogining = "cookie";
- U.A.Request(US.USER, ["LoginByCookie", _cookie.userid, _cookie.username], U.MD.U.L.defaultCallBack, ["", _address]);
- }
- }
- U.MD.U.L.getCookieByUserId = function (userid) {
- var i, _cookiearr = U.MD.U.L.cookieToArray("usestudiosso");
-
- if (_cookiearr.userid) {
-
- if (userid) {
-
- for (i = 0; i < _cookiearr.userid.length; i++) {
- if (_cookiearr.userid[i] == userid) {
- break;
- }
- }
- }
-
- else {
-
- i = _cookiearr.userid.length - 1;
- }
-
- for (var c in _cookiearr) {
-
- _cookiearr[c] = decodeURIComponent(_cookiearr[c][i]);
- }
- }
-
- return _cookiearr;
- }
- U.MD.U.L.cookieToArray = function (key) {
- var i,
- _cookieobj = {},
- _cookie = U.UF.Cookie.get("usestudiosso");
- if (_cookie) {
- _cookie = _cookie.split("&");
- for (i = 0; i < _cookie.length; i++) {
- _cookie[i] = _cookie[i].split("=");
-
- if (!_cookieobj[_cookie[i][0]]) {
- _cookieobj[_cookie[i][0]] = [];
- }
- _cookieobj[_cookie[i][0]].push(decodeURIComponent(_cookie[i][1]));
- }
- }
- return _cookieobj;
- }
- U.MD.U.L.getLoginUserInfo = function (username) {
- U.A.Request(US.USER, ["GetUserLoginData", username], U.MD.U.L.asynGetLoginUserInfo);
- }
- U.MD.U.L.asynGetLoginUserInfo = function (r) {
- r = r.value;
- US.friend = r;
- U.MD.U.L.initUserLogin(US.userInfo);
- if (U.MD.D && U.MD.D.IsUseStudio || U.selectEl("#usestudio_server")[0]) {
- U.MD.F && U.MD.F.N.friendMessageHandle([r.unreadfirendmessage, r.unreadgroupmessage]);
- }
- }
- U.MD.U.L.setUserInfo = function (userinfo) {
- US.userInfo = userinfo[0];
- US.userInfo.LoginId = userinfo[2];
- US.friend.onlinefirendinfo = userinfo[1];
- return US.userInfo;
- }
- U.MD.U.L.initUserLogin = function () {
- var _userinfo = US.userInfo;
- U.MD.UI && U.MD.UI.flashEmptyUpload && U.MD.UI.flashEmptyUpload();
-
- if (U.UF.C.isFunction(U.MD.U.L.loginCallBack)) {
- U.MD.U.L.loginCallBack(_userinfo);
- }
- U.MD.F && U.MD.F.initFriend();
-
- if (U.MD.D && U.MD.D.IsUseStudio) {
- U.MD.D.I.openApplication("disk", { "userid": _userinfo.UserId, "directoryid": US.FTPFOLDERID });
- }
-
- if (!US.userInfo.UserEmail && !$("#usestudio_server")[0]) {
- U.MD.U.P.userDataSet();
- }
- }
- U.MD.U.L.addUserAccess = function () {
-
- if (US.city.userAllLocation) {
- U.A.Request(US.USER, ["RecordUserClientInfo", US.userInfo.UserName, "", "", US.city.userAllLocation, ""],
- function () { });
- }
- }
- U.MD.U.L.printUserInfo = function () {
- var _childel,
- _userinfo = US.userInfo,
- _userimage = U.MD.C.getHeadImage(_userinfo.UserThumbnailImageHead),
- _el = U.selectEl("#U_MD_D_BDI");
- if (_el[0]) {
-
- _el.addAttrArray({
- "className": "U_MD_D_BDI"
- })[0];
-
- if (_el.find("img")[0]) {
-
- _el.find("img").addAttrArray({
- "onerror": U.MD.C.imgError,
- "title": _userinfo.UserNickName,
- "onclick": function () {
- U.MD.D.I.openApplication("set");
- },
- "src": U.MD.C.getHeadImage(_userinfo.UserThumbnailImageHead)
- });
- }
-
- else {
- $$("img", {
- "onerror": U.MD.C.imgError,
- "onerror": U.MD.C.imgError,
- "title": _userinfo.UserNickName,
- "onclick": function () {
- U.MD.D.I.openApplication("set");
- },
- "src": U.MD.C.getHeadImage(_userinfo.UserThumbnailImageHead)
- }, _el[0])
- }
- _childel = U.selectEl("#U_MD_D_BDL").Child();
- _childel[0].style.display = _childel[1].style.display = "none";
- _childel[2].style.display = "block";
- }
- }
- U.MD.U.LO.logoutSystem = function (callback) {
-
- if (US.userInfo.userid) {
-
- U.UF.UI.confirm("是否退出" + US.userInfo.username + "账号", function () {
-
- U.A.Request(US.Config.server + "logout", [], function (res) {
- U.alert("退出成功!")
- window.location.reload();
- }, [], { "type": "POST", "withCredentials": true });
- });
- }
- }
- U.MD.U.LO.logout = function (callback) {
-
-
-
-
- U.MD.U.LO.clearCookie(function () {
- U.MD.U.LO.emptyUserInfo();
- if ($('#UI_Login')[0]) {
- U.selectEl('#UI_Login')[0].contentWindow.U.MD.U.OT.logout();
- }
-
- if ($("#U_MD_D_BDI")[0]) {
-
- U.MD.U.LO.logoutStyle();
- U.MD.D.T.taskbar.clear();
- U.UF.UI.form.closeWindows();
- }
- U.UF.C.isFunction(callback) && callback();
- });
- }
- U.MD.U.LO.clearCookie = function (callback) {
-
- if (US.userInfo.userid) {
- var _iscookie = U.UF.Cookie.get("usestudiosso", "userid").indexOf(US.userInfo.userid) > -1;
-
- if (_iscookie) {
-
- U.A.Request(US.USER, ["UserOffline", US.userInfo.userid], function () { U.UF.C.isFunction(callback) && callback(); });
- } else {
- U.UF.C.isFunction(callback) && callback();
- }
- }
- }
- U.MD.U.LO.emptyUserInfo = function () {
- US.userInfo = {};
- US.friend = {};
- if ($("#U_MD_D_BG")[0]) {
- U.MD.D.B.setBackgroundImage(U.MD.D.B.url);
- }
- }
- U.MD.U.LO.logoutStyle = function () {
-
- U.selectEl("#U_MD_D_BDI").addAttrArray({
- "innerHTML": "",
- "className": "U_MD_D_BDI U_Img"
- });
-
- var _childel = U.selectEl("#U_MD_D_BDL").childs();
- _childel[0].style.display = _childel[1].style.display = "block";
- _childel[2].style.display = "none";
-
- U.selectEl("#U_MD_F_H_R").css("display", "none");
-
- U.selectEl("#U_MD_D_MG_OA").Parent(2).style.display = "none";
-
-
- }
- Namespace.register("U.MD.U.OT");
- U.MD.U.OT.perfectUserInfo = function (userinfo, username) {
- if ($("#U_MD_U_OT_B_Pop")[0]) {
- U.UF.F.windowTopCenter($("#U_MD_U_OT_B_Pop")[0]);
- }
- else {
- var _iframe = $$("iframe", { "style": { "border": "0", "float": "left" }, "id": "U_MD_U_OT_B_Iframe", "name": "UI_Login", "frameborder": "0", "width": "400px", "height": "290px", "src": US.MAINDOMAIN + "/CompleteInformation.htm" });
- new U.UF.UI.form("", _iframe,
- {
- "id": "U_MD_U_OT_B_Pop",
- "style": {
- "width": "400px",
- "height": "340px"
- }
- },
- {
- isdrag: false,
- isstretching: false,
- isenlarge: false,
- isnarrow: false
- });
-
- U.UF.DL.iframeLoad(_iframe, function () {
- if ($("#U_MD_HomeC_Pop")[0]) {
- U.selectEl("#U_MD_HomeC_Pop")[0].close();
- }
- _iframe.contentWindow.U.MD.U.OT.perfectUserInfoInit(userinfo, username);
- });
- }
- }
-
- ;
- Namespace.register("U.UF.EC");
- U.UF.EC.add32 = function (a, b) {
- return (a + b) & 0xFFFFFFFF;
- };
- U.UF.EC.hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
- U.UF.EC.cmn = function (q, a, b, x, s, t) {
- a = U.UF.EC.add32(U.UF.EC.add32(a, q), U.UF.EC.add32(x, t));
- return U.UF.EC.add32((a << s) | (a >>> (32 - s)), b);
- }
- U.UF.EC.md5cycle = function (x, k) {
- var a = x[0],
- b = x[1],
- c = x[2],
- d = x[3];
- a += (b & c | ~b & d) + k[0] - 680876936 | 0;
- a = (a << 7 | a >>> 25) + b | 0;
- d += (a & b | ~a & c) + k[1] - 389564586 | 0;
- d = (d << 12 | d >>> 20) + a | 0;
- c += (d & a | ~d & b) + k[2] + 606105819 | 0;
- c = (c << 17 | c >>> 15) + d | 0;
- b += (c & d | ~c & a) + k[3] - 1044525330 | 0;
- b = (b << 22 | b >>> 10) + c | 0;
- a += (b & c | ~b & d) + k[4] - 176418897 | 0;
- a = (a << 7 | a >>> 25) + b | 0;
- d += (a & b | ~a & c) + k[5] + 1200080426 | 0;
- d = (d << 12 | d >>> 20) + a | 0;
- c += (d & a | ~d & b) + k[6] - 1473231341 | 0;
- c = (c << 17 | c >>> 15) + d | 0;
- b += (c & d | ~c & a) + k[7] - 45705983 | 0;
- b = (b << 22 | b >>> 10) + c | 0;
- a += (b & c | ~b & d) + k[8] + 1770035416 | 0;
- a = (a << 7 | a >>> 25) + b | 0;
- d += (a & b | ~a & c) + k[9] - 1958414417 | 0;
- d = (d << 12 | d >>> 20) + a | 0;
- c += (d & a | ~d & b) + k[10] - 42063 | 0;
- c = (c << 17 | c >>> 15) + d | 0;
- b += (c & d | ~c & a) + k[11] - 1990404162 | 0;
- b = (b << 22 | b >>> 10) + c | 0;
- a += (b & c | ~b & d) + k[12] + 1804603682 | 0;
- a = (a << 7 | a >>> 25) + b | 0;
- d += (a & b | ~a & c) + k[13] - 40341101 | 0;
- d = (d << 12 | d >>> 20) + a | 0;
- c += (d & a | ~d & b) + k[14] - 1502002290 | 0;
- c = (c << 17 | c >>> 15) + d | 0;
- b += (c & d | ~c & a) + k[15] + 1236535329 | 0;
- b = (b << 22 | b >>> 10) + c | 0;
- a += (b & d | c & ~d) + k[1] - 165796510 | 0;
- a = (a << 5 | a >>> 27) + b | 0;
- d += (a & c | b & ~c) + k[6] - 1069501632 | 0;
- d = (d << 9 | d >>> 23) + a | 0;
- c += (d & b | a & ~b) + k[11] + 643717713 | 0;
- c = (c << 14 | c >>> 18) + d | 0;
- b += (c & a | d & ~a) + k[0] - 373897302 | 0;
- b = (b << 20 | b >>> 12) + c | 0;
- a += (b & d | c & ~d) + k[5] - 701558691 | 0;
- a = (a << 5 | a >>> 27) + b | 0;
- d += (a & c | b & ~c) + k[10] + 38016083 | 0;
- d = (d << 9 | d >>> 23) + a | 0;
- c += (d & b | a & ~b) + k[15] - 660478335 | 0;
- c = (c << 14 | c >>> 18) + d | 0;
- b += (c & a | d & ~a) + k[4] - 405537848 | 0;
- b = (b << 20 | b >>> 12) + c | 0;
- a += (b & d | c & ~d) + k[9] + 568446438 | 0;
- a = (a << 5 | a >>> 27) + b | 0;
- d += (a & c | b & ~c) + k[14] - 1019803690 | 0;
- d = (d << 9 | d >>> 23) + a | 0;
- c += (d & b | a & ~b) + k[3] - 187363961 | 0;
- c = (c << 14 | c >>> 18) + d | 0;
- b += (c & a | d & ~a) + k[8] + 1163531501 | 0;
- b = (b << 20 | b >>> 12) + c | 0;
- a += (b & d | c & ~d) + k[13] - 1444681467 | 0;
- a = (a << 5 | a >>> 27) + b | 0;
- d += (a & c | b & ~c) + k[2] - 51403784 | 0;
- d = (d << 9 | d >>> 23) + a | 0;
- c += (d & b | a & ~b) + k[7] + 1735328473 | 0;
- c = (c << 14 | c >>> 18) + d | 0;
- b += (c & a | d & ~a) + k[12] - 1926607734 | 0;
- b = (b << 20 | b >>> 12) + c | 0;
- a += (b ^ c ^ d) + k[5] - 378558 | 0;
- a = (a << 4 | a >>> 28) + b | 0;
- d += (a ^ b ^ c) + k[8] - 2022574463 | 0;
- d = (d << 11 | d >>> 21) + a | 0;
- c += (d ^ a ^ b) + k[11] + 1839030562 | 0;
- c = (c << 16 | c >>> 16) + d | 0;
- b += (c ^ d ^ a) + k[14] - 35309556 | 0;
- b = (b << 23 | b >>> 9) + c | 0;
- a += (b ^ c ^ d) + k[1] - 1530992060 | 0;
- a = (a << 4 | a >>> 28) + b | 0;
- d += (a ^ b ^ c) + k[4] + 1272893353 | 0;
- d = (d << 11 | d >>> 21) + a | 0;
- c += (d ^ a ^ b) + k[7] - 155497632 | 0;
- c = (c << 16 | c >>> 16) + d | 0;
- b += (c ^ d ^ a) + k[10] - 1094730640 | 0;
- b = (b << 23 | b >>> 9) + c | 0;
- a += (b ^ c ^ d) + k[13] + 681279174 | 0;
- a = (a << 4 | a >>> 28) + b | 0;
- d += (a ^ b ^ c) + k[0] - 358537222 | 0;
- d = (d << 11 | d >>> 21) + a | 0;
- c += (d ^ a ^ b) + k[3] - 722521979 | 0;
- c = (c << 16 | c >>> 16) + d | 0;
- b += (c ^ d ^ a) + k[6] + 76029189 | 0;
- b = (b << 23 | b >>> 9) + c | 0;
- a += (b ^ c ^ d) + k[9] - 640364487 | 0;
- a = (a << 4 | a >>> 28) + b | 0;
- d += (a ^ b ^ c) + k[12] - 421815835 | 0;
- d = (d << 11 | d >>> 21) + a | 0;
- c += (d ^ a ^ b) + k[15] + 530742520 | 0;
- c = (c << 16 | c >>> 16) + d | 0;
- b += (c ^ d ^ a) + k[2] - 995338651 | 0;
- b = (b << 23 | b >>> 9) + c | 0;
- a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;
- a = (a << 6 | a >>> 26) + b | 0;
- d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;
- d = (d << 10 | d >>> 22) + a | 0;
- c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;
- c = (c << 15 | c >>> 17) + d | 0;
- b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;
- b = (b << 21 | b >>> 11) + c | 0;
- a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;
- a = (a << 6 | a >>> 26) + b | 0;
- d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;
- d = (d << 10 | d >>> 22) + a | 0;
- c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;
- c = (c << 15 | c >>> 17) + d | 0;
- b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;
- b = (b << 21 | b >>> 11) + c | 0;
- a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;
- a = (a << 6 | a >>> 26) + b | 0;
- d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;
- d = (d << 10 | d >>> 22) + a | 0;
- c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;
- c = (c << 15 | c >>> 17) + d | 0;
- b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;
- b = (b << 21 | b >>> 11) + c | 0;
- a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;
- a = (a << 6 | a >>> 26) + b | 0;
- d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;
- d = (d << 10 | d >>> 22) + a | 0;
- c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;
- c = (c << 15 | c >>> 17) + d | 0;
- b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;
- b = (b << 21 | b >>> 11) + c | 0;
- x[0] = a + x[0] | 0;
- x[1] = b + x[1] | 0;
- x[2] = c + x[2] | 0;
- x[3] = d + x[3] | 0;
- }
- U.UF.EC.md5blk = function (s) {
- var md5blks = [],
- i;
- for (i = 0; i < 64; i += 4) {
- md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);
- }
- return md5blks;
- }
- U.UF.EC.md5blk_array = function (a) {
- var md5blks = [],
- i;
- for (i = 0; i < 64; i += 4) {
- md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);
- }
- return md5blks;
- }
- U.UF.EC.md51 = function (s) {
- var n = s.length,
- state = [1732584193, -271733879, -1732584194, 271733878],
- i,
- length,
- tail,
- tmp,
- lo,
- hi;
- for (i = 64; i <= n; i += 64) {
- U.UF.EC.md5cycle(state, U.UF.EC.md5blk(s.substring(i - 64, i)));
- }
- s = s.substring(i - 64);
- length = s.length;
- tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
- for (i = 0; i < length; i += 1) {
- tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3);
- }
- tail[i >> 2] |= 0x80 << ((i % 4) << 3);
- if (i > 55) {
- U.UF.EC.md5cycle(state, tail);
- for (i = 0; i < 16; i += 1) {
- tail[i] = 0;
- }
- }
-
- tmp = n * 8;
- tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
- lo = parseInt(tmp[2], 16);
- hi = parseInt(tmp[1], 16) || 0;
- tail[14] = lo;
- tail[15] = hi;
- U.UF.EC.md5cycle(state, tail);
- return state;
- }
- U.UF.EC.md51_array = function (a) {
- var n = a.length,
- state = [1732584193, -271733879, -1732584194, 271733878],
- i,
- length,
- tail,
- tmp,
- lo,
- hi;
- for (i = 64; i <= n; i += 64) {
- U.UF.EC.md5cycle(state, U.UF.EC.md5blk_array(a.subarray(i - 64, i)));
- }
-
-
-
-
- a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0);
- length = a.length;
- tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
- for (i = 0; i < length; i += 1) {
- tail[i >> 2] |= a[i] << ((i % 4) << 3);
- }
- tail[i >> 2] |= 0x80 << ((i % 4) << 3);
- if (i > 55) {
- U.UF.EC.md5cycle(state, tail);
- for (i = 0; i < 16; i += 1) {
- tail[i] = 0;
- }
- }
-
- tmp = n * 8;
- tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
- lo = parseInt(tmp[2], 16);
- hi = parseInt(tmp[1], 16) || 0;
- tail[14] = lo;
- tail[15] = hi;
- U.UF.EC.md5cycle(state, tail);
- return state;
- }
- U.UF.EC.rhex = function (n) {
- var s = '',
- j;
- for (j = 0; j < 4; j += 1) {
- s += U.UF.EC.hex_chr[(n >> (j * 8 + 4)) & 0x0F] + U.UF.EC.hex_chr[(n >> (j * 8)) & 0x0F];
- }
- return s;
- }
- U.UF.EC.hex = function (x) {
- var i;
- for (i = 0; i < x.length; i += 1) {
- x[i] = U.UF.EC.rhex(x[i]);
- }
- return x.join('');
- }
- U.UF.EC.toUtf8 = function (str) {
- if (/[\u0080-\uFFFF]/.test(str)) {
- str = unescape(encodeURIComponent(str));
- }
- return str;
- }
- U.UF.EC.utf8Str2ArrayBuffer = function (str, returnUInt8Array) {
- var length = str.length,
- buff = new ArrayBuffer(length),
- arr = new Uint8Array(buff),
- i;
- for (i = 0; i < length; i += 1) {
- arr[i] = str.charCodeAt(i);
- }
- return returnUInt8Array ? arr : buff;
- }
- U.UF.EC.arrayBuffer2Utf8Str = function (buff) {
- return String.fromCharCode.apply(null, new Uint8Array(buff));
- }
- U.UF.EC.concatenateArrayBuffers = function (first, second, returnUInt8Array) {
- var result = new Uint8Array(first.byteLength + second.byteLength);
- result.set(new Uint8Array(first));
- result.set(new Uint8Array(second), first.byteLength);
- return returnUInt8Array ? result : result.buffer;
- }
- U.UF.EC.hexToBinaryString = function (hex) {
- var bytes = [],
- length = hex.length,
- x;
- for (x = 0; x < length - 1; x += 2) {
- bytes.push(parseInt(hex.substr(x, 2), 16));
- }
- return String.fromCharCode.apply(String, bytes);
- }
- U.UF.EC.SparkMD5 = function () {
-
- this.reset();
- }
- U.UF.EC.SparkMD5.prototype.append = function (str) {
-
-
- this.appendBinary(U.UF.EC.toUtf8(str));
- return this;
- };
- U.UF.EC.SparkMD5.prototype.appendBinary = function (contents) {
- this._buff += contents;
- this._length += contents.length;
- var length = this._buff.length,
- i;
- for (i = 64; i <= length; i += 64) {
- U.UF.EC.md5cycle(this._hash, U.UF.EC.md5blk(this._buff.substring(i - 64, i)));
- }
- this._buff = this._buff.substring(i - 64);
- return this;
- };
- U.UF.EC.SparkMD5.prototype.end = function (raw) {
- var buff = this._buff,
- length = buff.length,
- i,
- tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
- ret;
- for (i = 0; i < length; i += 1) {
- tail[i >> 2] |= buff.charCodeAt(i) << ((i % 4) << 3);
- }
- this._finish(tail, length);
- ret = U.UF.EC.hex(this._hash);
- if (raw) {
- ret = U.UF.EC.hexToBinaryString(ret);
- }
- this.reset();
- return ret;
- };
- U.UF.EC.SparkMD5.prototype.reset = function () {
- this._buff = '';
- this._length = 0;
- this._hash = [1732584193, -271733879, -1732584194, 271733878];
- return this;
- };
- U.UF.EC.SparkMD5.prototype.getState = function () {
- return {
- buff: this._buff,
- length: this._length,
- hash: this._hash
- };
- };
- U.UF.EC.SparkMD5.prototype.setState = function (state) {
- this._buff = state.buff;
- this._length = state.length;
- this._hash = state.hash;
- return this;
- };
- U.UF.EC.SparkMD5.prototype.destroy = function () {
- delete this._hash;
- delete this._buff;
- delete this._length;
- };
- U.UF.EC.SparkMD5.prototype._finish = function (tail, length) {
- var i = length,
- tmp,
- lo,
- hi;
- tail[i >> 2] |= 0x80 << ((i % 4) << 3);
- if (i > 55) {
- U.UF.EC.md5cycle(this._hash, tail);
- for (i = 0; i < 16; i += 1) {
- tail[i] = 0;
- }
- }
-
-
- tmp = this._length * 8;
- tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
- lo = parseInt(tmp[2], 16);
- hi = parseInt(tmp[1], 16) || 0;
- tail[14] = lo;
- tail[15] = hi;
- U.UF.EC.md5cycle(this._hash, tail);
- };
- U.UF.EC.SparkMD5.hash = function (str, raw) {
-
-
- return U.UF.EC.SparkMD5.hashBinary(U.UF.EC.toUtf8(str), raw);
- };
- U.UF.EC.SparkMD5.hashBinary = function (content, raw) {
- var hash = U.UF.EC.md51(content),
- ret = U.UF.EC.hex(hash);
- return raw ? U.UF.EC.hexToBinaryString(ret) : ret;
- };
- U.UF.EC.SparkMD5.ArrayBuffer = function () {
-
- this.reset();
- };
- U.UF.EC.SparkMD5.ArrayBuffer.prototype.append = function (arr) {
- var buff = U.UF.EC.concatenateArrayBuffers(this._buff.buffer, arr, true),
- length = buff.length,
- i;
- this._length += arr.byteLength;
- for (i = 64; i <= length; i += 64) {
- U.UF.EC.md5cycle(this._hash, U.UF.EC.md5blk_array(buff.subarray(i - 64, i)));
- }
- this._buff = (i - 64) < length ? new Uint8Array(buff.buffer.slice(i - 64)) : new Uint8Array(0);
- return this;
- };
- U.UF.EC.SparkMD5.ArrayBuffer.prototype.end = function (raw) {
- var buff = this._buff,
- length = buff.length,
- tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
- i,
- ret;
- for (i = 0; i < length; i += 1) {
- tail[i >> 2] |= buff[i] << ((i % 4) << 3);
- }
- this._finish(tail, length);
- ret = U.UF.EC.hex(this._hash);
- if (raw) {
- ret = U.UF.EC.hexToBinaryString(ret);
- }
- this.reset();
- return ret;
- };
- U.UF.EC.SparkMD5.ArrayBuffer.prototype.reset = function () {
- this._buff = new Uint8Array(0);
- this._length = 0;
- this._hash = [1732584193, -271733879, -1732584194, 271733878];
- return this;
- };
- U.UF.EC.SparkMD5.ArrayBuffer.prototype.getState = function () {
- var state = U.UF.EC.SparkMD5.prototype.getState.call(this);
-
- state.buff = U.UF.EC.arrayBuffer2Utf8Str(state.buff);
- return state;
- };
- U.UF.EC.SparkMD5.ArrayBuffer.prototype.setState = function (state) {
-
- state.buff = U.UF.EC.utf8Str2ArrayBuffer(state.buff, true);
- return U.UF.EC.SparkMD5.prototype.setState.call(this, state);
- };
- U.UF.EC.SparkMD5.ArrayBuffer.prototype.destroy = U.UF.EC.SparkMD5.prototype.destroy;
- U.UF.EC.SparkMD5.ArrayBuffer.prototype._finish = U.UF.EC.SparkMD5.prototype._finish;
- U.UF.EC.SparkMD5.ArrayBuffer.hash = function (arr, raw) {
- var hash = U.UF.EC.md51_array(new Uint8Array(arr)),
- ret = U.UF.EC.hex(hash);
- return raw ? U.UF.EC.hexToBinaryString(ret) : ret;
- };
- U.UF.EC.MD5 = function (file, progressCb, cb) {
- }
- ;
- Namespace.register("U.UF.API");
- U.UF.API.user = function () {
- U.UF.DL.asynLoadJs({ type: "text/javascript", charset: "utf8", async: true, src: "http://user.1473.cn/js/User.js" });
- }
- U.UF.API.friend = function () {
- U.UF.DL.asynLoadJs({ type: "text/javascript", charset: "utf8", async: true, src: "http://friend.1473.cn/js/Friend.js" });
- }
- U.UF.API.disk = function () {
- U.UF.DL.asynLoadJs({ type: "text/javascript", charset: "utf8", async: true, src: "http://disk.1473.cn/js/Disk.js" });
- };
- Namespace.register("U.UF.E");
- U.UF.E.table = function (range) {
- var _p,
- _inputo,
- _inputt,
- _frag = $$("frag"),
- _table = U.UF.E.table;
- _table._range = range;
- _p = $$("p", { "style": { "cssText": "text-align: left;font-weight: bold;padding: 10px 0 0 15px;" }, "innerHTML": "表格尺寸: " }, _frag);
- _p = $$("p", { "style": { "cssText": "text-align: left;margin-top: 15px;font-size: 14px;padding-left: 30px;" }, "innerHTML": "列数: " }, _frag);
- _inputo = $$("input", { "type": "number", "style": { "cssText": "width: 80px;margin-left: 65px;" }, "min": "1" }, _p);
- _p = $$("p", { "style": { "cssText": "text-align: left;padding-left: 30px;margin-top: 15px;font-size: 14px;margin-bottom: 22px;" }, "innerHTML": "行数: " }, _frag);
- _inputt = $$("input", { "type": "number", "style": { "cssText": "width: 80px;margin-left: 65px;" }, "min": "1" }, _p);
-
- U.UF.UI.confirm(_frag, function () {
- var _row = _inputo.value;
- var _col = _inputt.value;
- if (_row >= 1 && _col >= 1) {
- _table.addTable(_row, _col);
- }
- });
- U.selectEl(document).unbind('mousedown', U.UF.E.table.removeFocus);
- U.selectEl(document).bind('mousedown', U.UF.E.table.removeFocus);
- };
- U.UF.E.table.load = function (tableel) {
- var _table = U.UF.E.table;
- var _tableEl = tableel;
- if (_tableEl.features) return;
- _tableEl.features = true;
- var _pelDiv = _tableEl.parentNode;
- var _allTd = _tableEl.querySelectorAll("td");
- _allTd.forEach(function (v) {
- U.selectEl(v).rmAttr("width");
- var _value = U.selectEl(v).css("display");
- if (_value === "none") {
- v.remove();
- }
- });
- _pelDiv.style.cssText = "overflow-y:hidden;padding-bottom:5px;padding-right:7px;";
- _tableEl.style.cssText = _tableEl.style.cssText + "border-spacing: 0;border-collapse: collapse;position: relative;";
- _tableEl.contentEditable = "false";
- _table.tableOver(_tableEl);
- var _trList = _tableEl.querySelectorAll("tr");
- var _tdList = U.selectEl(_tableEl).find("td");
-
- for (var i = 0; i < _tdList.length; i++) {
- var _tdCopy = _tdList[i];
- _tdCopy.contentEditable = "true";
- _tdCopy.style.cssText += ";outline:0;box-sizing:border-box;position:relative;padding:0px;border:2px solid #333;"
- var _tdWidth = _tdCopy.clientWidth;
- _tdCopy.style.width = _tdWidth + "px";
- _table.loadCell(_tdCopy);
- var _colRule = $$("div", { "style": { "outline": "0", "zIndex": "1", "position": "absolute", "top": 0, "right": 0, "cursor": "col-resize", "width": "3px", "height": "100%" }, "tabindex": "0", "contenteditable": "false", "className": "U_MD_O_W_Table_colRule", "inline": true }, _tdCopy);
- _table.colExpanding(_colRule);
- _table.dragCheckd(_tdCopy);
- _table.rightClick(_tableEl);
- }
-
- for (var i = 0; i < _trList.length; i++) {
- var _trEl = _trList[i];
- _trEl.style.cssText += ";position:relative;overflow:hidden;";
- var _rowRule = $$("div", { "style": { "outline": "0", "zIndex": "1", "position": "absolute", "left": 0, "margin-top": _trEl.clientHeight + "px", cursor: "row-resize", height: "3px", width: "100%" }, tabindex: "0", "contenteditable": "false", "className": "U_MD_O_W_Table_rowRule", "inline": true }, _trEl);
- _table.rowExpanding(_rowRule);
- };
- }
- U.UF.E.table.loadCell = function (tdEl) {
- var _table = U.UF.E.table;
- var _tableEl = _table.parentSelect(tdEl, "table");
- var _colSpan = tdEl.colSpan - 1;
- var _rowSpan = tdEl.rowSpan - 1;
- if (_colSpan >= 1) {
- for (var i = 0; i < _colSpan; i++) {
- var _newTd = $$("td");
- _newTd.style.display = "none";
- _table.After(tdEl, _newTd);
- }
- }
- if (_rowSpan >= 1) {
- var _tdIndex = _table.index(tdEl);
- var _trIndex = _table.index(tdEl.parentNode);
- var _trList = _tableEl.querySelectorAll("tr");
- for (var i = 1; i <= _rowSpan; i++) {
- var _tdList = _trList[_trIndex + i].querySelectorAll("td");
- var _td = _tdList[_tdIndex - 1];
- for (var j = 0; j <= _colSpan; j++) {
- var _newTd = $$("td");
- _newTd.style.display = "none";
- _table.After(_td, _newTd);
- }
- }
- }
- }
- U.UF.E.table.addTable = function (row, col) {
- var i, j, _tr, _td,
- _frag = $$("frag"),
- _pel = U.UF.E.table.createTablePel(),
- _table = $$("table", { style: { cssText: "border-spacing: 0;border-collapse: collapse;width: 100%;position: relative;table-layout:fixed;" } }, _pel),
- _tbody = $$("tbody", {}, _table),
- _width = Math.max(Math.floor(_table.clientWidth / col), 50)
- ;
-
-
- for (i = 0; i < row; i++) {
- _tr = $$("tr", {}, _frag);
- for (j = 0; j < col; j++) {
- _td = $$("td", { style: { width: _width + "px" }, "innerHTML": "<br />" }, _tr);
- }
- }
- _tbody.appendChild(_frag);
- U.UF.E.table.load(_table);
- };
- U.UF.E.table.createTablePel = function () {
- var _table = U.UF.E.table;
-
- var _range = U.UF.E.table._range,
- _div = U.UF.E.getLineElement(_range.startContainer);
- if (_div.textContent !== "") {
- var _div = U.selectEl("#" + U.UF.E.key.addLine(_range).addLine)[0];
- }
-
- _div.style.cssText = "overflow-y:hidden;padding-bottom:5px;padding-right:7px;width:90%";
- U.UF.E.key.addLine(_range);
- _table.placeCaretAtEnd(_div);
- return _div;
- };
- U.UF.E.table.firstLinePeak = function (tableEl) {
- U.selectEl(tableEl).find(".U_UF_E_Table_peak").css("height", 0);
- U.selectEl(tableEl).find(".U_UF_E_Table_peak").removeClass("U_UF_E_Table_peak");
- var _height = tableEl.clientHeight;
- var _colRuleList = tableEl.querySelectorAll("tr")[0].querySelectorAll(".U_MD_O_W_Table_colRule");
- for (var i = 0, len = _colRuleList.length; i < len; i++) {
- var _colRule = _colRuleList[i];
- _colRule.style.height = _height + "px";
- U.selectEl(_colRule).addClass("U_UF_E_Table_peak");
- }
- };
- U.UF.E.table.tableOver = function (table) {
- U.selectEl(table).bind('mouseover', function () {
- this.over = true;
- });
- U.selectEl(table).bind('mouseout', function () {
- this.over = false;
- });
- };
- U.UF.E.table.colExpanding = function (colrule) {
- var _div = colrule;
- U.selectEl(_div).bind({
- 'mousedown': function (e) {
- U.selectEl("#U_UF_EL_rightmenu")[0] && U.selectEl("#U_UF_EL_rightmenu")[0].remove();
- U.UF.EV.stopBubble(e);
- this.style.backgroundColor = "#8cb3e0";
- var _table = U.UF.E.table;
- var _this = this;
- var _tdEl = this.parentNode;
- var _tableEl = _table.parentSelect(this, "table");
- var _tableElWidth = _tableEl.clientWidth;
- var _trList = _tableEl.querySelectorAll("tr");
- var _tdElIndex = _table.index(_tdEl);
- var _dis,
- _disX;
- var _oMouseX = e.pageX;
- var _oX = parseInt(this.style.right);
- var expandingMove = function (e) {
- U.UF.EV.stopDefault(e);
- var _mouseX = e.pageX;
- _dis = _mouseX - _oMouseX;
- _disX = _dis + _oX;
- U.selectEl(_this).css("right", -_disX + "px");
- };
- var expandingUp = function () {
- _this.style.backgroundColor = "";
- var _child;
- for (var i = 0, len = _trList.length; i < len; i++) {
- var _colTdEl = U.selectEl("td", _trList[i])[_tdElIndex];
- _colTdEl.style.width = _colTdEl.offsetWidth + _disX + "px";
- var _colRule = _colTdEl.querySelectorAll('.U_MD_O_W_Table_colRule');
- U.selectEl(_colRule).css("right", "0px");
- _child = U.selectEl("div", _trList[i]);
- _child[_child.length - 1].style.marginTop = _trList[i].offsetHeight + "px";
- }
- U.selectEl(document).unbind('mousemove', expandingMove);
- U.selectEl(document).unbind('mouseup', expandingUp);
- };
- U.selectEl(document).bind('mousemove', expandingMove);
- U.selectEl(document).bind('mouseup', expandingUp)
- },
- 'dblclick': function (e) {
- U.UF.EV.stopBubble(e);
- },
- 'mousemove': function (e) {
- U.UF.EV.stopBubble(e);
- U.UF.EV.stopDefault(e);
- }
- });
- };
- U.UF.E.table.rowExpanding = function (rowrule) {
- var _div = rowrule;
- U.selectEl(_div).bind({
- 'mousedown': function (e) {
- U.selectEl("#U_UF_EL_rightmenu")[0] && U.selectEl("#U_UF_EL_rightmenu")[0].remove();
- this.style.backgroundColor = "#8cb3e0";
- U.UF.EV.stopBubble(e);
- var _oMouseY = e.pageY;
- var _this = this;
- var _oY = parseInt(this.style.marginTop);
- var _trEl = this.parentNode;
- var expandingMove = function (e) {
- U.UF.EV.stopDefault(e);
- var _mouseY = e.pageY;
- var _dis = _mouseY - _oMouseY + _oY;
- _dis = Math.max(30, _dis);
- _trEl.style.height = _dis + "px";
- var clienHeight = _trEl.clientHeight;
- _dis = Math.max(clienHeight, _dis);
- _trEl.style.height = _dis + "px";
- U.selectEl(_this).css("margin-top", _dis + "px");
- };
- var expandingUp = function () {
- var _table = U.UF.E.table;
- var _tableEl = _table.parentSelect(_this, "table");
- _table.firstLinePeak(_tableEl);
- _this.style.backgroundColor = "";
- U.selectEl(document).unbind('mousemove', expandingMove);
- U.selectEl(document).unbind('mouseup', expandingUp);
- };
- U.selectEl(document).bind('mousemove', expandingMove);
- U.selectEl(document).bind('mouseup', expandingUp)
- },
- 'mousemove': function (e) {
- U.UF.EV.stopBubble(e);
- U.UF.EV.stopDefault(e);
- }
- });
- };
- U.UF.E.table.createTextArea = function (parent, text) {
- var _textArea = $$("textarea", { className: "U_UF_E_Table_tdText", value: text || "", contenteditable: "true", inline: true }, parent);
- U.selectEl(_textArea).bind('mousedown', function (e) {
- U.selectEl("#U_UF_EL_rightmenu")[0] && U.selectEl("#U_UF_EL_rightmenu")[0].remove();
- });
- var autoHeight = function (el) {
- el.nodeType === 1 ? "" : el = el.target;
- el.scrollHeight ? el.style.height = el.scrollHeight + "px" : "";
- var _rowRuleList = U.selectEl(".U_MD_O_W_Table_rowRule");
- for (var i = 0, len = _rowRuleList.length; i < len; i++) {
- var _trPel = _rowRuleList[i].parentNode;
- _trPel.style.height = _trPel.clientHeight;
- U.selectEl(_rowRuleList[i]).css("margin-top", _trPel.clientHeight + "px");
- }
- };
- autoHeight(_textArea);
- U.selectEl(_textArea).bind('keydown', autoHeight);
- U.selectEl(_textArea).bind('keyup', autoHeight);
- U.selectEl(_textArea).bind('blur', function () {
- var _textla = U.selectEl(".U_UF_E_Table_tdText");
- var _tdEl = U.selectEl(".U_UF_E_Table_tdText")[0].parentNode;
- _tdEl.innerText = _textla[0].value;
- _textla.remove();
- });
- }
- U.UF.E.table.dragCheckd = function (td) {
- var _tdEl = td;
- U.selectEl(_tdEl).bind('mousedown', function (e) {
- U.UF.EV.stopBubble(e);
- U.selectEl("#U_UF_EL_rightmenu")[0] && U.selectEl("#U_UF_EL_rightmenu")[0].remove();
- if (e.button != 2) {
- var _table = U.UF.E.table;
-
- U.selectEl(".U_UF_E_Table_tdCheckd").removeClass("U_UF_E_Table_tdCheckd");
- U.selectEl(".U_UF_E_Table_tdCurrent").removeClass("U_UF_E_Table_tdCurrent");
-
- U.selectEl(this).addClass("U_UF_E_Table_tdCurrent");
- var _start = this;
- var _startX = _table.index(_start);
- var _startY = _table.index(this.parentNode);
- var _checkFlag = true;
- var _tableEl = _table.parentSelect(this, "table");
-
- var _drapMove = function (e) {
- var tagEl = e.path.filter(_filter)[0];
- if (tagEl) {
- U.UF.EV.stopBubble(e);
- if (!(_tableEl.over) || (tagEl === _start && _checkFlag)) return;
- _checkFlag = false;
- var _endX = _table.index(tagEl);
- var _endY = _table.index(tagEl.parentNode);
- U.selectEl(".U_UF_E_Table_tdCheckd").removeClass("U_UF_E_Table_tdCheckd");
- _table.tdAddClass(tagEl.parentNode, _startX, _startY, _endX, _endY);
- }
- };
- var _dragUp = function () {
- U.selectEl(document).unbind('mousemove', _drapMove);
- U.selectEl(document).unbind('mouseup', _dragUp);
- _checkFlag = true;
- };
- var _filter = function (el) {
- return el.nodeName && el.nodeName === "TD"
- }
- U.selectEl(document).bind('mousemove', _drapMove);
- U.selectEl(document).bind('mouseup', _dragUp);
- }
- });
- };
- U.UF.E.table.rightClick = function (tableEl) {
- var _table = U.UF.E.table;
- var leftAddCol = {
- innerHTML: '左侧添加列',
- onclick: function () {
- _table.addColumn("left");
- U.selectEl("#U_UF_EL_rightmenu")[0] && U.selectEl("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var rightAddCol = {
- innerHTML: '右侧添加列',
- onclick: function () {
- _table.addColumn("right");
- U.selectEl("#U_UF_EL_rightmenu")[0] && U.selectEl("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var upAddLine = {
- innerHTML: '向上添加行',
- onclick: function () {
- _table.addTr("up");
- U.selectEl("#U_UF_EL_rightmenu")[0] && U.selectEl("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var downAddLine = {
- innerHTML: '向下添加行',
- onclick: function () {
- _table.addTr("down");
- U.selectEl("#U_UF_EL_rightmenu")[0] && U.selectEl("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var removeCol = {
- innerHTML: '删除列',
- onclick: function () {
- _table.removeColumn();
- U.selectEl("#U_UF_EL_rightmenu")[0] && U.selectEl("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var removeLine = {
- innerHTML: '删除行',
- onclick: function () {
- _table.removeTr();
- U.selectEl("#U_UF_EL_rightmenu")[0] && U.selectEl("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var mergeCells = {
- innerHTML: '合并单元格',
- onclick: function () {
- _table.mergeCells();
- U.selectEl("#U_UF_EL_rightmenu")[0] && U.selectEl("#U_UF_EL_rightmenu")[0].remove();
- },
- onmousedown: function (e) {
- U.UF.EV.stopBubble(e);
- }
- };
- var _arr = [leftAddCol, rightAddCol, upAddLine, downAddLine, removeCol, removeLine, mergeCells];
- U.selectEl(tableEl).bind('contextmenu', function (e) {
- U.UF.EV.stopBubble(e);
- U.UF.EV.stopDefault();
- U.UF.EL.rightMenu(_arr, tableEl);
- U.selectEl("#U_UF_EL_rightmenu").bind('contextmenu', function (e) {
- U.UF.EV.stopBubble(e);
- });
- });
- U.selectEl(tableEl).bind('mousedown', function (e) {
- U.selectEl("#U_UF_EL_rightmenu")[0] && U.selectEl("#U_UF_EL_rightmenu")[0].remove();
- });
- };
- U.UF.E.table.addColumn = function (direction) {
- var _table = U.UF.E.table;
- var tdList = U.selectEl(".U_UF_E_Table_tdCheckd");
- if (!tdList[0]) {
- if ($(".U_UF_E_Table_tdCurrent")[0]) {
- tdList = U.selectEl(".U_UF_E_Table_tdCurrent");
- } else {
- return;
- }
- }
- var _tdEl;
- if (direction === "left") {
- _tdEl = tdList[0];
- } else if (direction === "right") {
- _tdEl = tdList[tdList.length - 1];
- }
- _table.insertTd(_tdEl, direction);
- };
- U.UF.E.table.insertTd = function (td, direction) {
- var _table = U.UF.E.table;
- var _tdEl = td,
- _index = _table.index(_tdEl),
- _dir = direction;
- var _tableEl = _table.parentSelect(_tdEl, 'table');
- var _trList = U.selectEl(_tableEl).find("tr");
- var _tableElWidth = _tableEl.offsetWidth;
- for (var i = 0, len = _trList.length; i < len; i++) {
- var _currentColumn = U.selectEl(_trList[i]).find("td")[_index];
- var _tdElClone = _tdEl.cloneNode();
- if (_dir === "left") {
- _table.Before(_currentColumn, _tdElClone);
- }
- else if (_dir === "right") {
- _table.After(_currentColumn, _tdElClone);
- }
- var _colRule = $$("div", { style: { position: "absolute", top: 0, left: "-7px", "margin-left": _tdElClone.style.width, cursor: "col-resize", width: "7px" }, className: "U_MD_O_W_Table_colRule", inline: true }, _tdElClone);
- _table.colExpanding(_colRule);
- _table.createTextArea(_tdElClone);
- _table.dragCheckd(_tdElClone);
- U.selectEl(_tdElClone).removeClass("U_UF_E_Table_tdCheckd");
- U.selectEl(_tdElClone).removeClass("U_UF_E_Table_tdCurrent");
- }
- _tableEl.style.width = _tableElWidth + _tdEl.offsetWidth + "px";
- _table.firstLinePeak(_tableEl);
- };
- U.UF.E.table.addTr = function (direction) {
- var _table = U.UF.E.table;
- var tdList = U.selectEl(".U_UF_E_Table_tdCheckd");
- if (!tdList[0]) {
- if ($(".U_UF_E_Table_tdCurrent")[0]) {
- tdList = U.selectEl(".U_UF_E_Table_tdCurrent");
- } else {
- return;
- }
- }
- var _trEl, _trElClone;
- if (direction === "up") {
- _trEl = tdList[0].parentNode;
- _trElClone = _table.cloneTr(_trEl);
- _table.Before(_trEl, _trElClone);
- } else if (direction === "down") {
- _trEl = tdList[tdList.length - 1].parentNode;
- _trElClone = _table.cloneTr(_trEl);
- _table.After(_trEl, _trElClone);
- }
- var _tableEl = _table.parentSelect(tdList[0], 'table');
- _table.firstLinePeak(_tableEl);
- };
- U.UF.E.table.removeTr = function () {
- var _table = U.UF.E.table;
- var tdList = U.selectEl(".U_UF_E_Table_tdCheckd");
- if (!tdList[0]) {
- if ($(".U_UF_E_Table_tdCurrent")[0]) {
- tdList = U.selectEl(".U_UF_E_Table_tdCurrent");
- } else {
- return;
- }
- }
- var start = _table.index(tdList[0].parentNode);
- var end = _table.index(tdList[tdList.length - 1].parentNode);
- var _tableEl = _table.parentSelect(tdList[0], "table");
- var _parentDiv = _table.parentSelect(_tableEl, "div");
- var _trList = U.selectEl(_tableEl).find("tr");
- for (var i = start; i <= end; i++) {
- _trList[i].remove();
- }
- if (!(_tableEl.querySelectorAll("tr").length)) {
- _parentDiv.remove();
- return
- }
- _table.firstLinePeak(_tableEl);
- };
- U.UF.E.table.cloneTr = function (tr) {
- var _table = U.UF.E.table;
- var _trNodes = tr.cloneNode(true);
- var _trClone = tr.cloneNode();
- var _cloneTd = U.selectEl(_trNodes).find("td");
- for (var i = 0, len = _cloneTd.length; i < len; i++) {
- var _td = _cloneTd[i].cloneNode();
- U.selectEl(_td).rmAttr("rowspan");
- _trClone.appendChild(_td);
- var _colRule = $$("div", { style: { position: "absolute", top: 0, left: "-7px", "margin-left": _td.style.width, cursor: "col-resize", width: "7px" }, className: "U_MD_O_W_Table_colRule", inline: true }, _td);
- _table.colExpanding(_colRule);
-
- _table.createTextArea(_td);
- _table.dragCheckd(_td);
- }
- var _rowRule = $$("div", { style: { position: "absolute", zIndex: "1", left: 0, "margin-top": "30px", cursor: "row-resize", height: "3px", width: "100%" }, className: "U_MD_O_W_Table_rowRule", inline: true }, _trClone);
- _table.rowExpanding(_rowRule);
- U.selectEl(_trClone).find(".U_UF_E_Table_tdCheckd").removeClass("U_UF_E_Table_tdCheckd");
- U.selectEl(_trClone).find(".U_UF_E_Table_tdCurrent").removeClass("U_UF_E_Table_tdCurrent");
- return _trClone;
- };
- U.UF.E.table.mergeCells = function () {
- var _table = U.UF.E.table;
- var _tdList = U.selectEl(".U_UF_E_Table_tdCheckd");
- if (_tdList.length <= 1) return;
- var _x1 = _table.index(_tdList[0]);
- var _y1 = _table.index(_tdList[0].parentNode);
- var _x2 = _table.index(_tdList[_tdList.length - 1]);
- var _y2 = _table.index(_tdList[_tdList.length - 1].parentNode);
- var _tableEl = _table.parentSelect(_tdList[0], "table");
- var _trList = _tableEl.querySelectorAll("tr");
- var _text = "";
- var allWidth = 0;
- for (var i = _y1; i <= _y2; i++) {
- var _trAllTd = _trList[i].querySelectorAll("td");
- for (var j = _x1; j <= _x2; j++) {
- var _tdEl = _trAllTd[j];
- _text += _tdEl.innerText;
- if (i === _y1) {
- allWidth += _tdEl.offsetWidth;
- }
- if (i === _y1 && j === _x1) continue;
- U.selectEl(_tdEl).css("display", "none");
- }
- }
- var _textNode = document.createTextNode(_text);
- var _firstNode = _table.getFirstText(_tdList[0]);
- _firstNode ? _firstNode.remove() : "";
- _tdList[0].appendChild(_textNode);
- _tdList[0].style.width = allWidth + "px";
- var _col = U.selectEl(_tdList[0]).attr("colspan");
- _col <= _x2 - _x1 + 1 ? U.selectEl(_tdList[0]).attr("colspan", _x2 - _x1 + 1) : "";
- U.selectEl(_tdList[0]).attr("rowspan", _y2 - _y1 + 1);
- U.selectEl(_tdList[0].querySelector(".U_MD_O_W_Table_colRule")).css("margin-left", allWidth + 'px');
- _table.firstLinePeak(_tableEl);
- };
- U.UF.E.table.removeColumn = function () {
- var _table = U.UF.E.table
- var tdList = U.selectEl(".U_UF_E_Table_tdCheckd");
- if (!tdList[0]) {
- if ($(".U_UF_E_Table_tdCurrent")[0]) {
- tdList = U.selectEl(".U_UF_E_Table_tdCurrent");
- } else {
- return;
- }
- }
- var _start = _table.index(tdList[0]);
- var _end = _table.index(tdList[tdList.length - 1]);
- var _tableEl = _table.parentSelect(tdList[0], 'table');
- var _trList = U.selectEl(_tableEl).find("tr");
- var _widthSum = 0;
- for (var i = 0, len = _trList.length; i < len; i++) {
- var _tdList = U.selectEl(_trList[i]).find("td");
- for (var j = _start; j <= _end; j++) {
- i === 0 ? _widthSum += _tdList[j].offsetWidth : "";
- _tdList[j].remove();
- }
- }
- _tableEl.style.width = _tableEl.offsetWidth - _widthSum + "px";
- var _tdLen = _tableEl.querySelectorAll("td").length;
- if (!_tdLen) {
- var _parentDiv = _table.parentSelect(_tableEl, "div");
- _parentDiv.remove();
- return
- }
- _table.firstLinePeak(_tableEl);
- };
- U.UF.E.table.removeFocus = function () {
- U.selectEl(".U_UF_E_Table_tdCheckd").removeClass("U_UF_E_Table_tdCheckd");
- U.selectEl(".U_UF_E_Table_tdCurrent").removeClass("U_UF_E_Table_tdCurrent");
- return;
- var _textArea = U.selectEl(".U_UF_E_Table_tdText")[0],
- _pel;
- _textArea ? _pel = _textArea.parentNode : "";
- if (_pel) {
- var _textNode = document.createTextNode(_textArea.value);
- _pel.appendChild(_textNode);
- _textArea.remove();
- }
- var _rowRuleList = U.selectEl(".U_MD_O_W_Table_rowRule");
- for (var i = 0, len = _rowRuleList.length; i < len; i++) {
- var _trEl = _rowRuleList[i].parentNode;
- _trEl.style.height = _trEl.clientHeight;
- U.selectEl(_rowRuleList[i]).css("margin-top", _trEl.clientHeight + "px");
- }
- };
- U.UF.E.table.tdAddClass = function (tr, x1, y1, x2, y2) {
- var _trList = tr.parentNode.querySelectorAll("tr");
- var _x1 = Math.min(x1, x2);
- var _x2 = Math.max(x1, x2);
- var _y1 = Math.min(y1, y2);
- var _y2 = Math.max(y1, y2);
- for (var i = _y1; i <= _y2; i++) {
- var _tdList = _trList[i].querySelectorAll("td");
- for (var j = _x1; j <= _x2; j++) {
- U.selectEl(_tdList[j]).addClass("U_UF_E_Table_tdCheckd");
- }
- }
- }
- U.UF.E.table.index = function (el) {
- var _el = el;
- var _name = _el.nodeName;
- var _list = _el.parentNode.querySelectorAll(_name);
- for (var i = 0, len = _list.length; i < len; i++) {
- if (_list[i] === _el) {
- return i;
- }
- }
- };
- U.UF.E.table.getFirstText = function (td) {
- var _child = td.childNodes;
- for (var i = 0, len = _child.length; i < len; i++) {
- if (_child[i].nodeType === 3) {
- return _child[i];
- }
- }
- return false;
- }
- U.UF.E.table.parentSelect = function (el, type) {
- var _this = el;
- var type = type.toUpperCase();
- if (_this.tagName === type) return _this;
- var parent = _this.parentNode;
- while (parent.tagName !== type) {
- parent = parent.parentNode;
- }
- return parent;
- };
- U.UF.E.table.Before = function (el, newEl) {
- var _this = el;
- var parentEl = _this.parentNode;
- parentEl.insertBefore(newEl, _this);
- };
- U.UF.E.table.After = function (el, newEl) {
- var _this = el;
- if (_this && _this.parentNode) {
- var parentEl = _this.parentNode;
- var child = parentEl.childNodes;
- var last = child[child.length - 1] || parentEl.lastChild;
- if (last === _this) {
- parentEl.appendChild(newEl);
- } else {
- parentEl.insertBefore(newEl, _this.nextSibling);
- }
- return newEl;
- }
- };
- U.UF.E.table.placeCaretAtEnd = function (el) {
- if (el.collapse) {
- var range = el;
- range.collapse(false);
- var sel = window.getSelection();
- sel.removeAllRanges();
- sel.addRange(range);
- return;
- }
- if (typeof window.getSelection != "undefined" && typeof document.createRange != "undefined") {
- el.focus && el.focus();
- var range = document.createRange();
- range.selectNodeContents(el);
- range.collapse(false);
- var sel = window.getSelection();
- sel.removeAllRanges();
- sel.addRange(range);
- } else if (typeof document.body.createTextRange != "undefined") {
- var textRange = document.body.createTextRange();
- textRange.moveToElementText(el);
- textRange.collapse(false);
- textRange.select();
- }
- };
- ;
- Namespace.register("U.UF.OT");
- U.UF.OT.weChatShareCode = function codeLayout(bindel, href, parent) {
- if (typeof bindel != 'object')
- return false;
- parent = parent ? parent : document.body;
- var _codeBox;
- if (!$('#wxfrom', parent)[0]) {
- _codeBox = $$('div', { id: "wxfrom", style: { cssText: 'display: none; position:fixed; top:0; left:0; bottom:0; right:0; margin:auto; width:251px; height:332px; padding:10px; background-color: #f4f4f4; border: 1px solid #b9b9b9;' } }, parent || document.body);
- $$('span', { innerText: "分享到微信朋友圈", style: { cssText: 'font-weight: bold' } }, _codeBox);
- $$('span', {
- innerText: 'x', style: { cssText: 'margin-left:140px; font-size: 18px; font-weight: bold; cursor:pointer' }, onclick: function () {
- _codeBox.style.display = 'none';
- }
- }, _codeBox);
- var _codeShowArea = $$('div', { style: { cssText: "padding:20px 10px;" } }, _codeBox);
-
- $$('div', { innerHTML: "打开微信,点击底部的“发现”,<br/>使用“扫一扫”即可将网页分享至朋友圈。" }, _codeBox);
- } else {
- _codeBox = U.selectEl('#wxfrom', parent)[0];
- }
- U.selectEl(bindel).bind({
- click: function () {
- U.UF.QR.generate("230", "235", "black", "#f4f4f4", href || window.location.href, _codeShowArea);
- _codeBox.style.display = '';
- }
- })
- return _codeBox;
- }
- U.UF.OT.qqFriendShare = function (url, title, pic, desc, summary) {
- var _sharesinastring = 'https://connect.qq.com/widget/shareqq/index.html?url=' + encodeURIComponent(url || window.location.href)
- + '&title=' + encodeURIComponent(title || '这文件超棒的,分享给你看看!')
- + '&pic=' + pic || ""
- + '&desc=' + desc || ""
- + '&summary=' + summary || "";
- window.open(_sharesinastring, 'newwindow', 'height=600,width=864,top=300,left=300');
- }
- U.UF.OT.weiboShare = function (url, title, pic) {
- var _sharesinastring = 'http://v.t.sina.com.cn/share/share.php?url=' + encodeURIComponent(url || window.location.href)
- + '&title=' + encodeURIComponent(title || '这文件超棒的,分享给你看看!') + '&content=utf-8'
- + '&pic=' + pic || "";
- window.open(_sharesinastring, 'newwindow', 'height=500,width=800,top=300,left=300');
- }
- ;
|