123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683 |
-
- 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 = "http://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.MD.U.LO.logout(callback);
- });
- }
- }
- 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');
- }
- ;
|