fw-comm-all.js 417 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757
  1. /*!
  2. * jQuery JavaScript Library v1.5
  3. * http://jquery.com/
  4. *
  5. * Copyright 2011, John Resig
  6. * Dual licensed under the MIT or GPL Version 2 licenses.
  7. * http://jquery.org/license
  8. *
  9. * Includes Sizzle.js
  10. * http://sizzlejs.com/
  11. * Copyright 2011, The Dojo Foundation
  12. * Released under the MIT, BSD, and GPL Licenses.
  13. *
  14. * Date: Mon Jan 31 08:31:29 2011 -0500
  15. */
  16. (function( window, undefined ) {
  17. // Use the correct document accordingly with window argument (sandbox)
  18. var document = window.document;
  19. var jQuery = (function() {
  20. // Define a local copy of jQuery
  21. var jQuery = function( selector, context ) {
  22. // The jQuery object is actually just the init constructor 'enhanced'
  23. return new jQuery.fn.init( selector, context, rootjQuery );
  24. },
  25. // Map over jQuery in case of overwrite
  26. _jQuery = window.jQuery,
  27. // Map over the $ in case of overwrite
  28. _$ = window.$,
  29. // A central reference to the root jQuery(document)
  30. rootjQuery,
  31. // A simple way to check for HTML strings or ID strings
  32. // (both of which we optimize for)
  33. quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
  34. // Check if a string has a non-whitespace character in it
  35. rnotwhite = /\S/,
  36. // Used for trimming whitespace
  37. trimLeft = /^\s+/,
  38. trimRight = /\s+$/,
  39. // Check for digits
  40. rdigit = /\d/,
  41. // Match a standalone tag
  42. rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
  43. // JSON RegExp
  44. rvalidchars = /^[\],:{}\s]*$/,
  45. rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
  46. rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
  47. rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
  48. // Useragent RegExp
  49. rwebkit = /(webkit)[ \/]([\w.]+)/,
  50. ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
  51. rmsie = /(msie) ([\w.]+)/,
  52. rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
  53. // Keep a UserAgent string for use with jQuery.browser
  54. userAgent = navigator.userAgent,
  55. // For matching the engine and version of the browser
  56. browserMatch,
  57. // Has the ready events already been bound?
  58. readyBound = false,
  59. // The deferred used on DOM ready
  60. readyList,
  61. // Promise methods
  62. promiseMethods = "then done fail isResolved isRejected promise".split( " " ),
  63. // The ready event handler
  64. DOMContentLoaded,
  65. // Save a reference to some core methods
  66. toString = Object.prototype.toString,
  67. hasOwn = Object.prototype.hasOwnProperty,
  68. push = Array.prototype.push,
  69. slice = Array.prototype.slice,
  70. trim = String.prototype.trim,
  71. indexOf = Array.prototype.indexOf,
  72. // [[Class]] -> type pairs
  73. class2type = {};
  74. jQuery.fn = jQuery.prototype = {
  75. constructor: jQuery,
  76. init: function( selector, context, rootjQuery ) {
  77. var match, elem, ret, doc;
  78. // Handle $(""), $(null), or $(undefined)
  79. if ( !selector ) {
  80. return this;
  81. }
  82. // Handle $(DOMElement)
  83. if ( selector.nodeType ) {
  84. this.context = this[0] = selector;
  85. this.length = 1;
  86. return this;
  87. }
  88. // The body element only exists once, optimize finding it
  89. if ( selector === "body" && !context && document.body ) {
  90. this.context = document;
  91. this[0] = document.body;
  92. this.selector = "body";
  93. this.length = 1;
  94. return this;
  95. }
  96. // Handle HTML strings
  97. if ( typeof selector === "string" ) {
  98. // Are we dealing with HTML string or an ID?
  99. match = quickExpr.exec( selector );
  100. // Verify a match, and that no context was specified for #id
  101. if ( match && (match[1] || !context) ) {
  102. // HANDLE: $(html) -> $(array)
  103. if ( match[1] ) {
  104. context = context instanceof jQuery ? context[0] : context;
  105. doc = (context ? context.ownerDocument || context : document);
  106. // If a single string is passed in and it's a single tag
  107. // just do a createElement and skip the rest
  108. ret = rsingleTag.exec( selector );
  109. if ( ret ) {
  110. if ( jQuery.isPlainObject( context ) ) {
  111. selector = [ document.createElement( ret[1] ) ];
  112. jQuery.fn.attr.call( selector, context, true );
  113. } else {
  114. selector = [ doc.createElement( ret[1] ) ];
  115. }
  116. } else {
  117. ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
  118. selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;
  119. }
  120. return jQuery.merge( this, selector );
  121. // HANDLE: $("#id")
  122. } else {
  123. elem = document.getElementById( match[2] );
  124. // Check parentNode to catch when Blackberry 4.6 returns
  125. // nodes that are no longer in the document #6963
  126. if ( elem && elem.parentNode ) {
  127. // Handle the case where IE and Opera return items
  128. // by name instead of ID
  129. if ( elem.id !== match[2] ) {
  130. return rootjQuery.find( selector );
  131. }
  132. // Otherwise, we inject the element directly into the jQuery object
  133. this.length = 1;
  134. this[0] = elem;
  135. }
  136. this.context = document;
  137. this.selector = selector;
  138. return this;
  139. }
  140. // HANDLE: $(expr, $(...))
  141. } else if ( !context || context.jquery ) {
  142. return (context || rootjQuery).find( selector );
  143. // HANDLE: $(expr, context)
  144. // (which is just equivalent to: $(context).find(expr)
  145. } else {
  146. return this.constructor( context ).find( selector );
  147. }
  148. // HANDLE: $(function)
  149. // Shortcut for document ready
  150. } else if ( jQuery.isFunction( selector ) ) {
  151. return rootjQuery.ready( selector );
  152. }
  153. if (selector.selector !== undefined) {
  154. this.selector = selector.selector;
  155. this.context = selector.context;
  156. }
  157. return jQuery.makeArray( selector, this );
  158. },
  159. // Start with an empty selector
  160. selector: "",
  161. // The current version of jQuery being used
  162. jquery: "1.5",
  163. // The default length of a jQuery object is 0
  164. length: 0,
  165. // The number of elements contained in the matched element set
  166. size: function() {
  167. return this.length;
  168. },
  169. toArray: function() {
  170. return slice.call( this, 0 );
  171. },
  172. // Get the Nth element in the matched element set OR
  173. // Get the whole matched element set as a clean array
  174. get: function( num ) {
  175. return num == null ?
  176. // Return a 'clean' array
  177. this.toArray() :
  178. // Return just the object
  179. ( num < 0 ? this[ this.length + num ] : this[ num ] );
  180. },
  181. // Take an array of elements and push it onto the stack
  182. // (returning the new matched element set)
  183. pushStack: function( elems, name, selector ) {
  184. // Build a new jQuery matched element set
  185. var ret = this.constructor();
  186. if ( jQuery.isArray( elems ) ) {
  187. push.apply( ret, elems );
  188. } else {
  189. jQuery.merge( ret, elems );
  190. }
  191. // Add the old object onto the stack (as a reference)
  192. ret.prevObject = this;
  193. ret.context = this.context;
  194. if ( name === "find" ) {
  195. ret.selector = this.selector + (this.selector ? " " : "") + selector;
  196. } else if ( name ) {
  197. ret.selector = this.selector + "." + name + "(" + selector + ")";
  198. }
  199. // Return the newly-formed element set
  200. return ret;
  201. },
  202. // Execute a callback for every element in the matched set.
  203. // (You can seed the arguments with an array of args, but this is
  204. // only used internally.)
  205. each: function( callback, args ) {
  206. return jQuery.each( this, callback, args );
  207. },
  208. ready: function( fn ) {
  209. // Attach the listeners
  210. jQuery.bindReady();
  211. // Add the callback
  212. readyList.done( fn );
  213. return this;
  214. },
  215. eq: function( i ) {
  216. return i === -1 ?
  217. this.slice( i ) :
  218. this.slice( i, +i + 1 );
  219. },
  220. first: function() {
  221. return this.eq( 0 );
  222. },
  223. last: function() {
  224. return this.eq( -1 );
  225. },
  226. slice: function() {
  227. return this.pushStack( slice.apply( this, arguments ),
  228. "slice", slice.call(arguments).join(",") );
  229. },
  230. map: function( callback ) {
  231. return this.pushStack( jQuery.map(this, function( elem, i ) {
  232. return callback.call( elem, i, elem );
  233. }));
  234. },
  235. end: function() {
  236. return this.prevObject || this.constructor(null);
  237. },
  238. // For internal use only.
  239. // Behaves like an Array's method, not like a jQuery method.
  240. push: push,
  241. sort: [].sort,
  242. splice: [].splice
  243. };
  244. // Give the init function the jQuery prototype for later instantiation
  245. jQuery.fn.init.prototype = jQuery.fn;
  246. jQuery.extend = jQuery.fn.extend = function() {
  247. var options, name, src, copy, copyIsArray, clone,
  248. target = arguments[0] || {},
  249. i = 1,
  250. length = arguments.length,
  251. deep = false;
  252. // Handle a deep copy situation
  253. if ( typeof target === "boolean" ) {
  254. deep = target;
  255. target = arguments[1] || {};
  256. // skip the boolean and the target
  257. i = 2;
  258. }
  259. // Handle case when target is a string or something (possible in deep copy)
  260. if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
  261. target = {};
  262. }
  263. // extend jQuery itself if only one argument is passed
  264. if ( length === i ) {
  265. target = this;
  266. --i;
  267. }
  268. for ( ; i < length; i++ ) {
  269. // Only deal with non-null/undefined values
  270. if ( (options = arguments[ i ]) != null ) {
  271. // Extend the base object
  272. for ( name in options ) {
  273. src = target[ name ];
  274. copy = options[ name ];
  275. // Prevent never-ending loop
  276. if ( target === copy ) {
  277. continue;
  278. }
  279. // Recurse if we're merging plain objects or arrays
  280. if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
  281. if ( copyIsArray ) {
  282. copyIsArray = false;
  283. clone = src && jQuery.isArray(src) ? src : [];
  284. } else {
  285. clone = src && jQuery.isPlainObject(src) ? src : {};
  286. }
  287. // Never move original objects, clone them
  288. target[ name ] = jQuery.extend( deep, clone, copy );
  289. // Don't bring in undefined values
  290. } else if ( copy !== undefined ) {
  291. target[ name ] = copy;
  292. }
  293. }
  294. }
  295. }
  296. // Return the modified object
  297. return target;
  298. };
  299. jQuery.extend({
  300. noConflict: function( deep ) {
  301. window.$ = _$;
  302. if ( deep ) {
  303. window.jQuery = _jQuery;
  304. }
  305. return jQuery;
  306. },
  307. // Is the DOM ready to be used? Set to true once it occurs.
  308. isReady: false,
  309. // A counter to track how many items to wait for before
  310. // the ready event fires. See #6781
  311. readyWait: 1,
  312. // Handle when the DOM is ready
  313. ready: function( wait ) {
  314. // A third-party is pushing the ready event forwards
  315. if ( wait === true ) {
  316. jQuery.readyWait--;
  317. }
  318. // Make sure that the DOM is not already loaded
  319. if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {
  320. // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
  321. if ( !document.body ) {
  322. return setTimeout( jQuery.ready, 1 );
  323. }
  324. // Remember that the DOM is ready
  325. jQuery.isReady = true;
  326. // If a normal DOM Ready event fired, decrement, and wait if need be
  327. if ( wait !== true && --jQuery.readyWait > 0 ) {
  328. return;
  329. }
  330. // If there are functions bound, to execute
  331. readyList.resolveWith( document, [ jQuery ] );
  332. // Trigger any bound ready events
  333. if ( jQuery.fn.trigger ) {
  334. jQuery( document ).trigger( "ready" ).unbind( "ready" );
  335. }
  336. }
  337. },
  338. bindReady: function() {
  339. if ( readyBound ) {
  340. return;
  341. }
  342. readyBound = true;
  343. // Catch cases where $(document).ready() is called after the
  344. // browser event has already occurred.
  345. if ( document.readyState === "complete" ) {
  346. // Handle it asynchronously to allow scripts the opportunity to delay ready
  347. return setTimeout( jQuery.ready, 1 );
  348. }
  349. // Mozilla, Opera and webkit nightlies currently support this event
  350. if ( document.addEventListener ) {
  351. // Use the handy event callback
  352. document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
  353. // A fallback to window.onload, that will always work
  354. window.addEventListener( "load", jQuery.ready, false );
  355. // If IE event model is used
  356. } else if ( document.attachEvent ) {
  357. // ensure firing before onload,
  358. // maybe late but safe also for iframes
  359. document.attachEvent("onreadystatechange", DOMContentLoaded);
  360. // A fallback to window.onload, that will always work
  361. window.attachEvent( "onload", jQuery.ready );
  362. // If IE and not a frame
  363. // continually check to see if the document is ready
  364. var toplevel = false;
  365. try {
  366. toplevel = window.frameElement == null;
  367. } catch(e) {}
  368. if ( document.documentElement.doScroll && toplevel ) {
  369. doScrollCheck();
  370. }
  371. }
  372. },
  373. // See test/unit/core.js for details concerning isFunction.
  374. // Since version 1.3, DOM methods and functions like alert
  375. // aren't supported. They return false on IE (#2968).
  376. isFunction: function( obj ) {
  377. return jQuery.type(obj) === "function";
  378. },
  379. isArray: Array.isArray || function( obj ) {
  380. return jQuery.type(obj) === "array";
  381. },
  382. // A crude way of determining if an object is a window
  383. isWindow: function( obj ) {
  384. return obj && typeof obj === "object" && "setInterval" in obj;
  385. },
  386. isNaN: function( obj ) {
  387. return obj == null || !rdigit.test( obj ) || isNaN( obj );
  388. },
  389. type: function( obj ) {
  390. return obj == null ?
  391. String( obj ) :
  392. class2type[ toString.call(obj) ] || "object";
  393. },
  394. isPlainObject: function( obj ) {
  395. // Must be an Object.
  396. // Because of IE, we also have to check the presence of the constructor property.
  397. // Make sure that DOM nodes and window objects don't pass through, as well
  398. if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
  399. return false;
  400. }
  401. // Not own constructor property must be Object
  402. if ( obj.constructor &&
  403. !hasOwn.call(obj, "constructor") &&
  404. !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
  405. return false;
  406. }
  407. // Own properties are enumerated firstly, so to speed up,
  408. // if last one is own, then all properties are own.
  409. var key;
  410. for ( key in obj ) {}
  411. return key === undefined || hasOwn.call( obj, key );
  412. },
  413. isEmptyObject: function( obj ) {
  414. for ( var name in obj ) {
  415. return false;
  416. }
  417. return true;
  418. },
  419. error: function( msg ) {
  420. throw msg;
  421. },
  422. parseJSON: function( data ) {
  423. if ( typeof data !== "string" || !data ) {
  424. return null;
  425. }
  426. // Make sure leading/trailing whitespace is removed (IE can't handle it)
  427. data = jQuery.trim( data );
  428. // Make sure the incoming data is actual JSON
  429. // Logic borrowed from http://json.org/json2.js
  430. if ( rvalidchars.test(data.replace(rvalidescape, "@")
  431. .replace(rvalidtokens, "]")
  432. .replace(rvalidbraces, "")) ) {
  433. // Try to use the native JSON parser first
  434. return window.JSON && window.JSON.parse ?
  435. window.JSON.parse( data ) :
  436. (new Function("return " + data))();
  437. } else {
  438. jQuery.error( "Invalid JSON: " + data );
  439. }
  440. },
  441. // Cross-browser xml parsing
  442. // (xml & tmp used internally)
  443. parseXML: function( data , xml , tmp ) {
  444. if ( window.DOMParser ) { // Standard
  445. tmp = new DOMParser();
  446. xml = tmp.parseFromString( data , "text/xml" );
  447. } else { // IE
  448. xml = new ActiveXObject( "Microsoft.XMLDOM" );
  449. xml.async = "false";
  450. xml.loadXML( data );
  451. }
  452. tmp = xml.documentElement;
  453. if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) {
  454. jQuery.error( "Invalid XML: " + data );
  455. }
  456. return xml;
  457. },
  458. noop: function() {},
  459. // Evalulates a script in a global context
  460. globalEval: function( data ) {
  461. if ( data && rnotwhite.test(data) ) {
  462. // Inspired by code by Andrea Giammarchi
  463. // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
  464. var head = document.getElementsByTagName("head")[0] || document.documentElement,
  465. script = document.createElement("script");
  466. script.type = "text/javascript";
  467. if ( jQuery.support.scriptEval() ) {
  468. script.appendChild( document.createTextNode( data ) );
  469. } else {
  470. script.text = data;
  471. }
  472. // Use insertBefore instead of appendChild to circumvent an IE6 bug.
  473. // This arises when a base node is used (#2709).
  474. head.insertBefore( script, head.firstChild );
  475. head.removeChild( script );
  476. }
  477. },
  478. nodeName: function( elem, name ) {
  479. return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
  480. },
  481. // args is for internal usage only
  482. each: function( object, callback, args ) {
  483. var name, i = 0,
  484. length = object.length,
  485. isObj = length === undefined || jQuery.isFunction(object);
  486. if ( args ) {
  487. if ( isObj ) {
  488. for ( name in object ) {
  489. if ( callback.apply( object[ name ], args ) === false ) {
  490. break;
  491. }
  492. }
  493. } else {
  494. for ( ; i < length; ) {
  495. if ( callback.apply( object[ i++ ], args ) === false ) {
  496. break;
  497. }
  498. }
  499. }
  500. // A special, fast, case for the most common use of each
  501. } else {
  502. if ( isObj ) {
  503. for ( name in object ) {
  504. if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
  505. break;
  506. }
  507. }
  508. } else {
  509. for ( var value = object[0];
  510. i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}
  511. }
  512. }
  513. return object;
  514. },
  515. // Use native String.trim function wherever possible
  516. trim: trim ?
  517. function( text ) {
  518. return text == null ?
  519. "" :
  520. trim.call( text );
  521. } :
  522. // Otherwise use our own trimming functionality
  523. function( text ) {
  524. return text == null ?
  525. "" :
  526. text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
  527. },
  528. // results is for internal usage only
  529. makeArray: function( array, results ) {
  530. var ret = results || [];
  531. if ( array != null ) {
  532. // The window, strings (and functions) also have 'length'
  533. // The extra typeof function check is to prevent crashes
  534. // in Safari 2 (See: #3039)
  535. // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
  536. var type = jQuery.type(array);
  537. if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
  538. push.call( ret, array );
  539. } else {
  540. jQuery.merge( ret, array );
  541. }
  542. }
  543. return ret;
  544. },
  545. inArray: function( elem, array ) {
  546. if ( array.indexOf ) {
  547. return array.indexOf( elem );
  548. }
  549. for ( var i = 0, length = array.length; i < length; i++ ) {
  550. if ( array[ i ] === elem ) {
  551. return i;
  552. }
  553. }
  554. return -1;
  555. },
  556. merge: function( first, second ) {
  557. var i = first.length,
  558. j = 0;
  559. if ( typeof second.length === "number" ) {
  560. for ( var l = second.length; j < l; j++ ) {
  561. first[ i++ ] = second[ j ];
  562. }
  563. } else {
  564. while ( second[j] !== undefined ) {
  565. first[ i++ ] = second[ j++ ];
  566. }
  567. }
  568. first.length = i;
  569. return first;
  570. },
  571. grep: function( elems, callback, inv ) {
  572. var ret = [], retVal;
  573. inv = !!inv;
  574. // Go through the array, only saving the items
  575. // that pass the validator function
  576. for ( var i = 0, length = elems.length; i < length; i++ ) {
  577. retVal = !!callback( elems[ i ], i );
  578. if ( inv !== retVal ) {
  579. ret.push( elems[ i ] );
  580. }
  581. }
  582. return ret;
  583. },
  584. // arg is for internal usage only
  585. map: function( elems, callback, arg ) {
  586. var ret = [], value;
  587. // Go through the array, translating each of the items to their
  588. // new value (or values).
  589. for ( var i = 0, length = elems.length; i < length; i++ ) {
  590. value = callback( elems[ i ], i, arg );
  591. if ( value != null ) {
  592. ret[ ret.length ] = value;
  593. }
  594. }
  595. // Flatten any nested arrays
  596. return ret.concat.apply( [], ret );
  597. },
  598. // A global GUID counter for objects
  599. guid: 1,
  600. proxy: function( fn, proxy, thisObject ) {
  601. if ( arguments.length === 2 ) {
  602. if ( typeof proxy === "string" ) {
  603. thisObject = fn;
  604. fn = thisObject[ proxy ];
  605. proxy = undefined;
  606. } else if ( proxy && !jQuery.isFunction( proxy ) ) {
  607. thisObject = proxy;
  608. proxy = undefined;
  609. }
  610. }
  611. if ( !proxy && fn ) {
  612. proxy = function() {
  613. return fn.apply( thisObject || this, arguments );
  614. };
  615. }
  616. // Set the guid of unique handler to the same of original handler, so it can be removed
  617. if ( fn ) {
  618. proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
  619. }
  620. // So proxy can be declared as an argument
  621. return proxy;
  622. },
  623. // Mutifunctional method to get and set values to a collection
  624. // The value/s can be optionally by executed if its a function
  625. access: function( elems, key, value, exec, fn, pass ) {
  626. var length = elems.length;
  627. // Setting many attributes
  628. if ( typeof key === "object" ) {
  629. for ( var k in key ) {
  630. jQuery.access( elems, k, key[k], exec, fn, value );
  631. }
  632. return elems;
  633. }
  634. // Setting one attribute
  635. if ( value !== undefined ) {
  636. // Optionally, function values get executed if exec is true
  637. exec = !pass && exec && jQuery.isFunction(value);
  638. for ( var i = 0; i < length; i++ ) {
  639. fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
  640. }
  641. return elems;
  642. }
  643. // Getting an attribute
  644. return length ? fn( elems[0], key ) : undefined;
  645. },
  646. now: function() {
  647. return (new Date()).getTime();
  648. },
  649. // Create a simple deferred (one callbacks list)
  650. _Deferred: function() {
  651. var // callbacks list
  652. callbacks = [],
  653. // stored [ context , args ]
  654. fired,
  655. // to avoid firing when already doing so
  656. firing,
  657. // flag to know if the deferred has been cancelled
  658. cancelled,
  659. // the deferred itself
  660. deferred = {
  661. // done( f1, f2, ...)
  662. done: function() {
  663. if ( !cancelled ) {
  664. var args = arguments,
  665. i,
  666. length,
  667. elem,
  668. type,
  669. _fired;
  670. if ( fired ) {
  671. _fired = fired;
  672. fired = 0;
  673. }
  674. for ( i = 0, length = args.length; i < length; i++ ) {
  675. elem = args[ i ];
  676. type = jQuery.type( elem );
  677. if ( type === "array" ) {
  678. deferred.done.apply( deferred, elem );
  679. } else if ( type === "function" ) {
  680. callbacks.push( elem );
  681. }
  682. }
  683. if ( _fired ) {
  684. deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );
  685. }
  686. }
  687. return this;
  688. },
  689. // resolve with given context and args
  690. resolveWith: function( context, args ) {
  691. if ( !cancelled && !fired && !firing ) {
  692. firing = 1;
  693. try {
  694. while( callbacks[ 0 ] ) {
  695. callbacks.shift().apply( context, args );
  696. }
  697. }
  698. finally {
  699. fired = [ context, args ];
  700. firing = 0;
  701. }
  702. }
  703. return this;
  704. },
  705. // resolve with this as context and given arguments
  706. resolve: function() {
  707. deferred.resolveWith( jQuery.isFunction( this.promise ) ? this.promise() : this, arguments );
  708. return this;
  709. },
  710. // Has this deferred been resolved?
  711. isResolved: function() {
  712. return !!( firing || fired );
  713. },
  714. // Cancel
  715. cancel: function() {
  716. cancelled = 1;
  717. callbacks = [];
  718. return this;
  719. }
  720. };
  721. return deferred;
  722. },
  723. // Full fledged deferred (two callbacks list)
  724. Deferred: function( func ) {
  725. var deferred = jQuery._Deferred(),
  726. failDeferred = jQuery._Deferred(),
  727. promise;
  728. // Add errorDeferred methods, then and promise
  729. jQuery.extend( deferred, {
  730. then: function( doneCallbacks, failCallbacks ) {
  731. deferred.done( doneCallbacks ).fail( failCallbacks );
  732. return this;
  733. },
  734. fail: failDeferred.done,
  735. rejectWith: failDeferred.resolveWith,
  736. reject: failDeferred.resolve,
  737. isRejected: failDeferred.isResolved,
  738. // Get a promise for this deferred
  739. // If obj is provided, the promise aspect is added to the object
  740. promise: function( obj , i /* internal */ ) {
  741. if ( obj == null ) {
  742. if ( promise ) {
  743. return promise;
  744. }
  745. promise = obj = {};
  746. }
  747. i = promiseMethods.length;
  748. while( i-- ) {
  749. obj[ promiseMethods[ i ] ] = deferred[ promiseMethods[ i ] ];
  750. }
  751. return obj;
  752. }
  753. } );
  754. // Make sure only one callback list will be used
  755. deferred.then( failDeferred.cancel, deferred.cancel );
  756. // Unexpose cancel
  757. delete deferred.cancel;
  758. // Call given func if any
  759. if ( func ) {
  760. func.call( deferred, deferred );
  761. }
  762. return deferred;
  763. },
  764. // Deferred helper
  765. when: function( object ) {
  766. var args = arguments,
  767. length = args.length,
  768. deferred = length <= 1 && object && jQuery.isFunction( object.promise ) ?
  769. object :
  770. jQuery.Deferred(),
  771. promise = deferred.promise(),
  772. resolveArray;
  773. if ( length > 1 ) {
  774. resolveArray = new Array( length );
  775. jQuery.each( args, function( index, element ) {
  776. jQuery.when( element ).then( function( value ) {
  777. resolveArray[ index ] = arguments.length > 1 ? slice.call( arguments, 0 ) : value;
  778. if( ! --length ) {
  779. deferred.resolveWith( promise, resolveArray );
  780. }
  781. }, deferred.reject );
  782. } );
  783. } else if ( deferred !== object ) {
  784. deferred.resolve( object );
  785. }
  786. return promise;
  787. },
  788. // Use of jQuery.browser is frowned upon.
  789. // More details: http://docs.jquery.com/Utilities/jQuery.browser
  790. uaMatch: function( ua ) {
  791. ua = ua.toLowerCase();
  792. var match = rwebkit.exec( ua ) ||
  793. ropera.exec( ua ) ||
  794. rmsie.exec( ua ) ||
  795. ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
  796. [];
  797. return { browser: match[1] || "", version: match[2] || "0" };
  798. },
  799. sub: function() {
  800. function jQuerySubclass( selector, context ) {
  801. return new jQuerySubclass.fn.init( selector, context );
  802. }
  803. jQuery.extend( true, jQuerySubclass, this );
  804. jQuerySubclass.superclass = this;
  805. jQuerySubclass.fn = jQuerySubclass.prototype = this();
  806. jQuerySubclass.fn.constructor = jQuerySubclass;
  807. jQuerySubclass.subclass = this.subclass;
  808. jQuerySubclass.fn.init = function init( selector, context ) {
  809. if ( context && context instanceof jQuery && !(context instanceof jQuerySubclass) ) {
  810. context = jQuerySubclass(context);
  811. }
  812. return jQuery.fn.init.call( this, selector, context, rootjQuerySubclass );
  813. };
  814. jQuerySubclass.fn.init.prototype = jQuerySubclass.fn;
  815. var rootjQuerySubclass = jQuerySubclass(document);
  816. return jQuerySubclass;
  817. },
  818. browser: {}
  819. });
  820. // Create readyList deferred
  821. readyList = jQuery._Deferred();
  822. // Populate the class2type map
  823. jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
  824. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  825. });
  826. browserMatch = jQuery.uaMatch( userAgent );
  827. if ( browserMatch.browser ) {
  828. jQuery.browser[ browserMatch.browser ] = true;
  829. jQuery.browser.version = browserMatch.version;
  830. }
  831. // Deprecated, use jQuery.browser.webkit instead
  832. if ( jQuery.browser.webkit ) {
  833. jQuery.browser.safari = true;
  834. }
  835. if ( indexOf ) {
  836. jQuery.inArray = function( elem, array ) {
  837. return indexOf.call( array, elem );
  838. };
  839. }
  840. // IE doesn't match non-breaking spaces with \s
  841. if ( rnotwhite.test( "\xA0" ) ) {
  842. trimLeft = /^[\s\xA0]+/;
  843. trimRight = /[\s\xA0]+$/;
  844. }
  845. // All jQuery objects should point back to these
  846. rootjQuery = jQuery(document);
  847. // Cleanup functions for the document ready method
  848. if ( document.addEventListener ) {
  849. DOMContentLoaded = function() {
  850. document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
  851. jQuery.ready();
  852. };
  853. } else if ( document.attachEvent ) {
  854. DOMContentLoaded = function() {
  855. // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
  856. if ( document.readyState === "complete" ) {
  857. document.detachEvent( "onreadystatechange", DOMContentLoaded );
  858. jQuery.ready();
  859. }
  860. };
  861. }
  862. // The DOM ready check for Internet Explorer
  863. function doScrollCheck() {
  864. if ( jQuery.isReady ) {
  865. return;
  866. }
  867. try {
  868. // If IE is used, use the trick by Diego Perini
  869. // http://javascript.nwbox.com/IEContentLoaded/
  870. document.documentElement.doScroll("left");
  871. } catch(e) {
  872. setTimeout( doScrollCheck, 1 );
  873. return;
  874. }
  875. // and execute any waiting functions
  876. jQuery.ready();
  877. }
  878. // Expose jQuery to the global object
  879. return (window.jQuery = window.$ = jQuery);
  880. })();
  881. (function() {
  882. jQuery.support = {};
  883. var div = document.createElement("div");
  884. div.style.display = "none";
  885. div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
  886. var all = div.getElementsByTagName("*"),
  887. a = div.getElementsByTagName("a")[0],
  888. select = document.createElement("select"),
  889. opt = select.appendChild( document.createElement("option") );
  890. // Can't get basic test support
  891. if ( !all || !all.length || !a ) {
  892. return;
  893. }
  894. jQuery.support = {
  895. // IE strips leading whitespace when .innerHTML is used
  896. leadingWhitespace: div.firstChild.nodeType === 3,
  897. // Make sure that tbody elements aren't automatically inserted
  898. // IE will insert them into empty tables
  899. tbody: !div.getElementsByTagName("tbody").length,
  900. // Make sure that link elements get serialized correctly by innerHTML
  901. // This requires a wrapper element in IE
  902. htmlSerialize: !!div.getElementsByTagName("link").length,
  903. // Get the style information from getAttribute
  904. // (IE uses .cssText insted)
  905. style: /red/.test( a.getAttribute("style") ),
  906. // Make sure that URLs aren't manipulated
  907. // (IE normalizes it by default)
  908. hrefNormalized: a.getAttribute("href") === "/a",
  909. // Make sure that element opacity exists
  910. // (IE uses filter instead)
  911. // Use a regex to work around a WebKit issue. See #5145
  912. opacity: /^0.55$/.test( a.style.opacity ),
  913. // Verify style float existence
  914. // (IE uses styleFloat instead of cssFloat)
  915. cssFloat: !!a.style.cssFloat,
  916. // Make sure that if no value is specified for a checkbox
  917. // that it defaults to "on".
  918. // (WebKit defaults to "" instead)
  919. checkOn: div.getElementsByTagName("input")[0].value === "on",
  920. // Make sure that a selected-by-default option has a working selected property.
  921. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
  922. optSelected: opt.selected,
  923. // Will be defined later
  924. deleteExpando: true,
  925. optDisabled: false,
  926. checkClone: false,
  927. _scriptEval: null,
  928. noCloneEvent: true,
  929. boxModel: null,
  930. inlineBlockNeedsLayout: false,
  931. shrinkWrapBlocks: false,
  932. reliableHiddenOffsets: true
  933. };
  934. // Make sure that the options inside disabled selects aren't marked as disabled
  935. // (WebKit marks them as diabled)
  936. select.disabled = true;
  937. jQuery.support.optDisabled = !opt.disabled;
  938. jQuery.support.scriptEval = function() {
  939. if ( jQuery.support._scriptEval === null ) {
  940. var root = document.documentElement,
  941. script = document.createElement("script"),
  942. id = "script" + jQuery.now();
  943. script.type = "text/javascript";
  944. try {
  945. script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
  946. } catch(e) {}
  947. root.insertBefore( script, root.firstChild );
  948. // Make sure that the execution of code works by injecting a script
  949. // tag with appendChild/createTextNode
  950. // (IE doesn't support this, fails, and uses .text instead)
  951. if ( window[ id ] ) {
  952. jQuery.support._scriptEval = true;
  953. delete window[ id ];
  954. } else {
  955. jQuery.support._scriptEval = false;
  956. }
  957. root.removeChild( script );
  958. // release memory in IE
  959. root = script = id = null;
  960. }
  961. return jQuery.support._scriptEval;
  962. };
  963. // Test to see if it's possible to delete an expando from an element
  964. // Fails in Internet Explorer
  965. try {
  966. delete div.test;
  967. } catch(e) {
  968. jQuery.support.deleteExpando = false;
  969. }
  970. if ( div.attachEvent && div.fireEvent ) {
  971. div.attachEvent("onclick", function click() {
  972. // Cloning a node shouldn't copy over any
  973. // bound event handlers (IE does this)
  974. jQuery.support.noCloneEvent = false;
  975. div.detachEvent("onclick", click);
  976. });
  977. div.cloneNode(true).fireEvent("onclick");
  978. }
  979. div = document.createElement("div");
  980. div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";
  981. var fragment = document.createDocumentFragment();
  982. fragment.appendChild( div.firstChild );
  983. // WebKit doesn't clone checked state correctly in fragments
  984. jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;
  985. // Figure out if the W3C box model works as expected
  986. // document.body must exist before we can do this
  987. jQuery(function() {
  988. var div = document.createElement("div"),
  989. body = document.getElementsByTagName("body")[0];
  990. // Frameset documents with no body should not run this code
  991. if ( !body ) {
  992. return;
  993. }
  994. div.style.width = div.style.paddingLeft = "1px";
  995. body.appendChild( div );
  996. jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
  997. if ( "zoom" in div.style ) {
  998. // Check if natively block-level elements act like inline-block
  999. // elements when setting their display to 'inline' and giving
  1000. // them layout
  1001. // (IE < 8 does this)
  1002. div.style.display = "inline";
  1003. div.style.zoom = 1;
  1004. jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2;
  1005. // Check if elements with layout shrink-wrap their children
  1006. // (IE 6 does this)
  1007. div.style.display = "";
  1008. div.innerHTML = "<div style='width:4px;'></div>";
  1009. jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
  1010. }
  1011. div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
  1012. var tds = div.getElementsByTagName("td");
  1013. // Check if table cells still have offsetWidth/Height when they are set
  1014. // to display:none and there are still other visible table cells in a
  1015. // table row; if so, offsetWidth/Height are not reliable for use when
  1016. // determining if an element has been hidden directly using
  1017. // display:none (it is still safe to use offsets if a parent element is
  1018. // hidden; don safety goggles and see bug #4512 for more information).
  1019. // (only IE 8 fails this test)
  1020. jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0;
  1021. tds[0].style.display = "";
  1022. tds[1].style.display = "none";
  1023. // Check if empty table cells still have offsetWidth/Height
  1024. // (IE < 8 fail this test)
  1025. jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
  1026. div.innerHTML = "";
  1027. body.removeChild( div ).style.display = "none";
  1028. div = tds = null;
  1029. });
  1030. // Technique from Juriy Zaytsev
  1031. // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
  1032. var eventSupported = function( eventName ) {
  1033. var el = document.createElement("div");
  1034. eventName = "on" + eventName;
  1035. // We only care about the case where non-standard event systems
  1036. // are used, namely in IE. Short-circuiting here helps us to
  1037. // avoid an eval call (in setAttribute) which can cause CSP
  1038. // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
  1039. if ( !el.attachEvent ) {
  1040. return true;
  1041. }
  1042. var isSupported = (eventName in el);
  1043. if ( !isSupported ) {
  1044. el.setAttribute(eventName, "return;");
  1045. isSupported = typeof el[eventName] === "function";
  1046. }
  1047. el = null;
  1048. return isSupported;
  1049. };
  1050. jQuery.support.submitBubbles = eventSupported("submit");
  1051. jQuery.support.changeBubbles = eventSupported("change");
  1052. // release memory in IE
  1053. div = all = a = null;
  1054. })();
  1055. var rbrace = /^(?:\{.*\}|\[.*\])$/;
  1056. jQuery.extend({
  1057. cache: {},
  1058. // Please use with caution
  1059. uuid: 0,
  1060. // Unique for each copy of jQuery on the page
  1061. // Non-digits removed to match rinlinejQuery
  1062. expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
  1063. // The following elements throw uncatchable exceptions if you
  1064. // attempt to add expando properties to them.
  1065. noData: {
  1066. "embed": true,
  1067. // Ban all objects except for Flash (which handle expandos)
  1068. "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
  1069. "applet": true
  1070. },
  1071. hasData: function( elem ) {
  1072. elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
  1073. return !!elem && !jQuery.isEmptyObject(elem);
  1074. },
  1075. data: function( elem, name, data, pvt /* Internal Use Only */ ) {
  1076. if ( !jQuery.acceptData( elem ) ) {
  1077. return;
  1078. }
  1079. var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache,
  1080. // We have to handle DOM nodes and JS objects differently because IE6-7
  1081. // can't GC object references properly across the DOM-JS boundary
  1082. isNode = elem.nodeType,
  1083. // Only DOM nodes need the global jQuery cache; JS object data is
  1084. // attached directly to the object so GC can occur automatically
  1085. cache = isNode ? jQuery.cache : elem,
  1086. // Only defining an ID for JS objects if its cache already exists allows
  1087. // the code to shortcut on the same path as a DOM node with no cache
  1088. id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;
  1089. // Avoid doing any more work than we need to when trying to get data on an
  1090. // object that has no data at all
  1091. if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) {
  1092. return;
  1093. }
  1094. if ( !id ) {
  1095. // Only DOM nodes need a new unique ID for each element since their data
  1096. // ends up in the global cache
  1097. if ( isNode ) {
  1098. elem[ jQuery.expando ] = id = ++jQuery.uuid;
  1099. } else {
  1100. id = jQuery.expando;
  1101. }
  1102. }
  1103. if ( !cache[ id ] ) {
  1104. cache[ id ] = {};
  1105. }
  1106. // An object can be passed to jQuery.data instead of a key/value pair; this gets
  1107. // shallow copied over onto the existing cache
  1108. if ( typeof name === "object" ) {
  1109. if ( pvt ) {
  1110. cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);
  1111. } else {
  1112. cache[ id ] = jQuery.extend(cache[ id ], name);
  1113. }
  1114. }
  1115. thisCache = cache[ id ];
  1116. // Internal jQuery data is stored in a separate object inside the object's data
  1117. // cache in order to avoid key collisions between internal data and user-defined
  1118. // data
  1119. if ( pvt ) {
  1120. if ( !thisCache[ internalKey ] ) {
  1121. thisCache[ internalKey ] = {};
  1122. }
  1123. thisCache = thisCache[ internalKey ];
  1124. }
  1125. if ( data !== undefined ) {
  1126. thisCache[ name ] = data;
  1127. }
  1128. // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should
  1129. // not attempt to inspect the internal events object using jQuery.data, as this
  1130. // internal data object is undocumented and subject to change.
  1131. if ( name === "events" && !thisCache[name] ) {
  1132. return thisCache[ internalKey ] && thisCache[ internalKey ].events;
  1133. }
  1134. return getByName ? thisCache[ name ] : thisCache;
  1135. },
  1136. removeData: function( elem, name, pvt /* Internal Use Only */ ) {
  1137. if ( !jQuery.acceptData( elem ) ) {
  1138. return;
  1139. }
  1140. var internalKey = jQuery.expando, isNode = elem.nodeType,
  1141. // See jQuery.data for more information
  1142. cache = isNode ? jQuery.cache : elem,
  1143. // See jQuery.data for more information
  1144. id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
  1145. // If there is already no cache entry for this object, there is no
  1146. // purpose in continuing
  1147. if ( !cache[ id ] ) {
  1148. return;
  1149. }
  1150. if ( name ) {
  1151. var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];
  1152. if ( thisCache ) {
  1153. delete thisCache[ name ];
  1154. // If there is no data left in the cache, we want to continue
  1155. // and let the cache object itself get destroyed
  1156. if ( !jQuery.isEmptyObject(thisCache) ) {
  1157. return;
  1158. }
  1159. }
  1160. }
  1161. // See jQuery.data for more information
  1162. if ( pvt ) {
  1163. delete cache[ id ][ internalKey ];
  1164. // Don't destroy the parent cache unless the internal data object
  1165. // had been the only thing left in it
  1166. if ( !jQuery.isEmptyObject(cache[ id ]) ) {
  1167. return;
  1168. }
  1169. }
  1170. var internalCache = cache[ id ][ internalKey ];
  1171. // Browsers that fail expando deletion also refuse to delete expandos on
  1172. // the window, but it will allow it on all other JS objects; other browsers
  1173. // don't care
  1174. if ( jQuery.support.deleteExpando || cache != window ) {
  1175. delete cache[ id ];
  1176. } else {
  1177. cache[ id ] = null;
  1178. }
  1179. // We destroyed the entire user cache at once because it's faster than
  1180. // iterating through each key, but we need to continue to persist internal
  1181. // data if it existed
  1182. if ( internalCache ) {
  1183. cache[ id ] = {};
  1184. cache[ id ][ internalKey ] = internalCache;
  1185. // Otherwise, we need to eliminate the expando on the node to avoid
  1186. // false lookups in the cache for entries that no longer exist
  1187. } else if ( isNode ) {
  1188. // IE does not allow us to delete expando properties from nodes,
  1189. // nor does it have a removeAttribute function on Document nodes;
  1190. // we must handle all of these cases
  1191. if ( jQuery.support.deleteExpando ) {
  1192. delete elem[ jQuery.expando ];
  1193. } else if ( elem.removeAttribute ) {
  1194. elem.removeAttribute( jQuery.expando );
  1195. } else {
  1196. elem[ jQuery.expando ] = null;
  1197. }
  1198. }
  1199. },
  1200. // For internal use only.
  1201. _data: function( elem, name, data ) {
  1202. return jQuery.data( elem, name, data, true );
  1203. },
  1204. // A method for determining if a DOM node can handle the data expando
  1205. acceptData: function( elem ) {
  1206. if ( elem.nodeName ) {
  1207. var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
  1208. if ( match ) {
  1209. return !(match === true || elem.getAttribute("classid") !== match);
  1210. }
  1211. }
  1212. return true;
  1213. }
  1214. });
  1215. jQuery.fn.extend({
  1216. data: function( key, value ) {
  1217. var data = null;
  1218. if ( typeof key === "undefined" ) {
  1219. if ( this.length ) {
  1220. data = jQuery.data( this[0] );
  1221. if ( this[0].nodeType === 1 ) {
  1222. var attr = this[0].attributes, name;
  1223. for ( var i = 0, l = attr.length; i < l; i++ ) {
  1224. name = attr[i].name;
  1225. if ( name.indexOf( "data-" ) === 0 ) {
  1226. name = name.substr( 5 );
  1227. dataAttr( this[0], name, data[ name ] );
  1228. }
  1229. }
  1230. }
  1231. }
  1232. return data;
  1233. } else if ( typeof key === "object" ) {
  1234. return this.each(function() {
  1235. jQuery.data( this, key );
  1236. });
  1237. }
  1238. var parts = key.split(".");
  1239. parts[1] = parts[1] ? "." + parts[1] : "";
  1240. if ( value === undefined ) {
  1241. data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
  1242. // Try to fetch any internally stored data first
  1243. if ( data === undefined && this.length ) {
  1244. data = jQuery.data( this[0], key );
  1245. data = dataAttr( this[0], key, data );
  1246. }
  1247. return data === undefined && parts[1] ?
  1248. this.data( parts[0] ) :
  1249. data;
  1250. } else {
  1251. return this.each(function() {
  1252. var $this = jQuery( this ),
  1253. args = [ parts[0], value ];
  1254. $this.triggerHandler( "setData" + parts[1] + "!", args );
  1255. jQuery.data( this, key, value );
  1256. $this.triggerHandler( "changeData" + parts[1] + "!", args );
  1257. });
  1258. }
  1259. },
  1260. removeData: function( key ) {
  1261. return this.each(function() {
  1262. jQuery.removeData( this, key );
  1263. });
  1264. }
  1265. });
  1266. function dataAttr( elem, key, data ) {
  1267. // If nothing was found internally, try to fetch any
  1268. // data from the HTML5 data-* attribute
  1269. if ( data === undefined && elem.nodeType === 1 ) {
  1270. data = elem.getAttribute( "data-" + key );
  1271. if ( typeof data === "string" ) {
  1272. try {
  1273. data = data === "true" ? true :
  1274. data === "false" ? false :
  1275. data === "null" ? null :
  1276. !jQuery.isNaN( data ) ? parseFloat( data ) :
  1277. rbrace.test( data ) ? jQuery.parseJSON( data ) :
  1278. data;
  1279. } catch( e ) {}
  1280. // Make sure we set the data so it isn't changed later
  1281. jQuery.data( elem, key, data );
  1282. } else {
  1283. data = undefined;
  1284. }
  1285. }
  1286. return data;
  1287. }
  1288. jQuery.extend({
  1289. queue: function( elem, type, data ) {
  1290. if ( !elem ) {
  1291. return;
  1292. }
  1293. type = (type || "fx") + "queue";
  1294. var q = jQuery._data( elem, type );
  1295. // Speed up dequeue by getting out quickly if this is just a lookup
  1296. if ( !data ) {
  1297. return q || [];
  1298. }
  1299. if ( !q || jQuery.isArray(data) ) {
  1300. q = jQuery._data( elem, type, jQuery.makeArray(data) );
  1301. } else {
  1302. q.push( data );
  1303. }
  1304. return q;
  1305. },
  1306. dequeue: function( elem, type ) {
  1307. type = type || "fx";
  1308. var queue = jQuery.queue( elem, type ),
  1309. fn = queue.shift();
  1310. // If the fx queue is dequeued, always remove the progress sentinel
  1311. if ( fn === "inprogress" ) {
  1312. fn = queue.shift();
  1313. }
  1314. if ( fn ) {
  1315. // Add a progress sentinel to prevent the fx queue from being
  1316. // automatically dequeued
  1317. if ( type === "fx" ) {
  1318. queue.unshift("inprogress");
  1319. }
  1320. fn.call(elem, function() {
  1321. jQuery.dequeue(elem, type);
  1322. });
  1323. }
  1324. if ( !queue.length ) {
  1325. jQuery.removeData( elem, type + "queue", true );
  1326. }
  1327. }
  1328. });
  1329. jQuery.fn.extend({
  1330. queue: function( type, data ) {
  1331. if ( typeof type !== "string" ) {
  1332. data = type;
  1333. type = "fx";
  1334. }
  1335. if ( data === undefined ) {
  1336. return jQuery.queue( this[0], type );
  1337. }
  1338. return this.each(function( i ) {
  1339. var queue = jQuery.queue( this, type, data );
  1340. if ( type === "fx" && queue[0] !== "inprogress" ) {
  1341. jQuery.dequeue( this, type );
  1342. }
  1343. });
  1344. },
  1345. dequeue: function( type ) {
  1346. return this.each(function() {
  1347. jQuery.dequeue( this, type );
  1348. });
  1349. },
  1350. // Based off of the plugin by Clint Helfers, with permission.
  1351. // http://blindsignals.com/index.php/2009/07/jquery-delay/
  1352. delay: function( time, type ) {
  1353. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  1354. type = type || "fx";
  1355. return this.queue( type, function() {
  1356. var elem = this;
  1357. setTimeout(function() {
  1358. jQuery.dequeue( elem, type );
  1359. }, time );
  1360. });
  1361. },
  1362. clearQueue: function( type ) {
  1363. return this.queue( type || "fx", [] );
  1364. }
  1365. });
  1366. var rclass = /[\n\t\r]/g,
  1367. rspaces = /\s+/,
  1368. rreturn = /\r/g,
  1369. rspecialurl = /^(?:href|src|style)$/,
  1370. rtype = /^(?:button|input)$/i,
  1371. rfocusable = /^(?:button|input|object|select|textarea)$/i,
  1372. rclickable = /^a(?:rea)?$/i,
  1373. rradiocheck = /^(?:radio|checkbox)$/i;
  1374. jQuery.props = {
  1375. "for": "htmlFor",
  1376. "class": "className",
  1377. readonly: "readOnly",
  1378. maxlength: "maxLength",
  1379. cellspacing: "cellSpacing",
  1380. rowspan: "rowSpan",
  1381. colspan: "colSpan",
  1382. tabindex: "tabIndex",
  1383. usemap: "useMap",
  1384. frameborder: "frameBorder"
  1385. };
  1386. jQuery.fn.extend({
  1387. attr: function( name, value ) {
  1388. return jQuery.access( this, name, value, true, jQuery.attr );
  1389. },
  1390. removeAttr: function( name, fn ) {
  1391. return this.each(function(){
  1392. jQuery.attr( this, name, "" );
  1393. if ( this.nodeType === 1 ) {
  1394. this.removeAttribute( name );
  1395. }
  1396. });
  1397. },
  1398. addClass: function( value ) {
  1399. if ( jQuery.isFunction(value) ) {
  1400. return this.each(function(i) {
  1401. var self = jQuery(this);
  1402. self.addClass( value.call(this, i, self.attr("class")) );
  1403. });
  1404. }
  1405. if ( value && typeof value === "string" ) {
  1406. var classNames = (value || "").split( rspaces );
  1407. for ( var i = 0, l = this.length; i < l; i++ ) {
  1408. var elem = this[i];
  1409. if ( elem.nodeType === 1 ) {
  1410. if ( !elem.className ) {
  1411. elem.className = value;
  1412. } else {
  1413. var className = " " + elem.className + " ",
  1414. setClass = elem.className;
  1415. for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
  1416. if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
  1417. setClass += " " + classNames[c];
  1418. }
  1419. }
  1420. elem.className = jQuery.trim( setClass );
  1421. }
  1422. }
  1423. }
  1424. }
  1425. return this;
  1426. },
  1427. removeClass: function( value ) {
  1428. if ( jQuery.isFunction(value) ) {
  1429. return this.each(function(i) {
  1430. var self = jQuery(this);
  1431. self.removeClass( value.call(this, i, self.attr("class")) );
  1432. });
  1433. }
  1434. if ( (value && typeof value === "string") || value === undefined ) {
  1435. var classNames = (value || "").split( rspaces );
  1436. for ( var i = 0, l = this.length; i < l; i++ ) {
  1437. var elem = this[i];
  1438. if ( elem.nodeType === 1 && elem.className ) {
  1439. if ( value ) {
  1440. var className = (" " + elem.className + " ").replace(rclass, " ");
  1441. for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
  1442. className = className.replace(" " + classNames[c] + " ", " ");
  1443. }
  1444. elem.className = jQuery.trim( className );
  1445. } else {
  1446. elem.className = "";
  1447. }
  1448. }
  1449. }
  1450. }
  1451. return this;
  1452. },
  1453. toggleClass: function( value, stateVal ) {
  1454. var type = typeof value,
  1455. isBool = typeof stateVal === "boolean";
  1456. if ( jQuery.isFunction( value ) ) {
  1457. return this.each(function(i) {
  1458. var self = jQuery(this);
  1459. self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
  1460. });
  1461. }
  1462. return this.each(function() {
  1463. if ( type === "string" ) {
  1464. // toggle individual class names
  1465. var className,
  1466. i = 0,
  1467. self = jQuery( this ),
  1468. state = stateVal,
  1469. classNames = value.split( rspaces );
  1470. while ( (className = classNames[ i++ ]) ) {
  1471. // check each className given, space seperated list
  1472. state = isBool ? state : !self.hasClass( className );
  1473. self[ state ? "addClass" : "removeClass" ]( className );
  1474. }
  1475. } else if ( type === "undefined" || type === "boolean" ) {
  1476. if ( this.className ) {
  1477. // store className if set
  1478. jQuery._data( this, "__className__", this.className );
  1479. }
  1480. // toggle whole className
  1481. this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
  1482. }
  1483. });
  1484. },
  1485. hasClass: function( selector ) {
  1486. var className = " " + selector + " ";
  1487. for ( var i = 0, l = this.length; i < l; i++ ) {
  1488. if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
  1489. return true;
  1490. }
  1491. }
  1492. return false;
  1493. },
  1494. val: function( value ) {
  1495. if ( !arguments.length ) {
  1496. var elem = this[0];
  1497. if ( elem ) {
  1498. if ( jQuery.nodeName( elem, "option" ) ) {
  1499. // attributes.value is undefined in Blackberry 4.7 but
  1500. // uses .value. See #6932
  1501. var val = elem.attributes.value;
  1502. return !val || val.specified ? elem.value : elem.text;
  1503. }
  1504. // We need to handle select boxes special
  1505. if ( jQuery.nodeName( elem, "select" ) ) {
  1506. var index = elem.selectedIndex,
  1507. values = [],
  1508. options = elem.options,
  1509. one = elem.type === "select-one";
  1510. // Nothing was selected
  1511. if ( index < 0 ) {
  1512. return null;
  1513. }
  1514. // Loop through all the selected options
  1515. for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
  1516. var option = options[ i ];
  1517. // Don't return options that are disabled or in a disabled optgroup
  1518. if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
  1519. (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
  1520. // Get the specific value for the option
  1521. value = jQuery(option).val();
  1522. // We don't need an array for one selects
  1523. if ( one ) {
  1524. return value;
  1525. }
  1526. // Multi-Selects return an array
  1527. values.push( value );
  1528. }
  1529. }
  1530. return values;
  1531. }
  1532. // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
  1533. if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {
  1534. return elem.getAttribute("value") === null ? "on" : elem.value;
  1535. }
  1536. // Everything else, we just grab the value
  1537. return (elem.value || "").replace(rreturn, "");
  1538. }
  1539. return undefined;
  1540. }
  1541. var isFunction = jQuery.isFunction(value);
  1542. return this.each(function(i) {
  1543. var self = jQuery(this), val = value;
  1544. if ( this.nodeType !== 1 ) {
  1545. return;
  1546. }
  1547. if ( isFunction ) {
  1548. val = value.call(this, i, self.val());
  1549. }
  1550. // Treat null/undefined as ""; convert numbers to string
  1551. if ( val == null ) {
  1552. val = "";
  1553. } else if ( typeof val === "number" ) {
  1554. val += "";
  1555. } else if ( jQuery.isArray(val) ) {
  1556. val = jQuery.map(val, function (value) {
  1557. return value == null ? "" : value + "";
  1558. });
  1559. }
  1560. if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {
  1561. this.checked = jQuery.inArray( self.val(), val ) >= 0;
  1562. } else if ( jQuery.nodeName( this, "select" ) ) {
  1563. var values = jQuery.makeArray(val);
  1564. jQuery( "option", this ).each(function() {
  1565. this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
  1566. });
  1567. if ( !values.length ) {
  1568. this.selectedIndex = -1;
  1569. }
  1570. } else {
  1571. this.value = val;
  1572. }
  1573. });
  1574. }
  1575. });
  1576. jQuery.extend({
  1577. attrFn: {
  1578. val: true,
  1579. css: true,
  1580. html: true,
  1581. text: true,
  1582. data: true,
  1583. width: true,
  1584. height: true,
  1585. offset: true
  1586. },
  1587. attr: function( elem, name, value, pass ) {
  1588. // don't get/set attributes on text, comment and attribute nodes
  1589. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || elem.nodeType === 2 ) {
  1590. return undefined;
  1591. }
  1592. if ( pass && name in jQuery.attrFn ) {
  1593. return jQuery(elem)[name](value);
  1594. }
  1595. var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ),
  1596. // Whether we are setting (or getting)
  1597. set = value !== undefined;
  1598. // Try to normalize/fix the name
  1599. name = notxml && jQuery.props[ name ] || name;
  1600. // Only do all the following if this is a node (faster for style)
  1601. if ( elem.nodeType === 1 ) {
  1602. // These attributes require special treatment
  1603. var special = rspecialurl.test( name );
  1604. // Safari mis-reports the default selected property of an option
  1605. // Accessing the parent's selectedIndex property fixes it
  1606. if ( name === "selected" && !jQuery.support.optSelected ) {
  1607. var parent = elem.parentNode;
  1608. if ( parent ) {
  1609. parent.selectedIndex;
  1610. // Make sure that it also works with optgroups, see #5701
  1611. if ( parent.parentNode ) {
  1612. parent.parentNode.selectedIndex;
  1613. }
  1614. }
  1615. }
  1616. // If applicable, access the attribute via the DOM 0 way
  1617. // 'in' checks fail in Blackberry 4.7 #6931
  1618. if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {
  1619. if ( set ) {
  1620. // We can't allow the type property to be changed (since it causes problems in IE)
  1621. if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
  1622. jQuery.error( "type property can't be changed" );
  1623. }
  1624. if ( value === null ) {
  1625. if ( elem.nodeType === 1 ) {
  1626. elem.removeAttribute( name );
  1627. }
  1628. } else {
  1629. elem[ name ] = value;
  1630. }
  1631. }
  1632. // browsers index elements by id/name on forms, give priority to attributes.
  1633. if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
  1634. return elem.getAttributeNode( name ).nodeValue;
  1635. }
  1636. // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
  1637. // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  1638. if ( name === "tabIndex" ) {
  1639. var attributeNode = elem.getAttributeNode( "tabIndex" );
  1640. return attributeNode && attributeNode.specified ?
  1641. attributeNode.value :
  1642. rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
  1643. 0 :
  1644. undefined;
  1645. }
  1646. return elem[ name ];
  1647. }
  1648. if ( !jQuery.support.style && notxml && name === "style" ) {
  1649. if ( set ) {
  1650. elem.style.cssText = "" + value;
  1651. }
  1652. return elem.style.cssText;
  1653. }
  1654. if ( set ) {
  1655. // convert the value to a string (all browsers do this but IE) see #1070
  1656. elem.setAttribute( name, "" + value );
  1657. }
  1658. // Ensure that missing attributes return undefined
  1659. // Blackberry 4.7 returns "" from getAttribute #6938
  1660. if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {
  1661. return undefined;
  1662. }
  1663. var attr = !jQuery.support.hrefNormalized && notxml && special ?
  1664. // Some attributes require a special call on IE
  1665. elem.getAttribute( name, 2 ) :
  1666. elem.getAttribute( name );
  1667. // Non-existent attributes return null, we normalize to undefined
  1668. return attr === null ? undefined : attr;
  1669. }
  1670. // Handle everything which isn't a DOM element node
  1671. if ( set ) {
  1672. elem[ name ] = value;
  1673. }
  1674. return elem[ name ];
  1675. }
  1676. });
  1677. var rnamespaces = /\.(.*)$/,
  1678. rformElems = /^(?:textarea|input|select)$/i,
  1679. rperiod = /\./g,
  1680. rspace = / /g,
  1681. rescape = /[^\w\s.|`]/g,
  1682. fcleanup = function( nm ) {
  1683. return nm.replace(rescape, "\\$&");
  1684. },
  1685. eventKey = "events";
  1686. /*
  1687. * A number of helper functions used for managing events.
  1688. * Many of the ideas behind this code originated from
  1689. * Dean Edwards' addEvent library.
  1690. */
  1691. jQuery.event = {
  1692. // Bind an event to an element
  1693. // Original by Dean Edwards
  1694. add: function( elem, types, handler, data ) {
  1695. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  1696. return;
  1697. }
  1698. // For whatever reason, IE has trouble passing the window object
  1699. // around, causing it to be cloned in the process
  1700. if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
  1701. elem = window;
  1702. }
  1703. if ( handler === false ) {
  1704. handler = returnFalse;
  1705. } else if ( !handler ) {
  1706. // Fixes bug #7229. Fix recommended by jdalton
  1707. return;
  1708. }
  1709. var handleObjIn, handleObj;
  1710. if ( handler.handler ) {
  1711. handleObjIn = handler;
  1712. handler = handleObjIn.handler;
  1713. }
  1714. // Make sure that the function being executed has a unique ID
  1715. if ( !handler.guid ) {
  1716. handler.guid = jQuery.guid++;
  1717. }
  1718. // Init the element's event structure
  1719. var elemData = jQuery._data( elem );
  1720. // If no elemData is found then we must be trying to bind to one of the
  1721. // banned noData elements
  1722. if ( !elemData ) {
  1723. return;
  1724. }
  1725. var events = elemData[ eventKey ],
  1726. eventHandle = elemData.handle;
  1727. if ( typeof events === "function" ) {
  1728. // On plain objects events is a fn that holds the the data
  1729. // which prevents this data from being JSON serialized
  1730. // the function does not need to be called, it just contains the data
  1731. eventHandle = events.handle;
  1732. events = events.events;
  1733. } else if ( !events ) {
  1734. if ( !elem.nodeType ) {
  1735. // On plain objects, create a fn that acts as the holder
  1736. // of the values to avoid JSON serialization of event data
  1737. elemData[ eventKey ] = elemData = function(){};
  1738. }
  1739. elemData.events = events = {};
  1740. }
  1741. if ( !eventHandle ) {
  1742. elemData.handle = eventHandle = function() {
  1743. // Handle the second event of a trigger and when
  1744. // an event is called after a page has unloaded
  1745. return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
  1746. jQuery.event.handle.apply( eventHandle.elem, arguments ) :
  1747. undefined;
  1748. };
  1749. }
  1750. // Add elem as a property of the handle function
  1751. // This is to prevent a memory leak with non-native events in IE.
  1752. eventHandle.elem = elem;
  1753. // Handle multiple events separated by a space
  1754. // jQuery(...).bind("mouseover mouseout", fn);
  1755. types = types.split(" ");
  1756. var type, i = 0, namespaces;
  1757. while ( (type = types[ i++ ]) ) {
  1758. handleObj = handleObjIn ?
  1759. jQuery.extend({}, handleObjIn) :
  1760. { handler: handler, data: data };
  1761. // Namespaced event handlers
  1762. if ( type.indexOf(".") > -1 ) {
  1763. namespaces = type.split(".");
  1764. type = namespaces.shift();
  1765. handleObj.namespace = namespaces.slice(0).sort().join(".");
  1766. } else {
  1767. namespaces = [];
  1768. handleObj.namespace = "";
  1769. }
  1770. handleObj.type = type;
  1771. if ( !handleObj.guid ) {
  1772. handleObj.guid = handler.guid;
  1773. }
  1774. // Get the current list of functions bound to this event
  1775. var handlers = events[ type ],
  1776. special = jQuery.event.special[ type ] || {};
  1777. // Init the event handler queue
  1778. if ( !handlers ) {
  1779. handlers = events[ type ] = [];
  1780. // Check for a special event handler
  1781. // Only use addEventListener/attachEvent if the special
  1782. // events handler returns false
  1783. if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  1784. // Bind the global event handler to the element
  1785. if ( elem.addEventListener ) {
  1786. elem.addEventListener( type, eventHandle, false );
  1787. } else if ( elem.attachEvent ) {
  1788. elem.attachEvent( "on" + type, eventHandle );
  1789. }
  1790. }
  1791. }
  1792. if ( special.add ) {
  1793. special.add.call( elem, handleObj );
  1794. if ( !handleObj.handler.guid ) {
  1795. handleObj.handler.guid = handler.guid;
  1796. }
  1797. }
  1798. // Add the function to the element's handler list
  1799. handlers.push( handleObj );
  1800. // Keep track of which events have been used, for global triggering
  1801. jQuery.event.global[ type ] = true;
  1802. }
  1803. // Nullify elem to prevent memory leaks in IE
  1804. elem = null;
  1805. },
  1806. global: {},
  1807. // Detach an event or set of events from an element
  1808. remove: function( elem, types, handler, pos ) {
  1809. // don't do events on text and comment nodes
  1810. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  1811. return;
  1812. }
  1813. if ( handler === false ) {
  1814. handler = returnFalse;
  1815. }
  1816. var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
  1817. elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
  1818. events = elemData && elemData[ eventKey ];
  1819. if ( !elemData || !events ) {
  1820. return;
  1821. }
  1822. if ( typeof events === "function" ) {
  1823. elemData = events;
  1824. events = events.events;
  1825. }
  1826. // types is actually an event object here
  1827. if ( types && types.type ) {
  1828. handler = types.handler;
  1829. types = types.type;
  1830. }
  1831. // Unbind all events for the element
  1832. if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
  1833. types = types || "";
  1834. for ( type in events ) {
  1835. jQuery.event.remove( elem, type + types );
  1836. }
  1837. return;
  1838. }
  1839. // Handle multiple events separated by a space
  1840. // jQuery(...).unbind("mouseover mouseout", fn);
  1841. types = types.split(" ");
  1842. while ( (type = types[ i++ ]) ) {
  1843. origType = type;
  1844. handleObj = null;
  1845. all = type.indexOf(".") < 0;
  1846. namespaces = [];
  1847. if ( !all ) {
  1848. // Namespaced event handlers
  1849. namespaces = type.split(".");
  1850. type = namespaces.shift();
  1851. namespace = new RegExp("(^|\\.)" +
  1852. jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
  1853. }
  1854. eventType = events[ type ];
  1855. if ( !eventType ) {
  1856. continue;
  1857. }
  1858. if ( !handler ) {
  1859. for ( j = 0; j < eventType.length; j++ ) {
  1860. handleObj = eventType[ j ];
  1861. if ( all || namespace.test( handleObj.namespace ) ) {
  1862. jQuery.event.remove( elem, origType, handleObj.handler, j );
  1863. eventType.splice( j--, 1 );
  1864. }
  1865. }
  1866. continue;
  1867. }
  1868. special = jQuery.event.special[ type ] || {};
  1869. for ( j = pos || 0; j < eventType.length; j++ ) {
  1870. handleObj = eventType[ j ];
  1871. if ( handler.guid === handleObj.guid ) {
  1872. // remove the given handler for the given type
  1873. if ( all || namespace.test( handleObj.namespace ) ) {
  1874. if ( pos == null ) {
  1875. eventType.splice( j--, 1 );
  1876. }
  1877. if ( special.remove ) {
  1878. special.remove.call( elem, handleObj );
  1879. }
  1880. }
  1881. if ( pos != null ) {
  1882. break;
  1883. }
  1884. }
  1885. }
  1886. // remove generic event handler if no more handlers exist
  1887. if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
  1888. if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
  1889. jQuery.removeEvent( elem, type, elemData.handle );
  1890. }
  1891. ret = null;
  1892. delete events[ type ];
  1893. }
  1894. }
  1895. // Remove the expando if it's no longer used
  1896. if ( jQuery.isEmptyObject( events ) ) {
  1897. var handle = elemData.handle;
  1898. if ( handle ) {
  1899. handle.elem = null;
  1900. }
  1901. delete elemData.events;
  1902. delete elemData.handle;
  1903. if ( typeof elemData === "function" ) {
  1904. jQuery.removeData( elem, eventKey, true );
  1905. } else if ( jQuery.isEmptyObject( elemData ) ) {
  1906. jQuery.removeData( elem, undefined, true );
  1907. }
  1908. }
  1909. },
  1910. // bubbling is internal
  1911. trigger: function( event, data, elem /*, bubbling */ ) {
  1912. // Event object or event type
  1913. var type = event.type || event,
  1914. bubbling = arguments[3];
  1915. if ( !bubbling ) {
  1916. event = typeof event === "object" ?
  1917. // jQuery.Event object
  1918. event[ jQuery.expando ] ? event :
  1919. // Object literal
  1920. jQuery.extend( jQuery.Event(type), event ) :
  1921. // Just the event type (string)
  1922. jQuery.Event(type);
  1923. if ( type.indexOf("!") >= 0 ) {
  1924. event.type = type = type.slice(0, -1);
  1925. event.exclusive = true;
  1926. }
  1927. // Handle a global trigger
  1928. if ( !elem ) {
  1929. // Don't bubble custom events when global (to avoid too much overhead)
  1930. event.stopPropagation();
  1931. // Only trigger if we've ever bound an event for it
  1932. if ( jQuery.event.global[ type ] ) {
  1933. // XXX This code smells terrible. event.js should not be directly
  1934. // inspecting the data cache
  1935. jQuery.each( jQuery.cache, function() {
  1936. // internalKey variable is just used to make it easier to find
  1937. // and potentially change this stuff later; currently it just
  1938. // points to jQuery.expando
  1939. var internalKey = jQuery.expando,
  1940. internalCache = this[ internalKey ];
  1941. if ( internalCache && internalCache.events && internalCache.events[type] ) {
  1942. jQuery.event.trigger( event, data, internalCache.handle.elem );
  1943. }
  1944. });
  1945. }
  1946. }
  1947. // Handle triggering a single element
  1948. // don't do events on text and comment nodes
  1949. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
  1950. return undefined;
  1951. }
  1952. // Clean up in case it is reused
  1953. event.result = undefined;
  1954. event.target = elem;
  1955. // Clone the incoming data, if any
  1956. data = jQuery.makeArray( data );
  1957. data.unshift( event );
  1958. }
  1959. event.currentTarget = elem;
  1960. // Trigger the event, it is assumed that "handle" is a function
  1961. var handle = elem.nodeType ?
  1962. jQuery._data( elem, "handle" ) :
  1963. (jQuery._data( elem, eventKey ) || {}).handle;
  1964. if ( handle ) {
  1965. handle.apply( elem, data );
  1966. }
  1967. var parent = elem.parentNode || elem.ownerDocument;
  1968. // Trigger an inline bound script
  1969. try {
  1970. if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
  1971. if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
  1972. event.result = false;
  1973. event.preventDefault();
  1974. }
  1975. }
  1976. // prevent IE from throwing an error for some elements with some event types, see #3533
  1977. } catch (inlineError) {}
  1978. if ( !event.isPropagationStopped() && parent ) {
  1979. jQuery.event.trigger( event, data, parent, true );
  1980. } else if ( !event.isDefaultPrevented() ) {
  1981. var old,
  1982. target = event.target,
  1983. targetType = type.replace( rnamespaces, "" ),
  1984. isClick = jQuery.nodeName( target, "a" ) && targetType === "click",
  1985. special = jQuery.event.special[ targetType ] || {};
  1986. if ( (!special._default || special._default.call( elem, event ) === false) &&
  1987. !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
  1988. try {
  1989. if ( target[ targetType ] ) {
  1990. // Make sure that we don't accidentally re-trigger the onFOO events
  1991. old = target[ "on" + targetType ];
  1992. if ( old ) {
  1993. target[ "on" + targetType ] = null;
  1994. }
  1995. jQuery.event.triggered = true;
  1996. target[ targetType ]();
  1997. }
  1998. // prevent IE from throwing an error for some elements with some event types, see #3533
  1999. } catch (triggerError) {}
  2000. if ( old ) {
  2001. target[ "on" + targetType ] = old;
  2002. }
  2003. jQuery.event.triggered = false;
  2004. }
  2005. }
  2006. },
  2007. handle: function( event ) {
  2008. var all, handlers, namespaces, namespace_re, events,
  2009. namespace_sort = [],
  2010. args = jQuery.makeArray( arguments );
  2011. event = args[0] = jQuery.event.fix( event || window.event );
  2012. event.currentTarget = this;
  2013. // Namespaced event handlers
  2014. all = event.type.indexOf(".") < 0 && !event.exclusive;
  2015. if ( !all ) {
  2016. namespaces = event.type.split(".");
  2017. event.type = namespaces.shift();
  2018. namespace_sort = namespaces.slice(0).sort();
  2019. namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)");
  2020. }
  2021. event.namespace = event.namespace || namespace_sort.join(".");
  2022. events = jQuery._data(this, eventKey);
  2023. if ( typeof events === "function" ) {
  2024. events = events.events;
  2025. }
  2026. handlers = (events || {})[ event.type ];
  2027. if ( events && handlers ) {
  2028. // Clone the handlers to prevent manipulation
  2029. handlers = handlers.slice(0);
  2030. for ( var j = 0, l = handlers.length; j < l; j++ ) {
  2031. var handleObj = handlers[ j ];
  2032. // Filter the functions by class
  2033. if ( all || namespace_re.test( handleObj.namespace ) ) {
  2034. // Pass in a reference to the handler function itself
  2035. // So that we can later remove it
  2036. event.handler = handleObj.handler;
  2037. event.data = handleObj.data;
  2038. event.handleObj = handleObj;
  2039. var ret = handleObj.handler.apply( this, args );
  2040. if ( ret !== undefined ) {
  2041. event.result = ret;
  2042. if ( ret === false ) {
  2043. event.preventDefault();
  2044. event.stopPropagation();
  2045. }
  2046. }
  2047. if ( event.isImmediatePropagationStopped() ) {
  2048. break;
  2049. }
  2050. }
  2051. }
  2052. }
  2053. return event.result;
  2054. },
  2055. props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
  2056. fix: function( event ) {
  2057. if ( event[ jQuery.expando ] ) {
  2058. return event;
  2059. }
  2060. // store a copy of the original event object
  2061. // and "clone" to set read-only properties
  2062. var originalEvent = event;
  2063. event = jQuery.Event( originalEvent );
  2064. for ( var i = this.props.length, prop; i; ) {
  2065. prop = this.props[ --i ];
  2066. event[ prop ] = originalEvent[ prop ];
  2067. }
  2068. // Fix target property, if necessary
  2069. if ( !event.target ) {
  2070. // Fixes #1925 where srcElement might not be defined either
  2071. event.target = event.srcElement || document;
  2072. }
  2073. // check if target is a textnode (safari)
  2074. if ( event.target.nodeType === 3 ) {
  2075. event.target = event.target.parentNode;
  2076. }
  2077. // Add relatedTarget, if necessary
  2078. if ( !event.relatedTarget && event.fromElement ) {
  2079. event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
  2080. }
  2081. // Calculate pageX/Y if missing and clientX/Y available
  2082. if ( event.pageX == null && event.clientX != null ) {
  2083. var doc = document.documentElement,
  2084. body = document.body;
  2085. event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
  2086. event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
  2087. }
  2088. // Add which for key events
  2089. if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
  2090. event.which = event.charCode != null ? event.charCode : event.keyCode;
  2091. }
  2092. // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
  2093. if ( !event.metaKey && event.ctrlKey ) {
  2094. event.metaKey = event.ctrlKey;
  2095. }
  2096. // Add which for click: 1 === left; 2 === middle; 3 === right
  2097. // Note: button is not normalized, so don't use it
  2098. if ( !event.which && event.button !== undefined ) {
  2099. event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
  2100. }
  2101. return event;
  2102. },
  2103. // Deprecated, use jQuery.guid instead
  2104. guid: 1E8,
  2105. // Deprecated, use jQuery.proxy instead
  2106. proxy: jQuery.proxy,
  2107. special: {
  2108. ready: {
  2109. // Make sure the ready event is setup
  2110. setup: jQuery.bindReady,
  2111. teardown: jQuery.noop
  2112. },
  2113. live: {
  2114. add: function( handleObj ) {
  2115. jQuery.event.add( this,
  2116. liveConvert( handleObj.origType, handleObj.selector ),
  2117. jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
  2118. },
  2119. remove: function( handleObj ) {
  2120. jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
  2121. }
  2122. },
  2123. beforeunload: {
  2124. setup: function( data, namespaces, eventHandle ) {
  2125. // We only want to do this special case on windows
  2126. if ( jQuery.isWindow( this ) ) {
  2127. this.onbeforeunload = eventHandle;
  2128. }
  2129. },
  2130. teardown: function( namespaces, eventHandle ) {
  2131. if ( this.onbeforeunload === eventHandle ) {
  2132. this.onbeforeunload = null;
  2133. }
  2134. }
  2135. }
  2136. }
  2137. };
  2138. jQuery.removeEvent = document.removeEventListener ?
  2139. function( elem, type, handle ) {
  2140. if ( elem.removeEventListener ) {
  2141. elem.removeEventListener( type, handle, false );
  2142. }
  2143. } :
  2144. function( elem, type, handle ) {
  2145. if ( elem.detachEvent ) {
  2146. elem.detachEvent( "on" + type, handle );
  2147. }
  2148. };
  2149. jQuery.Event = function( src ) {
  2150. // Allow instantiation without the 'new' keyword
  2151. if ( !this.preventDefault ) {
  2152. return new jQuery.Event( src );
  2153. }
  2154. // Event object
  2155. if ( src && src.type ) {
  2156. this.originalEvent = src;
  2157. this.type = src.type;
  2158. // Events bubbling up the document may have been marked as prevented
  2159. // by a handler lower down the tree; reflect the correct value.
  2160. this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
  2161. src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse;
  2162. // Event type
  2163. } else {
  2164. this.type = src;
  2165. }
  2166. // timeStamp is buggy for some events on Firefox(#3843)
  2167. // So we won't rely on the native value
  2168. this.timeStamp = jQuery.now();
  2169. // Mark it as fixed
  2170. this[ jQuery.expando ] = true;
  2171. };
  2172. function returnFalse() {
  2173. return false;
  2174. }
  2175. function returnTrue() {
  2176. return true;
  2177. }
  2178. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  2179. // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  2180. jQuery.Event.prototype = {
  2181. preventDefault: function() {
  2182. this.isDefaultPrevented = returnTrue;
  2183. var e = this.originalEvent;
  2184. if ( !e ) {
  2185. return;
  2186. }
  2187. // if preventDefault exists run it on the original event
  2188. if ( e.preventDefault ) {
  2189. e.preventDefault();
  2190. // otherwise set the returnValue property of the original event to false (IE)
  2191. } else {
  2192. e.returnValue = false;
  2193. }
  2194. },
  2195. stopPropagation: function() {
  2196. this.isPropagationStopped = returnTrue;
  2197. var e = this.originalEvent;
  2198. if ( !e ) {
  2199. return;
  2200. }
  2201. // if stopPropagation exists run it on the original event
  2202. if ( e.stopPropagation ) {
  2203. e.stopPropagation();
  2204. }
  2205. // otherwise set the cancelBubble property of the original event to true (IE)
  2206. e.cancelBubble = true;
  2207. },
  2208. stopImmediatePropagation: function() {
  2209. this.isImmediatePropagationStopped = returnTrue;
  2210. this.stopPropagation();
  2211. },
  2212. isDefaultPrevented: returnFalse,
  2213. isPropagationStopped: returnFalse,
  2214. isImmediatePropagationStopped: returnFalse
  2215. };
  2216. // Checks if an event happened on an element within another element
  2217. // Used in jQuery.event.special.mouseenter and mouseleave handlers
  2218. var withinElement = function( event ) {
  2219. // Check if mouse(over|out) are still within the same parent element
  2220. var parent = event.relatedTarget;
  2221. // Firefox sometimes assigns relatedTarget a XUL element
  2222. // which we cannot access the parentNode property of
  2223. try {
  2224. // Traverse up the tree
  2225. while ( parent && parent !== this ) {
  2226. parent = parent.parentNode;
  2227. }
  2228. if ( parent !== this ) {
  2229. // set the correct event type
  2230. event.type = event.data;
  2231. // handle event if we actually just moused on to a non sub-element
  2232. jQuery.event.handle.apply( this, arguments );
  2233. }
  2234. // assuming we've left the element since we most likely mousedover a xul element
  2235. } catch(e) { }
  2236. },
  2237. // In case of event delegation, we only need to rename the event.type,
  2238. // liveHandler will take care of the rest.
  2239. delegate = function( event ) {
  2240. event.type = event.data;
  2241. jQuery.event.handle.apply( this, arguments );
  2242. };
  2243. // Create mouseenter and mouseleave events
  2244. jQuery.each({
  2245. mouseenter: "mouseover",
  2246. mouseleave: "mouseout"
  2247. }, function( orig, fix ) {
  2248. jQuery.event.special[ orig ] = {
  2249. setup: function( data ) {
  2250. jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
  2251. },
  2252. teardown: function( data ) {
  2253. jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
  2254. }
  2255. };
  2256. });
  2257. // submit delegation
  2258. if ( !jQuery.support.submitBubbles ) {
  2259. jQuery.event.special.submit = {
  2260. setup: function( data, namespaces ) {
  2261. if ( this.nodeName && this.nodeName.toLowerCase() !== "form" ) {
  2262. jQuery.event.add(this, "click.specialSubmit", function( e ) {
  2263. var elem = e.target,
  2264. type = elem.type;
  2265. if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
  2266. e.liveFired = undefined;
  2267. return trigger( "submit", this, arguments );
  2268. }
  2269. });
  2270. jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
  2271. var elem = e.target,
  2272. type = elem.type;
  2273. if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
  2274. e.liveFired = undefined;
  2275. return trigger( "submit", this, arguments );
  2276. }
  2277. });
  2278. } else {
  2279. return false;
  2280. }
  2281. },
  2282. teardown: function( namespaces ) {
  2283. jQuery.event.remove( this, ".specialSubmit" );
  2284. }
  2285. };
  2286. }
  2287. // change delegation, happens here so we have bind.
  2288. if ( !jQuery.support.changeBubbles ) {
  2289. var changeFilters,
  2290. getVal = function( elem ) {
  2291. var type = elem.type, val = elem.value;
  2292. if ( type === "radio" || type === "checkbox" ) {
  2293. val = elem.checked;
  2294. } else if ( type === "select-multiple" ) {
  2295. val = elem.selectedIndex > -1 ?
  2296. jQuery.map( elem.options, function( elem ) {
  2297. return elem.selected;
  2298. }).join("-") :
  2299. "";
  2300. } else if ( elem.nodeName.toLowerCase() === "select" ) {
  2301. val = elem.selectedIndex;
  2302. }
  2303. return val;
  2304. },
  2305. testChange = function testChange( e ) {
  2306. var elem = e.target, data, val;
  2307. if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
  2308. return;
  2309. }
  2310. data = jQuery._data( elem, "_change_data" );
  2311. val = getVal(elem);
  2312. // the current data will be also retrieved by beforeactivate
  2313. if ( e.type !== "focusout" || elem.type !== "radio" ) {
  2314. jQuery._data( elem, "_change_data", val );
  2315. }
  2316. if ( data === undefined || val === data ) {
  2317. return;
  2318. }
  2319. if ( data != null || val ) {
  2320. e.type = "change";
  2321. e.liveFired = undefined;
  2322. return jQuery.event.trigger( e, arguments[1], elem );
  2323. }
  2324. };
  2325. jQuery.event.special.change = {
  2326. filters: {
  2327. focusout: testChange,
  2328. beforedeactivate: testChange,
  2329. click: function( e ) {
  2330. var elem = e.target, type = elem.type;
  2331. if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
  2332. return testChange.call( this, e );
  2333. }
  2334. },
  2335. // Change has to be called before submit
  2336. // Keydown will be called before keypress, which is used in submit-event delegation
  2337. keydown: function( e ) {
  2338. var elem = e.target, type = elem.type;
  2339. if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
  2340. (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
  2341. type === "select-multiple" ) {
  2342. return testChange.call( this, e );
  2343. }
  2344. },
  2345. // Beforeactivate happens also before the previous element is blurred
  2346. // with this event you can't trigger a change event, but you can store
  2347. // information
  2348. beforeactivate: function( e ) {
  2349. var elem = e.target;
  2350. jQuery._data( elem, "_change_data", getVal(elem) );
  2351. }
  2352. },
  2353. setup: function( data, namespaces ) {
  2354. if ( this.type === "file" ) {
  2355. return false;
  2356. }
  2357. for ( var type in changeFilters ) {
  2358. jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
  2359. }
  2360. return rformElems.test( this.nodeName );
  2361. },
  2362. teardown: function( namespaces ) {
  2363. jQuery.event.remove( this, ".specialChange" );
  2364. return rformElems.test( this.nodeName );
  2365. }
  2366. };
  2367. changeFilters = jQuery.event.special.change.filters;
  2368. // Handle when the input is .focus()'d
  2369. changeFilters.focus = changeFilters.beforeactivate;
  2370. }
  2371. function trigger( type, elem, args ) {
  2372. args[0].type = type;
  2373. return jQuery.event.handle.apply( elem, args );
  2374. }
  2375. // Create "bubbling" focus and blur events
  2376. if ( document.addEventListener ) {
  2377. jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  2378. jQuery.event.special[ fix ] = {
  2379. setup: function() {
  2380. this.addEventListener( orig, handler, true );
  2381. },
  2382. teardown: function() {
  2383. this.removeEventListener( orig, handler, true );
  2384. }
  2385. };
  2386. function handler( e ) {
  2387. e = jQuery.event.fix( e );
  2388. e.type = fix;
  2389. return jQuery.event.handle.call( this, e );
  2390. }
  2391. });
  2392. }
  2393. jQuery.each(["bind", "one"], function( i, name ) {
  2394. jQuery.fn[ name ] = function( type, data, fn ) {
  2395. // Handle object literals
  2396. if ( typeof type === "object" ) {
  2397. for ( var key in type ) {
  2398. this[ name ](key, data, type[key], fn);
  2399. }
  2400. return this;
  2401. }
  2402. if ( jQuery.isFunction( data ) || data === false ) {
  2403. fn = data;
  2404. data = undefined;
  2405. }
  2406. var handler = name === "one" ? jQuery.proxy( fn, function( event ) {
  2407. jQuery( this ).unbind( event, handler );
  2408. return fn.apply( this, arguments );
  2409. }) : fn;
  2410. if ( type === "unload" && name !== "one" ) {
  2411. this.one( type, data, fn );
  2412. } else {
  2413. for ( var i = 0, l = this.length; i < l; i++ ) {
  2414. jQuery.event.add( this[i], type, handler, data );
  2415. }
  2416. }
  2417. return this;
  2418. };
  2419. });
  2420. jQuery.fn.extend({
  2421. unbind: function( type, fn ) {
  2422. // Handle object literals
  2423. if ( typeof type === "object" && !type.preventDefault ) {
  2424. for ( var key in type ) {
  2425. this.unbind(key, type[key]);
  2426. }
  2427. } else {
  2428. for ( var i = 0, l = this.length; i < l; i++ ) {
  2429. jQuery.event.remove( this[i], type, fn );
  2430. }
  2431. }
  2432. return this;
  2433. },
  2434. delegate: function( selector, types, data, fn ) {
  2435. return this.live( types, data, fn, selector );
  2436. },
  2437. undelegate: function( selector, types, fn ) {
  2438. if ( arguments.length === 0 ) {
  2439. return this.unbind( "live" );
  2440. } else {
  2441. return this.die( types, null, fn, selector );
  2442. }
  2443. },
  2444. trigger: function( type, data ) {
  2445. return this.each(function() {
  2446. jQuery.event.trigger( type, data, this );
  2447. });
  2448. },
  2449. triggerHandler: function( type, data ) {
  2450. if ( this[0] ) {
  2451. var event = jQuery.Event( type );
  2452. event.preventDefault();
  2453. event.stopPropagation();
  2454. jQuery.event.trigger( event, data, this[0] );
  2455. return event.result;
  2456. }
  2457. },
  2458. toggle: function( fn ) {
  2459. // Save reference to arguments for access in closure
  2460. var args = arguments,
  2461. i = 1;
  2462. // link all the functions, so any of them can unbind this click handler
  2463. while ( i < args.length ) {
  2464. jQuery.proxy( fn, args[ i++ ] );
  2465. }
  2466. return this.click( jQuery.proxy( fn, function( event ) {
  2467. // Figure out which function to execute
  2468. var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
  2469. jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
  2470. // Make sure that clicks stop
  2471. event.preventDefault();
  2472. // and execute the function
  2473. return args[ lastToggle ].apply( this, arguments ) || false;
  2474. }));
  2475. },
  2476. hover: function( fnOver, fnOut ) {
  2477. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  2478. }
  2479. });
  2480. var liveMap = {
  2481. focus: "focusin",
  2482. blur: "focusout",
  2483. mouseenter: "mouseover",
  2484. mouseleave: "mouseout"
  2485. };
  2486. jQuery.each(["live", "die"], function( i, name ) {
  2487. jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
  2488. var type, i = 0, match, namespaces, preType,
  2489. selector = origSelector || this.selector,
  2490. context = origSelector ? this : jQuery( this.context );
  2491. if ( typeof types === "object" && !types.preventDefault ) {
  2492. for ( var key in types ) {
  2493. context[ name ]( key, data, types[key], selector );
  2494. }
  2495. return this;
  2496. }
  2497. if ( jQuery.isFunction( data ) ) {
  2498. fn = data;
  2499. data = undefined;
  2500. }
  2501. types = (types || "").split(" ");
  2502. while ( (type = types[ i++ ]) != null ) {
  2503. match = rnamespaces.exec( type );
  2504. namespaces = "";
  2505. if ( match ) {
  2506. namespaces = match[0];
  2507. type = type.replace( rnamespaces, "" );
  2508. }
  2509. if ( type === "hover" ) {
  2510. types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
  2511. continue;
  2512. }
  2513. preType = type;
  2514. if ( type === "focus" || type === "blur" ) {
  2515. types.push( liveMap[ type ] + namespaces );
  2516. type = type + namespaces;
  2517. } else {
  2518. type = (liveMap[ type ] || type) + namespaces;
  2519. }
  2520. if ( name === "live" ) {
  2521. // bind live handler
  2522. for ( var j = 0, l = context.length; j < l; j++ ) {
  2523. jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
  2524. { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
  2525. }
  2526. } else {
  2527. // unbind live handler
  2528. context.unbind( "live." + liveConvert( type, selector ), fn );
  2529. }
  2530. }
  2531. return this;
  2532. };
  2533. });
  2534. function liveHandler( event ) {
  2535. var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
  2536. elems = [],
  2537. selectors = [],
  2538. events = jQuery._data( this, eventKey );
  2539. if ( typeof events === "function" ) {
  2540. events = events.events;
  2541. }
  2542. // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911)
  2543. if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) {
  2544. return;
  2545. }
  2546. if ( event.namespace ) {
  2547. namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
  2548. }
  2549. event.liveFired = this;
  2550. var live = events.live.slice(0);
  2551. for ( j = 0; j < live.length; j++ ) {
  2552. handleObj = live[j];
  2553. if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
  2554. selectors.push( handleObj.selector );
  2555. } else {
  2556. live.splice( j--, 1 );
  2557. }
  2558. }
  2559. match = jQuery( event.target ).closest( selectors, event.currentTarget );
  2560. for ( i = 0, l = match.length; i < l; i++ ) {
  2561. close = match[i];
  2562. for ( j = 0; j < live.length; j++ ) {
  2563. handleObj = live[j];
  2564. if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) {
  2565. elem = close.elem;
  2566. related = null;
  2567. // Those two events require additional checking
  2568. if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
  2569. event.type = handleObj.preType;
  2570. related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
  2571. }
  2572. if ( !related || related !== elem ) {
  2573. elems.push({ elem: elem, handleObj: handleObj, level: close.level });
  2574. }
  2575. }
  2576. }
  2577. }
  2578. for ( i = 0, l = elems.length; i < l; i++ ) {
  2579. match = elems[i];
  2580. if ( maxLevel && match.level > maxLevel ) {
  2581. break;
  2582. }
  2583. event.currentTarget = match.elem;
  2584. event.data = match.handleObj.data;
  2585. event.handleObj = match.handleObj;
  2586. ret = match.handleObj.origHandler.apply( match.elem, arguments );
  2587. if ( ret === false || event.isPropagationStopped() ) {
  2588. maxLevel = match.level;
  2589. if ( ret === false ) {
  2590. stop = false;
  2591. }
  2592. if ( event.isImmediatePropagationStopped() ) {
  2593. break;
  2594. }
  2595. }
  2596. }
  2597. return stop;
  2598. }
  2599. function liveConvert( type, selector ) {
  2600. return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");
  2601. }
  2602. jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
  2603. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  2604. "change select submit keydown keypress keyup error").split(" "), function( i, name ) {
  2605. // Handle event binding
  2606. jQuery.fn[ name ] = function( data, fn ) {
  2607. if ( fn == null ) {
  2608. fn = data;
  2609. data = null;
  2610. }
  2611. return arguments.length > 0 ?
  2612. this.bind( name, data, fn ) :
  2613. this.trigger( name );
  2614. };
  2615. if ( jQuery.attrFn ) {
  2616. jQuery.attrFn[ name ] = true;
  2617. }
  2618. });
  2619. /*!
  2620. * Sizzle CSS Selector Engine
  2621. * Copyright 2011, The Dojo Foundation
  2622. * Released under the MIT, BSD, and GPL Licenses.
  2623. * More information: http://sizzlejs.com/
  2624. */
  2625. (function(){
  2626. var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
  2627. done = 0,
  2628. toString = Object.prototype.toString,
  2629. hasDuplicate = false,
  2630. baseHasDuplicate = true;
  2631. // Here we check if the JavaScript engine is using some sort of
  2632. // optimization where it does not always call our comparision
  2633. // function. If that is the case, discard the hasDuplicate value.
  2634. // Thus far that includes Google Chrome.
  2635. [0, 0].sort(function() {
  2636. baseHasDuplicate = false;
  2637. return 0;
  2638. });
  2639. var Sizzle = function( selector, context, results, seed ) {
  2640. results = results || [];
  2641. context = context || document;
  2642. var origContext = context;
  2643. if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
  2644. return [];
  2645. }
  2646. if ( !selector || typeof selector !== "string" ) {
  2647. return results;
  2648. }
  2649. var m, set, checkSet, extra, ret, cur, pop, i,
  2650. prune = true,
  2651. contextXML = Sizzle.isXML( context ),
  2652. parts = [],
  2653. soFar = selector;
  2654. // Reset the position of the chunker regexp (start from head)
  2655. do {
  2656. chunker.exec( "" );
  2657. m = chunker.exec( soFar );
  2658. if ( m ) {
  2659. soFar = m[3];
  2660. parts.push( m[1] );
  2661. if ( m[2] ) {
  2662. extra = m[3];
  2663. break;
  2664. }
  2665. }
  2666. } while ( m );
  2667. if ( parts.length > 1 && origPOS.exec( selector ) ) {
  2668. if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
  2669. set = posProcess( parts[0] + parts[1], context );
  2670. } else {
  2671. set = Expr.relative[ parts[0] ] ?
  2672. [ context ] :
  2673. Sizzle( parts.shift(), context );
  2674. while ( parts.length ) {
  2675. selector = parts.shift();
  2676. if ( Expr.relative[ selector ] ) {
  2677. selector += parts.shift();
  2678. }
  2679. set = posProcess( selector, set );
  2680. }
  2681. }
  2682. } else {
  2683. // Take a shortcut and set the context if the root selector is an ID
  2684. // (but not if it'll be faster if the inner selector is an ID)
  2685. if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
  2686. Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
  2687. ret = Sizzle.find( parts.shift(), context, contextXML );
  2688. context = ret.expr ?
  2689. Sizzle.filter( ret.expr, ret.set )[0] :
  2690. ret.set[0];
  2691. }
  2692. if ( context ) {
  2693. ret = seed ?
  2694. { expr: parts.pop(), set: makeArray(seed) } :
  2695. Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
  2696. set = ret.expr ?
  2697. Sizzle.filter( ret.expr, ret.set ) :
  2698. ret.set;
  2699. if ( parts.length > 0 ) {
  2700. checkSet = makeArray( set );
  2701. } else {
  2702. prune = false;
  2703. }
  2704. while ( parts.length ) {
  2705. cur = parts.pop();
  2706. pop = cur;
  2707. if ( !Expr.relative[ cur ] ) {
  2708. cur = "";
  2709. } else {
  2710. pop = parts.pop();
  2711. }
  2712. if ( pop == null ) {
  2713. pop = context;
  2714. }
  2715. Expr.relative[ cur ]( checkSet, pop, contextXML );
  2716. }
  2717. } else {
  2718. checkSet = parts = [];
  2719. }
  2720. }
  2721. if ( !checkSet ) {
  2722. checkSet = set;
  2723. }
  2724. if ( !checkSet ) {
  2725. Sizzle.error( cur || selector );
  2726. }
  2727. if ( toString.call(checkSet) === "[object Array]" ) {
  2728. if ( !prune ) {
  2729. results.push.apply( results, checkSet );
  2730. } else if ( context && context.nodeType === 1 ) {
  2731. for ( i = 0; checkSet[i] != null; i++ ) {
  2732. if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
  2733. results.push( set[i] );
  2734. }
  2735. }
  2736. } else {
  2737. for ( i = 0; checkSet[i] != null; i++ ) {
  2738. if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
  2739. results.push( set[i] );
  2740. }
  2741. }
  2742. }
  2743. } else {
  2744. makeArray( checkSet, results );
  2745. }
  2746. if ( extra ) {
  2747. Sizzle( extra, origContext, results, seed );
  2748. Sizzle.uniqueSort( results );
  2749. }
  2750. return results;
  2751. };
  2752. Sizzle.uniqueSort = function( results ) {
  2753. if ( sortOrder ) {
  2754. hasDuplicate = baseHasDuplicate;
  2755. results.sort( sortOrder );
  2756. if ( hasDuplicate ) {
  2757. for ( var i = 1; i < results.length; i++ ) {
  2758. if ( results[i] === results[ i - 1 ] ) {
  2759. results.splice( i--, 1 );
  2760. }
  2761. }
  2762. }
  2763. }
  2764. return results;
  2765. };
  2766. Sizzle.matches = function( expr, set ) {
  2767. return Sizzle( expr, null, null, set );
  2768. };
  2769. Sizzle.matchesSelector = function( node, expr ) {
  2770. return Sizzle( expr, null, null, [node] ).length > 0;
  2771. };
  2772. Sizzle.find = function( expr, context, isXML ) {
  2773. var set;
  2774. if ( !expr ) {
  2775. return [];
  2776. }
  2777. for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
  2778. var match,
  2779. type = Expr.order[i];
  2780. if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
  2781. var left = match[1];
  2782. match.splice( 1, 1 );
  2783. if ( left.substr( left.length - 1 ) !== "\\" ) {
  2784. match[1] = (match[1] || "").replace(/\\/g, "");
  2785. set = Expr.find[ type ]( match, context, isXML );
  2786. if ( set != null ) {
  2787. expr = expr.replace( Expr.match[ type ], "" );
  2788. break;
  2789. }
  2790. }
  2791. }
  2792. }
  2793. if ( !set ) {
  2794. set = typeof context.getElementsByTagName !== "undefined" ?
  2795. context.getElementsByTagName( "*" ) :
  2796. [];
  2797. }
  2798. return { set: set, expr: expr };
  2799. };
  2800. Sizzle.filter = function( expr, set, inplace, not ) {
  2801. var match, anyFound,
  2802. old = expr,
  2803. result = [],
  2804. curLoop = set,
  2805. isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
  2806. while ( expr && set.length ) {
  2807. for ( var type in Expr.filter ) {
  2808. if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
  2809. var found, item,
  2810. filter = Expr.filter[ type ],
  2811. left = match[1];
  2812. anyFound = false;
  2813. match.splice(1,1);
  2814. if ( left.substr( left.length - 1 ) === "\\" ) {
  2815. continue;
  2816. }
  2817. if ( curLoop === result ) {
  2818. result = [];
  2819. }
  2820. if ( Expr.preFilter[ type ] ) {
  2821. match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
  2822. if ( !match ) {
  2823. anyFound = found = true;
  2824. } else if ( match === true ) {
  2825. continue;
  2826. }
  2827. }
  2828. if ( match ) {
  2829. for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
  2830. if ( item ) {
  2831. found = filter( item, match, i, curLoop );
  2832. var pass = not ^ !!found;
  2833. if ( inplace && found != null ) {
  2834. if ( pass ) {
  2835. anyFound = true;
  2836. } else {
  2837. curLoop[i] = false;
  2838. }
  2839. } else if ( pass ) {
  2840. result.push( item );
  2841. anyFound = true;
  2842. }
  2843. }
  2844. }
  2845. }
  2846. if ( found !== undefined ) {
  2847. if ( !inplace ) {
  2848. curLoop = result;
  2849. }
  2850. expr = expr.replace( Expr.match[ type ], "" );
  2851. if ( !anyFound ) {
  2852. return [];
  2853. }
  2854. break;
  2855. }
  2856. }
  2857. }
  2858. // Improper expression
  2859. if ( expr === old ) {
  2860. if ( anyFound == null ) {
  2861. Sizzle.error( expr );
  2862. } else {
  2863. break;
  2864. }
  2865. }
  2866. old = expr;
  2867. }
  2868. return curLoop;
  2869. };
  2870. Sizzle.error = function( msg ) {
  2871. throw "Syntax error, unrecognized expression: " + msg;
  2872. };
  2873. var Expr = Sizzle.selectors = {
  2874. order: [ "ID", "NAME", "TAG" ],
  2875. match: {
  2876. ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
  2877. CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
  2878. NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
  2879. ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
  2880. TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
  2881. CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
  2882. POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
  2883. PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
  2884. },
  2885. leftMatch: {},
  2886. attrMap: {
  2887. "class": "className",
  2888. "for": "htmlFor"
  2889. },
  2890. attrHandle: {
  2891. href: function( elem ) {
  2892. return elem.getAttribute( "href" );
  2893. }
  2894. },
  2895. relative: {
  2896. "+": function(checkSet, part){
  2897. var isPartStr = typeof part === "string",
  2898. isTag = isPartStr && !/\W/.test( part ),
  2899. isPartStrNotTag = isPartStr && !isTag;
  2900. if ( isTag ) {
  2901. part = part.toLowerCase();
  2902. }
  2903. for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
  2904. if ( (elem = checkSet[i]) ) {
  2905. while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
  2906. checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
  2907. elem || false :
  2908. elem === part;
  2909. }
  2910. }
  2911. if ( isPartStrNotTag ) {
  2912. Sizzle.filter( part, checkSet, true );
  2913. }
  2914. },
  2915. ">": function( checkSet, part ) {
  2916. var elem,
  2917. isPartStr = typeof part === "string",
  2918. i = 0,
  2919. l = checkSet.length;
  2920. if ( isPartStr && !/\W/.test( part ) ) {
  2921. part = part.toLowerCase();
  2922. for ( ; i < l; i++ ) {
  2923. elem = checkSet[i];
  2924. if ( elem ) {
  2925. var parent = elem.parentNode;
  2926. checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
  2927. }
  2928. }
  2929. } else {
  2930. for ( ; i < l; i++ ) {
  2931. elem = checkSet[i];
  2932. if ( elem ) {
  2933. checkSet[i] = isPartStr ?
  2934. elem.parentNode :
  2935. elem.parentNode === part;
  2936. }
  2937. }
  2938. if ( isPartStr ) {
  2939. Sizzle.filter( part, checkSet, true );
  2940. }
  2941. }
  2942. },
  2943. "": function(checkSet, part, isXML){
  2944. var nodeCheck,
  2945. doneName = done++,
  2946. checkFn = dirCheck;
  2947. if ( typeof part === "string" && !/\W/.test(part) ) {
  2948. part = part.toLowerCase();
  2949. nodeCheck = part;
  2950. checkFn = dirNodeCheck;
  2951. }
  2952. checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
  2953. },
  2954. "~": function( checkSet, part, isXML ) {
  2955. var nodeCheck,
  2956. doneName = done++,
  2957. checkFn = dirCheck;
  2958. if ( typeof part === "string" && !/\W/.test( part ) ) {
  2959. part = part.toLowerCase();
  2960. nodeCheck = part;
  2961. checkFn = dirNodeCheck;
  2962. }
  2963. checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
  2964. }
  2965. },
  2966. find: {
  2967. ID: function( match, context, isXML ) {
  2968. if ( typeof context.getElementById !== "undefined" && !isXML ) {
  2969. var m = context.getElementById(match[1]);
  2970. // Check parentNode to catch when Blackberry 4.6 returns
  2971. // nodes that are no longer in the document #6963
  2972. return m && m.parentNode ? [m] : [];
  2973. }
  2974. },
  2975. NAME: function( match, context ) {
  2976. if ( typeof context.getElementsByName !== "undefined" ) {
  2977. var ret = [],
  2978. results = context.getElementsByName( match[1] );
  2979. for ( var i = 0, l = results.length; i < l; i++ ) {
  2980. if ( results[i].getAttribute("name") === match[1] ) {
  2981. ret.push( results[i] );
  2982. }
  2983. }
  2984. return ret.length === 0 ? null : ret;
  2985. }
  2986. },
  2987. TAG: function( match, context ) {
  2988. if ( typeof context.getElementsByTagName !== "undefined" ) {
  2989. return context.getElementsByTagName( match[1] );
  2990. }
  2991. }
  2992. },
  2993. preFilter: {
  2994. CLASS: function( match, curLoop, inplace, result, not, isXML ) {
  2995. match = " " + match[1].replace(/\\/g, "") + " ";
  2996. if ( isXML ) {
  2997. return match;
  2998. }
  2999. for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
  3000. if ( elem ) {
  3001. if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
  3002. if ( !inplace ) {
  3003. result.push( elem );
  3004. }
  3005. } else if ( inplace ) {
  3006. curLoop[i] = false;
  3007. }
  3008. }
  3009. }
  3010. return false;
  3011. },
  3012. ID: function( match ) {
  3013. return match[1].replace(/\\/g, "");
  3014. },
  3015. TAG: function( match, curLoop ) {
  3016. return match[1].toLowerCase();
  3017. },
  3018. CHILD: function( match ) {
  3019. if ( match[1] === "nth" ) {
  3020. if ( !match[2] ) {
  3021. Sizzle.error( match[0] );
  3022. }
  3023. match[2] = match[2].replace(/^\+|\s*/g, '');
  3024. // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
  3025. var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
  3026. match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
  3027. !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
  3028. // calculate the numbers (first)n+(last) including if they are negative
  3029. match[2] = (test[1] + (test[2] || 1)) - 0;
  3030. match[3] = test[3] - 0;
  3031. }
  3032. else if ( match[2] ) {
  3033. Sizzle.error( match[0] );
  3034. }
  3035. // TODO: Move to normal caching system
  3036. match[0] = done++;
  3037. return match;
  3038. },
  3039. ATTR: function( match, curLoop, inplace, result, not, isXML ) {
  3040. var name = match[1] = match[1].replace(/\\/g, "");
  3041. if ( !isXML && Expr.attrMap[name] ) {
  3042. match[1] = Expr.attrMap[name];
  3043. }
  3044. // Handle if an un-quoted value was used
  3045. match[4] = ( match[4] || match[5] || "" ).replace(/\\/g, "");
  3046. if ( match[2] === "~=" ) {
  3047. match[4] = " " + match[4] + " ";
  3048. }
  3049. return match;
  3050. },
  3051. PSEUDO: function( match, curLoop, inplace, result, not ) {
  3052. if ( match[1] === "not" ) {
  3053. // If we're dealing with a complex expression, or a simple one
  3054. if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
  3055. match[3] = Sizzle(match[3], null, null, curLoop);
  3056. } else {
  3057. var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
  3058. if ( !inplace ) {
  3059. result.push.apply( result, ret );
  3060. }
  3061. return false;
  3062. }
  3063. } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
  3064. return true;
  3065. }
  3066. return match;
  3067. },
  3068. POS: function( match ) {
  3069. match.unshift( true );
  3070. return match;
  3071. }
  3072. },
  3073. filters: {
  3074. enabled: function( elem ) {
  3075. return elem.disabled === false && elem.type !== "hidden";
  3076. },
  3077. disabled: function( elem ) {
  3078. return elem.disabled === true;
  3079. },
  3080. checked: function( elem ) {
  3081. return elem.checked === true;
  3082. },
  3083. selected: function( elem ) {
  3084. // Accessing this property makes selected-by-default
  3085. // options in Safari work properly
  3086. elem.parentNode.selectedIndex;
  3087. return elem.selected === true;
  3088. },
  3089. parent: function( elem ) {
  3090. return !!elem.firstChild;
  3091. },
  3092. empty: function( elem ) {
  3093. return !elem.firstChild;
  3094. },
  3095. has: function( elem, i, match ) {
  3096. return !!Sizzle( match[3], elem ).length;
  3097. },
  3098. header: function( elem ) {
  3099. return (/h\d/i).test( elem.nodeName );
  3100. },
  3101. text: function( elem ) {
  3102. return "text" === elem.type;
  3103. },
  3104. radio: function( elem ) {
  3105. return "radio" === elem.type;
  3106. },
  3107. checkbox: function( elem ) {
  3108. return "checkbox" === elem.type;
  3109. },
  3110. file: function( elem ) {
  3111. return "file" === elem.type;
  3112. },
  3113. password: function( elem ) {
  3114. return "password" === elem.type;
  3115. },
  3116. submit: function( elem ) {
  3117. return "submit" === elem.type;
  3118. },
  3119. image: function( elem ) {
  3120. return "image" === elem.type;
  3121. },
  3122. reset: function( elem ) {
  3123. return "reset" === elem.type;
  3124. },
  3125. button: function( elem ) {
  3126. return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
  3127. },
  3128. input: function( elem ) {
  3129. return (/input|select|textarea|button/i).test( elem.nodeName );
  3130. }
  3131. },
  3132. setFilters: {
  3133. first: function( elem, i ) {
  3134. return i === 0;
  3135. },
  3136. last: function( elem, i, match, array ) {
  3137. return i === array.length - 1;
  3138. },
  3139. even: function( elem, i ) {
  3140. return i % 2 === 0;
  3141. },
  3142. odd: function( elem, i ) {
  3143. return i % 2 === 1;
  3144. },
  3145. lt: function( elem, i, match ) {
  3146. return i < match[3] - 0;
  3147. },
  3148. gt: function( elem, i, match ) {
  3149. return i > match[3] - 0;
  3150. },
  3151. nth: function( elem, i, match ) {
  3152. return match[3] - 0 === i;
  3153. },
  3154. eq: function( elem, i, match ) {
  3155. return match[3] - 0 === i;
  3156. }
  3157. },
  3158. filter: {
  3159. PSEUDO: function( elem, match, i, array ) {
  3160. var name = match[1],
  3161. filter = Expr.filters[ name ];
  3162. if ( filter ) {
  3163. return filter( elem, i, match, array );
  3164. } else if ( name === "contains" ) {
  3165. return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
  3166. } else if ( name === "not" ) {
  3167. var not = match[3];
  3168. for ( var j = 0, l = not.length; j < l; j++ ) {
  3169. if ( not[j] === elem ) {
  3170. return false;
  3171. }
  3172. }
  3173. return true;
  3174. } else {
  3175. Sizzle.error( name );
  3176. }
  3177. },
  3178. CHILD: function( elem, match ) {
  3179. var type = match[1],
  3180. node = elem;
  3181. switch ( type ) {
  3182. case "only":
  3183. case "first":
  3184. while ( (node = node.previousSibling) ) {
  3185. if ( node.nodeType === 1 ) {
  3186. return false;
  3187. }
  3188. }
  3189. if ( type === "first" ) {
  3190. return true;
  3191. }
  3192. node = elem;
  3193. case "last":
  3194. while ( (node = node.nextSibling) ) {
  3195. if ( node.nodeType === 1 ) {
  3196. return false;
  3197. }
  3198. }
  3199. return true;
  3200. case "nth":
  3201. var first = match[2],
  3202. last = match[3];
  3203. if ( first === 1 && last === 0 ) {
  3204. return true;
  3205. }
  3206. var doneName = match[0],
  3207. parent = elem.parentNode;
  3208. if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
  3209. var count = 0;
  3210. for ( node = parent.firstChild; node; node = node.nextSibling ) {
  3211. if ( node.nodeType === 1 ) {
  3212. node.nodeIndex = ++count;
  3213. }
  3214. }
  3215. parent.sizcache = doneName;
  3216. }
  3217. var diff = elem.nodeIndex - last;
  3218. if ( first === 0 ) {
  3219. return diff === 0;
  3220. } else {
  3221. return ( diff % first === 0 && diff / first >= 0 );
  3222. }
  3223. }
  3224. },
  3225. ID: function( elem, match ) {
  3226. return elem.nodeType === 1 && elem.getAttribute("id") === match;
  3227. },
  3228. TAG: function( elem, match ) {
  3229. return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
  3230. },
  3231. CLASS: function( elem, match ) {
  3232. return (" " + (elem.className || elem.getAttribute("class")) + " ")
  3233. .indexOf( match ) > -1;
  3234. },
  3235. ATTR: function( elem, match ) {
  3236. var name = match[1],
  3237. result = Expr.attrHandle[ name ] ?
  3238. Expr.attrHandle[ name ]( elem ) :
  3239. elem[ name ] != null ?
  3240. elem[ name ] :
  3241. elem.getAttribute( name ),
  3242. value = result + "",
  3243. type = match[2],
  3244. check = match[4];
  3245. return result == null ?
  3246. type === "!=" :
  3247. type === "=" ?
  3248. value === check :
  3249. type === "*=" ?
  3250. value.indexOf(check) >= 0 :
  3251. type === "~=" ?
  3252. (" " + value + " ").indexOf(check) >= 0 :
  3253. !check ?
  3254. value && result !== false :
  3255. type === "!=" ?
  3256. value !== check :
  3257. type === "^=" ?
  3258. value.indexOf(check) === 0 :
  3259. type === "$=" ?
  3260. value.substr(value.length - check.length) === check :
  3261. type === "|=" ?
  3262. value === check || value.substr(0, check.length + 1) === check + "-" :
  3263. false;
  3264. },
  3265. POS: function( elem, match, i, array ) {
  3266. var name = match[2],
  3267. filter = Expr.setFilters[ name ];
  3268. if ( filter ) {
  3269. return filter( elem, i, match, array );
  3270. }
  3271. }
  3272. }
  3273. };
  3274. var origPOS = Expr.match.POS,
  3275. fescape = function(all, num){
  3276. return "\\" + (num - 0 + 1);
  3277. };
  3278. for ( var type in Expr.match ) {
  3279. Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
  3280. Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
  3281. }
  3282. var makeArray = function( array, results ) {
  3283. array = Array.prototype.slice.call( array, 0 );
  3284. if ( results ) {
  3285. results.push.apply( results, array );
  3286. return results;
  3287. }
  3288. return array;
  3289. };
  3290. // Perform a simple check to determine if the browser is capable of
  3291. // converting a NodeList to an array using builtin methods.
  3292. // Also verifies that the returned array holds DOM nodes
  3293. // (which is not the case in the Blackberry browser)
  3294. try {
  3295. Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
  3296. // Provide a fallback method if it does not work
  3297. } catch( e ) {
  3298. makeArray = function( array, results ) {
  3299. var i = 0,
  3300. ret = results || [];
  3301. if ( toString.call(array) === "[object Array]" ) {
  3302. Array.prototype.push.apply( ret, array );
  3303. } else {
  3304. if ( typeof array.length === "number" ) {
  3305. for ( var l = array.length; i < l; i++ ) {
  3306. ret.push( array[i] );
  3307. }
  3308. } else {
  3309. for ( ; array[i]; i++ ) {
  3310. ret.push( array[i] );
  3311. }
  3312. }
  3313. }
  3314. return ret;
  3315. };
  3316. }
  3317. var sortOrder, siblingCheck;
  3318. if ( document.documentElement.compareDocumentPosition ) {
  3319. sortOrder = function( a, b ) {
  3320. if ( a === b ) {
  3321. hasDuplicate = true;
  3322. return 0;
  3323. }
  3324. if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
  3325. return a.compareDocumentPosition ? -1 : 1;
  3326. }
  3327. return a.compareDocumentPosition(b) & 4 ? -1 : 1;
  3328. };
  3329. } else {
  3330. sortOrder = function( a, b ) {
  3331. var al, bl,
  3332. ap = [],
  3333. bp = [],
  3334. aup = a.parentNode,
  3335. bup = b.parentNode,
  3336. cur = aup;
  3337. // The nodes are identical, we can exit early
  3338. if ( a === b ) {
  3339. hasDuplicate = true;
  3340. return 0;
  3341. // If the nodes are siblings (or identical) we can do a quick check
  3342. } else if ( aup === bup ) {
  3343. return siblingCheck( a, b );
  3344. // If no parents were found then the nodes are disconnected
  3345. } else if ( !aup ) {
  3346. return -1;
  3347. } else if ( !bup ) {
  3348. return 1;
  3349. }
  3350. // Otherwise they're somewhere else in the tree so we need
  3351. // to build up a full list of the parentNodes for comparison
  3352. while ( cur ) {
  3353. ap.unshift( cur );
  3354. cur = cur.parentNode;
  3355. }
  3356. cur = bup;
  3357. while ( cur ) {
  3358. bp.unshift( cur );
  3359. cur = cur.parentNode;
  3360. }
  3361. al = ap.length;
  3362. bl = bp.length;
  3363. // Start walking down the tree looking for a discrepancy
  3364. for ( var i = 0; i < al && i < bl; i++ ) {
  3365. if ( ap[i] !== bp[i] ) {
  3366. return siblingCheck( ap[i], bp[i] );
  3367. }
  3368. }
  3369. // We ended someplace up the tree so do a sibling check
  3370. return i === al ?
  3371. siblingCheck( a, bp[i], -1 ) :
  3372. siblingCheck( ap[i], b, 1 );
  3373. };
  3374. siblingCheck = function( a, b, ret ) {
  3375. if ( a === b ) {
  3376. return ret;
  3377. }
  3378. var cur = a.nextSibling;
  3379. while ( cur ) {
  3380. if ( cur === b ) {
  3381. return -1;
  3382. }
  3383. cur = cur.nextSibling;
  3384. }
  3385. return 1;
  3386. };
  3387. }
  3388. // Utility function for retreiving the text value of an array of DOM nodes
  3389. Sizzle.getText = function( elems ) {
  3390. var ret = "", elem;
  3391. for ( var i = 0; elems[i]; i++ ) {
  3392. elem = elems[i];
  3393. // Get the text from text nodes and CDATA nodes
  3394. if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
  3395. ret += elem.nodeValue;
  3396. // Traverse everything else, except comment nodes
  3397. } else if ( elem.nodeType !== 8 ) {
  3398. ret += Sizzle.getText( elem.childNodes );
  3399. }
  3400. }
  3401. return ret;
  3402. };
  3403. // Check to see if the browser returns elements by name when
  3404. // querying by getElementById (and provide a workaround)
  3405. (function(){
  3406. // We're going to inject a fake input element with a specified name
  3407. var form = document.createElement("div"),
  3408. id = "script" + (new Date()).getTime(),
  3409. root = document.documentElement;
  3410. form.innerHTML = "<a name='" + id + "'/>";
  3411. // Inject it into the root element, check its status, and remove it quickly
  3412. root.insertBefore( form, root.firstChild );
  3413. // The workaround has to do additional checks after a getElementById
  3414. // Which slows things down for other browsers (hence the branching)
  3415. if ( document.getElementById( id ) ) {
  3416. Expr.find.ID = function( match, context, isXML ) {
  3417. if ( typeof context.getElementById !== "undefined" && !isXML ) {
  3418. var m = context.getElementById(match[1]);
  3419. return m ?
  3420. m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
  3421. [m] :
  3422. undefined :
  3423. [];
  3424. }
  3425. };
  3426. Expr.filter.ID = function( elem, match ) {
  3427. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  3428. return elem.nodeType === 1 && node && node.nodeValue === match;
  3429. };
  3430. }
  3431. root.removeChild( form );
  3432. // release memory in IE
  3433. root = form = null;
  3434. })();
  3435. (function(){
  3436. // Check to see if the browser returns only elements
  3437. // when doing getElementsByTagName("*")
  3438. // Create a fake element
  3439. var div = document.createElement("div");
  3440. div.appendChild( document.createComment("") );
  3441. // Make sure no comments are found
  3442. if ( div.getElementsByTagName("*").length > 0 ) {
  3443. Expr.find.TAG = function( match, context ) {
  3444. var results = context.getElementsByTagName( match[1] );
  3445. // Filter out possible comments
  3446. if ( match[1] === "*" ) {
  3447. var tmp = [];
  3448. for ( var i = 0; results[i]; i++ ) {
  3449. if ( results[i].nodeType === 1 ) {
  3450. tmp.push( results[i] );
  3451. }
  3452. }
  3453. results = tmp;
  3454. }
  3455. return results;
  3456. };
  3457. }
  3458. // Check to see if an attribute returns normalized href attributes
  3459. div.innerHTML = "<a href='#'></a>";
  3460. if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
  3461. div.firstChild.getAttribute("href") !== "#" ) {
  3462. Expr.attrHandle.href = function( elem ) {
  3463. return elem.getAttribute( "href", 2 );
  3464. };
  3465. }
  3466. // release memory in IE
  3467. div = null;
  3468. })();
  3469. if ( document.querySelectorAll ) {
  3470. (function(){
  3471. var oldSizzle = Sizzle,
  3472. div = document.createElement("div"),
  3473. id = "__sizzle__";
  3474. div.innerHTML = "<p class='TEST'></p>";
  3475. // Safari can't handle uppercase or unicode characters when
  3476. // in quirks mode.
  3477. if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
  3478. return;
  3479. }
  3480. Sizzle = function( query, context, extra, seed ) {
  3481. context = context || document;
  3482. // Only use querySelectorAll on non-XML documents
  3483. // (ID selectors don't work in non-HTML documents)
  3484. if ( !seed && !Sizzle.isXML(context) ) {
  3485. // See if we find a selector to speed up
  3486. var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
  3487. if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
  3488. // Speed-up: Sizzle("TAG")
  3489. if ( match[1] ) {
  3490. return makeArray( context.getElementsByTagName( query ), extra );
  3491. // Speed-up: Sizzle(".CLASS")
  3492. } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
  3493. return makeArray( context.getElementsByClassName( match[2] ), extra );
  3494. }
  3495. }
  3496. if ( context.nodeType === 9 ) {
  3497. // Speed-up: Sizzle("body")
  3498. // The body element only exists once, optimize finding it
  3499. if ( query === "body" && context.body ) {
  3500. return makeArray( [ context.body ], extra );
  3501. // Speed-up: Sizzle("#ID")
  3502. } else if ( match && match[3] ) {
  3503. var elem = context.getElementById( match[3] );
  3504. // Check parentNode to catch when Blackberry 4.6 returns
  3505. // nodes that are no longer in the document #6963
  3506. if ( elem && elem.parentNode ) {
  3507. // Handle the case where IE and Opera return items
  3508. // by name instead of ID
  3509. if ( elem.id === match[3] ) {
  3510. return makeArray( [ elem ], extra );
  3511. }
  3512. } else {
  3513. return makeArray( [], extra );
  3514. }
  3515. }
  3516. try {
  3517. return makeArray( context.querySelectorAll(query), extra );
  3518. } catch(qsaError) {}
  3519. // qSA works strangely on Element-rooted queries
  3520. // We can work around this by specifying an extra ID on the root
  3521. // and working up from there (Thanks to Andrew Dupont for the technique)
  3522. // IE 8 doesn't work on object elements
  3523. } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
  3524. var old = context.getAttribute( "id" ),
  3525. nid = old || id,
  3526. hasParent = context.parentNode,
  3527. relativeHierarchySelector = /^\s*[+~]/.test( query );
  3528. if ( !old ) {
  3529. context.setAttribute( "id", nid );
  3530. } else {
  3531. nid = nid.replace( /'/g, "\\$&" );
  3532. }
  3533. if ( relativeHierarchySelector && hasParent ) {
  3534. context = context.parentNode;
  3535. }
  3536. try {
  3537. if ( !relativeHierarchySelector || hasParent ) {
  3538. return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
  3539. }
  3540. } catch(pseudoError) {
  3541. } finally {
  3542. if ( !old ) {
  3543. context.removeAttribute( "id" );
  3544. }
  3545. }
  3546. }
  3547. }
  3548. return oldSizzle(query, context, extra, seed);
  3549. };
  3550. for ( var prop in oldSizzle ) {
  3551. Sizzle[ prop ] = oldSizzle[ prop ];
  3552. }
  3553. // release memory in IE
  3554. div = null;
  3555. })();
  3556. }
  3557. (function(){
  3558. var html = document.documentElement,
  3559. matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,
  3560. pseudoWorks = false;
  3561. try {
  3562. // This should fail with an exception
  3563. // Gecko does not error, returns false instead
  3564. matches.call( document.documentElement, "[test!='']:sizzle" );
  3565. } catch( pseudoError ) {
  3566. pseudoWorks = true;
  3567. }
  3568. if ( matches ) {
  3569. Sizzle.matchesSelector = function( node, expr ) {
  3570. // Make sure that attribute selectors are quoted
  3571. expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
  3572. if ( !Sizzle.isXML( node ) ) {
  3573. try {
  3574. if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
  3575. return matches.call( node, expr );
  3576. }
  3577. } catch(e) {}
  3578. }
  3579. return Sizzle(expr, null, null, [node]).length > 0;
  3580. };
  3581. }
  3582. })();
  3583. (function(){
  3584. var div = document.createElement("div");
  3585. div.innerHTML = "<div class='test e'></div><div class='test'></div>";
  3586. // Opera can't find a second classname (in 9.6)
  3587. // Also, make sure that getElementsByClassName actually exists
  3588. if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
  3589. return;
  3590. }
  3591. // Safari caches class attributes, doesn't catch changes (in 3.2)
  3592. div.lastChild.className = "e";
  3593. if ( div.getElementsByClassName("e").length === 1 ) {
  3594. return;
  3595. }
  3596. Expr.order.splice(1, 0, "CLASS");
  3597. Expr.find.CLASS = function( match, context, isXML ) {
  3598. if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
  3599. return context.getElementsByClassName(match[1]);
  3600. }
  3601. };
  3602. // release memory in IE
  3603. div = null;
  3604. })();
  3605. function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
  3606. for ( var i = 0, l = checkSet.length; i < l; i++ ) {
  3607. var elem = checkSet[i];
  3608. if ( elem ) {
  3609. var match = false;
  3610. elem = elem[dir];
  3611. while ( elem ) {
  3612. if ( elem.sizcache === doneName ) {
  3613. match = checkSet[elem.sizset];
  3614. break;
  3615. }
  3616. if ( elem.nodeType === 1 && !isXML ){
  3617. elem.sizcache = doneName;
  3618. elem.sizset = i;
  3619. }
  3620. if ( elem.nodeName.toLowerCase() === cur ) {
  3621. match = elem;
  3622. break;
  3623. }
  3624. elem = elem[dir];
  3625. }
  3626. checkSet[i] = match;
  3627. }
  3628. }
  3629. }
  3630. function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
  3631. for ( var i = 0, l = checkSet.length; i < l; i++ ) {
  3632. var elem = checkSet[i];
  3633. if ( elem ) {
  3634. var match = false;
  3635. elem = elem[dir];
  3636. while ( elem ) {
  3637. if ( elem.sizcache === doneName ) {
  3638. match = checkSet[elem.sizset];
  3639. break;
  3640. }
  3641. if ( elem.nodeType === 1 ) {
  3642. if ( !isXML ) {
  3643. elem.sizcache = doneName;
  3644. elem.sizset = i;
  3645. }
  3646. if ( typeof cur !== "string" ) {
  3647. if ( elem === cur ) {
  3648. match = true;
  3649. break;
  3650. }
  3651. } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
  3652. match = elem;
  3653. break;
  3654. }
  3655. }
  3656. elem = elem[dir];
  3657. }
  3658. checkSet[i] = match;
  3659. }
  3660. }
  3661. }
  3662. if ( document.documentElement.contains ) {
  3663. Sizzle.contains = function( a, b ) {
  3664. return a !== b && (a.contains ? a.contains(b) : true);
  3665. };
  3666. } else if ( document.documentElement.compareDocumentPosition ) {
  3667. Sizzle.contains = function( a, b ) {
  3668. return !!(a.compareDocumentPosition(b) & 16);
  3669. };
  3670. } else {
  3671. Sizzle.contains = function() {
  3672. return false;
  3673. };
  3674. }
  3675. Sizzle.isXML = function( elem ) {
  3676. // documentElement is verified for cases where it doesn't yet exist
  3677. // (such as loading iframes in IE - #4833)
  3678. var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
  3679. return documentElement ? documentElement.nodeName !== "HTML" : false;
  3680. };
  3681. var posProcess = function( selector, context ) {
  3682. var match,
  3683. tmpSet = [],
  3684. later = "",
  3685. root = context.nodeType ? [context] : context;
  3686. // Position selectors must be done after the filter
  3687. // And so must :not(positional) so we move all PSEUDOs to the end
  3688. while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
  3689. later += match[0];
  3690. selector = selector.replace( Expr.match.PSEUDO, "" );
  3691. }
  3692. selector = Expr.relative[selector] ? selector + "*" : selector;
  3693. for ( var i = 0, l = root.length; i < l; i++ ) {
  3694. Sizzle( selector, root[i], tmpSet );
  3695. }
  3696. return Sizzle.filter( later, tmpSet );
  3697. };
  3698. // EXPOSE
  3699. jQuery.find = Sizzle;
  3700. jQuery.expr = Sizzle.selectors;
  3701. jQuery.expr[":"] = jQuery.expr.filters;
  3702. jQuery.unique = Sizzle.uniqueSort;
  3703. jQuery.text = Sizzle.getText;
  3704. jQuery.isXMLDoc = Sizzle.isXML;
  3705. jQuery.contains = Sizzle.contains;
  3706. })();
  3707. var runtil = /Until$/,
  3708. rparentsprev = /^(?:parents|prevUntil|prevAll)/,
  3709. // Note: This RegExp should be improved, or likely pulled from Sizzle
  3710. rmultiselector = /,/,
  3711. isSimple = /^.[^:#\[\.,]*$/,
  3712. slice = Array.prototype.slice,
  3713. POS = jQuery.expr.match.POS,
  3714. // methods guaranteed to produce a unique set when starting from a unique set
  3715. guaranteedUnique = {
  3716. children: true,
  3717. contents: true,
  3718. next: true,
  3719. prev: true
  3720. };
  3721. jQuery.fn.extend({
  3722. find: function( selector ) {
  3723. var ret = this.pushStack( "", "find", selector ),
  3724. length = 0;
  3725. for ( var i = 0, l = this.length; i < l; i++ ) {
  3726. length = ret.length;
  3727. jQuery.find( selector, this[i], ret );
  3728. if ( i > 0 ) {
  3729. // Make sure that the results are unique
  3730. for ( var n = length; n < ret.length; n++ ) {
  3731. for ( var r = 0; r < length; r++ ) {
  3732. if ( ret[r] === ret[n] ) {
  3733. ret.splice(n--, 1);
  3734. break;
  3735. }
  3736. }
  3737. }
  3738. }
  3739. }
  3740. return ret;
  3741. },
  3742. has: function( target ) {
  3743. var targets = jQuery( target );
  3744. return this.filter(function() {
  3745. for ( var i = 0, l = targets.length; i < l; i++ ) {
  3746. if ( jQuery.contains( this, targets[i] ) ) {
  3747. return true;
  3748. }
  3749. }
  3750. });
  3751. },
  3752. not: function( selector ) {
  3753. return this.pushStack( winnow(this, selector, false), "not", selector);
  3754. },
  3755. filter: function( selector ) {
  3756. return this.pushStack( winnow(this, selector, true), "filter", selector );
  3757. },
  3758. is: function( selector ) {
  3759. return !!selector && jQuery.filter( selector, this ).length > 0;
  3760. },
  3761. closest: function( selectors, context ) {
  3762. var ret = [], i, l, cur = this[0];
  3763. if ( jQuery.isArray( selectors ) ) {
  3764. var match, selector,
  3765. matches = {},
  3766. level = 1;
  3767. if ( cur && selectors.length ) {
  3768. for ( i = 0, l = selectors.length; i < l; i++ ) {
  3769. selector = selectors[i];
  3770. if ( !matches[selector] ) {
  3771. matches[selector] = jQuery.expr.match.POS.test( selector ) ?
  3772. jQuery( selector, context || this.context ) :
  3773. selector;
  3774. }
  3775. }
  3776. while ( cur && cur.ownerDocument && cur !== context ) {
  3777. for ( selector in matches ) {
  3778. match = matches[selector];
  3779. if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {
  3780. ret.push({ selector: selector, elem: cur, level: level });
  3781. }
  3782. }
  3783. cur = cur.parentNode;
  3784. level++;
  3785. }
  3786. }
  3787. return ret;
  3788. }
  3789. var pos = POS.test( selectors ) ?
  3790. jQuery( selectors, context || this.context ) : null;
  3791. for ( i = 0, l = this.length; i < l; i++ ) {
  3792. cur = this[i];
  3793. while ( cur ) {
  3794. if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
  3795. ret.push( cur );
  3796. break;
  3797. } else {
  3798. cur = cur.parentNode;
  3799. if ( !cur || !cur.ownerDocument || cur === context ) {
  3800. break;
  3801. }
  3802. }
  3803. }
  3804. }
  3805. ret = ret.length > 1 ? jQuery.unique(ret) : ret;
  3806. return this.pushStack( ret, "closest", selectors );
  3807. },
  3808. // Determine the position of an element within
  3809. // the matched set of elements
  3810. index: function( elem ) {
  3811. if ( !elem || typeof elem === "string" ) {
  3812. return jQuery.inArray( this[0],
  3813. // If it receives a string, the selector is used
  3814. // If it receives nothing, the siblings are used
  3815. elem ? jQuery( elem ) : this.parent().children() );
  3816. }
  3817. // Locate the position of the desired element
  3818. return jQuery.inArray(
  3819. // If it receives a jQuery object, the first element is used
  3820. elem.jquery ? elem[0] : elem, this );
  3821. },
  3822. add: function( selector, context ) {
  3823. var set = typeof selector === "string" ?
  3824. jQuery( selector, context ) :
  3825. jQuery.makeArray( selector ),
  3826. all = jQuery.merge( this.get(), set );
  3827. return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
  3828. all :
  3829. jQuery.unique( all ) );
  3830. },
  3831. andSelf: function() {
  3832. return this.add( this.prevObject );
  3833. }
  3834. });
  3835. // A painfully simple check to see if an element is disconnected
  3836. // from a document (should be improved, where feasible).
  3837. function isDisconnected( node ) {
  3838. return !node || !node.parentNode || node.parentNode.nodeType === 11;
  3839. }
  3840. jQuery.each({
  3841. parent: function( elem ) {
  3842. var parent = elem.parentNode;
  3843. return parent && parent.nodeType !== 11 ? parent : null;
  3844. },
  3845. parents: function( elem ) {
  3846. return jQuery.dir( elem, "parentNode" );
  3847. },
  3848. parentsUntil: function( elem, i, until ) {
  3849. return jQuery.dir( elem, "parentNode", until );
  3850. },
  3851. next: function( elem ) {
  3852. return jQuery.nth( elem, 2, "nextSibling" );
  3853. },
  3854. prev: function( elem ) {
  3855. return jQuery.nth( elem, 2, "previousSibling" );
  3856. },
  3857. nextAll: function( elem ) {
  3858. return jQuery.dir( elem, "nextSibling" );
  3859. },
  3860. prevAll: function( elem ) {
  3861. return jQuery.dir( elem, "previousSibling" );
  3862. },
  3863. nextUntil: function( elem, i, until ) {
  3864. return jQuery.dir( elem, "nextSibling", until );
  3865. },
  3866. prevUntil: function( elem, i, until ) {
  3867. return jQuery.dir( elem, "previousSibling", until );
  3868. },
  3869. siblings: function( elem ) {
  3870. return jQuery.sibling( elem.parentNode.firstChild, elem );
  3871. },
  3872. children: function( elem ) {
  3873. return jQuery.sibling( elem.firstChild );
  3874. },
  3875. contents: function( elem ) {
  3876. return jQuery.nodeName( elem, "iframe" ) ?
  3877. elem.contentDocument || elem.contentWindow.document :
  3878. jQuery.makeArray( elem.childNodes );
  3879. }
  3880. }, function( name, fn ) {
  3881. jQuery.fn[ name ] = function( until, selector ) {
  3882. var ret = jQuery.map( this, fn, until ),
  3883. // The variable 'args' was introduced in
  3884. // https://github.com/jquery/jquery/commit/52a0238
  3885. // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
  3886. // http://code.google.com/p/v8/issues/detail?id=1050
  3887. args = slice.call(arguments);
  3888. if ( !runtil.test( name ) ) {
  3889. selector = until;
  3890. }
  3891. if ( selector && typeof selector === "string" ) {
  3892. ret = jQuery.filter( selector, ret );
  3893. }
  3894. ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
  3895. if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
  3896. ret = ret.reverse();
  3897. }
  3898. return this.pushStack( ret, name, args.join(",") );
  3899. };
  3900. });
  3901. jQuery.extend({
  3902. filter: function( expr, elems, not ) {
  3903. if ( not ) {
  3904. expr = ":not(" + expr + ")";
  3905. }
  3906. return elems.length === 1 ?
  3907. jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
  3908. jQuery.find.matches(expr, elems);
  3909. },
  3910. dir: function( elem, dir, until ) {
  3911. var matched = [],
  3912. cur = elem[ dir ];
  3913. while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
  3914. if ( cur.nodeType === 1 ) {
  3915. matched.push( cur );
  3916. }
  3917. cur = cur[dir];
  3918. }
  3919. return matched;
  3920. },
  3921. nth: function( cur, result, dir, elem ) {
  3922. result = result || 1;
  3923. var num = 0;
  3924. for ( ; cur; cur = cur[dir] ) {
  3925. if ( cur.nodeType === 1 && ++num === result ) {
  3926. break;
  3927. }
  3928. }
  3929. return cur;
  3930. },
  3931. sibling: function( n, elem ) {
  3932. var r = [];
  3933. for ( ; n; n = n.nextSibling ) {
  3934. if ( n.nodeType === 1 && n !== elem ) {
  3935. r.push( n );
  3936. }
  3937. }
  3938. return r;
  3939. }
  3940. });
  3941. // Implement the identical functionality for filter and not
  3942. function winnow( elements, qualifier, keep ) {
  3943. if ( jQuery.isFunction( qualifier ) ) {
  3944. return jQuery.grep(elements, function( elem, i ) {
  3945. var retVal = !!qualifier.call( elem, i, elem );
  3946. return retVal === keep;
  3947. });
  3948. } else if ( qualifier.nodeType ) {
  3949. return jQuery.grep(elements, function( elem, i ) {
  3950. return (elem === qualifier) === keep;
  3951. });
  3952. } else if ( typeof qualifier === "string" ) {
  3953. var filtered = jQuery.grep(elements, function( elem ) {
  3954. return elem.nodeType === 1;
  3955. });
  3956. if ( isSimple.test( qualifier ) ) {
  3957. return jQuery.filter(qualifier, filtered, !keep);
  3958. } else {
  3959. qualifier = jQuery.filter( qualifier, filtered );
  3960. }
  3961. }
  3962. return jQuery.grep(elements, function( elem, i ) {
  3963. return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
  3964. });
  3965. }
  3966. var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
  3967. rleadingWhitespace = /^\s+/,
  3968. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
  3969. rtagName = /<([\w:]+)/,
  3970. rtbody = /<tbody/i,
  3971. rhtml = /<|&#?\w+;/,
  3972. rnocache = /<(?:script|object|embed|option|style)/i,
  3973. // checked="checked" or checked (html5)
  3974. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  3975. wrapMap = {
  3976. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  3977. legend: [ 1, "<fieldset>", "</fieldset>" ],
  3978. thead: [ 1, "<table>", "</table>" ],
  3979. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  3980. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  3981. col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
  3982. area: [ 1, "<map>", "</map>" ],
  3983. _default: [ 0, "", "" ]
  3984. };
  3985. wrapMap.optgroup = wrapMap.option;
  3986. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  3987. wrapMap.th = wrapMap.td;
  3988. // IE can't serialize <link> and <script> tags normally
  3989. if ( !jQuery.support.htmlSerialize ) {
  3990. wrapMap._default = [ 1, "div<div>", "</div>" ];
  3991. }
  3992. jQuery.fn.extend({
  3993. text: function( text ) {
  3994. if ( jQuery.isFunction(text) ) {
  3995. return this.each(function(i) {
  3996. var self = jQuery( this );
  3997. self.text( text.call(this, i, self.text()) );
  3998. });
  3999. }
  4000. if ( typeof text !== "object" && text !== undefined ) {
  4001. return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
  4002. }
  4003. return jQuery.text( this );
  4004. },
  4005. wrapAll: function( html ) {
  4006. if ( jQuery.isFunction( html ) ) {
  4007. return this.each(function(i) {
  4008. jQuery(this).wrapAll( html.call(this, i) );
  4009. });
  4010. }
  4011. if ( this[0] ) {
  4012. // The elements to wrap the target around
  4013. var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
  4014. if ( this[0].parentNode ) {
  4015. wrap.insertBefore( this[0] );
  4016. }
  4017. wrap.map(function() {
  4018. var elem = this;
  4019. while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
  4020. elem = elem.firstChild;
  4021. }
  4022. return elem;
  4023. }).append(this);
  4024. }
  4025. return this;
  4026. },
  4027. wrapInner: function( html ) {
  4028. if ( jQuery.isFunction( html ) ) {
  4029. return this.each(function(i) {
  4030. jQuery(this).wrapInner( html.call(this, i) );
  4031. });
  4032. }
  4033. return this.each(function() {
  4034. var self = jQuery( this ),
  4035. contents = self.contents();
  4036. if ( contents.length ) {
  4037. contents.wrapAll( html );
  4038. } else {
  4039. self.append( html );
  4040. }
  4041. });
  4042. },
  4043. wrap: function( html ) {
  4044. return this.each(function() {
  4045. jQuery( this ).wrapAll( html );
  4046. });
  4047. },
  4048. unwrap: function() {
  4049. return this.parent().each(function() {
  4050. if ( !jQuery.nodeName( this, "body" ) ) {
  4051. jQuery( this ).replaceWith( this.childNodes );
  4052. }
  4053. }).end();
  4054. },
  4055. append: function() {
  4056. return this.domManip(arguments, true, function( elem ) {
  4057. if ( this.nodeType === 1 ) {
  4058. this.appendChild( elem );
  4059. }
  4060. });
  4061. },
  4062. prepend: function() {
  4063. return this.domManip(arguments, true, function( elem ) {
  4064. if ( this.nodeType === 1 ) {
  4065. this.insertBefore( elem, this.firstChild );
  4066. }
  4067. });
  4068. },
  4069. before: function() {
  4070. if ( this[0] && this[0].parentNode ) {
  4071. return this.domManip(arguments, false, function( elem ) {
  4072. this.parentNode.insertBefore( elem, this );
  4073. });
  4074. } else if ( arguments.length ) {
  4075. var set = jQuery(arguments[0]);
  4076. set.push.apply( set, this.toArray() );
  4077. return this.pushStack( set, "before", arguments );
  4078. }
  4079. },
  4080. after: function() {
  4081. if ( this[0] && this[0].parentNode ) {
  4082. return this.domManip(arguments, false, function( elem ) {
  4083. this.parentNode.insertBefore( elem, this.nextSibling );
  4084. });
  4085. } else if ( arguments.length ) {
  4086. var set = this.pushStack( this, "after", arguments );
  4087. set.push.apply( set, jQuery(arguments[0]).toArray() );
  4088. return set;
  4089. }
  4090. },
  4091. // keepData is for internal use only--do not document
  4092. remove: function( selector, keepData ) {
  4093. for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
  4094. if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
  4095. if ( !keepData && elem.nodeType === 1 ) {
  4096. jQuery.cleanData( elem.getElementsByTagName("*") );
  4097. jQuery.cleanData( [ elem ] );
  4098. }
  4099. if ( elem.parentNode ) {
  4100. elem.parentNode.removeChild( elem );
  4101. }
  4102. }
  4103. }
  4104. return this;
  4105. },
  4106. empty: function() {
  4107. for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
  4108. // Remove element nodes and prevent memory leaks
  4109. if ( elem.nodeType === 1 ) {
  4110. jQuery.cleanData( elem.getElementsByTagName("*") );
  4111. }
  4112. // Remove any remaining nodes
  4113. while ( elem.firstChild ) {
  4114. elem.removeChild( elem.firstChild );
  4115. }
  4116. }
  4117. return this;
  4118. },
  4119. clone: function( dataAndEvents, deepDataAndEvents ) {
  4120. dataAndEvents = dataAndEvents == null ? true : dataAndEvents;
  4121. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  4122. return this.map( function () {
  4123. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  4124. });
  4125. },
  4126. html: function( value ) {
  4127. if ( value === undefined ) {
  4128. return this[0] && this[0].nodeType === 1 ?
  4129. this[0].innerHTML.replace(rinlinejQuery, "") :
  4130. null;
  4131. // See if we can take a shortcut and just use innerHTML
  4132. } else if ( typeof value === "string" && !rnocache.test( value ) &&
  4133. (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
  4134. !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
  4135. value = value.replace(rxhtmlTag, "<$1></$2>");
  4136. try {
  4137. for ( var i = 0, l = this.length; i < l; i++ ) {
  4138. // Remove element nodes and prevent memory leaks
  4139. if ( this[i].nodeType === 1 ) {
  4140. jQuery.cleanData( this[i].getElementsByTagName("*") );
  4141. this[i].innerHTML = value;
  4142. }
  4143. }
  4144. // If using innerHTML throws an exception, use the fallback method
  4145. } catch(e) {
  4146. this.empty().append( value );
  4147. }
  4148. } else if ( jQuery.isFunction( value ) ) {
  4149. this.each(function(i){
  4150. var self = jQuery( this );
  4151. self.html( value.call(this, i, self.html()) );
  4152. });
  4153. } else {
  4154. this.empty().append( value );
  4155. }
  4156. return this;
  4157. },
  4158. replaceWith: function( value ) {
  4159. if ( this[0] && this[0].parentNode ) {
  4160. // Make sure that the elements are removed from the DOM before they are inserted
  4161. // this can help fix replacing a parent with child elements
  4162. if ( jQuery.isFunction( value ) ) {
  4163. return this.each(function(i) {
  4164. var self = jQuery(this), old = self.html();
  4165. self.replaceWith( value.call( this, i, old ) );
  4166. });
  4167. }
  4168. if ( typeof value !== "string" ) {
  4169. value = jQuery( value ).detach();
  4170. }
  4171. return this.each(function() {
  4172. var next = this.nextSibling,
  4173. parent = this.parentNode;
  4174. jQuery( this ).remove();
  4175. if ( next ) {
  4176. jQuery(next).before( value );
  4177. } else {
  4178. jQuery(parent).append( value );
  4179. }
  4180. });
  4181. } else {
  4182. return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );
  4183. }
  4184. },
  4185. detach: function( selector ) {
  4186. return this.remove( selector, true );
  4187. },
  4188. domManip: function( args, table, callback ) {
  4189. var results, first, fragment, parent,
  4190. value = args[0],
  4191. scripts = [];
  4192. // We can't cloneNode fragments that contain checked, in WebKit
  4193. if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
  4194. return this.each(function() {
  4195. jQuery(this).domManip( args, table, callback, true );
  4196. });
  4197. }
  4198. if ( jQuery.isFunction(value) ) {
  4199. return this.each(function(i) {
  4200. var self = jQuery(this);
  4201. args[0] = value.call(this, i, table ? self.html() : undefined);
  4202. self.domManip( args, table, callback );
  4203. });
  4204. }
  4205. if ( this[0] ) {
  4206. parent = value && value.parentNode;
  4207. // If we're in a fragment, just use that instead of building a new one
  4208. if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
  4209. results = { fragment: parent };
  4210. } else {
  4211. results = jQuery.buildFragment( args, this, scripts );
  4212. }
  4213. fragment = results.fragment;
  4214. if ( fragment.childNodes.length === 1 ) {
  4215. first = fragment = fragment.firstChild;
  4216. } else {
  4217. first = fragment.firstChild;
  4218. }
  4219. if ( first ) {
  4220. table = table && jQuery.nodeName( first, "tr" );
  4221. for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
  4222. callback.call(
  4223. table ?
  4224. root(this[i], first) :
  4225. this[i],
  4226. // Make sure that we do not leak memory by inadvertently discarding
  4227. // the original fragment (which might have attached data) instead of
  4228. // using it; in addition, use the original fragment object for the last
  4229. // item instead of first because it can end up being emptied incorrectly
  4230. // in certain situations (Bug #8070).
  4231. // Fragments from the fragment cache must always be cloned and never used
  4232. // in place.
  4233. results.cacheable || (l > 1 && i < lastIndex) ?
  4234. jQuery.clone( fragment, true, true ) :
  4235. fragment
  4236. );
  4237. }
  4238. }
  4239. if ( scripts.length ) {
  4240. jQuery.each( scripts, evalScript );
  4241. }
  4242. }
  4243. return this;
  4244. }
  4245. });
  4246. function root( elem, cur ) {
  4247. return jQuery.nodeName(elem, "table") ?
  4248. (elem.getElementsByTagName("tbody")[0] ||
  4249. elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
  4250. elem;
  4251. }
  4252. function cloneCopyEvent( src, dest ) {
  4253. if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
  4254. return;
  4255. }
  4256. var internalKey = jQuery.expando,
  4257. oldData = jQuery.data( src ),
  4258. curData = jQuery.data( dest, oldData );
  4259. // Switch to use the internal data object, if it exists, for the next
  4260. // stage of data copying
  4261. if ( (oldData = oldData[ internalKey ]) ) {
  4262. var events = oldData.events;
  4263. curData = curData[ internalKey ] = jQuery.extend({}, oldData);
  4264. if ( events ) {
  4265. delete curData.handle;
  4266. curData.events = {};
  4267. for ( var type in events ) {
  4268. for ( var i = 0, l = events[ type ].length; i < l; i++ ) {
  4269. jQuery.event.add( dest, type, events[ type ][ i ], events[ type ][ i ].data );
  4270. }
  4271. }
  4272. }
  4273. }
  4274. }
  4275. function cloneFixAttributes(src, dest) {
  4276. // We do not need to do anything for non-Elements
  4277. if ( dest.nodeType !== 1 ) {
  4278. return;
  4279. }
  4280. var nodeName = dest.nodeName.toLowerCase();
  4281. // clearAttributes removes the attributes, which we don't want,
  4282. // but also removes the attachEvent events, which we *do* want
  4283. dest.clearAttributes();
  4284. // mergeAttributes, in contrast, only merges back on the
  4285. // original attributes, not the events
  4286. dest.mergeAttributes(src);
  4287. // IE6-8 fail to clone children inside object elements that use
  4288. // the proprietary classid attribute value (rather than the type
  4289. // attribute) to identify the type of content to display
  4290. if ( nodeName === "object" ) {
  4291. dest.outerHTML = src.outerHTML;
  4292. } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
  4293. // IE6-8 fails to persist the checked state of a cloned checkbox
  4294. // or radio button. Worse, IE6-7 fail to give the cloned element
  4295. // a checked appearance if the defaultChecked value isn't also set
  4296. if ( src.checked ) {
  4297. dest.defaultChecked = dest.checked = src.checked;
  4298. }
  4299. // IE6-7 get confused and end up setting the value of a cloned
  4300. // checkbox/radio button to an empty string instead of "on"
  4301. if ( dest.value !== src.value ) {
  4302. dest.value = src.value;
  4303. }
  4304. // IE6-8 fails to return the selected option to the default selected
  4305. // state when cloning options
  4306. } else if ( nodeName === "option" ) {
  4307. dest.selected = src.defaultSelected;
  4308. // IE6-8 fails to set the defaultValue to the correct value when
  4309. // cloning other types of input fields
  4310. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  4311. dest.defaultValue = src.defaultValue;
  4312. }
  4313. // Event data gets referenced instead of copied if the expando
  4314. // gets copied too
  4315. dest.removeAttribute( jQuery.expando );
  4316. }
  4317. function getAll( elem ) {
  4318. if ( "getElementsByTagName" in elem ) {
  4319. return elem.getElementsByTagName( "*" );
  4320. } else if ( "querySelectorAll" in elem ) {
  4321. return elem.querySelectorAll( "*" );
  4322. } else {
  4323. return [];
  4324. }
  4325. }
  4326. jQuery.buildFragment = function( args, nodes, scripts ) {
  4327. var fragment, cacheable, cacheresults,
  4328. doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
  4329. // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
  4330. // Cloning options loses the selected state, so don't cache them
  4331. // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
  4332. // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
  4333. if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
  4334. args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
  4335. cacheable = true;
  4336. cacheresults = jQuery.fragments[ args[0] ];
  4337. if ( cacheresults ) {
  4338. if ( cacheresults !== 1 ) {
  4339. fragment = cacheresults;
  4340. }
  4341. }
  4342. }
  4343. if ( !fragment ) {
  4344. fragment = doc.createDocumentFragment();
  4345. jQuery.clean( args, doc, fragment, scripts );
  4346. }
  4347. if ( cacheable ) {
  4348. jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;
  4349. }
  4350. return { fragment: fragment, cacheable: cacheable };
  4351. };
  4352. jQuery.fragments = {};
  4353. jQuery.each({
  4354. appendTo: "append",
  4355. prependTo: "prepend",
  4356. insertBefore: "before",
  4357. insertAfter: "after",
  4358. replaceAll: "replaceWith"
  4359. }, function( name, original ) {
  4360. jQuery.fn[ name ] = function( selector ) {
  4361. var ret = [],
  4362. insert = jQuery( selector ),
  4363. parent = this.length === 1 && this[0].parentNode;
  4364. if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
  4365. insert[ original ]( this[0] );
  4366. return this;
  4367. } else {
  4368. for ( var i = 0, l = insert.length; i < l; i++ ) {
  4369. var elems = (i > 0 ? this.clone(true) : this).get();
  4370. jQuery( insert[i] )[ original ]( elems );
  4371. ret = ret.concat( elems );
  4372. }
  4373. return this.pushStack( ret, name, insert.selector );
  4374. }
  4375. };
  4376. });
  4377. jQuery.extend({
  4378. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  4379. var clone = elem.cloneNode(true),
  4380. srcElements,
  4381. destElements,
  4382. i;
  4383. if ( !jQuery.support.noCloneEvent && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
  4384. // IE copies events bound via attachEvent when using cloneNode.
  4385. // Calling detachEvent on the clone will also remove the events
  4386. // from the original. In order to get around this, we use some
  4387. // proprietary methods to clear the events. Thanks to MooTools
  4388. // guys for this hotness.
  4389. // Using Sizzle here is crazy slow, so we use getElementsByTagName
  4390. // instead
  4391. srcElements = getAll(elem);
  4392. destElements = getAll(clone);
  4393. // Weird iteration because IE will replace the length property
  4394. // with an element if you are cloning the body and one of the
  4395. // elements on the page has a name or id of "length"
  4396. for ( i = 0; srcElements[i]; ++i ) {
  4397. cloneFixAttributes( srcElements[i], destElements[i] );
  4398. }
  4399. cloneFixAttributes( elem, clone );
  4400. }
  4401. // Copy the events from the original to the clone
  4402. if ( dataAndEvents ) {
  4403. cloneCopyEvent( elem, clone );
  4404. if ( deepDataAndEvents && "getElementsByTagName" in elem ) {
  4405. srcElements =getAll(elem);
  4406. destElements = getAll(clone);
  4407. if ( srcElements.length ) {
  4408. for ( i = 0; srcElements[i]; ++i ) {
  4409. cloneCopyEvent( srcElements[i], destElements[i] );
  4410. }
  4411. }
  4412. }
  4413. }
  4414. // Return the cloned set
  4415. return clone;
  4416. },
  4417. clean: function( elems, context, fragment, scripts ) {
  4418. context = context || document;
  4419. // !context.createElement fails in IE with an error but returns typeof 'object'
  4420. if ( typeof context.createElement === "undefined" ) {
  4421. context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
  4422. }
  4423. var ret = [];
  4424. for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
  4425. if ( typeof elem === "number" ) {
  4426. elem += "";
  4427. }
  4428. if ( !elem ) {
  4429. continue;
  4430. }
  4431. // Convert html string into DOM nodes
  4432. if ( typeof elem === "string" && !rhtml.test( elem ) ) {
  4433. elem = context.createTextNode( elem );
  4434. } else if ( typeof elem === "string" ) {
  4435. // Fix "XHTML"-style tags in all browsers
  4436. elem = elem.replace(rxhtmlTag, "<$1></$2>");
  4437. // Trim whitespace, otherwise indexOf won't work as expected
  4438. var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
  4439. wrap = wrapMap[ tag ] || wrapMap._default,
  4440. depth = wrap[0],
  4441. div = context.createElement("div");
  4442. // Go to html and back, then peel off extra wrappers
  4443. div.innerHTML = wrap[1] + elem + wrap[2];
  4444. // Move to the right depth
  4445. while ( depth-- ) {
  4446. div = div.lastChild;
  4447. }
  4448. // Remove IE's autoinserted <tbody> from table fragments
  4449. if ( !jQuery.support.tbody ) {
  4450. // String was a <table>, *may* have spurious <tbody>
  4451. var hasBody = rtbody.test(elem),
  4452. tbody = tag === "table" && !hasBody ?
  4453. div.firstChild && div.firstChild.childNodes :
  4454. // String was a bare <thead> or <tfoot>
  4455. wrap[1] === "<table>" && !hasBody ?
  4456. div.childNodes :
  4457. [];
  4458. for ( var j = tbody.length - 1; j >= 0 ; --j ) {
  4459. if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
  4460. tbody[ j ].parentNode.removeChild( tbody[ j ] );
  4461. }
  4462. }
  4463. }
  4464. // IE completely kills leading whitespace when innerHTML is used
  4465. if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
  4466. div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
  4467. }
  4468. elem = div.childNodes;
  4469. }
  4470. if ( elem.nodeType ) {
  4471. ret.push( elem );
  4472. } else {
  4473. ret = jQuery.merge( ret, elem );
  4474. }
  4475. }
  4476. if ( fragment ) {
  4477. for ( i = 0; ret[i]; i++ ) {
  4478. if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
  4479. scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
  4480. } else {
  4481. if ( ret[i].nodeType === 1 ) {
  4482. ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
  4483. }
  4484. fragment.appendChild( ret[i] );
  4485. }
  4486. }
  4487. }
  4488. return ret;
  4489. },
  4490. cleanData: function( elems ) {
  4491. var data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special,
  4492. deleteExpando = jQuery.support.deleteExpando;
  4493. for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
  4494. if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
  4495. continue;
  4496. }
  4497. id = elem[ jQuery.expando ];
  4498. if ( id ) {
  4499. data = cache[ id ] && cache[ id ][ internalKey ];
  4500. if ( data && data.events ) {
  4501. for ( var type in data.events ) {
  4502. if ( special[ type ] ) {
  4503. jQuery.event.remove( elem, type );
  4504. // This is a shortcut to avoid jQuery.event.remove's overhead
  4505. } else {
  4506. jQuery.removeEvent( elem, type, data.handle );
  4507. }
  4508. }
  4509. // Null the DOM reference to avoid IE6/7/8 leak (#7054)
  4510. if ( data.handle ) {
  4511. data.handle.elem = null;
  4512. }
  4513. }
  4514. if ( deleteExpando ) {
  4515. delete elem[ jQuery.expando ];
  4516. } else if ( elem.removeAttribute ) {
  4517. elem.removeAttribute( jQuery.expando );
  4518. }
  4519. delete cache[ id ];
  4520. }
  4521. }
  4522. }
  4523. });
  4524. function evalScript( i, elem ) {
  4525. if ( elem.src ) {
  4526. jQuery.ajax({
  4527. url: elem.src,
  4528. async: false,
  4529. dataType: "script"
  4530. });
  4531. } else {
  4532. jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
  4533. }
  4534. if ( elem.parentNode ) {
  4535. elem.parentNode.removeChild( elem );
  4536. }
  4537. }
  4538. var ralpha = /alpha\([^)]*\)/i,
  4539. ropacity = /opacity=([^)]*)/,
  4540. rdashAlpha = /-([a-z])/ig,
  4541. rupper = /([A-Z])/g,
  4542. rnumpx = /^-?\d+(?:px)?$/i,
  4543. rnum = /^-?\d/,
  4544. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  4545. cssWidth = [ "Left", "Right" ],
  4546. cssHeight = [ "Top", "Bottom" ],
  4547. curCSS,
  4548. getComputedStyle,
  4549. currentStyle,
  4550. fcamelCase = function( all, letter ) {
  4551. return letter.toUpperCase();
  4552. };
  4553. jQuery.fn.css = function( name, value ) {
  4554. // Setting 'undefined' is a no-op
  4555. if ( arguments.length === 2 && value === undefined ) {
  4556. return this;
  4557. }
  4558. return jQuery.access( this, name, value, true, function( elem, name, value ) {
  4559. return value !== undefined ?
  4560. jQuery.style( elem, name, value ) :
  4561. jQuery.css( elem, name );
  4562. });
  4563. };
  4564. jQuery.extend({
  4565. // Add in style property hooks for overriding the default
  4566. // behavior of getting and setting a style property
  4567. cssHooks: {
  4568. opacity: {
  4569. get: function( elem, computed ) {
  4570. if ( computed ) {
  4571. // We should always get a number back from opacity
  4572. var ret = curCSS( elem, "opacity", "opacity" );
  4573. return ret === "" ? "1" : ret;
  4574. } else {
  4575. return elem.style.opacity;
  4576. }
  4577. }
  4578. }
  4579. },
  4580. // Exclude the following css properties to add px
  4581. cssNumber: {
  4582. "zIndex": true,
  4583. "fontWeight": true,
  4584. "opacity": true,
  4585. "zoom": true,
  4586. "lineHeight": true
  4587. },
  4588. // Add in properties whose names you wish to fix before
  4589. // setting or getting the value
  4590. cssProps: {
  4591. // normalize float css property
  4592. "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
  4593. },
  4594. // Get and set the style property on a DOM Node
  4595. style: function( elem, name, value, extra ) {
  4596. // Don't set styles on text and comment nodes
  4597. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  4598. return;
  4599. }
  4600. // Make sure that we're working with the right name
  4601. var ret, origName = jQuery.camelCase( name ),
  4602. style = elem.style, hooks = jQuery.cssHooks[ origName ];
  4603. name = jQuery.cssProps[ origName ] || origName;
  4604. // Check if we're setting a value
  4605. if ( value !== undefined ) {
  4606. // Make sure that NaN and null values aren't set. See: #7116
  4607. if ( typeof value === "number" && isNaN( value ) || value == null ) {
  4608. return;
  4609. }
  4610. // If a number was passed in, add 'px' to the (except for certain CSS properties)
  4611. if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) {
  4612. value += "px";
  4613. }
  4614. // If a hook was provided, use that value, otherwise just set the specified value
  4615. if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
  4616. // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
  4617. // Fixes bug #5509
  4618. try {
  4619. style[ name ] = value;
  4620. } catch(e) {}
  4621. }
  4622. } else {
  4623. // If a hook was provided get the non-computed value from there
  4624. if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
  4625. return ret;
  4626. }
  4627. // Otherwise just get the value from the style object
  4628. return style[ name ];
  4629. }
  4630. },
  4631. css: function( elem, name, extra ) {
  4632. // Make sure that we're working with the right name
  4633. var ret, origName = jQuery.camelCase( name ),
  4634. hooks = jQuery.cssHooks[ origName ];
  4635. name = jQuery.cssProps[ origName ] || origName;
  4636. // If a hook was provided get the computed value from there
  4637. if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
  4638. return ret;
  4639. // Otherwise, if a way to get the computed value exists, use that
  4640. } else if ( curCSS ) {
  4641. return curCSS( elem, name, origName );
  4642. }
  4643. },
  4644. // A method for quickly swapping in/out CSS properties to get correct calculations
  4645. swap: function( elem, options, callback ) {
  4646. var old = {};
  4647. // Remember the old values, and insert the new ones
  4648. for ( var name in options ) {
  4649. old[ name ] = elem.style[ name ];
  4650. elem.style[ name ] = options[ name ];
  4651. }
  4652. callback.call( elem );
  4653. // Revert the old values
  4654. for ( name in options ) {
  4655. elem.style[ name ] = old[ name ];
  4656. }
  4657. },
  4658. camelCase: function( string ) {
  4659. return string.replace( rdashAlpha, fcamelCase );
  4660. }
  4661. });
  4662. // DEPRECATED, Use jQuery.css() instead
  4663. jQuery.curCSS = jQuery.css;
  4664. jQuery.each(["height", "width"], function( i, name ) {
  4665. jQuery.cssHooks[ name ] = {
  4666. get: function( elem, computed, extra ) {
  4667. var val;
  4668. if ( computed ) {
  4669. if ( elem.offsetWidth !== 0 ) {
  4670. val = getWH( elem, name, extra );
  4671. } else {
  4672. jQuery.swap( elem, cssShow, function() {
  4673. val = getWH( elem, name, extra );
  4674. });
  4675. }
  4676. if ( val <= 0 ) {
  4677. val = curCSS( elem, name, name );
  4678. if ( val === "0px" && currentStyle ) {
  4679. val = currentStyle( elem, name, name );
  4680. }
  4681. if ( val != null ) {
  4682. // Should return "auto" instead of 0, use 0 for
  4683. // temporary backwards-compat
  4684. return val === "" || val === "auto" ? "0px" : val;
  4685. }
  4686. }
  4687. if ( val < 0 || val == null ) {
  4688. val = elem.style[ name ];
  4689. // Should return "auto" instead of 0, use 0 for
  4690. // temporary backwards-compat
  4691. return val === "" || val === "auto" ? "0px" : val;
  4692. }
  4693. return typeof val === "string" ? val : val + "px";
  4694. }
  4695. },
  4696. set: function( elem, value ) {
  4697. if ( rnumpx.test( value ) ) {
  4698. // ignore negative width and height values #1599
  4699. value = parseFloat(value);
  4700. if ( value >= 0 ) {
  4701. return value + "px";
  4702. }
  4703. } else {
  4704. return value;
  4705. }
  4706. }
  4707. };
  4708. });
  4709. if ( !jQuery.support.opacity ) {
  4710. jQuery.cssHooks.opacity = {
  4711. get: function( elem, computed ) {
  4712. // IE uses filters for opacity
  4713. return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?
  4714. (parseFloat(RegExp.$1) / 100) + "" :
  4715. computed ? "1" : "";
  4716. },
  4717. set: function( elem, value ) {
  4718. var style = elem.style;
  4719. // IE has trouble with opacity if it does not have layout
  4720. // Force it by setting the zoom level
  4721. style.zoom = 1;
  4722. // Set the alpha filter to set the opacity
  4723. var opacity = jQuery.isNaN(value) ?
  4724. "" :
  4725. "alpha(opacity=" + value * 100 + ")",
  4726. filter = style.filter || "";
  4727. style.filter = ralpha.test(filter) ?
  4728. filter.replace(ralpha, opacity) :
  4729. style.filter + ' ' + opacity;
  4730. }
  4731. };
  4732. }
  4733. if ( document.defaultView && document.defaultView.getComputedStyle ) {
  4734. getComputedStyle = function( elem, newName, name ) {
  4735. var ret, defaultView, computedStyle;
  4736. name = name.replace( rupper, "-$1" ).toLowerCase();
  4737. if ( !(defaultView = elem.ownerDocument.defaultView) ) {
  4738. return undefined;
  4739. }
  4740. if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
  4741. ret = computedStyle.getPropertyValue( name );
  4742. if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
  4743. ret = jQuery.style( elem, name );
  4744. }
  4745. }
  4746. return ret;
  4747. };
  4748. }
  4749. if ( document.documentElement.currentStyle ) {
  4750. currentStyle = function( elem, name ) {
  4751. var left,
  4752. ret = elem.currentStyle && elem.currentStyle[ name ],
  4753. rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ],
  4754. style = elem.style;
  4755. // From the awesome hack by Dean Edwards
  4756. // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  4757. // If we're not dealing with a regular pixel number
  4758. // but a number that has a weird ending, we need to convert it to pixels
  4759. if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
  4760. // Remember the original values
  4761. left = style.left;
  4762. // Put in the new values to get a computed value out
  4763. if ( rsLeft ) {
  4764. elem.runtimeStyle.left = elem.currentStyle.left;
  4765. }
  4766. style.left = name === "fontSize" ? "1em" : (ret || 0);
  4767. ret = style.pixelLeft + "px";
  4768. // Revert the changed values
  4769. style.left = left;
  4770. if ( rsLeft ) {
  4771. elem.runtimeStyle.left = rsLeft;
  4772. }
  4773. }
  4774. return ret === "" ? "auto" : ret;
  4775. };
  4776. }
  4777. curCSS = getComputedStyle || currentStyle;
  4778. function getWH( elem, name, extra ) {
  4779. var which = name === "width" ? cssWidth : cssHeight,
  4780. val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
  4781. if ( extra === "border" ) {
  4782. return val;
  4783. }
  4784. jQuery.each( which, function() {
  4785. if ( !extra ) {
  4786. val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
  4787. }
  4788. if ( extra === "margin" ) {
  4789. val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;
  4790. } else {
  4791. val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
  4792. }
  4793. });
  4794. return val;
  4795. }
  4796. if ( jQuery.expr && jQuery.expr.filters ) {
  4797. jQuery.expr.filters.hidden = function( elem ) {
  4798. var width = elem.offsetWidth,
  4799. height = elem.offsetHeight;
  4800. return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
  4801. };
  4802. jQuery.expr.filters.visible = function( elem ) {
  4803. return !jQuery.expr.filters.hidden( elem );
  4804. };
  4805. }
  4806. var r20 = /%20/g,
  4807. rbracket = /\[\]$/,
  4808. rCRLF = /\r?\n/g,
  4809. rhash = /#.*$/,
  4810. rheaders = /^(.*?):\s*(.*?)\r?$/mg, // IE leaves an \r character at EOL
  4811. rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
  4812. rnoContent = /^(?:GET|HEAD)$/,
  4813. rprotocol = /^\/\//,
  4814. rquery = /\?/,
  4815. rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
  4816. rselectTextarea = /^(?:select|textarea)/i,
  4817. rspacesAjax = /\s+/,
  4818. rts = /([?&])_=[^&]*/,
  4819. rurl = /^(\w+:)\/\/([^\/?#:]+)(?::(\d+))?/,
  4820. // Keep a copy of the old load method
  4821. _load = jQuery.fn.load,
  4822. /* Prefilters
  4823. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  4824. * 2) These are called:
  4825. * - BEFORE asking for a transport
  4826. * - AFTER param serialization (s.data is a string if s.processData is true)
  4827. * 3) key is the dataType
  4828. * 4) the catchall symbol "*" can be used
  4829. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  4830. */
  4831. prefilters = {},
  4832. /* Transports bindings
  4833. * 1) key is the dataType
  4834. * 2) the catchall symbol "*" can be used
  4835. * 3) selection will start with transport dataType and THEN go to "*" if needed
  4836. */
  4837. transports = {};
  4838. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  4839. function addToPrefiltersOrTransports( structure ) {
  4840. // dataTypeExpression is optional and defaults to "*"
  4841. return function( dataTypeExpression, func ) {
  4842. if ( typeof dataTypeExpression !== "string" ) {
  4843. func = dataTypeExpression;
  4844. dataTypeExpression = "*";
  4845. }
  4846. if ( jQuery.isFunction( func ) ) {
  4847. var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),
  4848. i = 0,
  4849. length = dataTypes.length,
  4850. dataType,
  4851. list,
  4852. placeBefore;
  4853. // For each dataType in the dataTypeExpression
  4854. for(; i < length; i++ ) {
  4855. dataType = dataTypes[ i ];
  4856. // We control if we're asked to add before
  4857. // any existing element
  4858. placeBefore = /^\+/.test( dataType );
  4859. if ( placeBefore ) {
  4860. dataType = dataType.substr( 1 ) || "*";
  4861. }
  4862. list = structure[ dataType ] = structure[ dataType ] || [];
  4863. // then we add to the structure accordingly
  4864. list[ placeBefore ? "unshift" : "push" ]( func );
  4865. }
  4866. }
  4867. };
  4868. }
  4869. //Base inspection function for prefilters and transports
  4870. function inspectPrefiltersOrTransports( structure, options, originalOptions, jXHR,
  4871. dataType /* internal */, inspected /* internal */ ) {
  4872. dataType = dataType || options.dataTypes[ 0 ];
  4873. inspected = inspected || {};
  4874. inspected[ dataType ] = true;
  4875. var list = structure[ dataType ],
  4876. i = 0,
  4877. length = list ? list.length : 0,
  4878. executeOnly = ( structure === prefilters ),
  4879. selection;
  4880. for(; i < length && ( executeOnly || !selection ); i++ ) {
  4881. selection = list[ i ]( options, originalOptions, jXHR );
  4882. // If we got redirected to another dataType
  4883. // we try there if not done already
  4884. if ( typeof selection === "string" ) {
  4885. if ( inspected[ selection ] ) {
  4886. selection = undefined;
  4887. } else {
  4888. options.dataTypes.unshift( selection );
  4889. selection = inspectPrefiltersOrTransports(
  4890. structure, options, originalOptions, jXHR, selection, inspected );
  4891. }
  4892. }
  4893. }
  4894. // If we're only executing or nothing was selected
  4895. // we try the catchall dataType if not done already
  4896. if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
  4897. selection = inspectPrefiltersOrTransports(
  4898. structure, options, originalOptions, jXHR, "*", inspected );
  4899. }
  4900. // unnecessary when only executing (prefilters)
  4901. // but it'll be ignored by the caller in that case
  4902. return selection;
  4903. }
  4904. jQuery.fn.extend({
  4905. load: function( url, params, callback ) {
  4906. if ( typeof url !== "string" && _load ) {
  4907. return _load.apply( this, arguments );
  4908. // Don't do a request if no elements are being requested
  4909. } else if ( !this.length ) {
  4910. return this;
  4911. }
  4912. var off = url.indexOf( " " );
  4913. if ( off >= 0 ) {
  4914. var selector = url.slice( off, url.length );
  4915. url = url.slice( 0, off );
  4916. }
  4917. // Default to a GET request
  4918. var type = "GET";
  4919. // If the second parameter was provided
  4920. if ( params ) {
  4921. // If it's a function
  4922. if ( jQuery.isFunction( params ) ) {
  4923. // We assume that it's the callback
  4924. callback = params;
  4925. params = null;
  4926. // Otherwise, build a param string
  4927. } else if ( typeof params === "object" ) {
  4928. params = jQuery.param( params, jQuery.ajaxSettings.traditional );
  4929. type = "POST";
  4930. }
  4931. }
  4932. var self = this;
  4933. // Request the remote document
  4934. jQuery.ajax({
  4935. url: url,
  4936. type: type,
  4937. dataType: "html",
  4938. data: params,
  4939. // Complete callback (responseText is used internally)
  4940. complete: function( jXHR, status, responseText ) {
  4941. // Store the response as specified by the jXHR object
  4942. responseText = jXHR.responseText;
  4943. // If successful, inject the HTML into all the matched elements
  4944. if ( jXHR.isResolved() ) {
  4945. // #4825: Get the actual response in case
  4946. // a dataFilter is present in ajaxSettings
  4947. jXHR.done(function( r ) {
  4948. responseText = r;
  4949. });
  4950. // See if a selector was specified
  4951. self.html( selector ?
  4952. // Create a dummy div to hold the results
  4953. jQuery("<div>")
  4954. // inject the contents of the document in, removing the scripts
  4955. // to avoid any 'Permission Denied' errors in IE
  4956. .append(responseText.replace(rscript, ""))
  4957. // Locate the specified elements
  4958. .find(selector) :
  4959. // If not, just inject the full result
  4960. responseText );
  4961. }
  4962. if ( callback ) {
  4963. self.each( callback, [ responseText, status, jXHR ] );
  4964. }
  4965. }
  4966. });
  4967. return this;
  4968. },
  4969. serialize: function() {
  4970. return jQuery.param( this.serializeArray() );
  4971. },
  4972. serializeArray: function() {
  4973. return this.map(function(){
  4974. return this.elements ? jQuery.makeArray( this.elements ) : this;
  4975. })
  4976. .filter(function(){
  4977. return this.name && !this.disabled &&
  4978. ( this.checked || rselectTextarea.test( this.nodeName ) ||
  4979. rinput.test( this.type ) );
  4980. })
  4981. .map(function( i, elem ){
  4982. var val = jQuery( this ).val();
  4983. return val == null ?
  4984. null :
  4985. jQuery.isArray( val ) ?
  4986. jQuery.map( val, function( val, i ){
  4987. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  4988. }) :
  4989. { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  4990. }).get();
  4991. }
  4992. });
  4993. // Attach a bunch of functions for handling common AJAX events
  4994. jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
  4995. jQuery.fn[ o ] = function( f ){
  4996. return this.bind( o, f );
  4997. };
  4998. } );
  4999. jQuery.each( [ "get", "post" ], function( i, method ) {
  5000. jQuery[ method ] = function( url, data, callback, type ) {
  5001. // shift arguments if data argument was omitted
  5002. if ( jQuery.isFunction( data ) ) {
  5003. type = type || callback;
  5004. callback = data;
  5005. data = null;
  5006. }
  5007. return jQuery.ajax({
  5008. type: method,
  5009. url: url,
  5010. data: data,
  5011. success: callback,
  5012. dataType: type
  5013. });
  5014. };
  5015. } );
  5016. jQuery.extend({
  5017. getScript: function( url, callback ) {
  5018. return jQuery.get( url, null, callback, "script" );
  5019. },
  5020. getJSON: function( url, data, callback ) {
  5021. return jQuery.get( url, data, callback, "json" );
  5022. },
  5023. ajaxSetup: function( settings ) {
  5024. jQuery.extend( true, jQuery.ajaxSettings, settings );
  5025. if ( settings.context ) {
  5026. jQuery.ajaxSettings.context = settings.context;
  5027. }
  5028. },
  5029. ajaxSettings: {
  5030. url: location.href,
  5031. global: true,
  5032. type: "GET",
  5033. contentType: "application/x-www-form-urlencoded",
  5034. processData: true,
  5035. async: true,
  5036. /*
  5037. timeout: 0,
  5038. data: null,
  5039. dataType: null,
  5040. username: null,
  5041. password: null,
  5042. cache: null,
  5043. traditional: false,
  5044. headers: {},
  5045. crossDomain: null,
  5046. */
  5047. accepts: {
  5048. xml: "application/xml, text/xml",
  5049. html: "text/html",
  5050. text: "text/plain",
  5051. json: "application/json, text/javascript",
  5052. "*": "*/*"
  5053. },
  5054. contents: {
  5055. xml: /xml/,
  5056. html: /html/,
  5057. json: /json/
  5058. },
  5059. responseFields: {
  5060. xml: "responseXML",
  5061. text: "responseText"
  5062. },
  5063. // List of data converters
  5064. // 1) key format is "source_type destination_type" (a single space in-between)
  5065. // 2) the catchall symbol "*" can be used for source_type
  5066. converters: {
  5067. // Convert anything to text
  5068. "* text": window.String,
  5069. // Text to html (true = no transformation)
  5070. "text html": true,
  5071. // Evaluate text as a json expression
  5072. "text json": jQuery.parseJSON,
  5073. // Parse text as xml
  5074. "text xml": jQuery.parseXML
  5075. }
  5076. },
  5077. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  5078. ajaxTransport: addToPrefiltersOrTransports( transports ),
  5079. // Main method
  5080. ajax: function( url, options ) {
  5081. // If options is not an object,
  5082. // we simulate pre-1.5 signature
  5083. if ( typeof options !== "object" ) {
  5084. options = url;
  5085. url = undefined;
  5086. }
  5087. // Force options to be an object
  5088. options = options || {};
  5089. var // Create the final options object
  5090. s = jQuery.extend( true, {}, jQuery.ajaxSettings, options ),
  5091. // Callbacks contexts
  5092. // We force the original context if it exists
  5093. // or take it from jQuery.ajaxSettings otherwise
  5094. // (plain objects used as context get extended)
  5095. callbackContext =
  5096. ( s.context = ( "context" in options ? options : jQuery.ajaxSettings ).context ) || s,
  5097. globalEventContext = callbackContext === s ? jQuery.event : jQuery( callbackContext ),
  5098. // Deferreds
  5099. deferred = jQuery.Deferred(),
  5100. completeDeferred = jQuery._Deferred(),
  5101. // Status-dependent callbacks
  5102. statusCode = s.statusCode || {},
  5103. // Headers (they are sent all at once)
  5104. requestHeaders = {},
  5105. // Response headers
  5106. responseHeadersString,
  5107. responseHeaders,
  5108. // transport
  5109. transport,
  5110. // timeout handle
  5111. timeoutTimer,
  5112. // Cross-domain detection vars
  5113. loc = document.location,
  5114. protocol = loc.protocol || "http:",
  5115. parts,
  5116. // The jXHR state
  5117. state = 0,
  5118. // Loop variable
  5119. i,
  5120. // Fake xhr
  5121. jXHR = {
  5122. readyState: 0,
  5123. // Caches the header
  5124. setRequestHeader: function( name, value ) {
  5125. if ( state === 0 ) {
  5126. requestHeaders[ name.toLowerCase() ] = value;
  5127. }
  5128. return this;
  5129. },
  5130. // Raw string
  5131. getAllResponseHeaders: function() {
  5132. return state === 2 ? responseHeadersString : null;
  5133. },
  5134. // Builds headers hashtable if needed
  5135. getResponseHeader: function( key ) {
  5136. var match;
  5137. if ( state === 2 ) {
  5138. if ( !responseHeaders ) {
  5139. responseHeaders = {};
  5140. while( ( match = rheaders.exec( responseHeadersString ) ) ) {
  5141. responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
  5142. }
  5143. }
  5144. match = responseHeaders[ key.toLowerCase() ];
  5145. }
  5146. return match || null;
  5147. },
  5148. // Cancel the request
  5149. abort: function( statusText ) {
  5150. statusText = statusText || "abort";
  5151. if ( transport ) {
  5152. transport.abort( statusText );
  5153. }
  5154. done( 0, statusText );
  5155. return this;
  5156. }
  5157. };
  5158. // Callback for when everything is done
  5159. // It is defined here because jslint complains if it is declared
  5160. // at the end of the function (which would be more logical and readable)
  5161. function done( status, statusText, responses, headers) {
  5162. // Called once
  5163. if ( state === 2 ) {
  5164. return;
  5165. }
  5166. // State is "done" now
  5167. state = 2;
  5168. // Clear timeout if it exists
  5169. if ( timeoutTimer ) {
  5170. clearTimeout( timeoutTimer );
  5171. }
  5172. // Dereference transport for early garbage collection
  5173. // (no matter how long the jXHR object will be used)
  5174. transport = undefined;
  5175. // Cache response headers
  5176. responseHeadersString = headers || "";
  5177. // Set readyState
  5178. jXHR.readyState = status ? 4 : 0;
  5179. var isSuccess,
  5180. success,
  5181. error,
  5182. response = responses ? ajaxHandleResponses( s, jXHR, responses ) : undefined,
  5183. lastModified,
  5184. etag;
  5185. // If successful, handle type chaining
  5186. if ( status >= 200 && status < 300 || status === 304 ) {
  5187. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  5188. if ( s.ifModified ) {
  5189. if ( ( lastModified = jXHR.getResponseHeader( "Last-Modified" ) ) ) {
  5190. jQuery.lastModified[ s.url ] = lastModified;
  5191. }
  5192. if ( ( etag = jXHR.getResponseHeader( "Etag" ) ) ) {
  5193. jQuery.etag[ s.url ] = etag;
  5194. }
  5195. }
  5196. // If not modified
  5197. if ( status === 304 ) {
  5198. statusText = "notmodified";
  5199. isSuccess = true;
  5200. // If we have data
  5201. } else {
  5202. try {
  5203. success = ajaxConvert( s, response );
  5204. statusText = "success";
  5205. isSuccess = true;
  5206. } catch(e) {
  5207. // We have a parsererror
  5208. statusText = "parsererror";
  5209. error = e;
  5210. }
  5211. }
  5212. } else {
  5213. // We extract error from statusText
  5214. // then normalize statusText and status for non-aborts
  5215. error = statusText;
  5216. if( status ) {
  5217. statusText = "error";
  5218. if ( status < 0 ) {
  5219. status = 0;
  5220. }
  5221. }
  5222. }
  5223. // Set data for the fake xhr object
  5224. jXHR.status = status;
  5225. jXHR.statusText = statusText;
  5226. // Success/Error
  5227. if ( isSuccess ) {
  5228. deferred.resolveWith( callbackContext, [ success, statusText, jXHR ] );
  5229. } else {
  5230. deferred.rejectWith( callbackContext, [ jXHR, statusText, error ] );
  5231. }
  5232. // Status-dependent callbacks
  5233. jXHR.statusCode( statusCode );
  5234. statusCode = undefined;
  5235. if ( s.global ) {
  5236. globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
  5237. [ jXHR, s, isSuccess ? success : error ] );
  5238. }
  5239. // Complete
  5240. completeDeferred.resolveWith( callbackContext, [ jXHR, statusText ] );
  5241. if ( s.global ) {
  5242. globalEventContext.trigger( "ajaxComplete", [ jXHR, s] );
  5243. // Handle the global AJAX counter
  5244. if ( !( --jQuery.active ) ) {
  5245. jQuery.event.trigger( "ajaxStop" );
  5246. }
  5247. }
  5248. }
  5249. // Attach deferreds
  5250. deferred.promise( jXHR );
  5251. jXHR.success = jXHR.done;
  5252. jXHR.error = jXHR.fail;
  5253. jXHR.complete = completeDeferred.done;
  5254. // Status-dependent callbacks
  5255. jXHR.statusCode = function( map ) {
  5256. if ( map ) {
  5257. var tmp;
  5258. if ( state < 2 ) {
  5259. for( tmp in map ) {
  5260. statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
  5261. }
  5262. } else {
  5263. tmp = map[ jXHR.status ];
  5264. jXHR.then( tmp, tmp );
  5265. }
  5266. }
  5267. return this;
  5268. };
  5269. // Remove hash character (#7531: and string promotion)
  5270. // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
  5271. // We also use the url parameter if available
  5272. s.url = ( "" + ( url || s.url ) ).replace( rhash, "" ).replace( rprotocol, protocol + "//" );
  5273. // Extract dataTypes list
  5274. s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
  5275. // Determine if a cross-domain request is in order
  5276. if ( !s.crossDomain ) {
  5277. parts = rurl.exec( s.url.toLowerCase() );
  5278. s.crossDomain = !!( parts &&
  5279. ( parts[ 1 ] != protocol || parts[ 2 ] != loc.hostname ||
  5280. ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
  5281. ( loc.port || ( protocol === "http:" ? 80 : 443 ) ) )
  5282. );
  5283. }
  5284. // Convert data if not already a string
  5285. if ( s.data && s.processData && typeof s.data !== "string" ) {
  5286. s.data = jQuery.param( s.data, s.traditional );
  5287. }
  5288. // Apply prefilters
  5289. inspectPrefiltersOrTransports( prefilters, s, options, jXHR );
  5290. // Uppercase the type
  5291. s.type = s.type.toUpperCase();
  5292. // Determine if request has content
  5293. s.hasContent = !rnoContent.test( s.type );
  5294. // Watch for a new set of requests
  5295. if ( s.global && jQuery.active++ === 0 ) {
  5296. jQuery.event.trigger( "ajaxStart" );
  5297. }
  5298. // More options handling for requests with no content
  5299. if ( !s.hasContent ) {
  5300. // If data is available, append data to url
  5301. if ( s.data ) {
  5302. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
  5303. }
  5304. // Add anti-cache in url if needed
  5305. if ( s.cache === false ) {
  5306. var ts = jQuery.now(),
  5307. // try replacing _= if it is there
  5308. ret = s.url.replace( rts, "$1_=" + ts );
  5309. // if nothing was replaced, add timestamp to the end
  5310. s.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
  5311. }
  5312. }
  5313. // Set the correct header, if data is being sent
  5314. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  5315. requestHeaders[ "content-type" ] = s.contentType;
  5316. }
  5317. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  5318. if ( s.ifModified ) {
  5319. if ( jQuery.lastModified[ s.url ] ) {
  5320. requestHeaders[ "if-modified-since" ] = jQuery.lastModified[ s.url ];
  5321. }
  5322. if ( jQuery.etag[ s.url ] ) {
  5323. requestHeaders[ "if-none-match" ] = jQuery.etag[ s.url ];
  5324. }
  5325. }
  5326. // Set the Accepts header for the server, depending on the dataType
  5327. requestHeaders.accept = s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
  5328. s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) :
  5329. s.accepts[ "*" ];
  5330. // Check for headers option
  5331. for ( i in s.headers ) {
  5332. requestHeaders[ i.toLowerCase() ] = s.headers[ i ];
  5333. }
  5334. // Allow custom headers/mimetypes and early abort
  5335. if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jXHR, s ) === false || state === 2 ) ) {
  5336. // Abort if not done already
  5337. done( 0, "abort" );
  5338. // Return false
  5339. jXHR = false;
  5340. } else {
  5341. // Install callbacks on deferreds
  5342. for ( i in { success: 1, error: 1, complete: 1 } ) {
  5343. jXHR[ i ]( s[ i ] );
  5344. }
  5345. // Get transport
  5346. transport = inspectPrefiltersOrTransports( transports, s, options, jXHR );
  5347. // If no transport, we auto-abort
  5348. if ( !transport ) {
  5349. done( -1, "No Transport" );
  5350. } else {
  5351. // Set state as sending
  5352. state = jXHR.readyState = 1;
  5353. // Send global event
  5354. if ( s.global ) {
  5355. globalEventContext.trigger( "ajaxSend", [ jXHR, s ] );
  5356. }
  5357. // Timeout
  5358. if ( s.async && s.timeout > 0 ) {
  5359. timeoutTimer = setTimeout( function(){
  5360. jXHR.abort( "timeout" );
  5361. }, s.timeout );
  5362. }
  5363. try {
  5364. transport.send( requestHeaders, done );
  5365. } catch (e) {
  5366. // Propagate exception as error if not done
  5367. if ( status < 2 ) {
  5368. done( -1, e );
  5369. // Simply rethrow otherwise
  5370. } else {
  5371. jQuery.error( e );
  5372. }
  5373. }
  5374. }
  5375. }
  5376. return jXHR;
  5377. },
  5378. // Serialize an array of form elements or a set of
  5379. // key/values into a query string
  5380. param: function( a, traditional ) {
  5381. var s = [],
  5382. add = function( key, value ) {
  5383. // If value is a function, invoke it and return its value
  5384. value = jQuery.isFunction( value ) ? value() : value;
  5385. s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
  5386. };
  5387. // Set traditional to true for jQuery <= 1.3.2 behavior.
  5388. if ( traditional === undefined ) {
  5389. traditional = jQuery.ajaxSettings.traditional;
  5390. }
  5391. // If an array was passed in, assume that it is an array of form elements.
  5392. if ( jQuery.isArray( a ) || a.jquery ) {
  5393. // Serialize the form elements
  5394. jQuery.each( a, function() {
  5395. add( this.name, this.value );
  5396. } );
  5397. } else {
  5398. // If traditional, encode the "old" way (the way 1.3.2 or older
  5399. // did it), otherwise encode params recursively.
  5400. for ( var prefix in a ) {
  5401. buildParams( prefix, a[ prefix ], traditional, add );
  5402. }
  5403. }
  5404. // Return the resulting serialization
  5405. return s.join( "&" ).replace( r20, "+" );
  5406. }
  5407. });
  5408. function buildParams( prefix, obj, traditional, add ) {
  5409. if ( jQuery.isArray( obj ) && obj.length ) {
  5410. // Serialize array item.
  5411. jQuery.each( obj, function( i, v ) {
  5412. if ( traditional || rbracket.test( prefix ) ) {
  5413. // Treat each array item as a scalar.
  5414. add( prefix, v );
  5415. } else {
  5416. // If array item is non-scalar (array or object), encode its
  5417. // numeric index to resolve deserialization ambiguity issues.
  5418. // Note that rack (as of 1.0.0) can't currently deserialize
  5419. // nested arrays properly, and attempting to do so may cause
  5420. // a server error. Possible fixes are to modify rack's
  5421. // deserialization algorithm or to provide an option or flag
  5422. // to force array serialization to be shallow.
  5423. buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
  5424. }
  5425. });
  5426. } else if ( !traditional && obj != null && typeof obj === "object" ) {
  5427. // If we see an array here, it is empty and should be treated as an empty
  5428. // object
  5429. if ( jQuery.isArray( obj ) || jQuery.isEmptyObject( obj ) ) {
  5430. add( prefix, "" );
  5431. // Serialize object item.
  5432. } else {
  5433. jQuery.each( obj, function( k, v ) {
  5434. buildParams( prefix + "[" + k + "]", v, traditional, add );
  5435. });
  5436. }
  5437. } else {
  5438. // Serialize scalar item.
  5439. add( prefix, obj );
  5440. }
  5441. }
  5442. // This is still on the jQuery object... for now
  5443. // Want to move this to jQuery.ajax some day
  5444. jQuery.extend({
  5445. // Counter for holding the number of active queries
  5446. active: 0,
  5447. // Last-Modified header cache for next request
  5448. lastModified: {},
  5449. etag: {}
  5450. });
  5451. /* Handles responses to an ajax request:
  5452. * - sets all responseXXX fields accordingly
  5453. * - finds the right dataType (mediates between content-type and expected dataType)
  5454. * - returns the corresponding response
  5455. */
  5456. function ajaxHandleResponses( s, jXHR, responses ) {
  5457. var contents = s.contents,
  5458. dataTypes = s.dataTypes,
  5459. responseFields = s.responseFields,
  5460. ct,
  5461. type,
  5462. finalDataType,
  5463. firstDataType;
  5464. // Fill responseXXX fields
  5465. for( type in responseFields ) {
  5466. if ( type in responses ) {
  5467. jXHR[ responseFields[type] ] = responses[ type ];
  5468. }
  5469. }
  5470. // Remove auto dataType and get content-type in the process
  5471. while( dataTypes[ 0 ] === "*" ) {
  5472. dataTypes.shift();
  5473. if ( ct === undefined ) {
  5474. ct = jXHR.getResponseHeader( "content-type" );
  5475. }
  5476. }
  5477. // Check if we're dealing with a known content-type
  5478. if ( ct ) {
  5479. for ( type in contents ) {
  5480. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  5481. dataTypes.unshift( type );
  5482. break;
  5483. }
  5484. }
  5485. }
  5486. // Check to see if we have a response for the expected dataType
  5487. if ( dataTypes[ 0 ] in responses ) {
  5488. finalDataType = dataTypes[ 0 ];
  5489. } else {
  5490. // Try convertible dataTypes
  5491. for ( type in responses ) {
  5492. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
  5493. finalDataType = type;
  5494. break;
  5495. }
  5496. if ( !firstDataType ) {
  5497. firstDataType = type;
  5498. }
  5499. }
  5500. // Or just use first one
  5501. finalDataType = finalDataType || firstDataType;
  5502. }
  5503. // If we found a dataType
  5504. // We add the dataType to the list if needed
  5505. // and return the corresponding response
  5506. if ( finalDataType ) {
  5507. if ( finalDataType !== dataTypes[ 0 ] ) {
  5508. dataTypes.unshift( finalDataType );
  5509. }
  5510. return responses[ finalDataType ];
  5511. }
  5512. }
  5513. // Chain conversions given the request and the original response
  5514. function ajaxConvert( s, response ) {
  5515. // Apply the dataFilter if provided
  5516. if ( s.dataFilter ) {
  5517. response = s.dataFilter( response, s.dataType );
  5518. }
  5519. var dataTypes = s.dataTypes,
  5520. converters = s.converters,
  5521. i,
  5522. length = dataTypes.length,
  5523. tmp,
  5524. // Current and previous dataTypes
  5525. current = dataTypes[ 0 ],
  5526. prev,
  5527. // Conversion expression
  5528. conversion,
  5529. // Conversion function
  5530. conv,
  5531. // Conversion functions (transitive conversion)
  5532. conv1,
  5533. conv2;
  5534. // For each dataType in the chain
  5535. for( i = 1; i < length; i++ ) {
  5536. // Get the dataTypes
  5537. prev = current;
  5538. current = dataTypes[ i ];
  5539. // If current is auto dataType, update it to prev
  5540. if( current === "*" ) {
  5541. current = prev;
  5542. // If no auto and dataTypes are actually different
  5543. } else if ( prev !== "*" && prev !== current ) {
  5544. // Get the converter
  5545. conversion = prev + " " + current;
  5546. conv = converters[ conversion ] || converters[ "* " + current ];
  5547. // If there is no direct converter, search transitively
  5548. if ( !conv ) {
  5549. conv2 = undefined;
  5550. for( conv1 in converters ) {
  5551. tmp = conv1.split( " " );
  5552. if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
  5553. conv2 = converters[ tmp[1] + " " + current ];
  5554. if ( conv2 ) {
  5555. conv1 = converters[ conv1 ];
  5556. if ( conv1 === true ) {
  5557. conv = conv2;
  5558. } else if ( conv2 === true ) {
  5559. conv = conv1;
  5560. }
  5561. break;
  5562. }
  5563. }
  5564. }
  5565. }
  5566. // If we found no converter, dispatch an error
  5567. if ( !( conv || conv2 ) ) {
  5568. jQuery.error( "No conversion from " + conversion.replace(" "," to ") );
  5569. }
  5570. // If found converter is not an equivalence
  5571. if ( conv !== true ) {
  5572. // Convert with 1 or 2 converters accordingly
  5573. response = conv ? conv( response ) : conv2( conv1(response) );
  5574. }
  5575. }
  5576. }
  5577. return response;
  5578. }
  5579. var jsc = jQuery.now(),
  5580. jsre = /(\=)\?(&|$)|()\?\?()/i;
  5581. // Default jsonp settings
  5582. jQuery.ajaxSetup({
  5583. jsonp: "callback",
  5584. jsonpCallback: function() {
  5585. return jQuery.expando + "_" + ( jsc++ );
  5586. }
  5587. });
  5588. // Detect, normalize options and install callbacks for jsonp requests
  5589. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, dataIsString /* internal */ ) {
  5590. dataIsString = ( typeof s.data === "string" );
  5591. if ( s.dataTypes[ 0 ] === "jsonp" ||
  5592. originalSettings.jsonpCallback ||
  5593. originalSettings.jsonp != null ||
  5594. s.jsonp !== false && ( jsre.test( s.url ) ||
  5595. dataIsString && jsre.test( s.data ) ) ) {
  5596. var responseContainer,
  5597. jsonpCallback = s.jsonpCallback =
  5598. jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
  5599. previous = window[ jsonpCallback ],
  5600. url = s.url,
  5601. data = s.data,
  5602. replace = "$1" + jsonpCallback + "$2";
  5603. if ( s.jsonp !== false ) {
  5604. url = url.replace( jsre, replace );
  5605. if ( s.url === url ) {
  5606. if ( dataIsString ) {
  5607. data = data.replace( jsre, replace );
  5608. }
  5609. if ( s.data === data ) {
  5610. // Add callback manually
  5611. url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;
  5612. }
  5613. }
  5614. }
  5615. s.url = url;
  5616. s.data = data;
  5617. window[ jsonpCallback ] = function( response ) {
  5618. responseContainer = [ response ];
  5619. };
  5620. s.complete = [ function() {
  5621. // Set callback back to previous value
  5622. window[ jsonpCallback ] = previous;
  5623. // Call if it was a function and we have a response
  5624. if ( previous) {
  5625. if ( responseContainer && jQuery.isFunction( previous ) ) {
  5626. window[ jsonpCallback ] ( responseContainer[ 0 ] );
  5627. }
  5628. } else {
  5629. // else, more memory leak avoidance
  5630. try{
  5631. delete window[ jsonpCallback ];
  5632. } catch( e ) {}
  5633. }
  5634. }, s.complete ];
  5635. // Use data converter to retrieve json after script execution
  5636. s.converters["script json"] = function() {
  5637. if ( ! responseContainer ) {
  5638. jQuery.error( jsonpCallback + " was not called" );
  5639. }
  5640. return responseContainer[ 0 ];
  5641. };
  5642. // force json dataType
  5643. s.dataTypes[ 0 ] = "json";
  5644. // Delegate to script
  5645. return "script";
  5646. }
  5647. } );
  5648. // Install script dataType
  5649. jQuery.ajaxSetup({
  5650. accepts: {
  5651. script: "text/javascript, application/javascript"
  5652. },
  5653. contents: {
  5654. script: /javascript/
  5655. },
  5656. converters: {
  5657. "text script": function( text ) {
  5658. jQuery.globalEval( text );
  5659. return text;
  5660. }
  5661. }
  5662. });
  5663. // Handle cache's special case and global
  5664. jQuery.ajaxPrefilter( "script", function( s ) {
  5665. if ( s.cache === undefined ) {
  5666. s.cache = false;
  5667. }
  5668. if ( s.crossDomain ) {
  5669. s.type = "GET";
  5670. s.global = false;
  5671. }
  5672. } );
  5673. // Bind script tag hack transport
  5674. jQuery.ajaxTransport( "script", function(s) {
  5675. // This transport only deals with cross domain requests
  5676. if ( s.crossDomain ) {
  5677. var script,
  5678. head = document.getElementsByTagName( "head" )[ 0 ] || document.documentElement;
  5679. return {
  5680. send: function( _, callback ) {
  5681. script = document.createElement( "script" );
  5682. script.async = "async";
  5683. if ( s.scriptCharset ) {
  5684. script.charset = s.scriptCharset;
  5685. }
  5686. script.src = s.url;
  5687. // Attach handlers for all browsers
  5688. script.onload = script.onreadystatechange = function( _, isAbort ) {
  5689. if ( !script.readyState || /loaded|complete/.test( script.readyState ) ) {
  5690. // Handle memory leak in IE
  5691. script.onload = script.onreadystatechange = null;
  5692. // Remove the script
  5693. if ( head && script.parentNode ) {
  5694. head.removeChild( script );
  5695. }
  5696. // Dereference the script
  5697. script = undefined;
  5698. // Callback if not abort
  5699. if ( !isAbort ) {
  5700. callback( 200, "success" );
  5701. }
  5702. }
  5703. };
  5704. // Use insertBefore instead of appendChild to circumvent an IE6 bug.
  5705. // This arises when a base node is used (#2709 and #4378).
  5706. head.insertBefore( script, head.firstChild );
  5707. },
  5708. abort: function() {
  5709. if ( script ) {
  5710. script.onload( 0, 1 );
  5711. }
  5712. }
  5713. };
  5714. }
  5715. } );
  5716. var // Next active xhr id
  5717. xhrId = jQuery.now(),
  5718. // active xhrs
  5719. xhrs = {},
  5720. // #5280: see below
  5721. xhrUnloadAbortInstalled,
  5722. // XHR used to determine supports properties
  5723. testXHR;
  5724. // Create the request object
  5725. // (This is still attached to ajaxSettings for backward compatibility)
  5726. jQuery.ajaxSettings.xhr = window.ActiveXObject ?
  5727. /* Microsoft failed to properly
  5728. * implement the XMLHttpRequest in IE7 (can't request local files),
  5729. * so we use the ActiveXObject when it is available
  5730. * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
  5731. * we need a fallback.
  5732. */
  5733. function() {
  5734. if ( window.location.protocol !== "file:" ) {
  5735. try {
  5736. return new window.XMLHttpRequest();
  5737. } catch( xhrError ) {}
  5738. }
  5739. try {
  5740. return new window.ActiveXObject("Microsoft.XMLHTTP");
  5741. } catch( activeError ) {}
  5742. } :
  5743. // For all other browsers, use the standard XMLHttpRequest object
  5744. function() {
  5745. return new window.XMLHttpRequest();
  5746. };
  5747. // Test if we can create an xhr object
  5748. try {
  5749. testXHR = jQuery.ajaxSettings.xhr();
  5750. } catch( xhrCreationException ) {}
  5751. //Does this browser support XHR requests?
  5752. jQuery.support.ajax = !!testXHR;
  5753. // Does this browser support crossDomain XHR requests
  5754. jQuery.support.cors = testXHR && ( "withCredentials" in testXHR );
  5755. // No need for the temporary xhr anymore
  5756. testXHR = undefined;
  5757. // Create transport if the browser can provide an xhr
  5758. if ( jQuery.support.ajax ) {
  5759. jQuery.ajaxTransport(function( s ) {
  5760. // Cross domain only allowed if supported through XMLHttpRequest
  5761. if ( !s.crossDomain || jQuery.support.cors ) {
  5762. var callback;
  5763. return {
  5764. send: function( headers, complete ) {
  5765. // #5280: we need to abort on unload or IE will keep connections alive
  5766. if ( !xhrUnloadAbortInstalled ) {
  5767. xhrUnloadAbortInstalled = 1;
  5768. jQuery(window).bind( "unload", function() {
  5769. // Abort all pending requests
  5770. jQuery.each( xhrs, function( _, xhr ) {
  5771. if ( xhr.onreadystatechange ) {
  5772. xhr.onreadystatechange( 1 );
  5773. }
  5774. } );
  5775. } );
  5776. }
  5777. // Get a new xhr
  5778. var xhr = s.xhr(),
  5779. handle;
  5780. // Open the socket
  5781. // Passing null username, generates a login popup on Opera (#2865)
  5782. if ( s.username ) {
  5783. xhr.open( s.type, s.url, s.async, s.username, s.password );
  5784. } else {
  5785. xhr.open( s.type, s.url, s.async );
  5786. }
  5787. // Requested-With header
  5788. // Not set for crossDomain requests with no content
  5789. // (see why at http://trac.dojotoolkit.org/ticket/9486)
  5790. // Won't change header if already provided
  5791. if ( !( s.crossDomain && !s.hasContent ) && !headers["x-requested-with"] ) {
  5792. headers[ "x-requested-with" ] = "XMLHttpRequest";
  5793. }
  5794. // Need an extra try/catch for cross domain requests in Firefox 3
  5795. try {
  5796. jQuery.each( headers, function( key, value ) {
  5797. xhr.setRequestHeader( key, value );
  5798. } );
  5799. } catch( _ ) {}
  5800. // Do send the request
  5801. // This may raise an exception which is actually
  5802. // handled in jQuery.ajax (so no try/catch here)
  5803. xhr.send( ( s.hasContent && s.data ) || null );
  5804. // Listener
  5805. callback = function( _, isAbort ) {
  5806. // Was never called and is aborted or complete
  5807. if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
  5808. // Only called once
  5809. callback = 0;
  5810. // Do not keep as active anymore
  5811. if ( handle ) {
  5812. xhr.onreadystatechange = jQuery.noop;
  5813. delete xhrs[ handle ];
  5814. }
  5815. // If it's an abort
  5816. if ( isAbort ) {
  5817. // Abort it manually if needed
  5818. if ( xhr.readyState !== 4 ) {
  5819. xhr.abort();
  5820. }
  5821. } else {
  5822. // Get info
  5823. var status = xhr.status,
  5824. statusText,
  5825. responseHeaders = xhr.getAllResponseHeaders(),
  5826. responses = {},
  5827. xml = xhr.responseXML;
  5828. // Construct response list
  5829. if ( xml && xml.documentElement /* #4958 */ ) {
  5830. responses.xml = xml;
  5831. }
  5832. responses.text = xhr.responseText;
  5833. // Firefox throws an exception when accessing
  5834. // statusText for faulty cross-domain requests
  5835. try {
  5836. statusText = xhr.statusText;
  5837. } catch( e ) {
  5838. // We normalize with Webkit giving an empty statusText
  5839. statusText = "";
  5840. }
  5841. // Filter status for non standard behaviours
  5842. status =
  5843. // Opera returns 0 when it should be 304
  5844. // Webkit returns 0 for failing cross-domain no matter the real status
  5845. status === 0 ?
  5846. (
  5847. // Webkit, Firefox: filter out faulty cross-domain requests
  5848. !s.crossDomain || statusText ?
  5849. (
  5850. // Opera: filter out real aborts #6060
  5851. responseHeaders ?
  5852. 304 :
  5853. 0
  5854. ) :
  5855. // We assume 302 but could be anything cross-domain related
  5856. 302
  5857. ) :
  5858. (
  5859. // IE sometimes returns 1223 when it should be 204 (see #1450)
  5860. status == 1223 ?
  5861. 204 :
  5862. status
  5863. );
  5864. // Call complete
  5865. complete( status, statusText, responses, responseHeaders );
  5866. }
  5867. }
  5868. };
  5869. // if we're in sync mode or it's in cache
  5870. // and has been retrieved directly (IE6 & IE7)
  5871. // we need to manually fire the callback
  5872. if ( !s.async || xhr.readyState === 4 ) {
  5873. callback();
  5874. } else {
  5875. // Add to list of active xhrs
  5876. handle = xhrId++;
  5877. xhrs[ handle ] = xhr;
  5878. xhr.onreadystatechange = callback;
  5879. }
  5880. },
  5881. abort: function() {
  5882. if ( callback ) {
  5883. callback(0,1);
  5884. }
  5885. }
  5886. };
  5887. }
  5888. });
  5889. }
  5890. var elemdisplay = {},
  5891. rfxtypes = /^(?:toggle|show|hide)$/,
  5892. rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
  5893. timerId,
  5894. fxAttrs = [
  5895. // height animations
  5896. [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
  5897. // width animations
  5898. [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
  5899. // opacity animations
  5900. [ "opacity" ]
  5901. ];
  5902. jQuery.fn.extend({
  5903. show: function( speed, easing, callback ) {
  5904. var elem, display;
  5905. if ( speed || speed === 0 ) {
  5906. return this.animate( genFx("show", 3), speed, easing, callback);
  5907. } else {
  5908. for ( var i = 0, j = this.length; i < j; i++ ) {
  5909. elem = this[i];
  5910. display = elem.style.display;
  5911. // Reset the inline display of this element to learn if it is
  5912. // being hidden by cascaded rules or not
  5913. if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
  5914. display = elem.style.display = "";
  5915. }
  5916. // Set elements which have been overridden with display: none
  5917. // in a stylesheet to whatever the default browser style is
  5918. // for such an element
  5919. if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
  5920. jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName));
  5921. }
  5922. }
  5923. // Set the display of most of the elements in a second loop
  5924. // to avoid the constant reflow
  5925. for ( i = 0; i < j; i++ ) {
  5926. elem = this[i];
  5927. display = elem.style.display;
  5928. if ( display === "" || display === "none" ) {
  5929. elem.style.display = jQuery._data(elem, "olddisplay") || "";
  5930. }
  5931. }
  5932. return this;
  5933. }
  5934. },
  5935. hide: function( speed, easing, callback ) {
  5936. if ( speed || speed === 0 ) {
  5937. return this.animate( genFx("hide", 3), speed, easing, callback);
  5938. } else {
  5939. for ( var i = 0, j = this.length; i < j; i++ ) {
  5940. var display = jQuery.css( this[i], "display" );
  5941. if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) {
  5942. jQuery._data( this[i], "olddisplay", display );
  5943. }
  5944. }
  5945. // Set the display of the elements in a second loop
  5946. // to avoid the constant reflow
  5947. for ( i = 0; i < j; i++ ) {
  5948. this[i].style.display = "none";
  5949. }
  5950. return this;
  5951. }
  5952. },
  5953. // Save the old toggle function
  5954. _toggle: jQuery.fn.toggle,
  5955. toggle: function( fn, fn2, callback ) {
  5956. var bool = typeof fn === "boolean";
  5957. if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
  5958. this._toggle.apply( this, arguments );
  5959. } else if ( fn == null || bool ) {
  5960. this.each(function() {
  5961. var state = bool ? fn : jQuery(this).is(":hidden");
  5962. jQuery(this)[ state ? "show" : "hide" ]();
  5963. });
  5964. } else {
  5965. this.animate(genFx("toggle", 3), fn, fn2, callback);
  5966. }
  5967. return this;
  5968. },
  5969. fadeTo: function( speed, to, easing, callback ) {
  5970. return this.filter(":hidden").css("opacity", 0).show().end()
  5971. .animate({opacity: to}, speed, easing, callback);
  5972. },
  5973. animate: function( prop, speed, easing, callback ) {
  5974. var optall = jQuery.speed(speed, easing, callback);
  5975. if ( jQuery.isEmptyObject( prop ) ) {
  5976. return this.each( optall.complete );
  5977. }
  5978. return this[ optall.queue === false ? "each" : "queue" ](function() {
  5979. // XXX 'this' does not always have a nodeName when running the
  5980. // test suite
  5981. var opt = jQuery.extend({}, optall), p,
  5982. isElement = this.nodeType === 1,
  5983. hidden = isElement && jQuery(this).is(":hidden"),
  5984. self = this;
  5985. for ( p in prop ) {
  5986. var name = jQuery.camelCase( p );
  5987. if ( p !== name ) {
  5988. prop[ name ] = prop[ p ];
  5989. delete prop[ p ];
  5990. p = name;
  5991. }
  5992. if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) {
  5993. return opt.complete.call(this);
  5994. }
  5995. if ( isElement && ( p === "height" || p === "width" ) ) {
  5996. // Make sure that nothing sneaks out
  5997. // Record all 3 overflow attributes because IE does not
  5998. // change the overflow attribute when overflowX and
  5999. // overflowY are set to the same value
  6000. opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
  6001. // Set display property to inline-block for height/width
  6002. // animations on inline elements that are having width/height
  6003. // animated
  6004. if ( jQuery.css( this, "display" ) === "inline" &&
  6005. jQuery.css( this, "float" ) === "none" ) {
  6006. if ( !jQuery.support.inlineBlockNeedsLayout ) {
  6007. this.style.display = "inline-block";
  6008. } else {
  6009. var display = defaultDisplay(this.nodeName);
  6010. // inline-level elements accept inline-block;
  6011. // block-level elements need to be inline with layout
  6012. if ( display === "inline" ) {
  6013. this.style.display = "inline-block";
  6014. } else {
  6015. this.style.display = "inline";
  6016. this.style.zoom = 1;
  6017. }
  6018. }
  6019. }
  6020. }
  6021. if ( jQuery.isArray( prop[p] ) ) {
  6022. // Create (if needed) and add to specialEasing
  6023. (opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1];
  6024. prop[p] = prop[p][0];
  6025. }
  6026. }
  6027. if ( opt.overflow != null ) {
  6028. this.style.overflow = "hidden";
  6029. }
  6030. opt.curAnim = jQuery.extend({}, prop);
  6031. jQuery.each( prop, function( name, val ) {
  6032. var e = new jQuery.fx( self, opt, name );
  6033. if ( rfxtypes.test(val) ) {
  6034. e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop );
  6035. } else {
  6036. var parts = rfxnum.exec(val),
  6037. start = e.cur() || 0;
  6038. if ( parts ) {
  6039. var end = parseFloat( parts[2] ),
  6040. unit = parts[3] || "px";
  6041. // We need to compute starting value
  6042. if ( unit !== "px" ) {
  6043. jQuery.style( self, name, (end || 1) + unit);
  6044. start = ((end || 1) / e.cur()) * start;
  6045. jQuery.style( self, name, start + unit);
  6046. }
  6047. // If a +=/-= token was provided, we're doing a relative animation
  6048. if ( parts[1] ) {
  6049. end = ((parts[1] === "-=" ? -1 : 1) * end) + start;
  6050. }
  6051. e.custom( start, end, unit );
  6052. } else {
  6053. e.custom( start, val, "" );
  6054. }
  6055. }
  6056. });
  6057. // For JS strict compliance
  6058. return true;
  6059. });
  6060. },
  6061. stop: function( clearQueue, gotoEnd ) {
  6062. var timers = jQuery.timers;
  6063. if ( clearQueue ) {
  6064. this.queue([]);
  6065. }
  6066. this.each(function() {
  6067. // go in reverse order so anything added to the queue during the loop is ignored
  6068. for ( var i = timers.length - 1; i >= 0; i-- ) {
  6069. if ( timers[i].elem === this ) {
  6070. if (gotoEnd) {
  6071. // force the next step to be the last
  6072. timers[i](true);
  6073. }
  6074. timers.splice(i, 1);
  6075. }
  6076. }
  6077. });
  6078. // start the next in the queue if the last step wasn't forced
  6079. if ( !gotoEnd ) {
  6080. this.dequeue();
  6081. }
  6082. return this;
  6083. }
  6084. });
  6085. function genFx( type, num ) {
  6086. var obj = {};
  6087. jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
  6088. obj[ this ] = type;
  6089. });
  6090. return obj;
  6091. }
  6092. // Generate shortcuts for custom animations
  6093. jQuery.each({
  6094. slideDown: genFx("show", 1),
  6095. slideUp: genFx("hide", 1),
  6096. slideToggle: genFx("toggle", 1),
  6097. fadeIn: { opacity: "show" },
  6098. fadeOut: { opacity: "hide" },
  6099. fadeToggle: { opacity: "toggle" }
  6100. }, function( name, props ) {
  6101. jQuery.fn[ name ] = function( speed, easing, callback ) {
  6102. return this.animate( props, speed, easing, callback );
  6103. };
  6104. });
  6105. jQuery.extend({
  6106. speed: function( speed, easing, fn ) {
  6107. var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
  6108. complete: fn || !fn && easing ||
  6109. jQuery.isFunction( speed ) && speed,
  6110. duration: speed,
  6111. easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
  6112. };
  6113. opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
  6114. opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
  6115. // Queueing
  6116. opt.old = opt.complete;
  6117. opt.complete = function() {
  6118. if ( opt.queue !== false ) {
  6119. jQuery(this).dequeue();
  6120. }
  6121. if ( jQuery.isFunction( opt.old ) ) {
  6122. opt.old.call( this );
  6123. }
  6124. };
  6125. return opt;
  6126. },
  6127. easing: {
  6128. linear: function( p, n, firstNum, diff ) {
  6129. return firstNum + diff * p;
  6130. },
  6131. swing: function( p, n, firstNum, diff ) {
  6132. return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
  6133. }
  6134. },
  6135. timers: [],
  6136. fx: function( elem, options, prop ) {
  6137. this.options = options;
  6138. this.elem = elem;
  6139. this.prop = prop;
  6140. if ( !options.orig ) {
  6141. options.orig = {};
  6142. }
  6143. }
  6144. });
  6145. jQuery.fx.prototype = {
  6146. // Simple function for setting a style value
  6147. update: function() {
  6148. if ( this.options.step ) {
  6149. this.options.step.call( this.elem, this.now, this );
  6150. }
  6151. (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
  6152. },
  6153. // Get the current size
  6154. cur: function() {
  6155. if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
  6156. return this.elem[ this.prop ];
  6157. }
  6158. var r = parseFloat( jQuery.css( this.elem, this.prop ) );
  6159. return r || 0;
  6160. },
  6161. // Start an animation from one number to another
  6162. custom: function( from, to, unit ) {
  6163. var self = this,
  6164. fx = jQuery.fx;
  6165. this.startTime = jQuery.now();
  6166. this.start = from;
  6167. this.end = to;
  6168. this.unit = unit || this.unit || "px";
  6169. this.now = this.start;
  6170. this.pos = this.state = 0;
  6171. function t( gotoEnd ) {
  6172. return self.step(gotoEnd);
  6173. }
  6174. t.elem = this.elem;
  6175. if ( t() && jQuery.timers.push(t) && !timerId ) {
  6176. timerId = setInterval(fx.tick, fx.interval);
  6177. }
  6178. },
  6179. // Simple 'show' function
  6180. show: function() {
  6181. // Remember where we started, so that we can go back to it later
  6182. this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
  6183. this.options.show = true;
  6184. // Begin the animation
  6185. // Make sure that we start at a small width/height to avoid any
  6186. // flash of content
  6187. this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());
  6188. // Start by showing the element
  6189. jQuery( this.elem ).show();
  6190. },
  6191. // Simple 'hide' function
  6192. hide: function() {
  6193. // Remember where we started, so that we can go back to it later
  6194. this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
  6195. this.options.hide = true;
  6196. // Begin the animation
  6197. this.custom(this.cur(), 0);
  6198. },
  6199. // Each step of an animation
  6200. step: function( gotoEnd ) {
  6201. var t = jQuery.now(), done = true;
  6202. if ( gotoEnd || t >= this.options.duration + this.startTime ) {
  6203. this.now = this.end;
  6204. this.pos = this.state = 1;
  6205. this.update();
  6206. this.options.curAnim[ this.prop ] = true;
  6207. for ( var i in this.options.curAnim ) {
  6208. if ( this.options.curAnim[i] !== true ) {
  6209. done = false;
  6210. }
  6211. }
  6212. if ( done ) {
  6213. // Reset the overflow
  6214. if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
  6215. var elem = this.elem,
  6216. options = this.options;
  6217. jQuery.each( [ "", "X", "Y" ], function (index, value) {
  6218. elem.style[ "overflow" + value ] = options.overflow[index];
  6219. } );
  6220. }
  6221. // Hide the element if the "hide" operation was done
  6222. if ( this.options.hide ) {
  6223. jQuery(this.elem).hide();
  6224. }
  6225. // Reset the properties, if the item has been hidden or shown
  6226. if ( this.options.hide || this.options.show ) {
  6227. for ( var p in this.options.curAnim ) {
  6228. jQuery.style( this.elem, p, this.options.orig[p] );
  6229. }
  6230. }
  6231. // Execute the complete function
  6232. this.options.complete.call( this.elem );
  6233. }
  6234. return false;
  6235. } else {
  6236. var n = t - this.startTime;
  6237. this.state = n / this.options.duration;
  6238. // Perform the easing function, defaults to swing
  6239. var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop];
  6240. var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear");
  6241. this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);
  6242. this.now = this.start + ((this.end - this.start) * this.pos);
  6243. // Perform the next step of the animation
  6244. this.update();
  6245. }
  6246. return true;
  6247. }
  6248. };
  6249. jQuery.extend( jQuery.fx, {
  6250. tick: function() {
  6251. var timers = jQuery.timers;
  6252. for ( var i = 0; i < timers.length; i++ ) {
  6253. if ( !timers[i]() ) {
  6254. timers.splice(i--, 1);
  6255. }
  6256. }
  6257. if ( !timers.length ) {
  6258. jQuery.fx.stop();
  6259. }
  6260. },
  6261. interval: 13,
  6262. stop: function() {
  6263. clearInterval( timerId );
  6264. timerId = null;
  6265. },
  6266. speeds: {
  6267. slow: 600,
  6268. fast: 200,
  6269. // Default speed
  6270. _default: 400
  6271. },
  6272. step: {
  6273. opacity: function( fx ) {
  6274. jQuery.style( fx.elem, "opacity", fx.now );
  6275. },
  6276. _default: function( fx ) {
  6277. if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
  6278. fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;
  6279. } else {
  6280. fx.elem[ fx.prop ] = fx.now;
  6281. }
  6282. }
  6283. }
  6284. });
  6285. if ( jQuery.expr && jQuery.expr.filters ) {
  6286. jQuery.expr.filters.animated = function( elem ) {
  6287. return jQuery.grep(jQuery.timers, function( fn ) {
  6288. return elem === fn.elem;
  6289. }).length;
  6290. };
  6291. }
  6292. function defaultDisplay( nodeName ) {
  6293. if ( !elemdisplay[ nodeName ] ) {
  6294. var elem = jQuery("<" + nodeName + ">").appendTo("body"),
  6295. display = elem.css("display");
  6296. elem.remove();
  6297. if ( display === "none" || display === "" ) {
  6298. display = "block";
  6299. }
  6300. elemdisplay[ nodeName ] = display;
  6301. }
  6302. return elemdisplay[ nodeName ];
  6303. }
  6304. var rtable = /^t(?:able|d|h)$/i,
  6305. rroot = /^(?:body|html)$/i;
  6306. if ( "getBoundingClientRect" in document.documentElement ) {
  6307. jQuery.fn.offset = function( options ) {
  6308. var elem = this[0], box;
  6309. if ( options ) {
  6310. return this.each(function( i ) {
  6311. jQuery.offset.setOffset( this, options, i );
  6312. });
  6313. }
  6314. if ( !elem || !elem.ownerDocument ) {
  6315. return null;
  6316. }
  6317. if ( elem === elem.ownerDocument.body ) {
  6318. return jQuery.offset.bodyOffset( elem );
  6319. }
  6320. try {
  6321. box = elem.getBoundingClientRect();
  6322. } catch(e) {}
  6323. var doc = elem.ownerDocument,
  6324. docElem = doc.documentElement;
  6325. // Make sure we're not dealing with a disconnected DOM node
  6326. if ( !box || !jQuery.contains( docElem, elem ) ) {
  6327. return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
  6328. }
  6329. var body = doc.body,
  6330. win = getWindow(doc),
  6331. clientTop = docElem.clientTop || body.clientTop || 0,
  6332. clientLeft = docElem.clientLeft || body.clientLeft || 0,
  6333. scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ),
  6334. scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft),
  6335. top = box.top + scrollTop - clientTop,
  6336. left = box.left + scrollLeft - clientLeft;
  6337. return { top: top, left: left };
  6338. };
  6339. } else {
  6340. jQuery.fn.offset = function( options ) {
  6341. var elem = this[0];
  6342. if ( options ) {
  6343. return this.each(function( i ) {
  6344. jQuery.offset.setOffset( this, options, i );
  6345. });
  6346. }
  6347. if ( !elem || !elem.ownerDocument ) {
  6348. return null;
  6349. }
  6350. if ( elem === elem.ownerDocument.body ) {
  6351. return jQuery.offset.bodyOffset( elem );
  6352. }
  6353. jQuery.offset.initialize();
  6354. var computedStyle,
  6355. offsetParent = elem.offsetParent,
  6356. prevOffsetParent = elem,
  6357. doc = elem.ownerDocument,
  6358. docElem = doc.documentElement,
  6359. body = doc.body,
  6360. defaultView = doc.defaultView,
  6361. prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
  6362. top = elem.offsetTop,
  6363. left = elem.offsetLeft;
  6364. while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
  6365. if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
  6366. break;
  6367. }
  6368. computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
  6369. top -= elem.scrollTop;
  6370. left -= elem.scrollLeft;
  6371. if ( elem === offsetParent ) {
  6372. top += elem.offsetTop;
  6373. left += elem.offsetLeft;
  6374. if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
  6375. top += parseFloat( computedStyle.borderTopWidth ) || 0;
  6376. left += parseFloat( computedStyle.borderLeftWidth ) || 0;
  6377. }
  6378. prevOffsetParent = offsetParent;
  6379. offsetParent = elem.offsetParent;
  6380. }
  6381. if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
  6382. top += parseFloat( computedStyle.borderTopWidth ) || 0;
  6383. left += parseFloat( computedStyle.borderLeftWidth ) || 0;
  6384. }
  6385. prevComputedStyle = computedStyle;
  6386. }
  6387. if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
  6388. top += body.offsetTop;
  6389. left += body.offsetLeft;
  6390. }
  6391. if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
  6392. top += Math.max( docElem.scrollTop, body.scrollTop );
  6393. left += Math.max( docElem.scrollLeft, body.scrollLeft );
  6394. }
  6395. return { top: top, left: left };
  6396. };
  6397. }
  6398. jQuery.offset = {
  6399. initialize: function() {
  6400. var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,
  6401. html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
  6402. jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
  6403. container.innerHTML = html;
  6404. body.insertBefore( container, body.firstChild );
  6405. innerDiv = container.firstChild;
  6406. checkDiv = innerDiv.firstChild;
  6407. td = innerDiv.nextSibling.firstChild.firstChild;
  6408. this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
  6409. this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
  6410. checkDiv.style.position = "fixed";
  6411. checkDiv.style.top = "20px";
  6412. // safari subtracts parent border width here which is 5px
  6413. this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
  6414. checkDiv.style.position = checkDiv.style.top = "";
  6415. innerDiv.style.overflow = "hidden";
  6416. innerDiv.style.position = "relative";
  6417. this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
  6418. this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
  6419. body.removeChild( container );
  6420. body = container = innerDiv = checkDiv = table = td = null;
  6421. jQuery.offset.initialize = jQuery.noop;
  6422. },
  6423. bodyOffset: function( body ) {
  6424. var top = body.offsetTop,
  6425. left = body.offsetLeft;
  6426. jQuery.offset.initialize();
  6427. if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
  6428. top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
  6429. left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
  6430. }
  6431. return { top: top, left: left };
  6432. },
  6433. setOffset: function( elem, options, i ) {
  6434. var position = jQuery.css( elem, "position" );
  6435. // set position first, in-case top/left are set even on static elem
  6436. if ( position === "static" ) {
  6437. elem.style.position = "relative";
  6438. }
  6439. var curElem = jQuery( elem ),
  6440. curOffset = curElem.offset(),
  6441. curCSSTop = jQuery.css( elem, "top" ),
  6442. curCSSLeft = jQuery.css( elem, "left" ),
  6443. calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
  6444. props = {}, curPosition = {}, curTop, curLeft;
  6445. // need to be able to calculate position if either top or left is auto and position is absolute
  6446. if ( calculatePosition ) {
  6447. curPosition = curElem.position();
  6448. }
  6449. curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0;
  6450. curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;
  6451. if ( jQuery.isFunction( options ) ) {
  6452. options = options.call( elem, i, curOffset );
  6453. }
  6454. if (options.top != null) {
  6455. props.top = (options.top - curOffset.top) + curTop;
  6456. }
  6457. if (options.left != null) {
  6458. props.left = (options.left - curOffset.left) + curLeft;
  6459. }
  6460. if ( "using" in options ) {
  6461. options.using.call( elem, props );
  6462. } else {
  6463. curElem.css( props );
  6464. }
  6465. }
  6466. };
  6467. jQuery.fn.extend({
  6468. position: function() {
  6469. if ( !this[0] ) {
  6470. return null;
  6471. }
  6472. var elem = this[0],
  6473. // Get *real* offsetParent
  6474. offsetParent = this.offsetParent(),
  6475. // Get correct offsets
  6476. offset = this.offset(),
  6477. parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
  6478. // Subtract element margins
  6479. // note: when an element has margin: auto the offsetLeft and marginLeft
  6480. // are the same in Safari causing offset.left to incorrectly be 0
  6481. offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
  6482. offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
  6483. // Add offsetParent borders
  6484. parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
  6485. parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
  6486. // Subtract the two offsets
  6487. return {
  6488. top: offset.top - parentOffset.top,
  6489. left: offset.left - parentOffset.left
  6490. };
  6491. },
  6492. offsetParent: function() {
  6493. return this.map(function() {
  6494. var offsetParent = this.offsetParent || document.body;
  6495. while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
  6496. offsetParent = offsetParent.offsetParent;
  6497. }
  6498. return offsetParent;
  6499. });
  6500. }
  6501. });
  6502. // Create scrollLeft and scrollTop methods
  6503. jQuery.each( ["Left", "Top"], function( i, name ) {
  6504. var method = "scroll" + name;
  6505. jQuery.fn[ method ] = function(val) {
  6506. var elem = this[0], win;
  6507. if ( !elem ) {
  6508. return null;
  6509. }
  6510. if ( val !== undefined ) {
  6511. // Set the scroll offset
  6512. return this.each(function() {
  6513. win = getWindow( this );
  6514. if ( win ) {
  6515. win.scrollTo(
  6516. !i ? val : jQuery(win).scrollLeft(),
  6517. i ? val : jQuery(win).scrollTop()
  6518. );
  6519. } else {
  6520. this[ method ] = val;
  6521. }
  6522. });
  6523. } else {
  6524. win = getWindow( elem );
  6525. // Return the scroll offset
  6526. return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
  6527. jQuery.support.boxModel && win.document.documentElement[ method ] ||
  6528. win.document.body[ method ] :
  6529. elem[ method ];
  6530. }
  6531. };
  6532. });
  6533. function getWindow( elem ) {
  6534. return jQuery.isWindow( elem ) ?
  6535. elem :
  6536. elem.nodeType === 9 ?
  6537. elem.defaultView || elem.parentWindow :
  6538. false;
  6539. }
  6540. // Create innerHeight, innerWidth, outerHeight and outerWidth methods
  6541. jQuery.each([ "Height", "Width" ], function( i, name ) {
  6542. var type = name.toLowerCase();
  6543. // innerHeight and innerWidth
  6544. jQuery.fn["inner" + name] = function() {
  6545. return this[0] ?
  6546. parseFloat( jQuery.css( this[0], type, "padding" ) ) :
  6547. null;
  6548. };
  6549. // outerHeight and outerWidth
  6550. jQuery.fn["outer" + name] = function( margin ) {
  6551. return this[0] ?
  6552. parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
  6553. null;
  6554. };
  6555. jQuery.fn[ type ] = function( size ) {
  6556. // Get window width or height
  6557. var elem = this[0];
  6558. if ( !elem ) {
  6559. return size == null ? null : this;
  6560. }
  6561. if ( jQuery.isFunction( size ) ) {
  6562. return this.each(function( i ) {
  6563. var self = jQuery( this );
  6564. self[ type ]( size.call( this, i, self[ type ]() ) );
  6565. });
  6566. }
  6567. if ( jQuery.isWindow( elem ) ) {
  6568. // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
  6569. // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
  6570. var docElemProp = elem.document.documentElement[ "client" + name ];
  6571. return elem.document.compatMode === "CSS1Compat" && docElemProp ||
  6572. elem.document.body[ "client" + name ] || docElemProp;
  6573. // Get document width or height
  6574. } else if ( elem.nodeType === 9 ) {
  6575. // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
  6576. return Math.max(
  6577. elem.documentElement["client" + name],
  6578. elem.body["scroll" + name], elem.documentElement["scroll" + name],
  6579. elem.body["offset" + name], elem.documentElement["offset" + name]
  6580. );
  6581. // Get or set width or height on the element
  6582. } else if ( size === undefined ) {
  6583. var orig = jQuery.css( elem, type ),
  6584. ret = parseFloat( orig );
  6585. return jQuery.isNaN( ret ) ? orig : ret;
  6586. // Set the width or height on the element (default to pixels if value is unitless)
  6587. } else {
  6588. return this.css( type, typeof size === "string" ? size : size + "px" );
  6589. }
  6590. };
  6591. });
  6592. })(window);
  6593. /*!
  6594. * jQuery UI 1.8.5
  6595. *
  6596. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  6597. * Dual licensed under the MIT or GPL Version 2 licenses.
  6598. * http://jquery.org/license
  6599. *
  6600. * http://docs.jquery.com/UI
  6601. */
  6602. (function( $, undefined ) {
  6603. // prevent duplicate loading
  6604. // this is only a problem because we proxy existing functions
  6605. // and we don't want to double proxy them
  6606. $.ui = $.ui || {};
  6607. if ( $.ui.version ) {
  6608. return;
  6609. }
  6610. $.extend( $.ui, {
  6611. version: "1.8.5",
  6612. keyCode: {
  6613. ALT: 18,
  6614. BACKSPACE: 8,
  6615. CAPS_LOCK: 20,
  6616. COMMA: 188,
  6617. COMMAND: 91,
  6618. COMMAND_LEFT: 91, // COMMAND
  6619. COMMAND_RIGHT: 93,
  6620. CONTROL: 17,
  6621. DELETE: 46,
  6622. DOWN: 40,
  6623. END: 35,
  6624. ENTER: 13,
  6625. ESCAPE: 27,
  6626. HOME: 36,
  6627. INSERT: 45,
  6628. LEFT: 37,
  6629. MENU: 93, // COMMAND_RIGHT
  6630. NUMPAD_ADD: 107,
  6631. NUMPAD_DECIMAL: 110,
  6632. NUMPAD_DIVIDE: 111,
  6633. NUMPAD_ENTER: 108,
  6634. NUMPAD_MULTIPLY: 106,
  6635. NUMPAD_SUBTRACT: 109,
  6636. PAGE_DOWN: 34,
  6637. PAGE_UP: 33,
  6638. PERIOD: 190,
  6639. RIGHT: 39,
  6640. SHIFT: 16,
  6641. SPACE: 32,
  6642. TAB: 9,
  6643. UP: 38,
  6644. WINDOWS: 91 // COMMAND
  6645. }
  6646. });
  6647. // plugins
  6648. $.fn.extend({
  6649. _focus: $.fn.focus,
  6650. focus: function( delay, fn ) {
  6651. return typeof delay === "number" ?
  6652. this.each(function() {
  6653. var elem = this;
  6654. setTimeout(function() {
  6655. $( elem ).focus();
  6656. if ( fn ) {
  6657. fn.call( elem );
  6658. }
  6659. }, delay );
  6660. }) :
  6661. this._focus.apply( this, arguments );
  6662. },
  6663. scrollParent: function() {
  6664. var scrollParent;
  6665. if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
  6666. scrollParent = this.parents().filter(function() {
  6667. return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
  6668. }).eq(0);
  6669. } else {
  6670. scrollParent = this.parents().filter(function() {
  6671. return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
  6672. }).eq(0);
  6673. }
  6674. return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
  6675. },
  6676. zIndex: function( zIndex ) {
  6677. if ( zIndex !== undefined ) {
  6678. return this.css( "zIndex", zIndex );
  6679. }
  6680. if ( this.length ) {
  6681. var elem = $( this[ 0 ] ), position, value;
  6682. while ( elem.length && elem[ 0 ] !== document ) {
  6683. // Ignore z-index if position is set to a value where z-index is ignored by the browser
  6684. // This makes behavior of this function consistent across browsers
  6685. // WebKit always returns auto if the element is positioned
  6686. position = elem.css( "position" );
  6687. if ( position === "absolute" || position === "relative" || position === "fixed" ) {
  6688. // IE returns 0 when zIndex is not specified
  6689. // other browsers return a string
  6690. // we ignore the case of nested elements with an explicit value of 0
  6691. // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
  6692. value = parseInt( elem.css( "zIndex" ) );
  6693. if ( !isNaN( value ) && value != 0 ) {
  6694. return value;
  6695. }
  6696. }
  6697. elem = elem.parent();
  6698. }
  6699. }
  6700. return 0;
  6701. },
  6702. disableSelection: function() {
  6703. return this.bind(
  6704. "mousedown.ui-disableSelection selectstart.ui-disableSelection",
  6705. function( event ) {
  6706. event.preventDefault();
  6707. });
  6708. },
  6709. enableSelection: function() {
  6710. return this.unbind( ".ui-disableSelection" );
  6711. }
  6712. });
  6713. $.each( [ "Width", "Height" ], function( i, name ) {
  6714. var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
  6715. type = name.toLowerCase(),
  6716. orig = {
  6717. innerWidth: $.fn.innerWidth,
  6718. innerHeight: $.fn.innerHeight,
  6719. outerWidth: $.fn.outerWidth,
  6720. outerHeight: $.fn.outerHeight
  6721. };
  6722. function reduce( elem, size, border, margin ) {
  6723. $.each( side, function() {
  6724. size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
  6725. if ( border ) {
  6726. size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
  6727. }
  6728. if ( margin ) {
  6729. size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
  6730. }
  6731. });
  6732. return size;
  6733. }
  6734. $.fn[ "inner" + name ] = function( size ) {
  6735. if ( size === undefined ) {
  6736. return orig[ "inner" + name ].call( this );
  6737. }
  6738. return this.each(function() {
  6739. $.style( this, type, reduce( this, size ) + "px" );
  6740. });
  6741. };
  6742. $.fn[ "outer" + name] = function( size, margin ) {
  6743. if ( typeof size !== "number" ) {
  6744. return orig[ "outer" + name ].call( this, size );
  6745. }
  6746. return this.each(function() {
  6747. $.style( this, type, reduce( this, size, true, margin ) + "px" );
  6748. });
  6749. };
  6750. });
  6751. // selectors
  6752. function visible( element ) {
  6753. return !$( element ).parents().andSelf().filter(function() {
  6754. return $.curCSS( this, "visibility" ) === "hidden" ||
  6755. $.expr.filters.hidden( this );
  6756. }).length;
  6757. }
  6758. $.extend( $.expr[ ":" ], {
  6759. data: function( elem, i, match ) {
  6760. return !!$.data( elem, match[ 3 ] );
  6761. },
  6762. focusable: function( element ) {
  6763. var nodeName = element.nodeName.toLowerCase(),
  6764. tabIndex = $.attr( element, "tabindex" );
  6765. if ( "area" === nodeName ) {
  6766. var map = element.parentNode,
  6767. mapName = map.name,
  6768. img;
  6769. if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
  6770. return false;
  6771. }
  6772. img = $( "img[usemap=#" + mapName + "]" )[0];
  6773. return !!img && visible( img );
  6774. }
  6775. return ( /input|select|textarea|button|object/.test( nodeName )
  6776. ? !element.disabled
  6777. : "a" == nodeName
  6778. ? element.href || !isNaN( tabIndex )
  6779. : !isNaN( tabIndex ))
  6780. // the element and all of its ancestors must be visible
  6781. && visible( element );
  6782. },
  6783. tabbable: function( element ) {
  6784. var tabIndex = $.attr( element, "tabindex" );
  6785. return ( isNaN( tabIndex ) || tabIndex >= 0 ) && $( element ).is( ":focusable" );
  6786. }
  6787. });
  6788. // support
  6789. $(function() {
  6790. var div = document.createElement( "div" ),
  6791. body = document.body;
  6792. $.extend( div.style, {
  6793. minHeight: "100px",
  6794. height: "auto",
  6795. padding: 0,
  6796. borderWidth: 0
  6797. });
  6798. $.support.minHeight = body.appendChild( div ).offsetHeight === 100;
  6799. // set display to none to avoid a layout bug in IE
  6800. // http://dev.jquery.com/ticket/4014
  6801. body.removeChild( div ).style.display = "none";
  6802. });
  6803. // deprecated
  6804. $.extend( $.ui, {
  6805. // $.ui.plugin is deprecated. Use the proxy pattern instead.
  6806. plugin: {
  6807. add: function( module, option, set ) {
  6808. var proto = $.ui[ module ].prototype;
  6809. for ( var i in set ) {
  6810. proto.plugins[ i ] = proto.plugins[ i ] || [];
  6811. proto.plugins[ i ].push( [ option, set[ i ] ] );
  6812. }
  6813. },
  6814. call: function( instance, name, args ) {
  6815. var set = instance.plugins[ name ];
  6816. if ( !set || !instance.element[ 0 ].parentNode ) {
  6817. return;
  6818. }
  6819. for ( var i = 0; i < set.length; i++ ) {
  6820. if ( instance.options[ set[ i ][ 0 ] ] ) {
  6821. set[ i ][ 1 ].apply( instance.element, args );
  6822. }
  6823. }
  6824. }
  6825. },
  6826. // will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
  6827. contains: function( a, b ) {
  6828. return document.compareDocumentPosition ?
  6829. a.compareDocumentPosition( b ) & 16 :
  6830. a !== b && a.contains( b );
  6831. },
  6832. // only used by resizable
  6833. hasScroll: function( el, a ) {
  6834. //If overflow is hidden, the element might have extra content, but the user wants to hide it
  6835. if ( $( el ).css( "overflow" ) === "hidden") {
  6836. return false;
  6837. }
  6838. var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
  6839. has = false;
  6840. if ( el[ scroll ] > 0 ) {
  6841. return true;
  6842. }
  6843. // TODO: determine which cases actually cause this to happen
  6844. // if the element doesn't have the scroll set, see if it's possible to
  6845. // set the scroll
  6846. el[ scroll ] = 1;
  6847. has = ( el[ scroll ] > 0 );
  6848. el[ scroll ] = 0;
  6849. return has;
  6850. },
  6851. // these are odd functions, fix the API or move into individual plugins
  6852. isOverAxis: function( x, reference, size ) {
  6853. //Determines when x coordinate is over "b" element axis
  6854. return ( x > reference ) && ( x < ( reference + size ) );
  6855. },
  6856. isOver: function( y, x, top, left, height, width ) {
  6857. //Determines when x, y coordinates is over "b" element
  6858. return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
  6859. }
  6860. });
  6861. })( jQuery );
  6862. /*!
  6863. * jQuery UI Widget 1.8.5
  6864. *
  6865. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  6866. * Dual licensed under the MIT or GPL Version 2 licenses.
  6867. * http://jquery.org/license
  6868. *
  6869. * http://docs.jquery.com/UI/Widget
  6870. */
  6871. (function( $, undefined ) {
  6872. // jQuery 1.4+
  6873. if ( $.cleanData ) {
  6874. var _cleanData = $.cleanData;
  6875. $.cleanData = function( elems ) {
  6876. for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
  6877. $( elem ).triggerHandler( "remove" );
  6878. }
  6879. _cleanData( elems );
  6880. };
  6881. } else {
  6882. var _remove = $.fn.remove;
  6883. $.fn.remove = function( selector, keepData ) {
  6884. return this.each(function() {
  6885. if ( !keepData ) {
  6886. if ( !selector || $.filter( selector, [ this ] ).length ) {
  6887. $( "*", this ).add( [ this ] ).each(function() {
  6888. $( this ).triggerHandler( "remove" );
  6889. });
  6890. }
  6891. }
  6892. return _remove.call( $(this), selector, keepData );
  6893. });
  6894. };
  6895. }
  6896. $.widget = function( name, base, prototype ) {
  6897. var namespace = name.split( "." )[ 0 ],
  6898. fullName;
  6899. name = name.split( "." )[ 1 ];
  6900. fullName = namespace + "-" + name;
  6901. if ( !prototype ) {
  6902. prototype = base;
  6903. base = $.Widget;
  6904. }
  6905. // create selector for plugin
  6906. $.expr[ ":" ][ fullName ] = function( elem ) {
  6907. return !!$.data( elem, name );
  6908. };
  6909. $[ namespace ] = $[ namespace ] || {};
  6910. $[ namespace ][ name ] = function( options, element ) {
  6911. // allow instantiation without initializing for simple inheritance
  6912. if ( arguments.length ) {
  6913. this._createWidget( options, element );
  6914. }
  6915. };
  6916. var basePrototype = new base();
  6917. // we need to make the options hash a property directly on the new instance
  6918. // otherwise we'll modify the options hash on the prototype that we're
  6919. // inheriting from
  6920. // $.each( basePrototype, function( key, val ) {
  6921. // if ( $.isPlainObject(val) ) {
  6922. // basePrototype[ key ] = $.extend( {}, val );
  6923. // }
  6924. // });
  6925. basePrototype.options = $.extend( true, {}, basePrototype.options );
  6926. $[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
  6927. namespace: namespace,
  6928. widgetName: name,
  6929. widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
  6930. widgetBaseClass: fullName
  6931. }, prototype );
  6932. $.widget.bridge( name, $[ namespace ][ name ] );
  6933. };
  6934. $.widget.bridge = function( name, object ) {
  6935. $.fn[ name ] = function( options ) {
  6936. var isMethodCall = typeof options === "string",
  6937. args = Array.prototype.slice.call( arguments, 1 ),
  6938. returnValue = this;
  6939. // allow multiple hashes to be passed on init
  6940. options = !isMethodCall && args.length ?
  6941. $.extend.apply( null, [ true, options ].concat(args) ) :
  6942. options;
  6943. // prevent calls to internal methods
  6944. if ( isMethodCall && options.substring( 0, 1 ) === "_" ) {
  6945. return returnValue;
  6946. }
  6947. if ( isMethodCall ) {
  6948. this.each(function() {
  6949. var instance = $.data( this, name );
  6950. if ( !instance ) {
  6951. throw "cannot call methods on " + name + " prior to initialization; " +
  6952. "attempted to call method '" + options + "'";
  6953. }
  6954. if ( !$.isFunction( instance[options] ) ) {
  6955. throw "no such method '" + options + "' for " + name + " widget instance";
  6956. }
  6957. var methodValue = instance[ options ].apply( instance, args );
  6958. if ( methodValue !== instance && methodValue !== undefined ) {
  6959. returnValue = methodValue;
  6960. return false;
  6961. }
  6962. });
  6963. } else {
  6964. this.each(function() {
  6965. var instance = $.data( this, name );
  6966. if ( instance ) {
  6967. instance.option( options || {} )._init();
  6968. } else {
  6969. $.data( this, name, new object( options, this ) );
  6970. }
  6971. });
  6972. }
  6973. return returnValue;
  6974. };
  6975. };
  6976. $.Widget = function( options, element ) {
  6977. // allow instantiation without initializing for simple inheritance
  6978. if ( arguments.length ) {
  6979. this._createWidget( options, element );
  6980. }
  6981. };
  6982. $.Widget.prototype = {
  6983. widgetName: "widget",
  6984. widgetEventPrefix: "",
  6985. options: {
  6986. disabled: false
  6987. },
  6988. _createWidget: function( options, element ) {
  6989. // $.widget.bridge stores the plugin instance, but we do it anyway
  6990. // so that it's stored even before the _create function runs
  6991. $.data( element, this.widgetName, this );
  6992. this.element = $( element );
  6993. this.options = $.extend( true, {},
  6994. this.options,
  6995. $.metadata && $.metadata.get( element )[ this.widgetName ],
  6996. options );
  6997. var self = this;
  6998. this.element.bind( "remove." + this.widgetName, function() {
  6999. self.destroy();
  7000. });
  7001. this._create();
  7002. this._init();
  7003. },
  7004. _create: function() {},
  7005. _init: function() {},
  7006. destroy: function() {
  7007. this.element
  7008. .unbind( "." + this.widgetName )
  7009. .removeData( this.widgetName );
  7010. this.widget()
  7011. .unbind( "." + this.widgetName )
  7012. .removeAttr( "aria-disabled" )
  7013. .removeClass(
  7014. this.widgetBaseClass + "-disabled " +
  7015. "ui-state-disabled" );
  7016. },
  7017. widget: function() {
  7018. return this.element;
  7019. },
  7020. option: function( key, value ) {
  7021. var options = key,
  7022. self = this;
  7023. if ( arguments.length === 0 ) {
  7024. // don't return a reference to the internal hash
  7025. return $.extend( {}, self.options );
  7026. }
  7027. if (typeof key === "string" ) {
  7028. if ( value === undefined ) {
  7029. return this.options[ key ];
  7030. }
  7031. options = {};
  7032. options[ key ] = value;
  7033. }
  7034. $.each( options, function( key, value ) {
  7035. self._setOption( key, value );
  7036. });
  7037. return self;
  7038. },
  7039. _setOption: function( key, value ) {
  7040. this.options[ key ] = value;
  7041. if ( key === "disabled" ) {
  7042. this.widget()
  7043. [ value ? "addClass" : "removeClass"](
  7044. this.widgetBaseClass + "-disabled" + " " +
  7045. "ui-state-disabled" )
  7046. .attr( "aria-disabled", value );
  7047. }
  7048. return this;
  7049. },
  7050. enable: function() {
  7051. return this._setOption( "disabled", false );
  7052. },
  7053. disable: function() {
  7054. return this._setOption( "disabled", true );
  7055. },
  7056. _trigger: function( type, event, data ) {
  7057. var callback = this.options[ type ];
  7058. event = $.Event( event );
  7059. event.type = ( type === this.widgetEventPrefix ?
  7060. type :
  7061. this.widgetEventPrefix + type ).toLowerCase();
  7062. data = data || {};
  7063. // copy original event properties over to the new event
  7064. // this would happen if we could call $.event.fix instead of $.Event
  7065. // but we don't have a way to force an event to be fixed multiple times
  7066. if ( event.originalEvent ) {
  7067. for ( var i = $.event.props.length, prop; i; ) {
  7068. prop = $.event.props[ --i ];
  7069. event[ prop ] = event.originalEvent[ prop ];
  7070. }
  7071. }
  7072. this.element.trigger( event, data );
  7073. return !( $.isFunction(callback) &&
  7074. callback.call( this.element[0], event, data ) === false ||
  7075. event.isDefaultPrevented() );
  7076. }
  7077. };
  7078. })( jQuery );
  7079. /*!
  7080. * jQuery Cookie Plugin v1.4.0
  7081. * https://github.com/carhartl/jquery-cookie
  7082. *
  7083. * Copyright 2013 Klaus Hartl
  7084. * Released under the MIT license
  7085. */
  7086. (function(factory) {
  7087. if (typeof define === 'function' && define.amd) {
  7088. // AMD. Register as anonymous module.
  7089. define([ 'jquery' ], factory);
  7090. } else {
  7091. // Browser globals.
  7092. factory(jQuery);
  7093. }
  7094. }(function($) {
  7095. var pluses = /\+/g;
  7096. function encode(s) {
  7097. return config.raw ? s : encodeURIComponent(s);
  7098. }
  7099. function decode(s) {
  7100. return config.raw ? s : decodeURIComponent(s);
  7101. }
  7102. function stringifyCookieValue(value) {
  7103. return encode(config.json ? JSON.stringify(value) : String(value));
  7104. }
  7105. function parseCookieValue(s) {
  7106. if (s.indexOf('"') === 0) {
  7107. // This is a quoted cookie as according to RFC2068, unescape...
  7108. s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
  7109. }
  7110. try {
  7111. // Replace server-side written pluses with spaces.
  7112. // If we can't decode the cookie, ignore it, it's unusable.
  7113. s = decodeURIComponent(s.replace(pluses, ' '));
  7114. } catch (e) {
  7115. return;
  7116. }
  7117. try {
  7118. // If we can't parse the cookie, ignore it, it's unusable.
  7119. return config.json ? JSON.parse(s) : s;
  7120. } catch (e) {
  7121. }
  7122. }
  7123. function read(s, converter) {
  7124. var value = config.raw ? s : parseCookieValue(s);
  7125. return $.isFunction(converter) ? converter(value) : value;
  7126. }
  7127. var config = $.cookie = function(key, value, options) {
  7128. // Write
  7129. if (value !== undefined && !$.isFunction(value)) {
  7130. options = $.extend({}, config.defaults, options);
  7131. if (typeof options.expires === 'number') {
  7132. var days = options.expires, t = options.expires = new Date();
  7133. t.setDate(t.getDate() + days);
  7134. }
  7135. return (document.cookie = [
  7136. encode(key),
  7137. '=',
  7138. stringifyCookieValue(value),
  7139. options.expires ? '; expires='
  7140. + options.expires.toUTCString() : '', // use
  7141. // expires
  7142. // attribute,
  7143. // max-age
  7144. // is not
  7145. // supported
  7146. // by IE
  7147. options.path ? '; path=' + options.path : '',
  7148. options.domain ? '; domain=' + options.domain : '',
  7149. options.secure ? '; secure' : '' ].join(''));
  7150. }
  7151. // Read
  7152. var result = key ? undefined : {};
  7153. // To prevent the for loop in the first place assign an empty array
  7154. // in case there are no cookies at all. Also prevents odd result when
  7155. // calling $.cookie().
  7156. var cookies = document.cookie ? document.cookie.split('; ') : [];
  7157. for ( var i = 0, l = cookies.length; i < l; i++) {
  7158. var parts = cookies[i].split('=');
  7159. var name = decode(parts.shift());
  7160. var cookie = parts.join('=');
  7161. if (key && key === name) {
  7162. // If second argument (value) is a function it's a converter...
  7163. result = read(cookie, value);
  7164. break;
  7165. }
  7166. // Prevent storing a cookie that we couldn't decode.
  7167. if (!key && (cookie = read(cookie)) !== undefined) {
  7168. result[name] = cookie;
  7169. }
  7170. }
  7171. return result;
  7172. };
  7173. config.defaults = {};
  7174. $.removeCookie = function(key, options) {
  7175. if ($.cookie(key) !== undefined) {
  7176. // Must not alter options, thus extending a fresh object...
  7177. $.cookie(key, '', $.extend({}, options, {
  7178. expires : -1
  7179. }));
  7180. return true;
  7181. }
  7182. return false;
  7183. };
  7184. }));
  7185. // @preserve jQuery.floatThead 1.4.0 - http://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2016 Misha Koryak
  7186. // @license MIT
  7187. /* @author Misha Koryak
  7188. * @projectDescription lock a table header in place while scrolling - without breaking styles or events bound to the header
  7189. *
  7190. * Dependencies:
  7191. * jquery 1.9.0 + [required] OR jquery 1.7.0 + jquery UI core
  7192. *
  7193. * http://mkoryak.github.io/floatThead/
  7194. *
  7195. * Tested on FF13+, Chrome 21+, IE8, IE9, IE10, IE11
  7196. *
  7197. */
  7198. (function( $ ) {
  7199. /**
  7200. * provides a default config object. You can modify this after including this script if you want to change the init defaults
  7201. * @type {Object}
  7202. */
  7203. $.floatThead = $.floatThead || {};
  7204. $.floatThead.defaults = {
  7205. headerCellSelector: 'tr:visible:first>*:visible', //thead cells are this.
  7206. zIndex: 1001, //zindex of the floating thead (actually a container div)
  7207. position: 'auto', // 'fixed', 'absolute', 'auto'. auto picks the best for your table scrolling type.
  7208. top: 0, //String or function($table) - offset from top of window where the header should not pass above
  7209. bottom: 0, //String or function($table) - offset from the bottom of the table where the header should stop scrolling
  7210. scrollContainer: function($table) { // or boolean 'true' (use offsetParent) | function -> if the table has horizontal scroll bars then this is the container that has overflow:auto and causes those scroll bars
  7211. return $([]);
  7212. },
  7213. responsiveContainer: function($table) { // only valid if scrollContainer is not used (ie window scrolling). this is the container which will control y scrolling at some mobile breakpoints
  7214. return $([]);
  7215. },
  7216. getSizingRow: function($table, $cols, $fthCells){ // this is only called when using IE,
  7217. // override it if the first row of the table is going to contain colgroups (any cell spans greater than one col)
  7218. // it should return a jquery object containing a wrapped set of table cells comprising a row that contains no col spans and is visible
  7219. return $table.find('tbody tr:visible:first>*:visible');
  7220. },
  7221. floatTableClass: 'floatThead-table',
  7222. floatWrapperClass: 'floatThead-wrapper',
  7223. floatContainerClass: 'floatThead-container',
  7224. copyTableClass: true, //copy 'class' attribute from table into the floated table so that the styles match.
  7225. enableAria: false, //will copy header text from the floated header back into the table for screen readers. Might cause the css styling to be off. beware!
  7226. autoReflow: false, //(undocumented) - use MutationObserver api to reflow automatically when internal table DOM changes
  7227. debug: false //print possible issues (that don't prevent script loading) to console, if console exists.
  7228. };
  7229. var util = window._;
  7230. var canObserveMutations = typeof MutationObserver !== 'undefined';
  7231. //browser stuff
  7232. var ieVersion = function(){for(var a=3,b=document.createElement("b"),c=b.all||[];a = 1+a,b.innerHTML="<!--[if gt IE "+ a +"]><i><![endif]-->",c[0];);return 4<a?a:document.documentMode}();
  7233. var isFF = /Gecko\//.test(navigator.userAgent);
  7234. var isWebkit = /WebKit\//.test(navigator.userAgent);
  7235. if(!(ieVersion || isFF || isWebkit)){
  7236. ieVersion = 11; //yey a hack!
  7237. }
  7238. //safari 7 (and perhaps others) reports table width to be parent container's width if max-width is set on table. see: https://github.com/mkoryak/floatThead/issues/108
  7239. var isTableWidthBug = function(){
  7240. if(isWebkit) {
  7241. var $test = $('<div style="width:0px"><table style="max-width:100%"><tr><th><div style="min-width:100px;">X</div></th></tr></table></div>');
  7242. $("body").append($test);
  7243. var ret = ($test.find("table").width() == 0);
  7244. $test.remove();
  7245. return ret;
  7246. }
  7247. return false;
  7248. };
  7249. var createElements = !isFF && !ieVersion; //FF can read width from <col> elements, but webkit cannot
  7250. var $window = $(window);
  7251. if(!window.matchMedia) {
  7252. //these will be used by the plugin to go into print mode (destroy and remake itself)
  7253. var _beforePrint = window.onbeforeprint;
  7254. var _afterPrint = window.onafterprint;
  7255. window.onbeforeprint = function () {
  7256. _beforePrint && _beforePrint();
  7257. $window.triggerHandler("beforeprint");
  7258. };
  7259. window.onafterprint = function () {
  7260. _afterPrint && _afterPrint();
  7261. $window.triggerHandler("afterprint");
  7262. };
  7263. }
  7264. /**
  7265. * @param debounceMs
  7266. * @param cb
  7267. */
  7268. function windowResize(eventName, cb){
  7269. if(ieVersion == 8){ //ie8 is crap: https://github.com/mkoryak/floatThead/issues/65
  7270. var winWidth = $window.width();
  7271. var debouncedCb = util.debounce(function(){
  7272. var winWidthNew = $window.width();
  7273. if(winWidth != winWidthNew){
  7274. winWidth = winWidthNew;
  7275. cb();
  7276. }
  7277. }, 1);
  7278. $window.bind(eventName, debouncedCb);
  7279. } else {
  7280. $window.bind(eventName, util.debounce(cb, 1));
  7281. }
  7282. }
  7283. function getTrueOffsetParent($elem) {
  7284. var elem = $elem[0];
  7285. var parent = elem.offsetParent;
  7286. if (!parent) {
  7287. parent = elem.parentElement;
  7288. do {
  7289. var pos = window
  7290. .getComputedStyle(parent)
  7291. .getPropertyValue('position');
  7292. if (pos != 'static') break;
  7293. if (parent.offsetParent) {
  7294. parent = parent.offsetParent;
  7295. break;
  7296. }
  7297. } while (parent = parent.parentElement)
  7298. }
  7299. if(parent == document.body){
  7300. return $([]);
  7301. }
  7302. return $(parent);
  7303. }
  7304. function debug(str){
  7305. window && window.console && window.console.error && window.console.error("jQuery.floatThead: " + str);
  7306. }
  7307. //returns fractional pixel widths
  7308. function getOffsetWidth(el) {
  7309. var rect = el.getBoundingClientRect();
  7310. return rect.width || rect.right - rect.left;
  7311. }
  7312. /**
  7313. * try to calculate the scrollbar width for your browser/os
  7314. * @return {Number}
  7315. */
  7316. function scrollbarWidth() {
  7317. var $div = $( //borrowed from anti-scroll
  7318. '<div style="width:50px;height:50px;overflow-y:scroll;'
  7319. + 'position:absolute;top:-200px;left:-200px;"><div style="height:100px;width:100%">'
  7320. + '</div>'
  7321. );
  7322. $('body').append($div);
  7323. var w1 = $div.innerWidth();
  7324. var w2 = $('div', $div).innerWidth();
  7325. $div.remove();
  7326. return w1 - w2;
  7327. }
  7328. /**
  7329. * Check if a given table has been datatableized (http://datatables.net)
  7330. * @param $table
  7331. * @return {Boolean}
  7332. */
  7333. function isDatatable($table){
  7334. if($table.dataTableSettings){
  7335. for(var i = 0; i < $table.dataTableSettings.length; i++){
  7336. var table = $table.dataTableSettings[i].nTable;
  7337. if($table[0] == table){
  7338. return true;
  7339. }
  7340. }
  7341. }
  7342. return false;
  7343. }
  7344. function tableWidth($table, $fthCells, isOuter){
  7345. // see: https://github.com/mkoryak/floatThead/issues/108
  7346. var fn = isOuter ? "outerWidth": "width";
  7347. if(isTableWidthBug && $table.css("max-width")){
  7348. var w = 0;
  7349. if(isOuter) {
  7350. w += parseInt($table.css("borderLeft"), 10);
  7351. w += parseInt($table.css("borderRight"), 10);
  7352. }
  7353. for(var i=0; i < $fthCells.length; i++){
  7354. w += $fthCells.get(i).offsetWidth;
  7355. }
  7356. return w;
  7357. } else {
  7358. return $table[fn]();
  7359. }
  7360. }
  7361. $.fn.floatThead = function(map){
  7362. map = map || {};
  7363. if(!util){ //may have been included after the script? lets try to grab it again.
  7364. util = window._ || $.floatThead._;
  7365. if(!util){
  7366. throw new Error("jquery.floatThead-slim.js requires underscore. You should use the non-lite version since you do not have underscore.");
  7367. }
  7368. }
  7369. if(ieVersion < 8){
  7370. return this; //no more crappy browser support.
  7371. }
  7372. var mObs = null; //mutation observer lives in here if we can use it / make it
  7373. if(util.isFunction(isTableWidthBug)) {
  7374. isTableWidthBug = isTableWidthBug();
  7375. }
  7376. if(util.isString(map)){
  7377. var command = map;
  7378. var ret = this;
  7379. this.filter('table').each(function(){
  7380. var $this = $(this);
  7381. var opts = $this.data('floatThead-lazy');
  7382. if(opts){
  7383. $this.floatThead(opts);
  7384. }
  7385. var obj = $this.data('floatThead-attached');
  7386. if(obj && util.isFunction(obj[command])){
  7387. var r = obj[command]();
  7388. if(typeof r !== 'undefined'){
  7389. ret = r;
  7390. }
  7391. }
  7392. });
  7393. return ret;
  7394. }
  7395. var opts = $.extend({}, $.floatThead.defaults || {}, map);
  7396. $.each(map, function(key, val){
  7397. if((!(key in $.floatThead.defaults)) && opts.debug){
  7398. debug("Used ["+key+"] key to init plugin, but that param is not an option for the plugin. Valid options are: "+ (util.keys($.floatThead.defaults)).join(', '));
  7399. }
  7400. });
  7401. if(opts.debug){
  7402. var v = $.fn.jquery.split(".");
  7403. if(parseInt(v[0], 10) == 1 && parseInt(v[1], 10) <= 7){
  7404. debug("jQuery version "+$.fn.jquery+" detected! This plugin supports 1.8 or better, or 1.7.x with jQuery UI 1.8.24 -> http://jqueryui.com/resources/download/jquery-ui-1.8.24.zip")
  7405. }
  7406. }
  7407. this.filter(':not(.'+opts.floatTableClass+')').each(function(){
  7408. var floatTheadId = util.uniqueId();
  7409. var $table = $(this);
  7410. if($table.data('floatThead-attached')){
  7411. return true; //continue the each loop
  7412. }
  7413. if(!$table.is('table')){
  7414. throw new Error('jQuery.floatThead must be run on a table element. ex: $("table").floatThead();');
  7415. }
  7416. canObserveMutations = opts.autoReflow && canObserveMutations; //option defaults to false!
  7417. var $header = $table.children('thead:first');
  7418. var $tbody = $table.children('tbody:first');
  7419. if($header.length == 0 || $tbody.length == 0){
  7420. $table.data('floatThead-lazy', opts);
  7421. $table.unbind("reflow").one('reflow', function(){
  7422. $table.floatThead(opts);
  7423. });
  7424. return;
  7425. }
  7426. if($table.data('floatThead-lazy')){
  7427. $table.unbind("reflow");
  7428. }
  7429. $table.data('floatThead-lazy', false);
  7430. var headerFloated = true;
  7431. var scrollingTop, scrollingBottom;
  7432. var scrollbarOffset = {vertical: 0, horizontal: 0};
  7433. var scWidth = scrollbarWidth();
  7434. var lastColumnCount = 0; //used by columnNum()
  7435. if(opts.scrollContainer === true){
  7436. opts.scrollContainer = getTrueOffsetParent;
  7437. }
  7438. var $scrollContainer = opts.scrollContainer($table) || $([]); //guard against returned nulls
  7439. var locked = $scrollContainer.length > 0;
  7440. var $responsiveContainer = locked ? $([]) : opts.responsiveContainer($table) || $([]);
  7441. var responsive = isResponsiveContainerActive();
  7442. var useAbsolutePositioning = null;
  7443. if(typeof opts.useAbsolutePositioning !== 'undefined'){
  7444. opts.position = 'auto';
  7445. if(opts.useAbsolutePositioning){
  7446. opts.position = opts.useAbsolutePositioning ? 'absolute' : 'fixed';
  7447. }
  7448. debug("option 'useAbsolutePositioning' has been removed in v1.3.0, use `position:'"+opts.position+"'` instead. See docs for more info: http://mkoryak.github.io/floatThead/#options")
  7449. }
  7450. if(typeof opts.scrollingTop !== 'undefined'){
  7451. opts.top = opts.scrollingTop;
  7452. debug("option 'scrollingTop' has been renamed to 'top' in v1.3.0. See docs for more info: http://mkoryak.github.io/floatThead/#options");
  7453. }
  7454. if(typeof opts.scrollingBottom !== 'undefined'){
  7455. opts.bottom = opts.scrollingBottom;
  7456. debug("option 'scrollingBottom' has been renamed to 'bottom' in v1.3.0. See docs for more info: http://mkoryak.github.io/floatThead/#options");
  7457. }
  7458. if (opts.position == 'auto') {
  7459. useAbsolutePositioning = null;
  7460. } else if (opts.position == 'fixed') {
  7461. useAbsolutePositioning = false;
  7462. } else if (opts.position == 'absolute'){
  7463. useAbsolutePositioning = true;
  7464. } else if (opts.debug) {
  7465. debug('Invalid value given to "position" option, valid is "fixed", "absolute" and "auto". You passed: ', opts.position);
  7466. }
  7467. if(useAbsolutePositioning == null){ //defaults: locked=true, !locked=false
  7468. useAbsolutePositioning = locked;
  7469. }
  7470. var $caption = $table.find("caption");
  7471. var haveCaption = $caption.length == 1;
  7472. if(haveCaption){
  7473. var captionAlignTop = ($caption.css("caption-side") || $caption.attr("align") || "top") === "top";
  7474. }
  7475. var $fthGrp = $('<fthfoot style="display:table-footer-group;border-spacing:0;height:0;border-collapse:collapse;visibility:hidden"/>');
  7476. var wrappedContainer = false; //used with absolute positioning enabled. did we need to wrap the scrollContainer/table with a relative div?
  7477. var $wrapper = $([]); //used when absolute positioning enabled - wraps the table and the float container
  7478. var absoluteToFixedOnScroll = ieVersion <= 9 && !locked && useAbsolutePositioning; //on IE using absolute positioning doesn't look good with window scrolling, so we change position to fixed on scroll, and then change it back to absolute when done.
  7479. var $floatTable = $("<table/>");
  7480. var $floatColGroup = $("<colgroup/>");
  7481. var $tableColGroup = $table.children('colgroup:first');
  7482. var existingColGroup = true;
  7483. if($tableColGroup.length == 0){
  7484. $tableColGroup = $("<colgroup/>");
  7485. existingColGroup = false;
  7486. }
  7487. var $fthRow = $('<fthtr style="display:table-row;border-spacing:0;height:0;border-collapse:collapse"/>'); //created unstyled elements (used for sizing the table because chrome can't read <col> width)
  7488. var $floatContainer = $('<div style="overflow: hidden;" aria-hidden="true"></div>');
  7489. var floatTableHidden = false; //this happens when the table is hidden and we do magic when making it visible
  7490. var $newHeader = $("<thead/>");
  7491. var $sizerRow = $('<tr class="size-row"/>');
  7492. var $sizerCells = $([]);
  7493. var $tableCells = $([]); //used for sizing - either $sizerCells or $tableColGroup cols. $tableColGroup cols are only created in chrome for borderCollapse:collapse because of a chrome bug.
  7494. var $headerCells = $([]);
  7495. var $fthCells = $([]); //created elements
  7496. $newHeader.append($sizerRow);
  7497. $table.prepend($tableColGroup);
  7498. if(createElements){
  7499. $fthGrp.append($fthRow);
  7500. $table.append($fthGrp);
  7501. }
  7502. $floatTable.append($floatColGroup);
  7503. $floatContainer.append($floatTable);
  7504. if(opts.copyTableClass){
  7505. $floatTable.attr('class', $table.attr('class'));
  7506. }
  7507. $floatTable.attr({ //copy over some deprecated table attributes that people still like to use. Good thing people don't use colgroups...
  7508. 'cellpadding': $table.attr('cellpadding'),
  7509. 'cellspacing': $table.attr('cellspacing'),
  7510. 'border': $table.attr('border')
  7511. });
  7512. var tableDisplayCss = $table.css('display');
  7513. $floatTable.css({
  7514. 'borderCollapse': $table.css('borderCollapse'),
  7515. 'border': $table.css('border'),
  7516. 'display': tableDisplayCss
  7517. });
  7518. if(tableDisplayCss == 'none'){
  7519. floatTableHidden = true;
  7520. }
  7521. $floatTable.addClass(opts.floatTableClass).css({'margin': 0, 'border-bottom-width': 0}); //must have no margins or you won't be able to click on things under floating table
  7522. if(useAbsolutePositioning){
  7523. var makeRelative = function($container, alwaysWrap){
  7524. var positionCss = $container.css('position');
  7525. var relativeToScrollContainer = (positionCss == "relative" || positionCss == "absolute");
  7526. var $containerWrap = $container;
  7527. if(!relativeToScrollContainer || alwaysWrap){
  7528. var css = {"paddingLeft": $container.css('paddingLeft'), "paddingRight": $container.css('paddingRight')};
  7529. $floatContainer.css(css);
  7530. $containerWrap = $container.data('floatThead-containerWrap') || $container.wrap("<div class='"+opts.floatWrapperClass+"' style='position: relative; clear:both;'></div>").parent();
  7531. $container.data('floatThead-containerWrap', $containerWrap); //multiple tables inside one scrolling container - #242
  7532. wrappedContainer = true;
  7533. }
  7534. return $containerWrap;
  7535. };
  7536. if(locked){
  7537. $wrapper = makeRelative($scrollContainer, true);
  7538. $wrapper.prepend($floatContainer);
  7539. } else {
  7540. $wrapper = makeRelative($table);
  7541. $table.before($floatContainer);
  7542. }
  7543. } else {
  7544. $table.before($floatContainer);
  7545. }
  7546. $floatContainer.css({
  7547. position: useAbsolutePositioning ? 'absolute' : 'fixed',
  7548. marginTop: 0,
  7549. top: useAbsolutePositioning ? 0 : 'auto',
  7550. zIndex: opts.zIndex
  7551. });
  7552. $floatContainer.addClass(opts.floatContainerClass);
  7553. updateScrollingOffsets();
  7554. var layoutFixed = {'table-layout': 'fixed'};
  7555. var layoutAuto = {'table-layout': $table.css('tableLayout') || 'auto'};
  7556. var originalTableWidth = $table[0].style.width || ""; //setting this to auto is bad: #70
  7557. var originalTableMinWidth = $table.css('minWidth') || "";
  7558. function eventName(name){
  7559. return name+'.fth-'+floatTheadId+'.floatTHead'
  7560. }
  7561. function setHeaderHeight(){
  7562. var headerHeight = 0;
  7563. $header.children("tr:visible").each(function(){
  7564. headerHeight += $(this).outerHeight(true);
  7565. });
  7566. if($table.css('border-collapse') == 'collapse') {
  7567. var tableBorderTopHeight = parseInt($table.css('border-top-width'), 10);
  7568. var cellBorderTopHeight = parseInt($table.find("thead tr:first").find(">*:first").css('border-top-width'), 10);
  7569. if(tableBorderTopHeight > cellBorderTopHeight) {
  7570. headerHeight -= (tableBorderTopHeight / 2); //id love to see some docs where this magic recipe is found..
  7571. }
  7572. }
  7573. $sizerRow.outerHeight(headerHeight);
  7574. $sizerCells.outerHeight(headerHeight);
  7575. }
  7576. function setFloatWidth(){
  7577. var tw = tableWidth($table, $fthCells, true);
  7578. var $container = responsive ? $responsiveContainer : $scrollContainer;
  7579. var width = $container.width() || tw;
  7580. var floatContainerWidth = $container.css("overflow-y") != 'hidden' ? width - scrollbarOffset.vertical : width;
  7581. $floatContainer.width(floatContainerWidth);
  7582. if(locked){
  7583. var percent = 100 * tw / (floatContainerWidth);
  7584. $floatTable.css('width', percent+'%');
  7585. } else {
  7586. $floatTable.outerWidth(tw);
  7587. }
  7588. }
  7589. function updateScrollingOffsets(){
  7590. scrollingTop = (util.isFunction(opts.top) ? opts.top($table) : opts.top) || 0;
  7591. scrollingBottom = (util.isFunction(opts.bottom) ? opts.bottom($table) : opts.bottom) || 0;
  7592. }
  7593. /**
  7594. * get the number of columns and also rebuild resizer rows if the count is different than the last count
  7595. */
  7596. function columnNum(){
  7597. var count;
  7598. var $headerColumns = $header.find(opts.headerCellSelector);
  7599. if(existingColGroup){
  7600. count = $tableColGroup.find('col').length;
  7601. } else {
  7602. count = 0;
  7603. $headerColumns.each(function () {
  7604. count += parseInt(($(this).attr('colspan') || 1), 10);
  7605. });
  7606. }
  7607. if(count != lastColumnCount){
  7608. lastColumnCount = count;
  7609. var cells = [], cols = [], psuedo = [], content;
  7610. for(var x = 0; x < count; x++){
  7611. if (opts.enableAria && (content = $headerColumns.eq(x).text()) ) {
  7612. cells.push('<th scope="col" class="floatThead-col">' + content + '</th>');
  7613. } else {
  7614. cells.push('<th class="floatThead-col"/>');
  7615. }
  7616. cols.push('<col/>');
  7617. psuedo.push("<fthtd style='display:table-cell;height:0;width:auto;'/>");
  7618. }
  7619. cols = cols.join('');
  7620. cells = cells.join('');
  7621. if(createElements){
  7622. psuedo = psuedo.join('');
  7623. $fthRow.html(psuedo);
  7624. $fthCells = $fthRow.find('fthtd');
  7625. }
  7626. $sizerRow.html(cells);
  7627. $sizerCells = $sizerRow.find("th");
  7628. if(!existingColGroup){
  7629. $tableColGroup.html(cols);
  7630. }
  7631. $tableCells = $tableColGroup.find('col');
  7632. $floatColGroup.html(cols);
  7633. $headerCells = $floatColGroup.find("col");
  7634. }
  7635. return count;
  7636. }
  7637. function refloat(){ //make the thing float
  7638. if(!headerFloated){
  7639. headerFloated = true;
  7640. if(useAbsolutePositioning){ //#53, #56
  7641. var tw = tableWidth($table, $fthCells, true);
  7642. var wrapperWidth = $wrapper.width();
  7643. if(tw > wrapperWidth){
  7644. $table.css('minWidth', tw);
  7645. }
  7646. }
  7647. $table.css(layoutFixed);
  7648. $floatTable.css(layoutFixed);
  7649. $floatTable.append($header); //append because colgroup must go first in chrome
  7650. $tbody.before($newHeader);
  7651. setHeaderHeight();
  7652. }
  7653. }
  7654. function unfloat(){ //put the header back into the table
  7655. if(headerFloated){
  7656. headerFloated = false;
  7657. if(useAbsolutePositioning){ //#53, #56
  7658. $table.width(originalTableWidth);
  7659. }
  7660. $newHeader.detach();
  7661. $table.prepend($header);
  7662. $table.css(layoutAuto);
  7663. $floatTable.css(layoutAuto);
  7664. $table.css('minWidth', originalTableMinWidth); //this looks weird, but it's not a bug. Think about it!!
  7665. $table.css('minWidth', tableWidth($table, $fthCells)); //#121
  7666. }
  7667. }
  7668. var isHeaderFloatingLogical = false; //for the purpose of this event, the header is/isnt floating, even though the element
  7669. //might be in some other state. this is what the header looks like to the user
  7670. function triggerFloatEvent(isFloating){
  7671. if(isHeaderFloatingLogical != isFloating){
  7672. isHeaderFloatingLogical = isFloating;
  7673. $table.triggerHandler("floatThead", [isFloating, $floatContainer])
  7674. }
  7675. }
  7676. function changePositioning(isAbsolute){
  7677. if(useAbsolutePositioning != isAbsolute){
  7678. useAbsolutePositioning = isAbsolute;
  7679. $floatContainer.css({
  7680. position: useAbsolutePositioning ? 'absolute' : 'fixed'
  7681. });
  7682. }
  7683. }
  7684. function getSizingRow($table, $cols, $fthCells, ieVersion){
  7685. if(createElements){
  7686. return $fthCells;
  7687. } else if(ieVersion) {
  7688. return opts.getSizingRow($table, $cols, $fthCells);
  7689. } else {
  7690. return $cols;
  7691. }
  7692. }
  7693. /**
  7694. * returns a function that updates the floating header's cell widths.
  7695. * @return {Function}
  7696. */
  7697. function reflow(){
  7698. var i;
  7699. var numCols = columnNum(); //if the tables columns changed dynamically since last time (datatables), rebuild the sizer rows and get a new count
  7700. return function(){
  7701. $tableCells = $tableColGroup.find('col');
  7702. var $rowCells = getSizingRow($table, $tableCells, $fthCells, ieVersion);
  7703. if($rowCells.length == numCols && numCols > 0){
  7704. if(!existingColGroup){
  7705. for(i=0; i < numCols; i++){
  7706. $tableCells.eq(i).css('width', '');
  7707. }
  7708. }
  7709. unfloat();
  7710. var widths = [];
  7711. for(i=0; i < numCols; i++){
  7712. widths[i] = getOffsetWidth($rowCells.get(i));
  7713. }
  7714. for(i=0; i < numCols; i++){
  7715. $headerCells.eq(i).width(widths[i]);
  7716. $tableCells.eq(i).width(widths[i]);
  7717. }
  7718. refloat();
  7719. } else {
  7720. $floatTable.append($header);
  7721. $table.css(layoutAuto);
  7722. $floatTable.css(layoutAuto);
  7723. setHeaderHeight();
  7724. }
  7725. $table.triggerHandler("reflowed", [$floatContainer]);
  7726. };
  7727. }
  7728. function floatContainerBorderWidth(side){
  7729. var border = $scrollContainer.css("border-"+side+"-width");
  7730. var w = 0;
  7731. if (border && ~border.indexOf('px')) {
  7732. w = parseInt(border, 10);
  7733. }
  7734. return w;
  7735. }
  7736. function isResponsiveContainerActive(){
  7737. return $responsiveContainer.css("overflow-x") == 'auto';
  7738. }
  7739. /**
  7740. * first performs initial calculations that we expect to not change when the table, window, or scrolling container are scrolled.
  7741. * returns a function that calculates the floating container's top and left coords. takes into account if we are using page scrolling or inner scrolling
  7742. * @return {Function}
  7743. */
  7744. function calculateFloatContainerPosFn(){
  7745. var scrollingContainerTop = $scrollContainer.scrollTop();
  7746. //this floatEnd calc was moved out of the returned function because we assume the table height doesn't change (otherwise we must reinit by calling calculateFloatContainerPosFn)
  7747. var floatEnd;
  7748. var tableContainerGap = 0;
  7749. var captionHeight = haveCaption ? $caption.outerHeight(true) : 0;
  7750. var captionScrollOffset = captionAlignTop ? captionHeight : -captionHeight;
  7751. var floatContainerHeight = $floatContainer.height();
  7752. var tableOffset = $table.offset();
  7753. var tableLeftGap = 0; //can be caused by border on container (only in locked mode)
  7754. var tableTopGap = 0;
  7755. if(locked){
  7756. var containerOffset = $scrollContainer.offset();
  7757. tableContainerGap = tableOffset.top - containerOffset.top + scrollingContainerTop;
  7758. if(haveCaption && captionAlignTop){
  7759. tableContainerGap += captionHeight;
  7760. }
  7761. tableLeftGap = floatContainerBorderWidth('left');
  7762. tableTopGap = floatContainerBorderWidth('top');
  7763. tableContainerGap -= tableTopGap;
  7764. } else {
  7765. floatEnd = tableOffset.top - scrollingTop - floatContainerHeight + scrollingBottom + scrollbarOffset.horizontal;
  7766. }
  7767. var windowTop = $window.scrollTop();
  7768. var windowLeft = $window.scrollLeft();
  7769. var scrollContainerLeft = (isResponsiveContainerActive() ? $responsiveContainer : $scrollContainer).scrollLeft();
  7770. return function(eventType){
  7771. responsive = isResponsiveContainerActive();
  7772. var isTableHidden = $table[0].offsetWidth <= 0 && $table[0].offsetHeight <= 0;
  7773. if(!isTableHidden && floatTableHidden) {
  7774. floatTableHidden = false;
  7775. setTimeout(function(){
  7776. $table.triggerHandler("reflow");
  7777. }, 1);
  7778. return null;
  7779. }
  7780. if(isTableHidden){ //it's hidden
  7781. floatTableHidden = true;
  7782. if(!useAbsolutePositioning){
  7783. return null;
  7784. }
  7785. }
  7786. if(eventType == 'windowScroll'){
  7787. windowTop = $window.scrollTop();
  7788. windowLeft = $window.scrollLeft();
  7789. } else if(eventType == 'containerScroll'){
  7790. if($responsiveContainer.length){
  7791. if(!responsive){
  7792. return; //we dont care about the event if we arent responsive right now
  7793. }
  7794. scrollContainerLeft = $responsiveContainer.scrollLeft();
  7795. } else {
  7796. scrollingContainerTop = $scrollContainer.scrollTop();
  7797. scrollContainerLeft = $scrollContainer.scrollLeft();
  7798. }
  7799. } else if(eventType != 'init') {
  7800. windowTop = $window.scrollTop();
  7801. windowLeft = $window.scrollLeft();
  7802. scrollingContainerTop = $scrollContainer.scrollTop();
  7803. scrollContainerLeft = (responsive ? $responsiveContainer : $scrollContainer).scrollLeft();
  7804. }
  7805. if(isWebkit && (windowTop < 0 || windowLeft < 0)){ //chrome overscroll effect at the top of the page - breaks fixed positioned floated headers
  7806. return;
  7807. }
  7808. if(absoluteToFixedOnScroll){
  7809. if(eventType == 'windowScrollDone'){
  7810. changePositioning(true); //change to absolute
  7811. } else {
  7812. changePositioning(false); //change to fixed
  7813. }
  7814. } else if(eventType == 'windowScrollDone'){
  7815. return null; //event is fired when they stop scrolling. ignore it if not 'absoluteToFixedOnScroll'
  7816. }
  7817. tableOffset = $table.offset();
  7818. if(haveCaption && captionAlignTop){
  7819. tableOffset.top += captionHeight;
  7820. }
  7821. var top, left;
  7822. var tableHeight = $table.outerHeight();
  7823. if(locked && useAbsolutePositioning){ //inner scrolling, absolute positioning
  7824. if (tableContainerGap >= scrollingContainerTop) {
  7825. var gap = tableContainerGap - scrollingContainerTop + tableTopGap;
  7826. top = gap > 0 ? gap : 0;
  7827. triggerFloatEvent(false);
  7828. } else {
  7829. top = wrappedContainer ? tableTopGap : scrollingContainerTop;
  7830. //headers stop at the top of the viewport
  7831. triggerFloatEvent(true);
  7832. }
  7833. left = tableLeftGap;
  7834. } else if(!locked && useAbsolutePositioning) { //window scrolling, absolute positioning
  7835. if(windowTop > floatEnd + tableHeight + captionScrollOffset){
  7836. top = tableHeight - floatContainerHeight + captionScrollOffset; //scrolled past table
  7837. } else if (tableOffset.top >= windowTop + scrollingTop) {
  7838. top = 0; //scrolling to table
  7839. unfloat();
  7840. triggerFloatEvent(false);
  7841. } else {
  7842. top = scrollingTop + windowTop - tableOffset.top + tableContainerGap + (captionAlignTop ? captionHeight : 0);
  7843. refloat(); //scrolling within table. header floated
  7844. triggerFloatEvent(true);
  7845. }
  7846. left = scrollContainerLeft;
  7847. } else if(locked && !useAbsolutePositioning){ //inner scrolling, fixed positioning
  7848. if (tableContainerGap > scrollingContainerTop || scrollingContainerTop - tableContainerGap > tableHeight) {
  7849. top = tableOffset.top - windowTop;
  7850. unfloat();
  7851. triggerFloatEvent(false);
  7852. } else {
  7853. top = tableOffset.top + scrollingContainerTop - windowTop - tableContainerGap;
  7854. refloat();
  7855. triggerFloatEvent(true);
  7856. //headers stop at the top of the viewport
  7857. }
  7858. left = tableOffset.left + scrollContainerLeft - windowLeft;
  7859. } else if(!locked && !useAbsolutePositioning) { //window scrolling, fixed positioning
  7860. if(windowTop > floatEnd + tableHeight + captionScrollOffset){
  7861. top = tableHeight + scrollingTop - windowTop + floatEnd + captionScrollOffset;
  7862. //scrolled past the bottom of the table
  7863. } else if (tableOffset.top > windowTop + scrollingTop) {
  7864. top = tableOffset.top - windowTop;
  7865. refloat();
  7866. triggerFloatEvent(false); //this is a weird case, the header never gets unfloated and i have no no way to know
  7867. //scrolled past the top of the table
  7868. } else {
  7869. //scrolling within the table
  7870. top = scrollingTop;
  7871. triggerFloatEvent(true);
  7872. }
  7873. left = tableOffset.left + scrollContainerLeft - windowLeft;
  7874. }
  7875. return {top: top, left: left};
  7876. };
  7877. }
  7878. /**
  7879. * returns a function that caches old floating container position and only updates css when the position changes
  7880. * @return {Function}
  7881. */
  7882. function repositionFloatContainerFn(){
  7883. var oldTop = null;
  7884. var oldLeft = null;
  7885. var oldScrollLeft = null;
  7886. return function(pos, setWidth, setHeight){
  7887. if(pos != null && (oldTop != pos.top || oldLeft != pos.left)){
  7888. $floatContainer.css({
  7889. top: pos.top,
  7890. left: pos.left
  7891. });
  7892. oldTop = pos.top;
  7893. oldLeft = pos.left;
  7894. }
  7895. if(setWidth){
  7896. setFloatWidth();
  7897. }
  7898. if(setHeight){
  7899. setHeaderHeight();
  7900. }
  7901. var scrollLeft = (responsive ? $responsiveContainer : $scrollContainer).scrollLeft();
  7902. if(!useAbsolutePositioning || oldScrollLeft != scrollLeft){
  7903. $floatContainer.scrollLeft(scrollLeft);
  7904. oldScrollLeft = scrollLeft;
  7905. }
  7906. }
  7907. }
  7908. /**
  7909. * checks if THIS table has scrollbars, and finds their widths
  7910. */
  7911. function calculateScrollBarSize(){ //this should happen after the floating table has been positioned
  7912. if($scrollContainer.length){
  7913. if($scrollContainer.data().perfectScrollbar){
  7914. scrollbarOffset = {horizontal:0, vertical:0};
  7915. } else {
  7916. var sw = $scrollContainer.width(), sh = $scrollContainer.height(), th = $table.height(), tw = tableWidth($table, $fthCells);
  7917. var offseth = sw < tw ? scWidth : 0;
  7918. var offsetv = sh < th ? scWidth : 0;
  7919. scrollbarOffset.horizontal = sw - offsetv < tw ? scWidth : 0;
  7920. scrollbarOffset.vertical = sh - offseth < th ? scWidth : 0;
  7921. }
  7922. }
  7923. }
  7924. //finish up. create all calculation functions and bind them to events
  7925. calculateScrollBarSize();
  7926. var flow;
  7927. var ensureReflow = function(){
  7928. flow = reflow();
  7929. flow();
  7930. };
  7931. ensureReflow();
  7932. var calculateFloatContainerPos = calculateFloatContainerPosFn();
  7933. var repositionFloatContainer = repositionFloatContainerFn();
  7934. repositionFloatContainer(calculateFloatContainerPos('init'), true); //this must come after reflow because reflow changes scrollLeft back to 0 when it rips out the thead
  7935. var windowScrollDoneEvent = util.debounce(function(){
  7936. repositionFloatContainer(calculateFloatContainerPos('windowScrollDone'), false);
  7937. }, 1);
  7938. var windowScrollEvent = function(){
  7939. repositionFloatContainer(calculateFloatContainerPos('windowScroll'), false);
  7940. if(absoluteToFixedOnScroll){
  7941. windowScrollDoneEvent();
  7942. }
  7943. };
  7944. var containerScrollEvent = function(){
  7945. repositionFloatContainer(calculateFloatContainerPos('containerScroll'), false);
  7946. };
  7947. var windowResizeEvent = function(){
  7948. if($table.is(":hidden")){
  7949. return;
  7950. }
  7951. updateScrollingOffsets();
  7952. calculateScrollBarSize();
  7953. ensureReflow();
  7954. calculateFloatContainerPos = calculateFloatContainerPosFn();
  7955. repositionFloatContainer = repositionFloatContainerFn();
  7956. repositionFloatContainer(calculateFloatContainerPos('resize'), true, true);
  7957. };
  7958. var reflowEvent = util.debounce(function(){
  7959. if($table.is(":hidden")){
  7960. return;
  7961. }
  7962. calculateScrollBarSize();
  7963. updateScrollingOffsets();
  7964. ensureReflow();
  7965. calculateFloatContainerPos = calculateFloatContainerPosFn();
  7966. repositionFloatContainer(calculateFloatContainerPos('reflow'), true);
  7967. }, 1);
  7968. /////// printing stuff
  7969. var beforePrint = function(){
  7970. $table.floatThead('destroy', [true]);
  7971. };
  7972. var afterPrint = function(){
  7973. $table.floatThead(opts);
  7974. };
  7975. var printEvent = function(mql){
  7976. //make printing the table work properly on IE10+
  7977. if(mql.matches) {
  7978. beforePrint();
  7979. } else {
  7980. afterPrint();
  7981. }
  7982. };
  7983. if(window.matchMedia){
  7984. window.matchMedia("print").addListener(printEvent);
  7985. } else {
  7986. $window.bind('beforeprint', beforePrint);
  7987. $window.bind('afterprint', afterPrint);
  7988. }
  7989. ////// end printing stuff
  7990. if(locked){ //internal scrolling
  7991. if(useAbsolutePositioning){
  7992. $scrollContainer.bind(eventName('scroll'), containerScrollEvent);
  7993. } else {
  7994. $scrollContainer.bind(eventName('scroll'), containerScrollEvent);
  7995. $window.bind(eventName('scroll'), windowScrollEvent);
  7996. }
  7997. } else { //window scrolling
  7998. $responsiveContainer.bind(eventName('scroll'), containerScrollEvent);
  7999. $window.bind(eventName('scroll'), windowScrollEvent);
  8000. }
  8001. $window.bind(eventName('load'), reflowEvent); //for tables with images
  8002. windowResize(eventName('resize'), windowResizeEvent);
  8003. $table.bind('reflow', reflowEvent);
  8004. if(isDatatable($table)){
  8005. $table
  8006. .bind('filter', reflowEvent)
  8007. .bind('sort', reflowEvent)
  8008. .bind('page', reflowEvent);
  8009. }
  8010. $window.bind(eventName('shown.bs.tab'), reflowEvent); // people cant seem to figure out how to use this plugin with bs3 tabs... so this :P
  8011. $window.bind(eventName('tabsactivate'), reflowEvent); // same thing for jqueryui
  8012. if (canObserveMutations) {
  8013. var mutationElement = null;
  8014. if(util.isFunction(opts.autoReflow)){
  8015. mutationElement = opts.autoReflow($table, $scrollContainer)
  8016. }
  8017. if(!mutationElement) {
  8018. mutationElement = $scrollContainer.length ? $scrollContainer[0] : $table[0]
  8019. }
  8020. mObs = new MutationObserver(function(e){
  8021. var wasTableRelated = function(nodes){
  8022. return nodes && nodes[0] && (nodes[0].nodeName == "THEAD" || nodes[0].nodeName == "TD"|| nodes[0].nodeName == "TH");
  8023. };
  8024. for(var i=0; i < e.length; i++){
  8025. if(!(wasTableRelated(e[i].addedNodes) || wasTableRelated(e[i].removedNodes))){
  8026. reflowEvent();
  8027. break;
  8028. }
  8029. }
  8030. });
  8031. mObs.observe(mutationElement, {
  8032. childList: true,
  8033. subtree: true
  8034. });
  8035. }
  8036. //attach some useful functions to the table.
  8037. $table.data('floatThead-attached', {
  8038. destroy: function(e, isPrintEvent){
  8039. var ns = '.fth-'+floatTheadId;
  8040. unfloat();
  8041. $table.css(layoutAuto);
  8042. $tableColGroup.remove();
  8043. createElements && $fthGrp.remove();
  8044. if($newHeader.parent().length){ //only if it's in the DOM
  8045. $newHeader.replaceWith($header);
  8046. }
  8047. triggerFloatEvent(false);
  8048. if(canObserveMutations){
  8049. mObs.disconnect();
  8050. mObs = null;
  8051. }
  8052. $table.unbind('reflow reflowed');
  8053. $scrollContainer.unbind(ns);
  8054. $responsiveContainer.unbind(ns);
  8055. if (wrappedContainer) {
  8056. if ($scrollContainer.length) {
  8057. $scrollContainer.unwrap();
  8058. }
  8059. else {
  8060. $table.unwrap();
  8061. }
  8062. }
  8063. if(locked){
  8064. $scrollContainer.data('floatThead-containerWrap', false);
  8065. } else {
  8066. $table.data('floatThead-containerWrap', false);
  8067. }
  8068. $table.css('minWidth', originalTableMinWidth);
  8069. $floatContainer.remove();
  8070. $table.data('floatThead-attached', false);
  8071. $window.unbind(ns);
  8072. if(!isPrintEvent){
  8073. //if we are in the middle of printing, we want this event to re-create the plugin
  8074. window.matchMedia && window.matchMedia("print").removeListener(printEvent);
  8075. beforePrint = afterPrint = function(){};
  8076. }
  8077. },
  8078. reflow: function(){
  8079. reflowEvent();
  8080. },
  8081. setHeaderHeight: function(){
  8082. setHeaderHeight();
  8083. },
  8084. getFloatContainer: function(){
  8085. return $floatContainer;
  8086. },
  8087. getRowGroups: function(){
  8088. if(headerFloated){
  8089. return $floatContainer.find('>table>thead').add($table.children("tbody,tfoot"));
  8090. } else {
  8091. return $table.children("thead,tbody,tfoot");
  8092. }
  8093. }
  8094. });
  8095. });
  8096. return this;
  8097. };
  8098. })(jQuery);
  8099. /* jQuery.floatThead.utils - http://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2014 Misha Koryak
  8100. * License: MIT
  8101. *
  8102. * This file is required if you do not use underscore in your project and you want to use floatThead.
  8103. * It contains functions from underscore that the plugin uses.
  8104. *
  8105. * YOU DON'T NEED TO INCLUDE THIS IF YOU ALREADY INCLUDE UNDERSCORE!
  8106. *
  8107. */
  8108. (function($){
  8109. $.floatThead = $.floatThead || {};
  8110. $.floatThead._ = window._ || (function(){
  8111. var that = {};
  8112. var hasOwnProperty = Object.prototype.hasOwnProperty, isThings = ['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'];
  8113. that.has = function(obj, key) {
  8114. return hasOwnProperty.call(obj, key);
  8115. };
  8116. that.keys = function(obj) {
  8117. if (obj !== Object(obj)) throw new TypeError('Invalid object');
  8118. var keys = [];
  8119. for (var key in obj) if (that.has(obj, key)) keys.push(key);
  8120. return keys;
  8121. };
  8122. var idCounter = 0;
  8123. that.uniqueId = function(prefix) {
  8124. var id = ++idCounter + '';
  8125. return prefix ? prefix + id : id;
  8126. };
  8127. $.each(isThings, function(){
  8128. var name = this;
  8129. that['is' + name] = function(obj) {
  8130. return Object.prototype.toString.call(obj) == '[object ' + name + ']';
  8131. };
  8132. });
  8133. that.debounce = function(func, wait, immediate) {
  8134. var timeout, args, context, timestamp, result;
  8135. return function() {
  8136. context = this;
  8137. args = arguments;
  8138. timestamp = new Date();
  8139. var later = function() {
  8140. var last = (new Date()) - timestamp;
  8141. if (last < wait) {
  8142. timeout = setTimeout(later, wait - last);
  8143. } else {
  8144. timeout = null;
  8145. if (!immediate) result = func.apply(context, args);
  8146. }
  8147. };
  8148. var callNow = immediate && !timeout;
  8149. if (!timeout) {
  8150. timeout = setTimeout(later, wait);
  8151. }
  8152. if (callNow) result = func.apply(context, args);
  8153. return result;
  8154. };
  8155. };
  8156. return that;
  8157. })();
  8158. })(jQuery);
  8159. /*************************************************************************
  8160. jquery.dynatree.js
  8161. Dynamic tree view control, with support for lazy loading of branches.
  8162. Copyright (c) 2008-2010, Martin Wendt (http://wwWendt.de)
  8163. Dual licensed under the MIT or GPL Version 2 licenses.
  8164. http://code.google.com/p/dynatree/wiki/LicenseInfo
  8165. A current version and some documentation is available at
  8166. http://dynatree.googlecode.com/
  8167. $Version: 0.5.4$
  8168. $Revision: 329, 2010-05-05 08:04:39$
  8169. @depends: jquery.js
  8170. @depends: ui.core.js
  8171. @depends: jquery.cookie.js
  8172. *************************************************************************/
  8173. /*************************************************************************
  8174. * Debug functions
  8175. */
  8176. var _canLog = true;
  8177. function _log(mode, msg) {
  8178. /**
  8179. * Usage: logMsg("%o was toggled", this);
  8180. */
  8181. if( !_canLog )
  8182. return;
  8183. // Remove first argument
  8184. var args = Array.prototype.slice.apply(arguments, [1]);
  8185. // Prepend timestamp
  8186. var dt = new Date();
  8187. var tag = dt.getHours()+":"+dt.getMinutes()+":"+dt.getSeconds()+"."+dt.getMilliseconds();
  8188. args[0] = tag + " - " + args[0];
  8189. try {
  8190. switch( mode ) {
  8191. case "info":
  8192. window.console.info.apply(window.console, args);
  8193. break;
  8194. case "warn":
  8195. window.console.warn.apply(window.console, args);
  8196. break;
  8197. default:
  8198. window.console.log.apply(window.console, args);
  8199. }
  8200. } catch(e) {
  8201. if( !window.console )
  8202. _canLog = false; // Permanently disable, when logging is not supported by the browser
  8203. }
  8204. }
  8205. function logMsg(msg) {
  8206. Array.prototype.unshift.apply(arguments, ["debug"]);
  8207. _log.apply(this, arguments);
  8208. }
  8209. // Forward declaration
  8210. var getDynaTreePersistData = undefined;
  8211. /*************************************************************************
  8212. * Constants
  8213. */
  8214. var DTNodeStatus_Error = -1;
  8215. var DTNodeStatus_Loading = 1;
  8216. var DTNodeStatus_Ok = 0;
  8217. // Start of local namespace
  8218. ;(function($) {
  8219. /*************************************************************************
  8220. * Common tool functions.
  8221. */
  8222. var Class = {
  8223. create: function() {
  8224. return function() {
  8225. this.initialize.apply(this, arguments);
  8226. }
  8227. }
  8228. }
  8229. /*************************************************************************
  8230. * Class DynaTreeNode
  8231. */
  8232. var DynaTreeNode = Class.create();
  8233. DynaTreeNode.prototype = {
  8234. initialize: function(parent, tree, data) {
  8235. /**
  8236. * @constructor
  8237. */
  8238. this.parent = parent;
  8239. this.tree = tree;
  8240. if ( typeof data == "string" )
  8241. data = { title: data };
  8242. if( data.key == undefined )
  8243. data.key = "_" + tree._nodeCount++;
  8244. this.data = $.extend({}, $.ui.dynatree.nodedatadefaults, data);
  8245. this.div = null; // not yet created
  8246. this.span = null; // not yet created
  8247. this.childList = null; // no subnodes yet
  8248. // this.isRead = false; // Lazy content not yet read
  8249. this.isLoading = false; // Lazy content is being loaded
  8250. this.hasSubSel = false;
  8251. },
  8252. toString: function() {
  8253. return "dtnode<" + this.data.key + ">: '" + this.data.title + "'";
  8254. },
  8255. toDict: function(recursive, callback) {
  8256. var dict = $.extend({}, this.data);
  8257. dict.activate = ( this.tree.activeNode === this );
  8258. dict.focus = ( this.tree.focusNode === this );
  8259. dict.expand = this.bExpanded;
  8260. dict.select = this.bSelected;
  8261. if( callback )
  8262. callback(dict);
  8263. if( recursive && this.childList ) {
  8264. dict.children = [];
  8265. for(var i=0; i<this.childList.length; i++ )
  8266. dict.children.push(this.childList[i].toDict(true, callback));
  8267. } else {
  8268. delete dict.children;
  8269. }
  8270. return dict;
  8271. },
  8272. _getInnerHtml: function() {
  8273. var opts = this.tree.options;
  8274. var cache = this.tree.cache;
  8275. // parent connectors
  8276. var rootParent = opts.rootVisible ? null : this.tree.tnRoot;
  8277. var bHideFirstExpander = (opts.rootVisible && opts.minExpandLevel>0) || opts.minExpandLevel>1;
  8278. var bHideFirstConnector = opts.rootVisible || opts.minExpandLevel>0;
  8279. var res = "";
  8280. var p = this.parent;
  8281. while( p ) {
  8282. // Suppress first connector column, if visible top level is always expanded
  8283. if ( bHideFirstConnector && p==rootParent )
  8284. break;
  8285. res = ( p.isLastSibling() ? cache.tagEmpty : cache.tagVline) + res;
  8286. p = p.parent;
  8287. }
  8288. //@modify liguocai 2011-11-30 让顶层元素也有展开收缩的功能
  8289. // connector (expanded, expandable or simple)
  8290. //if( bHideFirstExpander && this.parent==rootParent ) {
  8291. // skip connector
  8292. //} else
  8293. if ( this.childList || this.data.isLazy ) {
  8294. res += cache.tagExpander;
  8295. } else {
  8296. res += cache.tagConnector;
  8297. }
  8298. // Checkbox mode
  8299. if( opts.checkbox && this.data.hideCheckbox!=true && !this.data.isStatusNode ) {
  8300. res += cache.tagCheckbox;
  8301. }
  8302. // folder or doctype icon
  8303. if ( this.data.icon ) {
  8304. res += "<img src='" + opts.imagePath + this.data.icon + "' alt='' />";
  8305. } else if ( this.data.icon == false ) {
  8306. // icon == false means 'no icon'
  8307. } else {
  8308. // icon == null means 'default icon'
  8309. res += cache.tagNodeIcon;
  8310. }
  8311. // node name
  8312. var tooltip = ( this.data && typeof this.data.tooltip == "string" ) ? " title='" + this.data.tooltip + "'" : "";
  8313. res += "<a href='#' class='" + opts.classNames.title + "'" + tooltip + ">" + this.data.title + "</a>";
  8314. return res;
  8315. },
  8316. _fixOrder: function() {
  8317. /**
  8318. * Make sure, that <div> order matches childList order.
  8319. */
  8320. var cl = this.childList;
  8321. if( !cl )
  8322. return;
  8323. var childDiv = this.div.firstChild.nextSibling;
  8324. for(var i=0; i<cl.length-1; i++) {
  8325. var childNode1 = cl[i];
  8326. var childNode2 = childDiv.firstChild.dtnode;
  8327. if( childNode1 !== childNode2 ) {
  8328. this.tree.logDebug("_fixOrder: mismatch at index " + i + ": " + childNode1 + " != " + childNode2);
  8329. this.div.insertBefore(childNode1.div, childNode2.div);
  8330. } else {
  8331. childDiv = childDiv.nextSibling;
  8332. }
  8333. }
  8334. },
  8335. render: function(bDeep, bHidden) {
  8336. /**
  8337. * Create HTML markup for this node.
  8338. *
  8339. * <div> // This div contains the node's span and list of child div's.
  8340. * <span id='key'>S S S A</span> // Span contains graphic spans and title <a> tag
  8341. * <div>child1</div>
  8342. * <div>child2</div>
  8343. * </div>
  8344. */
  8345. // this.tree.logDebug("%o.render()", this);
  8346. var opts = this.tree.options;
  8347. var cn = opts.classNames;
  8348. var isLastSib = this.isLastSibling();
  8349. // ---
  8350. if( ! this.div ) {
  8351. this.span = document.createElement("span");
  8352. this.span.dtnode = this;
  8353. if( this.data.key )
  8354. this.span.id = this.tree.options.idPrefix + this.data.key;
  8355. this.div = document.createElement("div");
  8356. this.div.appendChild(this.span);
  8357. if ( this.parent ) {
  8358. this.parent.div.appendChild(this.div);
  8359. }
  8360. if( this.parent==null && !this.tree.options.rootVisible )
  8361. this.span.style.display = "none";
  8362. }
  8363. // set node connector images, links and text
  8364. this.span.innerHTML = this._getInnerHtml();
  8365. // hide this node, if parent is collapsed
  8366. this.div.style.display = ( this.parent==null || this.parent.bExpanded ? "" : "none");
  8367. // Set classes for current status
  8368. var cnList = [];
  8369. cnList.push( ( this.data.isFolder ) ? cn.folder : cn.document );
  8370. if( this.bExpanded )
  8371. cnList.push(cn.expanded);
  8372. if( this.childList != null )
  8373. cnList.push(cn.hasChildren);
  8374. if( this.data.isLazy && this.childList==null )
  8375. cnList.push(cn.lazy);
  8376. if( isLastSib )
  8377. cnList.push(cn.lastsib);
  8378. if( this.bSelected )
  8379. cnList.push(cn.selected);
  8380. if( this.hasSubSel )
  8381. cnList.push(cn.partsel);
  8382. if( this.tree.activeNode === this )
  8383. cnList.push(cn.active);
  8384. if( this.data.addClass )
  8385. cnList.push(this.data.addClass);
  8386. // IE6 doesn't correctly evaluate multiple class names,
  8387. // so we create combined class names that can be used in the CSS
  8388. cnList.push(cn.combinedExpanderPrefix
  8389. + (this.bExpanded ? "e" : "c")
  8390. + (this.data.isLazy && this.childList==null ? "d" : "")
  8391. + (isLastSib ? "l" : "")
  8392. );
  8393. cnList.push(cn.combinedIconPrefix
  8394. + (this.bExpanded ? "e" : "c")
  8395. + (this.data.isFolder ? "f" : "")
  8396. );
  8397. this.span.className = cnList.join(" ");
  8398. if( bDeep && this.childList && (bHidden || this.bExpanded) ) {
  8399. for(var i=0; i<this.childList.length; i++) {
  8400. this.childList[i].render(bDeep, bHidden)
  8401. }
  8402. this._fixOrder();
  8403. }
  8404. },
  8405. hasChildren: function() {
  8406. return this.childList != null;
  8407. },
  8408. isLastSibling: function() {
  8409. var p = this.parent;
  8410. if ( !p ) return true;
  8411. return p.childList[p.childList.length-1] === this;
  8412. },
  8413. prevSibling: function() {
  8414. if( !this.parent ) return null;
  8415. var ac = this.parent.childList;
  8416. for(var i=1; i<ac.length; i++) // start with 1, so prev(first) = null
  8417. if( ac[i] === this )
  8418. return ac[i-1];
  8419. return null;
  8420. },
  8421. nextSibling: function() {
  8422. if( !this.parent ) return null;
  8423. var ac = this.parent.childList;
  8424. for(var i=0; i<ac.length-1; i++) // up to length-2, so next(last) = null
  8425. if( ac[i] === this )
  8426. return ac[i+1];
  8427. return null;
  8428. },
  8429. _setStatusNode: function(data) {
  8430. // Create, modify or remove the status child node (pass 'null', to remove it).
  8431. var firstChild = ( this.childList ? this.childList[0] : null );
  8432. if( !data ) {
  8433. if ( firstChild ) {
  8434. this.div.removeChild(firstChild.div);
  8435. if( this.childList.length == 1 )
  8436. this.childList = null;
  8437. else
  8438. this.childList.shift();
  8439. }
  8440. } else if ( firstChild ) {
  8441. data.isStatusNode = true;
  8442. firstChild.data = data;
  8443. firstChild.render(false, false);
  8444. } else {
  8445. data.isStatusNode = true;
  8446. firstChild = this.addChild(data);
  8447. }
  8448. },
  8449. setLazyNodeStatus: function(lts, opts) {
  8450. var tooltip = (opts && opts.tooltip) ? opts.tooltip : null;
  8451. var info = (opts && opts.info) ? " (" + opts.info + ")" : "";
  8452. switch( lts ) {
  8453. case DTNodeStatus_Ok:
  8454. this._setStatusNode(null);
  8455. // this.isRead = true;
  8456. this.isLoading = false;
  8457. this.render(false, false);
  8458. if( this.tree.options.autoFocus ) {
  8459. if( this === this.tree.tnRoot && !this.tree.options.rootVisible && this.childList ) {
  8460. // special case: using ajaxInit
  8461. this.childList[0].focus();
  8462. } else {
  8463. this.focus();
  8464. }
  8465. }
  8466. break;
  8467. case DTNodeStatus_Loading:
  8468. this.isLoading = true;
  8469. this._setStatusNode({
  8470. title: this.tree.options.strings.loading + info,
  8471. tooltip: tooltip,
  8472. addClass: this.tree.options.classNames.nodeWait
  8473. });
  8474. break;
  8475. case DTNodeStatus_Error:
  8476. this.isLoading = false;
  8477. this._setStatusNode({
  8478. title: this.tree.options.strings.loadError + info,
  8479. tooltip: tooltip,
  8480. addClass: this.tree.options.classNames.nodeError
  8481. });
  8482. break;
  8483. default:
  8484. throw "Bad LazyNodeStatus: '" + lts + "'.";
  8485. }
  8486. },
  8487. _parentList: function(includeRoot, includeSelf) {
  8488. var l = [];
  8489. var dtn = includeSelf ? this : this.parent;
  8490. while( dtn ) {
  8491. if( includeRoot || dtn.parent )
  8492. l.unshift(dtn);
  8493. dtn = dtn.parent;
  8494. };
  8495. return l;
  8496. },
  8497. getLevel: function() {
  8498. var level = 0;
  8499. var dtn = this.parent;
  8500. while( dtn ) {
  8501. level++;
  8502. dtn = dtn.parent;
  8503. };
  8504. return level;
  8505. },
  8506. _getTypeForOuterNodeEvent: function(event) {
  8507. /** Return the inner node span (title, checkbox or expander) if
  8508. * event.target points to the outer span.
  8509. * This function should fix issue #93:
  8510. * FF2 ignores empty spans, when generating events (returning the parent instead).
  8511. */
  8512. var cns = this.tree.options.classNames;
  8513. var target = event.target;
  8514. // Only process clicks on an outer node span (probably due to a FF2 event handling bug)
  8515. if( target.className.indexOf(cns.folder)<0
  8516. && target.className.indexOf(cns.document)<0 ) {
  8517. return null
  8518. }
  8519. // Event coordinates, relative to outer node span:
  8520. var eventX = event.pageX - target.offsetLeft;
  8521. var eventY = event.pageY - target.offsetTop;
  8522. for(var i=0; i<target.childNodes.length; i++) {
  8523. var cn = target.childNodes[i];
  8524. var x = cn.offsetLeft - target.offsetLeft;
  8525. var y = cn.offsetTop - target.offsetTop;
  8526. var nx = cn.clientWidth, ny = cn.clientHeight;
  8527. // alert (cn.className + ": " + x + ", " + y + ", s:" + nx + ", " + ny);
  8528. if( eventX>=x && eventX<=(x+nx) && eventY>=y && eventY<=(y+ny) ) {
  8529. // alert("HIT "+ cn.className);
  8530. if( cn.className==cns.title )
  8531. return "title";
  8532. else if( cn.className==cns.expander )
  8533. return "expander";
  8534. else if( cn.className==cns.checkbox )
  8535. return "checkbox";
  8536. else if( cn.className==cns.nodeIcon )
  8537. return "icon";
  8538. }
  8539. }
  8540. return "prefix";
  8541. },
  8542. getEventTargetType: function(event) {
  8543. // Return the part of a node, that a click event occured on.
  8544. // Note: there is no check, if the was fired on TIHS node.
  8545. var tcn = event && event.target ? event.target.className : "";
  8546. var cns = this.tree.options.classNames;
  8547. if( tcn == cns.title )
  8548. return "title";
  8549. else if( tcn==cns.expander )
  8550. return "expander";
  8551. else if( tcn==cns.checkbox )
  8552. return "checkbox";
  8553. else if( tcn==cns.nodeIcon )
  8554. return "icon";
  8555. else if( tcn==cns.empty || tcn==cns.vline || tcn==cns.connector )
  8556. return "prefix";
  8557. else if( tcn.indexOf(cns.folder)>=0 || tcn.indexOf(cns.document)>=0 )
  8558. // FIX issue #93
  8559. return this._getTypeForOuterNodeEvent(event);
  8560. return null;
  8561. },
  8562. isVisible: function() {
  8563. // Return true, if all parents are expanded.
  8564. var parents = this._parentList(true, false);
  8565. for(var i=0; i<parents.length; i++)
  8566. if( ! parents[i].bExpanded ) return false;
  8567. return true;
  8568. },
  8569. makeVisible: function() {
  8570. // Make sure, all parents are expanded
  8571. var parents = this._parentList(true, false);
  8572. for(var i=0; i<parents.length; i++)
  8573. parents[i]._expand(true);
  8574. },
  8575. focus: function() {
  8576. // TODO: check, if we already have focus
  8577. // this.tree.logDebug("dtnode.focus(): %o", this);
  8578. this.makeVisible();
  8579. try {
  8580. $(this.span).find(">a").focus();
  8581. } catch(e) { }
  8582. },
  8583. _activate: function(flag, fireEvents) {
  8584. // (De)Activate - but not focus - this node.
  8585. this.tree.logDebug("dtnode._activate(%o, fireEvents=%o) - %o", flag, fireEvents, this);
  8586. var opts = this.tree.options;
  8587. if( this.data.isStatusNode )
  8588. return;
  8589. if ( fireEvents && opts.onQueryActivate && opts.onQueryActivate.call(this.span, flag, this) == false )
  8590. return; // Callback returned false
  8591. if( flag ) {
  8592. // Activate
  8593. if( this.tree.activeNode ) {
  8594. if( this.tree.activeNode === this )
  8595. return;
  8596. this.tree.activeNode.deactivate();
  8597. }
  8598. if( opts.activeVisible )
  8599. this.makeVisible();
  8600. this.tree.activeNode = this;
  8601. if( opts.persist )
  8602. $.cookie(opts.cookieId+"-active", this.data.key, opts.cookie);
  8603. this.tree.persistence.activeKey = this.data.key;
  8604. $(this.span).addClass(opts.classNames.active);
  8605. if ( fireEvents && opts.onActivate ) // Pass element as 'this' (jQuery convention)
  8606. opts.onActivate.call(this.span, this);
  8607. } else {
  8608. // Deactivate
  8609. if( this.tree.activeNode === this ) {
  8610. var opts = this.tree.options;
  8611. if ( opts.onQueryActivate && opts.onQueryActivate.call(this.span, false, this) == false )
  8612. return; // Callback returned false
  8613. $(this.span).removeClass(opts.classNames.active);
  8614. if( opts.persist ) {
  8615. // Note: we don't pass null, but ''. So the cookie is not deleted.
  8616. // If we pass null, we also have to pass a COPY of opts, because $cookie will override opts.expires (issue 84)
  8617. $.cookie(opts.cookieId+"-active", "", opts.cookie);
  8618. }
  8619. this.tree.persistence.activeKey = null;
  8620. this.tree.activeNode = null;
  8621. if ( fireEvents && opts.onDeactivate )
  8622. opts.onDeactivate.call(this.span, this);
  8623. }
  8624. }
  8625. },
  8626. activate: function() {
  8627. // Select - but not focus - this node.
  8628. // this.tree.logDebug("dtnode.activate(): %o", this);
  8629. this._activate(true, true);
  8630. },
  8631. deactivate: function() {
  8632. // this.tree.logDebug("dtnode.deactivate(): %o", this);
  8633. this._activate(false, true);
  8634. },
  8635. isActive: function() {
  8636. return (this.tree.activeNode === this);
  8637. },
  8638. _userActivate: function() {
  8639. // Handle user click / [space] / [enter], according to clickFolderMode.
  8640. var activate = true;
  8641. var expand = false;
  8642. if ( this.data.isFolder ) {
  8643. switch( this.tree.options.clickFolderMode ) {
  8644. case 2:
  8645. activate = false;
  8646. expand = true;
  8647. break;
  8648. case 3:
  8649. activate = expand = true;
  8650. break;
  8651. }
  8652. }
  8653. if( this.parent == null && this.tree.options.minExpandLevel>0 ) {
  8654. expand = false;
  8655. }
  8656. if( expand ) {
  8657. this.toggleExpand();
  8658. this.focus();
  8659. }
  8660. if( activate ) {
  8661. this.activate();
  8662. }
  8663. },
  8664. _setSubSel: function(hasSubSel) {
  8665. if( hasSubSel ) {
  8666. this.hasSubSel = true;
  8667. $(this.span).addClass(this.tree.options.classNames.partsel);
  8668. } else {
  8669. this.hasSubSel = false;
  8670. $(this.span).removeClass(this.tree.options.classNames.partsel);
  8671. }
  8672. },
  8673. _fixSelectionState: function() {
  8674. // fix selection status, for multi-hier mode
  8675. // this.tree.logDebug("_fixSelectionState(%o) - %o", this.bSelected, this);
  8676. if( this.bSelected ) {
  8677. // Select all children
  8678. this.visit(function(dtnode){
  8679. dtnode.parent._setSubSel(true);
  8680. dtnode._select(true, false, false);
  8681. });
  8682. // Select parents, if all children are selected
  8683. var p = this.parent;
  8684. while( p ) {
  8685. p._setSubSel(true);
  8686. var allChildsSelected = true;
  8687. for(var i=0; i<p.childList.length; i++) {
  8688. var n = p.childList[i];
  8689. if( !n.bSelected && !n.data.isStatusNode ) {
  8690. allChildsSelected = false;
  8691. break;
  8692. }
  8693. }
  8694. if( allChildsSelected )
  8695. p._select(true, false, false);
  8696. p = p.parent;
  8697. }
  8698. } else {
  8699. // Deselect all children
  8700. this._setSubSel(false);
  8701. this.visit(function(dtnode){
  8702. dtnode._setSubSel(false);
  8703. dtnode._select(false, false, false);
  8704. });
  8705. // Deselect parents, and recalc hasSubSel
  8706. var p = this.parent;
  8707. while( p ) {
  8708. p._select(false, false, false);
  8709. var isPartSel = false;
  8710. for(var i=0; i<p.childList.length; i++) {
  8711. if( p.childList[i].bSelected || p.childList[i].hasSubSel ) {
  8712. isPartSel = true;
  8713. break;
  8714. }
  8715. }
  8716. p._setSubSel(isPartSel);
  8717. p = p.parent;
  8718. }
  8719. }
  8720. },
  8721. _select: function(sel, fireEvents, deep) {
  8722. // Select - but not focus - this node.
  8723. // this.tree.logDebug("dtnode._select(%o) - %o", sel, this);
  8724. var opts = this.tree.options;
  8725. if( this.data.isStatusNode )
  8726. return;
  8727. //
  8728. if( this.bSelected == sel ) {
  8729. // this.tree.logDebug("dtnode._select(%o) IGNORED - %o", sel, this);
  8730. return;
  8731. }
  8732. // Allow event listener to abort selection
  8733. if ( fireEvents && opts.onQuerySelect && opts.onQuerySelect.call(this.span, sel, this) == false )
  8734. return; // Callback returned false
  8735. // Force single-selection
  8736. if( opts.selectMode==1 && sel ) {
  8737. this.tree.visit(function(dtnode){
  8738. if( dtnode.bSelected ) {
  8739. // Deselect; assuming that in selectMode:1 there's max. one other selected node
  8740. dtnode._select(false, false, false);
  8741. return false;
  8742. }
  8743. });
  8744. }
  8745. this.bSelected = sel;
  8746. // this.tree._changeNodeList("select", this, sel);
  8747. if( sel ) {
  8748. if( opts.persist )
  8749. this.tree.persistence.addSelect(this.data.key);
  8750. $(this.span).addClass(opts.classNames.selected);
  8751. if( deep && opts.selectMode==3 )
  8752. this._fixSelectionState();
  8753. if ( fireEvents && opts.onSelect )
  8754. opts.onSelect.call(this.span, true, this);
  8755. } else {
  8756. if( opts.persist )
  8757. this.tree.persistence.clearSelect(this.data.key);
  8758. $(this.span).removeClass(opts.classNames.selected);
  8759. if( deep && opts.selectMode==3 )
  8760. this._fixSelectionState();
  8761. if ( fireEvents && opts.onSelect )
  8762. opts.onSelect.call(this.span, false, this);
  8763. }
  8764. },
  8765. select: function(sel) {
  8766. // Select - but not focus - this node.
  8767. // this.tree.logDebug("dtnode.select(%o) - %o", sel, this);
  8768. if( this.data.unselectable )
  8769. return this.bSelected;
  8770. return this._select(sel!=false, true, true);
  8771. },
  8772. toggleSelect: function() {
  8773. // this.tree.logDebug("dtnode.toggleSelect() - %o", this);
  8774. return this.select(!this.bSelected);
  8775. },
  8776. isSelected: function() {
  8777. return this.bSelected;
  8778. },
  8779. _loadContent: function() {
  8780. try {
  8781. var opts = this.tree.options;
  8782. this.tree.logDebug("_loadContent: start - %o", this);
  8783. this.setLazyNodeStatus(DTNodeStatus_Loading);
  8784. if( true == opts.onLazyRead.call(this.span, this) ) {
  8785. // If function returns 'true', we assume that the loading is done:
  8786. this.setLazyNodeStatus(DTNodeStatus_Ok);
  8787. // Otherwise (i.e. if the loading was started as an asynchronous process)
  8788. // the onLazyRead(dtnode) handler is expected to call dtnode.setLazyNodeStatus(DTNodeStatus_Ok/_Error) when done.
  8789. this.tree.logDebug("_loadContent: succeeded - %o", this);
  8790. }
  8791. } catch(e) {
  8792. // alert(e);
  8793. this.setLazyNodeStatus(DTNodeStatus_Error);
  8794. this.tree.logWarning("_loadContent: failed - %o", e);
  8795. }
  8796. },
  8797. _expand: function(bExpand) {
  8798. // this.tree.logDebug("dtnode._expand(%o) - %o", bExpand, this);
  8799. if( this.bExpanded == bExpand ) {
  8800. // this.tree.logDebug("dtnode._expand(%o) IGNORED - %o", bExpand, this);
  8801. return;
  8802. }
  8803. var opts = this.tree.options;
  8804. //@modify liguocai 2011-11-30 miniExpandLevel置为无效,以防阻止顶层元素打开
  8805. //if( !bExpand && this.getLevel()<opts.minExpandLevel ) {
  8806. // this.tree.logDebug("dtnode._expand(%o) forced expand - %o", bExpand, this);
  8807. // return;
  8808. //}
  8809. if ( opts.onQueryExpand && opts.onQueryExpand.call(this.span, bExpand, this) == false )
  8810. return; // Callback returned false
  8811. this.bExpanded = bExpand;
  8812. // Persist expand state
  8813. if( opts.persist ) {
  8814. if( bExpand )
  8815. this.tree.persistence.addExpand(this.data.key);
  8816. else
  8817. this.tree.persistence.clearExpand(this.data.key);
  8818. }
  8819. this.render(false);
  8820. // Auto-collapse mode: collapse all siblings
  8821. if( this.bExpanded && this.parent && opts.autoCollapse ) {
  8822. var parents = this._parentList(false, true);
  8823. for(var i=0; i<parents.length; i++)
  8824. parents[i].collapseSiblings();
  8825. }
  8826. // If the currently active node is now hidden, deactivate it
  8827. if( opts.activeVisible && this.tree.activeNode && ! this.tree.activeNode.isVisible() ) {
  8828. this.tree.activeNode.deactivate();
  8829. }
  8830. // Expanding a lazy node: set 'loading...' and call callback
  8831. if( bExpand && this.data.isLazy && this.childList==null && !this.isLoading ) {
  8832. this._loadContent();
  8833. return;
  8834. }
  8835. // this.tree.logDebug("_expand: start div toggle - %o", this);
  8836. var fxDuration = opts.fx ? (opts.fx.duration || 200) : 0;
  8837. if( this.childList ) {
  8838. for(var i=0; i<this.childList.length; i++ ) {
  8839. var $child = $(this.childList[i].div);
  8840. if( fxDuration ) {
  8841. // This is a toggle, so only do it, if not already rendered (in)visible (issue 98)
  8842. if( bExpand != $child.is(':visible') )
  8843. $child.animate(opts.fx, fxDuration);
  8844. } else {
  8845. if( bExpand )
  8846. $child.show();
  8847. else
  8848. $child.hide(); // TODO: this seems to be slow, when called the first time for an element
  8849. }
  8850. }
  8851. }
  8852. /* issue 109: using selector filter is really SLOW.
  8853. // issue 98: only toggle, if render hasn't set visibility already:
  8854. var filter = ">DIV" + (bExpand ? ":hidden" : ":visible");
  8855. if( opts.fx ) {
  8856. var duration = opts.fx.duration || 200;
  8857. // $(">DIV", this.div).animate(opts.fx, duration);
  8858. $(filter, this.div).animate(opts.fx, duration);
  8859. } else {
  8860. $(filter, this.div).toggle();
  8861. // var $d = $(">DIV", this.div);
  8862. // this.tree.logDebug("_expand: got div, start toggle - %o", this);
  8863. // $d.toggle();
  8864. }
  8865. //*/
  8866. // this.tree.logDebug("_expand: end div toggle - %o", this);
  8867. if ( opts.onExpand )
  8868. opts.onExpand.call(this.span, bExpand, this);
  8869. },
  8870. expand: function(flag) {
  8871. if( !this.childList && !this.data.isLazy && flag )
  8872. return; // Prevent expanding empty nodes
  8873. if( this.parent == null && this.tree.options.minExpandLevel>0 && !flag )
  8874. return; // Prevent collapsing the root
  8875. this._expand(flag);
  8876. },
  8877. toggleExpand: function() {
  8878. this.expand(!this.bExpanded);
  8879. },
  8880. collapseSiblings: function() {
  8881. if( this.parent == null )
  8882. return;
  8883. var ac = this.parent.childList;
  8884. for (var i=0; i<ac.length; i++) {
  8885. if ( ac[i] !== this && ac[i].bExpanded )
  8886. ac[i]._expand(false);
  8887. }
  8888. },
  8889. onClick: function(event) {
  8890. // this.tree.logDebug("dtnode.onClick(" + event.type + "): dtnode:" + this + ", button:" + event.button + ", which: " + event.which);
  8891. var targetType = this.getEventTargetType(event);
  8892. if( targetType == "expander" ) {
  8893. // Clicking the expander icon always expands/collapses
  8894. this.toggleExpand();
  8895. this.focus(); // issue 95
  8896. } else if( targetType == "checkbox" ) {
  8897. // Clicking the checkbox always (de)selects
  8898. this.toggleSelect();
  8899. this.focus(); // issue 95
  8900. } else {
  8901. this._userActivate();
  8902. // Chrome and Safari don't focus the a-tag on click
  8903. this.span.getElementsByTagName("a")[0].focus();
  8904. }
  8905. // Make sure that clicks stop, otherwise <a href='#'> jumps to the top
  8906. return false;
  8907. },
  8908. onDblClick: function(event) {
  8909. // this.tree.logDebug("dtnode.onDblClick(" + event.type + "): dtnode:" + this + ", button:" + event.button + ", which: " + event.which);
  8910. },
  8911. onKeydown: function(event) {
  8912. // this.tree.logDebug("dtnode.onKeydown(" + event.type + "): dtnode:" + this + ", charCode:" + event.charCode + ", keyCode: " + event.keyCode + ", which: " + event.which);
  8913. var handled = true;
  8914. // alert("keyDown" + event.which);
  8915. switch( event.which ) {
  8916. // charCodes:
  8917. // case 43: // '+'
  8918. case 107: // '+'
  8919. case 187: // '+' @ Chrome, Safari
  8920. if( !this.bExpanded ) this.toggleExpand();
  8921. break;
  8922. // case 45: // '-'
  8923. case 109: // '-'
  8924. case 189: // '+' @ Chrome, Safari
  8925. if( this.bExpanded ) this.toggleExpand();
  8926. break;
  8927. //~ case 42: // '*'
  8928. //~ break;
  8929. //~ case 47: // '/'
  8930. //~ break;
  8931. // case 13: // <enter>
  8932. // <enter> on a focused <a> tag seems to generate a click-event.
  8933. // this._userActivate();
  8934. // break;
  8935. case 32: // <space>
  8936. this._userActivate();
  8937. break;
  8938. case 8: // <backspace>
  8939. if( this.parent )
  8940. this.parent.focus();
  8941. break;
  8942. case 37: // <left>
  8943. if( this.bExpanded ) {
  8944. this.toggleExpand();
  8945. this.focus();
  8946. } else if( this.parent && (this.tree.options.rootVisible || this.parent.parent) ) {
  8947. this.parent.focus();
  8948. }
  8949. break;
  8950. case 39: // <right>
  8951. if( !this.bExpanded && (this.childList || this.data.isLazy) ) {
  8952. this.toggleExpand();
  8953. this.focus();
  8954. } else if( this.childList ) {
  8955. this.childList[0].focus();
  8956. }
  8957. break;
  8958. case 38: // <up>
  8959. var sib = this.prevSibling();
  8960. while( sib && sib.bExpanded && sib.childList )
  8961. sib = sib.childList[sib.childList.length-1];
  8962. if( !sib && this.parent && (this.tree.options.rootVisible || this.parent.parent) )
  8963. sib = this.parent;
  8964. if( sib ) sib.focus();
  8965. break;
  8966. case 40: // <down>
  8967. var sib;
  8968. if( this.bExpanded && this.childList ) {
  8969. sib = this.childList[0];
  8970. } else {
  8971. var parents = this._parentList(false, true);
  8972. for(var i=parents.length-1; i>=0; i--) {
  8973. sib = parents[i].nextSibling();
  8974. if( sib ) break;
  8975. }
  8976. }
  8977. if( sib ) sib.focus();
  8978. break;
  8979. default:
  8980. handled = false;
  8981. }
  8982. // Return false, if handled, to prevent default processing
  8983. return !handled;
  8984. },
  8985. onKeypress: function(event) {
  8986. // onKeypress is only hooked to allow user callbacks.
  8987. // We don't process it, because IE and Safari don't fire keypress for cursor keys.
  8988. // this.tree.logDebug("dtnode.onKeypress(" + event.type + "): dtnode:" + this + ", charCode:" + event.charCode + ", keyCode: " + event.keyCode + ", which: " + event.which);
  8989. },
  8990. onFocus: function(event) {
  8991. // Handles blur and focus events.
  8992. // this.tree.logDebug("dtnode.onFocus(%o): %o", event, this);
  8993. var opts = this.tree.options;
  8994. if ( event.type=="blur" || event.type=="focusout" ) {
  8995. if ( opts.onBlur ) // Pass element as 'this' (jQuery convention)
  8996. opts.onBlur.call(this.span, this);
  8997. if( this.tree.tnFocused )
  8998. $(this.tree.tnFocused.span).removeClass(opts.classNames.focused);
  8999. this.tree.tnFocused = null;
  9000. if( opts.persist )
  9001. $.cookie(opts.cookieId+"-focus", "", opts.cookie);
  9002. } else if ( event.type=="focus" || event.type=="focusin") {
  9003. // Fix: sometimes the blur event is not generated
  9004. if( this.tree.tnFocused && this.tree.tnFocused !== this ) {
  9005. this.tree.logDebug("dtnode.onFocus: out of sync: curFocus: %o", this.tree.tnFocused);
  9006. $(this.tree.tnFocused.span).removeClass(opts.classNames.focused);
  9007. }
  9008. this.tree.tnFocused = this;
  9009. if ( opts.onFocus ) // Pass element as 'this' (jQuery convention)
  9010. opts.onFocus.call(this.span, this);
  9011. $(this.tree.tnFocused.span).addClass(opts.classNames.focused);
  9012. if( opts.persist )
  9013. $.cookie(opts.cookieId+"-focus", this.data.key, opts.cookie);
  9014. }
  9015. // TODO: return anything?
  9016. // return false;
  9017. },
  9018. visit: function(fn, data, includeSelf) {
  9019. // Call fn(dtnode, data) for all child nodes. Stop iteration, if fn() returns false.
  9020. var n = 0;
  9021. if( includeSelf == true ) {
  9022. if( fn(this, data) == false )
  9023. return 1;
  9024. n++;
  9025. }
  9026. if ( this.childList )
  9027. for (var i=0; i<this.childList.length; i++)
  9028. n += this.childList[i].visit(fn, data, true);
  9029. return n;
  9030. },
  9031. remove: function() {
  9032. // Remove this node
  9033. // this.tree.logDebug ("%o.remove()", this);
  9034. if ( this === this.tree.root )
  9035. return false;
  9036. return this.parent.removeChild(this);
  9037. },
  9038. removeChild: function(tn) {
  9039. // Remove tn from list of direct children.
  9040. var ac = this.childList;
  9041. if( ac.length == 1 ) {
  9042. if( tn !== ac[0] )
  9043. throw "removeChild: invalid child";
  9044. return this.removeChildren();
  9045. }
  9046. if( tn === this.tree.activeNode )
  9047. tn.deactivate();
  9048. if( this.tree.options.persist ) {
  9049. if( tn.bSelected )
  9050. this.tree.persistence.clearSelect(tn.data.key);
  9051. if ( tn.bExpanded )
  9052. this.tree.persistence.clearExpand(tn.data.key);
  9053. }
  9054. tn.removeChildren(true);
  9055. this.div.removeChild(tn.div);
  9056. for(var i=0; i<ac.length; i++) {
  9057. if( ac[i] === tn ) {
  9058. this.childList.splice(i, 1);
  9059. delete tn;
  9060. break;
  9061. }
  9062. }
  9063. },
  9064. removeChildren: function(isRecursiveCall, retainPersistence) {
  9065. // Remove all child nodes (more efficiently than recursive remove())
  9066. // this.tree.logDebug ("%o.removeChildren(%o)", this, isRecursiveCall);
  9067. var tree = this.tree;
  9068. var ac = this.childList;
  9069. if( ac ) {
  9070. for(var i=0; i<ac.length; i++) {
  9071. var tn=ac[i];
  9072. // this.tree.logDebug ("del %o", tn);
  9073. if ( tn === tree.activeNode && !retainPersistence )
  9074. tn.deactivate();
  9075. if( this.tree.options.persist && !retainPersistence ) {
  9076. if( tn.bSelected )
  9077. this.tree.persistence.clearSelect(tn.data.key);
  9078. if ( tn.bExpanded )
  9079. this.tree.persistence.clearExpand(tn.data.key);
  9080. }
  9081. tn.removeChildren(true, retainPersistence);
  9082. this.div.removeChild(tn.div);
  9083. delete tn;
  9084. }
  9085. this.childList = null;
  9086. }
  9087. if( ! isRecursiveCall ) {
  9088. // this._expand(false);
  9089. // this.isRead = false;
  9090. this.isLoading = false;
  9091. this.render(false, false);
  9092. }
  9093. },
  9094. reload: function(force) {
  9095. // Discard lazy content (and reload, if node was expanded).
  9096. if( this.parent == null )
  9097. return this.tree.reload();
  9098. if( ! this.data.isLazy )
  9099. throw "node.reload() requires lazy nodes.";
  9100. if( this.bExpanded ) {
  9101. this.expand(false);
  9102. this.removeChildren();
  9103. this.expand(true);
  9104. } else {
  9105. this.removeChildren();
  9106. if( force )
  9107. this._loadContent();
  9108. }
  9109. },
  9110. _addChildNode: function(dtnode, beforeNode) {
  9111. /**
  9112. * Internal function to add one single DynatreeNode as a child.
  9113. *
  9114. */
  9115. var tree = this.tree;
  9116. var opts = tree.options;
  9117. var pers = tree.persistence;
  9118. // tree.logDebug("%o._addChildNode(%o)", this, dtnode);
  9119. // --- Update and fix dtnode attributes if necessary
  9120. dtnode.parent = this;
  9121. // if( beforeNode && (beforeNode.parent !== this || beforeNode === dtnode ) )
  9122. // throw "<beforeNode> must be another child of <this>";
  9123. // --- Add dtnode as a child
  9124. if ( this.childList==null ) {
  9125. this.childList = [];
  9126. } else if( ! beforeNode ) {
  9127. // Fix 'lastsib'
  9128. $(this.childList[this.childList.length-1].span).removeClass(opts.classNames.lastsib);
  9129. }
  9130. if( beforeNode ) {
  9131. var iBefore = $.inArray(beforeNode, this.childList);
  9132. if( iBefore < 0 )
  9133. throw "<beforeNode> must be a child of <this>";
  9134. this.childList.splice(iBefore, 0, dtnode);
  9135. // alert(this.childList);
  9136. } else {
  9137. // Append node
  9138. this.childList.push(dtnode);
  9139. }
  9140. // --- Handle persistence
  9141. // Initial status is read from cookies, if persistence is active and
  9142. // cookies are already present.
  9143. // Otherwise the status is read from the data attributes and then persisted.
  9144. var isInitializing = tree.isInitializing();
  9145. if( opts.persist && pers.cookiesFound && isInitializing ) {
  9146. // Init status from cookies
  9147. // tree.logDebug("init from cookie, pa=%o, dk=%o", pers.activeKey, dtnode.data.key);
  9148. if( pers.activeKey == dtnode.data.key )
  9149. tree.activeNode = dtnode;
  9150. if( pers.focusedKey == dtnode.data.key )
  9151. tree.focusNode = dtnode;
  9152. dtnode.bExpanded = ($.inArray(dtnode.data.key, pers.expandedKeyList) >= 0);
  9153. dtnode.bSelected = ($.inArray(dtnode.data.key, pers.selectedKeyList) >= 0);
  9154. // tree.logDebug(" key=%o, bSelected=%o", dtnode.data.key, dtnode.bSelected);
  9155. } else {
  9156. // Init status from data (Note: we write the cookies after the init phase)
  9157. // tree.logDebug("init from data");
  9158. if( dtnode.data.activate ) {
  9159. tree.activeNode = dtnode;
  9160. if( opts.persist )
  9161. pers.activeKey = dtnode.data.key;
  9162. }
  9163. if( dtnode.data.focus ) {
  9164. tree.focusNode = dtnode;
  9165. if( opts.persist )
  9166. pers.focusedKey = dtnode.data.key;
  9167. }
  9168. dtnode.bExpanded = ( dtnode.data.expand == true ); // Collapsed by default
  9169. if( dtnode.bExpanded && opts.persist )
  9170. pers.addExpand(dtnode.data.key);
  9171. dtnode.bSelected = ( dtnode.data.select == true ); // Deselected by default
  9172. /*
  9173. Doesn't work, cause pers.selectedKeyList may be null
  9174. if( dtnode.bSelected && opts.selectMode==1
  9175. && pers.selectedKeyList && pers.selectedKeyList.length>0 ) {
  9176. tree.logWarning("Ignored multi-selection in single-mode for %o", dtnode);
  9177. dtnode.bSelected = false; // Fixing bad input data (multi selection for mode:1)
  9178. }
  9179. */
  9180. if( dtnode.bSelected && opts.persist )
  9181. pers.addSelect(dtnode.data.key);
  9182. }
  9183. // Always expand, if it's below minExpandLevel
  9184. // tree.logDebug ("%o._addChildNode(%o), l=%o", this, dtnode, dtnode.getLevel());
  9185. if ( opts.minExpandLevel >= dtnode.getLevel() ) {
  9186. // tree.logDebug ("Force expand for %o", dtnode);
  9187. this.bExpanded = true;
  9188. }
  9189. // In multi-hier mode, update the parents selection state
  9190. // issue #82: only if not initializing, because the children may not exist yet
  9191. // if( !dtnode.data.isStatusNode && opts.selectMode==3 && !isInitializing )
  9192. // dtnode._fixSelectionState();
  9193. // In multi-hier mode, update the parents selection state
  9194. if( dtnode.bSelected && opts.selectMode==3 ) {
  9195. var p = this;
  9196. while( p ) {
  9197. if( !p.hasSubSel )
  9198. p._setSubSel(true);
  9199. p = p.parent;
  9200. }
  9201. }
  9202. // render this node and the new child
  9203. if ( tree.bEnableUpdate )
  9204. this.render(true, true);
  9205. return dtnode;
  9206. },
  9207. addChild: function(obj, beforeNode) {
  9208. /**
  9209. * Add a node object as child.
  9210. *
  9211. * This should be the only place, where a DynaTreeNode is constructed!
  9212. * (Except for the root node creation in the tree constructor)
  9213. *
  9214. * @param obj A JS object (may be recursive) or an array of those.
  9215. * @param {DynaTreeNode} beforeNode (optional) sibling node.
  9216. *
  9217. * Data format: array of node objects, with optional 'children' attributes.
  9218. * [
  9219. * { title: "t1", isFolder: true, ... }
  9220. * { title: "t2", isFolder: true, ...,
  9221. * children: [
  9222. * {title: "t2.1", ..},
  9223. * {..}
  9224. * ]
  9225. * }
  9226. * ]
  9227. * A simple object is also accepted instead of an array.
  9228. *
  9229. */
  9230. // this.tree.logDebug("%o.addChild(%o, %o)", this, obj, beforeNode);
  9231. if( !obj || obj.length==0 ) // Passed null or undefined or empty array
  9232. return;
  9233. if( obj instanceof DynaTreeNode )
  9234. return this._addChildNode(obj, beforeNode);
  9235. if( !obj.length ) // Passed a single data object
  9236. obj = [ obj ];
  9237. var prevFlag = this.tree.enableUpdate(false);
  9238. var tnFirst = null;
  9239. for (var i=0; i<obj.length; i++) {
  9240. var data = obj[i];
  9241. var dtnode = this._addChildNode(new DynaTreeNode(this, this.tree, data), beforeNode);
  9242. if( !tnFirst ) tnFirst = dtnode;
  9243. // Add child nodes recursively
  9244. if( data.children )
  9245. dtnode.addChild(data.children, null);
  9246. }
  9247. this.tree.enableUpdate(prevFlag);
  9248. return tnFirst;
  9249. },
  9250. append: function(obj) {
  9251. this.tree.logWarning("node.append() is deprecated (use node.addChild() instead).");
  9252. return this.addChild(obj, null);
  9253. },
  9254. appendAjax: function(ajaxOptions) {
  9255. this.removeChildren(false, true);
  9256. this.setLazyNodeStatus(DTNodeStatus_Loading);
  9257. // Ajax option inheritance: $.ajaxSetup < $.ui.dynatree.defaults.ajaxDefaults < tree.options.ajaxDefaults < ajaxOptions
  9258. var self = this;
  9259. var orgSuccess = ajaxOptions.success;
  9260. var orgError = ajaxOptions.error;
  9261. var options = $.extend({}, this.tree.options.ajaxDefaults, ajaxOptions, {
  9262. /*
  9263. complete: function(req, textStatus){
  9264. alert("ajax complete");
  9265. },
  9266. timeout: 5000, // 5 sec
  9267. */
  9268. success: function(data, textStatus){
  9269. if("1"!=data.FHZ){//出错了,弹出错误提醒
  9270. if("CSRF" == data.FHZ){
  9271. showMsg(data.MSG||'',3);
  9272. return;
  9273. }else if("-1" == data.FHZ){
  9274. _FW.oFtl.fnAlert(data.MSG||'');
  9275. var prevPhase = self.tree.phase;
  9276. self.tree.phase = "init";
  9277. self.tree.phase = "postInit";
  9278. self.setLazyNodeStatus(DTNodeStatus_Ok);
  9279. self.tree.phase = prevPhase;
  9280. return;
  9281. }
  9282. }
  9283. // <this> is the request options
  9284. // self.tree.logDebug("appendAjax().success");
  9285. var prevPhase = self.tree.phase;
  9286. self.tree.phase = "init";
  9287. // self.append(data);
  9288. self.addChild(data, null);
  9289. self.tree.phase = "postInit";
  9290. self.setLazyNodeStatus(DTNodeStatus_Ok);
  9291. if( orgSuccess )
  9292. orgSuccess.call(options, self);
  9293. self.tree.phase = prevPhase;
  9294. },
  9295. error: function(XMLHttpRequest, textStatus, errorThrown){
  9296. // <this> is the request options
  9297. // self.tree.logWarning("appendAjax failed: %o:\n%o\n%o", textStatus, XMLHttpRequest, errorThrown);
  9298. self.tree.logWarning("appendAjax failed:", textStatus, ":\n", XMLHttpRequest, "\n", errorThrown);
  9299. self.setLazyNodeStatus(DTNodeStatus_Error, {info: textStatus, tooltip: ""+errorThrown});
  9300. if( orgError )
  9301. orgError.call(options, self, XMLHttpRequest, textStatus, errorThrown);
  9302. },
  9303. beforeSend:function(XMLHttpRequest ){
  9304. var cToken = $.cookie(headtoken) || token;XMLHttpRequest.setRequestHeader(headtoken,cToken);
  9305. }
  9306. });
  9307. $.ajax(options);
  9308. },
  9309. // --- end of class
  9310. lastentry: undefined
  9311. }
  9312. /*************************************************************************
  9313. * class DynaTreeStatus
  9314. */
  9315. var DynaTreeStatus = Class.create();
  9316. DynaTreeStatus._getTreePersistData = function(cookieId, cookieOpts) {
  9317. // Static member: Return persistence information from cookies
  9318. var ts = new DynaTreeStatus(cookieId, cookieOpts);
  9319. ts.read();
  9320. return ts.toDict();
  9321. }
  9322. // Make available in global scope
  9323. getDynaTreePersistData = DynaTreeStatus._getTreePersistData;
  9324. DynaTreeStatus.prototype = {
  9325. // Constructor
  9326. initialize: function(cookieId, cookieOpts) {
  9327. this._log("DynaTreeStatus: initialize");
  9328. if( cookieId === undefined )
  9329. cookieId = $.ui.dynatree.defaults.cookieId;
  9330. cookieOpts = $.extend({}, $.ui.dynatree.defaults.cookie, cookieOpts);
  9331. this.cookieId = cookieId;
  9332. this.cookieOpts = cookieOpts;
  9333. this.cookiesFound = undefined;
  9334. this.activeKey = null;
  9335. this.focusedKey = null;
  9336. this.expandedKeyList = null;
  9337. this.selectedKeyList = null;
  9338. },
  9339. // member functions
  9340. _log: function(msg) {
  9341. // this.logDebug("_changeNodeList(%o): nodeList:%o, idx:%o", mode, nodeList, idx);
  9342. Array.prototype.unshift.apply(arguments, ["debug"]);
  9343. _log.apply(this, arguments);
  9344. },
  9345. read: function() {
  9346. this._log("DynaTreeStatus: read");
  9347. // Read or init cookies.
  9348. this.cookiesFound = false;
  9349. var cookie = $.cookie(this.cookieId + "-active");
  9350. this.activeKey = ( cookie == null ) ? "" : cookie;
  9351. if( cookie != null ) this.cookiesFound = true;
  9352. cookie = $.cookie(this.cookieId + "-focus");
  9353. this.focusedKey = ( cookie == null ) ? "" : cookie;
  9354. if( cookie != null ) this.cookiesFound = true;
  9355. cookie = $.cookie(this.cookieId + "-expand");
  9356. this.expandedKeyList = ( cookie == null ) ? [] : cookie.split(",");
  9357. if( cookie != null ) this.cookiesFound = true;
  9358. cookie = $.cookie(this.cookieId + "-select");
  9359. this.selectedKeyList = ( cookie == null ) ? [] : cookie.split(",");
  9360. if( cookie != null ) this.cookiesFound = true;
  9361. },
  9362. write: function() {
  9363. this._log("DynaTreeStatus: write");
  9364. $.cookie(this.cookieId + "-active", ( this.activeKey == null ) ? "" : this.activeKey, this.cookieOpts);
  9365. $.cookie(this.cookieId + "-focus", ( this.focusedKey == null ) ? "" : this.focusedKey, this.cookieOpts);
  9366. $.cookie(this.cookieId + "-expand", ( this.expandedKeyList == null ) ? "" : this.expandedKeyList.join(","), this.cookieOpts);
  9367. $.cookie(this.cookieId + "-select", ( this.selectedKeyList == null ) ? "" : this.selectedKeyList.join(","), this.cookieOpts);
  9368. },
  9369. addExpand: function(key) {
  9370. this._log("addExpand(%o)", key);
  9371. if( $.inArray(key, this.expandedKeyList) < 0 ) {
  9372. this.expandedKeyList.push(key);
  9373. $.cookie(this.cookieId + "-expand", this.expandedKeyList.join(","), this.cookieOpts);
  9374. }
  9375. },
  9376. clearExpand: function(key) {
  9377. this._log("clearExpand(%o)", key);
  9378. var idx = $.inArray(key, this.expandedKeyList);
  9379. if( idx >= 0 ) {
  9380. this.expandedKeyList.splice(idx, 1);
  9381. $.cookie(this.cookieId + "-expand", this.expandedKeyList.join(","), this.cookieOpts);
  9382. }
  9383. },
  9384. addSelect: function(key) {
  9385. this._log("addSelect(%o)", key);
  9386. if( $.inArray(key, this.selectedKeyList) < 0 ) {
  9387. this.selectedKeyList.push(key);
  9388. $.cookie(this.cookieId + "-select", this.selectedKeyList.join(","), this.cookieOpts);
  9389. }
  9390. },
  9391. clearSelect: function(key) {
  9392. this._log("clearSelect(%o)", key);
  9393. var idx = $.inArray(key, this.selectedKeyList);
  9394. if( idx >= 0 ) {
  9395. this.selectedKeyList.splice(idx, 1);
  9396. $.cookie(this.cookieId + "-select", this.selectedKeyList.join(","), this.cookieOpts);
  9397. }
  9398. },
  9399. isReloading: function() {
  9400. return this.cookiesFound == true;
  9401. },
  9402. toDict: function() {
  9403. return {
  9404. cookiesFound: this.cookiesFound,
  9405. activeKey: this.activeKey,
  9406. focusedKey: this.activeKey,
  9407. expandedKeyList: this.expandedKeyList,
  9408. selectedKeyList: this.selectedKeyList
  9409. };
  9410. },
  9411. // --- end of class
  9412. lastentry: undefined
  9413. };
  9414. /*************************************************************************
  9415. * class DynaTree
  9416. */
  9417. var DynaTree = Class.create();
  9418. // --- Static members ----------------------------------------------------------
  9419. DynaTree.version = "$Version: 0.5.4$";
  9420. /*
  9421. DynaTree._initTree = function() {
  9422. };
  9423. DynaTree._bind = function() {
  9424. };
  9425. */
  9426. //--- Class members ------------------------------------------------------------
  9427. DynaTree.prototype = {
  9428. // Constructor
  9429. // initialize: function(divContainer, options) {
  9430. initialize: function($widget) {
  9431. // instance members
  9432. this.phase = "init";
  9433. this.$widget = $widget;
  9434. this.options = $widget.options;
  9435. this.$tree = $widget.element;
  9436. // find container element
  9437. this.divTree = this.$tree.get(0);
  9438. },
  9439. // member functions
  9440. _load: function() {
  9441. var $widget = this.$widget;
  9442. var opts = this.options;
  9443. this.bEnableUpdate = true;
  9444. this._nodeCount = 1;
  9445. this.activeNode = null;
  9446. this.focusNode = null;
  9447. // If a 'options.classNames' dictionary was passed, still use defaults
  9448. // for undefined classes:
  9449. if( opts.classNames !== $.ui.dynatree.defaults.classNames ) {
  9450. opts.classNames = $.extend({}, $.ui.dynatree.defaults.classNames, opts.classNames);
  9451. }
  9452. // Guess skin path, if not specified
  9453. if(!opts.imagePath) {
  9454. $("script").each( function () {
  9455. // Eclipse syntax parser breaks on this expression, so put it at the bottom:
  9456. if( this.src.search(_rexDtLibName) >= 0 ) {
  9457. if( this.src.indexOf("/")>=0 ) // issue #47
  9458. opts.imagePath = this.src.slice(0, this.src.lastIndexOf("/")) + "/skin/";
  9459. else
  9460. opts.imagePath = "skin/";
  9461. // logMsg("Guessing imagePath from '%s': '%s'", this.src, opts.imagePath);
  9462. return false; // first match
  9463. }
  9464. });
  9465. }
  9466. this.persistence = new DynaTreeStatus(opts.cookieId, opts.cookie);
  9467. if( opts.persist ) {
  9468. if( !$.cookie )
  9469. _log("warn", "Please include jquery.cookie.js to use persistence.");
  9470. this.persistence.read();
  9471. }
  9472. this.logDebug("DynaTree.persistence: %o", this.persistence.toDict());
  9473. // Cached tag strings
  9474. this.cache = {
  9475. tagEmpty: "<span class='" + opts.classNames.empty + "'></span>",
  9476. tagVline: "<span class='" + opts.classNames.vline + "'></span>",
  9477. tagExpander: "<span class='" + opts.classNames.expander + "'></span>",
  9478. tagConnector: "<span class='" + opts.classNames.connector + "'></span>",
  9479. tagNodeIcon: "<span class='" + opts.classNames.nodeIcon + "'></span>",
  9480. tagCheckbox: "<span class='" + opts.classNames.checkbox + "'></span>",
  9481. lastentry: undefined
  9482. };
  9483. // Clear container, in case it contained some 'waiting' or 'error' text
  9484. // for clients that don't support JS.
  9485. // We don't do this however, if we try to load from an embedded UL element.
  9486. if( opts.children || (opts.initAjax && opts.initAjax.url) || opts.initId )
  9487. $(this.divTree).empty();
  9488. else if( this.divRoot )
  9489. $(this.divRoot).remove();
  9490. // create the root element
  9491. this.tnRoot = new DynaTreeNode(null, this, {title: opts.title, key: "root"});
  9492. this.tnRoot.data.isFolder = true;
  9493. this.tnRoot.render(false, false);
  9494. this.divRoot = this.tnRoot.div;
  9495. this.divRoot.className = opts.classNames.container;
  9496. // add root to container
  9497. // TODO: this should be delayed until all children have been created for performance reasons
  9498. this.divTree.appendChild(this.divRoot);
  9499. var root = this.tnRoot;
  9500. var isReloading = ( opts.persist && this.persistence.isReloading() );
  9501. var isLazy = false;
  9502. var prevFlag = this.enableUpdate(false);
  9503. this.logDebug("Dynatree._load(): read tree structure...");
  9504. // Init tree structure
  9505. if( opts.children ) {
  9506. // Read structure from node array
  9507. root.addChild(opts.children);
  9508. } else if( opts.initAjax && opts.initAjax.url ) {
  9509. // Init tree from AJAX request
  9510. isLazy = true;
  9511. root.data.isLazy = true;
  9512. this._reloadAjax();
  9513. } else if( opts.initId ) {
  9514. // Init tree from another UL element
  9515. this._createFromTag(root, $("#"+opts.initId));
  9516. } else {
  9517. // Init tree from the first UL element inside the container <div>
  9518. var $ul = this.$tree.find(">ul").hide();
  9519. this._createFromTag(root, $ul);
  9520. $ul.remove();
  9521. }
  9522. this._checkConsistency();
  9523. // Render html markup
  9524. this.logDebug("Dynatree._load(): render nodes...");
  9525. this.enableUpdate(prevFlag);
  9526. // bind event handlers
  9527. this.logDebug("Dynatree._load(): bind events...");
  9528. this.$widget.bind();
  9529. // --- Post-load processing
  9530. this.logDebug("Dynatree._load(): postInit...");
  9531. this.phase = "postInit";
  9532. // In persist mode, make sure that cookies are written, even if they are empty
  9533. if( opts.persist ) {
  9534. this.persistence.write();
  9535. }
  9536. // Set focus, if possible (this will also fire an event and write a cookie)
  9537. if( this.focusNode && this.focusNode.isVisible() ) {
  9538. this.logDebug("Focus on init: %o", this.focusNode);
  9539. this.focusNode.focus();
  9540. }
  9541. if( !isLazy && opts.onPostInit ) {
  9542. opts.onPostInit.call(this, isReloading, false);
  9543. }
  9544. this.phase = "idle";
  9545. },
  9546. _reloadAjax: function() {
  9547. // Reload
  9548. var opts = this.options;
  9549. if( ! opts.initAjax || ! opts.initAjax.url )
  9550. throw "tree.reload() requires 'initAjax' mode.";
  9551. var pers = this.persistence;
  9552. var ajaxOpts = $.extend({}, opts.initAjax);
  9553. // Append cookie info to the request
  9554. // this.logDebug("reloadAjax: key=%o, an.key:%o", pers.activeKey, this.activeNode?this.activeNode.data.key:"?");
  9555. if( ajaxOpts.addActiveKey )
  9556. ajaxOpts.data.activeKey = pers.activeKey;
  9557. if( ajaxOpts.addFocusedKey )
  9558. ajaxOpts.data.focusedKey = pers.focusedKey;
  9559. if( ajaxOpts.addExpandedKeyList )
  9560. ajaxOpts.data.expandedKeyList = pers.expandedKeyList.join(",");
  9561. if( ajaxOpts.addSelectedKeyList )
  9562. ajaxOpts.data.selectedKeyList = pers.selectedKeyList.join(",");
  9563. // Set up onPostInit callback to be called when Ajax returns
  9564. if( opts.onPostInit ) {
  9565. if( ajaxOpts.success )
  9566. this.logWarning("initAjax: success callback is ignored when onPostInit was specified.");
  9567. if( ajaxOpts.error )
  9568. this.logWarning("initAjax: error callback is ignored when onPostInit was specified.");
  9569. var isReloading = pers.isReloading();
  9570. ajaxOpts["success"] = function(dtnode) { opts.onPostInit.call(dtnode.tree, isReloading, false); };
  9571. ajaxOpts["error"] = function(dtnode) { opts.onPostInit.call(dtnode.tree, isReloading, true); };
  9572. }
  9573. this.logDebug("Dynatree._init(): send Ajax request...");
  9574. this.tnRoot.appendAjax(ajaxOpts);
  9575. },
  9576. toString: function() {
  9577. return "DynaTree '" + this.options.title + "'";
  9578. },
  9579. toDict: function() {
  9580. return this.tnRoot.toDict(true);
  9581. },
  9582. getPersistData: function() {
  9583. return this.persistence.toDict();
  9584. },
  9585. logDebug: function(msg) {
  9586. if( this.options.debugLevel >= 2 ) {
  9587. Array.prototype.unshift.apply(arguments, ["debug"]);
  9588. _log.apply(this, arguments);
  9589. }
  9590. },
  9591. logInfo: function(msg) {
  9592. if( this.options.debugLevel >= 1 ) {
  9593. Array.prototype.unshift.apply(arguments, ["info"]);
  9594. _log.apply(this, arguments);
  9595. }
  9596. },
  9597. logWarning: function(msg) {
  9598. Array.prototype.unshift.apply(arguments, ["warn"]);
  9599. _log.apply(this, arguments);
  9600. },
  9601. isInitializing: function() {
  9602. return ( this.phase=="init" || this.phase=="postInit" );
  9603. },
  9604. isReloading: function() {
  9605. return ( this.phase=="init" || this.phase=="postInit" ) && this.options.persist && this.persistence.cookiesFound;
  9606. },
  9607. isUserEvent: function() {
  9608. return ( this.phase=="userEvent" );
  9609. },
  9610. redraw: function() {
  9611. this.logDebug("dynatree.redraw()...");
  9612. this.tnRoot.render(true, true);
  9613. this.logDebug("dynatree.redraw() done.");
  9614. },
  9615. reloadAjax: function() {
  9616. this.logWarning("tree.reloadAjax() is deprecated since v0.5.2 (use reload() instead).");
  9617. },
  9618. reload: function() {
  9619. this._load();
  9620. },
  9621. getRoot: function() {
  9622. return this.tnRoot;
  9623. },
  9624. getNodeByKey: function(key) {
  9625. // $("#...") has problems, if the key contains '.', so we use getElementById()
  9626. // return $("#" + this.options.idPrefix + key).attr("dtnode");
  9627. var el = document.getElementById(this.options.idPrefix + key);
  9628. return ( el && el.dtnode ) ? el.dtnode : null;
  9629. },
  9630. getActiveNode: function() {
  9631. return this.activeNode;
  9632. },
  9633. reactivate: function(setFocus) {
  9634. // Re-fire onQueryActivate and onActivate events.
  9635. var node = this.activeNode;
  9636. // this.logDebug("reactivate %o", node);
  9637. if( node ) {
  9638. this.activeNode = null; // Force re-activating
  9639. node.activate();
  9640. if( setFocus )
  9641. node.focus();
  9642. }
  9643. },
  9644. getSelectedNodes: function(stopOnParents) {
  9645. var nodeList = [];
  9646. this.tnRoot.visit(function(dtnode){
  9647. if( dtnode.bSelected ) {
  9648. nodeList.push(dtnode);
  9649. if( stopOnParents == true )
  9650. return false; // stop processing this branch
  9651. }
  9652. });
  9653. return nodeList;
  9654. },
  9655. activateKey: function(key) {
  9656. var dtnode = (key === null) ? null : this.getNodeByKey(key);
  9657. if( !dtnode ) {
  9658. if( this.activeNode )
  9659. this.activeNode.deactivate();
  9660. this.activeNode = null;
  9661. return null;
  9662. }
  9663. dtnode.focus();
  9664. dtnode.activate();
  9665. return dtnode;
  9666. },
  9667. selectKey: function(key, select) {
  9668. var dtnode = this.getNodeByKey(key);
  9669. if( !dtnode )
  9670. return null;
  9671. dtnode.select(select);
  9672. return dtnode;
  9673. },
  9674. enableUpdate: function(bEnable) {
  9675. if ( this.bEnableUpdate==bEnable )
  9676. return bEnable;
  9677. this.bEnableUpdate = bEnable;
  9678. if ( bEnable )
  9679. this.redraw();
  9680. return !bEnable; // return previous value
  9681. },
  9682. visit: function(fn, data, includeRoot) {
  9683. return this.tnRoot.visit(fn, data, includeRoot);
  9684. },
  9685. _createFromTag: function(parentTreeNode, $ulParent) {
  9686. // Convert a <UL>...</UL> list into children of the parent tree node.
  9687. var self = this;
  9688. /*
  9689. TODO: better?
  9690. this.$lis = $("li:has(a[href])", this.element);
  9691. this.$tabs = this.$lis.map(function() { return $("a", this)[0]; });
  9692. */
  9693. $ulParent.find(">li").each(function() {
  9694. var $li = $(this);
  9695. var $liSpan = $li.find(">span:first");
  9696. var title;
  9697. if( $liSpan.length ) {
  9698. // If a <li><span> tag is specified, use it literally.
  9699. title = $liSpan.html();
  9700. } else {
  9701. // If only a <li> tag is specified, use the trimmed string up to the next child <ul> tag.
  9702. title = $li.html();
  9703. var iPos = title.search(/<ul/i);
  9704. if( iPos>=0 )
  9705. title = $.trim(title.substring(0, iPos));
  9706. else
  9707. title = $.trim(title);
  9708. // self.logDebug("%o", title);
  9709. }
  9710. // Parse node options from ID, title and class attributes
  9711. var data = {
  9712. title: title,
  9713. isFolder: $li.hasClass("folder"),
  9714. isLazy: $li.hasClass("lazy"),
  9715. expand: $li.hasClass("expanded"),
  9716. select: $li.hasClass("selected"),
  9717. activate: $li.hasClass("active"),
  9718. focus: $li.hasClass("focused")
  9719. };
  9720. if( $li.attr("title") )
  9721. data.tooltip = $li.attr("title");
  9722. if( $li.attr("id") )
  9723. data.key = $li.attr("id");
  9724. // If a data attribute is present, evaluate as a JavaScript object
  9725. if( $li.attr("data") ) {
  9726. var dataAttr = $.trim($li.attr("data"));
  9727. if( dataAttr ) {
  9728. if( dataAttr.charAt(0) != "{" )
  9729. dataAttr = "{" + dataAttr + "}"
  9730. try {
  9731. $.extend(data, eval("(" + dataAttr + ")"));
  9732. } catch(e) {
  9733. throw ("Error parsing node data: " + e + "\ndata:\n'" + dataAttr + "'");
  9734. }
  9735. }
  9736. }
  9737. childNode = parentTreeNode.addChild(data);
  9738. // Recursive reading of child nodes, if LI tag contains an UL tag
  9739. var $ul = $li.find(">ul:first");
  9740. if( $ul.length ) {
  9741. self._createFromTag(childNode, $ul); // must use 'self', because 'this' is the each() context
  9742. }
  9743. });
  9744. },
  9745. _checkConsistency: function() {
  9746. // this.logDebug("tree._checkConsistency() NOT IMPLEMENTED - %o", this);
  9747. },
  9748. // --- end of class
  9749. lastentry: undefined
  9750. };
  9751. /*************************************************************************
  9752. * widget $(..).dynatree
  9753. */
  9754. $.widget("ui.dynatree", {
  9755. init: function() {
  9756. // ui.core 1.6 renamed init() to _init(): this stub assures backward compatibility
  9757. _log("warn", "ui.dynatree.init() was called; you should upgrade to ui.core.js v1.6 or higher.");
  9758. return this._init();
  9759. },
  9760. _init: function() {
  9761. if( parseFloat($.ui.version) < 1.8 ) {
  9762. // jquery.ui.core 1.8 renamed _init() to _create(): this stub assures backward compatibility
  9763. _log("info", "ui.dynatree._init() was called; consider upgrading to jquery.ui.core.js v1.8 or higher.");
  9764. return this._create();
  9765. }
  9766. // jquery.ui.core 1.8 still uses _init() to perform "default functionality"
  9767. _log("debug", "ui.dynatree._init() was called; no current default functionality.");
  9768. },
  9769. _create: function() {
  9770. if( parseFloat($.ui.version) >= 1.8 ) {
  9771. this.options = $.extend(true, {}, $[this.namespace][this.widgetName].defaults, this.options);
  9772. }
  9773. logMsg("Dynatree._create(): version='%s', debugLevel=%o.", DynaTree.version, this.options.debugLevel);
  9774. var opts = this.options;
  9775. // The widget framework supplies this.element and this.options.
  9776. this.options.event += ".dynatree"; // namespace event
  9777. var divTree = this.element.get(0);
  9778. /* // Clear container, in case it contained some 'waiting' or 'error' text
  9779. // for clients that don't support JS
  9780. if( opts.children || (opts.initAjax && opts.initAjax.url) || opts.initId )
  9781. $(divTree).empty();
  9782. */
  9783. // Create the DynaTree object
  9784. this.tree = new DynaTree(this);
  9785. this.tree._load();
  9786. this.tree.logDebug("Dynatree._create(): done.");
  9787. },
  9788. bind: function() {
  9789. var $this = this.element;
  9790. var o = this.options;
  9791. // Prevent duplicate binding
  9792. this.unbind();
  9793. // Tool function to get dtnode from the event target:
  9794. function __getNodeFromElement(el) {
  9795. var iMax = 5;
  9796. while( el && iMax-- ) {
  9797. if( el.dtnode ) return el.dtnode;
  9798. el = el.parentNode;
  9799. };
  9800. return null;
  9801. }
  9802. var eventNames = "click.dynatree dblclick.dynatree";
  9803. if( o.keyboard ) // Note: leading ' '!
  9804. eventNames += " keypress.dynatree keydown.dynatree";
  9805. $this.bind(eventNames, function(event){
  9806. var dtnode = __getNodeFromElement(event.target);
  9807. if( !dtnode )
  9808. return true; // Allow bubbling of other events
  9809. var prevPhase = dtnode.tree.phase;
  9810. dtnode.tree.phase = "userEvent";
  9811. try {
  9812. dtnode.tree.logDebug("bind(%o): dtnode: %o", event, dtnode);
  9813. switch(event.type) {
  9814. case "click":
  9815. return ( o.onClick && o.onClick(dtnode, event)===false ) ? false : dtnode.onClick(event);
  9816. case "dblclick":
  9817. return ( o.onDblClick && o.onDblClick(dtnode, event)===false ) ? false : dtnode.onDblClick(event);
  9818. case "keydown":
  9819. return ( o.onKeydown && o.onKeydown(dtnode, event)===false ) ? false : dtnode.onKeydown(event);
  9820. case "keypress":
  9821. return ( o.onKeypress && o.onKeypress(dtnode, event)===false ) ? false : dtnode.onKeypress(event);
  9822. };
  9823. } catch(e) {
  9824. var _ = null; // issue 117
  9825. // dtnode.tree.logError("bind(%o): dtnode: %o", event, dtnode);
  9826. } finally {
  9827. dtnode.tree.phase = prevPhase;
  9828. }
  9829. });
  9830. // focus/blur don't bubble, i.e. are not delegated to parent <div> tags,
  9831. // so we use the addEventListener capturing phase.
  9832. // See http://www.howtocreate.co.uk/tutorials/javascript/domevents
  9833. function __focusHandler(event) {
  9834. // Handles blur and focus.
  9835. // Fix event for IE:
  9836. event = arguments[0] = $.event.fix( event || window.event );
  9837. var dtnode = __getNodeFromElement(event.target);
  9838. return dtnode ? dtnode.onFocus(event) : false;
  9839. }
  9840. var div = this.tree.divTree;
  9841. if( div.addEventListener ) {
  9842. div.addEventListener("focus", __focusHandler, true);
  9843. div.addEventListener("blur", __focusHandler, true);
  9844. } else {
  9845. div.onfocusin = div.onfocusout = __focusHandler;
  9846. }
  9847. // EVENTS
  9848. // disable click if event is configured to something else
  9849. // if (!(/^click/).test(o.event))
  9850. // this.$tabs.bind("click.tabs", function() { return false; });
  9851. },
  9852. unbind: function() {
  9853. this.element.unbind(".dynatree");
  9854. },
  9855. /* TODO: we could handle option changes during runtime here (maybe to re-render, ...)
  9856. setData: function(key, value) {
  9857. this.tree.logDebug("dynatree.setData('" + key + "', '" + value + "')");
  9858. },
  9859. */
  9860. enable: function() {
  9861. this.bind();
  9862. // Call default disable(): remove -disabled from css:
  9863. $.widget.prototype.enable.apply(this, arguments);
  9864. },
  9865. disable: function() {
  9866. this.unbind();
  9867. // Call default disable(): add -disabled to css:
  9868. $.widget.prototype.disable.apply(this, arguments);
  9869. },
  9870. // --- getter methods (i.e. NOT returning a reference to $)
  9871. getTree: function() {
  9872. return this.tree;
  9873. },
  9874. getRoot: function() {
  9875. return this.tree.getRoot();
  9876. },
  9877. getActiveNode: function() {
  9878. return this.tree.getActiveNode();
  9879. },
  9880. getSelectedNodes: function() {
  9881. return this.tree.getSelectedNodes();
  9882. },
  9883. // ------------------------------------------------------------------------
  9884. lastentry: undefined
  9885. });
  9886. // The following methods return a value (thus breaking the jQuery call chain):
  9887. $.ui.dynatree.getter = "getTree getRoot getActiveNode getSelectedNodes";
  9888. // Plugin default options:
  9889. $.ui.dynatree.defaults = {
  9890. title: "Dynatree root", // Name of the root node.
  9891. rootVisible: false, // Set to true, to make the root node visible.
  9892. minExpandLevel: 1, // 1: root node is not collapsible
  9893. imagePath: null, // Path to a folder containing icons. Defaults to 'skin/' subdirectory.
  9894. children: null, // Init tree structure from this object array.
  9895. initId: null, // Init tree structure from a <ul> element with this ID.
  9896. initAjax: null, // Ajax options used to initialize the tree strucuture.
  9897. autoFocus: true, // Set focus to first child, when expanding or lazy-loading.
  9898. keyboard: true, // Support keyboard navigation.
  9899. persist: false, // Persist expand-status to a cookie
  9900. autoCollapse: false, // Automatically collapse all siblings, when a node is expanded.
  9901. clickFolderMode: 3, // 1:activate, 2:expand, 3:activate and expand
  9902. activeVisible: true, // Make sure, active nodes are visible (expanded).
  9903. checkbox: false, // Show checkboxes.
  9904. selectMode: 2, // 1:single, 2:multi, 3:multi-hier
  9905. fx: null, // Animations, e.g. null or { height: "toggle", duration: 200 }
  9906. // Low level event handlers: onEvent(dtnode, event): return false, to stop default processing
  9907. onClick: null, // null: generate focus, expand, activate, select events.
  9908. onDblClick: null, // (No default actions.)
  9909. onKeydown: null, // null: generate keyboard navigation (focus, expand, activate).
  9910. onKeypress: null, // (No default actions.)
  9911. onFocus: null, // null: set focus to node.
  9912. onBlur: null, // null: remove focus from node.
  9913. // Pre-event handlers onQueryEvent(flag, dtnode): return false, to stop processing
  9914. onQueryActivate: null, // Callback(flag, dtnode) before a node is (de)activated.
  9915. onQuerySelect: null, // Callback(flag, dtnode) before a node is (de)selected.
  9916. onQueryExpand: null, // Callback(flag, dtnode) before a node is expanded/collpsed.
  9917. // High level event handlers
  9918. onPostInit: null, // Callback(isReloading, isError) when tree was (re)loaded.
  9919. onActivate: null, // Callback(dtnode) when a node is activated.
  9920. onDeactivate: null, // Callback(dtnode) when a node is deactivated.
  9921. onSelect: null, // Callback(flag, dtnode) when a node is (de)selected.
  9922. onExpand: null, // Callback(dtnode) when a node is expanded/collapsed.
  9923. onLazyRead: null, // Callback(dtnode) when a lazy node is expanded for the first time.
  9924. ajaxDefaults: { // Used by initAjax option
  9925. cache: false, // false: Append random '_' argument to the request url to prevent caching.
  9926. dataType: "json" // Expect json format and pass json object to callbacks.
  9927. },
  9928. strings: {
  9929. loading: "Loading&#8230;",
  9930. loadError: "Load error!"
  9931. },
  9932. idPrefix: "ui-dynatree-id-", // Used to generate node id's like <span id="ui-dynatree-id-<key>">.
  9933. // cookieId: "ui-dynatree-cookie", // Choose a more unique name, to allow multiple trees.
  9934. cookieId: "dynatree", // Choose a more unique name, to allow multiple trees.
  9935. cookie: {
  9936. expires: null //7, // Days or Date; null: session cookie
  9937. // path: "/", // Defaults to current page
  9938. // domain: "jquery.com",
  9939. // secure: true
  9940. },
  9941. // Class names used, when rendering the HTML markup.
  9942. // Note: if only single entries are passed for options.classNames, all other
  9943. // values are still set to default.
  9944. classNames: {
  9945. container: "ui-dynatree-container",
  9946. folder: "ui-dynatree-folder",
  9947. document: "ui-dynatree-document",
  9948. empty: "ui-dynatree-empty",
  9949. vline: "ui-dynatree-vline",
  9950. expander: "ui-dynatree-expander",
  9951. connector: "ui-dynatree-connector",
  9952. checkbox: "ui-dynatree-checkbox",
  9953. nodeIcon: "ui-dynatree-icon",
  9954. title: "ui-dynatree-title",
  9955. nodeError: "ui-dynatree-statusnode-error",
  9956. nodeWait: "ui-dynatree-statusnode-wait",
  9957. hidden: "ui-dynatree-hidden",
  9958. combinedExpanderPrefix: "ui-dynatree-exp-",
  9959. combinedIconPrefix: "ui-dynatree-ico-",
  9960. // disabled: "ui-dynatree-disabled",
  9961. hasChildren: "ui-dynatree-has-children",
  9962. active: "ui-dynatree-active",
  9963. selected: "ui-dynatree-selected",
  9964. expanded: "ui-dynatree-expanded",
  9965. lazy: "ui-dynatree-lazy",
  9966. focused: "ui-dynatree-focused",
  9967. partsel: "ui-dynatree-partsel",
  9968. lastsib: "ui-dynatree-lastsib"
  9969. },
  9970. debugLevel: 1,
  9971. // ------------------------------------------------------------------------
  9972. lastentry: undefined
  9973. };
  9974. /**
  9975. * Reserved data attributes for a tree node.
  9976. */
  9977. $.ui.dynatree.nodedatadefaults = {
  9978. title: null, // (required) Displayed name of the node (html is allowed here)
  9979. key: null, // May be used with activate(), select(), find(), ...
  9980. isFolder: false, // Use a folder icon. Also the node is expandable but not selectable.
  9981. isLazy: false, // Call onLazyRead(), when the node is expanded for the first time to allow for delayed creation of children.
  9982. tooltip: null, // Show this popup text.
  9983. icon: null, // Use a custom image (filename relative to tree.options.imagePath). 'null' for default icon, 'false' for no icon.
  9984. addClass: null, // Class name added to the node's span tag.
  9985. activate: false, // Initial active status.
  9986. focus: false, // Initial focused status.
  9987. expand: false, // Initial expanded status.
  9988. select: false, // Initial selected status.
  9989. hideCheckbox: false, // Suppress checkbox display for this node.
  9990. unselectable: false, // Prevent selection.
  9991. // disabled: false,
  9992. // The following attributes are only valid if passed to some functions:
  9993. children: null, // Array of child nodes.
  9994. // NOTE: we can also add custom attributes here.
  9995. // This may then also be used in the onActivate(), onSelect() or onLazyTree() callbacks.
  9996. // ------------------------------------------------------------------------
  9997. lastentry: undefined
  9998. };
  9999. // ---------------------------------------------------------------------------
  10000. })(jQuery);
  10001. // Eclipse syntax parser breaks on this expression, so we put it at the bottom.
  10002. var _rexDtLibName = /.*dynatree[^/]*\.js$/i;
  10003. /*
  10004. * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
  10005. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  10006. *
  10007. * Redistribution and use in source and binary forms, with or without
  10008. * modification, are permitted provided that the following conditions
  10009. * are met:
  10010. *
  10011. * - Redistributions of source code must retain the above copyright
  10012. * notice, this list of conditions and the following disclaimer.
  10013. *
  10014. * - Redistributions in binary form must reproduce the above copyright
  10015. * notice, this list of conditions and the following disclaimer in the
  10016. * documentation and/or other materials provided with the distribution.
  10017. *
  10018. * - Neither the name of Oracle nor the names of its
  10019. * contributors may be used to endorse or promote products derived
  10020. * from this software without specific prior written permission.
  10021. *
  10022. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  10023. * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  10024. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  10025. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  10026. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  10027. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  10028. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  10029. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  10030. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  10031. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  10032. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  10033. */
  10034. /*
  10035. * deployJava.js
  10036. *
  10037. * This file is part of the Deployment Toolkit. It provides functions for web
  10038. * pages to detect the presence of a JRE, install the latest JRE, and easily run
  10039. * applets or Web Start programs. More Information on usage of the
  10040. * Deployment Toolkit can be found in the Deployment Guide at:
  10041. * http://docs.oracle.com/javase/6/docs/technotes/guides/jweb/index.html
  10042. *
  10043. * The "live" copy of this file may be found at :
  10044. * http://java.com/js/deployJava.js.
  10045. * For web pages provisioned using https, you may want to access the copy at:
  10046. * https://java.com/js/deployJava.js.
  10047. *
  10048. * You are encouraged to link directly to the live copies.
  10049. * The above files are stripped of comments and whitespace for performance,
  10050. * You can access this file w/o the whitespace and comments removed at:
  10051. * http://java.com/js/deployJava.txt.
  10052. *
  10053. */
  10054. /* The following regular expression is used as the base for the parsing
  10055. * of the version string. The version string could be either in the old format
  10056. * (1.7.0_65, 1.7.0, 1.7) or in the new format (9.1.2.3, 9.1.2, 9.1, 9)
  10057. * and must include only VNUM parts of the version string (the full
  10058. * version string format is $VNUM(-$PRE)?(\+$BUILD)?(-$OPT)?, see JEP 223 for more details)
  10059. *
  10060. * ^ - Beginning of the string
  10061. * ( - Capturing group 1
  10062. * \\d+ - Match any digit one or more times
  10063. * ) - Match once
  10064. * (?: - Non capturing group
  10065. * \\. - Match '.' character
  10066. * ( - Capturing group 2
  10067. * \\d+ - Match any digit one or more times
  10068. * ) - Match once
  10069. * (?: - Non capturing group
  10070. * \\. - Match '.' character
  10071. * ( - Capturing group 3
  10072. * \\d+ - Match any digit one or more times
  10073. * ) - Match once
  10074. * (?: - Non capturing group
  10075. * [_\\.] - Math '_' (old version format) or '.' (new version format)
  10076. * ( - Capturing group 4
  10077. * \\d+ - Match any digit one or more times
  10078. * ) - Match once
  10079. * )? - Match zero or one time
  10080. * )? - Match zero or one time
  10081. * )? - Match zero or one time
  10082. *
  10083. *
  10084. *
  10085. */
  10086. var version_regex_base = "^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:[_\\.](\\d+))?)?)?";
  10087. /*
  10088. * version_regex_base - see version_regex_base comment above
  10089. * $ - End of the string
  10090. *
  10091. */
  10092. var version_regex_strict = version_regex_base + "$";
  10093. /*
  10094. * version_regex_base - see version_regex_base comment above
  10095. * ( - Capturing group 5
  10096. * \\* - Match '*'
  10097. * | - OR
  10098. * \\+ - Match '+'
  10099. * )? - Match zero or one time
  10100. * $ - End of string
  10101. *
  10102. */
  10103. var version_regex_with_family_modifier = version_regex_base + "(\\*|\\+)?$";
  10104. var deployJava = function() {
  10105. /** HTML attribute filter implementation */
  10106. var hattrs = {
  10107. core: [ 'id', 'class', 'title', 'style' ],
  10108. i18n: [ 'lang', 'dir' ],
  10109. events: [ 'onclick', 'ondblclick', 'onmousedown', 'onmouseup',
  10110. 'onmouseover', 'onmousemove', 'onmouseout', 'onkeypress',
  10111. 'onkeydown', 'onkeyup' ],
  10112. applet: [ 'codebase', 'code', 'name', 'archive', 'object',
  10113. 'width', 'height', 'alt', 'align', 'hspace', 'vspace' ],
  10114. object: [ 'classid', 'codebase', 'codetype', 'data', 'type',
  10115. 'archive', 'declare', 'standby', 'height', 'width', 'usemap',
  10116. 'name', 'tabindex', 'align', 'border', 'hspace', 'vspace' ]
  10117. };
  10118. var object_valid_attrs = hattrs.object.concat(hattrs.core, hattrs.i18n,
  10119. hattrs.events);
  10120. var applet_valid_attrs = hattrs.applet.concat(hattrs.core);
  10121. // generic log function, use console.log unless it isn't available
  10122. // then revert to alert()
  10123. function log(message) {
  10124. if ( ! rv.debug ) {return};
  10125. if (console.log) {
  10126. console.log(message);
  10127. } else {
  10128. alert(message);
  10129. }
  10130. }
  10131. //checks where given version string matches query
  10132. //
  10133. //NB: assume format is correct. Can add format check later if needed
  10134. // from dtjava.js
  10135. function versionCheckEx(query, version) {
  10136. if (query == null || query.length == 0) return true;
  10137. var c = query.charAt(query.length - 1);
  10138. //if it is not explicit pattern but does not have update version then need to append *
  10139. if (c != '+' && c != '*' && (query.indexOf('_') != -1 && c != '_')) {
  10140. query = query + "*";
  10141. c = '*';
  10142. }
  10143. query = query.substring(0, query.length - 1);
  10144. //if query ends with ".", "_" then we want to strip it to allow match of "1.6.*" to shorter form such as "1.6"
  10145. //TODO: add support for match of "1.7.0*" to "1.7"?
  10146. if (query.length > 0) {
  10147. var z = query.charAt(query.length - 1);
  10148. if (z == '.' || z == '_') {
  10149. query = query.substring(0, query.length - 1);
  10150. }
  10151. }
  10152. if (c == '*') {
  10153. //it is match if version starts from it
  10154. return (version.indexOf(query) == 0);
  10155. } else if (c == '+') {
  10156. //match if query string is lexicographically smaller
  10157. return query <= version;
  10158. }
  10159. return false;
  10160. }
  10161. function getWebStartLaunchIconURL() {
  10162. var imageUrl = '//java.com/js/webstart.png';
  10163. try {
  10164. // for http/https; use protocol less url; use http for all other protocol
  10165. return document.location.protocol.indexOf('http') != -1 ?
  10166. imageUrl : 'http:' + imageUrl;
  10167. } catch (err) {
  10168. return 'http:' + imageUrl;
  10169. }
  10170. }
  10171. // GetJava page
  10172. function constructGetJavaURL(query) {
  10173. var getJavaURL = 'http://java.com/dt-redirect';
  10174. if (query == null || query.length == 0) return getJavaURL;
  10175. if(query.charAt(0) == '&')
  10176. {
  10177. query = query.substring(1, query.length);
  10178. }
  10179. return getJavaURL + '?'+ query;
  10180. }
  10181. function arHas(ar, attr) {
  10182. var len = ar.length;
  10183. for (var i = 0; i < len; i++) {
  10184. if (ar[i] === attr) return true;
  10185. }
  10186. return false;
  10187. }
  10188. function isValidAppletAttr(attr) {
  10189. return arHas(applet_valid_attrs, attr.toLowerCase());
  10190. }
  10191. function isValidObjectAttr(attr) {
  10192. return arHas(object_valid_attrs, attr.toLowerCase());
  10193. }
  10194. /**
  10195. * returns true if we can enable DT plugin auto-install without chance of
  10196. * deadlock on cert mismatch dialog
  10197. *
  10198. * requestedJREVersion param is optional - if null, it will be
  10199. * treated as installing any JRE version
  10200. *
  10201. * DT plugin for 6uX only knows about JRE installer signed by SUN cert.
  10202. * If it encounter Oracle signed JRE installer, it will have chance of
  10203. * deadlock when running with IE. This function is to guard against this.
  10204. */
  10205. function enableWithoutCertMisMatchWorkaround(requestedJREVersion) {
  10206. // Non-IE browser are okay
  10207. if ('MSIE' != deployJava.browserName) return true;
  10208. // if DT plugin is 10.0.0 or above, return true
  10209. // This is because they are aware of both SUN and Oracle signature and
  10210. // will not show cert mismatch dialog that might cause deadlock
  10211. if (deployJava.compareVersionToPattern(deployJava.getPlugin().version,
  10212. ["10", "0", "0"], false, true)) {
  10213. return true;
  10214. }
  10215. // If we got there, DT plugin is 6uX
  10216. if (requestedJREVersion == null) {
  10217. // if requestedJREVersion is not defined - it means ANY.
  10218. // can not guarantee it is safe to install ANY version because 6uX
  10219. // DT does not know about Oracle certificates and may deadlock
  10220. return false;
  10221. }
  10222. // 6u32 or earlier JRE installer used Sun certificate
  10223. // 6u33+ uses Oracle's certificate
  10224. // DT in JRE6 does not know about Oracle certificate => can only
  10225. // install 6u32 or earlier without risk of deadlock
  10226. return !versionCheckEx("1.6.0_33+", requestedJREVersion);
  10227. }
  10228. /* HTML attribute filters */
  10229. var rv = {
  10230. debug: null,
  10231. /* version of deployJava.js */
  10232. version: "20120801",
  10233. firefoxJavaVersion: null,
  10234. myInterval: null,
  10235. preInstallJREList: null,
  10236. returnPage: null,
  10237. brand: null,
  10238. locale: null,
  10239. installType: null,
  10240. EAInstallEnabled: false,
  10241. EarlyAccessURL: null,
  10242. // mime-type of the DeployToolkit plugin object
  10243. oldMimeType: 'application/npruntime-scriptable-plugin;DeploymentToolkit',
  10244. mimeType: 'application/java-deployment-toolkit',
  10245. /* location of the Java Web Start launch button graphic is right next to
  10246. * deployJava.js at:
  10247. * http://java.com/js/webstart.png
  10248. *
  10249. * Use protocol less url here for http/https support
  10250. */
  10251. launchButtonPNG: getWebStartLaunchIconURL(),
  10252. browserName: null,
  10253. browserName2: null,
  10254. /**
  10255. * Returns an array of currently-installed JRE version strings.
  10256. * Version strings are of the form #.#[.#[_#]], with the function returning
  10257. * as much version information as it can determine, from just family
  10258. * versions ("1.4.2", "1.5") through the full version ("1.5.0_06").
  10259. *
  10260. * Detection is done on a best-effort basis. Under some circumstances
  10261. * only the highest installed JRE version will be detected, and
  10262. * JREs older than 1.4.2 will not always be detected.
  10263. */
  10264. getJREs: function() {
  10265. var list = new Array();
  10266. if (this.isPluginInstalled()) {
  10267. var plugin = this.getPlugin();
  10268. var VMs = plugin.jvms;
  10269. for (var i = 0; i < VMs.getLength(); i++) {
  10270. list[i] = VMs.get(i).version;
  10271. }
  10272. } else {
  10273. var browser = this.getBrowser();
  10274. if (browser == 'MSIE') {
  10275. if (this.testUsingActiveX('1.7.0')) {
  10276. list[0] = '1.7.0';
  10277. } else if (this.testUsingActiveX('1.6.0')) {
  10278. list[0] = '1.6.0';
  10279. } else if (this.testUsingActiveX('1.5.0')) {
  10280. list[0] = '1.5.0';
  10281. } else if (this.testUsingActiveX('1.4.2')) {
  10282. list[0] = '1.4.2';
  10283. } else if (this.testForMSVM()) {
  10284. list[0] = '1.1';
  10285. }
  10286. } else if (browser == 'Netscape Family') {
  10287. this.getJPIVersionUsingMimeType();
  10288. if (this.firefoxJavaVersion != null) {
  10289. list[0] = this.firefoxJavaVersion;
  10290. } else if (this.testUsingMimeTypes('1.7')) {
  10291. list[0] = '1.7.0';
  10292. } else if (this.testUsingMimeTypes('1.6')) {
  10293. list[0] = '1.6.0';
  10294. } else if (this.testUsingMimeTypes('1.5')) {
  10295. list[0] = '1.5.0';
  10296. } else if (this.testUsingMimeTypes('1.4.2')) {
  10297. list[0] = '1.4.2';
  10298. } else if (this.browserName2 == 'Safari') {
  10299. if (this.testUsingPluginsArray('1.7.0')) {
  10300. list[0] = '1.7.0';
  10301. } else if (this.testUsingPluginsArray('1.6')) {
  10302. list[0] = '1.6.0';
  10303. } else if (this.testUsingPluginsArray('1.5')) {
  10304. list[0] = '1.5.0';
  10305. } else if (this.testUsingPluginsArray('1.4.2')) {
  10306. list[0] = '1.4.2';
  10307. }
  10308. }
  10309. }
  10310. }
  10311. if (this.debug) {
  10312. for (var i = 0; i < list.length; ++i) {
  10313. log('[getJREs()] We claim to have detected Java SE ' + list[i]);
  10314. }
  10315. }
  10316. return list;
  10317. },
  10318. /**
  10319. * Triggers a JRE installation. The exact effect of triggering an
  10320. * installation varies based on platform, browser, and if the
  10321. * Deployment Toolkit plugin is installed.
  10322. *
  10323. * The requestVersion string is of the form #[.#[.#[_#]]][+|*],
  10324. * which includes strings such as "1.4", "1.5.0*", and "1.6.0_02+".
  10325. * A star (*) means "any version starting within this family" and
  10326. * a plus (+) means "any version greater or equal to this".
  10327. * "1.5.0*" * matches 1.5.0_06 but not 1.6.0_01, whereas
  10328. * "1.5.0+" matches both.
  10329. *
  10330. * installCallback is an optional argument which holds a reference
  10331. * to a javascript callback function for reporting install status.
  10332. *
  10333. * If the Deployment Toolkit plugin is not present, this will just call
  10334. * this.installLatestJRE().
  10335. */
  10336. installJRE: function(requestVersion, installCallback) {
  10337. var ret = false;
  10338. if (this.isPluginInstalled() &&
  10339. this.isAutoInstallEnabled(requestVersion)) {
  10340. var installSucceeded = false;
  10341. if (this.isCallbackSupported()) {
  10342. installSucceeded =
  10343. this.getPlugin().installJRE(requestVersion, installCallback);
  10344. } else {
  10345. installSucceeded = this.getPlugin().installJRE(requestVersion);
  10346. }
  10347. if (installSucceeded) {
  10348. this.refresh();
  10349. if (this.returnPage != null) {
  10350. document.location = this.returnPage;
  10351. }
  10352. }
  10353. return installSucceeded;
  10354. } else {
  10355. return this.installLatestJRE();
  10356. }
  10357. },
  10358. /**
  10359. * returns true if jre auto install for the requestedJREVersion is enabled
  10360. * for the local system; false otherwise
  10361. *
  10362. * requestedJREVersion param is optional - if not specified, it will be
  10363. * treated as installing any JRE version
  10364. *
  10365. * DT plugin for 6uX only knows about JRE installer signed by SUN cert.
  10366. * If it encounter Oracle signed JRE installer, it will have chance of
  10367. * deadlock when running with IE. This function is to guard against this.
  10368. */
  10369. isAutoInstallEnabled: function(requestedJREVersion) {
  10370. // if no DT plugin, return false
  10371. if (!this.isPluginInstalled()) return false;
  10372. if (typeof requestedJREVersion == 'undefined') {
  10373. requestedJREVersion = null;
  10374. }
  10375. return enableWithoutCertMisMatchWorkaround(requestedJREVersion);
  10376. },
  10377. /**
  10378. * returns true if jre install callback is supported
  10379. * callback support is added since dt plugin version 10.2.0 or above
  10380. */
  10381. isCallbackSupported: function() {
  10382. return this.isPluginInstalled() &&
  10383. this.compareVersionToPattern(this.getPlugin().version,
  10384. ["10", "2", "0"], false, true);
  10385. },
  10386. /**
  10387. * Triggers a JRE installation. The exact effect of triggering an
  10388. * installation varies based on platform, browser, and if the
  10389. * Deployment Toolkit plugin is installed.
  10390. *
  10391. * In the simplest case, the browser window will be redirected to the
  10392. * java.com JRE installation page, and (if possible) a redirect back to
  10393. * the current URL upon successful installation. The return redirect is
  10394. * not always possible, as the JRE installation may require the browser to
  10395. * be restarted.
  10396. *
  10397. * installCallback is an optional argument which holds a reference
  10398. * to a javascript callback function for reporting install status.
  10399. *
  10400. * In the best case (when the Deployment Toolkit plugin is present), this
  10401. * function will immediately cause a progress dialog to be displayed
  10402. * as the JRE is downloaded and installed.
  10403. */
  10404. installLatestJRE: function(installCallback) {
  10405. if (this.isPluginInstalled() && this.isAutoInstallEnabled()) {
  10406. var installSucceeded = false;
  10407. if (this.isCallbackSupported()) {
  10408. installSucceeded = this.getPlugin().installLatestJRE(installCallback);
  10409. } else {
  10410. installSucceeded = this.getPlugin().installLatestJRE();
  10411. }
  10412. if (installSucceeded) {
  10413. this.refresh();
  10414. if (this.returnPage != null) {
  10415. document.location = this.returnPage;
  10416. }
  10417. }
  10418. return installSucceeded;
  10419. } else {
  10420. var browser = this.getBrowser();
  10421. var platform = navigator.platform.toLowerCase();
  10422. if ((this.EAInstallEnabled == 'true') &&
  10423. (platform.indexOf('win') != -1) &&
  10424. (this.EarlyAccessURL != null)) {
  10425. this.preInstallJREList = this.getJREs();
  10426. if (this.returnPage != null) {
  10427. this.myInterval =
  10428. setInterval("deployJava.poll()", 3000);
  10429. }
  10430. location.href = this.EarlyAccessURL;
  10431. // we have to return false although there may be an install
  10432. // in progress now, when complete it may go to return page
  10433. return false;
  10434. } else {
  10435. if (browser == 'MSIE') {
  10436. return this.IEInstall();
  10437. } else if ((browser == 'Netscape Family') &&
  10438. (platform.indexOf('win32') != -1)) {
  10439. return this.FFInstall();
  10440. } else {
  10441. location.href = constructGetJavaURL(
  10442. ((this.returnPage != null) ?
  10443. ('&returnPage=' + this.returnPage) : '') +
  10444. ((this.locale != null) ?
  10445. ('&locale=' + this.locale) : '') +
  10446. ((this.brand != null) ?
  10447. ('&brand=' + this.brand) : ''));
  10448. }
  10449. // we have to return false although there may be an install
  10450. // in progress now, when complete it may go to return page
  10451. return false;
  10452. }
  10453. }
  10454. },
  10455. /**
  10456. * Ensures that an appropriate JRE is installed and then runs an applet.
  10457. * minimumVersion is of the form #[.#[.#[_#]]], and is the minimum
  10458. * JRE version necessary to run this applet. minimumVersion is optional,
  10459. * defaulting to the value "1.1" (which matches any JRE).
  10460. * If an equal or greater JRE is detected, runApplet() will call
  10461. * writeAppletTag(attributes, parameters) to output the applet tag,
  10462. * otherwise it will call installJRE(minimumVersion + '+').
  10463. *
  10464. * After installJRE() is called, the script will attempt to detect that the
  10465. * JRE installation has completed and begin running the applet, but there
  10466. * are circumstances (such as when the JRE installation requires a browser
  10467. * restart) when this cannot be fulfilled.
  10468. *
  10469. * As with writeAppletTag(), this function should only be called prior to
  10470. * the web page being completely rendered. Note that version wildcards
  10471. * (star (*) and plus (+)) are not supported, and including them in the
  10472. * minimumVersion will result in an error message.
  10473. */
  10474. runApplet: function(attributes, parameters, minimumVersion) {
  10475. if (minimumVersion == 'undefined' || minimumVersion == null) {
  10476. minimumVersion = '1.1';
  10477. }
  10478. var matchData = minimumVersion.match(version_regex_strict);
  10479. if (this.returnPage == null) {
  10480. // if there is an install, come back here and run the applet
  10481. this.returnPage = document.location;
  10482. }
  10483. if (matchData != null) {
  10484. var browser = this.getBrowser();
  10485. if (browser != '?') {
  10486. if (this.versionCheck(minimumVersion + '+')) {
  10487. this.writeAppletTag(attributes, parameters);
  10488. } else if (this.installJRE(minimumVersion + '+')) {
  10489. // after successful install we need to refresh page to pick
  10490. // pick up new plugin
  10491. this.refresh();
  10492. location.href = document.location;
  10493. this.writeAppletTag(attributes, parameters);
  10494. }
  10495. } else {
  10496. // for unknown or Safari - just try to show applet
  10497. this.writeAppletTag(attributes, parameters);
  10498. }
  10499. } else {
  10500. log('[runApplet()] Invalid minimumVersion argument to runApplet():' +
  10501. minimumVersion);
  10502. }
  10503. },
  10504. /**
  10505. * Outputs an applet tag with the specified attributes and parameters, where
  10506. * both attributes and parameters are associative arrays. Each key/value
  10507. * pair in attributes becomes an attribute of the applet tag itself, while
  10508. * key/value pairs in parameters become <PARAM> tags. No version checking
  10509. * or other special behaviors are performed; the tag is simply written to
  10510. * the page using document.writeln().
  10511. *
  10512. * As document.writeln() is generally only safe to use while the page is
  10513. * being rendered, you should never call this function after the page
  10514. * has been completed.
  10515. */
  10516. writeAppletTag: function(attributes, parameters) {
  10517. var startApplet = '<' + 'applet ';
  10518. var params = '';
  10519. var endApplet = '<' + '/' + 'applet' + '>';
  10520. var addCodeAttribute = true;
  10521. if (null == parameters || typeof parameters != 'object') {
  10522. parameters = new Object();
  10523. }
  10524. for (var attribute in attributes) {
  10525. if (! isValidAppletAttr(attribute)) {
  10526. parameters[attribute] = attributes[attribute];
  10527. } else {
  10528. startApplet += (' ' +attribute+ '="' +attributes[attribute] + '"');
  10529. if (attribute == 'code') {
  10530. addCodeAttribute = false;
  10531. }
  10532. }
  10533. }
  10534. var codebaseParam = false;
  10535. for (var parameter in parameters) {
  10536. if (parameter == 'codebase_lookup') {
  10537. codebaseParam = true;
  10538. }
  10539. // Originally, parameter 'object' was used for serialized
  10540. // applets, later, to avoid confusion with object tag in IE
  10541. // the 'java_object' was added. Plugin supports both.
  10542. if (parameter == 'object' || parameter == 'java_object' ||
  10543. parameter == 'java_code' ) {
  10544. addCodeAttribute = false;
  10545. }
  10546. params += '<param name="' + parameter + '" value="' +
  10547. parameters[parameter] + '"/>';
  10548. }
  10549. if (!codebaseParam) {
  10550. params += '<param name="codebase_lookup" value="false"/>';
  10551. }
  10552. if (addCodeAttribute) {
  10553. startApplet += (' code="dummy"');
  10554. }
  10555. startApplet += '>';
  10556. document.write(startApplet + '\n' + params + '\n' + endApplet);
  10557. },
  10558. /**
  10559. * Returns true if there is a matching JRE version currently installed
  10560. * (among those detected by getJREs()). The versionPattern string is
  10561. * of the form #[.#[.#[_#]]][+|*], which includes strings such as "1.4",
  10562. * "1.5.0*", and "1.6.0_02+".
  10563. * A star (*) means "any version within this family" and a plus (+) means
  10564. * "any version greater or equal to the specified version". "1.5.0*"
  10565. * matches 1.5.0_06 but not 1.6.0_01, whereas "1.5.0+" matches both.
  10566. *
  10567. * If the versionPattern does not include all four version components
  10568. * but does not end with a star or plus, it will be treated as if it
  10569. * ended with a star. "1.5" is exactly equivalent to "1.5*", and will
  10570. * match any version number beginning with "1.5".
  10571. *
  10572. * If getJREs() is unable to detect the precise version number, a match
  10573. * could be ambiguous. For example if getJREs() detects "1.5", there is
  10574. * no way to know whether the JRE matches "1.5.0_06+". versionCheck()
  10575. * compares only as much of the version information as could be detected,
  10576. * so versionCheck("1.5.0_06+") would return true in in this case.
  10577. *
  10578. * Invalid versionPattern will result in a JavaScript error alert.
  10579. * versionPatterns which are valid but do not match any existing JRE
  10580. * release (e.g. "32.65+") will always return false.
  10581. */
  10582. versionCheck: function(versionPattern)
  10583. {
  10584. var index = 0;
  10585. var matchData = versionPattern.match(version_regex_with_family_modifier);
  10586. if (matchData != null) {
  10587. // default is exact version match
  10588. // examples:
  10589. // local machine has 1.7.0_04 only installed
  10590. // exact match request is "1.7.0_05": return false
  10591. // family match request is "1.7.0*": return true
  10592. // minimum match request is "1.6+": return true
  10593. var familyMatch = false;
  10594. var minMatch = false;
  10595. var patternArray = new Array();
  10596. for (var i = 1; i < matchData.length; ++i) {
  10597. // browser dependency here.
  10598. // Fx sets 'undefined', IE sets '' string for unmatched groups
  10599. if ((typeof matchData[i] == 'string') && (matchData[i] != '')) {
  10600. patternArray[index] = matchData[i];
  10601. index++;
  10602. }
  10603. }
  10604. if (patternArray[patternArray.length-1] == '+') {
  10605. // + specified in request - doing a minimum match
  10606. minMatch = true;
  10607. familyMatch = false;
  10608. patternArray.length--;
  10609. } else if (patternArray[patternArray.length-1] == '*') {
  10610. // * specified in request - doing a family match
  10611. minMatch = false;
  10612. familyMatch = true;
  10613. patternArray.length--;
  10614. } else if (patternArray.length < 4) {
  10615. // versionPattern does not include all four version components
  10616. // and does not end with a star or plus, it will be treated as
  10617. // if it ended with a star. (family match)
  10618. minMatch = false;
  10619. familyMatch = true;
  10620. }
  10621. var list = this.getJREs();
  10622. for (var i = 0; i < list.length; ++i) {
  10623. if (this.compareVersionToPattern(list[i], patternArray,
  10624. familyMatch, minMatch)) {
  10625. return true;
  10626. }
  10627. }
  10628. return false;
  10629. } else {
  10630. var msg = 'Invalid versionPattern passed to versionCheck: ' +
  10631. versionPattern;
  10632. log('[versionCheck()] ' + msg);
  10633. alert(msg);
  10634. return false;
  10635. }
  10636. },
  10637. /**
  10638. * Returns true if an installation of Java Web Start of the specified
  10639. * minimumVersion can be detected. minimumVersion is optional, and
  10640. * if not specified, '1.4.2' will be used.
  10641. * (Versions earlier than 1.4.2 may not be detected.)
  10642. */
  10643. isWebStartInstalled: function(minimumVersion) {
  10644. var browser = this.getBrowser();
  10645. if (browser == '?') {
  10646. // we really don't know - better to try to use it than reinstall
  10647. return true;
  10648. }
  10649. if (minimumVersion == 'undefined' || minimumVersion == null) {
  10650. minimumVersion = '1.4.2';
  10651. }
  10652. var retval = false;
  10653. var matchData = minimumVersion.match(version_regex_strict);
  10654. if (matchData != null) {
  10655. retval = this.versionCheck(minimumVersion + '+');
  10656. } else {
  10657. log('[isWebStartInstaller()] Invalid minimumVersion argument to isWebStartInstalled(): ' + minimumVersion);
  10658. retval = this.versionCheck('1.4.2+');
  10659. }
  10660. return retval;
  10661. },
  10662. // obtain JPI version using navigator.mimeTypes array
  10663. // if found, set the version to this.firefoxJavaVersion
  10664. getJPIVersionUsingMimeType: function() {
  10665. // Walk through the full list of mime types.
  10666. for (var i = 0; i < navigator.mimeTypes.length; ++i) {
  10667. var s = navigator.mimeTypes[i].type;
  10668. // The jpi-version is the plug-in version. This is the best
  10669. // version to use.
  10670. var m = s.match(/^application\/x-java-applet;jpi-version=(.*)$/);
  10671. if (m != null) {
  10672. this.firefoxJavaVersion = m[1];
  10673. // Opera puts the latest sun JRE last not first
  10674. if ('Opera' != this.browserName2) {
  10675. break;
  10676. }
  10677. }
  10678. }
  10679. },
  10680. // launch the specified JNLP application using the passed in jnlp file
  10681. // the jnlp file does not need to have a codebase
  10682. // this requires JRE 7 or above to work
  10683. // if machine has no JRE 7 or above, we will try to auto-install and then launch
  10684. // (function will return false if JRE auto-install failed)
  10685. launchWebStartApplication: function(jnlp) {
  10686. var uaString = navigator.userAgent.toLowerCase();
  10687. this.getJPIVersionUsingMimeType();
  10688. // make sure we are JRE 7 or above
  10689. if (this.isWebStartInstalled('1.7.0') == false) {
  10690. // perform latest JRE auto-install
  10691. if ((this.installJRE('1.7.0+') == false) ||
  10692. ((this.isWebStartInstalled('1.7.0') == false))) {
  10693. return false;
  10694. }
  10695. }
  10696. var jnlpDocbase = null;
  10697. // use document.documentURI for docbase
  10698. if (document.documentURI) {
  10699. jnlpDocbase = document.documentURI;
  10700. }
  10701. // fallback to document.URL if documentURI not available
  10702. if (jnlpDocbase == null) {
  10703. jnlpDocbase = document.URL;
  10704. }
  10705. var browser = this.getBrowser();
  10706. var launchTag;
  10707. if (browser == 'MSIE') {
  10708. launchTag = '<' +
  10709. 'object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" ' +
  10710. 'width="0" height="0">' +
  10711. '<' + 'PARAM name="launchjnlp" value="' + jnlp + '"' + '>' +
  10712. '<' + 'PARAM name="docbase" value="' + encodeURIComponent(jnlpDocbase) + '"' + '>' +
  10713. '<' + '/' + 'object' + '>';
  10714. } else if (browser == 'Netscape Family') {
  10715. launchTag = '<' +
  10716. 'embed type="application/x-java-applet;jpi-version=' +
  10717. this.firefoxJavaVersion + '" ' +
  10718. 'width="0" height="0" ' +
  10719. 'launchjnlp="' + jnlp + '"' +
  10720. 'docbase="' + encodeURIComponent(jnlpDocbase) + '"' +
  10721. ' />';
  10722. }
  10723. if (document.body == 'undefined' || document.body == null) {
  10724. document.write(launchTag);
  10725. // go back to original page, otherwise current page becomes blank
  10726. document.location = jnlpDocbase;
  10727. } else {
  10728. var divTag = document.createElement("div");
  10729. divTag.id = "div1";
  10730. divTag.style.position = "relative";
  10731. divTag.style.left = "-10000px";
  10732. divTag.style.margin = "0px auto";
  10733. divTag.className ="dynamicDiv";
  10734. divTag.innerHTML = launchTag;
  10735. document.body.appendChild(divTag);
  10736. }
  10737. },
  10738. createWebStartLaunchButtonEx: function(jnlp, minimumVersion) {
  10739. if (this.returnPage == null) {
  10740. // if there is an install, come back and run the jnlp file
  10741. this.returnPage = jnlp;
  10742. }
  10743. var url = 'javascript:deployJava.launchWebStartApplication(\'' + jnlp +
  10744. '\');';
  10745. document.write('<' + 'a href="' + url +
  10746. '" onMouseOver="window.status=\'\'; ' +
  10747. 'return true;"><' + 'img ' +
  10748. 'src="' + this.launchButtonPNG + '" ' +
  10749. 'border="0" /><' + '/' + 'a' + '>');
  10750. },
  10751. /**
  10752. * Outputs a launch button for the specified JNLP URL. When clicked, the
  10753. * button will ensure that an appropriate JRE is installed and then launch
  10754. * the JNLP application. minimumVersion is of the form #[.#[.#[_#]]], and
  10755. * is the minimum JRE version necessary to run this JNLP application.
  10756. * minimumVersion is optional, and if it is not specified, '1.4.2'
  10757. * will be used.
  10758. * If an appropriate JRE or Web Start installation is detected,
  10759. * the JNLP application will be launched, otherwise installLatestJRE()
  10760. * will be called.
  10761. *
  10762. * After installLatestJRE() is called, the script will attempt to detect
  10763. * that the JRE installation has completed and launch the JNLP application,
  10764. * but there are circumstances (such as when the JRE installation
  10765. * requires a browser restart) when this cannot be fulfilled.
  10766. */
  10767. createWebStartLaunchButton: function(jnlp, minimumVersion) {
  10768. if (this.returnPage == null) {
  10769. // if there is an install, come back and run the jnlp file
  10770. this.returnPage = jnlp;
  10771. }
  10772. var url = 'javascript:' +
  10773. 'if (!deployJava.isWebStartInstalled(&quot;' +
  10774. minimumVersion + '&quot;)) {' +
  10775. 'if (deployJava.installLatestJRE()) {' +
  10776. 'if (deployJava.launch(&quot;' + jnlp + '&quot;)) {}' +
  10777. '}' +
  10778. '} else {' +
  10779. 'if (deployJava.launch(&quot;' + jnlp + '&quot;)) {}' +
  10780. '}';
  10781. document.write('<' + 'a href="' + url +
  10782. '" onMouseOver="window.status=\'\'; ' +
  10783. 'return true;"><' + 'img ' +
  10784. 'src="' + this.launchButtonPNG + '" ' +
  10785. 'border="0" /><' + '/' + 'a' + '>');
  10786. },
  10787. /**
  10788. * Launch a JNLP application, (using the plugin if available)
  10789. */
  10790. launch: function(jnlp) {
  10791. /*
  10792. * Using the plugin to launch Java Web Start is disabled for the time being
  10793. */
  10794. document.location=jnlp;
  10795. return true;
  10796. },
  10797. /*
  10798. * returns true if the ActiveX or XPI plugin is installed
  10799. */
  10800. isPluginInstalled: function() {
  10801. var plugin = this.getPlugin();
  10802. if (plugin && plugin.jvms) {
  10803. return true;
  10804. } else {
  10805. return false;
  10806. }
  10807. },
  10808. /*
  10809. * returns true if the plugin is installed and AutoUpdate is enabled
  10810. */
  10811. isAutoUpdateEnabled: function() {
  10812. if (this.isPluginInstalled()) {
  10813. return this.getPlugin().isAutoUpdateEnabled();
  10814. }
  10815. return false;
  10816. },
  10817. /*
  10818. * sets AutoUpdate on if plugin is installed
  10819. */
  10820. setAutoUpdateEnabled: function() {
  10821. if (this.isPluginInstalled()) {
  10822. return this.getPlugin().setAutoUpdateEnabled();
  10823. }
  10824. return false;
  10825. },
  10826. /*
  10827. * sets the preferred install type : null, online, kernel
  10828. */
  10829. setInstallerType: function(type) {
  10830. this.installType = type;
  10831. if (this.isPluginInstalled()) {
  10832. return this.getPlugin().setInstallerType(type);
  10833. }
  10834. return false;
  10835. },
  10836. /*
  10837. * sets additional package list - to be used by kernel installer
  10838. */
  10839. setAdditionalPackages: function(packageList) {
  10840. if (this.isPluginInstalled()) {
  10841. return this.getPlugin().setAdditionalPackages(
  10842. packageList);
  10843. }
  10844. return false;
  10845. },
  10846. /*
  10847. * sets preference to install Early Access versions if available
  10848. */
  10849. setEarlyAccess: function(enabled) {
  10850. this.EAInstallEnabled = enabled;
  10851. },
  10852. /*
  10853. * Determines if the next generation plugin (Plugin II) is default
  10854. */
  10855. isPlugin2: function() {
  10856. if (this.isPluginInstalled()) {
  10857. if (this.versionCheck('1.6.0_10+')) {
  10858. try {
  10859. return this.getPlugin().isPlugin2();
  10860. } catch (err) {
  10861. // older plugin w/o isPlugin2() function -
  10862. }
  10863. }
  10864. }
  10865. return false;
  10866. },
  10867. //support native DT plugin?
  10868. allowPlugin: function() {
  10869. this.getBrowser();
  10870. // Safari and Opera browsers find the plugin but it
  10871. // doesn't work, so until we can get it to work - don't use it.
  10872. var ret = ('Safari' != this.browserName2 &&
  10873. 'Opera' != this.browserName2);
  10874. return ret;
  10875. },
  10876. getPlugin: function() {
  10877. this.refresh();
  10878. var ret = null;
  10879. if (this.allowPlugin()) {
  10880. ret = document.getElementById('deployJavaPlugin');
  10881. }
  10882. return ret;
  10883. },
  10884. compareVersionToPattern: function(version, patternArray,
  10885. familyMatch, minMatch) {
  10886. if (version == undefined || patternArray == undefined) {
  10887. return false;
  10888. }
  10889. var matchData = version.match(version_regex_strict);
  10890. if (matchData != null) {
  10891. var index = 0;
  10892. var result = new Array();
  10893. for (var i = 1; i < matchData.length; ++i) {
  10894. if ((typeof matchData[i] == 'string') && (matchData[i] != ''))
  10895. {
  10896. result[index] = matchData[i];
  10897. index++;
  10898. }
  10899. }
  10900. var l = Math.min(result.length, patternArray.length);
  10901. // result contains what is installed in local machine
  10902. // patternArray is what is being requested by application
  10903. if (minMatch) {
  10904. // minimum version match, return true if what we have (installed)
  10905. // is greater or equal to what is requested. false otherwise.
  10906. for (var i = 0; i < l; ++i) {
  10907. var resultTemp = parseInt(result[i]);
  10908. var patternArrayTemp = parseInt(patternArray[i]);
  10909. if (resultTemp < patternArrayTemp) {
  10910. return false;
  10911. } else if (resultTemp > patternArrayTemp) {
  10912. return true;
  10913. }
  10914. }
  10915. return true;
  10916. } else {
  10917. for (var i = 0; i < l; ++i) {
  10918. if (result[i] != patternArray[i]) return false;
  10919. }
  10920. if (familyMatch) {
  10921. // family match - return true as long as what we have
  10922. // (installed) matches up to the request pattern
  10923. return true;
  10924. } else {
  10925. // exact match
  10926. // result and patternArray needs to have exact same content
  10927. return (result.length == patternArray.length);
  10928. }
  10929. }
  10930. } else {
  10931. return false;
  10932. }
  10933. },
  10934. getBrowser: function() {
  10935. if (this.browserName == null) {
  10936. var browser = navigator.userAgent.toLowerCase();
  10937. log('[getBrowser()] navigator.userAgent.toLowerCase() -> ' + browser);
  10938. // order is important here. Safari userAgent contains mozilla,
  10939. // IE 11 userAgent contains mozilla and netscape,
  10940. // and Chrome userAgent contains both mozilla and safari.
  10941. if ((browser.indexOf('msie') != -1) && (browser.indexOf('opera') == -1)) {
  10942. this.browserName = 'MSIE';
  10943. this.browserName2 = 'MSIE';
  10944. } else if (browser.indexOf('trident') != -1 || browser.indexOf('Trident') != -1) {
  10945. this.browserName = 'MSIE';
  10946. this.browserName2 = 'MSIE';
  10947. } else if (browser.indexOf('iphone') != -1) {
  10948. // this included both iPhone and iPad
  10949. this.browserName = 'Netscape Family';
  10950. this.browserName2 = 'iPhone';
  10951. } else if ((browser.indexOf('firefox') != -1) && (browser.indexOf('opera') == -1)) {
  10952. this.browserName = 'Netscape Family';
  10953. this.browserName2 = 'Firefox';
  10954. } else if (browser.indexOf('chrome') != -1) {
  10955. this.browserName = 'Netscape Family';
  10956. this.browserName2 = 'Chrome';
  10957. } else if (browser.indexOf('safari') != -1) {
  10958. this.browserName = 'Netscape Family';
  10959. this.browserName2 = 'Safari';
  10960. } else if ((browser.indexOf('mozilla') != -1) && (browser.indexOf('opera') == -1)) {
  10961. this.browserName = 'Netscape Family';
  10962. this.browserName2 = 'Other';
  10963. } else if (browser.indexOf('opera') != -1) {
  10964. this.browserName = 'Netscape Family';
  10965. this.browserName2 = 'Opera';
  10966. } else {
  10967. this.browserName = '?';
  10968. this.browserName2 = 'unknown';
  10969. }
  10970. log('[getBrowser()] Detected browser name:'+ this.browserName +
  10971. ', ' + this.browserName2);
  10972. }
  10973. return this.browserName;
  10974. },
  10975. testUsingActiveX: function(version) {
  10976. var objectName = 'JavaWebStart.isInstalled.' + version + '.0';
  10977. // we need the typeof check here for this to run on FF/Chrome
  10978. // the check needs to be in place here - cannot even pass ActiveXObject
  10979. // as arg to another function
  10980. if (typeof ActiveXObject == 'undefined' || !ActiveXObject) {
  10981. log('[testUsingActiveX()] Browser claims to be IE, but no ActiveXObject object?');
  10982. return false;
  10983. }
  10984. try {
  10985. return (new ActiveXObject(objectName) != null);
  10986. } catch (exception) {
  10987. return false;
  10988. }
  10989. },
  10990. testForMSVM: function() {
  10991. var clsid = '{08B0E5C0-4FCB-11CF-AAA5-00401C608500}';
  10992. if (typeof oClientCaps != 'undefined') {
  10993. var v = oClientCaps.getComponentVersion(clsid, "ComponentID");
  10994. if ((v == '') || (v == '5,0,5000,0')) {
  10995. return false;
  10996. } else {
  10997. return true;
  10998. }
  10999. } else {
  11000. return false;
  11001. }
  11002. },
  11003. testUsingMimeTypes: function(version) {
  11004. if (!navigator.mimeTypes) {
  11005. log ('[testUsingMimeTypes()] Browser claims to be Netscape family, but no mimeTypes[] array?');
  11006. return false;
  11007. }
  11008. for (var i = 0; i < navigator.mimeTypes.length; ++i) {
  11009. s = navigator.mimeTypes[i].type;
  11010. var m = s.match(/^application\/x-java-applet\x3Bversion=(1\.8|1\.7|1\.6|1\.5|1\.4\.2)$/);
  11011. if (m != null) {
  11012. if (this.compareVersions(m[1], version)) {
  11013. return true;
  11014. }
  11015. }
  11016. }
  11017. return false;
  11018. },
  11019. testUsingPluginsArray: function(version) {
  11020. if ((!navigator.plugins) || (!navigator.plugins.length)) {
  11021. return false;
  11022. }
  11023. var platform = navigator.platform.toLowerCase();
  11024. for (var i = 0; i < navigator.plugins.length; ++i) {
  11025. s = navigator.plugins[i].description;
  11026. if (s.search(/^Java Switchable Plug-in (Cocoa)/) != -1) {
  11027. // Safari on MAC
  11028. if (this.compareVersions("1.5.0", version)) {
  11029. return true;
  11030. }
  11031. } else if (s.search(/^Java/) != -1) {
  11032. if (platform.indexOf('win') != -1) {
  11033. // still can't tell - opera, safari on windows
  11034. // return true for 1.5.0 and 1.6.0
  11035. if (this.compareVersions("1.5.0", version) ||
  11036. this.compareVersions("1.6.0", version)) {
  11037. return true;
  11038. }
  11039. }
  11040. }
  11041. }
  11042. // if above dosn't work on Apple or Windows, just allow 1.5.0
  11043. if (this.compareVersions("1.5.0", version)) {
  11044. return true;
  11045. }
  11046. return false;
  11047. },
  11048. IEInstall: function() {
  11049. location.href = constructGetJavaURL(
  11050. ((this.returnPage != null) ?
  11051. ('&returnPage=' + this.returnPage) : '') +
  11052. ((this.locale != null) ?
  11053. ('&locale=' + this.locale) : '') +
  11054. ((this.brand != null) ? ('&brand=' + this.brand) : ''));
  11055. // should not actually get here
  11056. return false;
  11057. },
  11058. done: function (name, result) {
  11059. },
  11060. FFInstall: function() {
  11061. location.href = constructGetJavaURL(
  11062. ((this.returnPage != null) ?
  11063. ('&returnPage=' + this.returnPage) : '') +
  11064. ((this.locale != null) ?
  11065. ('&locale=' + this.locale) : '') +
  11066. ((this.brand != null) ? ('&brand=' + this.brand) : '') +
  11067. ((this.installType != null) ?
  11068. ('&type=' + this.installType) : ''));
  11069. // should not actually get here
  11070. return false;
  11071. },
  11072. // return true if 'installed' (considered as a JRE version string) is
  11073. // greater than or equal to 'required' (again, a JRE version string).
  11074. compareVersions: function(installed, required) {
  11075. var a = installed.split('.');
  11076. var b = required.split('.');
  11077. for (var i = 0; i < a.length; ++i) {
  11078. a[i] = Number(a[i]);
  11079. }
  11080. for (var i = 0; i < b.length; ++i) {
  11081. b[i] = Number(b[i]);
  11082. }
  11083. if (a.length == 2) {
  11084. a[2] = 0;
  11085. }
  11086. if (a[0] > b[0]) return true;
  11087. if (a[0] < b[0]) return false;
  11088. if (a[1] > b[1]) return true;
  11089. if (a[1] < b[1]) return false;
  11090. if (a[2] > b[2]) return true;
  11091. if (a[2] < b[2]) return false;
  11092. return true;
  11093. },
  11094. enableAlerts: function() {
  11095. // reset this so we can show the browser detection
  11096. this.browserName = null;
  11097. this.debug = true;
  11098. },
  11099. poll: function() {
  11100. this.refresh();
  11101. var postInstallJREList = this.getJREs();
  11102. if ((this.preInstallJREList.length == 0) &&
  11103. (postInstallJREList.length != 0)) {
  11104. clearInterval(this.myInterval);
  11105. if (this.returnPage != null) {
  11106. location.href = this.returnPage;
  11107. };
  11108. }
  11109. if ((this.preInstallJREList.length != 0) &&
  11110. (postInstallJREList.length != 0) &&
  11111. (this.preInstallJREList[0] != postInstallJREList[0])) {
  11112. clearInterval(this.myInterval);
  11113. if (this.returnPage != null) {
  11114. location.href = this.returnPage;
  11115. }
  11116. }
  11117. },
  11118. writePluginTag: function() {
  11119. var browser = this.getBrowser();
  11120. if (browser == 'MSIE') {
  11121. document.write('<' +
  11122. 'object classid="clsid:CAFEEFAC-DEC7-0000-0001-ABCDEFFEDCBA" ' +
  11123. 'id="deployJavaPlugin" width="0" height="0">' +
  11124. '<' + '/' + 'object' + '>');
  11125. } else if (browser == 'Netscape Family' && this.allowPlugin()) {
  11126. this.writeEmbedTag();
  11127. }
  11128. },
  11129. refresh: function() {
  11130. navigator.plugins.refresh(false);
  11131. var browser = this.getBrowser();
  11132. if (browser == 'Netscape Family' && this.allowPlugin()) {
  11133. var plugin = document.getElementById('deployJavaPlugin');
  11134. // only do this again if no plugin
  11135. if (plugin == null) {
  11136. this.writeEmbedTag();
  11137. }
  11138. }
  11139. },
  11140. writeEmbedTag: function() {
  11141. var written = false;
  11142. if (navigator.mimeTypes != null) {
  11143. for (var i=0; i < navigator.mimeTypes.length; i++) {
  11144. if (navigator.mimeTypes[i].type == this.mimeType) {
  11145. if (navigator.mimeTypes[i].enabledPlugin) {
  11146. document.write('<' +
  11147. 'embed id="deployJavaPlugin" type="' +
  11148. this.mimeType + '" hidden="true" />');
  11149. written = true;
  11150. }
  11151. }
  11152. }
  11153. // if we ddn't find new mimeType, look for old mimeType
  11154. if (!written) for (var i=0; i < navigator.mimeTypes.length; i++) {
  11155. if (navigator.mimeTypes[i].type == this.oldMimeType) {
  11156. if (navigator.mimeTypes[i].enabledPlugin) {
  11157. document.write('<' +
  11158. 'embed id="deployJavaPlugin" type="' +
  11159. this.oldMimeType + '" hidden="true" />');
  11160. }
  11161. }
  11162. }
  11163. }
  11164. }
  11165. }; // deployJava object
  11166. rv.writePluginTag();
  11167. if (rv.locale == null) {
  11168. var loc = null;
  11169. if (loc == null) try {
  11170. loc = navigator.userLanguage;
  11171. } catch (err) { }
  11172. if (loc == null) try {
  11173. loc = navigator.systemLanguage;
  11174. } catch (err) { }
  11175. if (loc == null) try {
  11176. loc = navigator.language;
  11177. } catch (err) { }
  11178. if (loc != null) {
  11179. loc.replace("-","_")
  11180. rv.locale = loc;
  11181. }
  11182. }
  11183. return rv;
  11184. }();
  11185. window.PINYIN_DICT = [["a","啊阿吖嗄腌锕"],["ai","爱埃挨哎唉哀皑癌蔼矮艾碍隘捱嗳嗌嫒瑷暧砹锿霭"],["an","安案按鞍氨俺暗岸胺谙埯揞犴庵桉铵鹌黯"],["ang","肮昂盎"],["ao","凹敖熬翱袄傲奥懊澳坳拗嗷岙廒遨媪骜獒聱螯鏊鳌鏖"],["ba","芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸茇菝岜灞钯粑鲅魃"],["bai","白柏百摆佰败拜稗捭掰"],["ban","版般办斑班搬扳颁板扮拌伴瓣半绊阪坂钣瘢癍舨"],["bang","帮邦梆榜膀绑棒磅蚌镑傍谤蒡浜"],["bao","保报包苞胞褒剥薄雹堡饱宝抱暴豹鲍爆炮曝瀑勹葆孢煲鸨褓趵龅"],["bei","北备杯碑悲卑辈背贝钡倍狈惫焙被孛陂邶蓓呗悖碚鹎褙鐾鞴"],["ben","本奔苯笨夯畚坌锛"],["beng","蚌崩绷甭泵蹦迸嘣甏"],["bi","比必币毕逼鼻鄙笔彼碧蓖蔽毙毖庇痹闭敝弊辟壁臂避陛匕俾芘荜荸萆薜吡哔狴庳愎滗濞弼妣婢嬖璧贲睥畀铋秕裨筚箅篦舭襞跸髀"],["bian","变编边便鞭贬扁卞辨辩辫遍匾弁苄忭汴缏煸砭碥窆褊蝙笾鳊"],["biao","表标彪膘婊骠飑飙飚镖镳瘭裱鳔"],["bie","别鳖憋瘪蹩"],["bin","彬斌濒滨宾摈傧豳缤玢槟殡膑镔髌鬓"],["bing","并兵冰柄丙秉饼炳病屏禀邴摒槟"],["bo","播博柏剥薄玻菠拨钵波勃搏铂箔伯帛舶脖膊渤泊驳卜亳啵饽檗擘礴钹鹁簸跛踣"],["bu","不布部步捕卜哺补埠簿怖埔卟逋瓿晡钚钸醭"],["ca","擦嚓礤"],["cai","才采材彩猜裁财睬踩菜蔡"],["can","参餐蚕残惭惨灿孱骖璨粲黪"],["cang","藏苍舱仓沧伧"],["cao","操糙槽曹草嘈漕螬艚"],["ce","册策测厕侧恻"],["ceng","曾层蹭噌"],["cha","查插叉茬茶碴搽察岔差诧刹喳嚓猹馇汊姹杈楂槎檫锸镲衩"],["chai","差拆柴豺侪钗瘥虿"],["chan","产搀掺蝉馋谗缠铲阐颤冁谄蒇廛忏潺澶孱羼婵骣觇禅蟾躔"],["chang","场常长昌猖尝偿肠厂敞畅唱倡裳伥鬯苌菖徜怅惝阊娼嫦昶氅鲳"],["chao","超抄钞朝嘲潮巢吵炒绰剿怊晁焯耖"],["che","车扯撤掣彻澈坼砗"],["chen","称郴臣辰尘晨忱沉陈趁衬沈谌谶抻嗔宸琛榇碜龀"],["cheng","成程称城撑橙呈乘惩澄诚承逞骋秤丞埕枨柽塍瞠铖铛裎蛏酲"],["chi","持吃痴匙池迟弛驰耻齿侈尺赤翅斥炽傺墀茌叱哧啻嗤彳饬媸敕眵鸱瘛褫蚩螭笞篪豉踟魑"],["chong","重充冲虫崇宠茺忡憧铳舂艟"],["chou","抽酬畴踌稠愁筹仇绸瞅丑臭俦帱惆瘳雠"],["chu","出除处础初橱厨躇锄雏滁楚储矗搐触畜亍刍怵憷绌杵楮樗褚蜍蹰黜"],["chuai","揣搋啜嘬膪踹"],["chuan","传川穿椽船喘串舛遄氚钏舡"],["chuang","创疮窗幢床闯怆"],["chui","吹炊捶锤垂椎陲棰槌"],["chun","春椿醇唇淳纯蠢莼鹑蝽"],["chuo","戳绰啜辍踔龊"],["ci","次此词差疵茨磁雌辞慈瓷刺赐茈祠鹚糍"],["cong","从聪葱囱匆丛苁淙骢琮璁枞"],["cou","凑楱辏腠"],["cu","促粗醋簇卒蔟徂猝殂酢蹙蹴"],["cuan","蹿篡窜攒汆撺爨镩"],["cui","摧崔催脆瘁粹淬翠衰萃啐悴璀榱毳"],["cun","存村寸忖皴"],["cuo","错措磋撮搓挫厝嵯脞锉矬痤瘥鹾蹉"],["da","大达打答搭瘩耷哒嗒囗怛妲沓褡笪靼鞑"],["dai","代带呆歹傣戴殆贷袋待逮怠埭甙呔岱迨绐玳黛"],["dan","单但耽担丹郸掸胆旦氮惮淡诞弹蛋石儋凼萏菪啖澹宕殚赕眈疸瘅聃箪"],["dang","当挡党荡档谠砀铛裆"],["dao","到道导刀捣蹈倒岛祷稻悼盗叨氘焘纛"],["de","的地得德锝"],["deng","等登蹬灯瞪凳邓噔嶝戥磴镫簦"],["di","的地第底弟堤低滴迪敌笛狄涤翟嫡抵蒂帝递缔氐籴诋谛邸坻荻嘀娣柢棣觌祗砥碲睇镝羝骶"],["dian","电点典店颠掂滇碘靛垫佃甸惦奠淀殿丶阽坫巅玷钿癜癫簟踮"],["diao","调碉叼雕凋刁掉吊钓铞貂鲷"],["die","跌爹碟蝶迭谍叠垤堞揲喋牒瓞耋鲽"],["ding","定丁盯叮钉顶鼎锭订仃啶玎腚碇町疔耵酊"],["diu","丢铥"],["dong","动东冬董懂栋侗恫冻洞垌咚岽峒氡胨胴硐鸫"],["dou","都兜抖斗陡豆逗痘蔸钭窦蚪篼"],["du","都度读督毒犊独堵睹赌杜镀肚渡妒芏嘟渎椟牍蠹笃髑黩"],["duan","断段短端锻缎椴煅簖"],["dui","对堆兑队敦怼憝碓镦"],["dun","墩吨蹲敦顿囤钝盾遁沌炖砘礅盹趸"],["duo","多度掇哆夺垛躲朵跺舵剁惰堕咄哚沲缍铎裰踱"],["e","阿蛾峨鹅俄额讹娥恶厄扼遏鄂饿哦噩谔垩苊莪萼呃愕屙婀轭腭锇锷鹗颚鳄"],["en","恩蒽摁嗯"],["er","而二儿耳尔饵洱贰迩珥铒鸸鲕"],["fa","发法罚筏伐乏阀珐垡砝"],["fan","范藩帆番翻樊矾钒繁凡烦反返贩犯饭泛蕃蘩幡夂梵攵燔畈蹯"],["fang","方放访房坊芳肪防妨仿纺邡枋钫舫鲂"],["fei","费非菲啡飞肥匪诽吠肺废沸芾狒悱淝妃绯榧腓斐扉砩镄痱蜚篚翡霏鲱"],["fen","分份芬酚吩氛纷坟焚汾粉奋忿愤粪偾瀵棼鲼鼢"],["feng","风丰封枫蜂峰锋疯烽逢冯缝讽奉凤俸酆葑唪沣砜"],["fo","佛"],["fou","否缶"],["fu","服复府父负福富夫敷肤孵扶拂辐幅氟符伏俘浮涪袱弗甫抚辅俯釜斧脯腑腐赴副覆赋傅付阜腹讣附妇缚咐莆匐凫郛芙芾苻茯莩菔拊呋呒幞怫滏艴孚驸绂绋桴赙祓黻黼罘稃馥蚨蜉蝠蝮麸趺跗鲋鳆"],["ga","噶嘎夹轧垓尬尕尜旮钆"],["gai","改该概钙盖溉芥丐陔戤赅"],["gan","感敢干甘杆柑竿肝赶秆赣坩苷尴擀泔淦澉绀橄旰矸疳酐"],["gang","港冈刚钢缸肛纲岗杠戆罡筻"],["gao","告高篙皋膏羔糕搞镐稿睾诰郜藁缟槔槁杲锆"],["ge","个格合歌各革哥搁戈鸽胳疙割葛蛤阁隔铬咯鬲仡哿圪塥嗝纥搿膈硌镉袼颌虼舸骼"],["gei","给"],["gen","根跟亘茛哏艮"],["geng","更耕庚羹埂耿梗哽赓绠鲠"],["gong","公工供功共贡攻恭龚躬宫弓巩汞拱珙肱蚣觥"],["gou","构够购钩勾沟苟狗垢佝诟岣遘媾缑枸觏彀笱篝鞲"],["gu","告故辜菇咕箍估沽孤姑鼓古蛊骨谷股顾固雇贾嘏诂菰崮汩梏轱牯牿臌毂瞽罟钴锢鸪鹄痼蛄酤觚鲴鹘"],["gua","刮瓜剐寡挂褂卦诖呱栝胍鸹"],["guai","乖拐怪掴"],["guan","关管观棺官冠馆罐惯灌贯纶倌莞掼涫盥鹳矜鳏"],["guang","广光逛咣犷桄胱"],["gui","规瑰圭硅归龟闺轨鬼诡癸桂柜跪贵刽匦刿庋宄妫桧炅晷皈簋鲑鳜"],["gun","辊滚棍衮绲磙鲧"],["guo","国过果锅郭裹馘埚掴呙帼崞猓椁虢聒蜾蝈"],["ha","哈蛤铪"],["hai","还海孩骸氦亥害骇嗨胲醢"],["han","韩酣憨邯含涵寒函喊罕翰撼捍旱憾悍焊汗汉邗菡撖犴阚瀚晗焓顸颔蚶鼾"],["hang","行杭夯航吭沆绗颃"],["hao","好号壕嚎豪毫郝耗浩貉蒿薅嗥嚆濠灏昊皓颢蚝"],["he","何合呵喝荷菏核禾和盒貉阂河涸赫褐鹤贺诃劾壑嗬阖曷盍颌蚵翮"],["hei","嘿黑"],["hen","很痕狠恨"],["heng","哼亨横衡恒蘅珩桁"],["hong","轰哄烘虹鸿洪宏弘红黉訇讧荭蕻薨闳泓"],["hou","后候喉侯猴吼厚堠後逅瘊篌糇鲎骺"],["hu","户护乎互和呼忽瑚壶葫胡蝴狐糊湖弧虎唬沪冱唿囫岵猢怙惚浒滹琥槲轷觳烀煳戽扈祜瓠鹄鹕鹱笏醐斛鹘"],["hua","话华化划花哗猾滑画骅桦砉铧"],["huai","槐徊怀淮坏踝"],["huan","还欢环桓缓换患唤痪豢焕涣宦幻郇奂萑擐圜獾洹浣漶寰逭缳锾鲩鬟"],["huang","荒慌黄磺蝗簧皇凰惶煌晃幌恍谎隍徨湟潢遑璜肓癀蟥篁鳇"],["hui","会回恢挥灰辉徽蛔毁悔慧卉惠晦贿秽烩汇讳诲绘诙茴荟蕙咴喙隳洄彗缋珲桧晖恚虺蟪麾"],["hun","荤昏婚魂浑混诨馄阍溷珲"],["huo","活或获和豁伙火惑霍货祸劐藿攉嚯夥钬锪镬耠蠖"],["ji","系己机技计级积际及基击记济辑即几继集极给绩激圾畸稽箕肌饥迹讥鸡姬缉吉棘籍急疾汲嫉挤脊蓟冀季伎祭剂悸寄寂既忌妓纪藉骑亟乩剞佶偈墼芨芰荠蒺蕺掎叽咭哜唧岌嵴洎屐骥畿玑楫殛戟戢赍觊犄齑矶羁嵇稷瘠虮笈笄暨跻跽霁鲚鲫髻麂"],["jia","家加价佳嘉枷夹荚颊贾甲钾假稼架驾嫁茄伽郏葭岬浃迦珈戛胛恝铗镓痂瘕蛱笳袈跏"],["jian","间件建简荐见健检坚监减键歼尖笺煎兼肩艰奸缄茧柬碱硷拣捡俭剪槛鉴践贱箭舰剑饯渐溅涧僭谏谫菅蒹搛囝湔蹇謇缣枧楗戋戬牮犍毽腱睑锏鹣裥笕翦踺鲣鞯"],["jiang","江强僵姜将浆疆蒋桨奖讲匠酱降茳洚绛缰犟礓耩糨豇靓"],["jiao","教交校较蕉椒礁焦胶郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿酵轿叫窖佼僬艽茭挢噍峤徼湫姣敫皎鹪蛟醮跤鲛"],["jie","接结解介界阶姐揭皆秸街截劫节桔杰捷睫竭洁戒藉芥借疥诫届讦诘拮喈嗟婕孑桀碣疖颉蚧羯鲒骱"],["jin","进今金近仅津尽巾筋斤襟紧锦谨靳晋禁烬浸劲卺荩堇噤馑廑妗缙瑾槿赆觐衿矜"],["jing","经京精境睛竞竟荆兢茎晶鲸惊粳井警景颈静敬镜径痉靖净刭儆阱菁獍憬泾迳弪婧肼胫腈旌箐"],["jiong","炯窘迥扃"],["jiu","就究酒揪纠玖韭久灸九厩救旧臼舅咎疚僦啾阄柩桕鸠鹫赳鬏"],["ju","具且据车举巨鞠拘狙疽居驹菊局咀矩沮聚拒距踞锯俱句惧炬剧倨讵苣苴莒掬遽屦琚枸椐榘榉橘犋飓钜锔窭裾趄醵踽龃雎鞫"],["juan","捐鹃娟倦眷卷绢鄄狷涓桊蠲锩镌隽"],["jue","觉决绝嚼撅攫抉掘倔爵诀厥劂谲矍蕨噘噱崛獗孓珏桷橛爝镢蹶觖"],["jun","均菌钧军君峻俊竣浚郡骏捃皲筠麇"],["ka","喀咖卡咯佧咔胩"],["kai","开揩楷凯慨剀垲蒈忾恺铠锎锴"],["kan","看槛刊堪勘坎砍侃莰阚戡龛瞰"],["kang","康慷糠扛抗亢炕伉闶钪"],["kao","考拷烤靠尻栲犒铐"],["ke","可科客课坷苛柯棵磕颗壳咳渴克刻嗑岢恪溘骒缂珂轲氪瞌钶锞稞疴窠颏蝌髁"],["ken","肯啃垦恳裉龈"],["keng","坑吭铿"],["kong","控空恐孔倥崆箜"],["kou","口抠扣寇芤蔻叩囗眍筘"],["ku","枯哭窟苦酷库裤刳堀喾绔骷"],["kua","夸垮挎跨胯侉"],["kuai","会快块筷侩蒯郐哙狯浍脍"],["kuan","款宽髋"],["kuang","况匡筐狂框矿眶旷诓诳邝圹夼哐纩贶"],["kui","亏盔岿窥葵奎魁傀馈愧溃馗匮夔隗蒉揆喹喟悝愦逵暌睽聩蝰篑跬"],["kun","坤昆捆困悃阃琨锟醌鲲髡"],["kuo","括扩廓阔蛞"],["la","垃拉喇蜡腊辣啦落剌邋旯砬瘌"],["lai","来莱赖崃徕涞濑赉睐铼癞籁"],["lan","览蓝婪栏拦篮阑兰澜谰揽懒缆烂滥岚漤榄斓罱镧褴"],["lang","琅榔狼廊郎朗浪蒗啷阆稂螂"],["lao","老捞劳牢佬姥酪烙涝潦唠崂忉栳铑铹痨耢醪"],["le","了乐勒仂叻泐鳓"],["lei","类雷镭蕾磊累儡垒擂肋泪羸诔嘞嫘缧檑耒酹"],["leng","棱楞冷塄愣"],["li","理里力立历离利丽厘梨犁黎篱狸漓李鲤礼莉荔吏栗厉励砾傈例俐痢粒沥隶璃哩俪俚郦坜苈莅蓠藜呖唳喱猁溧澧逦娌嫠骊缡枥栎轹膦戾砺詈罹锂鹂疠疬蛎蜊蠡笠篥粝醴跞雳鲡鳢黧"],["lia","俩"],["lian","联链连练脸莲镰廉怜涟帘敛恋炼蔹奁潋濂琏楝殓臁裢裣蠊鲢"],["liang","量两良亮俩粮凉梁粱辆晾谅墚莨椋锒踉靓魉"],["liao","了料疗撩聊僚燎寥辽潦撂镣廖蓼尥嘹獠寮缭钌鹩"],["lie","列裂烈劣猎冽埒捩咧洌趔躐鬣"],["lin","琳林磷霖临邻鳞淋凛赁吝拎蔺啉嶙廪懔遴檩辚瞵粼躏麟"],["ling","领另铃令玲菱零龄伶羚凌灵陵岭酃苓呤囹泠绫柃棂瓴聆蛉翎鲮"],["liu","留浏流溜琉榴硫馏刘瘤柳六遛骝绺旒熘锍镏鹨鎏"],["long","龙聋咙笼窿隆垄拢陇垅茏泷珑栊胧砻癃"],["lou","楼娄搂篓漏陋露偻蒌喽嵝镂瘘耧蝼髅"],["lu","录陆芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄戮垆撸噜泸渌漉逯璐栌橹轳辂辘氇胪镥鸬鹭簏舻鲈"],["lv","律旅虑驴吕铝侣履屡缕氯率滤绿偻捋闾榈膂稆褛"],["luan","峦挛孪滦卵乱脔娈栾鸾銮"],["lue","略掠锊"],["lun","论抡轮伦仑沦纶囵"],["luo","络咯烙萝螺罗逻锣箩骡裸落洛骆倮蠃荦摞猡泺漯珞椤脶镙瘰跞雒"],["ma","码妈马麻玛蚂骂嘛吗抹唛犸杩蟆麽"],["mai","买埋麦卖迈脉劢荬霾"],["man","满瞒馒蛮蔓曼慢漫谩墁幔缦熳镘颟螨鳗鞔"],["mang","芒茫盲氓忙莽邙漭硭蟒"],["mao","贸猫茅锚毛矛铆卯茂冒帽貌袤茆峁泖瑁昴牦耄旄懋瞀蝥蟊髦"],["me","么麽"],["mei","没美每媒魅玫枚梅酶霉煤眉镁昧寐妹媚糜莓嵋猸浼湄楣镅鹛袂"],["men","们门闷扪焖懑钔"],["meng","盟萌蒙檬锰猛梦孟勐甍瞢懵朦礞虻蜢蠓艋艨"],["mi","密眯醚靡糜迷谜弥米秘觅泌蜜幂芈谧咪嘧猕汨宓弭脒祢敉縻麋"],["mian","面免棉眠绵冕勉娩缅沔渑湎腼眄"],["miao","描苗瞄藐秒渺庙妙喵邈缈缪杪淼眇鹋"],["mie","蔑灭乜咩蠛篾"],["min","民抿皿敏悯闽苠岷闵泯缗玟珉愍黾鳘"],["ming","明名命螟鸣铭冥茗溟暝瞑酩"],["miu","谬缪"],["mo","没模脉摸摹蘑膜磨摩魔抹末莫墨默沫漠寞陌谟茉蓦馍嫫嬷殁镆秣瘼耱貊貘麽"],["mou","谋牟某侔哞缪眸蛑鍪"],["mu","目母牟拇牡亩姆墓暮幕募慕木睦牧穆仫坶苜沐毪钼"],["na","那拿哪呐钠娜纳讷捺肭镎衲"],["nai","氖乃奶耐奈鼐佴艿萘柰"],["nan","男南难喃囝囡楠腩蝻赧"],["nang","囊攮囔馕曩"],["nao","脑挠恼闹淖孬垴呶猱瑙硇铙蛲"],["ne","呢讷"],["nei","内馁"],["nen","嫩恁"],["neng","能"],["ni","你妮霓倪泥尼拟匿腻逆溺伲坭蘼猊怩昵旎睨铌鲵"],["nian","年蔫拈碾撵捻念粘廿埝辇黏鲇鲶"],["niang","娘酿"],["niao","鸟尿茑嬲脲袅"],["nie","捏聂孽啮镊镍涅乜陧蘖嗫颞臬蹑"],["nin","您"],["ning","柠狞凝宁拧泞佞咛甯聍"],["niu","牛扭钮纽拗狃忸妞"],["nong","农脓浓弄侬哝"],["nu","努奴怒弩胬孥驽"],["nv","女恧钕衄"],["nuan","暖"],["nue","虐疟挪"],["nuo","娜懦糯诺傩搦喏锘"],["o","哦噢"],["ou","欧鸥殴藕呕偶沤讴怄瓯耦"],["pa","扒耙啪趴爬帕怕琶葩杷筢"],["pai","牌派排拍徘湃俳蒎哌"],["pan","攀潘盘磐盼畔判叛胖拚爿泮袢襻蟠蹒"],["pang","磅乓庞旁耪胖彷夂滂逄攵螃"],["pao","抛咆刨炮袍跑泡匏狍庖脬疱"],["pei","培配呸胚裴赔陪佩沛辔帔旆锫醅霈"],["pen","喷盆湓"],["peng","朋砰抨烹澎彭蓬棚硼篷膨鹏捧碰堋嘭怦蟛"],["pi","否被辟坯砒霹批披劈琵毗啤脾疲皮匹痞僻屁譬丕仳陴邳郫圮埤鼙芘擗噼庀淠媲纰枇甓罴铍癖疋蚍蜱貔"],["pian","片便篇偏骗谝骈犏胼翩蹁"],["piao","漂飘瓢票剽莩嘌嫖缥殍瞟螵"],["pie","撇瞥丿苤彡氕"],["pin","品频聘拼贫姘嫔榀牝颦"],["ping","评平冯乒坪苹萍凭瓶屏俜娉枰鲆"],["po","坡泼颇婆破魄迫粕叵鄱珀钋钷皤笸"],["pu","普暴扑铺仆莆葡菩蒲埔朴圃浦谱曝瀑匍噗溥濮璞氆镤镨蹼"],["qi","其企起期汽器启气奇缉欺栖戚妻七凄漆柒沏棋歧畦崎脐齐旗祈祁骑岂乞契砌迄弃泣讫亓俟圻芑芪萁萋葺蕲嘁屺岐汔淇骐绮琪琦杞桤槭耆祺憩碛颀蛴蜞綦鳍麒"],["qia","夹掐恰洽葜袷髂"],["qian","前钱牵扦钎铅千迁签仟谦乾黔钳潜遣浅谴堑嵌欠歉纤倩佥阡芊芡茜荨掮岍悭慊骞搴褰缱椠肷愆钤虔箝"],["qiang","强将枪呛腔羌墙蔷抢戕嫱樯戗炝锖锵镪襁蜣羟跄"],["qiao","壳橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍削劁诮谯荞峤愀憔缲樵硗跷鞒"],["qie","且切茄怯窃郄惬慊妾挈锲箧趄"],["qin","亲钦侵秦琴勤芹擒禽寝沁芩揿吣嗪噙溱檎锓矜覃螓衾"],["qing","情请庆轻青氢倾卿清擎晴氰顷苘圊檠磬蜻罄綮謦鲭黥"],["qiong","琼穷邛茕穹蛩筇跫銎"],["qiu","求球秋丘邱囚酋泅俅巯犰湫逑遒楸赇虬蚯蝤裘糗鳅鼽"],["qu","区去取曲趋蛆躯屈驱渠娶龋趣诎劬苣蕖蘧岖衢阒璩觑氍朐祛磲鸲癯蛐蠼麴瞿黢"],["quan","全权圈颧醛泉痊拳犬券劝诠荃犭悛绻辁畎铨蜷筌鬈"],["que","确缺炔瘸却鹊榷雀阕阙悫"],["qun","裙群逡麇"],["ran","然燃冉染苒蚺髯"],["rang","让瓤壤攘嚷禳穰"],["rao","饶扰绕荛娆桡"],["re","惹热喏"],["ren","人任认壬仁忍韧刃妊纫仞荏饪轫稔衽"],["reng","扔仍"],["ri","日"],["rong","容戎茸蓉荣融熔溶绒冗嵘狨榕肜蝾"],["rou","揉柔肉糅蹂鞣"],["ru","如入茹蠕儒孺辱乳汝褥蓐薷嚅洳溽濡缛铷襦颥"],["ruan","软阮朊"],["rui","蕊瑞锐芮蕤枘睿蚋"],["run","闰润"],["ruo","若弱偌箬"],["sa","撒洒萨卅挲脎飒"],["sai","赛腮鳃塞噻"],["san","三叁伞散仨彡馓毵糁"],["sang","桑嗓丧搡磉颡"],["sao","搔骚扫嫂埽缫臊瘙鳋"],["se","色塞瑟涩啬铯穑"],["sen","森"],["seng","僧"],["sha","莎砂杀刹沙纱傻啥煞厦唼挲歃铩痧裟霎鲨"],["shai","筛晒酾"],["shan","删山珊苫杉煽衫闪陕擅赡膳善汕扇缮栅剡讪鄯埏芟潸姗嬗骟膻钐疝蟮舢跚鳝"],["shang","上商尚赏墒伤晌裳垧泷绱殇熵觞"],["shao","少绍鞘梢捎稍烧芍勺韶哨邵劭苕潲杓蛸筲艄"],["she","设社奢赊蛇舌舍赦摄射慑涉厍佘揲猞滠歙畲麝"],["shen","什身参深神甚申砷呻伸娠绅沈审婶肾慎渗诜谂莘葚哂渖椹胂矧蜃糁"],["sheng","生声乘甥牲升绳省盛剩胜圣嵊渑晟眚笙"],["shi","是时式什市实使事示始世施识视试师史十食势释失室匙狮湿诗尸虱石拾蚀矢屎驶士柿拭誓逝嗜噬适仕侍饰氏恃嘘谥埘莳蓍弑轼贳炻礻铈螫舐筮豕鲥鲺"],["shou","手首受授收售守寿瘦兽狩绶艏"],["shu","数术束输属殊述蔬枢梳抒叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠树戍竖墅庶漱恕俞丨倏塾菽摅沭澍姝纾毹腧殳秫"],["shua","刷耍唰"],["shuai","率摔衰甩帅蟀"],["shuan","栓拴闩涮"],["shuang","霜双爽孀"],["shui","说水谁睡税"],["shun","吮瞬顺舜"],["shuo","数说硕朔烁蒴搠妁槊铄"],["si","司思似食四斯撕嘶私丝死肆寺嗣伺饲巳厮俟兕厶咝汜泗澌姒驷缌祀锶鸶耜蛳笥"],["song","松送耸怂颂宋讼诵凇菘崧嵩忪悚淞竦"],["sou","搜艘擞嗽叟薮嗖嗾馊溲飕瞍锼螋"],["su","速诉苏素酥俗粟僳塑溯宿肃缩夙谡蔌嗉愫涑簌觫稣"],["suan","算酸蒜狻"],["sui","虽随隋绥髓碎岁穗遂隧祟谇荽濉邃燧眭睢"],["sun","孙损笋荪狲飧榫隼"],["suo","所索莎蓑梭唆缩琐锁唢嗦嗍娑桫挲睃羧"],["ta","他它她塌塔獭挞蹋踏嗒闼溻漯遢榻沓铊趿鳎"],["tai","大态台胎苔抬泰酞太汰邰薹骀肽炱钛跆鲐"],["tan","坛弹坍摊贪瘫滩檀痰潭谭谈坦毯袒碳探叹炭郯澹昙忐钽锬覃"],["tang","汤塘搪堂棠膛唐糖倘躺淌趟烫傥帑惝溏瑭樘铴镗耥螗螳羰醣"],["tao","讨掏涛滔绦萄桃逃淘陶套鼗叨啕洮韬饕"],["te","特忒忑慝铽"],["teng","藤腾疼誊滕"],["ti","题提体梯剔踢锑蹄啼替嚏惕涕剃屉倜荑悌逖绨缇鹈裼醍"],["tian","天添填田甜恬舔腆掭忝阗殄畋"],["tiao","调条挑迢眺跳佻苕祧窕蜩笤粜龆鲦髫"],["tie","帖贴铁萜餮"],["ting","庭听厅烃汀廷停亭挺艇莛葶婷梃铤蜓霆"],["tong","同统通桐酮瞳铜彤童桶捅筒痛佟仝茼嗵恸潼砼"],["tou","投头偷透骰"],["tu","图突凸秃徒途涂屠土吐兔堍荼菟钍酴"],["tuan","团湍抟彖疃"],["tui","推颓腿蜕褪退忒煺"],["tun","囤褪吞屯臀氽饨暾豚"],["tuo","拖托脱鸵陀驮驼椭妥拓唾乇佗坨庹沱柝??橐砣箨酡跎鼍"],["wa","挖哇蛙洼娃瓦袜佤娲腽"],["wai","外歪崴"],["wan","完湾万晚玩蔓豌弯顽丸烷碗挽皖惋宛婉腕剜芄莞菀纨绾琬脘畹蜿"],["wang","网望汪王亡枉往旺忘妄罔惘辋魍"],["wei","为位威未围维委巍微危韦违桅唯惟潍苇萎伟伪尾纬蔚味畏胃喂魏渭谓尉慰卫偎诿隈隗圩葳薇帏帷崴嵬猥猬闱沩洧涠逶娓玮韪軎炜煨痿艉鲔"],["wen","文问闻稳瘟温蚊纹吻紊刎夂阌汶璺攵雯"],["weng","嗡翁瓮蓊蕹"],["wo","我挝蜗涡窝斡卧握沃倭莴喔幄渥肟硪龌"],["wu","务无误物午恶巫呜钨乌污诬屋芜梧吾吴毋武五捂舞伍侮坞戊雾晤勿悟兀仵阢邬圬芴唔庑怃忤寤迕妩婺骛杌牾焐鹉鹜痦蜈鋈鼯"],["xi","系息戏习希细西喜析栖昔熙硒矽晰嘻吸锡牺稀悉膝夕惜熄烯溪汐犀檄袭席媳铣洗隙僖兮隰郗茜菥葸蓰奚唏徙饩阋浠淅屣嬉玺樨曦觋欷歙熹禊禧皙穸裼蜥螅蟋舄舾羲粞翕醯蹊鼷"],["xia","下瞎虾匣霞辖暇峡侠狭厦夏吓呷狎遐瑕柙硖罅黠"],["xian","现限线显先见献衔险铣掀锨仙鲜纤咸贤舷闲涎弦嫌县腺馅羡宪陷冼苋莶藓岘猃暹娴氙燹祆鹇痫蚬筅籼酰跣跹霰"],["xiang","相想项享详象响香像向降厢镶箱襄湘乡翔祥巷橡芗葙饷庠骧缃蟓鲞飨"],["xiao","小销消效校萧硝霄削哮嚣宵淆晓孝肖啸笑哓崤潇逍骁绡枭枵蛸筱箫魈"],["xie","些谢械楔歇蝎鞋协挟携邪斜胁谐写卸蟹懈泄泻屑偕亵勰燮薤撷獬廨渫瀣邂绁缬榭榍颉蹀躞"],["xin","信新心欣薪芯锌辛忻衅囟馨莘昕歆镡鑫"],["xing","行形型性幸姓省星腥猩惺兴刑邢醒杏陉荇荥擤饧悻硎"],["xiong","兄凶胸匈汹雄熊芎"],["xiu","修秀臭休羞朽嗅锈袖绣咻岫馐庥溴鸺貅髹"],["xu","需许须序续墟戌虚嘘徐蓄酗叙旭畜恤絮婿绪吁诩勖圩蓿洫溆顼栩肷煦盱胥糈醑"],["xuan","选宣轩喧悬旋玄癣眩绚儇谖萱揎泫渲漩璇楦暄炫煊碹铉镟痃"],["xue","学削靴薛穴雪血谑噱泶踅鳕"],["xun","询训讯迅寻浚勋熏循旬驯巡殉汛逊巽郇埙荀荨蕈薰峋徇獯恂洵浔曛窨醺鲟"],["ya","压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶轧伢垭揠岈迓娅琊桠氩砑睚痖"],["yan","言研验眼严颜焉咽阉烟淹盐蜒岩延阎炎沿奄掩衍演艳堰燕厌砚雁唁彦焰宴谚殷厣赝剡俨偃兖谳郾鄢埏芫菸崦恹闫阏湮滟妍嫣琰檐晏胭腌焱罨筵酽趼魇餍鼹"],["yang","样央阳养殃鸯秧杨扬佯疡羊洋氧仰痒漾徉怏泱炀烊恙蛘鞅"],["yao","要邀腰妖瑶摇尧遥窑谣姚咬舀药耀钥夭爻吆崾徭幺珧杳轺曜肴铫鹞窈繇鳐麽"],["ye","业也页椰噎耶爷野冶掖叶曳腋夜液拽靥谒邺揶揲晔烨铘"],["yi","一以已意易议医移艺益义艾蛇壹揖铱依伊衣颐夷遗仪胰疑沂宜姨彝椅蚁倚乙矣抑邑屹亿役臆逸肄疫亦裔毅忆溢诣谊译异翼翌绎刈劓佚佾诒圯埸懿苡荑薏弈奕挹弋呓咦咿嗌噫峄嶷猗饴怿怡悒漪迤驿缢殪轶贻欹旖熠眙钇镒镱痍瘗癔翊蜴舣羿翳酏黟"],["yin","因音引银茵荫殷阴姻吟淫寅饮尹隐印胤鄞垠堙茚吲喑狺夤洇氤铟瘾窨蚓霪龈"],["ying","影应营英迎樱婴鹰缨莹萤荧蝇赢盈颖硬映嬴郢茔荥莺萦蓥撄嘤膺滢潆瀛瑛璎楹媵鹦瘿颍罂"],["yo","哟唷"],["yong","用拥永佣臃痈庸雍踊蛹咏泳涌恿勇俑壅墉喁慵邕镛甬鳙饔"],["you","有游由友优右邮幽悠忧尤铀犹油酉佑釉诱又幼卣攸侑莠莜莸尢呦囿宥柚猷牖铕疣蚰蚴蝣蝤繇鱿黝鼬"],["yu","于育语域娱与遇尉迂淤盂榆虞愚舆余俞逾鱼愉渝渔隅予雨屿禹宇羽玉芋郁吁喻峪御愈欲狱誉浴寓裕预豫驭粥禺毓伛俣谀谕萸蓣揄圄圉嵛狳饫馀庾阈鬻妪妤纡瑜昱觎腴欤於煜熨燠聿畲钰鹆鹬瘐瘀窬窳蜮蝓竽臾舁雩龉"],["yuan","员原源元院远鸳渊冤垣袁援辕园圆猿缘苑愿怨垸塬芫掾圜沅媛瑗橼爰眢鸢螈箢鼋"],["yue","说乐阅越曰约跃钥岳粤月悦龠哕瀹栎樾刖钺"],["yun","运耘云郧匀陨允蕴酝晕韵孕郓芸狁恽愠纭韫殒昀氲熨筠"],["za","匝砸杂咋拶咂"],["zai","在载子再栽哉灾宰崽甾"],["zan","暂咱攒赞瓒昝簪糌趱錾"],["zang","赃脏葬奘驵臧"],["zao","造遭糟凿藻枣早澡蚤躁噪皂灶燥唣"],["ze","责择则泽咋仄赜啧帻迮昃笮箦舴"],["zei","贼"],["zen","怎谮"],["zeng","增综曾憎赠缯甑罾锃"],["zha","扎喳渣札轧铡闸眨栅榨咋乍炸诈柞揸吒咤哳楂砟痄蚱齄"],["zhai","翟摘斋宅窄债寨砦瘵"],["zhan","站展战瞻毡詹粘沾盏斩辗崭蘸栈占湛绽谵搌旃"],["zhang","章长张樟彰漳掌涨杖丈帐账仗胀瘴障仉鄣幛嶂獐嫜璋蟑"],["zhao","着照找招朝昭沼赵罩兆肇召爪诏棹钊笊"],["zhe","这者着浙遮折哲蛰辙锗蔗乇谪摺柘辄磔鹧褶蜇螫赭"],["zhen","真圳珍斟甄砧臻贞针侦枕疹诊震振镇阵帧蓁浈缜桢椹榛轸赈胗朕祯畛稹鸩箴"],["zheng","正政整证争蒸挣睁征狰怔拯症郑诤峥徵钲铮筝"],["zhi","只之知制置址支直至织治质执职值致指志芝枝吱蜘肢脂汁植殖侄止趾旨纸挚掷帜峙智秩稚炙痔滞窒卮陟郅埴芷摭帙忮彘咫骘栉枳栀桎轵轾贽胝膣祉黹雉鸷痣蛭絷酯跖踬踯豸觯"],["zhong","中种重终盅忠钟衷肿仲众冢忪锺螽舯踵"],["zhou","州舟周洲诌粥轴肘帚咒皱宙昼骤荮啁妯纣绉胄碡籀繇酎"],["zhu","注主助筑属珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱著柱蛀贮铸住祝驻伫侏邾苎茱洙渚潴杼槠橥炷铢疰瘃竺箸舳翥躅麈"],["zhua","挝抓爪"],["zhuai","拽"],["zhuan","专传转砖撰赚篆啭馔颛"],["zhuang","状装幢桩庄妆撞壮僮"],["zhui","椎锥追赘坠缀萑惴骓缒隹"],["zhun","准屯谆肫窀"],["zhuo","着捉拙卓桌琢茁酌啄灼浊倬诼擢浞涿濯禚斫镯"],["zi","自资子字咨兹姿滋淄孜紫仔籽滓渍谘茈呲嵫姊孳缁梓辎赀恣眦锱秭耔笫粢趑觜訾龇鲻髭"],["zong","综总鬃棕踪宗纵偬腙粽"],["zou","邹走奏揍诹陬鄹驺鲰"],["zu","组足租卒族祖诅阻俎菹镞"],["zuan","钻纂攥缵躜"],["zui","最嘴醉罪蕞觜"],["zun","尊遵撙樽鳟"],["zuo","作左昨佐柞做坐座阼唑嘬怍胙祚笮酢"]];
  11186. var PINYIN_DICT_CACHE = {};
  11187. for(var i=0,l=PINYIN_DICT.length; i<l; i++){
  11188. var hans = PINYIN_DICT[i][1];
  11189. for(var j=0,m=hans.length; j<m; j++){
  11190. var han = hans.charAt(j);
  11191. if(!PINYIN_DICT_CACHE[han]){
  11192. PINYIN_DICT_CACHE[han] = new Array();
  11193. }
  11194. PINYIN_DICT_CACHE[han].push(PINYIN_DICT[i][0]);
  11195. }
  11196. }
  11197. window.PINYIN_DICT = null;/**通用ajax服务的定义对象
  11198. * services可以是单个服务对象,也可以是service服务数组
  11199. * 具体服务的定义请参考appendServices成员函数
  11200. */
  11201. function Service(services){
  11202. this.services=[];
  11203. this.shareParameters={};
  11204. /**添加共享参数,在这里统一设置共享参数
  11205. */
  11206. this.addShareParameters=function(shareParameters){
  11207. this.shareParameters=shareParameters;
  11208. return this;
  11209. };
  11210. /**
  11211. * 批量调用一般服务
  11212. * 入参可以是一个调用服务的数组或者单个调用服务
  11213. * 每个调用服务有下面的属性
  11214. * serviceId 服务Id,不可为空
  11215. * method 服务方法名,不可为空
  11216. * parameters 服务参数,必须是object,object的属性名代表参数名,属性值代表参数值。
  11217. * transform:结果集的转换规则(返回结果集合List<Map<String,Object>>时才会用到):null(无转换)、'firstRow'(取首行)、'breakdown'(分列),值不区分大小写
  11218. * shareResults 共享服务的返回结果,默认不共享false,如果后续服务需要使用到结果里面的参数,
  11219. * 那么就需要明确指定。该参数可以是 boolean,array或者object,为true时表示全部共享;
  11220. * 数组可以指定返回值中需要共享的值的名,这样返回值的键值对应关系共享;
  11221. * object可以额外指定共享名的别名,当要求返回值以新的字段名共享、
  11222. * 或者一个以多个新别名共享时就需要用到这种类型,object的属性名表示结果集中需要共享的字段名,
  11223. * 属性值表示新的字段名;
  11224. * 参数共享处理列表结果集时,整个结果集的数据存放在别名为空串的特殊key上。如果本业务没有返回结果,那么参数共享无效。
  11225. * useShare 使用共享参数标志,定义方式与shareResults一样,意义正好想对应。该参数指明如果从共享参数中获取要的值。
  11226. * shareNotNull 校验共享参数是否为空,作为useShare的附属属性。
  11227. * 有时希望如果获取到的共享参数是空的,那么不继续执行,那么可以在这里指定哪些一定不能为空。
  11228. * 目前只允许三种取值,null,true和别名数组,null表示不校验,true表示全校验,别名数组表示只校验指定的值(别名是指useShare中新的别名,并非共享池里面的共享别名)。
  11229. */
  11230. this.appendServices=function(services){
  11231. if(!services){
  11232. return this;
  11233. }
  11234. //默认按批量形式添加服务,如果是单个,那么用数组包装
  11235. var tmp_services=services;
  11236. if(!$.isArray(tmp_services)){
  11237. tmp_services = [tmp_services];
  11238. }
  11239. //每个service必须有serviceId,method
  11240. for(var index=0 ;index< tmp_services.length;index++){
  11241. //检查必录项
  11242. if(!tmp_services[index].serviceId||!tmp_services[index].method){
  11243. _FW.oFtl.fnAlert('服务定义的serviceId和method不可为空');
  11244. return this;
  11245. }
  11246. //检查可选项
  11247. if(tmp_services[index].parameters){
  11248. if(typeof tmp_services[index].parameters !='object'
  11249. ||jQuery.isArray(tmp_services[index].parameters)){
  11250. _FW.oFtl.fnAlert('服务定义的参数必须是map!');
  11251. return;
  11252. }
  11253. }
  11254. //如果指定了transform,那么值只能是规定的
  11255. if(tmp_services[index].transform){
  11256. if('FIRSTROW'!=tmp_services[index].transform.toUpperCase()
  11257. &&'BREAKDOWN'!=tmp_services[index].transform.toUpperCase()){
  11258. _FW.oFtl.fnAlert('transform属性不正确');
  11259. return this;
  11260. }
  11261. }
  11262. //shareResults
  11263. //转换shareResults,统一转换成map,或者boolean
  11264. shareResults = tmp_services[index].shareResults;
  11265. if(shareResults){
  11266. if(typeof shareResults =='boolean'){
  11267. if(!shareResults){
  11268. shareResults =null;
  11269. }
  11270. }else if(jQuery.isArray(shareResults)){
  11271. //转化为map
  11272. shareResults={};
  11273. $.each(tmp_services[index].shareResults,function(indexInArray, valueOfElement){
  11274. shareResults[valueOfElement]=valueOfElement;
  11275. });
  11276. tmp_services[index].shareResults =shareResults;
  11277. }
  11278. }
  11279. //useShare
  11280. useShare = tmp_services[index].useShare;
  11281. if(useShare){
  11282. if(typeof useShare =='boolean'){
  11283. if(!useShare){
  11284. tmp_services[index].useShare =null;
  11285. }
  11286. }else if(jQuery.isArray(useShare)){
  11287. //转化为map
  11288. useShare={};
  11289. $.each(tmp_services[index].useShare,function(indexInArray, valueOfElement){
  11290. useShare[valueOfElement]=valueOfElement;
  11291. });
  11292. tmp_services[index].useShare =useShare;
  11293. }
  11294. }
  11295. //shareNotNull,只允许true和字符串数组
  11296. shareNotNull = tmp_services[index].shareNotNull;
  11297. if(shareNotNull){
  11298. if(typeof shareNotNull !=='boolean' && !jQuery.isArray(shareNotNull)){
  11299. _FW.oFtl.fnAlert('参数[shareNotNull]的取值必须是true或者字符串数组!');
  11300. return this;
  11301. }else if(shareNotNull ===false){
  11302. tmp_services[index].shareNotNull = null;
  11303. }
  11304. }
  11305. }
  11306. this.services=this.services.concat(tmp_services);
  11307. return this;
  11308. };
  11309. /**定义添加直接调用存储过程的服务
  11310. * 可以批量添加存储过程。每个存储过程服务的有以下属性:
  11311. * procName、parameters、shareResults、useShare,
  11312. * 其中procName指明存储过程的名称,其他的请参考appendServices;parameters中的参数名不能是procName
  11313. * 批量添加存储过程时,用数组存储各个存储过程作为参数传入即可。
  11314. * ...
  11315. */
  11316. this.appendProc=function(procedures){
  11317. if(!procedures){
  11318. return this;
  11319. }
  11320. //默认按批量形式添加服务,如果是单个,那么用数组包装
  11321. tmp_procedures=procedures;
  11322. if(!$.isArray(tmp_procedures)){
  11323. tmp_procedures = [tmp_procedures];
  11324. }
  11325. //遍历,一个一个的处理
  11326. procedure_services =[];
  11327. for (var index=0;index< tmp_procedures.length;index++){
  11328. //必须有configId属性
  11329. procedure = tmp_procedures[index];
  11330. if(!procedure.procName){
  11331. _FW.oFtl.fnAlert('存储过程服务必须指定procName属性');
  11332. return this;
  11333. }
  11334. procedure = $.extend(true,{},procedure,
  11335. {serviceId:'directJdbcService',method:'savePointProcedure'
  11336. ,parameters:{'':procedure.procName}});
  11337. //去掉存储过程名称
  11338. delete procedure.procName;
  11339. //添加到服务列表
  11340. procedure_services.push(procedure);
  11341. }
  11342. return this.appendServices(procedure_services);
  11343. };
  11344. /**定义添加调用预定义查询语句的服务
  11345. * 可以批量添加查询语句。每个查询服务的包括以下属性:
  11346. * configId、transform、indices,parameters、shareResults、useShare。
  11347. * configId是Mapper.xml中的配置ID(注意写上空间名)
  11348. * parameters是传递给configId的参数
  11349. * transform:结果集的转换规则:null(无转换)、'firstRow'(取首行)、'breakdown'(分列),值不区分大小写
  11350. * ,该参数要求传入字符串数组类型,元素值指明参数Map中的一个参数名。
  11351. * 其它属性将作为查询语句的备用参数。其他的请参考appendServices;
  11352. * 批量添加查询服务时,用数组存储各个查询服务作为参数传入即可。
  11353. * ...
  11354. */
  11355. this.appendQuery=function(querys){
  11356. if(!querys){
  11357. return this;
  11358. }
  11359. //默认按批量形式添加服务,如果是单个,那么用数组包装
  11360. tmp_querys=querys;
  11361. if(!$.isArray(tmp_querys)){
  11362. tmp_querys = [tmp_querys];
  11363. }
  11364. //遍历,一个一个的处理
  11365. query_services = [];
  11366. for (var index=0;index<tmp_querys.length;index++){
  11367. //必须有configId属性
  11368. var query = tmp_querys[index];
  11369. if(!query.configId){
  11370. _FW.oFtl.fnAlert('查询服务必须指定configId属性');
  11371. return this;
  11372. }
  11373. //参数索引放入参数串中
  11374. query = $.extend(true,{},query,
  11375. {serviceId:'commService',method:'query'
  11376. ,parameters:{'_commDo':query.configId}});
  11377. //去掉存储过程名称,和参数索引
  11378. delete query.configId;
  11379. //添加到服务列表
  11380. query_services.push(query);
  11381. }
  11382. return this.appendServices(query_services);
  11383. };
  11384. /**定义触发ajax的事件
  11385. * message:本次ajax请求的名称,可选。
  11386. * success:处理成功后触发的函数,原型是function(data)。
  11387. * error:处理是否时触发的函数,原型是function(XMLHttpRequest, textStatus, errorThrown);
  11388. * async:同步或是异步,同步为false、异步是true
  11389. */
  11390. this.sentAjax=function(message,success,error,async){
  11391. var that=this;
  11392. if(this.services.length==0){
  11393. _FW.oFtl.fnAlert('请至少添加一个服务');
  11394. return;
  11395. }
  11396. var t_async = true;
  11397. var t_message = message;
  11398. var t_success = success;
  11399. var t_error = error;
  11400. if(jQuery.isFunction(message)){
  11401. t_message = '正在请求服务,请稍候...';
  11402. t_success =message;
  11403. t_error = success;
  11404. }else if (typeof message != 'string'){
  11405. _FW.oFtl.fnAlert('入参错误,请检查程序!');
  11406. return ;
  11407. }
  11408. if(async!=null&&typeof async=='boolean'){
  11409. if(!async){
  11410. t_async = false;
  11411. }
  11412. }
  11413. var thisrequest={};
  11414. $.ajax({
  11415. url:contextPath+'/ajaxAdapter.do'
  11416. ,data:{parameters:JSON.stringify(this.services),shareArguments:JSON.stringify(this.shareParameters)}
  11417. ,dataType :'json'
  11418. ,cache:false
  11419. ,async:t_async
  11420. ,contentType: "application/x-www-form-urlencoded; charset=utf-8"
  11421. ,type:'post'
  11422. ,error:function (request, textStatus, errorThrown) {
  11423. if(!t_error){
  11424. _FW.oFtl.fnAlert('数据请求错误!');
  11425. }else{
  11426. t_error(request, textStatus, errorThrown);
  11427. }
  11428. }
  11429. ,success:function (data, textStatus) {
  11430. if(data!=null && data[headtoken]!=null){
  11431. token=data[headtoken];//更新全局变量token标志
  11432. }
  11433. //校验业务处理是否正确执行
  11434. if("1"!=data.FHZ){//出错了,弹出错误提醒
  11435. if ("loginTimeout" == data.FHZ) {
  11436. if(window.confirm(data.MSG||'')){
  11437. window.top.location.href=_selfUrl;
  11438. }
  11439. } else if("CSRF" == data.FHZ){
  11440. showMsg(data.MSG||'',3);
  11441. return;
  11442. } else {
  11443. if(t_error){
  11444. t_error(data.MSG||'', 'serviceErr', data.MSG);
  11445. }else{
  11446. _FW.oFtl.fnAlert(data.MSG||'');
  11447. }
  11448. }
  11449. }else if(!t_success){
  11450. }else{
  11451. t_success(data.RTN);
  11452. }
  11453. }
  11454. ,beforeSend:function(XMLHttpRequest ){
  11455. var cToken = $.cookie(headtoken) || token;XMLHttpRequest.setRequestHeader(headtoken,cToken);
  11456. $.data(thisrequest,'msg',showMsg(t_message,-1));
  11457. //createProgressBar();
  11458. }
  11459. ,complete:function( ){
  11460. hideMsg($.data(thisrequest,'msg'));
  11461. }
  11462. });
  11463. };
  11464. //添加参数
  11465. if(services){
  11466. this.appendServices(services);
  11467. }
  11468. /**
  11469. * 将JSON序列化为一个字符串,
  11470. * 相对于JSON.stringify,{}中的键值对会按照key升序顺序输出。
  11471. */
  11472. function stringify(o){
  11473. var toString = Object.prototype.toString;
  11474. var s = "";
  11475. if(null === o){
  11476. return "null";
  11477. }else if(undefined === o){
  11478. return "undefined";
  11479. }else if("[object Function]" === toString.call(o)){
  11480. return "\"[object Function]\"";
  11481. }else if("[object Object]" === toString.call(o)){
  11482. s += "{";
  11483. var arr = [];
  11484. for(var key in o){
  11485. arr.push(key);
  11486. }
  11487. arr.sort();
  11488. for(var i in arr){
  11489. var key = arr[i];
  11490. s += "\"" + key + "\":" + stringify(o[key]) + ",";
  11491. }
  11492. s = s.substring(0,s.length-1);
  11493. s += "}";
  11494. }else if("[object Array]" === toString.call(o)){
  11495. s += "[";
  11496. for(var i in o){
  11497. s += stringify(o[i]);
  11498. if(i != o.length-1){
  11499. s += ",";
  11500. }
  11501. }
  11502. s += "]";
  11503. }else if("[object Number]" === toString.call(o)){
  11504. if(isFinite(o)){
  11505. return "" + o;
  11506. }else if(isNaN(o)){
  11507. return "NaN";
  11508. }else if(Infinity === o){
  11509. return "Infinity";
  11510. }
  11511. }else if("[object String]" === toString.call(o)){
  11512. return "\"" + o + "\"";
  11513. }else if("[object Boolean]" === toString.call(o)){
  11514. return true === o?"true":"false"
  11515. }else if("[object RegExp]" === toString.call(o)){
  11516. return "/"+ o.source +"/"
  11517. + (o.global?"g":"")
  11518. + (o.ignoreCase?"i":"")
  11519. + (o.multiline?"m":"");
  11520. }else{
  11521. return "\"" + toString.call(o) + "\"";
  11522. }
  11523. return s;
  11524. }
  11525. }
  11526. /**
  11527. * 在页面的左上角显示错误消息
  11528. * @param msg 消息内容
  11529. * @param timeout 秒为单位,0或者负数表示不自动隐藏
  11530. * @author 吴英德
  11531. **/
  11532. var framework_message_layer;
  11533. var clearIntervalID;
  11534. function showMsg(msg,delay){
  11535. var recurrectLocation=function(){
  11536. if(framework_message_layer==null)
  11537. {clearInterval(clearIntervalID);return;}
  11538. var posX,posY;
  11539. if (window.innerHeight) {
  11540. posX = window.pageXOffset;
  11541. posY = window.pageYOffset;
  11542. }
  11543. else if (document.documentElement && document.documentElement.scrollTop) {
  11544. posX = document.documentElement.scrollLeft;
  11545. posY = document.documentElement.scrollTop;
  11546. }
  11547. else if (document.body) {
  11548. posX = document.body.scrollLeft;
  11549. posY = document.body.scrollTop;
  11550. }
  11551. framework_message_layer.style.top=String(posY+10)+'px';
  11552. framework_message_layer.style.right=String(posX+10)+'px';
  11553. };
  11554. if(framework_message_layer == null){
  11555. framework_message_layer=document.createElement('div');
  11556. framework_message_layer.className='err_message_blank_board';
  11557. document.body.appendChild(framework_message_layer);
  11558. clearIntervalID=window.setInterval(recurrectLocation,100);
  11559. recurrectLocation();
  11560. }
  11561. var my_div = document.createElement('div');
  11562. my_div.className='err_message';
  11563. //Element.extend(my_div);
  11564. my_div.innerHTML=msg;
  11565. //增加判断:已经存在的信息,则不再重复提示
  11566. if ($(".err_message:contains("+msg+")",document.body).length == 0) {
  11567. framework_message_layer.appendChild(my_div);
  11568. recurrectLocation();
  11569. }
  11570. if(delay>0){
  11571. setTimeout(function(){
  11572. jQuery(my_div).remove();
  11573. if(jQuery(framework_message_layer).is(':empty')){
  11574. jQuery(framework_message_layer).remove();
  11575. window.clearInterval(clearIntervalID);
  11576. framework_message_layer=null;
  11577. }
  11578. },delay*1000);
  11579. }else{
  11580. return my_div;
  11581. }
  11582. }
  11583. /**隐藏右上角对应的消息
  11584. * @param object 某消息对象,来自showMsg的返回值
  11585. */
  11586. function hideMsg(object){
  11587. jQuery(object).remove();
  11588. }