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