require-backend.min.js 955 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071
  1. /*! jQuery v2.2.4 | (c) jQuery Foundation | jquery.org/license */
  2. !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="2.2.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isPlainObject:function(a){var b;if("object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;if(a.constructor&&!k.call(a,"constructor")&&!k.call(a.constructor.prototype||{},"isPrototypeOf"))return!1;for(b in a);return void 0===b||k.call(a,b)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=d.createElement("script"),b.text=a,d.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:h.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a))for(d=a.length;d>g;g++)e=b(a[g],g,c),null!=e&&h.push(e);else for(g in a)e=b(a[g],g,c),null!=e&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(d=e.call(arguments,2),f=function(){return a.apply(b||this,d.concat(e.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ga(),z=ga(),A=ga(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,aa=/'|\\/g,ba=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),ca=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},da=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(ea){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fa(a,b,d,e){var f,h,j,k,l,o,r,s,w=b&&b.ownerDocument,x=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==x&&9!==x&&11!==x)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==x&&(o=$.exec(a)))if(f=o[1]){if(9===x){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(w&&(j=w.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(o[2])return H.apply(d,b.getElementsByTagName(a)),d;if((f=o[3])&&c.getElementsByClassName&&b.getElementsByClassName)return H.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==x)w=b,s=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(aa,"\\$&"):b.setAttribute("id",k=u),r=g(a),h=r.length,l=V.test(k)?"#"+k:"[id='"+k+"']";while(h--)r[h]=l+" "+qa(r[h]);s=r.join(","),w=_.test(a)&&oa(b.parentNode)||b}if(s)try{return H.apply(d,w.querySelectorAll(s)),d}catch(y){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(Q,"$1"),b,d,e)}function ga(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ha(a){return a[u]=!0,a}function ia(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ja(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function ka(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function la(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function na(a){return ha(function(b){return b=+b,ha(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function oa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=fa.support={},f=fa.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fa.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ia(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ia(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(n.getElementsByClassName),c.getById=ia(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Z.test(n.querySelectorAll))&&(ia(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ia(function(a){var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ia(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return ka(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?ka(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},fa.matches=function(a,b){return fa(a,null,null,b)},fa.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fa(b,n,null,[a]).length>0},fa.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fa.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fa.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fa.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fa.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fa.selectors={cacheLength:50,createPseudo:ha,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ba,ca),a[3]=(a[3]||a[4]||a[5]||"").replace(ba,ca),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fa.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fa.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ba,ca).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fa.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(P," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fa.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ha(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ha(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?ha(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ha(function(a){return function(b){return fa(a,b).length>0}}),contains:ha(function(a){return a=a.replace(ba,ca),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ha(function(a){return V.test(a||"")||fa.error("unsupported lang: "+a),a=a.replace(ba,ca).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Y.test(a.nodeName)},input:function(a){return X.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:na(function(){return[0]}),last:na(function(a,b){return[b-1]}),eq:na(function(a,b,c){return[0>c?c+b:c]}),even:na(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:na(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:na(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:na(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=la(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=ma(b);function pa(){}pa.prototype=d.filters=d.pseudos,d.setFilters=new pa,g=fa.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=R.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=S.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(Q," ")}),h=h.slice(c.length));for(g in d.filter)!(e=W[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fa.error(a):z(a,i).slice(0)};function qa(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function ra(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(j=b[u]||(b[u]={}),i=j[b.uniqueID]||(j[b.uniqueID]={}),(h=i[d])&&h[0]===w&&h[1]===f)return k[2]=h[2];if(i[d]=k,k[2]=a(b,c,g))return!0}}}function sa(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ta(a,b,c){for(var d=0,e=b.length;e>d;d++)fa(a,b[d],c);return c}function ua(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function va(a,b,c,d,e,f){return d&&!d[u]&&(d=va(d)),e&&!e[u]&&(e=va(e,f)),ha(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ta(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ua(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ua(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ua(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function wa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ra(function(a){return a===b},h,!0),l=ra(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ra(sa(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return va(i>1&&sa(m),i>1&&qa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,e>i&&wa(a.slice(i,e)),f>e&&wa(a=a.slice(e)),f>e&&qa(a))}m.push(c)}return sa(m)}function xa(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=F.call(i));u=ua(u)}H.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&fa.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ha(f):f}return h=fa.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xa(e,d)),f.selector=a}return f},i=fa.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ba,ca),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ba,ca),_.test(j[0].type)&&oa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qa(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||_.test(a)&&oa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ia(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ia(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ja("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ia(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ja("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ia(function(a){return null==a.getAttribute("disabled")})||ja(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fa}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.uniqueSort=n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},v=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},w=n.expr.match.needsContext,x=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,y=/^.[^:#\[\.,]*$/;function z(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(y.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return h.call(b,a)>-1!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(z(this,a||[],!1))},not:function(a){return this.pushStack(z(this,a||[],!0))},is:function(a){return!!z(this,"string"==typeof a&&w.test(a)?n(a):a||[],!1).length}});var A,B=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=n.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||A,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:B.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),x.test(e[1])&&n.isPlainObject(b))for(e in b)n.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&f.parentNode&&(this.length=1,this[0]=f),this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?void 0!==c.ready?c.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};C.prototype=n.fn,A=n(d);var D=/^(?:parents|prev(?:Until|All))/,E={children:!0,contents:!0,next:!0,prev:!0};n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=w.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?h.call(n(a),this[0]):h.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.uniqueSort(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function F(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return u(a,"parentNode")},parentsUntil:function(a,b,c){return u(a,"parentNode",c)},next:function(a){return F(a,"nextSibling")},prev:function(a){return F(a,"previousSibling")},nextAll:function(a){return u(a,"nextSibling")},prevAll:function(a){return u(a,"previousSibling")},nextUntil:function(a,b,c){return u(a,"nextSibling",c)},prevUntil:function(a,b,c){return u(a,"previousSibling",c)},siblings:function(a){return v((a.parentNode||{}).firstChild,a)},children:function(a){return v(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(E[a]||n.uniqueSort(e),D.test(a)&&e.reverse()),this.pushStack(e)}});var G=/\S+/g;function H(a){var b={};return n.each(a.match(G)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?H(a):n.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){n.each(b,function(b,c){n.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==n.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return n.each(arguments,function(a,b){var c;while((c=n.inArray(b,f,c))>-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?n.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().progress(c.notify).done(c.resolve).fail(c.reject):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1)for(i=new Array(d),j=new Array(d),k=new Array(d);d>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function J(){d.removeEventListener("DOMContentLoaded",J),a.removeEventListener("load",J),n.ready()}n.ready.promise=function(b){return I||(I=n.Deferred(),"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(n.ready):(d.addEventListener("DOMContentLoaded",J),a.addEventListener("load",J))),I.promise(b)},n.ready.promise();var K=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)K(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},L=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function M(){this.expando=n.expando+M.uid++}M.uid=1,M.prototype={register:function(a,b){var c=b||{};return a.nodeType?a[this.expando]=c:Object.defineProperty(a,this.expando,{value:c,writable:!0,configurable:!0}),a[this.expando]},cache:function(a){if(!L(a))return{};var b=a[this.expando];return b||(b={},L(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[b]=c;else for(d in b)e[d]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=a[this.expando];if(void 0!==f){if(void 0===b)this.register(a);else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in f?d=[b,e]:(d=e,d=d in f?[d]:d.match(G)||[])),c=d.length;while(c--)delete f[d[c]]}(void 0===b||n.isEmptyObject(f))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!n.isEmptyObject(b)}};var N=new M,O=new M,P=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Q=/[A-Z]/g;function R(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Q,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:P.test(c)?n.parseJSON(c):c;
  3. }catch(e){}O.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return O.hasData(a)||N.hasData(a)},data:function(a,b,c){return O.access(a,b,c)},removeData:function(a,b){O.remove(a,b)},_data:function(a,b,c){return N.access(a,b,c)},_removeData:function(a,b){N.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=O.get(f),1===f.nodeType&&!N.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),R(f,d,e[d])));N.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){O.set(this,a)}):K(this,function(b){var c,d;if(f&&void 0===b){if(c=O.get(f,a)||O.get(f,a.replace(Q,"-$&").toLowerCase()),void 0!==c)return c;if(d=n.camelCase(a),c=O.get(f,d),void 0!==c)return c;if(c=R(f,d,void 0),void 0!==c)return c}else d=n.camelCase(a),this.each(function(){var c=O.get(this,d);O.set(this,d,b),a.indexOf("-")>-1&&void 0!==c&&O.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){O.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=N.get(a,b),c&&(!d||n.isArray(c)?d=N.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return N.get(a,c)||N.access(a,c,{empty:n.Callbacks("once memory").add(function(){N.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=N.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),U=["Top","Right","Bottom","Left"],V=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)};function W(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return n.css(a,b,"")},i=h(),j=c&&c[3]||(n.cssNumber[b]?"":"px"),k=(n.cssNumber[b]||"px"!==j&&+i)&&T.exec(n.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,n.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var X=/^(?:checkbox|radio)$/i,Y=/<([\w:-]+)/,Z=/^$|\/(?:java|ecma)script/i,$={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};$.optgroup=$.option,$.tbody=$.tfoot=$.colgroup=$.caption=$.thead,$.th=$.td;function _(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function aa(a,b){for(var c=0,d=a.length;d>c;c++)N.set(a[c],"globalEval",!b||N.get(b[c],"globalEval"))}var ba=/<|&#?\w+;/;function ca(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],o=0,p=a.length;p>o;o++)if(f=a[o],f||0===f)if("object"===n.type(f))n.merge(m,f.nodeType?[f]:f);else if(ba.test(f)){g=g||l.appendChild(b.createElement("div")),h=(Y.exec(f)||["",""])[1].toLowerCase(),i=$[h]||$._default,g.innerHTML=i[1]+n.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;n.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",o=0;while(f=m[o++])if(d&&n.inArray(f,d)>-1)e&&e.push(f);else if(j=n.contains(f.ownerDocument,f),g=_(l.appendChild(f),"script"),j&&aa(g),c){k=0;while(f=g[k++])Z.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var da=/^key/,ea=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,fa=/^([^.]*)(?:\.(.+)|)/;function ga(){return!0}function ha(){return!1}function ia(){try{return d.activeElement}catch(a){}}function ja(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ja(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ha;else if(!e)return a;return 1===f&&(g=e,e=function(a){return n().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=n.guid++)),a.each(function(){n.event.add(this,b,e,d,c)})}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return"undefined"!=typeof n&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(G)||[""],j=b.length;while(j--)h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.hasData(a)&&N.get(a);if(r&&(i=r.events)){b=(b||"").match(G)||[""],j=b.length;while(j--)if(h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&N.remove(a,"handle events")}},dispatch:function(a){a=n.event.fix(a);var b,c,d,f,g,h=[],i=e.call(arguments),j=(N.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())a.rnamespace&&!a.rnamespace.test(g.namespace)||(a.handleObj=g,a.data=g.data,d=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==d&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!==this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>-1:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,e,f,g=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||d,e=c.documentElement,f=c.body,a.pageX=b.clientX+(e&&e.scrollLeft||f&&f.scrollLeft||0)-(e&&e.clientLeft||f&&f.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||f&&f.scrollTop||0)-(e&&e.clientTop||f&&f.clientTop||0)),a.which||void 0===g||(a.which=1&g?1:2&g?3:4&g?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,e,f=a.type,g=a,h=this.fixHooks[f];h||(this.fixHooks[f]=h=ea.test(f)?this.mouseHooks:da.test(f)?this.keyHooks:{}),e=h.props?this.props.concat(h.props):this.props,a=new n.Event(g),b=e.length;while(b--)c=e[b],a[c]=g[c];return a.target||(a.target=d),3===a.target.nodeType&&(a.target=a.target.parentNode),h.filter?h.filter(a,g):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==ia()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===ia()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ga:ha):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={constructor:n.Event,isDefaultPrevented:ha,isPropagationStopped:ha,isImmediatePropagationStopped:ha,isSimulated:!1,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ga,a&&!this.isSimulated&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ga,a&&!this.isSimulated&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ga,a&&!this.isSimulated&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||n.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),n.fn.extend({on:function(a,b,c,d){return ja(this,a,b,c,d)},one:function(a,b,c,d){return ja(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=ha),this.each(function(){n.event.remove(this,a,c,b)})}});var ka=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,la=/<script|<style|<link/i,ma=/checked\s*(?:[^=]|=\s*.checked.)/i,na=/^true\/(.*)/,oa=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function pa(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function qa(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function ra(a){var b=na.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function sa(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(N.hasData(a)&&(f=N.access(a),g=N.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}O.hasData(a)&&(h=O.access(a),i=n.extend({},h),O.set(b,i))}}function ta(a,b){var c=b.nodeName.toLowerCase();"input"===c&&X.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function ua(a,b,c,d){b=f.apply([],b);var e,g,h,i,j,k,m=0,o=a.length,p=o-1,q=b[0],r=n.isFunction(q);if(r||o>1&&"string"==typeof q&&!l.checkClone&&ma.test(q))return a.each(function(e){var f=a.eq(e);r&&(b[0]=q.call(this,e,f.html())),ua(f,b,c,d)});if(o&&(e=ca(b,a[0].ownerDocument,!1,a,d),g=e.firstChild,1===e.childNodes.length&&(e=g),g||d)){for(h=n.map(_(e,"script"),qa),i=h.length;o>m;m++)j=e,m!==p&&(j=n.clone(j,!0,!0),i&&n.merge(h,_(j,"script"))),c.call(a[m],j,m);if(i)for(k=h[h.length-1].ownerDocument,n.map(h,ra),m=0;i>m;m++)j=h[m],Z.test(j.type||"")&&!N.access(j,"globalEval")&&n.contains(k,j)&&(j.src?n._evalUrl&&n._evalUrl(j.src):n.globalEval(j.textContent.replace(oa,"")))}return a}function va(a,b,c){for(var d,e=b?n.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||n.cleanData(_(d)),d.parentNode&&(c&&n.contains(d.ownerDocument,d)&&aa(_(d,"script")),d.parentNode.removeChild(d));return a}n.extend({htmlPrefilter:function(a){return a.replace(ka,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=_(h),f=_(a),d=0,e=f.length;e>d;d++)ta(f[d],g[d]);if(b)if(c)for(f=f||_(a),g=g||_(h),d=0,e=f.length;e>d;d++)sa(f[d],g[d]);else sa(a,h);return g=_(h,"script"),g.length>0&&aa(g,!i&&_(a,"script")),h},cleanData:function(a){for(var b,c,d,e=n.event.special,f=0;void 0!==(c=a[f]);f++)if(L(c)){if(b=c[N.expando]){if(b.events)for(d in b.events)e[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);c[N.expando]=void 0}c[O.expando]&&(c[O.expando]=void 0)}}}),n.fn.extend({domManip:ua,detach:function(a){return va(this,a,!0)},remove:function(a){return va(this,a)},text:function(a){return K(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return ua(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=pa(this,a);b.appendChild(a)}})},prepend:function(){return ua(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=pa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return ua(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return ua(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(_(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return K(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!la.test(a)&&!$[(Y.exec(a)||["",""])[1].toLowerCase()]){a=n.htmlPrefilter(a);try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(_(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return ua(this,arguments,function(b){var c=this.parentNode;n.inArray(this,a)<0&&(n.cleanData(_(this)),c&&c.replaceChild(b,this))},a)}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),f=e.length-1,h=0;f>=h;h++)c=h===f?this:this.clone(!0),n(e[h])[b](c),g.apply(d,c.get());return this.pushStack(d)}});var wa,xa={HTML:"block",BODY:"block"};function ya(a,b){var c=n(b.createElement(a)).appendTo(b.body),d=n.css(c[0],"display");return c.detach(),d}function za(a){var b=d,c=xa[a];return c||(c=ya(a,b),"none"!==c&&c||(wa=(wa||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=wa[0].contentDocument,b.write(),b.close(),c=ya(a,b),wa.detach()),xa[a]=c),c}var Aa=/^margin/,Ba=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ca=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)},Da=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e},Ea=d.documentElement;!function(){var b,c,e,f,g=d.createElement("div"),h=d.createElement("div");if(h.style){h.style.backgroundClip="content-box",h.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===h.style.backgroundClip,g.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",g.appendChild(h);function i(){h.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",h.innerHTML="",Ea.appendChild(g);var d=a.getComputedStyle(h);b="1%"!==d.top,f="2px"===d.marginLeft,c="4px"===d.width,h.style.marginRight="50%",e="4px"===d.marginRight,Ea.removeChild(g)}n.extend(l,{pixelPosition:function(){return i(),b},boxSizingReliable:function(){return null==c&&i(),c},pixelMarginRight:function(){return null==c&&i(),e},reliableMarginLeft:function(){return null==c&&i(),f},reliableMarginRight:function(){var b,c=h.appendChild(d.createElement("div"));return c.style.cssText=h.style.cssText="-webkit-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",h.style.width="1px",Ea.appendChild(g),b=!parseFloat(a.getComputedStyle(c).marginRight),Ea.removeChild(g),h.removeChild(c),b}})}}();function Fa(a,b,c){var d,e,f,g,h=a.style;return c=c||Ca(a),g=c?c.getPropertyValue(b)||c[b]:void 0,""!==g&&void 0!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),c&&!l.pixelMarginRight()&&Ba.test(g)&&Aa.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f),void 0!==g?g+"":g}function Ga(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Ha=/^(none|table(?!-c[ea]).+)/,Ia={position:"absolute",visibility:"hidden",display:"block"},Ja={letterSpacing:"0",fontWeight:"400"},Ka=["Webkit","O","Moz","ms"],La=d.createElement("div").style;function Ma(a){if(a in La)return a;var b=a[0].toUpperCase()+a.slice(1),c=Ka.length;while(c--)if(a=Ka[c]+b,a in La)return a}function Na(a,b,c){var d=T.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Oa(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+U[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+U[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+U[f]+"Width",!0,e))):(g+=n.css(a,"padding"+U[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+U[f]+"Width",!0,e)));return g}function Pa(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ca(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Fa(a,b,f),(0>e||null==e)&&(e=a.style[b]),Ba.test(e))return e;d=g&&(l.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Oa(a,b,c||(g?"border":"content"),d,f)+"px"}function Qa(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=N.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&V(d)&&(f[g]=N.access(d,"olddisplay",za(d.nodeName)))):(e=V(d),"none"===c&&e||N.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Fa(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Ma(h)||h),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=T.exec(c))&&e[1]&&(c=W(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(n.cssNumber[h]?"":"px")),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Ma(h)||h),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Fa(a,b,d)),"normal"===e&&b in Ja&&(e=Ja[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?Ha.test(n.css(a,"display"))&&0===a.offsetWidth?Da(a,Ia,function(){return Pa(a,b,d)}):Pa(a,b,d):void 0},set:function(a,c,d){var e,f=d&&Ca(a),g=d&&Oa(a,b,d,"border-box"===n.css(a,"boxSizing",!1,f),f);return g&&(e=T.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=n.css(a,b)),Na(a,c,g)}}}),n.cssHooks.marginLeft=Ga(l.reliableMarginLeft,function(a,b){return b?(parseFloat(Fa(a,"marginLeft"))||a.getBoundingClientRect().left-Da(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px":void 0}),n.cssHooks.marginRight=Ga(l.reliableMarginRight,function(a,b){return b?Da(a,{display:"inline-block"},Fa,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+U[d]+b]=f[d]||f[d-2]||f[0];return e}},Aa.test(a)||(n.cssHooks[a+b].set=Na)}),n.fn.extend({css:function(a,b){return K(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=Ca(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Qa(this,!0)},hide:function(){return Qa(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){V(this)?n(this).show():n(this).hide()})}});function Ra(a,b,c,d,e){return new Ra.prototype.init(a,b,c,d,e)}n.Tween=Ra,Ra.prototype={constructor:Ra,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||n.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Ra.propHooks[this.prop];return a&&a.get?a.get(this):Ra.propHooks._default.get(this)},run:function(a){var b,c=Ra.propHooks[this.prop];return this.options.duration?this.pos=b=n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Ra.propHooks._default.set(this),this}},Ra.prototype.init.prototype=Ra.prototype,Ra.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[n.cssProps[a.prop]]&&!n.cssHooks[a.prop]?a.elem[a.prop]=a.now:n.style(a.elem,a.prop,a.now+a.unit)}}},Ra.propHooks.scrollTop=Ra.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},n.fx=Ra.prototype.init,n.fx.step={};var Sa,Ta,Ua=/^(?:toggle|show|hide)$/,Va=/queueHooks$/;function Wa(){return a.setTimeout(function(){Sa=void 0}),Sa=n.now()}function Xa(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=U[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ya(a,b,c){for(var d,e=(_a.tweeners[b]||[]).concat(_a.tweeners["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Za(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&V(a),q=N.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?N.get(a,"olddisplay")||za(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Ua.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?za(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=N.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;N.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ya(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function $a(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function _a(a,b,c){var d,e,f=0,g=_a.prefilters.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Sa||Wa(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{},easing:n.easing._default},c),originalProperties:b,originalOptions:c,startTime:Sa||Wa(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for($a(k,j.opts.specialEasing);g>f;f++)if(d=_a.prefilters[f].call(j,a,k,j.opts))return n.isFunction(d.stop)&&(n._queueHooks(j.elem,j.opts.queue).stop=n.proxy(d.stop,d)),d;return n.map(k,Ya,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(_a,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return W(c.elem,a,T.exec(b),c),c}]},tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.match(G);for(var c,d=0,e=a.length;e>d;d++)c=a[d],_a.tweeners[c]=_a.tweeners[c]||[],_a.tweeners[c].unshift(b)},prefilters:[Za],prefilter:function(a,b){b?_a.prefilters.unshift(a):_a.prefilters.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,null!=d.queue&&d.queue!==!0||(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(V).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=_a(this,n.extend({},a),f);(e||N.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=N.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Va.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=N.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Xa(b,!0),a,d,e)}}),n.each({slideDown:Xa("show"),slideUp:Xa("hide"),slideToggle:Xa("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(Sa=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),Sa=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Ta||(Ta=a.setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){a.clearInterval(Ta),Ta=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(b,c){return b=n.fx?n.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",l.checkOn=""!==a.value,l.optSelected=c.selected,b.disabled=!0,l.optDisabled=!c.disabled,a=d.createElement("input"),a.value="t",a.type="radio",l.radioValue="t"===a.value}();var ab,bb=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return K(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),e=n.attrHooks[b]||(n.expr.match.bool.test(b)?ab:void 0)),void 0!==c?null===c?void n.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=n.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(G);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)}}),ab={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=bb[b]||n.find.attr;bb[b]=function(a,b,d){var e,f;return d||(f=bb[b],bb[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,bb[b]=f),e}});var cb=/^(?:input|select|textarea|button)$/i,db=/^(?:a|area)$/i;n.fn.extend({prop:function(a,b){return K(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&n.isXMLDoc(a)||(b=n.propFix[b]||b,e=n.propHooks[b]),
  4. void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=n.find.attr(a,"tabindex");return b?parseInt(b,10):cb.test(a.nodeName)||db.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var eb=/[\t\r\n\f]/g;function fb(a){return a.getAttribute&&a.getAttribute("class")||""}n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,fb(this)))});if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=fb(c),d=1===c.nodeType&&(" "+e+" ").replace(eb," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=n.trim(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,fb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=fb(c),d=1===c.nodeType&&(" "+e+" ").replace(eb," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=n.trim(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):n.isFunction(a)?this.each(function(c){n(this).toggleClass(a.call(this,c,fb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=n(this),f=a.match(G)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=fb(this),b&&N.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":N.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+fb(c)+" ").replace(eb," ").indexOf(b)>-1)return!0;return!1}});var gb=/\r/g,hb=/[\x20\t\r\n\f]+/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(gb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a)).replace(hb," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],(c.selected||i===e)&&(l.optDisabled?!c.disabled:null===c.getAttribute("disabled"))&&(!c.parentNode.disabled||!n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(n.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>-1:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var ib=/^(?:focusinfocus|focusoutblur)$/;n.extend(n.event,{trigger:function(b,c,e,f){var g,h,i,j,l,m,o,p=[e||d],q=k.call(b,"type")?b.type:b,r=k.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!ib.test(q+n.event.triggered)&&(q.indexOf(".")>-1&&(r=q.split("."),q=r.shift(),r.sort()),l=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=r.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},f||!o.trigger||o.trigger.apply(e,c)!==!1)){if(!f&&!o.noBubble&&!n.isWindow(e)){for(j=o.delegateType||q,ib.test(j+q)||(h=h.parentNode);h;h=h.parentNode)p.push(h),i=h;i===(e.ownerDocument||d)&&p.push(i.defaultView||i.parentWindow||a)}g=0;while((h=p[g++])&&!b.isPropagationStopped())b.type=g>1?j:o.bindType||q,m=(N.get(h,"events")||{})[b.type]&&N.get(h,"handle"),m&&m.apply(h,c),m=l&&h[l],m&&m.apply&&L(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=q,f||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!L(e)||l&&n.isFunction(e[q])&&!n.isWindow(e)&&(i=e[l],i&&(e[l]=null),n.event.triggered=q,e[q](),n.event.triggered=void 0,i&&(e[l]=i)),b.result}},simulate:function(a,b,c){var d=n.extend(new n.Event,c,{type:a,isSimulated:!0});n.event.trigger(d,null,b)}}),n.fn.extend({trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),l.focusin="onfocusin"in a,l.focusin||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a))};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=N.access(d,b);e||d.addEventListener(a,c,!0),N.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=N.access(d,b)-1;e?N.access(d,b,e):(d.removeEventListener(a,c,!0),N.remove(d,b))}}});var jb=a.location,kb=n.now(),lb=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||n.error("Invalid XML: "+b),c};var mb=/#.*$/,nb=/([?&])_=[^&]*/,ob=/^(.*?):[ \t]*([^\r\n]*)$/gm,pb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,qb=/^(?:GET|HEAD)$/,rb=/^\/\//,sb={},tb={},ub="*/".concat("*"),vb=d.createElement("a");vb.href=jb.href;function wb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(G)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function xb(a,b,c,d){var e={},f=a===tb;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function yb(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function zb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Ab(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:jb.href,type:"GET",isLocal:pb.test(jb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":ub,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?yb(yb(a,n.ajaxSettings),b):yb(n.ajaxSettings,a)},ajaxPrefilter:wb(sb),ajaxTransport:wb(tb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m=n.ajaxSetup({},c),o=m.context||m,p=m.context&&(o.nodeType||o.jquery)?n(o):n.event,q=n.Deferred(),r=n.Callbacks("once memory"),s=m.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,getResponseHeader:function(a){var b;if(2===v){if(!h){h={};while(b=ob.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===v?g:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return v||(a=u[c]=u[c]||a,t[a]=b),this},overrideMimeType:function(a){return v||(m.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>v)for(b in a)s[b]=[s[b],a[b]];else x.always(a[x.status]);return this},abort:function(a){var b=a||w;return e&&e.abort(b),z(0,b),this}};if(q.promise(x).complete=r.add,x.success=x.done,x.error=x.fail,m.url=((b||m.url||jb.href)+"").replace(mb,"").replace(rb,jb.protocol+"//"),m.type=c.method||c.type||m.method||m.type,m.dataTypes=n.trim(m.dataType||"*").toLowerCase().match(G)||[""],null==m.crossDomain){j=d.createElement("a");try{j.href=m.url,j.href=j.href,m.crossDomain=vb.protocol+"//"+vb.host!=j.protocol+"//"+j.host}catch(y){m.crossDomain=!0}}if(m.data&&m.processData&&"string"!=typeof m.data&&(m.data=n.param(m.data,m.traditional)),xb(sb,m,c,x),2===v)return x;k=n.event&&m.global,k&&0===n.active++&&n.event.trigger("ajaxStart"),m.type=m.type.toUpperCase(),m.hasContent=!qb.test(m.type),f=m.url,m.hasContent||(m.data&&(f=m.url+=(lb.test(f)?"&":"?")+m.data,delete m.data),m.cache===!1&&(m.url=nb.test(f)?f.replace(nb,"$1_="+kb++):f+(lb.test(f)?"&":"?")+"_="+kb++)),m.ifModified&&(n.lastModified[f]&&x.setRequestHeader("If-Modified-Since",n.lastModified[f]),n.etag[f]&&x.setRequestHeader("If-None-Match",n.etag[f])),(m.data&&m.hasContent&&m.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",m.contentType),x.setRequestHeader("Accept",m.dataTypes[0]&&m.accepts[m.dataTypes[0]]?m.accepts[m.dataTypes[0]]+("*"!==m.dataTypes[0]?", "+ub+"; q=0.01":""):m.accepts["*"]);for(l in m.headers)x.setRequestHeader(l,m.headers[l]);if(m.beforeSend&&(m.beforeSend.call(o,x,m)===!1||2===v))return x.abort();w="abort";for(l in{success:1,error:1,complete:1})x[l](m[l]);if(e=xb(tb,m,c,x)){if(x.readyState=1,k&&p.trigger("ajaxSend",[x,m]),2===v)return x;m.async&&m.timeout>0&&(i=a.setTimeout(function(){x.abort("timeout")},m.timeout));try{v=1,e.send(t,z)}catch(y){if(!(2>v))throw y;z(-1,y)}}else z(-1,"No Transport");function z(b,c,d,h){var j,l,t,u,w,y=c;2!==v&&(v=2,i&&a.clearTimeout(i),e=void 0,g=h||"",x.readyState=b>0?4:0,j=b>=200&&300>b||304===b,d&&(u=zb(m,x,d)),u=Ab(m,u,x,j),j?(m.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(n.lastModified[f]=w),w=x.getResponseHeader("etag"),w&&(n.etag[f]=w)),204===b||"HEAD"===m.type?y="nocontent":304===b?y="notmodified":(y=u.state,l=u.data,t=u.error,j=!t)):(t=y,!b&&y||(y="error",0>b&&(b=0))),x.status=b,x.statusText=(c||y)+"",j?q.resolveWith(o,[l,y,x]):q.rejectWith(o,[x,y,t]),x.statusCode(s),s=void 0,k&&p.trigger(j?"ajaxSuccess":"ajaxError",[x,m,j?l:t]),r.fireWith(o,[x,y]),k&&(p.trigger("ajaxComplete",[x,m]),--n.active||n.event.trigger("ajaxStop")))}return x},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax(n.extend({url:a,type:b,dataType:e,data:c,success:d},n.isPlainObject(a)&&a))}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return n.isFunction(a)?this.each(function(b){n(this).wrapInner(a.call(this,b))}):this.each(function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return!n.expr.filters.visible(a)},n.expr.filters.visible=function(a){return a.offsetWidth>0||a.offsetHeight>0||a.getClientRects().length>0};var Bb=/%20/g,Cb=/\[\]$/,Db=/\r?\n/g,Eb=/^(?:submit|button|image|reset|file)$/i,Fb=/^(?:input|select|textarea|keygen)/i;function Gb(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||Cb.test(a)?d(a,e):Gb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Gb(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Gb(c,a[c],b,e);return d.join("&").replace(Bb,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Fb.test(this.nodeName)&&!Eb.test(a)&&(this.checked||!X.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(Db,"\r\n")}}):{name:b.name,value:c.replace(Db,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Hb={0:200,1223:204},Ib=n.ajaxSettings.xhr();l.cors=!!Ib&&"withCredentials"in Ib,l.ajax=Ib=!!Ib,n.ajaxTransport(function(b){var c,d;return l.cors||Ib&&!b.crossDomain?{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Hb[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=n("<script>").prop({charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&f("error"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Jb=[],Kb=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Jb.pop()||n.expando+"_"+kb++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Kb.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Kb.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Kb,"$1"+e):b.jsonp!==!1&&(b.url+=(lb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?n(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Jb.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||d;var e=x.exec(a),f=!c&&[];return e?[b.createElement(e[1])]:(e=ca([a],b,f),f&&f.length&&n(f).remove(),n.merge([],e.childNodes))};var Lb=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Lb)return Lb.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};function Mb(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,n.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(e=d.getBoundingClientRect(),c=Mb(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Ea})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;n.fn[a]=function(d){return K(this,function(a,d,e){var f=Mb(a);return void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Ga(l.pixelPosition,function(a,c){return c?(c=Fa(a,b),Ba.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return K(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)},size:function(){return this.length}}),n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Nb=a.jQuery,Ob=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Ob),b&&a.jQuery===n&&(a.jQuery=Nb),n},b||(a.jQuery=a.$=n),n});
  5. /*!
  6. * Bootstrap v3.3.7 (http://getbootstrap.com)
  7. * Copyright 2011-2016 Twitter, Inc.
  8. * Licensed under the MIT license
  9. */
  10. if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){if(a(b.target).is(this))return b.handleObj.handler.apply(this,arguments)}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.7",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a("#"===f?[]:f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.7",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c).prop(c,!0)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c).prop(c,!1))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target).closest(".btn");b.call(d,"toggle"),a(c.target).is('input[type="radio"], input[type="checkbox"]')||(c.preventDefault(),d.is("input,button")?d.trigger("focus"):d.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(a>this.$items.length-1||a<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.7",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.7",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",c).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f,g.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var d=this,e=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(e),this.isShown||e.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){d.$element.one("mouseup.dismiss.bs.modal",function(b){a(b.target).is(d.$element)&&(d.ignoreBackdropClick=!0)})}),this.backdrop(function(){var e=a.support.transition&&d.$element.hasClass("fade");d.$element.parent().length||d.$element.appendTo(d.$body),d.$element.show().scrollTop(0),d.adjustDialog(),e&&d.$element[0].offsetWidth,d.$element.addClass("in"),d.enforceFocus();var f=a.Event("shown.bs.modal",{relatedTarget:b});e?d.$dialog.one("bsTransitionEnd",function(){d.$element.trigger("focus").trigger(f)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger("focus").trigger(f)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(c.TRANSITION_DURATION):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){document===a.target||this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},c.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$body.removeClass("modal-open"),a.resetAdjustments(),a.resetScrollbar(),a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+e).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.handleUpdate=function(){this.adjustDialog()},c.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar()},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",a,b)};c.VERSION="3.3.7",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);if(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),!c.isInStateTrue())return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-m<o.top?"bottom":"right"==h&&k.right+l>o.width?"left":"left"==h&&k.left-l<o.left?"right":h,f.removeClass(n).addClass(h)}var p=this.getCalculatedOffset(h,k,l,m);this.applyPlacement(p,h);var q=function(){var a=e.hoverState;e.$element.trigger("shown.bs."+e.type),e.hoverState=null,"out"==a&&e.leave(e)};a.support.transition&&this.$tip.hasClass("fade")?f.one("bsTransitionEnd",q).emulateTransitionEnd(c.TRANSITION_DURATION):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top+=g,b.left+=h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(m,d[0][n],l)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c?"left":"top",50*(1-a/b)+"%").css(c?"top":"left","")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(b){function d(){"in"!=e.hoverState&&f.detach(),e.$element&&e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),b&&b()}var e=this,f=a(this.$tip),g=a.Event("hide.bs."+this.type);if(this.$element.trigger(g),!g.isDefaultPrevented())return f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",d).emulateTransitionEnd(c.TRANSITION_DURATION):d(),this.hoverState=null,this},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName,e=c.getBoundingClientRect();null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=window.SVGElement&&c instanceof window.SVGElement,g=d?{top:0,left:0}:f?null:b.offset(),h={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop()},i=d?{width:a(window).width(),height:a(window).height()}:null;return a.extend({},e,h,i,g)},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null,a.$element=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.7",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.7",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){
  11. this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.3.7",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest("li"),c),this.activate(h,h.parent(),function(){e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.7",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return e<c&&"top";if("bottom"==this.affixed)return null!=c?!(e+this.unpin<=f.top)&&"bottom":!(e+g<=a-d)&&"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&e<=c?"top":null!=d&&i+j>=a-d&&"bottom"},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);
  12. define("bootstrap", ["jquery"], function(){});
  13. require.config({
  14. urlArgs: "v=" + requirejs.s.contexts._.config.config.site.version,
  15. packages: [{
  16. name: 'moment',
  17. location: '../libs/moment',
  18. main: 'moment'
  19. }
  20. ],
  21. //在打包压缩时将会把include中的模块合并到主文件中
  22. include: ['css', 'layer', 'toastr', 'fast', 'backend', 'table', 'form', 'dragsort', 'drag', 'drop', 'addtabs', 'selectpage'],
  23. paths: {
  24. 'lang': "empty:",
  25. 'form': 'require-form',
  26. 'table': 'require-table',
  27. 'upload': 'require-upload',
  28. 'validator': 'require-validator',
  29. 'drag': 'jquery.drag.min',
  30. 'drop': 'jquery.drop.min',
  31. 'echarts': 'echarts.min',
  32. 'echarts-theme': 'echarts-theme',
  33. 'adminlte': 'adminlte',
  34. 'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch',
  35. 'bootstrap-table-template': 'bootstrap-table-template',
  36. //
  37. // 以下的包从bower的libs目录加载
  38. 'jquery': '../libs/jquery/dist/jquery.min',
  39. 'bootstrap': '../libs/bootstrap/dist/js/bootstrap.min',
  40. 'bootstrap-datetimepicker': '../libs/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min',
  41. 'bootstrap-daterangepicker': '../libs/bootstrap-daterangepicker/daterangepicker',
  42. 'bootstrap-select': '../libs/bootstrap-select/dist/js/bootstrap-select.min',
  43. 'bootstrap-select-lang': '../libs/bootstrap-select/dist/js/i18n/defaults-zh_CN',
  44. 'bootstrap-table': '../libs/bootstrap-table/dist/bootstrap-table.min',
  45. 'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',
  46. 'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile',
  47. 'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN',
  48. 'tableexport': '../libs/tableExport.jquery.plugin/tableExport.min',
  49. 'dragsort': '../libs/dragsort/jquery.dragsort',
  50. 'qrcode': '../libs/jquery-qrcode/jquery.qrcode.min',
  51. 'sortable': '../libs/Sortable/Sortable.min',
  52. 'addtabs': '../libs/jquery-addtabs/jquery.addtabs',
  53. 'slimscroll': '../libs/jquery-slimscroll/jquery.slimscroll',
  54. 'summernote': '../libs/summernote/dist/lang/summernote-zh-CN.min',
  55. 'validator-core': '../libs/nice-validator/dist/jquery.validator',
  56. 'validator-lang': '../libs/nice-validator/dist/local/zh-CN',
  57. 'plupload': '../libs/plupload/js/plupload.min',
  58. 'toastr': '../libs/toastr/toastr',
  59. 'jstree': '../libs/jstree/dist/jstree.min',
  60. 'layer': '../libs/layer/src/layer',
  61. 'cookie': '../libs/jquery.cookie/jquery.cookie',
  62. 'cxselect': '../libs/jquery-cxselect/js/jquery.cxselect',
  63. 'template': '../libs/art-template/dist/template-native',
  64. 'selectpage': '../libs/selectpage/selectpage',
  65. 'citypicker': '../libs/city-picker/dist/js/city-picker.min',
  66. 'citypicker-data': '../libs/city-picker/dist/js/city-picker.data',
  67. },
  68. // shim依赖配置
  69. shim: {
  70. 'addons': ['backend'],
  71. 'bootstrap': ['jquery'],
  72. 'bootstrap-table': {
  73. deps: [
  74. 'bootstrap',
  75. // 'css!../libs/bootstrap-table/dist/bootstrap-table.min.css'
  76. ],
  77. exports: '$.fn.bootstrapTable'
  78. },
  79. 'bootstrap-table-lang': {
  80. deps: ['bootstrap-table'],
  81. exports: '$.fn.bootstrapTable.defaults'
  82. },
  83. 'bootstrap-table-export': {
  84. deps: ['bootstrap-table', 'tableexport'],
  85. exports: '$.fn.bootstrapTable.defaults'
  86. },
  87. 'bootstrap-table-mobile': {
  88. deps: ['bootstrap-table'],
  89. exports: '$.fn.bootstrapTable.defaults'
  90. },
  91. 'bootstrap-table-advancedsearch': {
  92. deps: ['bootstrap-table'],
  93. exports: '$.fn.bootstrapTable.defaults'
  94. },
  95. 'bootstrap-table-commonsearch': {
  96. deps: ['bootstrap-table'],
  97. exports: '$.fn.bootstrapTable.defaults'
  98. },
  99. 'bootstrap-table-template': {
  100. deps: ['bootstrap-table', 'template'],
  101. exports: '$.fn.bootstrapTable.defaults'
  102. },
  103. 'tableexport': {
  104. deps: ['jquery'],
  105. exports: '$.fn.extend'
  106. },
  107. 'slimscroll': {
  108. deps: ['jquery'],
  109. exports: '$.fn.extend'
  110. },
  111. 'adminlte': {
  112. deps: ['bootstrap', 'slimscroll'],
  113. exports: '$.AdminLTE'
  114. },
  115. 'bootstrap-datetimepicker': [
  116. 'moment/locale/zh-cn',
  117. // 'css!../libs/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css',
  118. ],
  119. 'bootstrap-select': ['css!../libs/bootstrap-select/dist/css/bootstrap-select.min.css', ],
  120. 'bootstrap-select-lang': ['bootstrap-select'],
  121. 'summernote': ['../libs/summernote/dist/summernote.min', 'css!../libs/summernote/dist/summernote.css'],
  122. // 'toastr': ['css!../libs/toastr/toastr.min.css'],
  123. 'jstree': ['css!../libs/jstree/dist/themes/default/style.css', ],
  124. 'plupload': {
  125. deps: ['../libs/plupload/js/moxie.min'],
  126. exports: "plupload"
  127. },
  128. // 'layer': ['css!../libs/layer/dist/theme/default/layer.css'],
  129. // 'validator-core': ['css!../libs/nice-validator/dist/jquery.validator.css'],
  130. 'validator-lang': ['validator-core'],
  131. // 'selectpage': ['css!../libs/selectpage/selectpage.css'],
  132. 'citypicker': ['citypicker-data', 'css!../libs/city-picker/dist/css/city-picker.css']
  133. },
  134. baseUrl: requirejs.s.contexts._.config.config.site.cdnurl + '/assets/js/', //资源基础路径
  135. map: {
  136. '*': {
  137. 'css': '../libs/require-css/css.min'
  138. }
  139. },
  140. waitSeconds: 30,
  141. charset: 'utf-8' // 文件编码
  142. });
  143. require(['jquery', 'bootstrap'], function ($, undefined) {
  144. //初始配置
  145. var Config = requirejs.s.contexts._.config.config;
  146. //将Config渲染到全局
  147. window.Config = Config;
  148. // 配置语言包的路径
  149. var paths = {};
  150. paths['lang'] = Config.moduleurl + '/ajax/lang?callback=define&controllername=' + Config.controllername;
  151. // 避免目录冲突
  152. paths['backend/'] = 'backend/';
  153. require.config({paths: paths});
  154. // 初始化
  155. $(function () {
  156. require(['fast'], function (Fast) {
  157. require(['backend', 'addons'], function (Backend, Addons) {
  158. //加载相应模块
  159. if (Config.jsname) {
  160. require([Config.jsname], function (Controller) {
  161. Controller[Config.actionname] != undefined && Controller[Config.actionname]();
  162. }, function (e) {
  163. console.error(e);
  164. // 这里可捕获模块加载的错误
  165. });
  166. }
  167. });
  168. });
  169. });
  170. });
  171. define("require-backend", function(){});
  172. define('../libs/require-css/css.min',[],function(){if("undefined"==typeof window)return{load:function(a,b,c){c()}};var a=document.getElementsByTagName("head")[0],b=window.navigator.userAgent.match(/Trident\/([^ ;]*)|AppleWebKit\/([^ ;]*)|Opera\/([^ ;]*)|rv\:([^ ;]*)(.*?)Gecko\/([^ ;]*)|MSIE\s([^ ;]*)|AndroidWebKit\/([^ ;]*)/)||0,c=!1,d=!0;b[1]||b[7]?c=parseInt(b[1])<6||parseInt(b[7])<=9:b[2]||b[8]?d=!1:b[4]&&(c=parseInt(b[4])<18);var e={};e.pluginBuilder="./css-builder";var f,g,h,i=function(){f=document.createElement("style"),a.appendChild(f),g=f.styleSheet||f.sheet},j=0,k=[],l=function(a){g.addImport(a),f.onload=function(){m()},j++,31==j&&(i(),j=0)},m=function(){h();var a=k.shift();return a?(h=a[1],void l(a[0])):void(h=null)},n=function(a,b){if(g&&g.addImport||i(),g&&g.addImport)h?k.push([a,b]):(l(a),h=b);else{f.textContent='@import "'+a+'";';var c=setInterval(function(){try{f.sheet.cssRules,clearInterval(c),b()}catch(a){}},10)}},o=function(b,c){var e=document.createElement("link");if(e.type="text/css",e.rel="stylesheet",d)e.onload=function(){e.onload=function(){},setTimeout(c,7)};else var f=setInterval(function(){for(var a=0;a<document.styleSheets.length;a++){var b=document.styleSheets[a];if(b.href==e.href)return clearInterval(f),c()}},10);e.href=b,a.appendChild(e)};return e.normalize=function(a,b){return".css"==a.substr(a.length-4,4)&&(a=a.substr(0,a.length-4)),b(a)},e.load=function(a,b,d,e){(c?n:o)(b.toUrl(a+".css"),d)},e});
  173. /**
  174. @Name:layer v3.1.1 Web弹层组件
  175. @Author:贤心
  176. @Site:http://layer.layui.com
  177. @License:MIT
  178. */
  179. ;!function(window, undefined){
  180. "use strict";
  181. var isLayui = window.layui && layui.define, $, win, ready = {
  182. getPath: function(){
  183. var jsPath = document.currentScript ? document.currentScript.src : function(){
  184. var js = document.scripts
  185. ,last = js.length - 1
  186. ,src;
  187. for(var i = last; i > 0; i--){
  188. if(js[i].readyState === 'interactive'){
  189. src = js[i].src;
  190. break;
  191. }
  192. }
  193. return src || js[last].src;
  194. }();
  195. return jsPath.substring(0, jsPath.lastIndexOf('/') + 1);
  196. }(),
  197. config: {}, end: {}, minIndex: 0, minLeft: [],
  198. btn: ['&#x786E;&#x5B9A;', '&#x53D6;&#x6D88;'],
  199. //五种原始层模式
  200. type: ['dialog', 'page', 'iframe', 'loading', 'tips'],
  201. //获取节点的style属性值
  202. getStyle: function(node, name){
  203. var style = node.currentStyle ? node.currentStyle : window.getComputedStyle(node, null);
  204. return style[style.getPropertyValue ? 'getPropertyValue' : 'getAttribute'](name);
  205. },
  206. //载入CSS配件
  207. link: function(href, fn, cssname){
  208. //未设置路径,则不主动加载css
  209. if(!layer.path) return;
  210. var head = document.getElementsByTagName("head")[0], link = document.createElement('link');
  211. if(typeof fn === 'string') cssname = fn;
  212. var app = (cssname || href).replace(/\.|\//g, '');
  213. var id = 'layuicss-'+ app, timeout = 0;
  214. link.rel = 'stylesheet';
  215. link.href = layer.path + href;
  216. link.id = id;
  217. if(!document.getElementById(id)){
  218. head.appendChild(link);
  219. }
  220. if(typeof fn !== 'function') return;
  221. //轮询css是否加载完毕
  222. (function poll() {
  223. if(++timeout > 8 * 1000 / 100){
  224. return window.console && console.error('layer.css: Invalid');
  225. };
  226. parseInt(ready.getStyle(document.getElementById(id), 'width')) === 1989 ? fn() : setTimeout(poll, 100);
  227. }());
  228. }
  229. };
  230. //默认内置方法。
  231. var layer = {
  232. v: '3.1.1',
  233. ie: function(){ //ie版本
  234. var agent = navigator.userAgent.toLowerCase();
  235. return (!!window.ActiveXObject || "ActiveXObject" in window) ? (
  236. (agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识
  237. ) : false;
  238. }(),
  239. index: (window.layer && window.layer.v) ? 100000 : 0,
  240. path: ready.getPath,
  241. config: function(options, fn){
  242. options = options || {};
  243. layer.cache = ready.config = $.extend({}, ready.config, options);
  244. layer.path = ready.config.path || layer.path;
  245. typeof options.extend === 'string' && (options.extend = [options.extend]);
  246. if(ready.config.path) layer.ready();
  247. if(!options.extend) return this;
  248. isLayui
  249. ? layui.addcss('modules/layer/' + options.extend)
  250. : ready.link('theme/' + options.extend);
  251. return this;
  252. },
  253. //主体CSS等待事件
  254. ready: function(callback){
  255. var cssname = 'layer', ver = ''
  256. ,path = (isLayui ? 'modules/layer/' : 'theme/') + 'default/layer.css?v='+ layer.v + ver;
  257. isLayui ? layui.addcss(path, callback, cssname) : ready.link(path, callback, cssname);
  258. return this;
  259. },
  260. //各种快捷引用
  261. alert: function(content, options, yes){
  262. var type = typeof options === 'function';
  263. if(type) yes = options;
  264. return layer.open($.extend({
  265. content: content,
  266. yes: yes
  267. }, type ? {} : options));
  268. },
  269. confirm: function(content, options, yes, cancel){
  270. var type = typeof options === 'function';
  271. if(type){
  272. cancel = yes;
  273. yes = options;
  274. }
  275. return layer.open($.extend({
  276. content: content,
  277. btn: ready.btn,
  278. yes: yes,
  279. btn2: cancel
  280. }, type ? {} : options));
  281. },
  282. msg: function(content, options, end){ //最常用提示层
  283. var type = typeof options === 'function', rskin = ready.config.skin;
  284. var skin = (rskin ? rskin + ' ' + rskin + '-msg' : '')||'layui-layer-msg';
  285. var anim = doms.anim.length - 1;
  286. if(type) end = options;
  287. return layer.open($.extend({
  288. content: content,
  289. time: 3000,
  290. shade: false,
  291. skin: skin,
  292. title: false,
  293. closeBtn: false,
  294. btn: false,
  295. resize: false,
  296. end: end
  297. }, (type && !ready.config.skin) ? {
  298. skin: skin + ' layui-layer-hui',
  299. anim: anim
  300. } : function(){
  301. options = options || {};
  302. if(options.icon === -1 || options.icon === undefined && !ready.config.skin){
  303. options.skin = skin + ' ' + (options.skin||'layui-layer-hui');
  304. }
  305. return options;
  306. }()));
  307. },
  308. load: function(icon, options){
  309. return layer.open($.extend({
  310. type: 3,
  311. icon: icon || 0,
  312. resize: false,
  313. shade: 0.01
  314. }, options));
  315. },
  316. tips: function(content, follow, options){
  317. return layer.open($.extend({
  318. type: 4,
  319. content: [content, follow],
  320. closeBtn: false,
  321. time: 3000,
  322. shade: false,
  323. resize: false,
  324. fixed: false,
  325. maxWidth: 210
  326. }, options));
  327. }
  328. };
  329. var Class = function(setings){
  330. var that = this;
  331. that.index = ++layer.index;
  332. that.config = $.extend({}, that.config, ready.config, setings);
  333. document.body ? that.creat() : setTimeout(function(){
  334. that.creat();
  335. }, 30);
  336. };
  337. Class.pt = Class.prototype;
  338. //缓存常用字符
  339. var doms = ['layui-layer', '.layui-layer-title', '.layui-layer-main', '.layui-layer-dialog', 'layui-layer-iframe', 'layui-layer-content', 'layui-layer-btn', 'layui-layer-close'];
  340. doms.anim = ['layer-anim-00', 'layer-anim-01', 'layer-anim-02', 'layer-anim-03', 'layer-anim-04', 'layer-anim-05', 'layer-anim-06'];
  341. //默认配置
  342. Class.pt.config = {
  343. type: 0,
  344. shade: 0.3,
  345. fixed: true,
  346. move: doms[1],
  347. title: '&#x4FE1;&#x606F;',
  348. offset: 'auto',
  349. area: 'auto',
  350. closeBtn: 1,
  351. time: 0, //0表示不自动关闭
  352. zIndex: 19891014,
  353. maxWidth: 360,
  354. anim: 0,
  355. isOutAnim: true,
  356. icon: -1,
  357. moveType: 1,
  358. resize: true,
  359. scrollbar: true, //是否允许浏览器滚动条
  360. tips: 2
  361. };
  362. //容器
  363. Class.pt.vessel = function(conType, callback){
  364. var that = this, times = that.index, config = that.config;
  365. var zIndex = config.zIndex + times, titype = typeof config.title === 'object';
  366. var ismax = config.maxmin && (config.type === 1 || config.type === 2);
  367. var titleHTML = (config.title ? '<div class="layui-layer-title" style="'+ (titype ? config.title[1] : '') +'">'
  368. + (titype ? config.title[0] : config.title)
  369. + '</div>' : '');
  370. config.zIndex = zIndex;
  371. callback([
  372. //遮罩
  373. config.shade ? ('<div class="layui-layer-shade" id="layui-layer-shade'+ times +'" times="'+ times +'" style="'+ ('z-index:'+ (zIndex-1) +'; ') +'"></div>') : '',
  374. //主体
  375. '<div class="'+ doms[0] + (' layui-layer-'+ready.type[config.type]) + (((config.type == 0 || config.type == 2) && !config.shade) ? ' layui-layer-border' : '') + ' ' + (config.skin||'') +'" id="'+ doms[0] + times +'" type="'+ ready.type[config.type] +'" times="'+ times +'" showtime="'+ config.time +'" conType="'+ (conType ? 'object' : 'string') +'" style="z-index: '+ zIndex +'; width:'+ config.area[0] + ';height:' + config.area[1] + (config.fixed ? '' : ';position:absolute;') +'">'
  376. + (conType && config.type != 2 ? '' : titleHTML)
  377. + '<div id="'+ (config.id||'') +'" class="layui-layer-content'+ ((config.type == 0 && config.icon !== -1) ? ' layui-layer-padding' :'') + (config.type == 3 ? ' layui-layer-loading'+config.icon : '') +'">'
  378. + (config.type == 0 && config.icon !== -1 ? '<i class="layui-layer-ico layui-layer-ico'+ config.icon +'"></i>' : '')
  379. + (config.type == 1 && conType ? '' : (config.content||''))
  380. + '</div>'
  381. + '<span class="layui-layer-setwin">'+ function(){
  382. var closebtn = ismax ? '<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>' : '';
  383. config.closeBtn && (closebtn += '<a class="layui-layer-ico '+ doms[7] +' '+ doms[7] + (config.title ? config.closeBtn : (config.type == 4 ? '1' : '2')) +'" href="javascript:;"></a>');
  384. return closebtn;
  385. }() + '</span>'
  386. + (config.btn ? function(){
  387. var button = '';
  388. typeof config.btn === 'string' && (config.btn = [config.btn]);
  389. for(var i = 0, len = config.btn.length; i < len; i++){
  390. button += '<a class="'+ doms[6] +''+ i +'">'+ config.btn[i] +'</a>'
  391. }
  392. return '<div class="'+ doms[6] +' layui-layer-btn-'+ (config.btnAlign||'') +'">'+ button +'</div>'
  393. }() : '')
  394. + (config.resize ? '<span class="layui-layer-resize"></span>' : '')
  395. + '</div>'
  396. ], titleHTML, $('<div class="layui-layer-move"></div>'));
  397. return that;
  398. };
  399. //创建骨架
  400. Class.pt.creat = function(){
  401. var that = this
  402. ,config = that.config
  403. ,times = that.index, nodeIndex
  404. ,content = config.content
  405. ,conType = typeof content === 'object'
  406. ,body = $('body');
  407. if(config.id && $('#'+config.id)[0]) return;
  408. if(typeof config.area === 'string'){
  409. config.area = config.area === 'auto' ? ['', ''] : [config.area, ''];
  410. }
  411. //anim兼容旧版shift
  412. if(config.shift){
  413. config.anim = config.shift;
  414. }
  415. if(layer.ie == 6){
  416. config.fixed = false;
  417. }
  418. switch(config.type){
  419. case 0:
  420. config.btn = ('btn' in config) ? config.btn : ready.btn[0];
  421. layer.closeAll('dialog');
  422. break;
  423. case 2:
  424. var content = config.content = conType ? config.content : [config.content||'http://layer.layui.com', 'auto'];
  425. config.content = '<iframe scrolling="'+ (config.content[1]||'auto') +'" allowtransparency="true" id="'+ doms[4] +''+ times +'" name="'+ doms[4] +''+ times +'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="' + config.content[0] + '"></iframe>';
  426. break;
  427. case 3:
  428. delete config.title;
  429. delete config.closeBtn;
  430. config.icon === -1 && (config.icon === 0);
  431. layer.closeAll('loading');
  432. break;
  433. case 4:
  434. conType || (config.content = [config.content, 'body']);
  435. config.follow = config.content[1];
  436. config.content = config.content[0] + '<i class="layui-layer-TipsG"></i>';
  437. delete config.title;
  438. config.tips = typeof config.tips === 'object' ? config.tips : [config.tips, true];
  439. config.tipsMore || layer.closeAll('tips');
  440. break;
  441. }
  442. //建立容器
  443. that.vessel(conType, function(html, titleHTML, moveElem){
  444. body.append(html[0]);
  445. conType ? function(){
  446. (config.type == 2 || config.type == 4) ? function(){
  447. $('body').append(html[1]);
  448. }() : function(){
  449. if(!content.parents('.'+doms[0])[0]){
  450. content.data('display', content.css('display')).show().addClass('layui-layer-wrap').wrap(html[1]);
  451. $('#'+ doms[0] + times).find('.'+doms[5]).before(titleHTML);
  452. }
  453. }();
  454. }() : body.append(html[1]);
  455. $('.layui-layer-move')[0] || body.append(ready.moveElem = moveElem);
  456. that.layero = $('#'+ doms[0] + times);
  457. config.scrollbar || doms.html.css('overflow', 'hidden').attr('layer-full', times);
  458. }).auto(times);
  459. //遮罩
  460. $('#layui-layer-shade'+ that.index).css({
  461. 'background-color': config.shade[1] || '#000'
  462. ,'opacity': config.shade[0]||config.shade
  463. });
  464. config.type == 2 && layer.ie == 6 && that.layero.find('iframe').attr('src', content[0]);
  465. //坐标自适应浏览器窗口尺寸
  466. config.type == 4 ? that.tips() : that.offset();
  467. if(config.fixed){
  468. win.on('resize', function(){
  469. that.offset();
  470. (/^\d+%$/.test(config.area[0]) || /^\d+%$/.test(config.area[1])) && that.auto(times);
  471. config.type == 4 && that.tips();
  472. });
  473. }
  474. config.time <= 0 || setTimeout(function(){
  475. layer.close(that.index)
  476. }, config.time);
  477. that.move().callback();
  478. //为兼容jQuery3.0的css动画影响元素尺寸计算
  479. if(doms.anim[config.anim]){
  480. var animClass = 'layer-anim '+ doms.anim[config.anim];
  481. that.layero.addClass(animClass).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
  482. $(this).removeClass(animClass);
  483. });
  484. };
  485. //记录关闭动画
  486. if(config.isOutAnim){
  487. that.layero.data('isOutAnim', true);
  488. }
  489. };
  490. //自适应
  491. Class.pt.auto = function(index){
  492. var that = this, config = that.config, layero = $('#'+ doms[0] + index);
  493. if(config.area[0] === '' && config.maxWidth > 0){
  494. //为了修复IE7下一个让人难以理解的bug
  495. if(layer.ie && layer.ie < 8 && config.btn){
  496. layero.width(layero.innerWidth());
  497. }
  498. layero.outerWidth() > config.maxWidth && layero.width(config.maxWidth);
  499. }
  500. var area = [layero.innerWidth(), layero.innerHeight()]
  501. ,titHeight = layero.find(doms[1]).outerHeight() || 0
  502. ,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0
  503. ,setHeight = function(elem){
  504. elem = layero.find(elem);
  505. elem.height(area[1] - titHeight - btnHeight - 2*(parseFloat(elem.css('padding-top'))|0));
  506. };
  507. switch(config.type){
  508. case 2:
  509. setHeight('iframe');
  510. break;
  511. default:
  512. if(config.area[1] === ''){
  513. if(config.maxHeight > 0 && layero.outerHeight() > config.maxHeight){
  514. area[1] = config.maxHeight;
  515. setHeight('.'+doms[5]);
  516. } else if(config.fixed && area[1] >= win.height()){
  517. area[1] = win.height();
  518. setHeight('.'+doms[5]);
  519. }
  520. } else {
  521. setHeight('.'+doms[5]);
  522. }
  523. break;
  524. };
  525. return that;
  526. };
  527. //计算坐标
  528. Class.pt.offset = function(){
  529. var that = this, config = that.config, layero = that.layero;
  530. var area = [layero.outerWidth(), layero.outerHeight()];
  531. var type = typeof config.offset === 'object';
  532. that.offsetTop = (win.height() - area[1])/2;
  533. that.offsetLeft = (win.width() - area[0])/2;
  534. if(type){
  535. that.offsetTop = config.offset[0];
  536. that.offsetLeft = config.offset[1]||that.offsetLeft;
  537. } else if(config.offset !== 'auto'){
  538. if(config.offset === 't'){ //上
  539. that.offsetTop = 0;
  540. } else if(config.offset === 'r'){ //右
  541. that.offsetLeft = win.width() - area[0];
  542. } else if(config.offset === 'b'){ //下
  543. that.offsetTop = win.height() - area[1];
  544. } else if(config.offset === 'l'){ //左
  545. that.offsetLeft = 0;
  546. } else if(config.offset === 'lt'){ //左上角
  547. that.offsetTop = 0;
  548. that.offsetLeft = 0;
  549. } else if(config.offset === 'lb'){ //左下角
  550. that.offsetTop = win.height() - area[1];
  551. that.offsetLeft = 0;
  552. } else if(config.offset === 'rt'){ //右上角
  553. that.offsetTop = 0;
  554. that.offsetLeft = win.width() - area[0];
  555. } else if(config.offset === 'rb'){ //右下角
  556. that.offsetTop = win.height() - area[1];
  557. that.offsetLeft = win.width() - area[0];
  558. } else {
  559. that.offsetTop = config.offset;
  560. }
  561. }
  562. if(!config.fixed){
  563. that.offsetTop = /%$/.test(that.offsetTop) ?
  564. win.height()*parseFloat(that.offsetTop)/100
  565. : parseFloat(that.offsetTop);
  566. that.offsetLeft = /%$/.test(that.offsetLeft) ?
  567. win.width()*parseFloat(that.offsetLeft)/100
  568. : parseFloat(that.offsetLeft);
  569. that.offsetTop += win.scrollTop();
  570. that.offsetLeft += win.scrollLeft();
  571. }
  572. if(layero.attr('minLeft')){
  573. that.offsetTop = win.height() - (layero.find(doms[1]).outerHeight() || 0);
  574. that.offsetLeft = layero.css('left');
  575. }
  576. layero.css({top: that.offsetTop, left: that.offsetLeft});
  577. };
  578. //Tips
  579. Class.pt.tips = function(){
  580. var that = this, config = that.config, layero = that.layero;
  581. var layArea = [layero.outerWidth(), layero.outerHeight()], follow = $(config.follow);
  582. if(!follow[0]) follow = $('body');
  583. var goal = {
  584. width: follow.outerWidth(),
  585. height: follow.outerHeight(),
  586. top: follow.offset().top,
  587. left: follow.offset().left
  588. }, tipsG = layero.find('.layui-layer-TipsG');
  589. var guide = config.tips[0];
  590. config.tips[1] || tipsG.remove();
  591. goal.autoLeft = function(){
  592. if(goal.left + layArea[0] - win.width() > 0){
  593. goal.tipLeft = goal.left + goal.width - layArea[0];
  594. tipsG.css({right: 12, left: 'auto'});
  595. } else {
  596. goal.tipLeft = goal.left;
  597. };
  598. };
  599. //辨别tips的方位
  600. goal.where = [function(){ //上
  601. goal.autoLeft();
  602. goal.tipTop = goal.top - layArea[1] - 10;
  603. tipsG.removeClass('layui-layer-TipsB').addClass('layui-layer-TipsT').css('border-right-color', config.tips[1]);
  604. }, function(){ //右
  605. goal.tipLeft = goal.left + goal.width + 10;
  606. goal.tipTop = goal.top;
  607. tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]);
  608. }, function(){ //下
  609. goal.autoLeft();
  610. goal.tipTop = goal.top + goal.height + 10;
  611. tipsG.removeClass('layui-layer-TipsT').addClass('layui-layer-TipsB').css('border-right-color', config.tips[1]);
  612. }, function(){ //左
  613. goal.tipLeft = goal.left - layArea[0] - 10;
  614. goal.tipTop = goal.top;
  615. tipsG.removeClass('layui-layer-TipsR').addClass('layui-layer-TipsL').css('border-bottom-color', config.tips[1]);
  616. }];
  617. goal.where[guide-1]();
  618. /* 8*2为小三角形占据的空间 */
  619. if(guide === 1){
  620. goal.top - (win.scrollTop() + layArea[1] + 8*2) < 0 && goal.where[2]();
  621. } else if(guide === 2){
  622. win.width() - (goal.left + goal.width + layArea[0] + 8*2) > 0 || goal.where[3]()
  623. } else if(guide === 3){
  624. (goal.top - win.scrollTop() + goal.height + layArea[1] + 8*2) - win.height() > 0 && goal.where[0]();
  625. } else if(guide === 4){
  626. layArea[0] + 8*2 - goal.left > 0 && goal.where[1]()
  627. }
  628. layero.find('.'+doms[5]).css({
  629. 'background-color': config.tips[1],
  630. 'padding-right': (config.closeBtn ? '30px' : '')
  631. });
  632. layero.css({
  633. left: goal.tipLeft - (config.fixed ? win.scrollLeft() : 0),
  634. top: goal.tipTop - (config.fixed ? win.scrollTop() : 0)
  635. });
  636. }
  637. //拖拽层
  638. Class.pt.move = function(){
  639. var that = this
  640. ,config = that.config
  641. ,_DOC = $(document)
  642. ,layero = that.layero
  643. ,moveElem = layero.find(config.move)
  644. ,resizeElem = layero.find('.layui-layer-resize')
  645. ,dict = {};
  646. if(config.move){
  647. moveElem.css('cursor', 'move');
  648. }
  649. moveElem.on('mousedown', function(e){
  650. e.preventDefault();
  651. if(config.move){
  652. dict.moveStart = true;
  653. dict.offset = [
  654. e.clientX - parseFloat(layero.css('left'))
  655. ,e.clientY - parseFloat(layero.css('top'))
  656. ];
  657. ready.moveElem.css('cursor', 'move').show();
  658. }
  659. });
  660. resizeElem.on('mousedown', function(e){
  661. e.preventDefault();
  662. dict.resizeStart = true;
  663. dict.offset = [e.clientX, e.clientY];
  664. dict.area = [
  665. layero.outerWidth()
  666. ,layero.outerHeight()
  667. ];
  668. ready.moveElem.css('cursor', 'se-resize').show();
  669. });
  670. _DOC.on('mousemove', function(e){
  671. //拖拽移动
  672. if(dict.moveStart){
  673. var X = e.clientX - dict.offset[0]
  674. ,Y = e.clientY - dict.offset[1]
  675. ,fixed = layero.css('position') === 'fixed';
  676. e.preventDefault();
  677. dict.stX = fixed ? 0 : win.scrollLeft();
  678. dict.stY = fixed ? 0 : win.scrollTop();
  679. //控制元素不被拖出窗口外
  680. if(!config.moveOut){
  681. var setRig = win.width() - layero.outerWidth() + dict.stX
  682. ,setBot = win.height() - layero.outerHeight() + dict.stY;
  683. X < dict.stX && (X = dict.stX);
  684. X > setRig && (X = setRig);
  685. Y < dict.stY && (Y = dict.stY);
  686. Y > setBot && (Y = setBot);
  687. }
  688. layero.css({
  689. left: X
  690. ,top: Y
  691. });
  692. }
  693. //Resize
  694. if(config.resize && dict.resizeStart){
  695. var X = e.clientX - dict.offset[0]
  696. ,Y = e.clientY - dict.offset[1];
  697. e.preventDefault();
  698. layer.style(that.index, {
  699. width: dict.area[0] + X
  700. ,height: dict.area[1] + Y
  701. })
  702. dict.isResize = true;
  703. config.resizing && config.resizing(layero);
  704. }
  705. }).on('mouseup', function(e){
  706. if(dict.moveStart){
  707. delete dict.moveStart;
  708. ready.moveElem.hide();
  709. config.moveEnd && config.moveEnd(layero);
  710. }
  711. if(dict.resizeStart){
  712. delete dict.resizeStart;
  713. ready.moveElem.hide();
  714. }
  715. });
  716. return that;
  717. };
  718. Class.pt.callback = function(){
  719. var that = this, layero = that.layero, config = that.config;
  720. that.openLayer();
  721. if(config.success){
  722. if(config.type == 2){
  723. layero.find('iframe').on('load', function(){
  724. config.success(layero, that.index);
  725. });
  726. } else {
  727. config.success(layero, that.index);
  728. }
  729. }
  730. layer.ie == 6 && that.IE6(layero);
  731. //按钮
  732. layero.find('.'+ doms[6]).children('a').on('click', function(){
  733. var index = $(this).index();
  734. if(index === 0){
  735. if(config.yes){
  736. config.yes(that.index, layero)
  737. } else if(config['btn1']){
  738. config['btn1'](that.index, layero)
  739. } else {
  740. layer.close(that.index);
  741. }
  742. } else {
  743. var close = config['btn'+(index+1)] && config['btn'+(index+1)](that.index, layero);
  744. close === false || layer.close(that.index);
  745. }
  746. });
  747. //取消
  748. function cancel(){
  749. var close = config.cancel && config.cancel(that.index, layero);
  750. close === false || layer.close(that.index);
  751. }
  752. //右上角关闭回调
  753. layero.find('.'+ doms[7]).on('click', cancel);
  754. //点遮罩关闭
  755. if(config.shadeClose){
  756. $('#layui-layer-shade'+ that.index).on('click', function(){
  757. layer.close(that.index);
  758. });
  759. }
  760. //最小化
  761. layero.find('.layui-layer-min').on('click', function(){
  762. var min = config.min && config.min(layero);
  763. min === false || layer.min(that.index, config);
  764. });
  765. //全屏/还原
  766. layero.find('.layui-layer-max').on('click', function(){
  767. if($(this).hasClass('layui-layer-maxmin')){
  768. layer.restore(that.index);
  769. config.restore && config.restore(layero);
  770. } else {
  771. layer.full(that.index, config);
  772. setTimeout(function(){
  773. config.full && config.full(layero);
  774. }, 100);
  775. }
  776. });
  777. config.end && (ready.end[that.index] = config.end);
  778. };
  779. //for ie6 恢复select
  780. ready.reselect = function(){
  781. $.each($('select'), function(index , value){
  782. var sthis = $(this);
  783. if(!sthis.parents('.'+doms[0])[0]){
  784. (sthis.attr('layer') == 1 && $('.'+doms[0]).length < 1) && sthis.removeAttr('layer').show();
  785. }
  786. sthis = null;
  787. });
  788. };
  789. Class.pt.IE6 = function(layero){
  790. //隐藏select
  791. $('select').each(function(index , value){
  792. var sthis = $(this);
  793. if(!sthis.parents('.'+doms[0])[0]){
  794. sthis.css('display') === 'none' || sthis.attr({'layer' : '1'}).hide();
  795. }
  796. sthis = null;
  797. });
  798. };
  799. //需依赖原型的对外方法
  800. Class.pt.openLayer = function(){
  801. var that = this;
  802. //置顶当前窗口
  803. layer.zIndex = that.config.zIndex;
  804. layer.setTop = function(layero){
  805. var setZindex = function(){
  806. layer.zIndex++;
  807. layero.css('z-index', layer.zIndex + 1);
  808. };
  809. layer.zIndex = parseInt(layero[0].style.zIndex);
  810. layero.on('mousedown', setZindex);
  811. return layer.zIndex;
  812. };
  813. };
  814. ready.record = function(layero){
  815. var area = [
  816. layero.width(),
  817. layero.height(),
  818. layero.position().top,
  819. layero.position().left + parseFloat(layero.css('margin-left'))
  820. ];
  821. layero.find('.layui-layer-max').addClass('layui-layer-maxmin');
  822. layero.attr({area: area});
  823. };
  824. ready.rescollbar = function(index){
  825. if(doms.html.attr('layer-full') == index){
  826. if(doms.html[0].style.removeProperty){
  827. doms.html[0].style.removeProperty('overflow');
  828. } else {
  829. doms.html[0].style.removeAttribute('overflow');
  830. }
  831. doms.html.removeAttr('layer-full');
  832. }
  833. };
  834. /** 内置成员 */
  835. window.layer = layer;
  836. //获取子iframe的DOM
  837. layer.getChildFrame = function(selector, index){
  838. index = index || $('.'+doms[4]).attr('times');
  839. return $('#'+ doms[0] + index).find('iframe').contents().find(selector);
  840. };
  841. //得到当前iframe层的索引,子iframe时使用
  842. layer.getFrameIndex = function(name){
  843. return $('#'+ name).parents('.'+doms[4]).attr('times');
  844. };
  845. //iframe层自适应宽高
  846. layer.iframeAuto = function(index){
  847. if(!index) return;
  848. var heg = layer.getChildFrame('html', index).outerHeight();
  849. var layero = $('#'+ doms[0] + index);
  850. var titHeight = layero.find(doms[1]).outerHeight() || 0;
  851. var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;
  852. layero.css({height: heg + titHeight + btnHeight});
  853. layero.find('iframe').css({height: heg});
  854. };
  855. //重置iframe url
  856. layer.iframeSrc = function(index, url){
  857. $('#'+ doms[0] + index).find('iframe').attr('src', url);
  858. };
  859. //设定层的样式
  860. layer.style = function(index, options, limit){
  861. var layero = $('#'+ doms[0] + index)
  862. ,contElem = layero.find('.layui-layer-content')
  863. ,type = layero.attr('type')
  864. ,titHeight = layero.find(doms[1]).outerHeight() || 0
  865. ,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0
  866. ,minLeft = layero.attr('minLeft');
  867. if(type === ready.type[3] || type === ready.type[4]){
  868. return;
  869. }
  870. if(!limit){
  871. if(parseFloat(options.width) <= 260){
  872. options.width = 260;
  873. };
  874. if(parseFloat(options.height) - titHeight - btnHeight <= 64){
  875. options.height = 64 + titHeight + btnHeight;
  876. };
  877. }
  878. layero.css(options);
  879. btnHeight = layero.find('.'+doms[6]).outerHeight();
  880. if(type === ready.type[2]){
  881. layero.find('iframe').css({
  882. height: parseFloat(options.height) - titHeight - btnHeight
  883. });
  884. } else {
  885. contElem.css({
  886. height: parseFloat(options.height) - titHeight - btnHeight
  887. - parseFloat(contElem.css('padding-top'))
  888. - parseFloat(contElem.css('padding-bottom'))
  889. })
  890. }
  891. };
  892. //最小化
  893. layer.min = function(index, options){
  894. var layero = $('#'+ doms[0] + index)
  895. ,titHeight = layero.find(doms[1]).outerHeight() || 0
  896. ,left = layero.attr('minLeft') || (181*ready.minIndex)+'px'
  897. ,position = layero.css('position');
  898. ready.record(layero);
  899. if(ready.minLeft[0]){
  900. left = ready.minLeft[0];
  901. ready.minLeft.shift();
  902. }
  903. layero.attr('position', position);
  904. layer.style(index, {
  905. width: 180
  906. ,height: titHeight
  907. ,left: left
  908. ,top: win.height() - titHeight
  909. ,position: 'fixed'
  910. ,overflow: 'hidden'
  911. }, true);
  912. layero.find('.layui-layer-min').hide();
  913. layero.attr('type') === 'page' && layero.find(doms[4]).hide();
  914. ready.rescollbar(index);
  915. if(!layero.attr('minLeft')){
  916. ready.minIndex++;
  917. }
  918. layero.attr('minLeft', left);
  919. };
  920. //还原
  921. layer.restore = function(index){
  922. var layero = $('#'+ doms[0] + index), area = layero.attr('area').split(',');
  923. var type = layero.attr('type');
  924. layer.style(index, {
  925. width: parseFloat(area[0]),
  926. height: parseFloat(area[1]),
  927. top: parseFloat(area[2]),
  928. left: parseFloat(area[3]),
  929. position: layero.attr('position'),
  930. overflow: 'visible'
  931. }, true);
  932. layero.find('.layui-layer-max').removeClass('layui-layer-maxmin');
  933. layero.find('.layui-layer-min').show();
  934. layero.attr('type') === 'page' && layero.find(doms[4]).show();
  935. ready.rescollbar(index);
  936. };
  937. //全屏
  938. layer.full = function(index){
  939. var layero = $('#'+ doms[0] + index), timer;
  940. ready.record(layero);
  941. if(!doms.html.attr('layer-full')){
  942. doms.html.css('overflow','hidden').attr('layer-full', index);
  943. }
  944. clearTimeout(timer);
  945. timer = setTimeout(function(){
  946. var isfix = layero.css('position') === 'fixed';
  947. layer.style(index, {
  948. top: isfix ? 0 : win.scrollTop(),
  949. left: isfix ? 0 : win.scrollLeft(),
  950. width: win.width(),
  951. height: win.height()
  952. }, true);
  953. layero.find('.layui-layer-min').hide();
  954. }, 100);
  955. };
  956. //改变title
  957. layer.title = function(name, index){
  958. var title = $('#'+ doms[0] + (index||layer.index)).find(doms[1]);
  959. title.html(name);
  960. };
  961. //关闭layer总方法
  962. layer.close = function(index){
  963. var layero = $('#'+ doms[0] + index), type = layero.attr('type'), closeAnim = 'layer-anim-close';
  964. if(!layero[0]) return;
  965. var WRAP = 'layui-layer-wrap', remove = function(){
  966. if(type === ready.type[1] && layero.attr('conType') === 'object'){
  967. layero.children(':not(.'+ doms[5] +')').remove();
  968. var wrap = layero.find('.'+WRAP);
  969. for(var i = 0; i < 2; i++){
  970. wrap.unwrap();
  971. }
  972. wrap.css('display', wrap.data('display')).removeClass(WRAP);
  973. } else {
  974. //低版本IE 回收 iframe
  975. if(type === ready.type[2]){
  976. try {
  977. var iframe = $('#'+doms[4]+index)[0];
  978. iframe.contentWindow.document.write('');
  979. iframe.contentWindow.close();
  980. layero.find('.'+doms[5])[0].removeChild(iframe);
  981. } catch(e){}
  982. }
  983. layero[0].innerHTML = '';
  984. layero.remove();
  985. }
  986. typeof ready.end[index] === 'function' && ready.end[index]();
  987. delete ready.end[index];
  988. };
  989. if(layero.data('isOutAnim')){
  990. layero.addClass('layer-anim '+ closeAnim);
  991. }
  992. $('#layui-layer-moves, #layui-layer-shade' + index).remove();
  993. layer.ie == 6 && ready.reselect();
  994. ready.rescollbar(index);
  995. if(layero.attr('minLeft')){
  996. ready.minIndex--;
  997. ready.minLeft.push(layero.attr('minLeft'));
  998. }
  999. if((layer.ie && layer.ie < 10) || !layero.data('isOutAnim')){
  1000. remove()
  1001. } else {
  1002. setTimeout(function(){
  1003. remove();
  1004. }, 200);
  1005. }
  1006. };
  1007. //关闭所有层
  1008. layer.closeAll = function(type){
  1009. $.each($('.'+doms[0]), function(){
  1010. var othis = $(this);
  1011. var is = type ? (othis.attr('type') === type) : 1;
  1012. is && layer.close(othis.attr('times'));
  1013. is = null;
  1014. });
  1015. };
  1016. /**
  1017. 拓展模块,layui开始合并在一起
  1018. */
  1019. var cache = layer.cache||{}, skin = function(type){
  1020. return (cache.skin ? (' ' + cache.skin + ' ' + cache.skin + '-'+type) : '');
  1021. };
  1022. //仿系统prompt
  1023. layer.prompt = function(options, yes){
  1024. var style = '';
  1025. options = options || {};
  1026. if(typeof options === 'function') yes = options;
  1027. if(options.area){
  1028. var area = options.area;
  1029. style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"';
  1030. delete options.area;
  1031. }
  1032. var prompt, content = options.formType == 2 ? '<textarea class="layui-layer-input"' + style +'>' + (options.value||'') +'</textarea>' : function(){
  1033. return '<input type="'+ (options.formType == 1 ? 'password' : 'text') +'" class="layui-layer-input" value="'+ (options.value||'') +'">';
  1034. }();
  1035. var success = options.success;
  1036. delete options.success;
  1037. return layer.open($.extend({
  1038. type: 1
  1039. ,btn: ['&#x786E;&#x5B9A;','&#x53D6;&#x6D88;']
  1040. ,content: content
  1041. ,skin: 'layui-layer-prompt' + skin('prompt')
  1042. ,maxWidth: win.width()
  1043. ,success: function(layero){
  1044. prompt = layero.find('.layui-layer-input');
  1045. prompt.focus();
  1046. typeof success === 'function' && success(layero);
  1047. }
  1048. ,resize: false
  1049. ,yes: function(index){
  1050. var value = prompt.val();
  1051. if(value === ''){
  1052. prompt.focus();
  1053. } else if(value.length > (options.maxlength||500)) {
  1054. layer.tips('&#x6700;&#x591A;&#x8F93;&#x5165;'+ (options.maxlength || 500) +'&#x4E2A;&#x5B57;&#x6570;', prompt, {tips: 1});
  1055. } else {
  1056. yes && yes(value, index, prompt);
  1057. }
  1058. }
  1059. }, options));
  1060. };
  1061. //tab层
  1062. layer.tab = function(options){
  1063. options = options || {};
  1064. var tab = options.tab || {}
  1065. ,THIS = 'layui-this'
  1066. ,success = options.success;
  1067. delete options.success;
  1068. return layer.open($.extend({
  1069. type: 1,
  1070. skin: 'layui-layer-tab' + skin('tab'),
  1071. resize: false,
  1072. title: function(){
  1073. var len = tab.length, ii = 1, str = '';
  1074. if(len > 0){
  1075. str = '<span class="'+ THIS +'">'+ tab[0].title +'</span>';
  1076. for(; ii < len; ii++){
  1077. str += '<span>'+ tab[ii].title +'</span>';
  1078. }
  1079. }
  1080. return str;
  1081. }(),
  1082. content: '<ul class="layui-layer-tabmain">'+ function(){
  1083. var len = tab.length, ii = 1, str = '';
  1084. if(len > 0){
  1085. str = '<li class="layui-layer-tabli '+ THIS +'">'+ (tab[0].content || 'no content') +'</li>';
  1086. for(; ii < len; ii++){
  1087. str += '<li class="layui-layer-tabli">'+ (tab[ii].content || 'no content') +'</li>';
  1088. }
  1089. }
  1090. return str;
  1091. }() +'</ul>',
  1092. success: function(layero){
  1093. var btn = layero.find('.layui-layer-title').children();
  1094. var main = layero.find('.layui-layer-tabmain').children();
  1095. btn.on('mousedown', function(e){
  1096. e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true;
  1097. var othis = $(this), index = othis.index();
  1098. othis.addClass(THIS).siblings().removeClass(THIS);
  1099. main.eq(index).show().siblings().hide();
  1100. typeof options.change === 'function' && options.change(index);
  1101. });
  1102. typeof success === 'function' && success(layero);
  1103. }
  1104. }, options));
  1105. };
  1106. //相册层
  1107. layer.photos = function(options, loop, key){
  1108. var dict = {};
  1109. options = options || {};
  1110. if(!options.photos) return;
  1111. var type = options.photos.constructor === Object;
  1112. var photos = type ? options.photos : {}, data = photos.data || [];
  1113. var start = photos.start || 0;
  1114. dict.imgIndex = (start|0) + 1;
  1115. options.img = options.img || 'img';
  1116. var success = options.success;
  1117. delete options.success;
  1118. if(!type){ //页面直接获取
  1119. var parent = $(options.photos), pushData = function(){
  1120. data = [];
  1121. parent.find(options.img).each(function(index){
  1122. var othis = $(this);
  1123. othis.attr('layer-index', index);
  1124. data.push({
  1125. alt: othis.attr('alt'),
  1126. pid: othis.attr('layer-pid'),
  1127. src: othis.attr('layer-src') || othis.attr('src'),
  1128. thumb: othis.attr('src')
  1129. });
  1130. })
  1131. };
  1132. pushData();
  1133. if (data.length === 0) return;
  1134. loop || parent.on('click', options.img, function(){
  1135. var othis = $(this), index = othis.attr('layer-index');
  1136. layer.photos($.extend(options, {
  1137. photos: {
  1138. start: index,
  1139. data: data,
  1140. tab: options.tab
  1141. },
  1142. full: options.full
  1143. }), true);
  1144. pushData();
  1145. })
  1146. //不直接弹出
  1147. if(!loop) return;
  1148. } else if (data.length === 0){
  1149. return layer.msg('&#x6CA1;&#x6709;&#x56FE;&#x7247;');
  1150. }
  1151. //上一张
  1152. dict.imgprev = function(key){
  1153. dict.imgIndex--;
  1154. if(dict.imgIndex < 1){
  1155. dict.imgIndex = data.length;
  1156. }
  1157. dict.tabimg(key);
  1158. };
  1159. //下一张
  1160. dict.imgnext = function(key,errorMsg){
  1161. dict.imgIndex++;
  1162. if(dict.imgIndex > data.length){
  1163. dict.imgIndex = 1;
  1164. if (errorMsg) {return};
  1165. }
  1166. dict.tabimg(key)
  1167. };
  1168. //方向键
  1169. dict.keyup = function(event){
  1170. if(!dict.end){
  1171. var code = event.keyCode;
  1172. event.preventDefault();
  1173. if(code === 37){
  1174. dict.imgprev(true);
  1175. } else if(code === 39) {
  1176. dict.imgnext(true);
  1177. } else if(code === 27) {
  1178. layer.close(dict.index);
  1179. }
  1180. }
  1181. }
  1182. //切换
  1183. dict.tabimg = function(key){
  1184. if(data.length <= 1) return;
  1185. photos.start = dict.imgIndex - 1;
  1186. layer.close(dict.index);
  1187. return layer.photos(options, true, key);
  1188. setTimeout(function(){
  1189. layer.photos(options, true, key);
  1190. }, 200);
  1191. }
  1192. //一些动作
  1193. dict.event = function(){
  1194. dict.bigimg.hover(function(){
  1195. dict.imgsee.show();
  1196. }, function(){
  1197. dict.imgsee.hide();
  1198. });
  1199. dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){
  1200. event.preventDefault();
  1201. dict.imgprev();
  1202. });
  1203. dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){
  1204. event.preventDefault();
  1205. dict.imgnext();
  1206. });
  1207. $(document).on('keyup', dict.keyup);
  1208. };
  1209. //图片预加载
  1210. function loadImage(url, callback, error) {
  1211. var img = new Image();
  1212. img.src = url;
  1213. if(img.complete){
  1214. return callback(img);
  1215. }
  1216. img.onload = function(){
  1217. img.onload = null;
  1218. callback(img);
  1219. };
  1220. img.onerror = function(e){
  1221. img.onerror = null;
  1222. error(e);
  1223. };
  1224. };
  1225. dict.loadi = layer.load(1, {
  1226. shade: 'shade' in options ? false : 0.9,
  1227. scrollbar: false
  1228. });
  1229. loadImage(data[start].src, function(img){
  1230. layer.close(dict.loadi);
  1231. dict.index = layer.open($.extend({
  1232. type: 1,
  1233. id: 'layui-layer-photos',
  1234. area: function(){
  1235. var imgarea = [img.width, img.height];
  1236. var winarea = [$(window).width() - 100, $(window).height() - 100];
  1237. //如果 实际图片的宽或者高比 屏幕大(那么进行缩放)
  1238. if(!options.full && (imgarea[0]>winarea[0]||imgarea[1]>winarea[1])){
  1239. var wh = [imgarea[0]/winarea[0],imgarea[1]/winarea[1]];//取宽度缩放比例、高度缩放比例
  1240. if(wh[0] > wh[1]){//取缩放比例最大的进行缩放
  1241. imgarea[0] = imgarea[0]/wh[0];
  1242. imgarea[1] = imgarea[1]/wh[0];
  1243. } else if(wh[0] < wh[1]){
  1244. imgarea[0] = imgarea[0]/wh[1];
  1245. imgarea[1] = imgarea[1]/wh[1];
  1246. }
  1247. }
  1248. return [imgarea[0]+'px', imgarea[1]+'px'];
  1249. }(),
  1250. title: false,
  1251. shade: 0.9,
  1252. shadeClose: true,
  1253. closeBtn: false,
  1254. move: '.layui-layer-phimg img',
  1255. moveType: 1,
  1256. scrollbar: false,
  1257. moveOut: true,
  1258. //anim: Math.random()*5|0,
  1259. isOutAnim: false,
  1260. skin: 'layui-layer-photos' + skin('photos'),
  1261. content: '<div class="layui-layer-phimg">'
  1262. +'<img src="'+ data[start].src +'" alt="'+ (data[start].alt||'') +'" layer-pid="'+ data[start].pid +'">'
  1263. +'<div class="layui-layer-imgsee">'
  1264. +(data.length > 1 ? '<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>' : '')
  1265. +'<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><a href="javascript:;">'+ (data[start].alt||'') +'</a><em>'+ dict.imgIndex +'/'+ data.length +'</em></span></div>'
  1266. +'</div>'
  1267. +'</div>',
  1268. success: function(layero, index){
  1269. dict.bigimg = layero.find('.layui-layer-phimg');
  1270. dict.imgsee = layero.find('.layui-layer-imguide,.layui-layer-imgbar');
  1271. dict.event(layero);
  1272. options.tab && options.tab(data[start], layero);
  1273. typeof success === 'function' && success(layero);
  1274. }, end: function(){
  1275. dict.end = true;
  1276. $(document).off('keyup', dict.keyup);
  1277. }
  1278. }, options));
  1279. }, function(){
  1280. layer.close(dict.loadi);
  1281. layer.msg('&#x5F53;&#x524D;&#x56FE;&#x7247;&#x5730;&#x5740;&#x5F02;&#x5E38;<br>&#x662F;&#x5426;&#x7EE7;&#x7EED;&#x67E5;&#x770B;&#x4E0B;&#x4E00;&#x5F20;&#xFF1F;', {
  1282. time: 30000,
  1283. btn: ['&#x4E0B;&#x4E00;&#x5F20;', '&#x4E0D;&#x770B;&#x4E86;'],
  1284. yes: function(){
  1285. data.length > 1 && dict.imgnext(true,true);
  1286. }
  1287. });
  1288. });
  1289. };
  1290. //主入口
  1291. ready.run = function(_$){
  1292. $ = _$;
  1293. win = $(window);
  1294. doms.html = $('html');
  1295. layer.open = function(deliver){
  1296. var o = new Class(deliver);
  1297. return o.index;
  1298. };
  1299. };
  1300. //加载方式
  1301. window.layui && layui.define ? (
  1302. layer.ready()
  1303. ,layui.define('jquery', function(exports){ //layui加载
  1304. layer.path = layui.cache.dir;
  1305. ready.run(layui.$);
  1306. //暴露模块
  1307. window.layer = layer;
  1308. exports('layer', layer);
  1309. })
  1310. ) : (
  1311. (typeof define === 'function' && define.amd) ? define('layer',['jquery'], function(){ //requirejs加载
  1312. ready.run(window.jQuery);
  1313. return layer;
  1314. }) : function(){ //普通script标签加载
  1315. ready.run(window.jQuery);
  1316. layer.ready();
  1317. }()
  1318. );
  1319. }(window);
  1320. /*
  1321. * Toastr
  1322. * Copyright 2012-2015
  1323. * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
  1324. * All Rights Reserved.
  1325. * Use, reproduction, distribution, and modification of this code is subject to the terms and
  1326. * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
  1327. *
  1328. * ARIA Support: Greta Krafsig
  1329. *
  1330. * Project: https://github.com/CodeSeven/toastr
  1331. */
  1332. /* global define */
  1333. (function (define) {
  1334. define('toastr',['jquery'], function ($) {
  1335. return (function () {
  1336. var $container;
  1337. var listener;
  1338. var toastId = 0;
  1339. var toastType = {
  1340. error: 'error',
  1341. info: 'info',
  1342. success: 'success',
  1343. warning: 'warning'
  1344. };
  1345. var toastr = {
  1346. clear: clear,
  1347. remove: remove,
  1348. error: error,
  1349. getContainer: getContainer,
  1350. info: info,
  1351. options: {},
  1352. subscribe: subscribe,
  1353. success: success,
  1354. version: '2.1.3',
  1355. warning: warning
  1356. };
  1357. var previousToast;
  1358. return toastr;
  1359. ////////////////
  1360. function error(message, title, optionsOverride) {
  1361. return notify({
  1362. type: toastType.error,
  1363. iconClass: getOptions().iconClasses.error,
  1364. message: message,
  1365. optionsOverride: optionsOverride,
  1366. title: title
  1367. });
  1368. }
  1369. function getContainer(options, create) {
  1370. if (!options) { options = getOptions(); }
  1371. $container = $('#' + options.containerId);
  1372. if ($container.length) {
  1373. return $container;
  1374. }
  1375. if (create) {
  1376. $container = createContainer(options);
  1377. }
  1378. return $container;
  1379. }
  1380. function info(message, title, optionsOverride) {
  1381. return notify({
  1382. type: toastType.info,
  1383. iconClass: getOptions().iconClasses.info,
  1384. message: message,
  1385. optionsOverride: optionsOverride,
  1386. title: title
  1387. });
  1388. }
  1389. function subscribe(callback) {
  1390. listener = callback;
  1391. }
  1392. function success(message, title, optionsOverride) {
  1393. return notify({
  1394. type: toastType.success,
  1395. iconClass: getOptions().iconClasses.success,
  1396. message: message,
  1397. optionsOverride: optionsOverride,
  1398. title: title
  1399. });
  1400. }
  1401. function warning(message, title, optionsOverride) {
  1402. return notify({
  1403. type: toastType.warning,
  1404. iconClass: getOptions().iconClasses.warning,
  1405. message: message,
  1406. optionsOverride: optionsOverride,
  1407. title: title
  1408. });
  1409. }
  1410. function clear($toastElement, clearOptions) {
  1411. var options = getOptions();
  1412. if (!$container) { getContainer(options); }
  1413. if (!clearToast($toastElement, options, clearOptions)) {
  1414. clearContainer(options);
  1415. }
  1416. }
  1417. function remove($toastElement) {
  1418. var options = getOptions();
  1419. if (!$container) { getContainer(options); }
  1420. if ($toastElement && $(':focus', $toastElement).length === 0) {
  1421. removeToast($toastElement);
  1422. return;
  1423. }
  1424. if ($container.children().length) {
  1425. $container.remove();
  1426. }
  1427. }
  1428. // internal functions
  1429. function clearContainer (options) {
  1430. var toastsToClear = $container.children();
  1431. for (var i = toastsToClear.length - 1; i >= 0; i--) {
  1432. clearToast($(toastsToClear[i]), options);
  1433. }
  1434. }
  1435. function clearToast ($toastElement, options, clearOptions) {
  1436. var force = clearOptions && clearOptions.force ? clearOptions.force : false;
  1437. if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
  1438. $toastElement[options.hideMethod]({
  1439. duration: options.hideDuration,
  1440. easing: options.hideEasing,
  1441. complete: function () { removeToast($toastElement); }
  1442. });
  1443. return true;
  1444. }
  1445. return false;
  1446. }
  1447. function createContainer(options) {
  1448. $container = $('<div/>')
  1449. .attr('id', options.containerId)
  1450. .addClass(options.positionClass);
  1451. $container.appendTo($(options.target));
  1452. return $container;
  1453. }
  1454. function getDefaults() {
  1455. return {
  1456. tapToDismiss: true,
  1457. toastClass: 'toast',
  1458. containerId: 'toast-container',
  1459. debug: false,
  1460. showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
  1461. showDuration: 300,
  1462. showEasing: 'swing', //swing and linear are built into jQuery
  1463. onShown: undefined,
  1464. hideMethod: 'fadeOut',
  1465. hideDuration: 1000,
  1466. hideEasing: 'swing',
  1467. onHidden: undefined,
  1468. closeMethod: false,
  1469. closeDuration: false,
  1470. closeEasing: false,
  1471. closeOnHover: true,
  1472. extendedTimeOut: 1000,
  1473. iconClasses: {
  1474. error: 'toast-error',
  1475. info: 'toast-info',
  1476. success: 'toast-success',
  1477. warning: 'toast-warning'
  1478. },
  1479. iconClass: 'toast-info',
  1480. positionClass: 'toast-top-right',
  1481. timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
  1482. titleClass: 'toast-title',
  1483. messageClass: 'toast-message',
  1484. escapeHtml: false,
  1485. target: 'body',
  1486. closeHtml: '<button type="button">&times;</button>',
  1487. closeClass: 'toast-close-button',
  1488. newestOnTop: true,
  1489. preventDuplicates: false,
  1490. progressBar: false,
  1491. progressClass: 'toast-progress',
  1492. rtl: false
  1493. };
  1494. }
  1495. function publish(args) {
  1496. if (!listener) { return; }
  1497. listener(args);
  1498. }
  1499. function notify(map) {
  1500. var options = getOptions();
  1501. var iconClass = map.iconClass || options.iconClass;
  1502. if (typeof (map.optionsOverride) !== 'undefined') {
  1503. options = $.extend(options, map.optionsOverride);
  1504. iconClass = map.optionsOverride.iconClass || iconClass;
  1505. }
  1506. if (shouldExit(options, map)) { return; }
  1507. toastId++;
  1508. $container = getContainer(options, true);
  1509. var intervalId = null;
  1510. var $toastElement = $('<div/>');
  1511. var $titleElement = $('<div/>');
  1512. var $messageElement = $('<div/>');
  1513. var $progressElement = $('<div/>');
  1514. var $closeElement = $(options.closeHtml);
  1515. var progressBar = {
  1516. intervalId: null,
  1517. hideEta: null,
  1518. maxHideTime: null
  1519. };
  1520. var response = {
  1521. toastId: toastId,
  1522. state: 'visible',
  1523. startTime: new Date(),
  1524. options: options,
  1525. map: map
  1526. };
  1527. personalizeToast();
  1528. displayToast();
  1529. handleEvents();
  1530. publish(response);
  1531. if (options.debug && console) {
  1532. console.log(response);
  1533. }
  1534. return $toastElement;
  1535. function escapeHtml(source) {
  1536. if (source == null) {
  1537. source = '';
  1538. }
  1539. return source
  1540. .replace(/&/g, '&amp;')
  1541. .replace(/"/g, '&quot;')
  1542. .replace(/'/g, '&#39;')
  1543. .replace(/</g, '&lt;')
  1544. .replace(/>/g, '&gt;');
  1545. }
  1546. function personalizeToast() {
  1547. setIcon();
  1548. setTitle();
  1549. setMessage();
  1550. setCloseButton();
  1551. setProgressBar();
  1552. setRTL();
  1553. setSequence();
  1554. setAria();
  1555. }
  1556. function setAria() {
  1557. var ariaValue = '';
  1558. switch (map.iconClass) {
  1559. case 'toast-success':
  1560. case 'toast-info':
  1561. ariaValue = 'polite';
  1562. break;
  1563. default:
  1564. ariaValue = 'assertive';
  1565. }
  1566. $toastElement.attr('aria-live', ariaValue);
  1567. }
  1568. function handleEvents() {
  1569. if (options.closeOnHover) {
  1570. $toastElement.hover(stickAround, delayedHideToast);
  1571. }
  1572. if (!options.onclick && options.tapToDismiss) {
  1573. $toastElement.click(hideToast);
  1574. }
  1575. if (options.closeButton && $closeElement) {
  1576. $closeElement.click(function (event) {
  1577. if (event.stopPropagation) {
  1578. event.stopPropagation();
  1579. } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
  1580. event.cancelBubble = true;
  1581. }
  1582. if (options.onCloseClick) {
  1583. options.onCloseClick(event);
  1584. }
  1585. hideToast(true);
  1586. });
  1587. }
  1588. if (options.onclick) {
  1589. $toastElement.click(function (event) {
  1590. options.onclick(event);
  1591. hideToast();
  1592. });
  1593. }
  1594. }
  1595. function displayToast() {
  1596. $toastElement.hide();
  1597. $toastElement[options.showMethod](
  1598. {duration: options.showDuration, easing: options.showEasing, complete: options.onShown}
  1599. );
  1600. if (options.timeOut > 0) {
  1601. intervalId = setTimeout(hideToast, options.timeOut);
  1602. progressBar.maxHideTime = parseFloat(options.timeOut);
  1603. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  1604. if (options.progressBar) {
  1605. progressBar.intervalId = setInterval(updateProgress, 10);
  1606. }
  1607. }
  1608. }
  1609. function setIcon() {
  1610. if (map.iconClass) {
  1611. $toastElement.addClass(options.toastClass).addClass(iconClass);
  1612. }
  1613. }
  1614. function setSequence() {
  1615. if (options.newestOnTop) {
  1616. $container.prepend($toastElement);
  1617. } else {
  1618. $container.append($toastElement);
  1619. }
  1620. }
  1621. function setTitle() {
  1622. if (map.title) {
  1623. var suffix = map.title;
  1624. if (options.escapeHtml) {
  1625. suffix = escapeHtml(map.title);
  1626. }
  1627. $titleElement.append(suffix).addClass(options.titleClass);
  1628. $toastElement.append($titleElement);
  1629. }
  1630. }
  1631. function setMessage() {
  1632. if (map.message) {
  1633. var suffix = map.message;
  1634. if (options.escapeHtml) {
  1635. suffix = escapeHtml(map.message);
  1636. }
  1637. $messageElement.append(suffix).addClass(options.messageClass);
  1638. $toastElement.append($messageElement);
  1639. }
  1640. }
  1641. function setCloseButton() {
  1642. if (options.closeButton) {
  1643. $closeElement.addClass(options.closeClass).attr('role', 'button');
  1644. $toastElement.prepend($closeElement);
  1645. }
  1646. }
  1647. function setProgressBar() {
  1648. if (options.progressBar) {
  1649. $progressElement.addClass(options.progressClass);
  1650. $toastElement.prepend($progressElement);
  1651. }
  1652. }
  1653. function setRTL() {
  1654. if (options.rtl) {
  1655. $toastElement.addClass('rtl');
  1656. }
  1657. }
  1658. function shouldExit(options, map) {
  1659. if (options.preventDuplicates) {
  1660. if (map.message === previousToast) {
  1661. return true;
  1662. } else {
  1663. previousToast = map.message;
  1664. }
  1665. }
  1666. return false;
  1667. }
  1668. function hideToast(override) {
  1669. var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
  1670. var duration = override && options.closeDuration !== false ?
  1671. options.closeDuration : options.hideDuration;
  1672. var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
  1673. if ($(':focus', $toastElement).length && !override) {
  1674. return;
  1675. }
  1676. clearTimeout(progressBar.intervalId);
  1677. return $toastElement[method]({
  1678. duration: duration,
  1679. easing: easing,
  1680. complete: function () {
  1681. removeToast($toastElement);
  1682. clearTimeout(intervalId);
  1683. if (options.onHidden && response.state !== 'hidden') {
  1684. options.onHidden();
  1685. }
  1686. response.state = 'hidden';
  1687. response.endTime = new Date();
  1688. publish(response);
  1689. }
  1690. });
  1691. }
  1692. function delayedHideToast() {
  1693. if (options.timeOut > 0 || options.extendedTimeOut > 0) {
  1694. intervalId = setTimeout(hideToast, options.extendedTimeOut);
  1695. progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
  1696. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  1697. }
  1698. }
  1699. function stickAround() {
  1700. clearTimeout(intervalId);
  1701. progressBar.hideEta = 0;
  1702. $toastElement.stop(true, true)[options.showMethod](
  1703. {duration: options.showDuration, easing: options.showEasing}
  1704. );
  1705. }
  1706. function updateProgress() {
  1707. var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
  1708. $progressElement.width(percentage + '%');
  1709. }
  1710. }
  1711. function getOptions() {
  1712. return $.extend({}, getDefaults(), toastr.options);
  1713. }
  1714. function removeToast($toastElement) {
  1715. if (!$container) { $container = getContainer(); }
  1716. if ($toastElement.is(':visible')) {
  1717. return;
  1718. }
  1719. $toastElement.remove();
  1720. $toastElement = null;
  1721. if ($container.children().length === 0) {
  1722. $container.remove();
  1723. previousToast = undefined;
  1724. }
  1725. }
  1726. })();
  1727. });
  1728. }(typeof define === 'function' && define.amd ? define : function (deps, factory) {
  1729. if (typeof module !== 'undefined' && module.exports) { //Node
  1730. module.exports = factory(require('jquery'));
  1731. } else {
  1732. window.toastr = factory(window.jQuery);
  1733. }
  1734. }));
  1735. define('fast',['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefined, Toastr, Layer, Lang) {
  1736. var Fast = {
  1737. config: {
  1738. //toastr默认配置
  1739. toastr: {
  1740. "closeButton": true,
  1741. "debug": false,
  1742. "newestOnTop": false,
  1743. "progressBar": false,
  1744. "positionClass": "toast-top-center",
  1745. "preventDuplicates": false,
  1746. "onclick": null,
  1747. "showDuration": "300",
  1748. "hideDuration": "1000",
  1749. "timeOut": "5000",
  1750. "extendedTimeOut": "1000",
  1751. "showEasing": "swing",
  1752. "hideEasing": "linear",
  1753. "showMethod": "fadeIn",
  1754. "hideMethod": "fadeOut"
  1755. }
  1756. },
  1757. events: {
  1758. //请求成功的回调
  1759. onAjaxSuccess: function (ret, onAjaxSuccess) {
  1760. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  1761. var msg = typeof ret.msg !== 'undefined' && ret.msg ? ret.msg : __('Operation completed');
  1762. if (typeof onAjaxSuccess === 'function') {
  1763. var result = onAjaxSuccess.call(this, data, ret);
  1764. if (result === false)
  1765. return;
  1766. }
  1767. Toastr.success(msg);
  1768. },
  1769. //请求错误的回调
  1770. onAjaxError: function (ret, onAjaxError) {
  1771. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  1772. if (typeof onAjaxError === 'function') {
  1773. var result = onAjaxError.call(this, data, ret);
  1774. if (result === false) {
  1775. return;
  1776. }
  1777. }
  1778. Toastr.error(ret.msg + "(code:" + ret.code + ")");
  1779. },
  1780. //服务器响应数据后
  1781. onAjaxResponse: function (response) {
  1782. try {
  1783. var ret = typeof response === 'object' ? response : JSON.parse(response);
  1784. if (!ret.hasOwnProperty('code')) {
  1785. $.extend(ret, {code: -2, msg: response, data: null});
  1786. }
  1787. } catch (e) {
  1788. var ret = {code: -1, msg: e.message, data: null};
  1789. }
  1790. return ret;
  1791. }
  1792. },
  1793. api: {
  1794. //发送Ajax请求
  1795. ajax: function (options, success, error) {
  1796. options = typeof options === 'string' ? {url: options} : options;
  1797. var index = Layer.load();
  1798. options = $.extend({
  1799. type: "POST",
  1800. dataType: "json",
  1801. success: function (ret) {
  1802. Layer.close(index);
  1803. ret = Fast.events.onAjaxResponse(ret);
  1804. if (ret.code === 1) {
  1805. Fast.events.onAjaxSuccess(ret, success);
  1806. } else {
  1807. Fast.events.onAjaxError(ret, error);
  1808. }
  1809. },
  1810. error: function (xhr) {
  1811. Layer.close(index);
  1812. var ret = {code: xhr.status, msg: xhr.statusText, data: null};
  1813. Fast.events.onAjaxError(ret, error);
  1814. }
  1815. }, options);
  1816. $.ajax(options);
  1817. },
  1818. //修复URL
  1819. fixurl: function (url) {
  1820. if (url.substr(0, 1) !== "/") {
  1821. var r = new RegExp('^(?:[a-z]+:)?//', 'i');
  1822. if (!r.test(url)) {
  1823. url = Config.moduleurl + "/" + url;
  1824. }
  1825. }
  1826. return url;
  1827. },
  1828. //获取修复后可访问的cdn链接
  1829. cdnurl: function (url) {
  1830. return /^(?:[a-z]+:)?\/\//i.test(url) ? url : Config.upload.cdnurl + url;
  1831. },
  1832. //查询Url参数
  1833. query: function (name, url) {
  1834. if (!url) {
  1835. url = window.location.href;
  1836. }
  1837. name = name.replace(/[\[\]]/g, "\\$&");
  1838. var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
  1839. results = regex.exec(url);
  1840. if (!results)
  1841. return null;
  1842. if (!results[2])
  1843. return '';
  1844. return decodeURIComponent(results[2].replace(/\+/g, " "));
  1845. },
  1846. //打开一个弹出窗口
  1847. open: function (url, title, options) {
  1848. title = title ? title : "";
  1849. url = Fast.api.fixurl(url);
  1850. url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1";
  1851. var area = [$(window).width() > 800 ? '800px' : '95%', $(window).height() > 600 ? '600px' : '95%'];
  1852. options = $.extend({
  1853. type: 2,
  1854. title: title,
  1855. shadeClose: true,
  1856. shade: false,
  1857. maxmin: true,
  1858. moveOut: true,
  1859. area: area,
  1860. content: url,
  1861. zIndex: Layer.zIndex,
  1862. success: function (layero, index) {
  1863. var that = this;
  1864. //存储callback事件
  1865. $(layero).data("callback", that.callback);
  1866. //$(layero).removeClass("layui-layer-border");
  1867. Layer.setTop(layero);
  1868. var frame = Layer.getChildFrame('html', index);
  1869. var layerfooter = frame.find(".layer-footer");
  1870. Fast.api.layerfooter(layero, index, that);
  1871. //绑定事件
  1872. if (layerfooter.size() > 0) {
  1873. // 监听窗口内的元素及属性变化
  1874. // Firefox和Chrome早期版本中带有前缀
  1875. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver
  1876. // 选择目标节点
  1877. var target = layerfooter[0];
  1878. // 创建观察者对象
  1879. var observer = new MutationObserver(function (mutations) {
  1880. Fast.api.layerfooter(layero, index, that);
  1881. mutations.forEach(function (mutation) {
  1882. });
  1883. });
  1884. // 配置观察选项:
  1885. var config = {attributes: true, childList: true, characterData: true, subtree: true}
  1886. // 传入目标节点和观察选项
  1887. observer.observe(target, config);
  1888. // 随后,你还可以停止观察
  1889. // observer.disconnect();
  1890. }
  1891. }
  1892. }, options ? options : {});
  1893. if ($(window).width() < 480 || (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream && top.$(".tab-pane.active").size() > 0)) {
  1894. options.area = [top.$(".tab-pane.active").width() + "px", top.$(".tab-pane.active").height() + "px"];
  1895. options.offset = [top.$(".tab-pane.active").scrollTop() + "px", "0px"];
  1896. }
  1897. Layer.open(options);
  1898. return false;
  1899. },
  1900. //关闭窗口并回传数据
  1901. close: function (data) {
  1902. var index = parent.Layer.getFrameIndex(window.name);
  1903. var callback = parent.$("#layui-layer" + index).data("callback");
  1904. //再执行关闭
  1905. parent.Layer.close(index);
  1906. //再调用回传函数
  1907. if (typeof callback === 'function') {
  1908. callback.call(undefined, data);
  1909. }
  1910. },
  1911. layerfooter: function (layero, index, that) {
  1912. var frame = Layer.getChildFrame('html', index);
  1913. var layerfooter = frame.find(".layer-footer");
  1914. if (layerfooter.size() > 0) {
  1915. $(".layui-layer-footer", layero).remove();
  1916. var footer = $("<div />").addClass('layui-layer-btn layui-layer-footer');
  1917. footer.html(layerfooter.html());
  1918. if ($(".row", footer).size() === 0) {
  1919. $(">", footer).wrapAll("<div class='row'></div>");
  1920. }
  1921. footer.insertAfter(layero.find('.layui-layer-content'));
  1922. //绑定事件
  1923. footer.on("click", ".btn", function () {
  1924. if ($(this).hasClass("disabled") || $(this).parent().hasClass("disabled")) {
  1925. return;
  1926. }
  1927. $(".btn:eq(" + $(this).index() + ")", layerfooter).trigger("click");
  1928. });
  1929. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  1930. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  1931. //重设iframe高度
  1932. $("iframe", layero).height(layero.height() - titHeight - btnHeight);
  1933. }
  1934. //修复iOS下弹出窗口的高度和iOS下iframe无法滚动的BUG
  1935. if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
  1936. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  1937. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  1938. $("iframe", layero).parent().css("height", layero.height() - titHeight - btnHeight);
  1939. $("iframe", layero).css("height", "100%");
  1940. }
  1941. },
  1942. success: function (options, callback) {
  1943. var type = typeof options === 'function';
  1944. if (type) {
  1945. callback = options;
  1946. }
  1947. return Layer.msg(__('Operation completed'), $.extend({
  1948. offset: 0, icon: 1
  1949. }, type ? {} : options), callback);
  1950. },
  1951. error: function (options, callback) {
  1952. var type = typeof options === 'function';
  1953. if (type) {
  1954. callback = options;
  1955. }
  1956. return Layer.msg(__('Operation failed'), $.extend({
  1957. offset: 0, icon: 2
  1958. }, type ? {} : options), callback);
  1959. },
  1960. toastr: Toastr,
  1961. layer: Layer
  1962. },
  1963. lang: function () {
  1964. var args = arguments,
  1965. string = args[0],
  1966. i = 1;
  1967. string = string.toLowerCase();
  1968. //string = typeof Lang[string] != 'undefined' ? Lang[string] : string;
  1969. if (typeof Lang[string] != 'undefined') {
  1970. if (typeof Lang[string] == 'object')
  1971. return Lang[string];
  1972. string = Lang[string];
  1973. } else if (string.indexOf('.') !== -1 && false) {
  1974. var arr = string.split('.');
  1975. var current = Lang[arr[0]];
  1976. for (var i = 1; i < arr.length; i++) {
  1977. current = typeof current[arr[i]] != 'undefined' ? current[arr[i]] : '';
  1978. if (typeof current != 'object')
  1979. break;
  1980. }
  1981. if (typeof current == 'object')
  1982. return current;
  1983. string = current;
  1984. } else {
  1985. string = args[0];
  1986. }
  1987. return string.replace(/%((%)|s|d)/g, function (m) {
  1988. // m is the matched format, e.g. %s, %d
  1989. var val = null;
  1990. if (m[2]) {
  1991. val = m[2];
  1992. } else {
  1993. val = args[i];
  1994. // A switch statement so that the formatter can be extended. Default is %s
  1995. switch (m) {
  1996. case '%d':
  1997. val = parseFloat(val);
  1998. if (isNaN(val)) {
  1999. val = 0;
  2000. }
  2001. break;
  2002. }
  2003. i++;
  2004. }
  2005. return val;
  2006. });
  2007. },
  2008. init: function () {
  2009. // 对相对地址进行处理
  2010. $.ajaxSetup({
  2011. beforeSend: function (xhr, setting) {
  2012. setting.url = Fast.api.fixurl(setting.url);
  2013. }
  2014. });
  2015. Layer.config({
  2016. skin: 'layui-layer-fast'
  2017. });
  2018. // 绑定ESC关闭窗口事件
  2019. $(window).keyup(function (e) {
  2020. if (e.keyCode == 27) {
  2021. if ($(".layui-layer").size() > 0) {
  2022. var index = 0;
  2023. $(".layui-layer").each(function () {
  2024. index = Math.max(index, parseInt($(this).attr("times")));
  2025. });
  2026. if (index) {
  2027. Layer.close(index);
  2028. }
  2029. }
  2030. }
  2031. });
  2032. //公共代码
  2033. //配置Toastr的参数
  2034. Toastr.options = Fast.config.toastr;
  2035. }
  2036. };
  2037. //将Layer暴露到全局中去
  2038. window.Layer = Layer;
  2039. //将Toastr暴露到全局中去
  2040. window.Toastr = Toastr;
  2041. //将语言方法暴露到全局中去
  2042. window.__ = Fast.lang;
  2043. //将Fast渲染至全局
  2044. window.Fast = Fast;
  2045. //默认初始化执行的代码
  2046. Fast.init();
  2047. return Fast;
  2048. });
  2049. //! moment.js
  2050. //! version : 2.19.3
  2051. //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
  2052. //! license : MIT
  2053. //! momentjs.com
  2054. ;(function (global, factory) {
  2055. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  2056. typeof define === 'function' && define.amd ? define('moment/moment',factory) :
  2057. global.moment = factory()
  2058. }(this, (function () { 'use strict';
  2059. var hookCallback;
  2060. function hooks () {
  2061. return hookCallback.apply(null, arguments);
  2062. }
  2063. // This is done to register the method called with moment()
  2064. // without creating circular dependencies.
  2065. function setHookCallback (callback) {
  2066. hookCallback = callback;
  2067. }
  2068. function isArray(input) {
  2069. return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';
  2070. }
  2071. function isObject(input) {
  2072. // IE8 will treat undefined and null as object if it wasn't for
  2073. // input != null
  2074. return input != null && Object.prototype.toString.call(input) === '[object Object]';
  2075. }
  2076. function isObjectEmpty(obj) {
  2077. if (Object.getOwnPropertyNames) {
  2078. return (Object.getOwnPropertyNames(obj).length === 0);
  2079. } else {
  2080. var k;
  2081. for (k in obj) {
  2082. if (obj.hasOwnProperty(k)) {
  2083. return false;
  2084. }
  2085. }
  2086. return true;
  2087. }
  2088. }
  2089. function isUndefined(input) {
  2090. return input === void 0;
  2091. }
  2092. function isNumber(input) {
  2093. return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]';
  2094. }
  2095. function isDate(input) {
  2096. return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
  2097. }
  2098. function map(arr, fn) {
  2099. var res = [], i;
  2100. for (i = 0; i < arr.length; ++i) {
  2101. res.push(fn(arr[i], i));
  2102. }
  2103. return res;
  2104. }
  2105. function hasOwnProp(a, b) {
  2106. return Object.prototype.hasOwnProperty.call(a, b);
  2107. }
  2108. function extend(a, b) {
  2109. for (var i in b) {
  2110. if (hasOwnProp(b, i)) {
  2111. a[i] = b[i];
  2112. }
  2113. }
  2114. if (hasOwnProp(b, 'toString')) {
  2115. a.toString = b.toString;
  2116. }
  2117. if (hasOwnProp(b, 'valueOf')) {
  2118. a.valueOf = b.valueOf;
  2119. }
  2120. return a;
  2121. }
  2122. function createUTC (input, format, locale, strict) {
  2123. return createLocalOrUTC(input, format, locale, strict, true).utc();
  2124. }
  2125. function defaultParsingFlags() {
  2126. // We need to deep clone this object.
  2127. return {
  2128. empty : false,
  2129. unusedTokens : [],
  2130. unusedInput : [],
  2131. overflow : -2,
  2132. charsLeftOver : 0,
  2133. nullInput : false,
  2134. invalidMonth : null,
  2135. invalidFormat : false,
  2136. userInvalidated : false,
  2137. iso : false,
  2138. parsedDateParts : [],
  2139. meridiem : null,
  2140. rfc2822 : false,
  2141. weekdayMismatch : false
  2142. };
  2143. }
  2144. function getParsingFlags(m) {
  2145. if (m._pf == null) {
  2146. m._pf = defaultParsingFlags();
  2147. }
  2148. return m._pf;
  2149. }
  2150. var some;
  2151. if (Array.prototype.some) {
  2152. some = Array.prototype.some;
  2153. } else {
  2154. some = function (fun) {
  2155. var t = Object(this);
  2156. var len = t.length >>> 0;
  2157. for (var i = 0; i < len; i++) {
  2158. if (i in t && fun.call(this, t[i], i, t)) {
  2159. return true;
  2160. }
  2161. }
  2162. return false;
  2163. };
  2164. }
  2165. function isValid(m) {
  2166. if (m._isValid == null) {
  2167. var flags = getParsingFlags(m);
  2168. var parsedParts = some.call(flags.parsedDateParts, function (i) {
  2169. return i != null;
  2170. });
  2171. var isNowValid = !isNaN(m._d.getTime()) &&
  2172. flags.overflow < 0 &&
  2173. !flags.empty &&
  2174. !flags.invalidMonth &&
  2175. !flags.invalidWeekday &&
  2176. !flags.weekdayMismatch &&
  2177. !flags.nullInput &&
  2178. !flags.invalidFormat &&
  2179. !flags.userInvalidated &&
  2180. (!flags.meridiem || (flags.meridiem && parsedParts));
  2181. if (m._strict) {
  2182. isNowValid = isNowValid &&
  2183. flags.charsLeftOver === 0 &&
  2184. flags.unusedTokens.length === 0 &&
  2185. flags.bigHour === undefined;
  2186. }
  2187. if (Object.isFrozen == null || !Object.isFrozen(m)) {
  2188. m._isValid = isNowValid;
  2189. }
  2190. else {
  2191. return isNowValid;
  2192. }
  2193. }
  2194. return m._isValid;
  2195. }
  2196. function createInvalid (flags) {
  2197. var m = createUTC(NaN);
  2198. if (flags != null) {
  2199. extend(getParsingFlags(m), flags);
  2200. }
  2201. else {
  2202. getParsingFlags(m).userInvalidated = true;
  2203. }
  2204. return m;
  2205. }
  2206. // Plugins that add properties should also add the key here (null value),
  2207. // so we can properly clone ourselves.
  2208. var momentProperties = hooks.momentProperties = [];
  2209. function copyConfig(to, from) {
  2210. var i, prop, val;
  2211. if (!isUndefined(from._isAMomentObject)) {
  2212. to._isAMomentObject = from._isAMomentObject;
  2213. }
  2214. if (!isUndefined(from._i)) {
  2215. to._i = from._i;
  2216. }
  2217. if (!isUndefined(from._f)) {
  2218. to._f = from._f;
  2219. }
  2220. if (!isUndefined(from._l)) {
  2221. to._l = from._l;
  2222. }
  2223. if (!isUndefined(from._strict)) {
  2224. to._strict = from._strict;
  2225. }
  2226. if (!isUndefined(from._tzm)) {
  2227. to._tzm = from._tzm;
  2228. }
  2229. if (!isUndefined(from._isUTC)) {
  2230. to._isUTC = from._isUTC;
  2231. }
  2232. if (!isUndefined(from._offset)) {
  2233. to._offset = from._offset;
  2234. }
  2235. if (!isUndefined(from._pf)) {
  2236. to._pf = getParsingFlags(from);
  2237. }
  2238. if (!isUndefined(from._locale)) {
  2239. to._locale = from._locale;
  2240. }
  2241. if (momentProperties.length > 0) {
  2242. for (i = 0; i < momentProperties.length; i++) {
  2243. prop = momentProperties[i];
  2244. val = from[prop];
  2245. if (!isUndefined(val)) {
  2246. to[prop] = val;
  2247. }
  2248. }
  2249. }
  2250. return to;
  2251. }
  2252. var updateInProgress = false;
  2253. // Moment prototype object
  2254. function Moment(config) {
  2255. copyConfig(this, config);
  2256. this._d = new Date(config._d != null ? config._d.getTime() : NaN);
  2257. if (!this.isValid()) {
  2258. this._d = new Date(NaN);
  2259. }
  2260. // Prevent infinite loop in case updateOffset creates new moment
  2261. // objects.
  2262. if (updateInProgress === false) {
  2263. updateInProgress = true;
  2264. hooks.updateOffset(this);
  2265. updateInProgress = false;
  2266. }
  2267. }
  2268. function isMoment (obj) {
  2269. return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
  2270. }
  2271. function absFloor (number) {
  2272. if (number < 0) {
  2273. // -0 -> 0
  2274. return Math.ceil(number) || 0;
  2275. } else {
  2276. return Math.floor(number);
  2277. }
  2278. }
  2279. function toInt(argumentForCoercion) {
  2280. var coercedNumber = +argumentForCoercion,
  2281. value = 0;
  2282. if (coercedNumber !== 0 && isFinite(coercedNumber)) {
  2283. value = absFloor(coercedNumber);
  2284. }
  2285. return value;
  2286. }
  2287. // compare two arrays, return the number of differences
  2288. function compareArrays(array1, array2, dontConvert) {
  2289. var len = Math.min(array1.length, array2.length),
  2290. lengthDiff = Math.abs(array1.length - array2.length),
  2291. diffs = 0,
  2292. i;
  2293. for (i = 0; i < len; i++) {
  2294. if ((dontConvert && array1[i] !== array2[i]) ||
  2295. (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
  2296. diffs++;
  2297. }
  2298. }
  2299. return diffs + lengthDiff;
  2300. }
  2301. function warn(msg) {
  2302. if (hooks.suppressDeprecationWarnings === false &&
  2303. (typeof console !== 'undefined') && console.warn) {
  2304. console.warn('Deprecation warning: ' + msg);
  2305. }
  2306. }
  2307. function deprecate(msg, fn) {
  2308. var firstTime = true;
  2309. return extend(function () {
  2310. if (hooks.deprecationHandler != null) {
  2311. hooks.deprecationHandler(null, msg);
  2312. }
  2313. if (firstTime) {
  2314. var args = [];
  2315. var arg;
  2316. for (var i = 0; i < arguments.length; i++) {
  2317. arg = '';
  2318. if (typeof arguments[i] === 'object') {
  2319. arg += '\n[' + i + '] ';
  2320. for (var key in arguments[0]) {
  2321. arg += key + ': ' + arguments[0][key] + ', ';
  2322. }
  2323. arg = arg.slice(0, -2); // Remove trailing comma and space
  2324. } else {
  2325. arg = arguments[i];
  2326. }
  2327. args.push(arg);
  2328. }
  2329. warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack);
  2330. firstTime = false;
  2331. }
  2332. return fn.apply(this, arguments);
  2333. }, fn);
  2334. }
  2335. var deprecations = {};
  2336. function deprecateSimple(name, msg) {
  2337. if (hooks.deprecationHandler != null) {
  2338. hooks.deprecationHandler(name, msg);
  2339. }
  2340. if (!deprecations[name]) {
  2341. warn(msg);
  2342. deprecations[name] = true;
  2343. }
  2344. }
  2345. hooks.suppressDeprecationWarnings = false;
  2346. hooks.deprecationHandler = null;
  2347. function isFunction(input) {
  2348. return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
  2349. }
  2350. function set (config) {
  2351. var prop, i;
  2352. for (i in config) {
  2353. prop = config[i];
  2354. if (isFunction(prop)) {
  2355. this[i] = prop;
  2356. } else {
  2357. this['_' + i] = prop;
  2358. }
  2359. }
  2360. this._config = config;
  2361. // Lenient ordinal parsing accepts just a number in addition to
  2362. // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
  2363. // TODO: Remove "ordinalParse" fallback in next major release.
  2364. this._dayOfMonthOrdinalParseLenient = new RegExp(
  2365. (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
  2366. '|' + (/\d{1,2}/).source);
  2367. }
  2368. function mergeConfigs(parentConfig, childConfig) {
  2369. var res = extend({}, parentConfig), prop;
  2370. for (prop in childConfig) {
  2371. if (hasOwnProp(childConfig, prop)) {
  2372. if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
  2373. res[prop] = {};
  2374. extend(res[prop], parentConfig[prop]);
  2375. extend(res[prop], childConfig[prop]);
  2376. } else if (childConfig[prop] != null) {
  2377. res[prop] = childConfig[prop];
  2378. } else {
  2379. delete res[prop];
  2380. }
  2381. }
  2382. }
  2383. for (prop in parentConfig) {
  2384. if (hasOwnProp(parentConfig, prop) &&
  2385. !hasOwnProp(childConfig, prop) &&
  2386. isObject(parentConfig[prop])) {
  2387. // make sure changes to properties don't modify parent config
  2388. res[prop] = extend({}, res[prop]);
  2389. }
  2390. }
  2391. return res;
  2392. }
  2393. function Locale(config) {
  2394. if (config != null) {
  2395. this.set(config);
  2396. }
  2397. }
  2398. var keys;
  2399. if (Object.keys) {
  2400. keys = Object.keys;
  2401. } else {
  2402. keys = function (obj) {
  2403. var i, res = [];
  2404. for (i in obj) {
  2405. if (hasOwnProp(obj, i)) {
  2406. res.push(i);
  2407. }
  2408. }
  2409. return res;
  2410. };
  2411. }
  2412. var defaultCalendar = {
  2413. sameDay : '[Today at] LT',
  2414. nextDay : '[Tomorrow at] LT',
  2415. nextWeek : 'dddd [at] LT',
  2416. lastDay : '[Yesterday at] LT',
  2417. lastWeek : '[Last] dddd [at] LT',
  2418. sameElse : 'L'
  2419. };
  2420. function calendar (key, mom, now) {
  2421. var output = this._calendar[key] || this._calendar['sameElse'];
  2422. return isFunction(output) ? output.call(mom, now) : output;
  2423. }
  2424. var defaultLongDateFormat = {
  2425. LTS : 'h:mm:ss A',
  2426. LT : 'h:mm A',
  2427. L : 'MM/DD/YYYY',
  2428. LL : 'MMMM D, YYYY',
  2429. LLL : 'MMMM D, YYYY h:mm A',
  2430. LLLL : 'dddd, MMMM D, YYYY h:mm A'
  2431. };
  2432. function longDateFormat (key) {
  2433. var format = this._longDateFormat[key],
  2434. formatUpper = this._longDateFormat[key.toUpperCase()];
  2435. if (format || !formatUpper) {
  2436. return format;
  2437. }
  2438. this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
  2439. return val.slice(1);
  2440. });
  2441. return this._longDateFormat[key];
  2442. }
  2443. var defaultInvalidDate = 'Invalid date';
  2444. function invalidDate () {
  2445. return this._invalidDate;
  2446. }
  2447. var defaultOrdinal = '%d';
  2448. var defaultDayOfMonthOrdinalParse = /\d{1,2}/;
  2449. function ordinal (number) {
  2450. return this._ordinal.replace('%d', number);
  2451. }
  2452. var defaultRelativeTime = {
  2453. future : 'in %s',
  2454. past : '%s ago',
  2455. s : 'a few seconds',
  2456. ss : '%d seconds',
  2457. m : 'a minute',
  2458. mm : '%d minutes',
  2459. h : 'an hour',
  2460. hh : '%d hours',
  2461. d : 'a day',
  2462. dd : '%d days',
  2463. M : 'a month',
  2464. MM : '%d months',
  2465. y : 'a year',
  2466. yy : '%d years'
  2467. };
  2468. function relativeTime (number, withoutSuffix, string, isFuture) {
  2469. var output = this._relativeTime[string];
  2470. return (isFunction(output)) ?
  2471. output(number, withoutSuffix, string, isFuture) :
  2472. output.replace(/%d/i, number);
  2473. }
  2474. function pastFuture (diff, output) {
  2475. var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
  2476. return isFunction(format) ? format(output) : format.replace(/%s/i, output);
  2477. }
  2478. var aliases = {};
  2479. function addUnitAlias (unit, shorthand) {
  2480. var lowerCase = unit.toLowerCase();
  2481. aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
  2482. }
  2483. function normalizeUnits(units) {
  2484. return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
  2485. }
  2486. function normalizeObjectUnits(inputObject) {
  2487. var normalizedInput = {},
  2488. normalizedProp,
  2489. prop;
  2490. for (prop in inputObject) {
  2491. if (hasOwnProp(inputObject, prop)) {
  2492. normalizedProp = normalizeUnits(prop);
  2493. if (normalizedProp) {
  2494. normalizedInput[normalizedProp] = inputObject[prop];
  2495. }
  2496. }
  2497. }
  2498. return normalizedInput;
  2499. }
  2500. var priorities = {};
  2501. function addUnitPriority(unit, priority) {
  2502. priorities[unit] = priority;
  2503. }
  2504. function getPrioritizedUnits(unitsObj) {
  2505. var units = [];
  2506. for (var u in unitsObj) {
  2507. units.push({unit: u, priority: priorities[u]});
  2508. }
  2509. units.sort(function (a, b) {
  2510. return a.priority - b.priority;
  2511. });
  2512. return units;
  2513. }
  2514. function zeroFill(number, targetLength, forceSign) {
  2515. var absNumber = '' + Math.abs(number),
  2516. zerosToFill = targetLength - absNumber.length,
  2517. sign = number >= 0;
  2518. return (sign ? (forceSign ? '+' : '') : '-') +
  2519. Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
  2520. }
  2521. var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
  2522. var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
  2523. var formatFunctions = {};
  2524. var formatTokenFunctions = {};
  2525. // token: 'M'
  2526. // padded: ['MM', 2]
  2527. // ordinal: 'Mo'
  2528. // callback: function () { this.month() + 1 }
  2529. function addFormatToken (token, padded, ordinal, callback) {
  2530. var func = callback;
  2531. if (typeof callback === 'string') {
  2532. func = function () {
  2533. return this[callback]();
  2534. };
  2535. }
  2536. if (token) {
  2537. formatTokenFunctions[token] = func;
  2538. }
  2539. if (padded) {
  2540. formatTokenFunctions[padded[0]] = function () {
  2541. return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
  2542. };
  2543. }
  2544. if (ordinal) {
  2545. formatTokenFunctions[ordinal] = function () {
  2546. return this.localeData().ordinal(func.apply(this, arguments), token);
  2547. };
  2548. }
  2549. }
  2550. function removeFormattingTokens(input) {
  2551. if (input.match(/\[[\s\S]/)) {
  2552. return input.replace(/^\[|\]$/g, '');
  2553. }
  2554. return input.replace(/\\/g, '');
  2555. }
  2556. function makeFormatFunction(format) {
  2557. var array = format.match(formattingTokens), i, length;
  2558. for (i = 0, length = array.length; i < length; i++) {
  2559. if (formatTokenFunctions[array[i]]) {
  2560. array[i] = formatTokenFunctions[array[i]];
  2561. } else {
  2562. array[i] = removeFormattingTokens(array[i]);
  2563. }
  2564. }
  2565. return function (mom) {
  2566. var output = '', i;
  2567. for (i = 0; i < length; i++) {
  2568. output += isFunction(array[i]) ? array[i].call(mom, format) : array[i];
  2569. }
  2570. return output;
  2571. };
  2572. }
  2573. // format date using native date object
  2574. function formatMoment(m, format) {
  2575. if (!m.isValid()) {
  2576. return m.localeData().invalidDate();
  2577. }
  2578. format = expandFormat(format, m.localeData());
  2579. formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
  2580. return formatFunctions[format](m);
  2581. }
  2582. function expandFormat(format, locale) {
  2583. var i = 5;
  2584. function replaceLongDateFormatTokens(input) {
  2585. return locale.longDateFormat(input) || input;
  2586. }
  2587. localFormattingTokens.lastIndex = 0;
  2588. while (i >= 0 && localFormattingTokens.test(format)) {
  2589. format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
  2590. localFormattingTokens.lastIndex = 0;
  2591. i -= 1;
  2592. }
  2593. return format;
  2594. }
  2595. var match1 = /\d/; // 0 - 9
  2596. var match2 = /\d\d/; // 00 - 99
  2597. var match3 = /\d{3}/; // 000 - 999
  2598. var match4 = /\d{4}/; // 0000 - 9999
  2599. var match6 = /[+-]?\d{6}/; // -999999 - 999999
  2600. var match1to2 = /\d\d?/; // 0 - 99
  2601. var match3to4 = /\d\d\d\d?/; // 999 - 9999
  2602. var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999
  2603. var match1to3 = /\d{1,3}/; // 0 - 999
  2604. var match1to4 = /\d{1,4}/; // 0 - 9999
  2605. var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
  2606. var matchUnsigned = /\d+/; // 0 - inf
  2607. var matchSigned = /[+-]?\d+/; // -inf - inf
  2608. var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
  2609. var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
  2610. var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
  2611. // any word (or two) characters or numbers including two/three word month in arabic.
  2612. // includes scottish gaelic two word and hyphenated months
  2613. var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;
  2614. var regexes = {};
  2615. function addRegexToken (token, regex, strictRegex) {
  2616. regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
  2617. return (isStrict && strictRegex) ? strictRegex : regex;
  2618. };
  2619. }
  2620. function getParseRegexForToken (token, config) {
  2621. if (!hasOwnProp(regexes, token)) {
  2622. return new RegExp(unescapeFormat(token));
  2623. }
  2624. return regexes[token](config._strict, config._locale);
  2625. }
  2626. // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
  2627. function unescapeFormat(s) {
  2628. return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
  2629. return p1 || p2 || p3 || p4;
  2630. }));
  2631. }
  2632. function regexEscape(s) {
  2633. return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  2634. }
  2635. var tokens = {};
  2636. function addParseToken (token, callback) {
  2637. var i, func = callback;
  2638. if (typeof token === 'string') {
  2639. token = [token];
  2640. }
  2641. if (isNumber(callback)) {
  2642. func = function (input, array) {
  2643. array[callback] = toInt(input);
  2644. };
  2645. }
  2646. for (i = 0; i < token.length; i++) {
  2647. tokens[token[i]] = func;
  2648. }
  2649. }
  2650. function addWeekParseToken (token, callback) {
  2651. addParseToken(token, function (input, array, config, token) {
  2652. config._w = config._w || {};
  2653. callback(input, config._w, config, token);
  2654. });
  2655. }
  2656. function addTimeToArrayFromToken(token, input, config) {
  2657. if (input != null && hasOwnProp(tokens, token)) {
  2658. tokens[token](input, config._a, config, token);
  2659. }
  2660. }
  2661. var YEAR = 0;
  2662. var MONTH = 1;
  2663. var DATE = 2;
  2664. var HOUR = 3;
  2665. var MINUTE = 4;
  2666. var SECOND = 5;
  2667. var MILLISECOND = 6;
  2668. var WEEK = 7;
  2669. var WEEKDAY = 8;
  2670. // FORMATTING
  2671. addFormatToken('Y', 0, 0, function () {
  2672. var y = this.year();
  2673. return y <= 9999 ? '' + y : '+' + y;
  2674. });
  2675. addFormatToken(0, ['YY', 2], 0, function () {
  2676. return this.year() % 100;
  2677. });
  2678. addFormatToken(0, ['YYYY', 4], 0, 'year');
  2679. addFormatToken(0, ['YYYYY', 5], 0, 'year');
  2680. addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
  2681. // ALIASES
  2682. addUnitAlias('year', 'y');
  2683. // PRIORITIES
  2684. addUnitPriority('year', 1);
  2685. // PARSING
  2686. addRegexToken('Y', matchSigned);
  2687. addRegexToken('YY', match1to2, match2);
  2688. addRegexToken('YYYY', match1to4, match4);
  2689. addRegexToken('YYYYY', match1to6, match6);
  2690. addRegexToken('YYYYYY', match1to6, match6);
  2691. addParseToken(['YYYYY', 'YYYYYY'], YEAR);
  2692. addParseToken('YYYY', function (input, array) {
  2693. array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
  2694. });
  2695. addParseToken('YY', function (input, array) {
  2696. array[YEAR] = hooks.parseTwoDigitYear(input);
  2697. });
  2698. addParseToken('Y', function (input, array) {
  2699. array[YEAR] = parseInt(input, 10);
  2700. });
  2701. // HELPERS
  2702. function daysInYear(year) {
  2703. return isLeapYear(year) ? 366 : 365;
  2704. }
  2705. function isLeapYear(year) {
  2706. return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
  2707. }
  2708. // HOOKS
  2709. hooks.parseTwoDigitYear = function (input) {
  2710. return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
  2711. };
  2712. // MOMENTS
  2713. var getSetYear = makeGetSet('FullYear', true);
  2714. function getIsLeapYear () {
  2715. return isLeapYear(this.year());
  2716. }
  2717. function makeGetSet (unit, keepTime) {
  2718. return function (value) {
  2719. if (value != null) {
  2720. set$1(this, unit, value);
  2721. hooks.updateOffset(this, keepTime);
  2722. return this;
  2723. } else {
  2724. return get(this, unit);
  2725. }
  2726. };
  2727. }
  2728. function get (mom, unit) {
  2729. return mom.isValid() ?
  2730. mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
  2731. }
  2732. function set$1 (mom, unit, value) {
  2733. if (mom.isValid() && !isNaN(value)) {
  2734. if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) {
  2735. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month()));
  2736. }
  2737. else {
  2738. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
  2739. }
  2740. }
  2741. }
  2742. // MOMENTS
  2743. function stringGet (units) {
  2744. units = normalizeUnits(units);
  2745. if (isFunction(this[units])) {
  2746. return this[units]();
  2747. }
  2748. return this;
  2749. }
  2750. function stringSet (units, value) {
  2751. if (typeof units === 'object') {
  2752. units = normalizeObjectUnits(units);
  2753. var prioritized = getPrioritizedUnits(units);
  2754. for (var i = 0; i < prioritized.length; i++) {
  2755. this[prioritized[i].unit](units[prioritized[i].unit]);
  2756. }
  2757. } else {
  2758. units = normalizeUnits(units);
  2759. if (isFunction(this[units])) {
  2760. return this[units](value);
  2761. }
  2762. }
  2763. return this;
  2764. }
  2765. function mod(n, x) {
  2766. return ((n % x) + x) % x;
  2767. }
  2768. var indexOf;
  2769. if (Array.prototype.indexOf) {
  2770. indexOf = Array.prototype.indexOf;
  2771. } else {
  2772. indexOf = function (o) {
  2773. // I know
  2774. var i;
  2775. for (i = 0; i < this.length; ++i) {
  2776. if (this[i] === o) {
  2777. return i;
  2778. }
  2779. }
  2780. return -1;
  2781. };
  2782. }
  2783. function daysInMonth(year, month) {
  2784. if (isNaN(year) || isNaN(month)) {
  2785. return NaN;
  2786. }
  2787. var modMonth = mod(month, 12);
  2788. year += (month - modMonth) / 12;
  2789. return modMonth === 1 ? (isLeapYear(year) ? 29 : 28) : (31 - modMonth % 7 % 2);
  2790. }
  2791. // FORMATTING
  2792. addFormatToken('M', ['MM', 2], 'Mo', function () {
  2793. return this.month() + 1;
  2794. });
  2795. addFormatToken('MMM', 0, 0, function (format) {
  2796. return this.localeData().monthsShort(this, format);
  2797. });
  2798. addFormatToken('MMMM', 0, 0, function (format) {
  2799. return this.localeData().months(this, format);
  2800. });
  2801. // ALIASES
  2802. addUnitAlias('month', 'M');
  2803. // PRIORITY
  2804. addUnitPriority('month', 8);
  2805. // PARSING
  2806. addRegexToken('M', match1to2);
  2807. addRegexToken('MM', match1to2, match2);
  2808. addRegexToken('MMM', function (isStrict, locale) {
  2809. return locale.monthsShortRegex(isStrict);
  2810. });
  2811. addRegexToken('MMMM', function (isStrict, locale) {
  2812. return locale.monthsRegex(isStrict);
  2813. });
  2814. addParseToken(['M', 'MM'], function (input, array) {
  2815. array[MONTH] = toInt(input) - 1;
  2816. });
  2817. addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
  2818. var month = config._locale.monthsParse(input, token, config._strict);
  2819. // if we didn't find a month name, mark the date as invalid.
  2820. if (month != null) {
  2821. array[MONTH] = month;
  2822. } else {
  2823. getParsingFlags(config).invalidMonth = input;
  2824. }
  2825. });
  2826. // LOCALES
  2827. var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
  2828. var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
  2829. function localeMonths (m, format) {
  2830. if (!m) {
  2831. return isArray(this._months) ? this._months :
  2832. this._months['standalone'];
  2833. }
  2834. return isArray(this._months) ? this._months[m.month()] :
  2835. this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];
  2836. }
  2837. var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
  2838. function localeMonthsShort (m, format) {
  2839. if (!m) {
  2840. return isArray(this._monthsShort) ? this._monthsShort :
  2841. this._monthsShort['standalone'];
  2842. }
  2843. return isArray(this._monthsShort) ? this._monthsShort[m.month()] :
  2844. this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
  2845. }
  2846. function handleStrictParse(monthName, format, strict) {
  2847. var i, ii, mom, llc = monthName.toLocaleLowerCase();
  2848. if (!this._monthsParse) {
  2849. // this is not used
  2850. this._monthsParse = [];
  2851. this._longMonthsParse = [];
  2852. this._shortMonthsParse = [];
  2853. for (i = 0; i < 12; ++i) {
  2854. mom = createUTC([2000, i]);
  2855. this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();
  2856. this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
  2857. }
  2858. }
  2859. if (strict) {
  2860. if (format === 'MMM') {
  2861. ii = indexOf.call(this._shortMonthsParse, llc);
  2862. return ii !== -1 ? ii : null;
  2863. } else {
  2864. ii = indexOf.call(this._longMonthsParse, llc);
  2865. return ii !== -1 ? ii : null;
  2866. }
  2867. } else {
  2868. if (format === 'MMM') {
  2869. ii = indexOf.call(this._shortMonthsParse, llc);
  2870. if (ii !== -1) {
  2871. return ii;
  2872. }
  2873. ii = indexOf.call(this._longMonthsParse, llc);
  2874. return ii !== -1 ? ii : null;
  2875. } else {
  2876. ii = indexOf.call(this._longMonthsParse, llc);
  2877. if (ii !== -1) {
  2878. return ii;
  2879. }
  2880. ii = indexOf.call(this._shortMonthsParse, llc);
  2881. return ii !== -1 ? ii : null;
  2882. }
  2883. }
  2884. }
  2885. function localeMonthsParse (monthName, format, strict) {
  2886. var i, mom, regex;
  2887. if (this._monthsParseExact) {
  2888. return handleStrictParse.call(this, monthName, format, strict);
  2889. }
  2890. if (!this._monthsParse) {
  2891. this._monthsParse = [];
  2892. this._longMonthsParse = [];
  2893. this._shortMonthsParse = [];
  2894. }
  2895. // TODO: add sorting
  2896. // Sorting makes sure if one month (or abbr) is a prefix of another
  2897. // see sorting in computeMonthsParse
  2898. for (i = 0; i < 12; i++) {
  2899. // make the regex if we don't have it already
  2900. mom = createUTC([2000, i]);
  2901. if (strict && !this._longMonthsParse[i]) {
  2902. this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
  2903. this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
  2904. }
  2905. if (!strict && !this._monthsParse[i]) {
  2906. regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
  2907. this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
  2908. }
  2909. // test the regex
  2910. if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
  2911. return i;
  2912. } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
  2913. return i;
  2914. } else if (!strict && this._monthsParse[i].test(monthName)) {
  2915. return i;
  2916. }
  2917. }
  2918. }
  2919. // MOMENTS
  2920. function setMonth (mom, value) {
  2921. var dayOfMonth;
  2922. if (!mom.isValid()) {
  2923. // No op
  2924. return mom;
  2925. }
  2926. if (typeof value === 'string') {
  2927. if (/^\d+$/.test(value)) {
  2928. value = toInt(value);
  2929. } else {
  2930. value = mom.localeData().monthsParse(value);
  2931. // TODO: Another silent failure?
  2932. if (!isNumber(value)) {
  2933. return mom;
  2934. }
  2935. }
  2936. }
  2937. dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
  2938. mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
  2939. return mom;
  2940. }
  2941. function getSetMonth (value) {
  2942. if (value != null) {
  2943. setMonth(this, value);
  2944. hooks.updateOffset(this, true);
  2945. return this;
  2946. } else {
  2947. return get(this, 'Month');
  2948. }
  2949. }
  2950. function getDaysInMonth () {
  2951. return daysInMonth(this.year(), this.month());
  2952. }
  2953. var defaultMonthsShortRegex = matchWord;
  2954. function monthsShortRegex (isStrict) {
  2955. if (this._monthsParseExact) {
  2956. if (!hasOwnProp(this, '_monthsRegex')) {
  2957. computeMonthsParse.call(this);
  2958. }
  2959. if (isStrict) {
  2960. return this._monthsShortStrictRegex;
  2961. } else {
  2962. return this._monthsShortRegex;
  2963. }
  2964. } else {
  2965. if (!hasOwnProp(this, '_monthsShortRegex')) {
  2966. this._monthsShortRegex = defaultMonthsShortRegex;
  2967. }
  2968. return this._monthsShortStrictRegex && isStrict ?
  2969. this._monthsShortStrictRegex : this._monthsShortRegex;
  2970. }
  2971. }
  2972. var defaultMonthsRegex = matchWord;
  2973. function monthsRegex (isStrict) {
  2974. if (this._monthsParseExact) {
  2975. if (!hasOwnProp(this, '_monthsRegex')) {
  2976. computeMonthsParse.call(this);
  2977. }
  2978. if (isStrict) {
  2979. return this._monthsStrictRegex;
  2980. } else {
  2981. return this._monthsRegex;
  2982. }
  2983. } else {
  2984. if (!hasOwnProp(this, '_monthsRegex')) {
  2985. this._monthsRegex = defaultMonthsRegex;
  2986. }
  2987. return this._monthsStrictRegex && isStrict ?
  2988. this._monthsStrictRegex : this._monthsRegex;
  2989. }
  2990. }
  2991. function computeMonthsParse () {
  2992. function cmpLenRev(a, b) {
  2993. return b.length - a.length;
  2994. }
  2995. var shortPieces = [], longPieces = [], mixedPieces = [],
  2996. i, mom;
  2997. for (i = 0; i < 12; i++) {
  2998. // make the regex if we don't have it already
  2999. mom = createUTC([2000, i]);
  3000. shortPieces.push(this.monthsShort(mom, ''));
  3001. longPieces.push(this.months(mom, ''));
  3002. mixedPieces.push(this.months(mom, ''));
  3003. mixedPieces.push(this.monthsShort(mom, ''));
  3004. }
  3005. // Sorting makes sure if one month (or abbr) is a prefix of another it
  3006. // will match the longer piece.
  3007. shortPieces.sort(cmpLenRev);
  3008. longPieces.sort(cmpLenRev);
  3009. mixedPieces.sort(cmpLenRev);
  3010. for (i = 0; i < 12; i++) {
  3011. shortPieces[i] = regexEscape(shortPieces[i]);
  3012. longPieces[i] = regexEscape(longPieces[i]);
  3013. }
  3014. for (i = 0; i < 24; i++) {
  3015. mixedPieces[i] = regexEscape(mixedPieces[i]);
  3016. }
  3017. this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  3018. this._monthsShortRegex = this._monthsRegex;
  3019. this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
  3020. this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
  3021. }
  3022. function createDate (y, m, d, h, M, s, ms) {
  3023. // can't just apply() to create a date:
  3024. // https://stackoverflow.com/q/181348
  3025. var date = new Date(y, m, d, h, M, s, ms);
  3026. // the date constructor remaps years 0-99 to 1900-1999
  3027. if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
  3028. date.setFullYear(y);
  3029. }
  3030. return date;
  3031. }
  3032. function createUTCDate (y) {
  3033. var date = new Date(Date.UTC.apply(null, arguments));
  3034. // the Date.UTC function remaps years 0-99 to 1900-1999
  3035. if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
  3036. date.setUTCFullYear(y);
  3037. }
  3038. return date;
  3039. }
  3040. // start-of-first-week - start-of-year
  3041. function firstWeekOffset(year, dow, doy) {
  3042. var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
  3043. fwd = 7 + dow - doy,
  3044. // first-week day local weekday -- which local weekday is fwd
  3045. fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
  3046. return -fwdlw + fwd - 1;
  3047. }
  3048. // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
  3049. function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
  3050. var localWeekday = (7 + weekday - dow) % 7,
  3051. weekOffset = firstWeekOffset(year, dow, doy),
  3052. dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
  3053. resYear, resDayOfYear;
  3054. if (dayOfYear <= 0) {
  3055. resYear = year - 1;
  3056. resDayOfYear = daysInYear(resYear) + dayOfYear;
  3057. } else if (dayOfYear > daysInYear(year)) {
  3058. resYear = year + 1;
  3059. resDayOfYear = dayOfYear - daysInYear(year);
  3060. } else {
  3061. resYear = year;
  3062. resDayOfYear = dayOfYear;
  3063. }
  3064. return {
  3065. year: resYear,
  3066. dayOfYear: resDayOfYear
  3067. };
  3068. }
  3069. function weekOfYear(mom, dow, doy) {
  3070. var weekOffset = firstWeekOffset(mom.year(), dow, doy),
  3071. week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
  3072. resWeek, resYear;
  3073. if (week < 1) {
  3074. resYear = mom.year() - 1;
  3075. resWeek = week + weeksInYear(resYear, dow, doy);
  3076. } else if (week > weeksInYear(mom.year(), dow, doy)) {
  3077. resWeek = week - weeksInYear(mom.year(), dow, doy);
  3078. resYear = mom.year() + 1;
  3079. } else {
  3080. resYear = mom.year();
  3081. resWeek = week;
  3082. }
  3083. return {
  3084. week: resWeek,
  3085. year: resYear
  3086. };
  3087. }
  3088. function weeksInYear(year, dow, doy) {
  3089. var weekOffset = firstWeekOffset(year, dow, doy),
  3090. weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
  3091. return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
  3092. }
  3093. // FORMATTING
  3094. addFormatToken('w', ['ww', 2], 'wo', 'week');
  3095. addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
  3096. // ALIASES
  3097. addUnitAlias('week', 'w');
  3098. addUnitAlias('isoWeek', 'W');
  3099. // PRIORITIES
  3100. addUnitPriority('week', 5);
  3101. addUnitPriority('isoWeek', 5);
  3102. // PARSING
  3103. addRegexToken('w', match1to2);
  3104. addRegexToken('ww', match1to2, match2);
  3105. addRegexToken('W', match1to2);
  3106. addRegexToken('WW', match1to2, match2);
  3107. addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
  3108. week[token.substr(0, 1)] = toInt(input);
  3109. });
  3110. // HELPERS
  3111. // LOCALES
  3112. function localeWeek (mom) {
  3113. return weekOfYear(mom, this._week.dow, this._week.doy).week;
  3114. }
  3115. var defaultLocaleWeek = {
  3116. dow : 0, // Sunday is the first day of the week.
  3117. doy : 6 // The week that contains Jan 1st is the first week of the year.
  3118. };
  3119. function localeFirstDayOfWeek () {
  3120. return this._week.dow;
  3121. }
  3122. function localeFirstDayOfYear () {
  3123. return this._week.doy;
  3124. }
  3125. // MOMENTS
  3126. function getSetWeek (input) {
  3127. var week = this.localeData().week(this);
  3128. return input == null ? week : this.add((input - week) * 7, 'd');
  3129. }
  3130. function getSetISOWeek (input) {
  3131. var week = weekOfYear(this, 1, 4).week;
  3132. return input == null ? week : this.add((input - week) * 7, 'd');
  3133. }
  3134. // FORMATTING
  3135. addFormatToken('d', 0, 'do', 'day');
  3136. addFormatToken('dd', 0, 0, function (format) {
  3137. return this.localeData().weekdaysMin(this, format);
  3138. });
  3139. addFormatToken('ddd', 0, 0, function (format) {
  3140. return this.localeData().weekdaysShort(this, format);
  3141. });
  3142. addFormatToken('dddd', 0, 0, function (format) {
  3143. return this.localeData().weekdays(this, format);
  3144. });
  3145. addFormatToken('e', 0, 0, 'weekday');
  3146. addFormatToken('E', 0, 0, 'isoWeekday');
  3147. // ALIASES
  3148. addUnitAlias('day', 'd');
  3149. addUnitAlias('weekday', 'e');
  3150. addUnitAlias('isoWeekday', 'E');
  3151. // PRIORITY
  3152. addUnitPriority('day', 11);
  3153. addUnitPriority('weekday', 11);
  3154. addUnitPriority('isoWeekday', 11);
  3155. // PARSING
  3156. addRegexToken('d', match1to2);
  3157. addRegexToken('e', match1to2);
  3158. addRegexToken('E', match1to2);
  3159. addRegexToken('dd', function (isStrict, locale) {
  3160. return locale.weekdaysMinRegex(isStrict);
  3161. });
  3162. addRegexToken('ddd', function (isStrict, locale) {
  3163. return locale.weekdaysShortRegex(isStrict);
  3164. });
  3165. addRegexToken('dddd', function (isStrict, locale) {
  3166. return locale.weekdaysRegex(isStrict);
  3167. });
  3168. addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
  3169. var weekday = config._locale.weekdaysParse(input, token, config._strict);
  3170. // if we didn't get a weekday name, mark the date as invalid
  3171. if (weekday != null) {
  3172. week.d = weekday;
  3173. } else {
  3174. getParsingFlags(config).invalidWeekday = input;
  3175. }
  3176. });
  3177. addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
  3178. week[token] = toInt(input);
  3179. });
  3180. // HELPERS
  3181. function parseWeekday(input, locale) {
  3182. if (typeof input !== 'string') {
  3183. return input;
  3184. }
  3185. if (!isNaN(input)) {
  3186. return parseInt(input, 10);
  3187. }
  3188. input = locale.weekdaysParse(input);
  3189. if (typeof input === 'number') {
  3190. return input;
  3191. }
  3192. return null;
  3193. }
  3194. function parseIsoWeekday(input, locale) {
  3195. if (typeof input === 'string') {
  3196. return locale.weekdaysParse(input) % 7 || 7;
  3197. }
  3198. return isNaN(input) ? null : input;
  3199. }
  3200. // LOCALES
  3201. var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
  3202. function localeWeekdays (m, format) {
  3203. if (!m) {
  3204. return isArray(this._weekdays) ? this._weekdays :
  3205. this._weekdays['standalone'];
  3206. }
  3207. return isArray(this._weekdays) ? this._weekdays[m.day()] :
  3208. this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()];
  3209. }
  3210. var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
  3211. function localeWeekdaysShort (m) {
  3212. return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
  3213. }
  3214. var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
  3215. function localeWeekdaysMin (m) {
  3216. return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
  3217. }
  3218. function handleStrictParse$1(weekdayName, format, strict) {
  3219. var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
  3220. if (!this._weekdaysParse) {
  3221. this._weekdaysParse = [];
  3222. this._shortWeekdaysParse = [];
  3223. this._minWeekdaysParse = [];
  3224. for (i = 0; i < 7; ++i) {
  3225. mom = createUTC([2000, 1]).day(i);
  3226. this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase();
  3227. this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase();
  3228. this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
  3229. }
  3230. }
  3231. if (strict) {
  3232. if (format === 'dddd') {
  3233. ii = indexOf.call(this._weekdaysParse, llc);
  3234. return ii !== -1 ? ii : null;
  3235. } else if (format === 'ddd') {
  3236. ii = indexOf.call(this._shortWeekdaysParse, llc);
  3237. return ii !== -1 ? ii : null;
  3238. } else {
  3239. ii = indexOf.call(this._minWeekdaysParse, llc);
  3240. return ii !== -1 ? ii : null;
  3241. }
  3242. } else {
  3243. if (format === 'dddd') {
  3244. ii = indexOf.call(this._weekdaysParse, llc);
  3245. if (ii !== -1) {
  3246. return ii;
  3247. }
  3248. ii = indexOf.call(this._shortWeekdaysParse, llc);
  3249. if (ii !== -1) {
  3250. return ii;
  3251. }
  3252. ii = indexOf.call(this._minWeekdaysParse, llc);
  3253. return ii !== -1 ? ii : null;
  3254. } else if (format === 'ddd') {
  3255. ii = indexOf.call(this._shortWeekdaysParse, llc);
  3256. if (ii !== -1) {
  3257. return ii;
  3258. }
  3259. ii = indexOf.call(this._weekdaysParse, llc);
  3260. if (ii !== -1) {
  3261. return ii;
  3262. }
  3263. ii = indexOf.call(this._minWeekdaysParse, llc);
  3264. return ii !== -1 ? ii : null;
  3265. } else {
  3266. ii = indexOf.call(this._minWeekdaysParse, llc);
  3267. if (ii !== -1) {
  3268. return ii;
  3269. }
  3270. ii = indexOf.call(this._weekdaysParse, llc);
  3271. if (ii !== -1) {
  3272. return ii;
  3273. }
  3274. ii = indexOf.call(this._shortWeekdaysParse, llc);
  3275. return ii !== -1 ? ii : null;
  3276. }
  3277. }
  3278. }
  3279. function localeWeekdaysParse (weekdayName, format, strict) {
  3280. var i, mom, regex;
  3281. if (this._weekdaysParseExact) {
  3282. return handleStrictParse$1.call(this, weekdayName, format, strict);
  3283. }
  3284. if (!this._weekdaysParse) {
  3285. this._weekdaysParse = [];
  3286. this._minWeekdaysParse = [];
  3287. this._shortWeekdaysParse = [];
  3288. this._fullWeekdaysParse = [];
  3289. }
  3290. for (i = 0; i < 7; i++) {
  3291. // make the regex if we don't have it already
  3292. mom = createUTC([2000, 1]).day(i);
  3293. if (strict && !this._fullWeekdaysParse[i]) {
  3294. this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i');
  3295. this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i');
  3296. this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i');
  3297. }
  3298. if (!this._weekdaysParse[i]) {
  3299. regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
  3300. this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
  3301. }
  3302. // test the regex
  3303. if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
  3304. return i;
  3305. } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
  3306. return i;
  3307. } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
  3308. return i;
  3309. } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
  3310. return i;
  3311. }
  3312. }
  3313. }
  3314. // MOMENTS
  3315. function getSetDayOfWeek (input) {
  3316. if (!this.isValid()) {
  3317. return input != null ? this : NaN;
  3318. }
  3319. var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
  3320. if (input != null) {
  3321. input = parseWeekday(input, this.localeData());
  3322. return this.add(input - day, 'd');
  3323. } else {
  3324. return day;
  3325. }
  3326. }
  3327. function getSetLocaleDayOfWeek (input) {
  3328. if (!this.isValid()) {
  3329. return input != null ? this : NaN;
  3330. }
  3331. var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
  3332. return input == null ? weekday : this.add(input - weekday, 'd');
  3333. }
  3334. function getSetISODayOfWeek (input) {
  3335. if (!this.isValid()) {
  3336. return input != null ? this : NaN;
  3337. }
  3338. // behaves the same as moment#day except
  3339. // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
  3340. // as a setter, sunday should belong to the previous week.
  3341. if (input != null) {
  3342. var weekday = parseIsoWeekday(input, this.localeData());
  3343. return this.day(this.day() % 7 ? weekday : weekday - 7);
  3344. } else {
  3345. return this.day() || 7;
  3346. }
  3347. }
  3348. var defaultWeekdaysRegex = matchWord;
  3349. function weekdaysRegex (isStrict) {
  3350. if (this._weekdaysParseExact) {
  3351. if (!hasOwnProp(this, '_weekdaysRegex')) {
  3352. computeWeekdaysParse.call(this);
  3353. }
  3354. if (isStrict) {
  3355. return this._weekdaysStrictRegex;
  3356. } else {
  3357. return this._weekdaysRegex;
  3358. }
  3359. } else {
  3360. if (!hasOwnProp(this, '_weekdaysRegex')) {
  3361. this._weekdaysRegex = defaultWeekdaysRegex;
  3362. }
  3363. return this._weekdaysStrictRegex && isStrict ?
  3364. this._weekdaysStrictRegex : this._weekdaysRegex;
  3365. }
  3366. }
  3367. var defaultWeekdaysShortRegex = matchWord;
  3368. function weekdaysShortRegex (isStrict) {
  3369. if (this._weekdaysParseExact) {
  3370. if (!hasOwnProp(this, '_weekdaysRegex')) {
  3371. computeWeekdaysParse.call(this);
  3372. }
  3373. if (isStrict) {
  3374. return this._weekdaysShortStrictRegex;
  3375. } else {
  3376. return this._weekdaysShortRegex;
  3377. }
  3378. } else {
  3379. if (!hasOwnProp(this, '_weekdaysShortRegex')) {
  3380. this._weekdaysShortRegex = defaultWeekdaysShortRegex;
  3381. }
  3382. return this._weekdaysShortStrictRegex && isStrict ?
  3383. this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
  3384. }
  3385. }
  3386. var defaultWeekdaysMinRegex = matchWord;
  3387. function weekdaysMinRegex (isStrict) {
  3388. if (this._weekdaysParseExact) {
  3389. if (!hasOwnProp(this, '_weekdaysRegex')) {
  3390. computeWeekdaysParse.call(this);
  3391. }
  3392. if (isStrict) {
  3393. return this._weekdaysMinStrictRegex;
  3394. } else {
  3395. return this._weekdaysMinRegex;
  3396. }
  3397. } else {
  3398. if (!hasOwnProp(this, '_weekdaysMinRegex')) {
  3399. this._weekdaysMinRegex = defaultWeekdaysMinRegex;
  3400. }
  3401. return this._weekdaysMinStrictRegex && isStrict ?
  3402. this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
  3403. }
  3404. }
  3405. function computeWeekdaysParse () {
  3406. function cmpLenRev(a, b) {
  3407. return b.length - a.length;
  3408. }
  3409. var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [],
  3410. i, mom, minp, shortp, longp;
  3411. for (i = 0; i < 7; i++) {
  3412. // make the regex if we don't have it already
  3413. mom = createUTC([2000, 1]).day(i);
  3414. minp = this.weekdaysMin(mom, '');
  3415. shortp = this.weekdaysShort(mom, '');
  3416. longp = this.weekdays(mom, '');
  3417. minPieces.push(minp);
  3418. shortPieces.push(shortp);
  3419. longPieces.push(longp);
  3420. mixedPieces.push(minp);
  3421. mixedPieces.push(shortp);
  3422. mixedPieces.push(longp);
  3423. }
  3424. // Sorting makes sure if one weekday (or abbr) is a prefix of another it
  3425. // will match the longer piece.
  3426. minPieces.sort(cmpLenRev);
  3427. shortPieces.sort(cmpLenRev);
  3428. longPieces.sort(cmpLenRev);
  3429. mixedPieces.sort(cmpLenRev);
  3430. for (i = 0; i < 7; i++) {
  3431. shortPieces[i] = regexEscape(shortPieces[i]);
  3432. longPieces[i] = regexEscape(longPieces[i]);
  3433. mixedPieces[i] = regexEscape(mixedPieces[i]);
  3434. }
  3435. this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  3436. this._weekdaysShortRegex = this._weekdaysRegex;
  3437. this._weekdaysMinRegex = this._weekdaysRegex;
  3438. this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
  3439. this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
  3440. this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i');
  3441. }
  3442. // FORMATTING
  3443. function hFormat() {
  3444. return this.hours() % 12 || 12;
  3445. }
  3446. function kFormat() {
  3447. return this.hours() || 24;
  3448. }
  3449. addFormatToken('H', ['HH', 2], 0, 'hour');
  3450. addFormatToken('h', ['hh', 2], 0, hFormat);
  3451. addFormatToken('k', ['kk', 2], 0, kFormat);
  3452. addFormatToken('hmm', 0, 0, function () {
  3453. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
  3454. });
  3455. addFormatToken('hmmss', 0, 0, function () {
  3456. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) +
  3457. zeroFill(this.seconds(), 2);
  3458. });
  3459. addFormatToken('Hmm', 0, 0, function () {
  3460. return '' + this.hours() + zeroFill(this.minutes(), 2);
  3461. });
  3462. addFormatToken('Hmmss', 0, 0, function () {
  3463. return '' + this.hours() + zeroFill(this.minutes(), 2) +
  3464. zeroFill(this.seconds(), 2);
  3465. });
  3466. function meridiem (token, lowercase) {
  3467. addFormatToken(token, 0, 0, function () {
  3468. return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
  3469. });
  3470. }
  3471. meridiem('a', true);
  3472. meridiem('A', false);
  3473. // ALIASES
  3474. addUnitAlias('hour', 'h');
  3475. // PRIORITY
  3476. addUnitPriority('hour', 13);
  3477. // PARSING
  3478. function matchMeridiem (isStrict, locale) {
  3479. return locale._meridiemParse;
  3480. }
  3481. addRegexToken('a', matchMeridiem);
  3482. addRegexToken('A', matchMeridiem);
  3483. addRegexToken('H', match1to2);
  3484. addRegexToken('h', match1to2);
  3485. addRegexToken('k', match1to2);
  3486. addRegexToken('HH', match1to2, match2);
  3487. addRegexToken('hh', match1to2, match2);
  3488. addRegexToken('kk', match1to2, match2);
  3489. addRegexToken('hmm', match3to4);
  3490. addRegexToken('hmmss', match5to6);
  3491. addRegexToken('Hmm', match3to4);
  3492. addRegexToken('Hmmss', match5to6);
  3493. addParseToken(['H', 'HH'], HOUR);
  3494. addParseToken(['k', 'kk'], function (input, array, config) {
  3495. var kInput = toInt(input);
  3496. array[HOUR] = kInput === 24 ? 0 : kInput;
  3497. });
  3498. addParseToken(['a', 'A'], function (input, array, config) {
  3499. config._isPm = config._locale.isPM(input);
  3500. config._meridiem = input;
  3501. });
  3502. addParseToken(['h', 'hh'], function (input, array, config) {
  3503. array[HOUR] = toInt(input);
  3504. getParsingFlags(config).bigHour = true;
  3505. });
  3506. addParseToken('hmm', function (input, array, config) {
  3507. var pos = input.length - 2;
  3508. array[HOUR] = toInt(input.substr(0, pos));
  3509. array[MINUTE] = toInt(input.substr(pos));
  3510. getParsingFlags(config).bigHour = true;
  3511. });
  3512. addParseToken('hmmss', function (input, array, config) {
  3513. var pos1 = input.length - 4;
  3514. var pos2 = input.length - 2;
  3515. array[HOUR] = toInt(input.substr(0, pos1));
  3516. array[MINUTE] = toInt(input.substr(pos1, 2));
  3517. array[SECOND] = toInt(input.substr(pos2));
  3518. getParsingFlags(config).bigHour = true;
  3519. });
  3520. addParseToken('Hmm', function (input, array, config) {
  3521. var pos = input.length - 2;
  3522. array[HOUR] = toInt(input.substr(0, pos));
  3523. array[MINUTE] = toInt(input.substr(pos));
  3524. });
  3525. addParseToken('Hmmss', function (input, array, config) {
  3526. var pos1 = input.length - 4;
  3527. var pos2 = input.length - 2;
  3528. array[HOUR] = toInt(input.substr(0, pos1));
  3529. array[MINUTE] = toInt(input.substr(pos1, 2));
  3530. array[SECOND] = toInt(input.substr(pos2));
  3531. });
  3532. // LOCALES
  3533. function localeIsPM (input) {
  3534. // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
  3535. // Using charAt should be more compatible.
  3536. return ((input + '').toLowerCase().charAt(0) === 'p');
  3537. }
  3538. var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
  3539. function localeMeridiem (hours, minutes, isLower) {
  3540. if (hours > 11) {
  3541. return isLower ? 'pm' : 'PM';
  3542. } else {
  3543. return isLower ? 'am' : 'AM';
  3544. }
  3545. }
  3546. // MOMENTS
  3547. // Setting the hour should keep the time, because the user explicitly
  3548. // specified which hour he wants. So trying to maintain the same hour (in
  3549. // a new timezone) makes sense. Adding/subtracting hours does not follow
  3550. // this rule.
  3551. var getSetHour = makeGetSet('Hours', true);
  3552. // months
  3553. // week
  3554. // weekdays
  3555. // meridiem
  3556. var baseConfig = {
  3557. calendar: defaultCalendar,
  3558. longDateFormat: defaultLongDateFormat,
  3559. invalidDate: defaultInvalidDate,
  3560. ordinal: defaultOrdinal,
  3561. dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
  3562. relativeTime: defaultRelativeTime,
  3563. months: defaultLocaleMonths,
  3564. monthsShort: defaultLocaleMonthsShort,
  3565. week: defaultLocaleWeek,
  3566. weekdays: defaultLocaleWeekdays,
  3567. weekdaysMin: defaultLocaleWeekdaysMin,
  3568. weekdaysShort: defaultLocaleWeekdaysShort,
  3569. meridiemParse: defaultLocaleMeridiemParse
  3570. };
  3571. // internal storage for locale config files
  3572. var locales = {};
  3573. var localeFamilies = {};
  3574. var globalLocale;
  3575. function normalizeLocale(key) {
  3576. return key ? key.toLowerCase().replace('_', '-') : key;
  3577. }
  3578. // pick the locale from the array
  3579. // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
  3580. // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
  3581. function chooseLocale(names) {
  3582. var i = 0, j, next, locale, split;
  3583. while (i < names.length) {
  3584. split = normalizeLocale(names[i]).split('-');
  3585. j = split.length;
  3586. next = normalizeLocale(names[i + 1]);
  3587. next = next ? next.split('-') : null;
  3588. while (j > 0) {
  3589. locale = loadLocale(split.slice(0, j).join('-'));
  3590. if (locale) {
  3591. return locale;
  3592. }
  3593. if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
  3594. //the next array item is better than a shallower substring of this one
  3595. break;
  3596. }
  3597. j--;
  3598. }
  3599. i++;
  3600. }
  3601. return null;
  3602. }
  3603. function loadLocale(name) {
  3604. var oldLocale = null;
  3605. // TODO: Find a better way to register and load all the locales in Node
  3606. if (!locales[name] && (typeof module !== 'undefined') &&
  3607. module && module.exports) {
  3608. try {
  3609. oldLocale = globalLocale._abbr;
  3610. var aliasedRequire = require;
  3611. aliasedRequire('./locale/' + name);
  3612. getSetGlobalLocale(oldLocale);
  3613. } catch (e) {}
  3614. }
  3615. return locales[name];
  3616. }
  3617. // This function will load locale and then set the global locale. If
  3618. // no arguments are passed in, it will simply return the current global
  3619. // locale key.
  3620. function getSetGlobalLocale (key, values) {
  3621. var data;
  3622. if (key) {
  3623. if (isUndefined(values)) {
  3624. data = getLocale(key);
  3625. }
  3626. else {
  3627. data = defineLocale(key, values);
  3628. }
  3629. if (data) {
  3630. // moment.duration._locale = moment._locale = data;
  3631. globalLocale = data;
  3632. }
  3633. }
  3634. return globalLocale._abbr;
  3635. }
  3636. function defineLocale (name, config) {
  3637. if (config !== null) {
  3638. var parentConfig = baseConfig;
  3639. config.abbr = name;
  3640. if (locales[name] != null) {
  3641. deprecateSimple('defineLocaleOverride',
  3642. 'use moment.updateLocale(localeName, config) to change ' +
  3643. 'an existing locale. moment.defineLocale(localeName, ' +
  3644. 'config) should only be used for creating a new locale ' +
  3645. 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');
  3646. parentConfig = locales[name]._config;
  3647. } else if (config.parentLocale != null) {
  3648. if (locales[config.parentLocale] != null) {
  3649. parentConfig = locales[config.parentLocale]._config;
  3650. } else {
  3651. if (!localeFamilies[config.parentLocale]) {
  3652. localeFamilies[config.parentLocale] = [];
  3653. }
  3654. localeFamilies[config.parentLocale].push({
  3655. name: name,
  3656. config: config
  3657. });
  3658. return null;
  3659. }
  3660. }
  3661. locales[name] = new Locale(mergeConfigs(parentConfig, config));
  3662. if (localeFamilies[name]) {
  3663. localeFamilies[name].forEach(function (x) {
  3664. defineLocale(x.name, x.config);
  3665. });
  3666. }
  3667. // backwards compat for now: also set the locale
  3668. // make sure we set the locale AFTER all child locales have been
  3669. // created, so we won't end up with the child locale set.
  3670. getSetGlobalLocale(name);
  3671. return locales[name];
  3672. } else {
  3673. // useful for testing
  3674. delete locales[name];
  3675. return null;
  3676. }
  3677. }
  3678. function updateLocale(name, config) {
  3679. if (config != null) {
  3680. var locale, tmpLocale, parentConfig = baseConfig;
  3681. // MERGE
  3682. tmpLocale = loadLocale(name);
  3683. if (tmpLocale != null) {
  3684. parentConfig = tmpLocale._config;
  3685. }
  3686. config = mergeConfigs(parentConfig, config);
  3687. locale = new Locale(config);
  3688. locale.parentLocale = locales[name];
  3689. locales[name] = locale;
  3690. // backwards compat for now: also set the locale
  3691. getSetGlobalLocale(name);
  3692. } else {
  3693. // pass null for config to unupdate, useful for tests
  3694. if (locales[name] != null) {
  3695. if (locales[name].parentLocale != null) {
  3696. locales[name] = locales[name].parentLocale;
  3697. } else if (locales[name] != null) {
  3698. delete locales[name];
  3699. }
  3700. }
  3701. }
  3702. return locales[name];
  3703. }
  3704. // returns locale data
  3705. function getLocale (key) {
  3706. var locale;
  3707. if (key && key._locale && key._locale._abbr) {
  3708. key = key._locale._abbr;
  3709. }
  3710. if (!key) {
  3711. return globalLocale;
  3712. }
  3713. if (!isArray(key)) {
  3714. //short-circuit everything else
  3715. locale = loadLocale(key);
  3716. if (locale) {
  3717. return locale;
  3718. }
  3719. key = [key];
  3720. }
  3721. return chooseLocale(key);
  3722. }
  3723. function listLocales() {
  3724. return keys(locales);
  3725. }
  3726. function checkOverflow (m) {
  3727. var overflow;
  3728. var a = m._a;
  3729. if (a && getParsingFlags(m).overflow === -2) {
  3730. overflow =
  3731. a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
  3732. a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
  3733. a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
  3734. a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE :
  3735. a[SECOND] < 0 || a[SECOND] > 59 ? SECOND :
  3736. a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
  3737. -1;
  3738. if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
  3739. overflow = DATE;
  3740. }
  3741. if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
  3742. overflow = WEEK;
  3743. }
  3744. if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
  3745. overflow = WEEKDAY;
  3746. }
  3747. getParsingFlags(m).overflow = overflow;
  3748. }
  3749. return m;
  3750. }
  3751. // Pick the first defined of two or three arguments.
  3752. function defaults(a, b, c) {
  3753. if (a != null) {
  3754. return a;
  3755. }
  3756. if (b != null) {
  3757. return b;
  3758. }
  3759. return c;
  3760. }
  3761. function currentDateArray(config) {
  3762. // hooks is actually the exported moment object
  3763. var nowValue = new Date(hooks.now());
  3764. if (config._useUTC) {
  3765. return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
  3766. }
  3767. return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
  3768. }
  3769. // convert an array to a date.
  3770. // the array should mirror the parameters below
  3771. // note: all values past the year are optional and will default to the lowest possible value.
  3772. // [year, month, day , hour, minute, second, millisecond]
  3773. function configFromArray (config) {
  3774. var i, date, input = [], currentDate, yearToUse;
  3775. if (config._d) {
  3776. return;
  3777. }
  3778. currentDate = currentDateArray(config);
  3779. //compute day of the year from weeks and weekdays
  3780. if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
  3781. dayOfYearFromWeekInfo(config);
  3782. }
  3783. //if the day of the year is set, figure out what it is
  3784. if (config._dayOfYear != null) {
  3785. yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
  3786. if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {
  3787. getParsingFlags(config)._overflowDayOfYear = true;
  3788. }
  3789. date = createUTCDate(yearToUse, 0, config._dayOfYear);
  3790. config._a[MONTH] = date.getUTCMonth();
  3791. config._a[DATE] = date.getUTCDate();
  3792. }
  3793. // Default to current date.
  3794. // * if no year, month, day of month are given, default to today
  3795. // * if day of month is given, default month and year
  3796. // * if month is given, default only year
  3797. // * if year is given, don't default anything
  3798. for (i = 0; i < 3 && config._a[i] == null; ++i) {
  3799. config._a[i] = input[i] = currentDate[i];
  3800. }
  3801. // Zero out whatever was not defaulted, including time
  3802. for (; i < 7; i++) {
  3803. config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
  3804. }
  3805. // Check for 24:00:00.000
  3806. if (config._a[HOUR] === 24 &&
  3807. config._a[MINUTE] === 0 &&
  3808. config._a[SECOND] === 0 &&
  3809. config._a[MILLISECOND] === 0) {
  3810. config._nextDay = true;
  3811. config._a[HOUR] = 0;
  3812. }
  3813. config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
  3814. // Apply timezone offset from input. The actual utcOffset can be changed
  3815. // with parseZone.
  3816. if (config._tzm != null) {
  3817. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  3818. }
  3819. if (config._nextDay) {
  3820. config._a[HOUR] = 24;
  3821. }
  3822. // check for mismatching day of week
  3823. if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== config._d.getDay()) {
  3824. getParsingFlags(config).weekdayMismatch = true;
  3825. }
  3826. }
  3827. function dayOfYearFromWeekInfo(config) {
  3828. var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
  3829. w = config._w;
  3830. if (w.GG != null || w.W != null || w.E != null) {
  3831. dow = 1;
  3832. doy = 4;
  3833. // TODO: We need to take the current isoWeekYear, but that depends on
  3834. // how we interpret now (local, utc, fixed offset). So create
  3835. // a now version of current config (take local/utc/offset flags, and
  3836. // create now).
  3837. weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year);
  3838. week = defaults(w.W, 1);
  3839. weekday = defaults(w.E, 1);
  3840. if (weekday < 1 || weekday > 7) {
  3841. weekdayOverflow = true;
  3842. }
  3843. } else {
  3844. dow = config._locale._week.dow;
  3845. doy = config._locale._week.doy;
  3846. var curWeek = weekOfYear(createLocal(), dow, doy);
  3847. weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
  3848. // Default to current week.
  3849. week = defaults(w.w, curWeek.week);
  3850. if (w.d != null) {
  3851. // weekday -- low day numbers are considered next week
  3852. weekday = w.d;
  3853. if (weekday < 0 || weekday > 6) {
  3854. weekdayOverflow = true;
  3855. }
  3856. } else if (w.e != null) {
  3857. // local weekday -- counting starts from begining of week
  3858. weekday = w.e + dow;
  3859. if (w.e < 0 || w.e > 6) {
  3860. weekdayOverflow = true;
  3861. }
  3862. } else {
  3863. // default to begining of week
  3864. weekday = dow;
  3865. }
  3866. }
  3867. if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
  3868. getParsingFlags(config)._overflowWeeks = true;
  3869. } else if (weekdayOverflow != null) {
  3870. getParsingFlags(config)._overflowWeekday = true;
  3871. } else {
  3872. temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
  3873. config._a[YEAR] = temp.year;
  3874. config._dayOfYear = temp.dayOfYear;
  3875. }
  3876. }
  3877. // iso 8601 regex
  3878. // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
  3879. var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
  3880. var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
  3881. var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
  3882. var isoDates = [
  3883. ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
  3884. ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
  3885. ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
  3886. ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
  3887. ['YYYY-DDD', /\d{4}-\d{3}/],
  3888. ['YYYY-MM', /\d{4}-\d\d/, false],
  3889. ['YYYYYYMMDD', /[+-]\d{10}/],
  3890. ['YYYYMMDD', /\d{8}/],
  3891. // YYYYMM is NOT allowed by the standard
  3892. ['GGGG[W]WWE', /\d{4}W\d{3}/],
  3893. ['GGGG[W]WW', /\d{4}W\d{2}/, false],
  3894. ['YYYYDDD', /\d{7}/]
  3895. ];
  3896. // iso time formats and regexes
  3897. var isoTimes = [
  3898. ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
  3899. ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
  3900. ['HH:mm:ss', /\d\d:\d\d:\d\d/],
  3901. ['HH:mm', /\d\d:\d\d/],
  3902. ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
  3903. ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
  3904. ['HHmmss', /\d\d\d\d\d\d/],
  3905. ['HHmm', /\d\d\d\d/],
  3906. ['HH', /\d\d/]
  3907. ];
  3908. var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
  3909. // date from iso format
  3910. function configFromISO(config) {
  3911. var i, l,
  3912. string = config._i,
  3913. match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
  3914. allowTime, dateFormat, timeFormat, tzFormat;
  3915. if (match) {
  3916. getParsingFlags(config).iso = true;
  3917. for (i = 0, l = isoDates.length; i < l; i++) {
  3918. if (isoDates[i][1].exec(match[1])) {
  3919. dateFormat = isoDates[i][0];
  3920. allowTime = isoDates[i][2] !== false;
  3921. break;
  3922. }
  3923. }
  3924. if (dateFormat == null) {
  3925. config._isValid = false;
  3926. return;
  3927. }
  3928. if (match[3]) {
  3929. for (i = 0, l = isoTimes.length; i < l; i++) {
  3930. if (isoTimes[i][1].exec(match[3])) {
  3931. // match[2] should be 'T' or space
  3932. timeFormat = (match[2] || ' ') + isoTimes[i][0];
  3933. break;
  3934. }
  3935. }
  3936. if (timeFormat == null) {
  3937. config._isValid = false;
  3938. return;
  3939. }
  3940. }
  3941. if (!allowTime && timeFormat != null) {
  3942. config._isValid = false;
  3943. return;
  3944. }
  3945. if (match[4]) {
  3946. if (tzRegex.exec(match[4])) {
  3947. tzFormat = 'Z';
  3948. } else {
  3949. config._isValid = false;
  3950. return;
  3951. }
  3952. }
  3953. config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
  3954. configFromStringAndFormat(config);
  3955. } else {
  3956. config._isValid = false;
  3957. }
  3958. }
  3959. // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
  3960. var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;
  3961. function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
  3962. var result = [
  3963. untruncateYear(yearStr),
  3964. defaultLocaleMonthsShort.indexOf(monthStr),
  3965. parseInt(dayStr, 10),
  3966. parseInt(hourStr, 10),
  3967. parseInt(minuteStr, 10)
  3968. ];
  3969. if (secondStr) {
  3970. result.push(parseInt(secondStr, 10));
  3971. }
  3972. return result;
  3973. }
  3974. function untruncateYear(yearStr) {
  3975. var year = parseInt(yearStr, 10);
  3976. if (year <= 49) {
  3977. return 2000 + year;
  3978. } else if (year <= 999) {
  3979. return 1900 + year;
  3980. }
  3981. return year;
  3982. }
  3983. function preprocessRFC2822(s) {
  3984. // Remove comments and folding whitespace and replace multiple-spaces with a single space
  3985. return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').trim();
  3986. }
  3987. function checkWeekday(weekdayStr, parsedInput, config) {
  3988. if (weekdayStr) {
  3989. // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check.
  3990. var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
  3991. weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay();
  3992. if (weekdayProvided !== weekdayActual) {
  3993. getParsingFlags(config).weekdayMismatch = true;
  3994. config._isValid = false;
  3995. return false;
  3996. }
  3997. }
  3998. return true;
  3999. }
  4000. var obsOffsets = {
  4001. UT: 0,
  4002. GMT: 0,
  4003. EDT: -4 * 60,
  4004. EST: -5 * 60,
  4005. CDT: -5 * 60,
  4006. CST: -6 * 60,
  4007. MDT: -6 * 60,
  4008. MST: -7 * 60,
  4009. PDT: -7 * 60,
  4010. PST: -8 * 60
  4011. };
  4012. function calculateOffset(obsOffset, militaryOffset, numOffset) {
  4013. if (obsOffset) {
  4014. return obsOffsets[obsOffset];
  4015. } else if (militaryOffset) {
  4016. // the only allowed military tz is Z
  4017. return 0;
  4018. } else {
  4019. var hm = parseInt(numOffset, 10);
  4020. var m = hm % 100, h = (hm - m) / 100;
  4021. return h * 60 + m;
  4022. }
  4023. }
  4024. // date and time from ref 2822 format
  4025. function configFromRFC2822(config) {
  4026. var match = rfc2822.exec(preprocessRFC2822(config._i));
  4027. if (match) {
  4028. var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]);
  4029. if (!checkWeekday(match[1], parsedArray, config)) {
  4030. return;
  4031. }
  4032. config._a = parsedArray;
  4033. config._tzm = calculateOffset(match[8], match[9], match[10]);
  4034. config._d = createUTCDate.apply(null, config._a);
  4035. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  4036. getParsingFlags(config).rfc2822 = true;
  4037. } else {
  4038. config._isValid = false;
  4039. }
  4040. }
  4041. // date from iso format or fallback
  4042. function configFromString(config) {
  4043. var matched = aspNetJsonRegex.exec(config._i);
  4044. if (matched !== null) {
  4045. config._d = new Date(+matched[1]);
  4046. return;
  4047. }
  4048. configFromISO(config);
  4049. if (config._isValid === false) {
  4050. delete config._isValid;
  4051. } else {
  4052. return;
  4053. }
  4054. configFromRFC2822(config);
  4055. if (config._isValid === false) {
  4056. delete config._isValid;
  4057. } else {
  4058. return;
  4059. }
  4060. // Final attempt, use Input Fallback
  4061. hooks.createFromInputFallback(config);
  4062. }
  4063. hooks.createFromInputFallback = deprecate(
  4064. 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
  4065. 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
  4066. 'discouraged and will be removed in an upcoming major release. Please refer to ' +
  4067. 'http://momentjs.com/guides/#/warnings/js-date/ for more info.',
  4068. function (config) {
  4069. config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
  4070. }
  4071. );
  4072. // constant that refers to the ISO standard
  4073. hooks.ISO_8601 = function () {};
  4074. // constant that refers to the RFC 2822 form
  4075. hooks.RFC_2822 = function () {};
  4076. // date from string and format string
  4077. function configFromStringAndFormat(config) {
  4078. // TODO: Move this to another part of the creation flow to prevent circular deps
  4079. if (config._f === hooks.ISO_8601) {
  4080. configFromISO(config);
  4081. return;
  4082. }
  4083. if (config._f === hooks.RFC_2822) {
  4084. configFromRFC2822(config);
  4085. return;
  4086. }
  4087. config._a = [];
  4088. getParsingFlags(config).empty = true;
  4089. // This array is used to make a Date, either with `new Date` or `Date.UTC`
  4090. var string = '' + config._i,
  4091. i, parsedInput, tokens, token, skipped,
  4092. stringLength = string.length,
  4093. totalParsedInputLength = 0;
  4094. tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
  4095. for (i = 0; i < tokens.length; i++) {
  4096. token = tokens[i];
  4097. parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
  4098. // console.log('token', token, 'parsedInput', parsedInput,
  4099. // 'regex', getParseRegexForToken(token, config));
  4100. if (parsedInput) {
  4101. skipped = string.substr(0, string.indexOf(parsedInput));
  4102. if (skipped.length > 0) {
  4103. getParsingFlags(config).unusedInput.push(skipped);
  4104. }
  4105. string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
  4106. totalParsedInputLength += parsedInput.length;
  4107. }
  4108. // don't parse if it's not a known token
  4109. if (formatTokenFunctions[token]) {
  4110. if (parsedInput) {
  4111. getParsingFlags(config).empty = false;
  4112. }
  4113. else {
  4114. getParsingFlags(config).unusedTokens.push(token);
  4115. }
  4116. addTimeToArrayFromToken(token, parsedInput, config);
  4117. }
  4118. else if (config._strict && !parsedInput) {
  4119. getParsingFlags(config).unusedTokens.push(token);
  4120. }
  4121. }
  4122. // add remaining unparsed input length to the string
  4123. getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
  4124. if (string.length > 0) {
  4125. getParsingFlags(config).unusedInput.push(string);
  4126. }
  4127. // clear _12h flag if hour is <= 12
  4128. if (config._a[HOUR] <= 12 &&
  4129. getParsingFlags(config).bigHour === true &&
  4130. config._a[HOUR] > 0) {
  4131. getParsingFlags(config).bigHour = undefined;
  4132. }
  4133. getParsingFlags(config).parsedDateParts = config._a.slice(0);
  4134. getParsingFlags(config).meridiem = config._meridiem;
  4135. // handle meridiem
  4136. config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
  4137. configFromArray(config);
  4138. checkOverflow(config);
  4139. }
  4140. function meridiemFixWrap (locale, hour, meridiem) {
  4141. var isPm;
  4142. if (meridiem == null) {
  4143. // nothing to do
  4144. return hour;
  4145. }
  4146. if (locale.meridiemHour != null) {
  4147. return locale.meridiemHour(hour, meridiem);
  4148. } else if (locale.isPM != null) {
  4149. // Fallback
  4150. isPm = locale.isPM(meridiem);
  4151. if (isPm && hour < 12) {
  4152. hour += 12;
  4153. }
  4154. if (!isPm && hour === 12) {
  4155. hour = 0;
  4156. }
  4157. return hour;
  4158. } else {
  4159. // this is not supposed to happen
  4160. return hour;
  4161. }
  4162. }
  4163. // date from string and array of format strings
  4164. function configFromStringAndArray(config) {
  4165. var tempConfig,
  4166. bestMoment,
  4167. scoreToBeat,
  4168. i,
  4169. currentScore;
  4170. if (config._f.length === 0) {
  4171. getParsingFlags(config).invalidFormat = true;
  4172. config._d = new Date(NaN);
  4173. return;
  4174. }
  4175. for (i = 0; i < config._f.length; i++) {
  4176. currentScore = 0;
  4177. tempConfig = copyConfig({}, config);
  4178. if (config._useUTC != null) {
  4179. tempConfig._useUTC = config._useUTC;
  4180. }
  4181. tempConfig._f = config._f[i];
  4182. configFromStringAndFormat(tempConfig);
  4183. if (!isValid(tempConfig)) {
  4184. continue;
  4185. }
  4186. // if there is any input that was not parsed add a penalty for that format
  4187. currentScore += getParsingFlags(tempConfig).charsLeftOver;
  4188. //or tokens
  4189. currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
  4190. getParsingFlags(tempConfig).score = currentScore;
  4191. if (scoreToBeat == null || currentScore < scoreToBeat) {
  4192. scoreToBeat = currentScore;
  4193. bestMoment = tempConfig;
  4194. }
  4195. }
  4196. extend(config, bestMoment || tempConfig);
  4197. }
  4198. function configFromObject(config) {
  4199. if (config._d) {
  4200. return;
  4201. }
  4202. var i = normalizeObjectUnits(config._i);
  4203. config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
  4204. return obj && parseInt(obj, 10);
  4205. });
  4206. configFromArray(config);
  4207. }
  4208. function createFromConfig (config) {
  4209. var res = new Moment(checkOverflow(prepareConfig(config)));
  4210. if (res._nextDay) {
  4211. // Adding is smart enough around DST
  4212. res.add(1, 'd');
  4213. res._nextDay = undefined;
  4214. }
  4215. return res;
  4216. }
  4217. function prepareConfig (config) {
  4218. var input = config._i,
  4219. format = config._f;
  4220. config._locale = config._locale || getLocale(config._l);
  4221. if (input === null || (format === undefined && input === '')) {
  4222. return createInvalid({nullInput: true});
  4223. }
  4224. if (typeof input === 'string') {
  4225. config._i = input = config._locale.preparse(input);
  4226. }
  4227. if (isMoment(input)) {
  4228. return new Moment(checkOverflow(input));
  4229. } else if (isDate(input)) {
  4230. config._d = input;
  4231. } else if (isArray(format)) {
  4232. configFromStringAndArray(config);
  4233. } else if (format) {
  4234. configFromStringAndFormat(config);
  4235. } else {
  4236. configFromInput(config);
  4237. }
  4238. if (!isValid(config)) {
  4239. config._d = null;
  4240. }
  4241. return config;
  4242. }
  4243. function configFromInput(config) {
  4244. var input = config._i;
  4245. if (isUndefined(input)) {
  4246. config._d = new Date(hooks.now());
  4247. } else if (isDate(input)) {
  4248. config._d = new Date(input.valueOf());
  4249. } else if (typeof input === 'string') {
  4250. configFromString(config);
  4251. } else if (isArray(input)) {
  4252. config._a = map(input.slice(0), function (obj) {
  4253. return parseInt(obj, 10);
  4254. });
  4255. configFromArray(config);
  4256. } else if (isObject(input)) {
  4257. configFromObject(config);
  4258. } else if (isNumber(input)) {
  4259. // from milliseconds
  4260. config._d = new Date(input);
  4261. } else {
  4262. hooks.createFromInputFallback(config);
  4263. }
  4264. }
  4265. function createLocalOrUTC (input, format, locale, strict, isUTC) {
  4266. var c = {};
  4267. if (locale === true || locale === false) {
  4268. strict = locale;
  4269. locale = undefined;
  4270. }
  4271. if ((isObject(input) && isObjectEmpty(input)) ||
  4272. (isArray(input) && input.length === 0)) {
  4273. input = undefined;
  4274. }
  4275. // object construction must be done this way.
  4276. // https://github.com/moment/moment/issues/1423
  4277. c._isAMomentObject = true;
  4278. c._useUTC = c._isUTC = isUTC;
  4279. c._l = locale;
  4280. c._i = input;
  4281. c._f = format;
  4282. c._strict = strict;
  4283. return createFromConfig(c);
  4284. }
  4285. function createLocal (input, format, locale, strict) {
  4286. return createLocalOrUTC(input, format, locale, strict, false);
  4287. }
  4288. var prototypeMin = deprecate(
  4289. 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
  4290. function () {
  4291. var other = createLocal.apply(null, arguments);
  4292. if (this.isValid() && other.isValid()) {
  4293. return other < this ? this : other;
  4294. } else {
  4295. return createInvalid();
  4296. }
  4297. }
  4298. );
  4299. var prototypeMax = deprecate(
  4300. 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
  4301. function () {
  4302. var other = createLocal.apply(null, arguments);
  4303. if (this.isValid() && other.isValid()) {
  4304. return other > this ? this : other;
  4305. } else {
  4306. return createInvalid();
  4307. }
  4308. }
  4309. );
  4310. // Pick a moment m from moments so that m[fn](other) is true for all
  4311. // other. This relies on the function fn to be transitive.
  4312. //
  4313. // moments should either be an array of moment objects or an array, whose
  4314. // first element is an array of moment objects.
  4315. function pickBy(fn, moments) {
  4316. var res, i;
  4317. if (moments.length === 1 && isArray(moments[0])) {
  4318. moments = moments[0];
  4319. }
  4320. if (!moments.length) {
  4321. return createLocal();
  4322. }
  4323. res = moments[0];
  4324. for (i = 1; i < moments.length; ++i) {
  4325. if (!moments[i].isValid() || moments[i][fn](res)) {
  4326. res = moments[i];
  4327. }
  4328. }
  4329. return res;
  4330. }
  4331. // TODO: Use [].sort instead?
  4332. function min () {
  4333. var args = [].slice.call(arguments, 0);
  4334. return pickBy('isBefore', args);
  4335. }
  4336. function max () {
  4337. var args = [].slice.call(arguments, 0);
  4338. return pickBy('isAfter', args);
  4339. }
  4340. var now = function () {
  4341. return Date.now ? Date.now() : +(new Date());
  4342. };
  4343. var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond'];
  4344. function isDurationValid(m) {
  4345. for (var key in m) {
  4346. if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
  4347. return false;
  4348. }
  4349. }
  4350. var unitHasDecimal = false;
  4351. for (var i = 0; i < ordering.length; ++i) {
  4352. if (m[ordering[i]]) {
  4353. if (unitHasDecimal) {
  4354. return false; // only allow non-integers for smallest unit
  4355. }
  4356. if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
  4357. unitHasDecimal = true;
  4358. }
  4359. }
  4360. }
  4361. return true;
  4362. }
  4363. function isValid$1() {
  4364. return this._isValid;
  4365. }
  4366. function createInvalid$1() {
  4367. return createDuration(NaN);
  4368. }
  4369. function Duration (duration) {
  4370. var normalizedInput = normalizeObjectUnits(duration),
  4371. years = normalizedInput.year || 0,
  4372. quarters = normalizedInput.quarter || 0,
  4373. months = normalizedInput.month || 0,
  4374. weeks = normalizedInput.week || 0,
  4375. days = normalizedInput.day || 0,
  4376. hours = normalizedInput.hour || 0,
  4377. minutes = normalizedInput.minute || 0,
  4378. seconds = normalizedInput.second || 0,
  4379. milliseconds = normalizedInput.millisecond || 0;
  4380. this._isValid = isDurationValid(normalizedInput);
  4381. // representation for dateAddRemove
  4382. this._milliseconds = +milliseconds +
  4383. seconds * 1e3 + // 1000
  4384. minutes * 6e4 + // 1000 * 60
  4385. hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
  4386. // Because of dateAddRemove treats 24 hours as different from a
  4387. // day when working around DST, we need to store them separately
  4388. this._days = +days +
  4389. weeks * 7;
  4390. // It is impossible to translate months into days without knowing
  4391. // which months you are are talking about, so we have to store
  4392. // it separately.
  4393. this._months = +months +
  4394. quarters * 3 +
  4395. years * 12;
  4396. this._data = {};
  4397. this._locale = getLocale();
  4398. this._bubble();
  4399. }
  4400. function isDuration (obj) {
  4401. return obj instanceof Duration;
  4402. }
  4403. function absRound (number) {
  4404. if (number < 0) {
  4405. return Math.round(-1 * number) * -1;
  4406. } else {
  4407. return Math.round(number);
  4408. }
  4409. }
  4410. // FORMATTING
  4411. function offset (token, separator) {
  4412. addFormatToken(token, 0, 0, function () {
  4413. var offset = this.utcOffset();
  4414. var sign = '+';
  4415. if (offset < 0) {
  4416. offset = -offset;
  4417. sign = '-';
  4418. }
  4419. return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
  4420. });
  4421. }
  4422. offset('Z', ':');
  4423. offset('ZZ', '');
  4424. // PARSING
  4425. addRegexToken('Z', matchShortOffset);
  4426. addRegexToken('ZZ', matchShortOffset);
  4427. addParseToken(['Z', 'ZZ'], function (input, array, config) {
  4428. config._useUTC = true;
  4429. config._tzm = offsetFromString(matchShortOffset, input);
  4430. });
  4431. // HELPERS
  4432. // timezone chunker
  4433. // '+10:00' > ['10', '00']
  4434. // '-1530' > ['-15', '30']
  4435. var chunkOffset = /([\+\-]|\d\d)/gi;
  4436. function offsetFromString(matcher, string) {
  4437. var matches = (string || '').match(matcher);
  4438. if (matches === null) {
  4439. return null;
  4440. }
  4441. var chunk = matches[matches.length - 1] || [];
  4442. var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
  4443. var minutes = +(parts[1] * 60) + toInt(parts[2]);
  4444. return minutes === 0 ?
  4445. 0 :
  4446. parts[0] === '+' ? minutes : -minutes;
  4447. }
  4448. // Return a moment from input, that is local/utc/zone equivalent to model.
  4449. function cloneWithOffset(input, model) {
  4450. var res, diff;
  4451. if (model._isUTC) {
  4452. res = model.clone();
  4453. diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();
  4454. // Use low-level api, because this fn is low-level api.
  4455. res._d.setTime(res._d.valueOf() + diff);
  4456. hooks.updateOffset(res, false);
  4457. return res;
  4458. } else {
  4459. return createLocal(input).local();
  4460. }
  4461. }
  4462. function getDateOffset (m) {
  4463. // On Firefox.24 Date#getTimezoneOffset returns a floating point.
  4464. // https://github.com/moment/moment/pull/1871
  4465. return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
  4466. }
  4467. // HOOKS
  4468. // This function will be called whenever a moment is mutated.
  4469. // It is intended to keep the offset in sync with the timezone.
  4470. hooks.updateOffset = function () {};
  4471. // MOMENTS
  4472. // keepLocalTime = true means only change the timezone, without
  4473. // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
  4474. // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
  4475. // +0200, so we adjust the time as needed, to be valid.
  4476. //
  4477. // Keeping the time actually adds/subtracts (one hour)
  4478. // from the actual represented time. That is why we call updateOffset
  4479. // a second time. In case it wants us to change the offset again
  4480. // _changeInProgress == true case, then we have to adjust, because
  4481. // there is no such time in the given timezone.
  4482. function getSetOffset (input, keepLocalTime, keepMinutes) {
  4483. var offset = this._offset || 0,
  4484. localAdjust;
  4485. if (!this.isValid()) {
  4486. return input != null ? this : NaN;
  4487. }
  4488. if (input != null) {
  4489. if (typeof input === 'string') {
  4490. input = offsetFromString(matchShortOffset, input);
  4491. if (input === null) {
  4492. return this;
  4493. }
  4494. } else if (Math.abs(input) < 16 && !keepMinutes) {
  4495. input = input * 60;
  4496. }
  4497. if (!this._isUTC && keepLocalTime) {
  4498. localAdjust = getDateOffset(this);
  4499. }
  4500. this._offset = input;
  4501. this._isUTC = true;
  4502. if (localAdjust != null) {
  4503. this.add(localAdjust, 'm');
  4504. }
  4505. if (offset !== input) {
  4506. if (!keepLocalTime || this._changeInProgress) {
  4507. addSubtract(this, createDuration(input - offset, 'm'), 1, false);
  4508. } else if (!this._changeInProgress) {
  4509. this._changeInProgress = true;
  4510. hooks.updateOffset(this, true);
  4511. this._changeInProgress = null;
  4512. }
  4513. }
  4514. return this;
  4515. } else {
  4516. return this._isUTC ? offset : getDateOffset(this);
  4517. }
  4518. }
  4519. function getSetZone (input, keepLocalTime) {
  4520. if (input != null) {
  4521. if (typeof input !== 'string') {
  4522. input = -input;
  4523. }
  4524. this.utcOffset(input, keepLocalTime);
  4525. return this;
  4526. } else {
  4527. return -this.utcOffset();
  4528. }
  4529. }
  4530. function setOffsetToUTC (keepLocalTime) {
  4531. return this.utcOffset(0, keepLocalTime);
  4532. }
  4533. function setOffsetToLocal (keepLocalTime) {
  4534. if (this._isUTC) {
  4535. this.utcOffset(0, keepLocalTime);
  4536. this._isUTC = false;
  4537. if (keepLocalTime) {
  4538. this.subtract(getDateOffset(this), 'm');
  4539. }
  4540. }
  4541. return this;
  4542. }
  4543. function setOffsetToParsedOffset () {
  4544. if (this._tzm != null) {
  4545. this.utcOffset(this._tzm, false, true);
  4546. } else if (typeof this._i === 'string') {
  4547. var tZone = offsetFromString(matchOffset, this._i);
  4548. if (tZone != null) {
  4549. this.utcOffset(tZone);
  4550. }
  4551. else {
  4552. this.utcOffset(0, true);
  4553. }
  4554. }
  4555. return this;
  4556. }
  4557. function hasAlignedHourOffset (input) {
  4558. if (!this.isValid()) {
  4559. return false;
  4560. }
  4561. input = input ? createLocal(input).utcOffset() : 0;
  4562. return (this.utcOffset() - input) % 60 === 0;
  4563. }
  4564. function isDaylightSavingTime () {
  4565. return (
  4566. this.utcOffset() > this.clone().month(0).utcOffset() ||
  4567. this.utcOffset() > this.clone().month(5).utcOffset()
  4568. );
  4569. }
  4570. function isDaylightSavingTimeShifted () {
  4571. if (!isUndefined(this._isDSTShifted)) {
  4572. return this._isDSTShifted;
  4573. }
  4574. var c = {};
  4575. copyConfig(c, this);
  4576. c = prepareConfig(c);
  4577. if (c._a) {
  4578. var other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
  4579. this._isDSTShifted = this.isValid() &&
  4580. compareArrays(c._a, other.toArray()) > 0;
  4581. } else {
  4582. this._isDSTShifted = false;
  4583. }
  4584. return this._isDSTShifted;
  4585. }
  4586. function isLocal () {
  4587. return this.isValid() ? !this._isUTC : false;
  4588. }
  4589. function isUtcOffset () {
  4590. return this.isValid() ? this._isUTC : false;
  4591. }
  4592. function isUtc () {
  4593. return this.isValid() ? this._isUTC && this._offset === 0 : false;
  4594. }
  4595. // ASP.NET json date format regex
  4596. var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;
  4597. // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
  4598. // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
  4599. // and further modified to allow for strings containing both week and day
  4600. var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
  4601. function createDuration (input, key) {
  4602. var duration = input,
  4603. // matching against regexp is expensive, do it on demand
  4604. match = null,
  4605. sign,
  4606. ret,
  4607. diffRes;
  4608. if (isDuration(input)) {
  4609. duration = {
  4610. ms : input._milliseconds,
  4611. d : input._days,
  4612. M : input._months
  4613. };
  4614. } else if (isNumber(input)) {
  4615. duration = {};
  4616. if (key) {
  4617. duration[key] = input;
  4618. } else {
  4619. duration.milliseconds = input;
  4620. }
  4621. } else if (!!(match = aspNetRegex.exec(input))) {
  4622. sign = (match[1] === '-') ? -1 : 1;
  4623. duration = {
  4624. y : 0,
  4625. d : toInt(match[DATE]) * sign,
  4626. h : toInt(match[HOUR]) * sign,
  4627. m : toInt(match[MINUTE]) * sign,
  4628. s : toInt(match[SECOND]) * sign,
  4629. ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
  4630. };
  4631. } else if (!!(match = isoRegex.exec(input))) {
  4632. sign = (match[1] === '-') ? -1 : (match[1] === '+') ? 1 : 1;
  4633. duration = {
  4634. y : parseIso(match[2], sign),
  4635. M : parseIso(match[3], sign),
  4636. w : parseIso(match[4], sign),
  4637. d : parseIso(match[5], sign),
  4638. h : parseIso(match[6], sign),
  4639. m : parseIso(match[7], sign),
  4640. s : parseIso(match[8], sign)
  4641. };
  4642. } else if (duration == null) {// checks for null or undefined
  4643. duration = {};
  4644. } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
  4645. diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to));
  4646. duration = {};
  4647. duration.ms = diffRes.milliseconds;
  4648. duration.M = diffRes.months;
  4649. }
  4650. ret = new Duration(duration);
  4651. if (isDuration(input) && hasOwnProp(input, '_locale')) {
  4652. ret._locale = input._locale;
  4653. }
  4654. return ret;
  4655. }
  4656. createDuration.fn = Duration.prototype;
  4657. createDuration.invalid = createInvalid$1;
  4658. function parseIso (inp, sign) {
  4659. // We'd normally use ~~inp for this, but unfortunately it also
  4660. // converts floats to ints.
  4661. // inp may be undefined, so careful calling replace on it.
  4662. var res = inp && parseFloat(inp.replace(',', '.'));
  4663. // apply sign while we're at it
  4664. return (isNaN(res) ? 0 : res) * sign;
  4665. }
  4666. function positiveMomentsDifference(base, other) {
  4667. var res = {milliseconds: 0, months: 0};
  4668. res.months = other.month() - base.month() +
  4669. (other.year() - base.year()) * 12;
  4670. if (base.clone().add(res.months, 'M').isAfter(other)) {
  4671. --res.months;
  4672. }
  4673. res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
  4674. return res;
  4675. }
  4676. function momentsDifference(base, other) {
  4677. var res;
  4678. if (!(base.isValid() && other.isValid())) {
  4679. return {milliseconds: 0, months: 0};
  4680. }
  4681. other = cloneWithOffset(other, base);
  4682. if (base.isBefore(other)) {
  4683. res = positiveMomentsDifference(base, other);
  4684. } else {
  4685. res = positiveMomentsDifference(other, base);
  4686. res.milliseconds = -res.milliseconds;
  4687. res.months = -res.months;
  4688. }
  4689. return res;
  4690. }
  4691. // TODO: remove 'name' arg after deprecation is removed
  4692. function createAdder(direction, name) {
  4693. return function (val, period) {
  4694. var dur, tmp;
  4695. //invert the arguments, but complain about it
  4696. if (period !== null && !isNaN(+period)) {
  4697. deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' +
  4698. 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');
  4699. tmp = val; val = period; period = tmp;
  4700. }
  4701. val = typeof val === 'string' ? +val : val;
  4702. dur = createDuration(val, period);
  4703. addSubtract(this, dur, direction);
  4704. return this;
  4705. };
  4706. }
  4707. function addSubtract (mom, duration, isAdding, updateOffset) {
  4708. var milliseconds = duration._milliseconds,
  4709. days = absRound(duration._days),
  4710. months = absRound(duration._months);
  4711. if (!mom.isValid()) {
  4712. // No op
  4713. return;
  4714. }
  4715. updateOffset = updateOffset == null ? true : updateOffset;
  4716. if (months) {
  4717. setMonth(mom, get(mom, 'Month') + months * isAdding);
  4718. }
  4719. if (days) {
  4720. set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
  4721. }
  4722. if (milliseconds) {
  4723. mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
  4724. }
  4725. if (updateOffset) {
  4726. hooks.updateOffset(mom, days || months);
  4727. }
  4728. }
  4729. var add = createAdder(1, 'add');
  4730. var subtract = createAdder(-1, 'subtract');
  4731. function getCalendarFormat(myMoment, now) {
  4732. var diff = myMoment.diff(now, 'days', true);
  4733. return diff < -6 ? 'sameElse' :
  4734. diff < -1 ? 'lastWeek' :
  4735. diff < 0 ? 'lastDay' :
  4736. diff < 1 ? 'sameDay' :
  4737. diff < 2 ? 'nextDay' :
  4738. diff < 7 ? 'nextWeek' : 'sameElse';
  4739. }
  4740. function calendar$1 (time, formats) {
  4741. // We want to compare the start of today, vs this.
  4742. // Getting start-of-today depends on whether we're local/utc/offset or not.
  4743. var now = time || createLocal(),
  4744. sod = cloneWithOffset(now, this).startOf('day'),
  4745. format = hooks.calendarFormat(this, sod) || 'sameElse';
  4746. var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
  4747. return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
  4748. }
  4749. function clone () {
  4750. return new Moment(this);
  4751. }
  4752. function isAfter (input, units) {
  4753. var localInput = isMoment(input) ? input : createLocal(input);
  4754. if (!(this.isValid() && localInput.isValid())) {
  4755. return false;
  4756. }
  4757. units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
  4758. if (units === 'millisecond') {
  4759. return this.valueOf() > localInput.valueOf();
  4760. } else {
  4761. return localInput.valueOf() < this.clone().startOf(units).valueOf();
  4762. }
  4763. }
  4764. function isBefore (input, units) {
  4765. var localInput = isMoment(input) ? input : createLocal(input);
  4766. if (!(this.isValid() && localInput.isValid())) {
  4767. return false;
  4768. }
  4769. units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
  4770. if (units === 'millisecond') {
  4771. return this.valueOf() < localInput.valueOf();
  4772. } else {
  4773. return this.clone().endOf(units).valueOf() < localInput.valueOf();
  4774. }
  4775. }
  4776. function isBetween (from, to, units, inclusivity) {
  4777. inclusivity = inclusivity || '()';
  4778. return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) &&
  4779. (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units));
  4780. }
  4781. function isSame (input, units) {
  4782. var localInput = isMoment(input) ? input : createLocal(input),
  4783. inputMs;
  4784. if (!(this.isValid() && localInput.isValid())) {
  4785. return false;
  4786. }
  4787. units = normalizeUnits(units || 'millisecond');
  4788. if (units === 'millisecond') {
  4789. return this.valueOf() === localInput.valueOf();
  4790. } else {
  4791. inputMs = localInput.valueOf();
  4792. return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
  4793. }
  4794. }
  4795. function isSameOrAfter (input, units) {
  4796. return this.isSame(input, units) || this.isAfter(input,units);
  4797. }
  4798. function isSameOrBefore (input, units) {
  4799. return this.isSame(input, units) || this.isBefore(input,units);
  4800. }
  4801. function diff (input, units, asFloat) {
  4802. var that,
  4803. zoneDelta,
  4804. delta, output;
  4805. if (!this.isValid()) {
  4806. return NaN;
  4807. }
  4808. that = cloneWithOffset(input, this);
  4809. if (!that.isValid()) {
  4810. return NaN;
  4811. }
  4812. zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
  4813. units = normalizeUnits(units);
  4814. switch (units) {
  4815. case 'year': output = monthDiff(this, that) / 12; break;
  4816. case 'month': output = monthDiff(this, that); break;
  4817. case 'quarter': output = monthDiff(this, that) / 3; break;
  4818. case 'second': output = (this - that) / 1e3; break; // 1000
  4819. case 'minute': output = (this - that) / 6e4; break; // 1000 * 60
  4820. case 'hour': output = (this - that) / 36e5; break; // 1000 * 60 * 60
  4821. case 'day': output = (this - that - zoneDelta) / 864e5; break; // 1000 * 60 * 60 * 24, negate dst
  4822. case 'week': output = (this - that - zoneDelta) / 6048e5; break; // 1000 * 60 * 60 * 24 * 7, negate dst
  4823. default: output = this - that;
  4824. }
  4825. return asFloat ? output : absFloor(output);
  4826. }
  4827. function monthDiff (a, b) {
  4828. // difference in months
  4829. var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
  4830. // b is in (anchor - 1 month, anchor + 1 month)
  4831. anchor = a.clone().add(wholeMonthDiff, 'months'),
  4832. anchor2, adjust;
  4833. if (b - anchor < 0) {
  4834. anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
  4835. // linear across the month
  4836. adjust = (b - anchor) / (anchor - anchor2);
  4837. } else {
  4838. anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
  4839. // linear across the month
  4840. adjust = (b - anchor) / (anchor2 - anchor);
  4841. }
  4842. //check for negative zero, return zero if negative zero
  4843. return -(wholeMonthDiff + adjust) || 0;
  4844. }
  4845. hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
  4846. hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
  4847. function toString () {
  4848. return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
  4849. }
  4850. function toISOString() {
  4851. if (!this.isValid()) {
  4852. return null;
  4853. }
  4854. var m = this.clone().utc();
  4855. if (m.year() < 0 || m.year() > 9999) {
  4856. return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
  4857. }
  4858. if (isFunction(Date.prototype.toISOString)) {
  4859. // native implementation is ~50x faster, use it when we can
  4860. return this.toDate().toISOString();
  4861. }
  4862. return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
  4863. }
  4864. /**
  4865. * Return a human readable representation of a moment that can
  4866. * also be evaluated to get a new moment which is the same
  4867. *
  4868. * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
  4869. */
  4870. function inspect () {
  4871. if (!this.isValid()) {
  4872. return 'moment.invalid(/* ' + this._i + ' */)';
  4873. }
  4874. var func = 'moment';
  4875. var zone = '';
  4876. if (!this.isLocal()) {
  4877. func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
  4878. zone = 'Z';
  4879. }
  4880. var prefix = '[' + func + '("]';
  4881. var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';
  4882. var datetime = '-MM-DD[T]HH:mm:ss.SSS';
  4883. var suffix = zone + '[")]';
  4884. return this.format(prefix + year + datetime + suffix);
  4885. }
  4886. function format (inputString) {
  4887. if (!inputString) {
  4888. inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
  4889. }
  4890. var output = formatMoment(this, inputString);
  4891. return this.localeData().postformat(output);
  4892. }
  4893. function from (time, withoutSuffix) {
  4894. if (this.isValid() &&
  4895. ((isMoment(time) && time.isValid()) ||
  4896. createLocal(time).isValid())) {
  4897. return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
  4898. } else {
  4899. return this.localeData().invalidDate();
  4900. }
  4901. }
  4902. function fromNow (withoutSuffix) {
  4903. return this.from(createLocal(), withoutSuffix);
  4904. }
  4905. function to (time, withoutSuffix) {
  4906. if (this.isValid() &&
  4907. ((isMoment(time) && time.isValid()) ||
  4908. createLocal(time).isValid())) {
  4909. return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
  4910. } else {
  4911. return this.localeData().invalidDate();
  4912. }
  4913. }
  4914. function toNow (withoutSuffix) {
  4915. return this.to(createLocal(), withoutSuffix);
  4916. }
  4917. // If passed a locale key, it will set the locale for this
  4918. // instance. Otherwise, it will return the locale configuration
  4919. // variables for this instance.
  4920. function locale (key) {
  4921. var newLocaleData;
  4922. if (key === undefined) {
  4923. return this._locale._abbr;
  4924. } else {
  4925. newLocaleData = getLocale(key);
  4926. if (newLocaleData != null) {
  4927. this._locale = newLocaleData;
  4928. }
  4929. return this;
  4930. }
  4931. }
  4932. var lang = deprecate(
  4933. 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
  4934. function (key) {
  4935. if (key === undefined) {
  4936. return this.localeData();
  4937. } else {
  4938. return this.locale(key);
  4939. }
  4940. }
  4941. );
  4942. function localeData () {
  4943. return this._locale;
  4944. }
  4945. function startOf (units) {
  4946. units = normalizeUnits(units);
  4947. // the following switch intentionally omits break keywords
  4948. // to utilize falling through the cases.
  4949. switch (units) {
  4950. case 'year':
  4951. this.month(0);
  4952. /* falls through */
  4953. case 'quarter':
  4954. case 'month':
  4955. this.date(1);
  4956. /* falls through */
  4957. case 'week':
  4958. case 'isoWeek':
  4959. case 'day':
  4960. case 'date':
  4961. this.hours(0);
  4962. /* falls through */
  4963. case 'hour':
  4964. this.minutes(0);
  4965. /* falls through */
  4966. case 'minute':
  4967. this.seconds(0);
  4968. /* falls through */
  4969. case 'second':
  4970. this.milliseconds(0);
  4971. }
  4972. // weeks are a special case
  4973. if (units === 'week') {
  4974. this.weekday(0);
  4975. }
  4976. if (units === 'isoWeek') {
  4977. this.isoWeekday(1);
  4978. }
  4979. // quarters are also special
  4980. if (units === 'quarter') {
  4981. this.month(Math.floor(this.month() / 3) * 3);
  4982. }
  4983. return this;
  4984. }
  4985. function endOf (units) {
  4986. units = normalizeUnits(units);
  4987. if (units === undefined || units === 'millisecond') {
  4988. return this;
  4989. }
  4990. // 'date' is an alias for 'day', so it should be considered as such.
  4991. if (units === 'date') {
  4992. units = 'day';
  4993. }
  4994. return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
  4995. }
  4996. function valueOf () {
  4997. return this._d.valueOf() - ((this._offset || 0) * 60000);
  4998. }
  4999. function unix () {
  5000. return Math.floor(this.valueOf() / 1000);
  5001. }
  5002. function toDate () {
  5003. return new Date(this.valueOf());
  5004. }
  5005. function toArray () {
  5006. var m = this;
  5007. return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
  5008. }
  5009. function toObject () {
  5010. var m = this;
  5011. return {
  5012. years: m.year(),
  5013. months: m.month(),
  5014. date: m.date(),
  5015. hours: m.hours(),
  5016. minutes: m.minutes(),
  5017. seconds: m.seconds(),
  5018. milliseconds: m.milliseconds()
  5019. };
  5020. }
  5021. function toJSON () {
  5022. // new Date(NaN).toJSON() === null
  5023. return this.isValid() ? this.toISOString() : null;
  5024. }
  5025. function isValid$2 () {
  5026. return isValid(this);
  5027. }
  5028. function parsingFlags () {
  5029. return extend({}, getParsingFlags(this));
  5030. }
  5031. function invalidAt () {
  5032. return getParsingFlags(this).overflow;
  5033. }
  5034. function creationData() {
  5035. return {
  5036. input: this._i,
  5037. format: this._f,
  5038. locale: this._locale,
  5039. isUTC: this._isUTC,
  5040. strict: this._strict
  5041. };
  5042. }
  5043. // FORMATTING
  5044. addFormatToken(0, ['gg', 2], 0, function () {
  5045. return this.weekYear() % 100;
  5046. });
  5047. addFormatToken(0, ['GG', 2], 0, function () {
  5048. return this.isoWeekYear() % 100;
  5049. });
  5050. function addWeekYearFormatToken (token, getter) {
  5051. addFormatToken(0, [token, token.length], 0, getter);
  5052. }
  5053. addWeekYearFormatToken('gggg', 'weekYear');
  5054. addWeekYearFormatToken('ggggg', 'weekYear');
  5055. addWeekYearFormatToken('GGGG', 'isoWeekYear');
  5056. addWeekYearFormatToken('GGGGG', 'isoWeekYear');
  5057. // ALIASES
  5058. addUnitAlias('weekYear', 'gg');
  5059. addUnitAlias('isoWeekYear', 'GG');
  5060. // PRIORITY
  5061. addUnitPriority('weekYear', 1);
  5062. addUnitPriority('isoWeekYear', 1);
  5063. // PARSING
  5064. addRegexToken('G', matchSigned);
  5065. addRegexToken('g', matchSigned);
  5066. addRegexToken('GG', match1to2, match2);
  5067. addRegexToken('gg', match1to2, match2);
  5068. addRegexToken('GGGG', match1to4, match4);
  5069. addRegexToken('gggg', match1to4, match4);
  5070. addRegexToken('GGGGG', match1to6, match6);
  5071. addRegexToken('ggggg', match1to6, match6);
  5072. addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
  5073. week[token.substr(0, 2)] = toInt(input);
  5074. });
  5075. addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
  5076. week[token] = hooks.parseTwoDigitYear(input);
  5077. });
  5078. // MOMENTS
  5079. function getSetWeekYear (input) {
  5080. return getSetWeekYearHelper.call(this,
  5081. input,
  5082. this.week(),
  5083. this.weekday(),
  5084. this.localeData()._week.dow,
  5085. this.localeData()._week.doy);
  5086. }
  5087. function getSetISOWeekYear (input) {
  5088. return getSetWeekYearHelper.call(this,
  5089. input, this.isoWeek(), this.isoWeekday(), 1, 4);
  5090. }
  5091. function getISOWeeksInYear () {
  5092. return weeksInYear(this.year(), 1, 4);
  5093. }
  5094. function getWeeksInYear () {
  5095. var weekInfo = this.localeData()._week;
  5096. return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
  5097. }
  5098. function getSetWeekYearHelper(input, week, weekday, dow, doy) {
  5099. var weeksTarget;
  5100. if (input == null) {
  5101. return weekOfYear(this, dow, doy).year;
  5102. } else {
  5103. weeksTarget = weeksInYear(input, dow, doy);
  5104. if (week > weeksTarget) {
  5105. week = weeksTarget;
  5106. }
  5107. return setWeekAll.call(this, input, week, weekday, dow, doy);
  5108. }
  5109. }
  5110. function setWeekAll(weekYear, week, weekday, dow, doy) {
  5111. var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
  5112. date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
  5113. this.year(date.getUTCFullYear());
  5114. this.month(date.getUTCMonth());
  5115. this.date(date.getUTCDate());
  5116. return this;
  5117. }
  5118. // FORMATTING
  5119. addFormatToken('Q', 0, 'Qo', 'quarter');
  5120. // ALIASES
  5121. addUnitAlias('quarter', 'Q');
  5122. // PRIORITY
  5123. addUnitPriority('quarter', 7);
  5124. // PARSING
  5125. addRegexToken('Q', match1);
  5126. addParseToken('Q', function (input, array) {
  5127. array[MONTH] = (toInt(input) - 1) * 3;
  5128. });
  5129. // MOMENTS
  5130. function getSetQuarter (input) {
  5131. return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
  5132. }
  5133. // FORMATTING
  5134. addFormatToken('D', ['DD', 2], 'Do', 'date');
  5135. // ALIASES
  5136. addUnitAlias('date', 'D');
  5137. // PRIOROITY
  5138. addUnitPriority('date', 9);
  5139. // PARSING
  5140. addRegexToken('D', match1to2);
  5141. addRegexToken('DD', match1to2, match2);
  5142. addRegexToken('Do', function (isStrict, locale) {
  5143. // TODO: Remove "ordinalParse" fallback in next major release.
  5144. return isStrict ?
  5145. (locale._dayOfMonthOrdinalParse || locale._ordinalParse) :
  5146. locale._dayOfMonthOrdinalParseLenient;
  5147. });
  5148. addParseToken(['D', 'DD'], DATE);
  5149. addParseToken('Do', function (input, array) {
  5150. array[DATE] = toInt(input.match(match1to2)[0], 10);
  5151. });
  5152. // MOMENTS
  5153. var getSetDayOfMonth = makeGetSet('Date', true);
  5154. // FORMATTING
  5155. addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
  5156. // ALIASES
  5157. addUnitAlias('dayOfYear', 'DDD');
  5158. // PRIORITY
  5159. addUnitPriority('dayOfYear', 4);
  5160. // PARSING
  5161. addRegexToken('DDD', match1to3);
  5162. addRegexToken('DDDD', match3);
  5163. addParseToken(['DDD', 'DDDD'], function (input, array, config) {
  5164. config._dayOfYear = toInt(input);
  5165. });
  5166. // HELPERS
  5167. // MOMENTS
  5168. function getSetDayOfYear (input) {
  5169. var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
  5170. return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
  5171. }
  5172. // FORMATTING
  5173. addFormatToken('m', ['mm', 2], 0, 'minute');
  5174. // ALIASES
  5175. addUnitAlias('minute', 'm');
  5176. // PRIORITY
  5177. addUnitPriority('minute', 14);
  5178. // PARSING
  5179. addRegexToken('m', match1to2);
  5180. addRegexToken('mm', match1to2, match2);
  5181. addParseToken(['m', 'mm'], MINUTE);
  5182. // MOMENTS
  5183. var getSetMinute = makeGetSet('Minutes', false);
  5184. // FORMATTING
  5185. addFormatToken('s', ['ss', 2], 0, 'second');
  5186. // ALIASES
  5187. addUnitAlias('second', 's');
  5188. // PRIORITY
  5189. addUnitPriority('second', 15);
  5190. // PARSING
  5191. addRegexToken('s', match1to2);
  5192. addRegexToken('ss', match1to2, match2);
  5193. addParseToken(['s', 'ss'], SECOND);
  5194. // MOMENTS
  5195. var getSetSecond = makeGetSet('Seconds', false);
  5196. // FORMATTING
  5197. addFormatToken('S', 0, 0, function () {
  5198. return ~~(this.millisecond() / 100);
  5199. });
  5200. addFormatToken(0, ['SS', 2], 0, function () {
  5201. return ~~(this.millisecond() / 10);
  5202. });
  5203. addFormatToken(0, ['SSS', 3], 0, 'millisecond');
  5204. addFormatToken(0, ['SSSS', 4], 0, function () {
  5205. return this.millisecond() * 10;
  5206. });
  5207. addFormatToken(0, ['SSSSS', 5], 0, function () {
  5208. return this.millisecond() * 100;
  5209. });
  5210. addFormatToken(0, ['SSSSSS', 6], 0, function () {
  5211. return this.millisecond() * 1000;
  5212. });
  5213. addFormatToken(0, ['SSSSSSS', 7], 0, function () {
  5214. return this.millisecond() * 10000;
  5215. });
  5216. addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
  5217. return this.millisecond() * 100000;
  5218. });
  5219. addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
  5220. return this.millisecond() * 1000000;
  5221. });
  5222. // ALIASES
  5223. addUnitAlias('millisecond', 'ms');
  5224. // PRIORITY
  5225. addUnitPriority('millisecond', 16);
  5226. // PARSING
  5227. addRegexToken('S', match1to3, match1);
  5228. addRegexToken('SS', match1to3, match2);
  5229. addRegexToken('SSS', match1to3, match3);
  5230. var token;
  5231. for (token = 'SSSS'; token.length <= 9; token += 'S') {
  5232. addRegexToken(token, matchUnsigned);
  5233. }
  5234. function parseMs(input, array) {
  5235. array[MILLISECOND] = toInt(('0.' + input) * 1000);
  5236. }
  5237. for (token = 'S'; token.length <= 9; token += 'S') {
  5238. addParseToken(token, parseMs);
  5239. }
  5240. // MOMENTS
  5241. var getSetMillisecond = makeGetSet('Milliseconds', false);
  5242. // FORMATTING
  5243. addFormatToken('z', 0, 0, 'zoneAbbr');
  5244. addFormatToken('zz', 0, 0, 'zoneName');
  5245. // MOMENTS
  5246. function getZoneAbbr () {
  5247. return this._isUTC ? 'UTC' : '';
  5248. }
  5249. function getZoneName () {
  5250. return this._isUTC ? 'Coordinated Universal Time' : '';
  5251. }
  5252. var proto = Moment.prototype;
  5253. proto.add = add;
  5254. proto.calendar = calendar$1;
  5255. proto.clone = clone;
  5256. proto.diff = diff;
  5257. proto.endOf = endOf;
  5258. proto.format = format;
  5259. proto.from = from;
  5260. proto.fromNow = fromNow;
  5261. proto.to = to;
  5262. proto.toNow = toNow;
  5263. proto.get = stringGet;
  5264. proto.invalidAt = invalidAt;
  5265. proto.isAfter = isAfter;
  5266. proto.isBefore = isBefore;
  5267. proto.isBetween = isBetween;
  5268. proto.isSame = isSame;
  5269. proto.isSameOrAfter = isSameOrAfter;
  5270. proto.isSameOrBefore = isSameOrBefore;
  5271. proto.isValid = isValid$2;
  5272. proto.lang = lang;
  5273. proto.locale = locale;
  5274. proto.localeData = localeData;
  5275. proto.max = prototypeMax;
  5276. proto.min = prototypeMin;
  5277. proto.parsingFlags = parsingFlags;
  5278. proto.set = stringSet;
  5279. proto.startOf = startOf;
  5280. proto.subtract = subtract;
  5281. proto.toArray = toArray;
  5282. proto.toObject = toObject;
  5283. proto.toDate = toDate;
  5284. proto.toISOString = toISOString;
  5285. proto.inspect = inspect;
  5286. proto.toJSON = toJSON;
  5287. proto.toString = toString;
  5288. proto.unix = unix;
  5289. proto.valueOf = valueOf;
  5290. proto.creationData = creationData;
  5291. // Year
  5292. proto.year = getSetYear;
  5293. proto.isLeapYear = getIsLeapYear;
  5294. // Week Year
  5295. proto.weekYear = getSetWeekYear;
  5296. proto.isoWeekYear = getSetISOWeekYear;
  5297. // Quarter
  5298. proto.quarter = proto.quarters = getSetQuarter;
  5299. // Month
  5300. proto.month = getSetMonth;
  5301. proto.daysInMonth = getDaysInMonth;
  5302. // Week
  5303. proto.week = proto.weeks = getSetWeek;
  5304. proto.isoWeek = proto.isoWeeks = getSetISOWeek;
  5305. proto.weeksInYear = getWeeksInYear;
  5306. proto.isoWeeksInYear = getISOWeeksInYear;
  5307. // Day
  5308. proto.date = getSetDayOfMonth;
  5309. proto.day = proto.days = getSetDayOfWeek;
  5310. proto.weekday = getSetLocaleDayOfWeek;
  5311. proto.isoWeekday = getSetISODayOfWeek;
  5312. proto.dayOfYear = getSetDayOfYear;
  5313. // Hour
  5314. proto.hour = proto.hours = getSetHour;
  5315. // Minute
  5316. proto.minute = proto.minutes = getSetMinute;
  5317. // Second
  5318. proto.second = proto.seconds = getSetSecond;
  5319. // Millisecond
  5320. proto.millisecond = proto.milliseconds = getSetMillisecond;
  5321. // Offset
  5322. proto.utcOffset = getSetOffset;
  5323. proto.utc = setOffsetToUTC;
  5324. proto.local = setOffsetToLocal;
  5325. proto.parseZone = setOffsetToParsedOffset;
  5326. proto.hasAlignedHourOffset = hasAlignedHourOffset;
  5327. proto.isDST = isDaylightSavingTime;
  5328. proto.isLocal = isLocal;
  5329. proto.isUtcOffset = isUtcOffset;
  5330. proto.isUtc = isUtc;
  5331. proto.isUTC = isUtc;
  5332. // Timezone
  5333. proto.zoneAbbr = getZoneAbbr;
  5334. proto.zoneName = getZoneName;
  5335. // Deprecations
  5336. proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
  5337. proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
  5338. proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
  5339. proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
  5340. proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);
  5341. function createUnix (input) {
  5342. return createLocal(input * 1000);
  5343. }
  5344. function createInZone () {
  5345. return createLocal.apply(null, arguments).parseZone();
  5346. }
  5347. function preParsePostFormat (string) {
  5348. return string;
  5349. }
  5350. var proto$1 = Locale.prototype;
  5351. proto$1.calendar = calendar;
  5352. proto$1.longDateFormat = longDateFormat;
  5353. proto$1.invalidDate = invalidDate;
  5354. proto$1.ordinal = ordinal;
  5355. proto$1.preparse = preParsePostFormat;
  5356. proto$1.postformat = preParsePostFormat;
  5357. proto$1.relativeTime = relativeTime;
  5358. proto$1.pastFuture = pastFuture;
  5359. proto$1.set = set;
  5360. // Month
  5361. proto$1.months = localeMonths;
  5362. proto$1.monthsShort = localeMonthsShort;
  5363. proto$1.monthsParse = localeMonthsParse;
  5364. proto$1.monthsRegex = monthsRegex;
  5365. proto$1.monthsShortRegex = monthsShortRegex;
  5366. // Week
  5367. proto$1.week = localeWeek;
  5368. proto$1.firstDayOfYear = localeFirstDayOfYear;
  5369. proto$1.firstDayOfWeek = localeFirstDayOfWeek;
  5370. // Day of Week
  5371. proto$1.weekdays = localeWeekdays;
  5372. proto$1.weekdaysMin = localeWeekdaysMin;
  5373. proto$1.weekdaysShort = localeWeekdaysShort;
  5374. proto$1.weekdaysParse = localeWeekdaysParse;
  5375. proto$1.weekdaysRegex = weekdaysRegex;
  5376. proto$1.weekdaysShortRegex = weekdaysShortRegex;
  5377. proto$1.weekdaysMinRegex = weekdaysMinRegex;
  5378. // Hours
  5379. proto$1.isPM = localeIsPM;
  5380. proto$1.meridiem = localeMeridiem;
  5381. function get$1 (format, index, field, setter) {
  5382. var locale = getLocale();
  5383. var utc = createUTC().set(setter, index);
  5384. return locale[field](utc, format);
  5385. }
  5386. function listMonthsImpl (format, index, field) {
  5387. if (isNumber(format)) {
  5388. index = format;
  5389. format = undefined;
  5390. }
  5391. format = format || '';
  5392. if (index != null) {
  5393. return get$1(format, index, field, 'month');
  5394. }
  5395. var i;
  5396. var out = [];
  5397. for (i = 0; i < 12; i++) {
  5398. out[i] = get$1(format, i, field, 'month');
  5399. }
  5400. return out;
  5401. }
  5402. // ()
  5403. // (5)
  5404. // (fmt, 5)
  5405. // (fmt)
  5406. // (true)
  5407. // (true, 5)
  5408. // (true, fmt, 5)
  5409. // (true, fmt)
  5410. function listWeekdaysImpl (localeSorted, format, index, field) {
  5411. if (typeof localeSorted === 'boolean') {
  5412. if (isNumber(format)) {
  5413. index = format;
  5414. format = undefined;
  5415. }
  5416. format = format || '';
  5417. } else {
  5418. format = localeSorted;
  5419. index = format;
  5420. localeSorted = false;
  5421. if (isNumber(format)) {
  5422. index = format;
  5423. format = undefined;
  5424. }
  5425. format = format || '';
  5426. }
  5427. var locale = getLocale(),
  5428. shift = localeSorted ? locale._week.dow : 0;
  5429. if (index != null) {
  5430. return get$1(format, (index + shift) % 7, field, 'day');
  5431. }
  5432. var i;
  5433. var out = [];
  5434. for (i = 0; i < 7; i++) {
  5435. out[i] = get$1(format, (i + shift) % 7, field, 'day');
  5436. }
  5437. return out;
  5438. }
  5439. function listMonths (format, index) {
  5440. return listMonthsImpl(format, index, 'months');
  5441. }
  5442. function listMonthsShort (format, index) {
  5443. return listMonthsImpl(format, index, 'monthsShort');
  5444. }
  5445. function listWeekdays (localeSorted, format, index) {
  5446. return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
  5447. }
  5448. function listWeekdaysShort (localeSorted, format, index) {
  5449. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
  5450. }
  5451. function listWeekdaysMin (localeSorted, format, index) {
  5452. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
  5453. }
  5454. getSetGlobalLocale('en', {
  5455. dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
  5456. ordinal : function (number) {
  5457. var b = number % 10,
  5458. output = (toInt(number % 100 / 10) === 1) ? 'th' :
  5459. (b === 1) ? 'st' :
  5460. (b === 2) ? 'nd' :
  5461. (b === 3) ? 'rd' : 'th';
  5462. return number + output;
  5463. }
  5464. });
  5465. // Side effect imports
  5466. hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale);
  5467. hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale);
  5468. var mathAbs = Math.abs;
  5469. function abs () {
  5470. var data = this._data;
  5471. this._milliseconds = mathAbs(this._milliseconds);
  5472. this._days = mathAbs(this._days);
  5473. this._months = mathAbs(this._months);
  5474. data.milliseconds = mathAbs(data.milliseconds);
  5475. data.seconds = mathAbs(data.seconds);
  5476. data.minutes = mathAbs(data.minutes);
  5477. data.hours = mathAbs(data.hours);
  5478. data.months = mathAbs(data.months);
  5479. data.years = mathAbs(data.years);
  5480. return this;
  5481. }
  5482. function addSubtract$1 (duration, input, value, direction) {
  5483. var other = createDuration(input, value);
  5484. duration._milliseconds += direction * other._milliseconds;
  5485. duration._days += direction * other._days;
  5486. duration._months += direction * other._months;
  5487. return duration._bubble();
  5488. }
  5489. // supports only 2.0-style add(1, 's') or add(duration)
  5490. function add$1 (input, value) {
  5491. return addSubtract$1(this, input, value, 1);
  5492. }
  5493. // supports only 2.0-style subtract(1, 's') or subtract(duration)
  5494. function subtract$1 (input, value) {
  5495. return addSubtract$1(this, input, value, -1);
  5496. }
  5497. function absCeil (number) {
  5498. if (number < 0) {
  5499. return Math.floor(number);
  5500. } else {
  5501. return Math.ceil(number);
  5502. }
  5503. }
  5504. function bubble () {
  5505. var milliseconds = this._milliseconds;
  5506. var days = this._days;
  5507. var months = this._months;
  5508. var data = this._data;
  5509. var seconds, minutes, hours, years, monthsFromDays;
  5510. // if we have a mix of positive and negative values, bubble down first
  5511. // check: https://github.com/moment/moment/issues/2166
  5512. if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
  5513. (milliseconds <= 0 && days <= 0 && months <= 0))) {
  5514. milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
  5515. days = 0;
  5516. months = 0;
  5517. }
  5518. // The following code bubbles up values, see the tests for
  5519. // examples of what that means.
  5520. data.milliseconds = milliseconds % 1000;
  5521. seconds = absFloor(milliseconds / 1000);
  5522. data.seconds = seconds % 60;
  5523. minutes = absFloor(seconds / 60);
  5524. data.minutes = minutes % 60;
  5525. hours = absFloor(minutes / 60);
  5526. data.hours = hours % 24;
  5527. days += absFloor(hours / 24);
  5528. // convert days to months
  5529. monthsFromDays = absFloor(daysToMonths(days));
  5530. months += monthsFromDays;
  5531. days -= absCeil(monthsToDays(monthsFromDays));
  5532. // 12 months -> 1 year
  5533. years = absFloor(months / 12);
  5534. months %= 12;
  5535. data.days = days;
  5536. data.months = months;
  5537. data.years = years;
  5538. return this;
  5539. }
  5540. function daysToMonths (days) {
  5541. // 400 years have 146097 days (taking into account leap year rules)
  5542. // 400 years have 12 months === 4800
  5543. return days * 4800 / 146097;
  5544. }
  5545. function monthsToDays (months) {
  5546. // the reverse of daysToMonths
  5547. return months * 146097 / 4800;
  5548. }
  5549. function as (units) {
  5550. if (!this.isValid()) {
  5551. return NaN;
  5552. }
  5553. var days;
  5554. var months;
  5555. var milliseconds = this._milliseconds;
  5556. units = normalizeUnits(units);
  5557. if (units === 'month' || units === 'year') {
  5558. days = this._days + milliseconds / 864e5;
  5559. months = this._months + daysToMonths(days);
  5560. return units === 'month' ? months : months / 12;
  5561. } else {
  5562. // handle milliseconds separately because of floating point math errors (issue #1867)
  5563. days = this._days + Math.round(monthsToDays(this._months));
  5564. switch (units) {
  5565. case 'week' : return days / 7 + milliseconds / 6048e5;
  5566. case 'day' : return days + milliseconds / 864e5;
  5567. case 'hour' : return days * 24 + milliseconds / 36e5;
  5568. case 'minute' : return days * 1440 + milliseconds / 6e4;
  5569. case 'second' : return days * 86400 + milliseconds / 1000;
  5570. // Math.floor prevents floating point math errors here
  5571. case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
  5572. default: throw new Error('Unknown unit ' + units);
  5573. }
  5574. }
  5575. }
  5576. // TODO: Use this.as('ms')?
  5577. function valueOf$1 () {
  5578. if (!this.isValid()) {
  5579. return NaN;
  5580. }
  5581. return (
  5582. this._milliseconds +
  5583. this._days * 864e5 +
  5584. (this._months % 12) * 2592e6 +
  5585. toInt(this._months / 12) * 31536e6
  5586. );
  5587. }
  5588. function makeAs (alias) {
  5589. return function () {
  5590. return this.as(alias);
  5591. };
  5592. }
  5593. var asMilliseconds = makeAs('ms');
  5594. var asSeconds = makeAs('s');
  5595. var asMinutes = makeAs('m');
  5596. var asHours = makeAs('h');
  5597. var asDays = makeAs('d');
  5598. var asWeeks = makeAs('w');
  5599. var asMonths = makeAs('M');
  5600. var asYears = makeAs('y');
  5601. function clone$1 () {
  5602. return createDuration(this);
  5603. }
  5604. function get$2 (units) {
  5605. units = normalizeUnits(units);
  5606. return this.isValid() ? this[units + 's']() : NaN;
  5607. }
  5608. function makeGetter(name) {
  5609. return function () {
  5610. return this.isValid() ? this._data[name] : NaN;
  5611. };
  5612. }
  5613. var milliseconds = makeGetter('milliseconds');
  5614. var seconds = makeGetter('seconds');
  5615. var minutes = makeGetter('minutes');
  5616. var hours = makeGetter('hours');
  5617. var days = makeGetter('days');
  5618. var months = makeGetter('months');
  5619. var years = makeGetter('years');
  5620. function weeks () {
  5621. return absFloor(this.days() / 7);
  5622. }
  5623. var round = Math.round;
  5624. var thresholds = {
  5625. ss: 44, // a few seconds to seconds
  5626. s : 45, // seconds to minute
  5627. m : 45, // minutes to hour
  5628. h : 22, // hours to day
  5629. d : 26, // days to month
  5630. M : 11 // months to year
  5631. };
  5632. // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
  5633. function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
  5634. return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
  5635. }
  5636. function relativeTime$1 (posNegDuration, withoutSuffix, locale) {
  5637. var duration = createDuration(posNegDuration).abs();
  5638. var seconds = round(duration.as('s'));
  5639. var minutes = round(duration.as('m'));
  5640. var hours = round(duration.as('h'));
  5641. var days = round(duration.as('d'));
  5642. var months = round(duration.as('M'));
  5643. var years = round(duration.as('y'));
  5644. var a = seconds <= thresholds.ss && ['s', seconds] ||
  5645. seconds < thresholds.s && ['ss', seconds] ||
  5646. minutes <= 1 && ['m'] ||
  5647. minutes < thresholds.m && ['mm', minutes] ||
  5648. hours <= 1 && ['h'] ||
  5649. hours < thresholds.h && ['hh', hours] ||
  5650. days <= 1 && ['d'] ||
  5651. days < thresholds.d && ['dd', days] ||
  5652. months <= 1 && ['M'] ||
  5653. months < thresholds.M && ['MM', months] ||
  5654. years <= 1 && ['y'] || ['yy', years];
  5655. a[2] = withoutSuffix;
  5656. a[3] = +posNegDuration > 0;
  5657. a[4] = locale;
  5658. return substituteTimeAgo.apply(null, a);
  5659. }
  5660. // This function allows you to set the rounding function for relative time strings
  5661. function getSetRelativeTimeRounding (roundingFunction) {
  5662. if (roundingFunction === undefined) {
  5663. return round;
  5664. }
  5665. if (typeof(roundingFunction) === 'function') {
  5666. round = roundingFunction;
  5667. return true;
  5668. }
  5669. return false;
  5670. }
  5671. // This function allows you to set a threshold for relative time strings
  5672. function getSetRelativeTimeThreshold (threshold, limit) {
  5673. if (thresholds[threshold] === undefined) {
  5674. return false;
  5675. }
  5676. if (limit === undefined) {
  5677. return thresholds[threshold];
  5678. }
  5679. thresholds[threshold] = limit;
  5680. if (threshold === 's') {
  5681. thresholds.ss = limit - 1;
  5682. }
  5683. return true;
  5684. }
  5685. function humanize (withSuffix) {
  5686. if (!this.isValid()) {
  5687. return this.localeData().invalidDate();
  5688. }
  5689. var locale = this.localeData();
  5690. var output = relativeTime$1(this, !withSuffix, locale);
  5691. if (withSuffix) {
  5692. output = locale.pastFuture(+this, output);
  5693. }
  5694. return locale.postformat(output);
  5695. }
  5696. var abs$1 = Math.abs;
  5697. function sign(x) {
  5698. return ((x > 0) - (x < 0)) || +x;
  5699. }
  5700. function toISOString$1() {
  5701. // for ISO strings we do not use the normal bubbling rules:
  5702. // * milliseconds bubble up until they become hours
  5703. // * days do not bubble at all
  5704. // * months bubble up until they become years
  5705. // This is because there is no context-free conversion between hours and days
  5706. // (think of clock changes)
  5707. // and also not between days and months (28-31 days per month)
  5708. if (!this.isValid()) {
  5709. return this.localeData().invalidDate();
  5710. }
  5711. var seconds = abs$1(this._milliseconds) / 1000;
  5712. var days = abs$1(this._days);
  5713. var months = abs$1(this._months);
  5714. var minutes, hours, years;
  5715. // 3600 seconds -> 60 minutes -> 1 hour
  5716. minutes = absFloor(seconds / 60);
  5717. hours = absFloor(minutes / 60);
  5718. seconds %= 60;
  5719. minutes %= 60;
  5720. // 12 months -> 1 year
  5721. years = absFloor(months / 12);
  5722. months %= 12;
  5723. // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
  5724. var Y = years;
  5725. var M = months;
  5726. var D = days;
  5727. var h = hours;
  5728. var m = minutes;
  5729. var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
  5730. var total = this.asSeconds();
  5731. if (!total) {
  5732. // this is the same as C#'s (Noda) and python (isodate)...
  5733. // but not other JS (goog.date)
  5734. return 'P0D';
  5735. }
  5736. var totalSign = total < 0 ? '-' : '';
  5737. var ymSign = sign(this._months) !== sign(total) ? '-' : '';
  5738. var daysSign = sign(this._days) !== sign(total) ? '-' : '';
  5739. var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
  5740. return totalSign + 'P' +
  5741. (Y ? ymSign + Y + 'Y' : '') +
  5742. (M ? ymSign + M + 'M' : '') +
  5743. (D ? daysSign + D + 'D' : '') +
  5744. ((h || m || s) ? 'T' : '') +
  5745. (h ? hmsSign + h + 'H' : '') +
  5746. (m ? hmsSign + m + 'M' : '') +
  5747. (s ? hmsSign + s + 'S' : '');
  5748. }
  5749. var proto$2 = Duration.prototype;
  5750. proto$2.isValid = isValid$1;
  5751. proto$2.abs = abs;
  5752. proto$2.add = add$1;
  5753. proto$2.subtract = subtract$1;
  5754. proto$2.as = as;
  5755. proto$2.asMilliseconds = asMilliseconds;
  5756. proto$2.asSeconds = asSeconds;
  5757. proto$2.asMinutes = asMinutes;
  5758. proto$2.asHours = asHours;
  5759. proto$2.asDays = asDays;
  5760. proto$2.asWeeks = asWeeks;
  5761. proto$2.asMonths = asMonths;
  5762. proto$2.asYears = asYears;
  5763. proto$2.valueOf = valueOf$1;
  5764. proto$2._bubble = bubble;
  5765. proto$2.clone = clone$1;
  5766. proto$2.get = get$2;
  5767. proto$2.milliseconds = milliseconds;
  5768. proto$2.seconds = seconds;
  5769. proto$2.minutes = minutes;
  5770. proto$2.hours = hours;
  5771. proto$2.days = days;
  5772. proto$2.weeks = weeks;
  5773. proto$2.months = months;
  5774. proto$2.years = years;
  5775. proto$2.humanize = humanize;
  5776. proto$2.toISOString = toISOString$1;
  5777. proto$2.toString = toISOString$1;
  5778. proto$2.toJSON = toISOString$1;
  5779. proto$2.locale = locale;
  5780. proto$2.localeData = localeData;
  5781. // Deprecations
  5782. proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1);
  5783. proto$2.lang = lang;
  5784. // Side effect imports
  5785. // FORMATTING
  5786. addFormatToken('X', 0, 0, 'unix');
  5787. addFormatToken('x', 0, 0, 'valueOf');
  5788. // PARSING
  5789. addRegexToken('x', matchSigned);
  5790. addRegexToken('X', matchTimestamp);
  5791. addParseToken('X', function (input, array, config) {
  5792. config._d = new Date(parseFloat(input, 10) * 1000);
  5793. });
  5794. addParseToken('x', function (input, array, config) {
  5795. config._d = new Date(toInt(input));
  5796. });
  5797. // Side effect imports
  5798. hooks.version = '2.19.3';
  5799. setHookCallback(createLocal);
  5800. hooks.fn = proto;
  5801. hooks.min = min;
  5802. hooks.max = max;
  5803. hooks.now = now;
  5804. hooks.utc = createUTC;
  5805. hooks.unix = createUnix;
  5806. hooks.months = listMonths;
  5807. hooks.isDate = isDate;
  5808. hooks.locale = getSetGlobalLocale;
  5809. hooks.invalid = createInvalid;
  5810. hooks.duration = createDuration;
  5811. hooks.isMoment = isMoment;
  5812. hooks.weekdays = listWeekdays;
  5813. hooks.parseZone = createInZone;
  5814. hooks.localeData = getLocale;
  5815. hooks.isDuration = isDuration;
  5816. hooks.monthsShort = listMonthsShort;
  5817. hooks.weekdaysMin = listWeekdaysMin;
  5818. hooks.defineLocale = defineLocale;
  5819. hooks.updateLocale = updateLocale;
  5820. hooks.locales = listLocales;
  5821. hooks.weekdaysShort = listWeekdaysShort;
  5822. hooks.normalizeUnits = normalizeUnits;
  5823. hooks.relativeTimeRounding = getSetRelativeTimeRounding;
  5824. hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
  5825. hooks.calendarFormat = getCalendarFormat;
  5826. hooks.prototype = proto;
  5827. return hooks;
  5828. })));
  5829. define('moment', ['moment/moment'], function (main) { return main; });
  5830. define('backend',['fast', 'moment'], function (Fast, Moment) {
  5831. var Backend = {
  5832. api: {
  5833. sidebar: function (params) {
  5834. colorArr = ['red', 'green', 'yellow', 'blue', 'teal', 'orange', 'purple'];
  5835. $colorNums = colorArr.length;
  5836. badgeList = {};
  5837. $.each(params, function (k, v) {
  5838. $url = Fast.api.fixurl(k);
  5839. if ($.isArray(v))
  5840. {
  5841. $nums = typeof v[0] !== 'undefined' ? v[0] : 0;
  5842. $color = typeof v[1] !== 'undefined' ? v[1] : colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
  5843. $class = typeof v[2] !== 'undefined' ? v[2] : 'label';
  5844. } else
  5845. {
  5846. $nums = v;
  5847. $color = colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
  5848. $class = 'label';
  5849. }
  5850. //必须nums大于0才显示
  5851. badgeList[$url] = $nums > 0 ? '<small class="' + $class + ' pull-right bg-' + $color + '">' + $nums + '</small>' : '';
  5852. });
  5853. $.each(badgeList, function (k, v) {
  5854. var anchor = top.window.$("li a[addtabs][url='" + k + "']");
  5855. if (anchor) {
  5856. top.window.$(".pull-right-container", anchor).html(v);
  5857. top.window.$(".nav-addtabs li a[node-id='" + anchor.attr("addtabs") + "'] .pull-right-container").html(v);
  5858. }
  5859. });
  5860. },
  5861. addtabs: function (url, title, icon) {
  5862. var dom = "a[url='{url}']"
  5863. var leftlink = top.window.$(dom.replace(/\{url\}/, url));
  5864. if (leftlink.size() > 0) {
  5865. leftlink.trigger("click");
  5866. } else {
  5867. url = Fast.api.fixurl(url);
  5868. leftlink = top.window.$(dom.replace(/\{url\}/, url));
  5869. if (leftlink.size() > 0) {
  5870. var event = leftlink.parent().hasClass("active") ? "dblclick" : "click";
  5871. leftlink.trigger(event);
  5872. } else {
  5873. var baseurl = url.substr(0, url.indexOf("?") > -1 ? url.indexOf("?") : url.length);
  5874. leftlink = top.window.$(dom.replace(/\{url\}/, baseurl));
  5875. //能找到相对地址
  5876. if (leftlink.size() > 0) {
  5877. icon = typeof icon !== 'undefined' ? icon : leftlink.find("i").attr("class");
  5878. title = typeof title !== 'undefined' ? title : leftlink.find("span:first").text();
  5879. leftlink.trigger("fa.event.toggleitem");
  5880. }
  5881. var navnode = top.window.$(".nav-tabs ul li a[node-url='" + url + "']");
  5882. if (navnode.size() > 0) {
  5883. navnode.trigger("click");
  5884. } else {
  5885. //追加新的tab
  5886. var id = Math.floor(new Date().valueOf() * Math.random());
  5887. icon = typeof icon !== 'undefined' ? icon : 'fa fa-circle-o';
  5888. title = typeof title !== 'undefined' ? title : '';
  5889. top.window.$("<a />").append('<i class="' + icon + '"></i> <span>' + title + '</span>').prop("href", url).attr({url: url, addtabs: id}).addClass("hide").appendTo(top.window.document.body).trigger("click");
  5890. }
  5891. }
  5892. }
  5893. },
  5894. closetabs: function (url) {
  5895. if (typeof url === 'undefined') {
  5896. top.window.$("ul.nav-addtabs li.active .close-tab").trigger("click");
  5897. } else {
  5898. var dom = "a[url='{url}']"
  5899. var navlink = top.window.$(dom.replace(/\{url\}/, url));
  5900. if (navlink.size() === 0) {
  5901. url = Fast.api.fixurl(url);
  5902. navlink = top.window.$(dom.replace(/\{url\}/, url));
  5903. if (navlink.size() === 0) {
  5904. } else {
  5905. var baseurl = url.substr(0, url.indexOf("?") > -1 ? url.indexOf("?") : url.length);
  5906. navlink = top.window.$(dom.replace(/\{url\}/, baseurl));
  5907. //能找到相对地址
  5908. if (navlink.size() === 0) {
  5909. navlink = top.window.$(".nav-tabs ul li a[node-url='" + url + "']");
  5910. }
  5911. }
  5912. }
  5913. if (navlink.size() > 0 && navlink.attr('addtabs')) {
  5914. top.window.$("ul.nav-addtabs li#tab_" + navlink.attr('addtabs') + " .close-tab").trigger("click");
  5915. }
  5916. }
  5917. },
  5918. replaceids: function (elem, url) {
  5919. //如果有需要替换ids的
  5920. if (url.indexOf("{ids}") > -1) {
  5921. var ids = 0;
  5922. var tableId = $(elem).data("table-id");
  5923. if (tableId && $(tableId).size() > 0 && $(tableId).data("bootstrap.table")) {
  5924. var Table = require("table");
  5925. ids = Table.api.selectedids($(tableId)).join(",");
  5926. }
  5927. url = url.replace(/\{ids\}/g, ids);
  5928. }
  5929. return url;
  5930. }
  5931. },
  5932. init: function () {
  5933. //公共代码
  5934. //添加ios-fix兼容iOS下的iframe
  5935. if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
  5936. $("html").addClass("ios-fix");
  5937. }
  5938. //配置Toastr的参数
  5939. Toastr.options.positionClass = Config.controllername === 'index' ? "toast-top-right-index" : "toast-top-right";
  5940. //点击包含.btn-dialog的元素时弹出dialog
  5941. $(document).on('click', '.btn-dialog,.dialogit', function (e) {
  5942. var that = this;
  5943. var options = $.extend({}, $(that).data() || {});
  5944. if (typeof options.tableId !== 'undefined' && typeof options.columnIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') {
  5945. var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions');
  5946. if (tableOptions) {
  5947. var button = tableOptions.columns[0][options.columnIndex]['buttons'][options.buttonIndex];
  5948. if (button && typeof button.callback === 'function') {
  5949. options.callback = button.callback;
  5950. }
  5951. }
  5952. }
  5953. if (typeof options.confirm !== 'undefined') {
  5954. Layer.confirm(options.confirm, function (index) {
  5955. Backend.api.open(Backend.api.replaceids(that, $(that).attr('href')), $(that).attr('title'), options);
  5956. Layer.close(index);
  5957. });
  5958. } else {
  5959. Backend.api.open(Backend.api.replaceids(that, $(that).attr('href')), $(that).attr('title'), options);
  5960. }
  5961. return false;
  5962. });
  5963. //点击包含.btn-addtabs的元素时新增选项卡
  5964. $(document).on('click', '.btn-addtabs,.addtabsit', function (e) {
  5965. var that = this;
  5966. var options = $.extend({}, $(that).data() || {});
  5967. if (typeof options.confirm !== 'undefined') {
  5968. Layer.confirm(options.confirm, function (index) {
  5969. Backend.api.addtabs(Backend.api.replaceids(that, $(that).attr('href')), $(that).attr("title"));
  5970. Layer.close(index);
  5971. });
  5972. } else {
  5973. Backend.api.addtabs(Backend.api.replaceids(that, $(that).attr('href')), $(that).attr("title"));
  5974. }
  5975. return false;
  5976. });
  5977. //点击包含.btn-ajax的元素时发送Ajax请求
  5978. $(document).on('click', '.btn-ajax,.ajaxit', function (e) {
  5979. var that = this;
  5980. var options = $.extend({}, $(that).data() || {});
  5981. if (typeof options.url === 'undefined' && $(that).attr("href")) {
  5982. options.url = $(that).attr("href");
  5983. }
  5984. options.url = Backend.api.replaceids(this, options.url);
  5985. var success = typeof options.success === 'function' ? options.success : null;
  5986. var error = typeof options.error === 'function' ? options.error : null;
  5987. delete options.success;
  5988. delete options.error;
  5989. if (typeof options.tableId !== 'undefined' && typeof options.columnIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') {
  5990. var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions');
  5991. if (tableOptions) {
  5992. var button = tableOptions.columns[0][options.columnIndex]['buttons'][options.buttonIndex];
  5993. if (button && typeof button.success === 'function') {
  5994. success = button.success;
  5995. }
  5996. if (button && typeof button.error === 'function') {
  5997. error = button.error;
  5998. }
  5999. }
  6000. }
  6001. //如果未设备成功的回调,设定了自动刷新的情况下自动进行刷新
  6002. if (!success && typeof options.tableId !== 'undefined' && typeof options.refresh !== 'undefined' && options.refresh) {
  6003. $("#" + options.tableId).bootstrapTable('refresh');
  6004. }
  6005. if (typeof options.confirm !== 'undefined') {
  6006. Layer.confirm(options.confirm, function (index) {
  6007. Backend.api.ajax(options, success, error);
  6008. Layer.close(index);
  6009. });
  6010. } else {
  6011. Backend.api.ajax(options, success, error);
  6012. }
  6013. return false;
  6014. });
  6015. //修复含有fixed-footer类的body边距
  6016. if ($(".fixed-footer").size() > 0) {
  6017. $(document.body).css("padding-bottom", $(".fixed-footer").outerHeight());
  6018. }
  6019. //修复不在iframe时layer-footer隐藏的问题
  6020. if ($(".layer-footer").size() > 0 && self === top) {
  6021. $(".layer-footer").show();
  6022. }
  6023. }
  6024. };
  6025. Backend.api = $.extend(Fast.api, Backend.api);
  6026. //将Moment渲染至全局,以便于在子框架中调用
  6027. window.Moment = Moment;
  6028. //将Backend渲染至全局,以便于在子框架中调用
  6029. window.Backend = Backend;
  6030. Backend.init();
  6031. return Backend;
  6032. });
  6033. //! moment.js locale configuration
  6034. //! locale : Chinese (China) [zh-cn]
  6035. //! author : suupic : https://github.com/suupic
  6036. //! author : Zeno Zeng : https://github.com/zenozeng
  6037. ;(function (global, factory) {
  6038. typeof exports === 'object' && typeof module !== 'undefined'
  6039. && typeof require === 'function' ? factory(require('../moment')) :
  6040. typeof define === 'function' && define.amd ? define('moment/locale/zh-cn',['../moment'], factory) :
  6041. factory(global.moment)
  6042. }(this, (function (moment) { 'use strict';
  6043. var zhCn = moment.defineLocale('zh-cn', {
  6044. months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
  6045. monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
  6046. weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  6047. weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'),
  6048. weekdaysMin : '日_一_二_三_四_五_六'.split('_'),
  6049. longDateFormat : {
  6050. LT : 'HH:mm',
  6051. LTS : 'HH:mm:ss',
  6052. L : 'YYYY年MMMD日',
  6053. LL : 'YYYY年MMMD日',
  6054. LLL : 'YYYY年MMMD日Ah点mm分',
  6055. LLLL : 'YYYY年MMMD日ddddAh点mm分',
  6056. l : 'YYYY年MMMD日',
  6057. ll : 'YYYY年MMMD日',
  6058. lll : 'YYYY年MMMD日 HH:mm',
  6059. llll : 'YYYY年MMMD日dddd HH:mm'
  6060. },
  6061. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  6062. meridiemHour: function (hour, meridiem) {
  6063. if (hour === 12) {
  6064. hour = 0;
  6065. }
  6066. if (meridiem === '凌晨' || meridiem === '早上' ||
  6067. meridiem === '上午') {
  6068. return hour;
  6069. } else if (meridiem === '下午' || meridiem === '晚上') {
  6070. return hour + 12;
  6071. } else {
  6072. // '中午'
  6073. return hour >= 11 ? hour : hour + 12;
  6074. }
  6075. },
  6076. meridiem : function (hour, minute, isLower) {
  6077. var hm = hour * 100 + minute;
  6078. if (hm < 600) {
  6079. return '凌晨';
  6080. } else if (hm < 900) {
  6081. return '早上';
  6082. } else if (hm < 1130) {
  6083. return '上午';
  6084. } else if (hm < 1230) {
  6085. return '中午';
  6086. } else if (hm < 1800) {
  6087. return '下午';
  6088. } else {
  6089. return '晚上';
  6090. }
  6091. },
  6092. calendar : {
  6093. sameDay : '[今天]LT',
  6094. nextDay : '[明天]LT',
  6095. nextWeek : '[下]ddddLT',
  6096. lastDay : '[昨天]LT',
  6097. lastWeek : '[上]ddddLT',
  6098. sameElse : 'L'
  6099. },
  6100. dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/,
  6101. ordinal : function (number, period) {
  6102. switch (period) {
  6103. case 'd':
  6104. case 'D':
  6105. case 'DDD':
  6106. return number + '日';
  6107. case 'M':
  6108. return number + '月';
  6109. case 'w':
  6110. case 'W':
  6111. return number + '周';
  6112. default:
  6113. return number;
  6114. }
  6115. },
  6116. relativeTime : {
  6117. future : '%s内',
  6118. past : '%s前',
  6119. s : '几秒',
  6120. m : '1 分钟',
  6121. mm : '%d 分钟',
  6122. h : '1 小时',
  6123. hh : '%d 小时',
  6124. d : '1 天',
  6125. dd : '%d 天',
  6126. M : '1 个月',
  6127. MM : '%d 个月',
  6128. y : '1 年',
  6129. yy : '%d 年'
  6130. },
  6131. week : {
  6132. // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
  6133. dow : 1, // Monday is the first day of the week.
  6134. doy : 4 // The week that contains Jan 4th is the first week of the year.
  6135. }
  6136. });
  6137. return zhCn;
  6138. })));
  6139. /*
  6140. * bootstrap-table - v1.11.1 - 2017-02-22
  6141. * https://github.com/wenzhixin/bootstrap-table
  6142. * Copyright (c) 2017 zhixin wen
  6143. * Licensed MIT License
  6144. */
  6145. !function(a){"use strict";var b=null,c=function(a){var b=arguments,c=!0,d=1;return a=a.replace(/%s/g,function(){var a=b[d++];return"undefined"==typeof a?(c=!1,""):a}),c?a:""},d=function(b,c,d,e){var f="";return a.each(b,function(a,b){return b[c]===e?(f=b[d],!1):!0}),f},e=function(b,c){var d=-1;return a.each(b,function(a,b){return b.field===c?(d=a,!1):!0}),d},f=function(b){var c,d,e,f=0,g=[];for(c=0;c<b[0].length;c++)f+=b[0][c].colspan||1;for(c=0;c<b.length;c++)for(g[c]=[],d=0;f>d;d++)g[c][d]=!1;for(c=0;c<b.length;c++)for(d=0;d<b[c].length;d++){var h=b[c][d],i=h.rowspan||1,j=h.colspan||1,k=a.inArray(!1,g[c]);for(1===j&&(h.fieldIndex=k,"undefined"==typeof h.field&&(h.field=k)),e=0;i>e;e++)g[c+e][k]=!0;for(e=0;j>e;e++)g[c][k+e]=!0}},g=function(){if(null===b){var c,d,e=a("<p/>").addClass("fixed-table-scroll-inner"),f=a("<div/>").addClass("fixed-table-scroll-outer");f.append(e),a("body").append(f),c=e[0].offsetWidth,f.css("overflow","scroll"),d=e[0].offsetWidth,c===d&&(d=f[0].clientWidth),f.remove(),b=c-d}return b},h=function(b,d,e,f){var g=d;if("string"==typeof d){var h=d.split(".");h.length>1?(g=window,a.each(h,function(a,b){g=g[b]})):g=window[d]}return"object"==typeof g?g:"function"==typeof g?g.apply(b,e||[]):!g&&"string"==typeof d&&c.apply(this,[d].concat(e))?c.apply(this,[d].concat(e)):f},i=function(b,c,d){var e=Object.getOwnPropertyNames(b),f=Object.getOwnPropertyNames(c),g="";if(d&&e.length!==f.length)return!1;for(var h=0;h<e.length;h++)if(g=e[h],a.inArray(g,f)>-1&&b[g]!==c[g])return!1;return!0},j=function(a){return"string"==typeof a?a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/`/g,"&#x60;"):a},k=function(a){for(var b in a){var c=b.split(/(?=[A-Z])/).join("-").toLowerCase();c!==b&&(a[c]=a[b],delete a[b])}return a},l=function(a,b,c){var d=a;if("string"!=typeof b||a.hasOwnProperty(b))return c?j(a[b]):a[b];var e=b.split(".");for(var f in e)e.hasOwnProperty(f)&&(d=d&&d[e[f]]);return c?j(d):d},m=function(){return!!(navigator.userAgent.indexOf("MSIE ")>0||navigator.userAgent.match(/Trident.*rv\:11\./))},n=function(){Object.keys||(Object.keys=function(){var a=Object.prototype.hasOwnProperty,b=!{toString:null}.propertyIsEnumerable("toString"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=c.length;return function(e){if("object"!=typeof e&&("function"!=typeof e||null===e))throw new TypeError("Object.keys called on non-object");var f,g,h=[];for(f in e)a.call(e,f)&&h.push(f);if(b)for(g=0;d>g;g++)a.call(e,c[g])&&h.push(c[g]);return h}}())},o=function(b,c){this.options=c,this.$el=a(b),this.$el_=this.$el.clone(),this.timeoutId_=0,this.timeoutFooter_=0,this.init()};o.DEFAULTS={classes:"table table-hover",sortClass:void 0,locale:void 0,height:void 0,undefinedText:"-",sortName:void 0,sortOrder:"asc",sortStable:!1,striped:!1,columns:[[]],data:[],totalField:"total",dataField:"rows",method:"get",url:void 0,ajax:void 0,cache:!0,contentType:"application/json",dataType:"json",ajaxOptions:{},queryParams:function(a){return a},queryParamsType:"limit",responseHandler:function(a){return a},pagination:!1,onlyInfoPagination:!1,paginationLoop:!0,sidePagination:"client",totalRows:0,pageNumber:1,pageSize:10,pageList:[10,25,50,100],paginationHAlign:"right",paginationVAlign:"bottom",paginationDetailHAlign:"left",paginationPreText:"&lsaquo;",paginationNextText:"&rsaquo;",search:!1,searchOnEnterKey:!1,strictSearch:!1,searchAlign:"right",selectItemName:"btSelectItem",showHeader:!0,showFooter:!1,showColumns:!1,showPaginationSwitch:!1,showRefresh:!1,showToggle:!1,buttonsAlign:"right",smartDisplay:!0,escape:!1,minimumCountColumns:1,idField:void 0,uniqueId:void 0,cardView:!1,detailView:!1,detailFormatter:function(){return""},trimOnSearch:!0,clickToSelect:!1,singleSelect:!1,toolbar:void 0,toolbarAlign:"left",checkboxHeader:!0,sortable:!0,silentSort:!0,maintainSelected:!1,searchTimeOut:500,searchText:"",iconSize:void 0,buttonsClass:"default",iconsPrefix:"glyphicon",icons:{paginationSwitchDown:"glyphicon-collapse-down icon-chevron-down",paginationSwitchUp:"glyphicon-collapse-up icon-chevron-up",refresh:"glyphicon-refresh icon-refresh",toggle:"glyphicon-list-alt icon-list-alt",columns:"glyphicon-th icon-th",detailOpen:"glyphicon-plus icon-plus",detailClose:"glyphicon-minus icon-minus"},customSearch:a.noop,customSort:a.noop,rowStyle:function(){return{}},rowAttributes:function(){return{}},footerStyle:function(){return{}},onAll:function(){return!1},onClickCell:function(){return!1},onDblClickCell:function(){return!1},onClickRow:function(){return!1},onDblClickRow:function(){return!1},onSort:function(){return!1},onCheck:function(){return!1},onUncheck:function(){return!1},onCheckAll:function(){return!1},onUncheckAll:function(){return!1},onCheckSome:function(){return!1},onUncheckSome:function(){return!1},onLoadSuccess:function(){return!1},onLoadError:function(){return!1},onColumnSwitch:function(){return!1},onPageChange:function(){return!1},onSearch:function(){return!1},onToggle:function(){return!1},onPreBody:function(){return!1},onPostBody:function(){return!1},onPostHeader:function(){return!1},onExpandRow:function(){return!1},onCollapseRow:function(){return!1},onRefreshOptions:function(){return!1},onRefresh:function(){return!1},onResetView:function(){return!1}},o.LOCALES={},o.LOCALES["en-US"]=o.LOCALES.en={formatLoadingMessage:function(){return"Loading, please wait..."},formatRecordsPerPage:function(a){return c("%s rows per page",a)},formatShowingRows:function(a,b,d){return c("Showing %s to %s of %s rows",a,b,d)},formatDetailPagination:function(a){return c("Showing %s rows",a)},formatSearch:function(){return"Search"},formatNoMatches:function(){return"No matching records found"},formatPaginationSwitch:function(){return"Hide/Show pagination"},formatRefresh:function(){return"Refresh"},formatToggle:function(){return"Toggle"},formatColumns:function(){return"Columns"},formatAllRows:function(){return"All"}},a.extend(o.DEFAULTS,o.LOCALES["en-US"]),o.COLUMN_DEFAULTS={radio:!1,checkbox:!1,checkboxEnabled:!0,field:void 0,title:void 0,titleTooltip:void 0,"class":void 0,align:void 0,halign:void 0,falign:void 0,valign:void 0,width:void 0,sortable:!1,order:"asc",visible:!0,switchable:!0,clickToSelect:!0,formatter:void 0,footerFormatter:void 0,events:void 0,sorter:void 0,sortName:void 0,cellStyle:void 0,searchable:!0,searchFormatter:!0,cardVisible:!0,escape:!1},o.EVENTS={"all.bs.table":"onAll","click-cell.bs.table":"onClickCell","dbl-click-cell.bs.table":"onDblClickCell","click-row.bs.table":"onClickRow","dbl-click-row.bs.table":"onDblClickRow","sort.bs.table":"onSort","check.bs.table":"onCheck","uncheck.bs.table":"onUncheck","check-all.bs.table":"onCheckAll","uncheck-all.bs.table":"onUncheckAll","check-some.bs.table":"onCheckSome","uncheck-some.bs.table":"onUncheckSome","load-success.bs.table":"onLoadSuccess","load-error.bs.table":"onLoadError","column-switch.bs.table":"onColumnSwitch","page-change.bs.table":"onPageChange","search.bs.table":"onSearch","toggle.bs.table":"onToggle","pre-body.bs.table":"onPreBody","post-body.bs.table":"onPostBody","post-header.bs.table":"onPostHeader","expand-row.bs.table":"onExpandRow","collapse-row.bs.table":"onCollapseRow","refresh-options.bs.table":"onRefreshOptions","reset-view.bs.table":"onResetView","refresh.bs.table":"onRefresh"},o.prototype.init=function(){this.initLocale(),this.initContainer(),this.initTable(),this.initHeader(),this.initData(),this.initHiddenRows(),this.initFooter(),this.initToolbar(),this.initPagination(),this.initBody(),this.initSearchText(),this.initServer()},o.prototype.initLocale=function(){if(this.options.locale){var b=this.options.locale.split(/-|_/);b[0].toLowerCase(),b[1]&&b[1].toUpperCase(),a.fn.bootstrapTable.locales[this.options.locale]?a.extend(this.options,a.fn.bootstrapTable.locales[this.options.locale]):a.fn.bootstrapTable.locales[b.join("-")]?a.extend(this.options,a.fn.bootstrapTable.locales[b.join("-")]):a.fn.bootstrapTable.locales[b[0]]&&a.extend(this.options,a.fn.bootstrapTable.locales[b[0]])}},o.prototype.initContainer=function(){this.$container=a(['<div class="bootstrap-table">','<div class="fixed-table-toolbar"></div>',"top"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?'<div class="fixed-table-pagination" style="clear: both;"></div>':"",'<div class="fixed-table-container">','<div class="fixed-table-header"><table></table></div>','<div class="fixed-table-body">','<div class="fixed-table-loading">',this.options.formatLoadingMessage(),"</div>","</div>",'<div class="fixed-table-footer"><table><tr></tr></table></div>',"bottom"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?'<div class="fixed-table-pagination"></div>':"","</div>","</div>"].join("")),this.$container.insertAfter(this.$el),this.$tableContainer=this.$container.find(".fixed-table-container"),this.$tableHeader=this.$container.find(".fixed-table-header"),this.$tableBody=this.$container.find(".fixed-table-body"),this.$tableLoading=this.$container.find(".fixed-table-loading"),this.$tableFooter=this.$container.find(".fixed-table-footer"),this.$toolbar=this.$container.find(".fixed-table-toolbar"),this.$pagination=this.$container.find(".fixed-table-pagination"),this.$tableBody.append(this.$el),this.$container.after('<div class="clearfix"></div>'),this.$el.addClass(this.options.classes),this.options.striped&&this.$el.addClass("table-striped"),-1!==a.inArray("table-no-bordered",this.options.classes.split(" "))&&this.$tableContainer.addClass("table-no-bordered")},o.prototype.initTable=function(){var b=this,c=[],d=[];if(this.$header=this.$el.find(">thead"),this.$header.length||(this.$header=a("<thead></thead>").appendTo(this.$el)),this.$header.find("tr").each(function(){var b=[];a(this).find("th").each(function(){"undefined"!=typeof a(this).data("field")&&a(this).data("field",a(this).data("field")+""),b.push(a.extend({},{title:a(this).html(),"class":a(this).attr("class"),titleTooltip:a(this).attr("title"),rowspan:a(this).attr("rowspan")?+a(this).attr("rowspan"):void 0,colspan:a(this).attr("colspan")?+a(this).attr("colspan"):void 0},a(this).data()))}),c.push(b)}),a.isArray(this.options.columns[0])||(this.options.columns=[this.options.columns]),this.options.columns=a.extend(!0,[],c,this.options.columns),this.columns=[],f(this.options.columns),a.each(this.options.columns,function(c,d){a.each(d,function(d,e){e=a.extend({},o.COLUMN_DEFAULTS,e),"undefined"!=typeof e.fieldIndex&&(b.columns[e.fieldIndex]=e),b.options.columns[c][d]=e})}),!this.options.data.length){var e=[];this.$el.find(">tbody>tr").each(function(c){var f={};f._id=a(this).attr("id"),f._class=a(this).attr("class"),f._data=k(a(this).data()),a(this).find(">td").each(function(d){for(var g,h,i=a(this),j=+i.attr("colspan")||1,l=+i.attr("rowspan")||1;e[c]&&e[c][d];d++);for(g=d;d+j>g;g++)for(h=c;c+l>h;h++)e[h]||(e[h]=[]),e[h][g]=!0;var m=b.columns[d].field;f[m]=a(this).html(),f["_"+m+"_id"]=a(this).attr("id"),f["_"+m+"_class"]=a(this).attr("class"),f["_"+m+"_rowspan"]=a(this).attr("rowspan"),f["_"+m+"_colspan"]=a(this).attr("colspan"),f["_"+m+"_title"]=a(this).attr("title"),f["_"+m+"_data"]=k(a(this).data())}),d.push(f)}),this.options.data=d,d.length&&(this.fromHtml=!0)}},o.prototype.initHeader=function(){var b=this,d={},e=[];this.header={fields:[],styles:[],classes:[],formatters:[],events:[],sorters:[],sortNames:[],cellStyles:[],searchables:[]},a.each(this.options.columns,function(f,g){e.push("<tr>"),0===f&&!b.options.cardView&&b.options.detailView&&e.push(c('<th class="detail" rowspan="%s"><div class="fht-cell"></div></th>',b.options.columns.length)),a.each(g,function(a,f){var g="",h="",i="",k="",l=c(' class="%s"',f["class"]),m=(b.options.sortOrder||f.order,"px"),n=f.width;if(void 0===f.width||b.options.cardView||"string"==typeof f.width&&-1!==f.width.indexOf("%")&&(m="%"),f.width&&"string"==typeof f.width&&(n=f.width.replace("%","").replace("px","")),h=c("text-align: %s; ",f.halign?f.halign:f.align),i=c("text-align: %s; ",f.align),k=c("vertical-align: %s; ",f.valign),k+=c("width: %s; ",!f.checkbox&&!f.radio||n?n?n+m:void 0:"36px"),"undefined"!=typeof f.fieldIndex){if(b.header.fields[f.fieldIndex]=f.field,b.header.styles[f.fieldIndex]=i+k,b.header.classes[f.fieldIndex]=l,b.header.formatters[f.fieldIndex]=f.formatter,b.header.events[f.fieldIndex]=f.events,b.header.sorters[f.fieldIndex]=f.sorter,b.header.sortNames[f.fieldIndex]=f.sortName,b.header.cellStyles[f.fieldIndex]=f.cellStyle,b.header.searchables[f.fieldIndex]=f.searchable,!f.visible)return;if(b.options.cardView&&!f.cardVisible)return;d[f.field]=f}e.push("<th"+c(' title="%s"',f.titleTooltip),f.checkbox||f.radio?c(' class="bs-checkbox %s"',f["class"]||""):l,c(' style="%s"',h+k),c(' rowspan="%s"',f.rowspan),c(' colspan="%s"',f.colspan),c(' data-field="%s"',f.field),">"),e.push(c('<div class="th-inner %s">',b.options.sortable&&f.sortable?"sortable both":"")),g=b.options.escape?j(f.title):f.title,f.checkbox&&(!b.options.singleSelect&&b.options.checkboxHeader&&(g='<input name="btSelectAll" type="checkbox" />'),b.header.stateField=f.field),f.radio&&(g="",b.header.stateField=f.field,b.options.singleSelect=!0),e.push(g),e.push("</div>"),e.push('<div class="fht-cell"></div>'),e.push("</div>"),e.push("</th>")}),e.push("</tr>")}),this.$header.html(e.join("")),this.$header.find("th[data-field]").each(function(){a(this).data(d[a(this).data("field")])}),this.$container.off("click",".th-inner").on("click",".th-inner",function(c){var d=a(this);return b.options.detailView&&d.closest(".bootstrap-table")[0]!==b.$container[0]?!1:void(b.options.sortable&&d.parent().data().sortable&&b.onSort(c))}),this.$header.children().children().off("keypress").on("keypress",function(c){if(b.options.sortable&&a(this).data().sortable){var d=c.keyCode||c.which;13==d&&b.onSort(c)}}),a(window).off("resize.bootstrap-table"),!this.options.showHeader||this.options.cardView?(this.$header.hide(),this.$tableHeader.hide(),this.$tableLoading.css("top",0)):(this.$header.show(),this.$tableHeader.show(),this.$tableLoading.css("top",this.$header.outerHeight()+1),this.getCaret(),a(window).on("resize.bootstrap-table",a.proxy(this.resetWidth,this))),this.$selectAll=this.$header.find('[name="btSelectAll"]'),this.$selectAll.off("click").on("click",function(){var c=a(this).prop("checked");b[c?"checkAll":"uncheckAll"](),b.updateSelected()})},o.prototype.initFooter=function(){!this.options.showFooter||this.options.cardView?this.$tableFooter.hide():this.$tableFooter.show()},o.prototype.initData=function(a,b){this.data="append"===b?this.data.concat(a):"prepend"===b?[].concat(a).concat(this.data):a||this.options.data,this.options.data="append"===b?this.options.data.concat(a):"prepend"===b?[].concat(a).concat(this.options.data):this.data,"server"!==this.options.sidePagination&&this.initSort()},o.prototype.initSort=function(){var b=this,d=this.options.sortName,e="desc"===this.options.sortOrder?-1:1,f=a.inArray(this.options.sortName,this.header.fields),g=0;return this.options.customSort!==a.noop?void this.options.customSort.apply(this,[this.options.sortName,this.options.sortOrder]):void(-1!==f&&(this.options.sortStable&&a.each(this.data,function(a,b){b.hasOwnProperty("_position")||(b._position=a)}),this.data.sort(function(c,g){b.header.sortNames[f]&&(d=b.header.sortNames[f]);var i=l(c,d,b.options.escape),j=l(g,d,b.options.escape),k=h(b.header,b.header.sorters[f],[i,j]);return void 0!==k?e*k:((void 0===i||null===i)&&(i=""),(void 0===j||null===j)&&(j=""),b.options.sortStable&&i===j&&(i=c._position,j=g._position),a.isNumeric(i)&&a.isNumeric(j)?(i=parseFloat(i),j=parseFloat(j),j>i?-1*e:e):i===j?0:("string"!=typeof i&&(i=i.toString()),-1===i.localeCompare(j)?-1*e:e))}),void 0!==this.options.sortClass&&(clearTimeout(g),g=setTimeout(function(){b.$el.removeClass(b.options.sortClass);var a=b.$header.find(c('[data-field="%s"]',b.options.sortName).index()+1);b.$el.find(c("tr td:nth-child(%s)",a)).addClass(b.options.sortClass)},250))))},o.prototype.onSort=function(b){var c="keypress"===b.type?a(b.currentTarget):a(b.currentTarget).parent(),d=this.$header.find("th").eq(c.index());return this.$header.add(this.$header_).find("span.order").remove(),this.options.sortName===c.data("field")?this.options.sortOrder="asc"===this.options.sortOrder?"desc":"asc":(this.options.sortName=c.data("field"),this.options.sortOrder="asc"===c.data("order")?"desc":"asc"),this.trigger("sort",this.options.sortName,this.options.sortOrder),c.add(d).data("order",this.options.sortOrder),this.getCaret(),"server"===this.options.sidePagination?void this.initServer(this.options.silentSort):(this.initSort(),void this.initBody())},o.prototype.initToolbar=function(){var b,d,e=this,f=[],g=0,i=0;this.$toolbar.find(".bs-bars").children().length&&a("body").append(a(this.options.toolbar)),this.$toolbar.html(""),("string"==typeof this.options.toolbar||"object"==typeof this.options.toolbar)&&a(c('<div class="bs-bars pull-%s"></div>',this.options.toolbarAlign)).appendTo(this.$toolbar).append(a(this.options.toolbar)),f=[c('<div class="columns columns-%s btn-group pull-%s">',this.options.buttonsAlign,this.options.buttonsAlign)],"string"==typeof this.options.icons&&(this.options.icons=h(null,this.options.icons)),this.options.showPaginationSwitch&&f.push(c('<button class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+'" type="button" name="paginationSwitch" aria-label="pagination Switch" title="%s">',this.options.formatPaginationSwitch()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.paginationSwitchDown),"</button>"),this.options.showRefresh&&f.push(c('<button class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+'" type="button" name="refresh" aria-label="refresh" title="%s">',this.options.formatRefresh()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.refresh),"</button>"),this.options.showToggle&&f.push(c('<button class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+'" type="button" name="toggle" aria-label="toggle" title="%s">',this.options.formatToggle()),c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.toggle),"</button>"),this.options.showColumns&&(f.push(c('<div class="keep-open btn-group" title="%s">',this.options.formatColumns()),'<button type="button" aria-label="columns" class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown">',c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.columns),' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">'),a.each(this.columns,function(a,b){if(!(b.radio||b.checkbox||e.options.cardView&&!b.cardVisible)){var d=b.visible?' checked="checked"':"";b.switchable&&(f.push(c('<li role="menuitem"><label><input type="checkbox" data-field="%s" value="%s"%s> %s</label></li>',b.field,a,d,b.title)),i++)}}),f.push("</ul>","</div>")),f.push("</div>"),(this.showToolbar||f.length>2)&&this.$toolbar.append(f.join("")),this.options.showPaginationSwitch&&this.$toolbar.find('button[name="paginationSwitch"]').off("click").on("click",a.proxy(this.togglePagination,this)),this.options.showRefresh&&this.$toolbar.find('button[name="refresh"]').off("click").on("click",a.proxy(this.refresh,this)),this.options.showToggle&&this.$toolbar.find('button[name="toggle"]').off("click").on("click",function(){e.toggleView()}),this.options.showColumns&&(b=this.$toolbar.find(".keep-open"),i<=this.options.minimumCountColumns&&b.find("input").prop("disabled",!0),b.find("li").off("click").on("click",function(a){a.stopImmediatePropagation()}),b.find("input").off("click").on("click",function(){var b=a(this);e.toggleColumn(a(this).val(),b.prop("checked"),!1),e.trigger("column-switch",a(this).data("field"),b.prop("checked"))})),this.options.search&&(f=[],f.push('<div class="pull-'+this.options.searchAlign+' search">',c('<input class="form-control'+c(" input-%s",this.options.iconSize)+'" type="text" placeholder="%s">',this.options.formatSearch()),"</div>"),this.$toolbar.append(f.join("")),d=this.$toolbar.find(".search input"),d.off("keyup drop blur").on("keyup drop blur",function(b){e.options.searchOnEnterKey&&13!==b.keyCode||a.inArray(b.keyCode,[37,38,39,40])>-1||(clearTimeout(g),g=setTimeout(function(){e.onSearch(b)},e.options.searchTimeOut))}),m()&&d.off("mouseup").on("mouseup",function(a){clearTimeout(g),g=setTimeout(function(){e.onSearch(a)},e.options.searchTimeOut)}))},o.prototype.onSearch=function(b){var c=a.trim(a(b.currentTarget).val());this.options.trimOnSearch&&a(b.currentTarget).val()!==c&&a(b.currentTarget).val(c),c!==this.searchText&&(this.searchText=c,this.options.searchText=c,this.options.pageNumber=1,this.initSearch(),this.updatePagination(),this.trigger("search",c))},o.prototype.initSearch=function(){var b=this;if("server"!==this.options.sidePagination){if(this.options.customSearch!==a.noop)return void this.options.customSearch.apply(this,[this.searchText]);var c=this.searchText&&(this.options.escape?j(this.searchText):this.searchText).toLowerCase(),d=a.isEmptyObject(this.filterColumns)?null:this.filterColumns;this.data=d?a.grep(this.options.data,function(b){for(var c in d)if(a.isArray(d[c])&&-1===a.inArray(b[c],d[c])||!a.isArray(d[c])&&b[c]!==d[c])return!1;return!0}):this.options.data,this.data=c?a.grep(this.data,function(d,f){for(var g=0;g<b.header.fields.length;g++)if(b.header.searchables[g]){var i,j=a.isNumeric(b.header.fields[g])?parseInt(b.header.fields[g],10):b.header.fields[g],k=b.columns[e(b.columns,j)];if("string"==typeof j){i=d;for(var l=j.split("."),m=0;m<l.length;m++)i=i[l[m]];k&&k.searchFormatter&&(i=h(k,b.header.formatters[g],[i,d,f],i))}else i=d[j];if("string"==typeof i||"number"==typeof i)if(b.options.strictSearch){if((i+"").toLowerCase()===c)return!0}else if(-1!==(i+"").toLowerCase().indexOf(c))return!0}return!1}):this.data}},o.prototype.initPagination=function(){if(!this.options.pagination)return void this.$pagination.hide();this.$pagination.show();var b,d,e,f,g,h,i,j,k,l=this,m=[],n=!1,o=this.getData(),p=this.options.pageList;if("server"!==this.options.sidePagination&&(this.options.totalRows=o.length),this.totalPages=0,this.options.totalRows){if(this.options.pageSize===this.options.formatAllRows())this.options.pageSize=this.options.totalRows,n=!0;else if(this.options.pageSize===this.options.totalRows){var q="string"==typeof this.options.pageList?this.options.pageList.replace("[","").replace("]","").replace(/ /g,"").toLowerCase().split(","):this.options.pageList;a.inArray(this.options.formatAllRows().toLowerCase(),q)>-1&&(n=!0)}this.totalPages=~~((this.options.totalRows-1)/this.options.pageSize)+1,this.options.totalPages=this.totalPages}if(this.totalPages>0&&this.options.pageNumber>this.totalPages&&(this.options.pageNumber=this.totalPages),this.pageFrom=(this.options.pageNumber-1)*this.options.pageSize+1,this.pageTo=this.options.pageNumber*this.options.pageSize,this.pageTo>this.options.totalRows&&(this.pageTo=this.options.totalRows),m.push('<div class="pull-'+this.options.paginationDetailHAlign+' pagination-detail">','<span class="pagination-info">',this.options.onlyInfoPagination?this.options.formatDetailPagination(this.options.totalRows):this.options.formatShowingRows(this.pageFrom,this.pageTo,this.options.totalRows),"</span>"),!this.options.onlyInfoPagination){m.push('<span class="page-list">');var r=[c('<span class="btn-group %s">',"top"===this.options.paginationVAlign||"both"===this.options.paginationVAlign?"dropdown":"dropup"),'<button type="button" class="btn'+c(" btn-%s",this.options.buttonsClass)+c(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown">','<span class="page-size">',n?this.options.formatAllRows():this.options.pageSize,"</span>",' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">'];if("string"==typeof this.options.pageList){var s=this.options.pageList.replace("[","").replace("]","").replace(/ /g,"").split(",");p=[],a.each(s,function(a,b){p.push(b.toUpperCase()===l.options.formatAllRows().toUpperCase()?l.options.formatAllRows():+b)})}for(a.each(p,function(a,b){if(!l.options.smartDisplay||0===a||p[a-1]<l.options.totalRows){var d;d=n?b===l.options.formatAllRows()?' class="active"':"":b===l.options.pageSize?' class="active"':"",r.push(c('<li role="menuitem"%s><a href="#">%s</a></li>',d,b))}}),r.push("</ul></span>"),m.push(this.options.formatRecordsPerPage(r.join(""))),m.push("</span>"),m.push("</div>",'<div class="pull-'+this.options.paginationHAlign+' pagination">','<ul class="pagination'+c(" pagination-%s",this.options.iconSize)+'">','<li class="page-pre"><a href="#">'+this.options.paginationPreText+"</a></li>"),this.totalPages<5?(d=1,e=this.totalPages):(d=this.options.pageNumber-2,e=d+4,1>d&&(d=1,e=5),e>this.totalPages&&(e=this.totalPages,d=e-4)),this.totalPages>=6&&(this.options.pageNumber>=3&&(m.push('<li class="page-first'+(1===this.options.pageNumber?" active":"")+'">','<a href="#">',1,"</a>","</li>"),d++),this.options.pageNumber>=4&&(4==this.options.pageNumber||6==this.totalPages||7==this.totalPages?d--:m.push('<li class="page-first-separator disabled">','<a href="#">...</a>',"</li>"),e--)),this.totalPages>=7&&this.options.pageNumber>=this.totalPages-2&&d--,6==this.totalPages?this.options.pageNumber>=this.totalPages-2&&e++:this.totalPages>=7&&(7==this.totalPages||this.options.pageNumber>=this.totalPages-3)&&e++,b=d;e>=b;b++)m.push('<li class="page-number'+(b===this.options.pageNumber?" active":"")+'">','<a href="#">',b,"</a>","</li>");this.totalPages>=8&&this.options.pageNumber<=this.totalPages-4&&m.push('<li class="page-last-separator disabled">','<a href="#">...</a>',"</li>"),this.totalPages>=6&&this.options.pageNumber<=this.totalPages-3&&m.push('<li class="page-last'+(this.totalPages===this.options.pageNumber?" active":"")+'">','<a href="#">',this.totalPages,"</a>","</li>"),m.push('<li class="page-next"><a href="#">'+this.options.paginationNextText+"</a></li>","</ul>","</div>")}this.$pagination.html(m.join("")),this.options.onlyInfoPagination||(f=this.$pagination.find(".page-list a"),g=this.$pagination.find(".page-first"),h=this.$pagination.find(".page-pre"),i=this.$pagination.find(".page-next"),j=this.$pagination.find(".page-last"),k=this.$pagination.find(".page-number"),this.options.smartDisplay&&(this.totalPages<=1&&this.$pagination.find("div.pagination").hide(),(p.length<2||this.options.totalRows<=p[0])&&this.$pagination.find("span.page-list").hide(),this.$pagination[this.getData().length?"show":"hide"]()),this.options.paginationLoop||(1===this.options.pageNumber&&h.addClass("disabled"),this.options.pageNumber===this.totalPages&&i.addClass("disabled")),n&&(this.options.pageSize=this.options.formatAllRows()),f.off("click").on("click",a.proxy(this.onPageListChange,this)),g.off("click").on("click",a.proxy(this.onPageFirst,this)),h.off("click").on("click",a.proxy(this.onPagePre,this)),i.off("click").on("click",a.proxy(this.onPageNext,this)),j.off("click").on("click",a.proxy(this.onPageLast,this)),k.off("click").on("click",a.proxy(this.onPageNumber,this)))},o.prototype.updatePagination=function(b){b&&a(b.currentTarget).hasClass("disabled")||(this.options.maintainSelected||this.resetRows(),this.initPagination(),"server"===this.options.sidePagination?this.initServer():this.initBody(),this.trigger("page-change",this.options.pageNumber,this.options.pageSize))},o.prototype.onPageListChange=function(b){var c=a(b.currentTarget);return c.parent().addClass("active").siblings().removeClass("active"),this.options.pageSize=c.text().toUpperCase()===this.options.formatAllRows().toUpperCase()?this.options.formatAllRows():+c.text(),this.$toolbar.find(".page-size").text(this.options.pageSize),this.updatePagination(b),!1},o.prototype.onPageFirst=function(a){return this.options.pageNumber=1,this.updatePagination(a),!1},o.prototype.onPagePre=function(a){return this.options.pageNumber-1===0?this.options.pageNumber=this.options.totalPages:this.options.pageNumber--,this.updatePagination(a),!1},o.prototype.onPageNext=function(a){return this.options.pageNumber+1>this.options.totalPages?this.options.pageNumber=1:this.options.pageNumber++,this.updatePagination(a),!1},o.prototype.onPageLast=function(a){return this.options.pageNumber=this.totalPages,this.updatePagination(a),!1},o.prototype.onPageNumber=function(b){return this.options.pageNumber!==+a(b.currentTarget).text()?(this.options.pageNumber=+a(b.currentTarget).text(),this.updatePagination(b),!1):void 0},o.prototype.initRow=function(b,e){var f,g=this,i=[],k={},m=[],n="",o={},p=[];if(!(a.inArray(b,this.hiddenRows)>-1)){if(k=h(this.options,this.options.rowStyle,[b,e],k),k&&k.css)for(f in k.css)m.push(f+": "+k.css[f]);if(o=h(this.options,this.options.rowAttributes,[b,e],o))for(f in o)p.push(c('%s="%s"',f,j(o[f])));return b._data&&!a.isEmptyObject(b._data)&&a.each(b._data,function(a,b){"index"!==a&&(n+=c(' data-%s="%s"',a,b))}),i.push("<tr",c(" %s",p.join(" ")),c(' id="%s"',a.isArray(b)?void 0:b._id),c(' class="%s"',k.classes||(a.isArray(b)?void 0:b._class)),c(' data-index="%s"',e),c(' data-uniqueid="%s"',b[this.options.uniqueId]),c("%s",n),">"),this.options.cardView&&i.push(c('<td colspan="%s"><div class="card-views">',this.header.fields.length)),!this.options.cardView&&this.options.detailView&&i.push("<td>",'<a class="detail-icon" href="#">',c('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.detailOpen),"</a>","</td>"),a.each(this.header.fields,function(f,n){var o="",p=l(b,n,g.options.escape),q="",r="",s={},t="",u=g.header.classes[f],v="",w="",x="",y="",z=g.columns[f];if(!(g.fromHtml&&"undefined"==typeof p||!z.visible||g.options.cardView&&!z.cardVisible)){if(z.escape&&(p=j(p)),k=c('style="%s"',m.concat(g.header.styles[f]).join("; ")),b["_"+n+"_id"]&&(t=c(' id="%s"',b["_"+n+"_id"])),b["_"+n+"_class"]&&(u=c(' class="%s"',b["_"+n+"_class"])),b["_"+n+"_rowspan"]&&(w=c(' rowspan="%s"',b["_"+n+"_rowspan"])),b["_"+n+"_colspan"]&&(x=c(' colspan="%s"',b["_"+n+"_colspan"])),b["_"+n+"_title"]&&(y=c(' title="%s"',b["_"+n+"_title"])),s=h(g.header,g.header.cellStyles[f],[p,b,e,n],s),s.classes&&(u=c(' class="%s"',s.classes)),s.css){var A=[];for(var B in s.css)A.push(B+": "+s.css[B]);k=c('style="%s"',A.concat(g.header.styles[f]).join("; "))}q=h(z,g.header.formatters[f],[p,b,e],p),b["_"+n+"_data"]&&!a.isEmptyObject(b["_"+n+"_data"])&&a.each(b["_"+n+"_data"],function(a,b){"index"!==a&&(v+=c(' data-%s="%s"',a,b))}),z.checkbox||z.radio?(r=z.checkbox?"checkbox":r,r=z.radio?"radio":r,o=[c(g.options.cardView?'<div class="card-view %s">':'<td class="bs-checkbox %s">',z["class"]||""),"<input"+c(' data-index="%s"',e)+c(' name="%s"',g.options.selectItemName)+c(' type="%s"',r)+c(' value="%s"',b[g.options.idField])+c(' checked="%s"',q===!0||p||q&&q.checked?"checked":void 0)+c(' disabled="%s"',!z.checkboxEnabled||q&&q.disabled?"disabled":void 0)+" />",g.header.formatters[f]&&"string"==typeof q?q:"",g.options.cardView?"</div>":"</td>"].join(""),b[g.header.stateField]=q===!0||q&&q.checked):(q="undefined"==typeof q||null===q?g.options.undefinedText:q,o=g.options.cardView?['<div class="card-view">',g.options.showHeader?c('<span class="title" %s>%s</span>',k,d(g.columns,"field","title",n)):"",c('<span class="value">%s</span>',q),"</div>"].join(""):[c("<td%s %s %s %s %s %s %s>",t,u,k,v,w,x,y),q,"</td>"].join(""),g.options.cardView&&g.options.smartDisplay&&""===q&&(o='<div class="card-view"></div>')),i.push(o)}}),this.options.cardView&&i.push("</div></td>"),i.push("</tr>"),i.join(" ")}},o.prototype.initBody=function(b){var d=this,f=this.getData();this.trigger("pre-body",f),this.$body=this.$el.find(">tbody"),this.$body.length||(this.$body=a("<tbody></tbody>").appendTo(this.$el)),this.options.pagination&&"server"!==this.options.sidePagination||(this.pageFrom=1,this.pageTo=f.length);for(var g,i=a(document.createDocumentFragment()),j=this.pageFrom-1;j<this.pageTo;j++){
  6146. var k=f[j],m=this.initRow(k,j,f,i);g=g||!!m,m&&m!==!0&&i.append(m)}g||i.append('<tr class="no-records-found">'+c('<td colspan="%s">%s</td>',this.$header.find("th").length,this.options.formatNoMatches())+"</tr>"),this.$body.html(i),b||this.scrollTo(0),this.$body.find("> tr[data-index] > td").off("click dblclick").on("click dblclick",function(b){var f=a(this),g=f.parent(),h=d.data[g.data("index")],i=f[0].cellIndex,j=d.getVisibleFields(),k=j[d.options.detailView&&!d.options.cardView?i-1:i],m=d.columns[e(d.columns,k)],n=l(h,k,d.options.escape);if(!f.find(".detail-icon").length&&(d.trigger("click"===b.type?"click-cell":"dbl-click-cell",k,n,h,f),d.trigger("click"===b.type?"click-row":"dbl-click-row",h,g,k),"click"===b.type&&d.options.clickToSelect&&m.clickToSelect)){var o=g.find(c('[name="%s"]',d.options.selectItemName));o.length&&o[0].click()}}),this.$body.find("> tr[data-index] > td > .detail-icon").off("click").on("click",function(){var b=a(this),e=b.parent().parent(),g=e.data("index"),i=f[g];if(e.next().is("tr.detail-view"))b.find("i").attr("class",c("%s %s",d.options.iconsPrefix,d.options.icons.detailOpen)),d.trigger("collapse-row",g,i),e.next().remove();else{b.find("i").attr("class",c("%s %s",d.options.iconsPrefix,d.options.icons.detailClose)),e.after(c('<tr class="detail-view"><td colspan="%s"></td></tr>',e.find("td").length));var j=e.next().find("td"),k=h(d.options,d.options.detailFormatter,[g,i,j],"");1===j.length&&j.append(k),d.trigger("expand-row",g,i,j)}return d.resetView(),!1}),this.$selectItem=this.$body.find(c('[name="%s"]',this.options.selectItemName)),this.$selectItem.off("click").on("click",function(b){b.stopImmediatePropagation();var c=a(this),e=c.prop("checked"),f=d.data[c.data("index")];d.options.maintainSelected&&a(this).is(":radio")&&a.each(d.options.data,function(a,b){b[d.header.stateField]=!1}),f[d.header.stateField]=e,d.options.singleSelect&&(d.$selectItem.not(this).each(function(){d.data[a(this).data("index")][d.header.stateField]=!1}),d.$selectItem.filter(":checked").not(this).prop("checked",!1)),d.updateSelected(),d.trigger(e?"check":"uncheck",f,c)}),a.each(this.header.events,function(b,c){if(c){"string"==typeof c&&(c=h(null,c));var e=d.header.fields[b],f=a.inArray(e,d.getVisibleFields());d.options.detailView&&!d.options.cardView&&(f+=1);for(var g in c)d.$body.find(">tr:not(.no-records-found)").each(function(){var b=a(this),h=b.find(d.options.cardView?".card-view":"td").eq(f),i=g.indexOf(" "),j=g.substring(0,i),k=g.substring(i+1),l=c[g];h.find(k).off(j).on(j,function(a){var c=b.data("index"),f=d.data[c],g=f[e];l.apply(this,[a,g,f,c])})})}}),this.updateSelected(),this.resetView(),this.trigger("post-body",f)},o.prototype.initServer=function(b,c,d){var e,f=this,g={},i={searchText:this.searchText,sortName:this.options.sortName,sortOrder:this.options.sortOrder};this.options.pagination&&(i.pageSize=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize,i.pageNumber=this.options.pageNumber),(d||this.options.url||this.options.ajax)&&("limit"===this.options.queryParamsType&&(i={search:i.searchText,sort:i.sortName,order:i.sortOrder},this.options.pagination&&(i.offset=this.options.pageSize===this.options.formatAllRows()?0:this.options.pageSize*(this.options.pageNumber-1),i.limit=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize)),a.isEmptyObject(this.filterColumnsPartial)||(i.filter=JSON.stringify(this.filterColumnsPartial,null)),g=h(this.options,this.options.queryParams,[i],g),a.extend(g,c||{}),g!==!1&&(b||this.$tableLoading.show(),e=a.extend({},h(null,this.options.ajaxOptions),{type:this.options.method,url:d||this.options.url,data:"application/json"===this.options.contentType&&"post"===this.options.method?JSON.stringify(g):g,cache:this.options.cache,contentType:this.options.contentType,dataType:this.options.dataType,success:function(a){a=h(f.options,f.options.responseHandler,[a],a),f.load(a),f.trigger("load-success",a),b||f.$tableLoading.hide()},error:function(a){f.trigger("load-error",a.status,a),b||f.$tableLoading.hide()}}),this.options.ajax?h(this,this.options.ajax,[e],null):(this._xhr&&4!==this._xhr.readyState&&this._xhr.abort(),this._xhr=a.ajax(e))))},o.prototype.initSearchText=function(){if(this.options.search&&""!==this.options.searchText){var a=this.$toolbar.find(".search input");a.val(this.options.searchText),this.onSearch({currentTarget:a})}},o.prototype.getCaret=function(){var b=this;a.each(this.$header.find("th"),function(c,d){a(d).find(".sortable").removeClass("desc asc").addClass(a(d).data("field")===b.options.sortName?b.options.sortOrder:"both")})},o.prototype.updateSelected=function(){var b=this.$selectItem.filter(":enabled").length&&this.$selectItem.filter(":enabled").length===this.$selectItem.filter(":enabled").filter(":checked").length;this.$selectAll.add(this.$selectAll_).prop("checked",b),this.$selectItem.each(function(){a(this).closest("tr")[a(this).prop("checked")?"addClass":"removeClass"]("selected")})},o.prototype.updateRows=function(){var b=this;this.$selectItem.each(function(){b.data[a(this).data("index")][b.header.stateField]=a(this).prop("checked")})},o.prototype.resetRows=function(){var b=this;a.each(this.data,function(a,c){b.$selectAll.prop("checked",!1),b.$selectItem.prop("checked",!1),b.header.stateField&&(c[b.header.stateField]=!1)}),this.initHiddenRows()},o.prototype.trigger=function(b){var c=Array.prototype.slice.call(arguments,1);b+=".bs.table",this.options[o.EVENTS[b]].apply(this.options,c),this.$el.trigger(a.Event(b),c),this.options.onAll(b,c),this.$el.trigger(a.Event("all.bs.table"),[b,c])},o.prototype.resetHeader=function(){clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(a.proxy(this.fitHeader,this),this.$el.is(":hidden")?100:0)},o.prototype.fitHeader=function(){var b,d,e,f,h=this;if(h.$el.is(":hidden"))return void(h.timeoutId_=setTimeout(a.proxy(h.fitHeader,h),100));if(b=this.$tableBody.get(0),d=b.scrollWidth>b.clientWidth&&b.scrollHeight>b.clientHeight+this.$header.outerHeight()?g():0,this.$el.css("margin-top",-this.$header.outerHeight()),e=a(":focus"),e.length>0){var i=e.parents("th");if(i.length>0){var j=i.attr("data-field");if(void 0!==j){var k=this.$header.find("[data-field='"+j+"']");k.length>0&&k.find(":input").addClass("focus-temp")}}}this.$header_=this.$header.clone(!0,!0),this.$selectAll_=this.$header_.find('[name="btSelectAll"]'),this.$tableHeader.css({"margin-right":d}).find("table").css("width",this.$el.outerWidth()).html("").attr("class",this.$el.attr("class")).append(this.$header_),f=a(".focus-temp:visible:eq(0)"),f.length>0&&(f.focus(),this.$header.find(".focus-temp").removeClass("focus-temp")),this.$header.find("th[data-field]").each(function(){h.$header_.find(c('th[data-field="%s"]',a(this).data("field"))).data(a(this).data())});var l=this.getVisibleFields(),m=this.$header_.find("th");this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(b){var d=a(this),e=b;h.options.detailView&&!h.options.cardView&&(0===b&&h.$header_.find("th.detail").find(".fht-cell").width(d.innerWidth()),e=b-1);var f=h.$header_.find(c('th[data-field="%s"]',l[e]));f.length>1&&(f=a(m[d[0].cellIndex])),f.find(".fht-cell").width(d.innerWidth())}),this.$tableBody.off("scroll").on("scroll",function(){h.$tableHeader.scrollLeft(a(this).scrollLeft()),h.options.showFooter&&!h.options.cardView&&h.$tableFooter.scrollLeft(a(this).scrollLeft())}),h.trigger("post-header")},o.prototype.resetFooter=function(){var b=this,d=b.getData(),e=[];this.options.showFooter&&!this.options.cardView&&(!this.options.cardView&&this.options.detailView&&e.push('<td><div class="th-inner">&nbsp;</div><div class="fht-cell"></div></td>'),a.each(this.columns,function(a,f){var g,i="",j="",k=[],l={},m=c(' class="%s"',f["class"]);if(f.visible&&(!b.options.cardView||f.cardVisible)){if(i=c("text-align: %s; ",f.falign?f.falign:f.align),j=c("vertical-align: %s; ",f.valign),l=h(null,b.options.footerStyle),l&&l.css)for(g in l.css)k.push(g+": "+l.css[g]);e.push("<td",m,c(' style="%s"',i+j+k.concat().join("; ")),">"),e.push('<div class="th-inner">'),e.push(h(f,f.footerFormatter,[d],"&nbsp;")||"&nbsp;"),e.push("</div>"),e.push('<div class="fht-cell"></div>'),e.push("</div>"),e.push("</td>")}}),this.$tableFooter.find("tr").html(e.join("")),this.$tableFooter.show(),clearTimeout(this.timeoutFooter_),this.timeoutFooter_=setTimeout(a.proxy(this.fitFooter,this),this.$el.is(":hidden")?100:0))},o.prototype.fitFooter=function(){var b,c,d;return clearTimeout(this.timeoutFooter_),this.$el.is(":hidden")?void(this.timeoutFooter_=setTimeout(a.proxy(this.fitFooter,this),100)):(c=this.$el.css("width"),d=c>this.$tableBody.width()?g():0,this.$tableFooter.css({"margin-right":d}).find("table").css("width",c).attr("class",this.$el.attr("class")),b=this.$tableFooter.find("td"),void this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(c){var d=a(this);b.eq(c).find(".fht-cell").width(d.innerWidth())}))},o.prototype.toggleColumn=function(a,b,d){if(-1!==a&&(this.columns[a].visible=b,this.initHeader(),this.initSearch(),this.initPagination(),this.initBody(),this.options.showColumns)){var e=this.$toolbar.find(".keep-open input").prop("disabled",!1);d&&e.filter(c('[value="%s"]',a)).prop("checked",b),e.filter(":checked").length<=this.options.minimumCountColumns&&e.filter(":checked").prop("disabled",!0)}},o.prototype.getVisibleFields=function(){var b=this,c=[];return a.each(this.header.fields,function(a,d){var f=b.columns[e(b.columns,d)];f.visible&&c.push(d)}),c},o.prototype.resetView=function(a){var b=0;if(a&&a.height&&(this.options.height=a.height),this.$selectAll.prop("checked",this.$selectItem.length>0&&this.$selectItem.length===this.$selectItem.filter(":checked").length),this.options.height){var c=this.$toolbar.outerHeight(!0),d=this.$pagination.outerHeight(!0),e=this.options.height-c-d;this.$tableContainer.css("height",e+"px")}return this.options.cardView?(this.$el.css("margin-top","0"),this.$tableContainer.css("padding-bottom","0"),void this.$tableFooter.hide()):(this.options.showHeader&&this.options.height?(this.$tableHeader.show(),this.resetHeader(),b+=this.$header.outerHeight()):(this.$tableHeader.hide(),this.trigger("post-header")),this.options.showFooter&&(this.resetFooter(),this.options.height&&(b+=this.$tableFooter.outerHeight()+1)),this.getCaret(),this.$tableContainer.css("padding-bottom",b+"px"),void this.trigger("reset-view"))},o.prototype.getData=function(b){return!this.searchText&&a.isEmptyObject(this.filterColumns)&&a.isEmptyObject(this.filterColumnsPartial)?b?this.options.data.slice(this.pageFrom-1,this.pageTo):this.options.data:b?this.data.slice(this.pageFrom-1,this.pageTo):this.data},o.prototype.load=function(b){var c=!1;"server"===this.options.sidePagination?(this.options.totalRows=b[this.options.totalField],c=b.fixedScroll,b=b[this.options.dataField]):a.isArray(b)||(c=b.fixedScroll,b=b.data),this.initData(b),this.initSearch(),this.initPagination(),this.initBody(c)},o.prototype.append=function(a){this.initData(a,"append"),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.prepend=function(a){this.initData(a,"prepend"),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.remove=function(b){var c,d,e=this.options.data.length;if(b.hasOwnProperty("field")&&b.hasOwnProperty("values")){for(c=e-1;c>=0;c--)d=this.options.data[c],d.hasOwnProperty(b.field)&&-1!==a.inArray(d[b.field],b.values)&&(this.options.data.splice(c,1),"server"===this.options.sidePagination&&(this.options.totalRows-=1));e!==this.options.data.length&&(this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0))}},o.prototype.removeAll=function(){this.options.data.length>0&&(this.options.data.splice(0,this.options.data.length),this.initSearch(),this.initPagination(),this.initBody(!0))},o.prototype.getRowByUniqueId=function(a){var b,c,d,e=this.options.uniqueId,f=this.options.data.length,g=null;for(b=f-1;b>=0;b--){if(c=this.options.data[b],c.hasOwnProperty(e))d=c[e];else{if(!c._data.hasOwnProperty(e))continue;d=c._data[e]}if("string"==typeof d?a=a.toString():"number"==typeof d&&(Number(d)===d&&d%1===0?a=parseInt(a):d===Number(d)&&0!==d&&(a=parseFloat(a))),d===a){g=c;break}}return g},o.prototype.removeByUniqueId=function(a){var b=this.options.data.length,c=this.getRowByUniqueId(a);c&&this.options.data.splice(this.options.data.indexOf(c),1),b!==this.options.data.length&&(this.initSearch(),this.initPagination(),this.initBody(!0))},o.prototype.updateByUniqueId=function(b){var c=this,d=a.isArray(b)?b:[b];a.each(d,function(b,d){var e;d.hasOwnProperty("id")&&d.hasOwnProperty("row")&&(e=a.inArray(c.getRowByUniqueId(d.id),c.options.data),-1!==e&&a.extend(c.options.data[e],d.row))}),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.insertRow=function(a){a.hasOwnProperty("index")&&a.hasOwnProperty("row")&&(this.data.splice(a.index,0,a.row),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0))},o.prototype.updateRow=function(b){var c=this,d=a.isArray(b)?b:[b];a.each(d,function(b,d){d.hasOwnProperty("index")&&d.hasOwnProperty("row")&&a.extend(c.options.data[d.index],d.row)}),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)},o.prototype.initHiddenRows=function(){this.hiddenRows=[]},o.prototype.showRow=function(a){this.toggleRow(a,!0)},o.prototype.hideRow=function(a){this.toggleRow(a,!1)},o.prototype.toggleRow=function(b,c){var d,e;b.hasOwnProperty("index")?d=this.getData()[b.index]:b.hasOwnProperty("uniqueId")&&(d=this.getRowByUniqueId(b.uniqueId)),d&&(e=a.inArray(d,this.hiddenRows),c||-1!==e?c&&e>-1&&this.hiddenRows.splice(e,1):this.hiddenRows.push(d),this.initBody(!0))},o.prototype.getHiddenRows=function(){var b=this,c=this.getData(),d=[];return a.each(c,function(c,e){a.inArray(e,b.hiddenRows)>-1&&d.push(e)}),this.hiddenRows=d,d},o.prototype.mergeCells=function(b){var c,d,e,f=b.index,g=a.inArray(b.field,this.getVisibleFields()),h=b.rowspan||1,i=b.colspan||1,j=this.$body.find(">tr");if(this.options.detailView&&!this.options.cardView&&(g+=1),e=j.eq(f).find(">td").eq(g),!(0>f||0>g||f>=this.data.length)){for(c=f;f+h>c;c++)for(d=g;g+i>d;d++)j.eq(c).find(">td").eq(d).hide();e.attr("rowspan",h).attr("colspan",i).show()}},o.prototype.updateCell=function(a){a.hasOwnProperty("index")&&a.hasOwnProperty("field")&&a.hasOwnProperty("value")&&(this.data[a.index][a.field]=a.value,a.reinit!==!1&&(this.initSort(),this.initBody(!0)))},o.prototype.getOptions=function(){return this.options},o.prototype.getSelections=function(){var b=this;return a.grep(this.options.data,function(a){return a[b.header.stateField]===!0})},o.prototype.getAllSelections=function(){var b=this;return a.grep(this.options.data,function(a){return a[b.header.stateField]})},o.prototype.checkAll=function(){this.checkAll_(!0)},o.prototype.uncheckAll=function(){this.checkAll_(!1)},o.prototype.checkInvert=function(){var b=this,c=b.$selectItem.filter(":enabled"),d=c.filter(":checked");c.each(function(){a(this).prop("checked",!a(this).prop("checked"))}),b.updateRows(),b.updateSelected(),b.trigger("uncheck-some",d),d=b.getSelections(),b.trigger("check-some",d)},o.prototype.checkAll_=function(a){var b;a||(b=this.getSelections()),this.$selectAll.add(this.$selectAll_).prop("checked",a),this.$selectItem.filter(":enabled").prop("checked",a),this.updateRows(),a&&(b=this.getSelections()),this.trigger(a?"check-all":"uncheck-all",b)},o.prototype.check=function(a){this.check_(!0,a)},o.prototype.uncheck=function(a){this.check_(!1,a)},o.prototype.check_=function(a,b){var d=this.$selectItem.filter(c('[data-index="%s"]',b)).prop("checked",a);this.data[b][this.header.stateField]=a,this.updateSelected(),this.trigger(a?"check":"uncheck",this.data[b],d)},o.prototype.checkBy=function(a){this.checkBy_(!0,a)},o.prototype.uncheckBy=function(a){this.checkBy_(!1,a)},o.prototype.checkBy_=function(b,d){if(d.hasOwnProperty("field")&&d.hasOwnProperty("values")){var e=this,f=[];a.each(this.options.data,function(g,h){if(!h.hasOwnProperty(d.field))return!1;if(-1!==a.inArray(h[d.field],d.values)){var i=e.$selectItem.filter(":enabled").filter(c('[data-index="%s"]',g)).prop("checked",b);h[e.header.stateField]=b,f.push(h),e.trigger(b?"check":"uncheck",h,i)}}),this.updateSelected(),this.trigger(b?"check-some":"uncheck-some",f)}},o.prototype.destroy=function(){this.$el.insertBefore(this.$container),a(this.options.toolbar).insertBefore(this.$el),this.$container.next().remove(),this.$container.remove(),this.$el.html(this.$el_.html()).css("margin-top","0").attr("class",this.$el_.attr("class")||"")},o.prototype.showLoading=function(){this.$tableLoading.show()},o.prototype.hideLoading=function(){this.$tableLoading.hide()},o.prototype.togglePagination=function(){this.options.pagination=!this.options.pagination;var a=this.$toolbar.find('button[name="paginationSwitch"] i');this.options.pagination?a.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchDown):a.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchUp),this.updatePagination()},o.prototype.refresh=function(a){a&&a.url&&(this.options.url=a.url),a&&a.pageNumber&&(this.options.pageNumber=a.pageNumber),a&&a.pageSize&&(this.options.pageSize=a.pageSize),this.initServer(a&&a.silent,a&&a.query,a&&a.url),this.trigger("refresh",a)},o.prototype.resetWidth=function(){this.options.showHeader&&this.options.height&&this.fitHeader(),this.options.showFooter&&this.fitFooter()},o.prototype.showColumn=function(a){this.toggleColumn(e(this.columns,a),!0,!0)},o.prototype.hideColumn=function(a){this.toggleColumn(e(this.columns,a),!1,!0)},o.prototype.getHiddenColumns=function(){return a.grep(this.columns,function(a){return!a.visible})},o.prototype.getVisibleColumns=function(){return a.grep(this.columns,function(a){return a.visible})},o.prototype.toggleAllColumns=function(b){if(a.each(this.columns,function(a){this.columns[a].visible=b}),this.initHeader(),this.initSearch(),this.initPagination(),this.initBody(),this.options.showColumns){var c=this.$toolbar.find(".keep-open input").prop("disabled",!1);c.filter(":checked").length<=this.options.minimumCountColumns&&c.filter(":checked").prop("disabled",!0)}},o.prototype.showAllColumns=function(){this.toggleAllColumns(!0)},o.prototype.hideAllColumns=function(){this.toggleAllColumns(!1)},o.prototype.filterBy=function(b){this.filterColumns=a.isEmptyObject(b)?{}:b,this.options.pageNumber=1,this.initSearch(),this.updatePagination()},o.prototype.scrollTo=function(a){return"string"==typeof a&&(a="bottom"===a?this.$tableBody[0].scrollHeight:0),"number"==typeof a&&this.$tableBody.scrollTop(a),"undefined"==typeof a?this.$tableBody.scrollTop():void 0},o.prototype.getScrollPosition=function(){return this.scrollTo()},o.prototype.selectPage=function(a){a>0&&a<=this.options.totalPages&&(this.options.pageNumber=a,this.updatePagination())},o.prototype.prevPage=function(){this.options.pageNumber>1&&(this.options.pageNumber--,this.updatePagination())},o.prototype.nextPage=function(){this.options.pageNumber<this.options.totalPages&&(this.options.pageNumber++,this.updatePagination())},o.prototype.toggleView=function(){this.options.cardView=!this.options.cardView,this.initHeader(),this.initBody(),this.trigger("toggle",this.options.cardView)},o.prototype.refreshOptions=function(b){i(this.options,b,!0)||(this.options=a.extend(this.options,b),this.trigger("refresh-options",this.options),this.destroy(),this.init())},o.prototype.resetSearch=function(a){var b=this.$toolbar.find(".search input");b.val(a||""),this.onSearch({currentTarget:b})},o.prototype.expandRow_=function(a,b){var d=this.$body.find(c('> tr[data-index="%s"]',b));d.next().is("tr.detail-view")===(a?!1:!0)&&d.find("> td > .detail-icon").click()},o.prototype.expandRow=function(a){this.expandRow_(!0,a)},o.prototype.collapseRow=function(a){this.expandRow_(!1,a)},o.prototype.expandAllRows=function(b){if(b){var d=this.$body.find(c('> tr[data-index="%s"]',0)),e=this,f=null,g=!1,h=-1;if(d.next().is("tr.detail-view")?d.next().next().is("tr.detail-view")||(d.next().find(".detail-icon").click(),g=!0):(d.find("> td > .detail-icon").click(),g=!0),g)try{h=setInterval(function(){f=e.$body.find("tr.detail-view").last().find(".detail-icon"),f.length>0?f.click():clearInterval(h)},1)}catch(i){clearInterval(h)}}else for(var j=this.$body.children(),k=0;k<j.length;k++)this.expandRow_(!0,a(j[k]).data("index"))},o.prototype.collapseAllRows=function(b){if(b)this.expandRow_(!1,0);else for(var c=this.$body.children(),d=0;d<c.length;d++)this.expandRow_(!1,a(c[d]).data("index"))},o.prototype.updateFormatText=function(a,b){this.options[c("format%s",a)]&&("string"==typeof b?this.options[c("format%s",a)]=function(){return b}:"function"==typeof b&&(this.options[c("format%s",a)]=b)),this.initToolbar(),this.initPagination(),this.initBody()};var p=["getOptions","getSelections","getAllSelections","getData","load","append","prepend","remove","removeAll","insertRow","updateRow","updateCell","updateByUniqueId","removeByUniqueId","getRowByUniqueId","showRow","hideRow","getHiddenRows","mergeCells","checkAll","uncheckAll","checkInvert","check","uncheck","checkBy","uncheckBy","refresh","resetView","resetWidth","destroy","showLoading","hideLoading","showColumn","hideColumn","getHiddenColumns","getVisibleColumns","showAllColumns","hideAllColumns","filterBy","scrollTo","getScrollPosition","selectPage","prevPage","nextPage","togglePagination","toggleView","refreshOptions","resetSearch","expandRow","collapseRow","expandAllRows","collapseAllRows","updateFormatText"];a.fn.bootstrapTable=function(b){var c,d=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=a(this),f=e.data("bootstrap.table"),g=a.extend({},o.DEFAULTS,e.data(),"object"==typeof b&&b);if("string"==typeof b){if(a.inArray(b,p)<0)throw new Error("Unknown method: "+b);if(!f)return;c=f[b].apply(f,d),"destroy"===b&&e.removeData("bootstrap.table")}f||e.data("bootstrap.table",f=new o(this,g))}),"undefined"==typeof c?this:c},a.fn.bootstrapTable.Constructor=o,a.fn.bootstrapTable.defaults=o.DEFAULTS,a.fn.bootstrapTable.columnDefaults=o.COLUMN_DEFAULTS,a.fn.bootstrapTable.locales=o.LOCALES,a.fn.bootstrapTable.methods=p,a.fn.bootstrapTable.utils={sprintf:c,getFieldIndex:e,compareObjects:i,calculateObjectValue:h,getItemField:l,objectKeys:n,isIEBrowser:m},a(function(){a('[data-toggle="table"]').bootstrapTable()})}(jQuery);
  6147. define("bootstrap-table", ["bootstrap"], (function (global) {
  6148. return function () {
  6149. var ret, fn;
  6150. return ret || global.$.fn.bootstrapTable;
  6151. };
  6152. }(this)));
  6153. /**
  6154. * Bootstrap Table Chinese translation
  6155. * Author: Zhixin Wen<wenzhixin2010@gmail.com>
  6156. */
  6157. (function ($) {
  6158. 'use strict';
  6159. $.fn.bootstrapTable.locales['zh-CN'] = {
  6160. formatLoadingMessage: function () {
  6161. return '正在努力地加载数据中,请稍候……';
  6162. },
  6163. formatRecordsPerPage: function (pageNumber) {
  6164. return '每页显示 ' + pageNumber + ' 条记录';
  6165. },
  6166. formatShowingRows: function (pageFrom, pageTo, totalRows) {
  6167. return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录';
  6168. },
  6169. formatSearch: function () {
  6170. return '搜索';
  6171. },
  6172. formatNoMatches: function () {
  6173. return '没有找到匹配的记录';
  6174. },
  6175. formatPaginationSwitch: function () {
  6176. return '隐藏/显示分页';
  6177. },
  6178. formatRefresh: function () {
  6179. return '刷新';
  6180. },
  6181. formatToggle: function () {
  6182. return '切换';
  6183. },
  6184. formatColumns: function () {
  6185. return '列';
  6186. },
  6187. formatExport: function () {
  6188. return '导出数据';
  6189. },
  6190. formatClearFilters: function () {
  6191. return '清空过滤';
  6192. }
  6193. };
  6194. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
  6195. })(jQuery);
  6196. define("bootstrap-table-lang", ["bootstrap-table"], (function (global) {
  6197. return function () {
  6198. var ret, fn;
  6199. return ret || global.$.fn.bootstrapTable.defaults;
  6200. };
  6201. }(this)));
  6202. /**
  6203. * @author: Dennis Hernández
  6204. * @webSite: http://djhvscf.github.io/Blog
  6205. * @version: v1.1.0
  6206. */
  6207. !function ($) {
  6208. 'use strict';
  6209. var showHideColumns = function (that, checked) {
  6210. if (that.options.columnsHidden.length > 0 ) {
  6211. $.each(that.columns, function (i, column) {
  6212. if (that.options.columnsHidden.indexOf(column.field) !== -1) {
  6213. if (column.visible !== checked) {
  6214. that.toggleColumn($.fn.bootstrapTable.utils.getFieldIndex(that.columns, column.field), checked, true);
  6215. }
  6216. }
  6217. });
  6218. }
  6219. };
  6220. var resetView = function (that) {
  6221. if (that.options.height || that.options.showFooter) {
  6222. setTimeout(function(){
  6223. that.resetView.call(that);
  6224. }, 1);
  6225. }
  6226. };
  6227. var changeView = function (that, width, height) {
  6228. if (that.options.minHeight) {
  6229. if ((width <= that.options.minWidth) && (height <= that.options.minHeight)) {
  6230. conditionCardView(that);
  6231. } else if ((width > that.options.minWidth) && (height > that.options.minHeight)) {
  6232. conditionFullView(that);
  6233. }
  6234. } else {
  6235. if (width <= that.options.minWidth) {
  6236. conditionCardView(that);
  6237. } else if (width > that.options.minWidth) {
  6238. conditionFullView(that);
  6239. }
  6240. }
  6241. resetView(that);
  6242. };
  6243. var conditionCardView = function (that) {
  6244. changeTableView(that, false);
  6245. showHideColumns(that, false);
  6246. };
  6247. var conditionFullView = function (that) {
  6248. changeTableView(that, true);
  6249. showHideColumns(that, true);
  6250. };
  6251. var changeTableView = function (that, cardViewState) {
  6252. that.options.cardView = cardViewState;
  6253. that.toggleView();
  6254. };
  6255. var debounce = function(func,wait) {
  6256. var timeout;
  6257. return function() {
  6258. var context = this,
  6259. args = arguments;
  6260. var later = function() {
  6261. timeout = null;
  6262. func.apply(context,args);
  6263. };
  6264. clearTimeout(timeout);
  6265. timeout = setTimeout(later, wait);
  6266. };
  6267. };
  6268. $.extend($.fn.bootstrapTable.defaults, {
  6269. mobileResponsive: false,
  6270. minWidth: 562,
  6271. minHeight: undefined,
  6272. heightThreshold: 100, // just slightly larger than mobile chrome's auto-hiding toolbar
  6273. checkOnInit: true,
  6274. columnsHidden: []
  6275. });
  6276. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  6277. _init = BootstrapTable.prototype.init;
  6278. BootstrapTable.prototype.init = function () {
  6279. _init.apply(this, Array.prototype.slice.apply(arguments));
  6280. if (!this.options.mobileResponsive) {
  6281. return;
  6282. }
  6283. if (!this.options.minWidth) {
  6284. return;
  6285. }
  6286. if (this.options.minWidth < 100 && this.options.resizable) {
  6287. console.log("The minWidth when the resizable extension is active should be greater or equal than 100");
  6288. this.options.minWidth = 100;
  6289. }
  6290. var that = this,
  6291. old = {
  6292. width: $(window).width(),
  6293. height: $(window).height()
  6294. };
  6295. $(window).on('resize orientationchange',debounce(function (evt) {
  6296. // reset view if height has only changed by at least the threshold.
  6297. var height = $(this).height(),
  6298. width = $(this).width();
  6299. if (Math.abs(old.height - height) > that.options.heightThreshold || old.width != width) {
  6300. changeView(that, width, height);
  6301. old = {
  6302. width: width,
  6303. height: height
  6304. };
  6305. }
  6306. },200));
  6307. if (this.options.checkOnInit) {
  6308. var height = $(window).height(),
  6309. width = $(window).width();
  6310. changeView(this, width, height);
  6311. old = {
  6312. width: width,
  6313. height: height
  6314. };
  6315. }
  6316. };
  6317. }(jQuery);
  6318. define("bootstrap-table-mobile", ["bootstrap-table"], (function (global) {
  6319. return function () {
  6320. var ret, fn;
  6321. return ret || global.$.fn.bootstrapTable.defaults;
  6322. };
  6323. }(this)));
  6324. /*
  6325. tableExport.jquery.plugin
  6326. Version 1.9.8
  6327. Copyright (c) 2015-2017 hhurz, https://github.com/hhurz
  6328. Original Work Copyright (c) 2014 Giri Raj
  6329. Licensed under the MIT License
  6330. */
  6331. var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(c,f,u){c instanceof String&&(c=String(c));for(var C=c.length,D=0;D<C;D++){var O=c[D];if(f.call(u,O,D,c))return{i:D,v:O}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(c,f,u){c!=Array.prototype&&c!=Object.prototype&&(c[f]=u.value)};
  6332. $jscomp.getGlobal=function(c){return"undefined"!=typeof window&&window===c?c:"undefined"!=typeof global&&null!=global?global:c};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(c,f,u,C){if(f){u=$jscomp.global;c=c.split(".");for(C=0;C<c.length-1;C++){var D=c[C];D in u||(u[D]={});u=u[D]}c=c[c.length-1];C=u[c];f=f(C);f!=C&&null!=f&&$jscomp.defineProperty(u,c,{configurable:!0,writable:!0,value:f})}};
  6333. $jscomp.polyfill("Array.prototype.find",function(c){return c?c:function(c,u){return $jscomp.findInternal(this,c,u).v}},"es6","es3");
  6334. (function(c){c.fn.extend({tableExport:function(f){function u(b){var e=[];C(b,"tbody").each(function(){e.push.apply(e,D(c(this),a.tbodySelector))});a.tfootSelector.length&&C(b,"tfoot").each(function(){e.push.apply(e,D(c(this),a.tfootSelector))});return e}function C(b,e){var a=b.parents("table").length;return b.find(e).filter(function(){return c(this).closest("table").parents("table").length===a})}function D(b,e){return b.find(e).filter(function(){return 0===c(this).find("table").length&&1===c(this).parents("table").length})}
  6335. function O(b){var e=[];c(b).find("thead").first().find("th").each(function(b,a){void 0!==c(a).attr("data-field")?e[b]=c(a).attr("data-field"):e[b]=b.toString()});return e}function P(b){var e="undefined"!==typeof b[0].cellIndex,a="undefined"!==typeof b[0].rowIndex,r=e||a?ya(b):b.is(":visible"),g=b.data("tableexport-display");e&&"none"!=g&&"always"!=g&&(b=c(b[0].parentNode),a="undefined"!==typeof b[0].rowIndex,g=b.data("tableexport-display"));a&&"none"!=g&&"always"!=g&&(g=b.closest("table").data("tableexport-display"));
  6336. return"none"!==g&&(1==r||"always"==g)}function ya(b){var e=[];R&&(e=K.filter(function(){var e=!1;this.nodeType==b[0].nodeType&&("undefined"!==typeof this.rowIndex&&this.rowIndex==b[0].rowIndex?e=!0:"undefined"!==typeof this.cellIndex&&this.cellIndex==b[0].cellIndex&&"undefined"!==typeof this.parentNode.rowIndex&&"undefined"!==typeof b[0].parentNode.rowIndex&&this.parentNode.rowIndex==b[0].parentNode.rowIndex&&(e=!0));return e}));return 0==R||0==e.length}function za(b,e,k){var r=!1;P(b)?0<a.ignoreColumn.length&&
  6337. (-1!=c.inArray(k,a.ignoreColumn)||-1!=c.inArray(k-e,a.ignoreColumn)||Q.length>k&&"undefined"!=typeof Q[k]&&-1!=c.inArray(Q[k],a.ignoreColumn))&&(r=!0):r=!0;return r}function B(b,e,k,r,g){if("function"===typeof g){var h=!1;"function"===typeof a.onIgnoreRow&&(h=a.onIgnoreRow(c(b),k));if(!1===h&&-1==c.inArray(k,a.ignoreRow)&&-1==c.inArray(k-r,a.ignoreRow)&&P(c(b))){var x=c(b).find(e),q=0;x.each(function(b){var e=c(this),a,h=parseInt(this.getAttribute("colspan")),r=parseInt(this.getAttribute("rowspan"));
  6338. G.forEach(function(b){if(k>=b.s.r&&k<=b.e.r&&q>=b.s.c&&q<=b.e.c)for(a=0;a<=b.e.c-b.s.c;++a)g(null,k,q++)});if(!1===za(e,x.length,b)){if(r||h)h=h||1,G.push({s:{r:k,c:q},e:{r:k+(r||1)-1,c:q+h-1}});g(this,k,q++)}if(h)for(a=0;a<h-1;++a)g(null,k,q++)});G.forEach(function(b){if(k>=b.s.r&&k<=b.e.r&&q>=b.s.c&&q<=b.e.c)for(Y=0;Y<=b.e.c-b.s.c;++Y)g(null,k,q++)})}}}function la(b,e){!0===a.consoleLog&&console.log(b.output());if("string"===a.outputMode)return b.output();if("base64"===a.outputMode)return L(b.output());
  6339. if("window"===a.outputMode)window.URL=window.URL||window.webkitURL,window.open(window.URL.createObjectURL(b.output("blob")));else try{var k=b.output("blob");saveAs(k,a.fileName+".pdf")}catch(r){H(a.fileName+".pdf","data:application/pdf"+(e?"":";base64")+",",e?b.output("blob"):b.output())}}function ma(b,e,a){var k=0;"undefined"!==typeof a&&(k=a.colspan);if(0<=k){for(var g=b.width,c=b.textPos.x,x=e.table.columns.indexOf(e.column),q=1;q<k;q++)g+=e.table.columns[x+q].width;1<k&&("right"===b.styles.halign?
  6340. c=b.textPos.x+g-b.width:"center"===b.styles.halign&&(c=b.textPos.x+(g-b.width)/2));b.width=g;b.textPos.x=c;"undefined"!==typeof a&&1<a.rowspan&&(b.height*=a.rowspan);if("middle"===b.styles.valign||"bottom"===b.styles.valign)a=("string"===typeof b.text?b.text.split(/\r\n|\r|\n/g):b.text).length||1,2<a&&(b.textPos.y-=(2-1.15)/2*e.row.styles.fontSize*(a-2)/3);return!0}return!1}function na(b,a,k){"undefined"!=typeof k.images&&a.each(function(){var a=c(this).children();if(c(this).is("img")){var e=oa(this.src);
  6341. k.images[e]={url:this.src,src:this.src}}"undefined"!=typeof a&&0<a.length&&na(b,a,k)})}function Aa(b,a){function e(b){if(b.url){var e=new Image;g=++h;e.crossOrigin="Anonymous";e.onerror=e.onload=function(){if(e.complete&&(0===e.src.indexOf("data:image/")&&(e.width=b.width||e.width||0,e.height=b.height||e.height||0),e.width+e.height)){var k=document.createElement("canvas"),c=k.getContext("2d");k.width=e.width;k.height=e.height;c.drawImage(e,0,0);b.src=k.toDataURL("image/jpeg")}--h||a(g)};e.src=b.url}}
  6342. var c,g=0,h=0;if("undefined"!=typeof b.images)for(c in b.images)b.images.hasOwnProperty(c)&&e(b.images[c]);(b=h)||(a(g),b=void 0);return b}function pa(b,e,k){e.each(function(){var e=c(this).children(),g=0;if(c(this).is("div")){var h=Z(M(this,"background-color"),[255,255,255]),x=Z(M(this,"border-top-color"),[0,0,0]),q=aa(this,"border-top-width",a.jspdf.unit),d=this.getBoundingClientRect(),f=this.offsetLeft*k.dw;g=this.offsetTop*k.dh;var l=d.width*k.dw;d=d.height*k.dh;k.doc.setDrawColor.apply(void 0,
  6343. x);k.doc.setFillColor.apply(void 0,h);k.doc.setLineWidth(q);k.doc.rect(b.x+f,b.y+g,l,d,q?"FD":"F")}else if(c(this).is("img")&&"undefined"!=typeof k.images&&(h=oa(this.src),h=k.images[h],"undefined"!=typeof h)){x=b.width/b.height;q=this.width/this.height;f=b.width;l=b.height;d=19.049976/25.4;q<=x?(l=Math.min(b.height,this.height),f=this.width*l/this.height):q>x&&(f=Math.min(b.width,this.width),l=this.height*f/this.width);f*=d;l*=d;l<b.height&&(g=(b.height-l)/2);try{k.doc.addImage(h.src,b.textPos.x,
  6344. b.y+g,f,l)}catch(Ea){}b.textPos.x+=f}"undefined"!=typeof e&&0<e.length&&pa(b,e,k)})}function qa(b,e,a){if("function"===typeof a.onAutotableText)a.onAutotableText(a.doc,b,e);else{var k=b.textPos.x,g=b.textPos.y,h={halign:b.styles.halign,valign:b.styles.valign};if(e.length){for(e=e[0];e.previousSibling;)e=e.previousSibling;for(var x=!1,q=!1;e;){var d=e.innerText||e.textContent||"";d=(d.length&&" "==d[0]?" ":"")+c.trim(d)+(1<d.length&&" "==d[d.length-1]?" ":"");c(e).is("br")&&(k=b.textPos.x,g+=a.doc.internal.getFontSize());
  6345. c(e).is("b")?x=!0:c(e).is("i")&&(q=!0);(x||q)&&a.doc.setFontType(x&&q?"bolditalic":x?"bold":"italic");var f=a.doc.getStringUnitWidth(d)*a.doc.internal.getFontSize();if(f){if("linebreak"===b.styles.overflow&&k>b.textPos.x&&k+f>b.textPos.x+b.width){if(0<=".,!%*;:=-".indexOf(d.charAt(0))){var l=d.charAt(0);f=a.doc.getStringUnitWidth(l)*a.doc.internal.getFontSize();k+f<=b.textPos.x+b.width&&(a.doc.autoTableText(l,k,g,h),d=d.substring(1,d.length));f=a.doc.getStringUnitWidth(d)*a.doc.internal.getFontSize()}k=
  6346. b.textPos.x;g+=a.doc.internal.getFontSize()}for(;d.length&&k+f>b.textPos.x+b.width;)d=d.substring(0,d.length-1),f=a.doc.getStringUnitWidth(d)*a.doc.internal.getFontSize();a.doc.autoTableText(d,k,g,h);k+=f}if(x||q)c(e).is("b")?x=!1:c(e).is("i")&&(q=!1),a.doc.setFontType(x||q?x?"bold":"italic":"normal");e=e.nextSibling}b.textPos.x=k;b.textPos.y=g}else a.doc.autoTableText(b.text,b.textPos.x,b.textPos.y,h)}}function ba(b,a,c){return b.replace(new RegExp(a.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),
  6347. "g"),c)}function ea(b){b=ba(b||"0",a.numbers.html.thousandsSeparator,"");b=ba(b,a.numbers.html.decimalMark,".");return"number"===typeof b||!1!==jQuery.isNumeric(b)?b:!1}function Ba(b){-1<b.indexOf("%")?(b=ea(b.replace(/%/g,"")),!1!==b&&(b/=100)):b=!1;return b}function z(b,e,k){var r="";if(null!==b){var g=c(b);if(g[0].hasAttribute("data-tableexport-value"))var h=(h=g.data("tableexport-value"))?h+"":"";else if(h=g.html(),"function"===typeof a.onCellHtmlData)h=a.onCellHtmlData(g,e,k,h);else if(""!=h){var d=
  6348. c.parseHTML(h),f=0,l=0;h="";c.each(d,function(){if(c(this).is("input"))h+=g.find("input").eq(f++).val();else if(c(this).is("select"))h+=g.find("select option:selected").eq(l++).text();else if("undefined"===typeof c(this).html())h+=c(this).text();else if(void 0===jQuery().bootstrapTable||!0!==c(this).hasClass("filterControl")&&0===c(b).parents(".detail-view").length)h+=c(this).html()})}if(!0===a.htmlContent)r=c.trim(h);else if(h&&""!=h)if(""!=c(b).data("tableexport-cellformat")){var n=h.replace(/\n/g,
  6349. "\u2028").replace(/<br\s*[\/]?>/gi,"\u2060"),m=c("<div/>").html(n).contents();d=!1;n="";c.each(m.text().split("\u2028"),function(b,a){0<b&&(n+=" ");n+=c.trim(a)});c.each(n.split("\u2060"),function(b,a){0<b&&(r+="\n");r+=c.trim(a).replace(/\u00AD/g,"")});if("json"==a.type||"excel"===a.type&&"xmlss"===a.excelFileFormat||!1===a.numbers.output)d=ea(r),!1!==d&&(r=Number(d));else if(a.numbers.html.decimalMark!=a.numbers.output.decimalMark||a.numbers.html.thousandsSeparator!=a.numbers.output.thousandsSeparator)if(d=
  6350. ea(r),!1!==d){m=(""+d.substr(0>d?1:0)).split(".");1==m.length&&(m[1]="");var p=3<m[0].length?m[0].length%3:0;r=(0>d?"-":"")+(a.numbers.output.thousandsSeparator?(p?m[0].substr(0,p)+a.numbers.output.thousandsSeparator:"")+m[0].substr(p).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):m[0])+(m[1].length?a.numbers.output.decimalMark+m[1]:"")}}else r=h;!0===a.escape&&(r=escape(r));"function"===typeof a.onCellData&&(r=a.onCellData(g,e,k,r))}return r}function Ca(b,a,c){return a+"-"+c.toLowerCase()}
  6351. function Z(b,a){(b=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(b))&&(a=[parseInt(b[1]),parseInt(b[2]),parseInt(b[3])]);return a}function ra(b){var a=M(b,"text-align"),k=M(b,"font-weight"),r=M(b,"font-style"),g="";"start"==a&&(a="rtl"==M(b,"direction")?"right":"left");700<=k&&(g="bold");"italic"==r&&(g+=r);""===g&&(g="normal");a={style:{align:a,bcolor:Z(M(b,"background-color"),[255,255,255]),color:Z(M(b,"color"),[0,0,0]),fstyle:g},colspan:parseInt(c(b).attr("colspan"))||0,rowspan:parseInt(c(b).attr("rowspan"))||
  6352. 0};null!==b&&(b=b.getBoundingClientRect(),a.rect={width:b.width,height:b.height});return a}function M(b,a){try{return window.getComputedStyle?(a=a.replace(/([a-z])([A-Z])/,Ca),window.getComputedStyle(b,null).getPropertyValue(a)):b.currentStyle?b.currentStyle[a]:b.style[a]}catch(k){}return""}function aa(b,a,c){a=M(b,a).match(/\d+/);if(null!==a){a=a[0];b=b.parentElement;var e=document.createElement("div");e.style.overflow="hidden";e.style.visibility="hidden";b.appendChild(e);e.style.width=100+c;c=100/
  6353. e.offsetWidth;b.removeChild(e);return a*c}return 0}function fa(){if(!(this instanceof fa))return new fa;this.SheetNames=[];this.Sheets={}}function sa(b){for(var a=new ArrayBuffer(b.length),c=new Uint8Array(a),d=0;d!=b.length;++d)c[d]=b.charCodeAt(d)&255;return a}function Da(b){for(var a={},c={s:{c:1E7,r:1E7},e:{c:0,r:0}},d=0;d!=b.length;++d)for(var g=0;g!=b[d].length;++g){c.s.r>d&&(c.s.r=d);c.s.c>g&&(c.s.c=g);c.e.r<d&&(c.e.r=d);c.e.c<g&&(c.e.c=g);var h={v:b[d][g]};if(null!==h.v){var f=XLSX.utils.encode_cell({c:g,
  6354. r:d});if("number"===typeof h.v)h.t="n";else if("boolean"===typeof h.v)h.t="b";else if(h.v instanceof Date){h.t="n";h.z=XLSX.SSF._table[14];var q=h;var l=(Date.parse(h.v)-new Date(Date.UTC(1899,11,30)))/864E5;q.v=l}else h.t="s";a[f]=h}}1E7>c.s.c&&(a["!ref"]=XLSX.utils.encode_range(c));return a}function oa(b){var a=0,c;if(0===b.length)return a;var d=0;for(c=b.length;d<c;d++){var g=b.charCodeAt(d);a=(a<<5)-a+g;a|=0}return a}function H(b,a,c){var e=window.navigator.userAgent;if(!1!==b&&window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(new Blob([c]),
  6355. b);else if(!1!==b&&(0<e.indexOf("MSIE ")||e.match(/Trident.*rv\:11\./))){if(a=document.createElement("iframe"))document.body.appendChild(a),a.setAttribute("style","display:none"),a.contentDocument.open("txt/html","replace"),a.contentDocument.write(c),a.contentDocument.close(),a.focus(),a.contentDocument.execCommand("SaveAs",!0,b),document.body.removeChild(a)}else{var g=document.createElement("a");if(g){var h=null;g.style.display="none";!1!==b?g.download=b:g.target="_blank";"object"==typeof c?(window.URL=
  6356. window.URL||window.webkitURL,h=window.URL.createObjectURL(c),g.href=h):0<=a.toLowerCase().indexOf("base64,")?g.href=a+L(c):g.href=a+encodeURIComponent(c);document.body.appendChild(g);if(document.createEvent)null===ca&&(ca=document.createEvent("MouseEvents")),ca.initEvent("click",!0,!1),g.dispatchEvent(ca);else if(document.createEventObject)g.fireEvent("onclick");else if("function"==typeof g.onclick)g.onclick();setTimeout(function(){h&&window.URL.revokeObjectURL(h);document.body.removeChild(g)},100)}}}
  6357. function L(a){var b,c="",d=0;if("string"===typeof a){a=a.replace(/\x0d\x0a/g,"\n");var g="";for(b=0;b<a.length;b++){var h=a.charCodeAt(b);128>h?g+=String.fromCharCode(h):(127<h&&2048>h?g+=String.fromCharCode(h>>6|192):(g+=String.fromCharCode(h>>12|224),g+=String.fromCharCode(h>>6&63|128)),g+=String.fromCharCode(h&63|128))}a=g}for(;d<a.length;){var f=a.charCodeAt(d++);g=a.charCodeAt(d++);b=a.charCodeAt(d++);h=f>>2;f=(f&3)<<4|g>>4;var q=(g&15)<<2|b>>6;var l=b&63;isNaN(g)?q=l=64:isNaN(b)&&(l=64);c=c+
  6358. "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(f)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(q)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(l)}return c}var a={consoleLog:!1,csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,displayTableName:!1,escape:!1,excelFileFormat:"xlshtml",excelRTL:!1,excelstyles:[],exportHiddenCells:!1,fileName:"tableExport",
  6359. htmlContent:!1,ignoreColumn:[],ignoreRow:[],jsonScope:"all",jspdf:{orientation:"p",unit:"pt",format:"a4",margins:{left:20,right:10,top:10,bottom:10},onDocCreated:null,autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize",halign:"left",valign:"middle"},headerStyles:{fillColor:[52,73,94],textColor:255,fontStyle:"bold",halign:"center"},alternateRowStyles:{fillColor:245},tableExport:{doc:null,onAfterAutotable:null,onBeforeAutotable:null,
  6360. onAutotableText:null,onTable:null,outputImages:!0}}},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onCellData:null,onCellHtmlData:null,onIgnoreRow:null,onMsoNumberFormat:null,outputMode:"file",pdfmake:{enabled:!1,docDefinition:{pageOrientation:"portrait",defaultStyle:{font:"Roboto"}},fonts:{}},tbodySelector:"tr",tfootSelector:"tr",theadSelector:"tr",tableName:"Table",type:"csv",worksheetName:""},v=this,ca=null,p=[],t=[],l=0,m="",Q=[],G=[],
  6361. K=[],R=!1;c.extend(!0,a,f);Q=O(v);if("csv"==a.type||"tsv"==a.type||"txt"==a.type){var I="",U=0;G=[];l=0;var ha=function(b,e,k){b.each(function(){m="";B(this,e,l,k+b.length,function(b,c,e){var g=m,h="";if(null!==b)if(b=z(b,c,e),c=null===b||""===b?"":b.toString(),"tsv"==a.type)b instanceof Date&&b.toLocaleString(),h=ba(c,"\t"," ");else if(b instanceof Date)h=a.csvEnclosure+b.toLocaleString()+a.csvEnclosure;else if(h=ba(c,a.csvEnclosure,a.csvEnclosure+a.csvEnclosure),0<=h.indexOf(a.csvSeparator)||/[\r\n ]/g.test(h))h=
  6362. a.csvEnclosure+h+a.csvEnclosure;m=g+(h+("tsv"==a.type?"\t":a.csvSeparator))});m=c.trim(m).substring(0,m.length-1);0<m.length&&(0<I.length&&(I+="\n"),I+=m);l++});return b.length};U+=ha(c(v).find("thead").first().find(a.theadSelector),"th,td",U);C(c(v),"tbody").each(function(){U+=ha(D(c(this),a.tbodySelector),"td,th",U)});a.tfootSelector.length&&ha(c(v).find("tfoot").first().find(a.tfootSelector),"td,th",U);I+="\n";!0===a.consoleLog&&console.log(I);if("string"===a.outputMode)return I;if("base64"===
  6363. a.outputMode)return L(I);if("window"===a.outputMode){H(!1,"data:text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8,",I);return}try{var A=new Blob([I],{type:"text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8"});saveAs(A,a.fileName+"."+a.type,"csv"!=a.type||!1===a.csvUseBOM)}catch(b){H(a.fileName+"."+a.type,"data:text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8,"+("csv"==a.type&&a.csvUseBOM?"\ufeff":""),I)}}else if("sql"==a.type){l=0;G=[];var w="INSERT INTO `"+a.tableName+"` (";p=c(v).find("thead").first().find(a.theadSelector);
  6364. p.each(function(){B(this,"th,td",l,p.length,function(a,c,k){w+="'"+z(a,c,k)+"',"});l++;w=c.trim(w);w=c.trim(w).substring(0,w.length-1)});w+=") VALUES ";t=u(c(v));c(t).each(function(){m="";B(this,"td,th",l,p.length+t.length,function(a,c,k){m+="'"+z(a,c,k)+"',"});3<m.length&&(w+="("+m,w=c.trim(w).substring(0,w.length-1),w+="),");l++});w=c.trim(w).substring(0,w.length-1);w+=";";!0===a.consoleLog&&console.log(w);if("string"===a.outputMode)return w;if("base64"===a.outputMode)return L(w);try{A=new Blob([w],
  6365. {type:"text/plain;charset=utf-8"}),saveAs(A,a.fileName+".sql")}catch(b){H(a.fileName+".sql","data:application/sql;charset=utf-8,",w)}}else if("json"==a.type){var S=[];G=[];p=c(v).find("thead").first().find(a.theadSelector);p.each(function(){var a=[];B(this,"th,td",l,p.length,function(b,c,d){a.push(z(b,c,d))});S.push(a)});var ia=[];t=u(c(v));c(t).each(function(){var a={},e=0;B(this,"td,th",l,p.length+t.length,function(b,c,g){S.length?a[S[S.length-1][e]]=z(b,c,g):a[e]=z(b,c,g);e++});!1===c.isEmptyObject(a)&&
  6366. ia.push(a);l++});f="";f="head"==a.jsonScope?JSON.stringify(S):"data"==a.jsonScope?JSON.stringify(ia):JSON.stringify({header:S,data:ia});!0===a.consoleLog&&console.log(f);if("string"===a.outputMode)return f;if("base64"===a.outputMode)return L(f);try{A=new Blob([f],{type:"application/json;charset=utf-8"}),saveAs(A,a.fileName+".json")}catch(b){H(a.fileName+".json","data:application/json;charset=utf-8;base64,",f)}}else if("xml"===a.type){l=0;G=[];var J='<?xml version="1.0" encoding="utf-8"?>';J+="<tabledata><fields>";
  6367. p=c(v).find("thead").first().find(a.theadSelector);p.each(function(){B(this,"th,td",l,p.length,function(a,c,d){J+="<field>"+z(a,c,d)+"</field>"});l++});J+="</fields><data>";var ta=1;t=u(c(v));c(t).each(function(){var a=1;m="";B(this,"td,th",l,p.length+t.length,function(b,c,d){m+="<column-"+a+">"+z(b,c,d)+"</column-"+a+">";a++});0<m.length&&"<column-1></column-1>"!=m&&(J+='<row id="'+ta+'">'+m+"</row>",ta++);l++});J+="</data></tabledata>";!0===a.consoleLog&&console.log(J);if("string"===a.outputMode)return J;
  6368. if("base64"===a.outputMode)return L(J);try{A=new Blob([J],{type:"application/xml;charset=utf-8"}),saveAs(A,a.fileName+".xml")}catch(b){H(a.fileName+".xml","data:application/xml;charset=utf-8;base64,",J)}}else if("excel"===a.type&&"xmlss"===a.excelFileFormat){var ja=[],F=[];c(v).filter(function(){return P(c(this))}).each(function(){function b(a,b,e){var g=[];c(a).each(function(){var b=0,h=0;m="";B(this,"td,th",l,e+a.length,function(a,e,d){if(null!==a){var k="";e=z(a,e,d);d="String";if(!1!==jQuery.isNumeric(e))d=
  6369. "Number";else{var f=Ba(e);!1!==f&&(e=f,d="Number",k+=' ss:StyleID="pct1"')}"Number"!==d&&(e=e.replace(/\n/g,"<br>"));f=parseInt(a.getAttribute("colspan"));a=parseInt(a.getAttribute("rowspan"));g.forEach(function(a){if(l>=a.s.r&&l<=a.e.r&&h>=a.s.c&&h<=a.e.c)for(var c=0;c<=a.e.c-a.s.c;++c)h++,b++});if(a||f)a=a||1,f=f||1,g.push({s:{r:l,c:h},e:{r:l+a-1,c:h+f-1}});1<f&&(k+=' ss:MergeAcross="'+(f-1)+'"',h+=f-1);1<a&&(k+=' ss:MergeDown="'+(a-1)+'" ss:StyleID="rsp1"');0<b&&(k+=' ss:Index="'+(h+1)+'"',b=0);
  6370. m+="<Cell"+k+'><Data ss:Type="'+d+'">'+c("<div />").text(e).html()+"</Data></Cell>\r";h++}});0<m.length&&(E+='<Row ss:AutoFitHeight="0">\r'+m+"</Row>\r");l++});return a.length}var e=c(this),d="";"string"===typeof a.worksheetName&&a.worksheetName.length?d=a.worksheetName+" "+(F.length+1):"undefined"!==typeof a.worksheetName[F.length]&&(d=a.worksheetName[F.length]);d.length||(d=e.find("caption").text()||"");d.length||(d="Table "+(F.length+1));d=d.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31).trim();
  6371. F.push(c("<div />").text(d).html());!1===a.exportHiddenCells&&(K=e.find("tr, th, td").filter(":hidden"),R=0<K.length);l=0;Q=O(this);E="<Table>\r";d=0;d+=b(e.find("thead").first().find(a.theadSelector),"th,td",d);b(u(e),"td,th",d);E+="</Table>\r";ja.push(E);!0===a.consoleLog&&console.log(E)});f={};for(var y={},n,N,T=0,Y=F.length;T<Y;T++)n=F[T],N=f[n],N=f[n]=null==N?1:N+1,2==N&&(F[y[n]]=F[y[n]].substring(0,29)+"-1"),1<f[n]?F[T]=F[T].substring(0,29)+"-"+f[n]:y[n]=T;f='<?xml version="1.0" encoding="UTF-8"?>\r<?mso-application progid="Excel.Sheet"?>\r<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:o="urn:schemas-microsoft-com:office:office"\r xmlns:x="urn:schemas-microsoft-com:office:excel"\r xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:html="http://www.w3.org/TR/REC-html40">\r<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">\r <Created>'+
  6372. (new Date).toISOString()+'</Created>\r</DocumentProperties>\r<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">\r <AllowPNG/>\r</OfficeDocumentSettings>\r<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">\r <WindowHeight>9000</WindowHeight>\r <WindowWidth>13860</WindowWidth>\r <WindowTopX>0</WindowTopX>\r <WindowTopY>0</WindowTopY>\r <ProtectStructure>False</ProtectStructure>\r <ProtectWindows>False</ProtectWindows>\r</ExcelWorkbook>\r<Styles>\r <Style ss:ID="Default" ss:Name="Normal">\r <Alignment ss:Vertical="Bottom"/>\r <Borders/>\r <Font/>\r <Interior/>\r <NumberFormat/>\r <Protection/>\r </Style>\r <Style ss:ID="rsp1">\r <Alignment ss:Vertical="Center"/>\r </Style>\r <Style ss:ID="pct1">\r <NumberFormat ss:Format="Percent"/>\r </Style>\r</Styles>\r';
  6373. for(y=0;y<ja.length;y++)f+='<Worksheet ss:Name="'+F[y]+'" ss:RightToLeft="'+(a.excelRTL?"1":"0")+'">\r'+ja[y],f=a.excelRTL?f+'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">\r<DisplayRightToLeft/>\r</WorksheetOptions>\r':f+'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"/>\r',f+="</Worksheet>\r";f+="</Workbook>\r";!0===a.consoleLog&&console.log(f);if("string"===a.outputMode)return f;if("base64"===a.outputMode)return L(f);try{A=new Blob([f],{type:"application/xml;charset=utf-8"}),
  6374. saveAs(A,a.fileName+".xml")}catch(b){H(a.fileName+".xml","data:application/xml;charset=utf-8;base64,",f)}}else if("excel"==a.type||"xls"==a.type||"word"==a.type||"doc"==a.type){f="excel"==a.type||"xls"==a.type?"excel":"word";y="excel"==f?"xls":"doc";n='xmlns:x="urn:schemas-microsoft-com:office:'+f+'"';var E="",V="";c(v).filter(function(){return P(c(this))}).each(function(){var b=c(this);""===V&&(V=a.worksheetName||b.find("caption").text()||"Table",V=V.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31).trim());
  6375. !1===a.exportHiddenCells&&(K=b.find("tr, th, td").filter(":hidden"),R=0<K.length);l=0;G=[];Q=O(this);E+="<table><thead>";p=b.find("thead").first().find(a.theadSelector);p.each(function(){m="";B(this,"th,td",l,p.length,function(b,d,f){if(null!==b){var e="";m+="<th";for(var h in a.excelstyles)if(a.excelstyles.hasOwnProperty(h)){var k=c(b).css(a.excelstyles[h]);""!==k&&"0px none rgb(0, 0, 0)"!=k&&"rgba(0, 0, 0, 0)"!=k&&(e+=""===e?'style="':";",e+=a.excelstyles[h]+":"+k)}""!==e&&(m+=" "+e+'"');c(b).is("[colspan]")&&
  6376. (m+=' colspan="'+c(b).attr("colspan")+'"');c(b).is("[rowspan]")&&(m+=' rowspan="'+c(b).attr("rowspan")+'"');m+=">"+z(b,d,f)+"</th>"}});0<m.length&&(E+="<tr>"+m+"</tr>");l++});E+="</thead><tbody>";t=u(b);c(t).each(function(){var b=c(this);m="";B(this,"td,th",l,p.length+t.length,function(e,d,g){if(null!==e){var h=z(e,d,g),k="",f=c(e).data("tableexport-msonumberformat");"undefined"==typeof f&&"function"===typeof a.onMsoNumberFormat&&(f=a.onMsoNumberFormat(e,d,g));"undefined"!=typeof f&&""!==f&&(k="style=\"mso-number-format:'"+
  6377. f+"'");for(var l in a.excelstyles)a.excelstyles.hasOwnProperty(l)&&(f=c(e).css(a.excelstyles[l]),""===f&&(f=b.css(a.excelstyles[l])),""!==f&&"0px none rgb(0, 0, 0)"!=f&&"rgba(0, 0, 0, 0)"!=f&&(k+=""===k?'style="':";",k+=a.excelstyles[l]+":"+f));m+="<td";""!==k&&(m+=" "+k+'"');c(e).is("[colspan]")&&(m+=' colspan="'+c(e).attr("colspan")+'"');c(e).is("[rowspan]")&&(m+=' rowspan="'+c(e).attr("rowspan")+'"');"string"===typeof h&&""!=h&&(h=h.replace(/\n/g,"<br>"));m+=">"+h+"</td>"}});0<m.length&&(E+="<tr>"+
  6378. m+"</tr>");l++});a.displayTableName&&(E+="<tr><td></td></tr><tr><td></td></tr><tr><td>"+z(c("<p>"+a.tableName+"</p>"))+"</td></tr>");E+="</tbody></table>";!0===a.consoleLog&&console.log(E)});n='<html xmlns:o="urn:schemas-microsoft-com:office:office" '+n+' xmlns="http://www.w3.org/TR/REC-html40">'+('<meta http-equiv="content-type" content="application/vnd.ms-'+f+'; charset=UTF-8">')+"<head>";"excel"===f&&(n+="\x3c!--[if gte mso 9]>",n+="<xml>",n+="<x:ExcelWorkbook>",n+="<x:ExcelWorksheets>",n+="<x:ExcelWorksheet>",
  6379. n+="<x:Name>",n+=V,n+="</x:Name>",n+="<x:WorksheetOptions>",n+="<x:DisplayGridlines/>",a.excelRTL&&(n+="<x:DisplayRightToLeft/>"),n+="</x:WorksheetOptions>",n+="</x:ExcelWorksheet>",n+="</x:ExcelWorksheets>",n+="</x:ExcelWorkbook>",n+="</xml>",n+="<![endif]--\x3e");n+="<style>br {mso-data-placement:same-cell;}</style>";n+="</head>";n+="<body>";n+=E;n+="</body>";n+="</html>";!0===a.consoleLog&&console.log(n);if("string"===a.outputMode)return n;if("base64"===a.outputMode)return L(n);try{A=new Blob([n],
  6380. {type:"application/vnd.ms-"+a.type}),saveAs(A,a.fileName+"."+y)}catch(b){H(a.fileName+"."+y,"data:application/vnd.ms-"+f+";base64,",n)}}else if("xlsx"==a.type){var ua=[],ka=[];l=0;t=c(v).find("thead").first().find(a.theadSelector);t.push.apply(t,u(c(v)));c(t).each(function(){var b=[];B(this,"th,td",l,t.length,function(c,d,f){if("undefined"!==typeof c&&null!==c){f=z(c,d,f);d=parseInt(c.getAttribute("colspan"));c=parseInt(c.getAttribute("rowspan"));ka.forEach(function(a){if(l>=a.s.r&&l<=a.e.r&&b.length>=
  6381. a.s.c&&b.length<=a.e.c)for(var c=0;c<=a.e.c-a.s.c;++c)b.push(null)});if(c||d)d=d||1,ka.push({s:{r:l,c:b.length},e:{r:l+(c||1)-1,c:b.length+d-1}});"function"!==typeof a.onCellData&&""!==f&&f==+f&&(f=+f);b.push(""!==f?f:null);if(d)for(c=0;c<d-1;++c)b.push(null)}});ua.push(b);l++});f=new fa;y=Da(ua);y["!merges"]=ka;f.SheetNames.push(a.worksheetName);f.Sheets[a.worksheetName]=y;f=XLSX.write(f,{bookType:a.type,bookSST:!1,type:"binary"});try{A=new Blob([sa(f)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"}),
  6382. saveAs(A,a.fileName+"."+a.type)}catch(b){H(a.fileName+"."+a.type,"data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8,",sa(f))}}else if("png"==a.type)html2canvas(c(v)[0]).then(function(b){b=b.toDataURL();for(var c=atob(b.substring(22)),d=new ArrayBuffer(c.length),f=new Uint8Array(d),g=0;g<c.length;g++)f[g]=c.charCodeAt(g);!0===a.consoleLog&&console.log(c);if("string"===a.outputMode)return c;if("base64"===a.outputMode)return L(b);if("window"===a.outputMode)window.open(b);
  6383. else try{A=new Blob([d],{type:"image/png"}),saveAs(A,a.fileName+".png")}catch(h){H(a.fileName+".png","data:image/png,",A)}});else if("pdf"==a.type)if(!0===a.pdfmake.enabled){f=[];var va=[];l=0;G=[];y=function(a,d,f){var b=0;c(a).each(function(){var a=[];B(this,d,l,f,function(b,c,d){if("undefined"!==typeof b&&null!==b){var e=parseInt(b.getAttribute("colspan")),g=parseInt(b.getAttribute("rowspan"));b=z(b,c,d)||" ";1<e||1<g?a.push({colSpan:e||1,rowSpan:g||1,text:b}):a.push(b)}else a.push(" ")});a.length&&
  6384. va.push(a);b<a.length&&(b=a.length);l++});return b};p=c(this).find("thead").first().find(a.theadSelector);n=y(p,"th,td",p.length);for(N=f.length;N<n;N++)f.push("*");t=u(c(this));y(t,"th,td",p.length+t.length);f={content:[{table:{headerRows:p.length,widths:f,body:va}}]};c.extend(!0,f,a.pdfmake.docDefinition);pdfMake.fonts={Roboto:{normal:"Roboto-Regular.ttf",bold:"Roboto-Medium.ttf",italics:"Roboto-Italic.ttf",bolditalics:"Roboto-MediumItalic.ttf"}};c.extend(!0,pdfMake.fonts,a.pdfmake.fonts);pdfMake.createPdf(f).getBuffer(function(b){try{var c=
  6385. new Blob([b],{type:"application/pdf"});saveAs(c,a.fileName+".pdf")}catch(k){H(a.fileName+".pdf","data:application/pdf;base64,",b)}})}else if(!1===a.jspdf.autotable){f={dim:{w:aa(c(v).first().get(0),"width","mm"),h:aa(c(v).first().get(0),"height","mm")},pagesplit:!1};var wa=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);wa.addHTML(c(v).first(),a.jspdf.margins.left,a.jspdf.margins.top,f,function(){la(wa,!1)})}else{var d=a.jspdf.autotable.tableExport;if("string"===typeof a.jspdf.format&&
  6386. "bestfit"===a.jspdf.format.toLowerCase()){var W={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89]},da="",X="",xa=0;c(v).each(function(){if(P(c(this))){var a=aa(c(this).get(0),"width","pt");if(a>xa){a>W.a0[0]&&(da="a0",X="l");for(var d in W)W.hasOwnProperty(d)&&W[d][1]>a&&(da=d,X="l",W[d][0]>a&&(X="p"));xa=a}}});a.jspdf.format=""===da?"a4":da;a.jspdf.orientation=""===X?"w":X}if(null==d.doc&&(d.doc=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format),
  6387. "function"===typeof a.jspdf.onDocCreated))a.jspdf.onDocCreated(d.doc);!0===d.outputImages&&(d.images={});"undefined"!=typeof d.images&&(c(v).filter(function(){return P(c(this))}).each(function(){var b=0;G=[];!1===a.exportHiddenCells&&(K=c(this).find("tr, th, td").filter(":hidden"),R=0<K.length);p=c(this).find("thead").find(a.theadSelector);t=u(c(this));c(t).each(function(){B(this,"td,th",p.length+b,p.length+t.length,function(a){if("undefined"!==typeof a&&null!==a){var b=c(a).children();"undefined"!=
  6388. typeof b&&0<b.length&&na(a,b,d)}});b++})}),p=[],t=[]);Aa(d,function(){c(v).filter(function(){return P(c(this))}).each(function(){var b;l=0;G=[];!1===a.exportHiddenCells&&(K=c(this).find("tr, th, td").filter(":hidden"),R=0<K.length);Q=O(this);d.columns=[];d.rows=[];d.rowoptions={};if("function"===typeof d.onTable&&!1===d.onTable(c(this),a))return!0;a.jspdf.autotable.tableExport=null;var e=c.extend(!0,{},a.jspdf.autotable);a.jspdf.autotable.tableExport=d;e.margin={};c.extend(!0,e.margin,a.jspdf.margins);
  6389. e.tableExport=d;"function"!==typeof e.beforePageContent&&(e.beforePageContent=function(a){1==a.pageCount&&a.table.rows.concat(a.table.headerRow).forEach(function(b){0<b.height&&(b.height+=(2-1.15)/2*b.styles.fontSize,a.table.height+=(2-1.15)/2*b.styles.fontSize)})});"function"!==typeof e.createdHeaderCell&&(e.createdHeaderCell=function(a,b){a.styles=c.extend({},b.row.styles);if("undefined"!=typeof d.columns[b.column.dataKey]){var g=d.columns[b.column.dataKey];if("undefined"!=typeof g.rect){a.contentWidth=
  6390. g.rect.width;if("undefined"==typeof d.heightRatio||0===d.heightRatio){var f=b.row.raw[b.column.dataKey].rowspan?b.row.raw[b.column.dataKey].rect.height/b.row.raw[b.column.dataKey].rowspan:b.row.raw[b.column.dataKey].rect.height;d.heightRatio=a.styles.rowHeight/f}f=b.row.raw[b.column.dataKey].rect.height*d.heightRatio;f>a.styles.rowHeight&&(a.styles.rowHeight=f)}"undefined"!=typeof g.style&&!0!==g.style.hidden&&(a.styles.halign=g.style.align,"inherit"===e.styles.fillColor&&(a.styles.fillColor=g.style.bcolor),
  6391. "inherit"===e.styles.textColor&&(a.styles.textColor=g.style.color),"inherit"===e.styles.fontStyle&&(a.styles.fontStyle=g.style.fstyle))}});"function"!==typeof e.createdCell&&(e.createdCell=function(a,b){b=d.rowoptions[b.row.index+":"+b.column.dataKey];"undefined"!=typeof b&&"undefined"!=typeof b.style&&!0!==b.style.hidden&&(a.styles.halign=b.style.align,"inherit"===e.styles.fillColor&&(a.styles.fillColor=b.style.bcolor),"inherit"===e.styles.textColor&&(a.styles.textColor=b.style.color),"inherit"===
  6392. e.styles.fontStyle&&(a.styles.fontStyle=b.style.fstyle))});"function"!==typeof e.drawHeaderCell&&(e.drawHeaderCell=function(a,b){var c=d.columns[b.column.dataKey];return(!0!==c.style.hasOwnProperty("hidden")||!0!==c.style.hidden)&&0<=c.rowIndex?ma(a,b,c):!1});"function"!==typeof e.drawCell&&(e.drawCell=function(a,b){var c=d.rowoptions[b.row.index+":"+b.column.dataKey];if(ma(a,b,c))if(d.doc.rect(a.x,a.y,a.width,a.height,a.styles.fillStyle),"undefined"!=typeof c&&"undefined"!=typeof c.kids&&0<c.kids.length){b=
  6393. a.height/c.rect.height;if(b>d.dh||"undefined"==typeof d.dh)d.dh=b;d.dw=a.width/c.rect.width;b=a.textPos.y;pa(a,c.kids,d);a.textPos.y=b;qa(a,c.kids,d)}else qa(a,{},d);return!1});d.headerrows=[];p=c(this).find("thead").find(a.theadSelector);p.each(function(){b=0;d.headerrows[l]=[];B(this,"th,td",l,p.length,function(a,c,e){var f=ra(a);f.title=z(a,c,e);f.key=b++;f.rowIndex=l;d.headerrows[l].push(f)});l++});if(0<l)for(var f=l-1;0<=f;)c.each(d.headerrows[f],function(){var a=this;0<f&&null===this.rect&&
  6394. (a=d.headerrows[f-1][this.key]);null!==a&&0<=a.rowIndex&&(!0!==a.style.hasOwnProperty("hidden")||!0!==a.style.hidden)&&d.columns.push(a)}),f=0<d.columns.length?-1:f-1;var m=0;t=[];t=u(c(this));c(t).each(function(){var a=[];b=0;B(this,"td,th",l,p.length+t.length,function(e,f,g){if("undefined"===typeof d.columns[b]){var h={title:"",key:b,style:{hidden:!0}};d.columns.push(h)}"undefined"!==typeof e&&null!==e?(h=ra(e),h.kids=c(e).children()):(h=c.extend(!0,{},d.rowoptions[m+":"+(b-1)]),h.colspan=-1);d.rowoptions[m+
  6395. ":"+b++]=h;a.push(z(e,f,g))});a.length&&(d.rows.push(a),m++);l++});if("function"===typeof d.onBeforeAutotable)d.onBeforeAutotable(c(this),d.columns,d.rows,e);d.doc.autoTable(d.columns,d.rows,e);if("function"===typeof d.onAfterAutotable)d.onAfterAutotable(c(this),e);a.jspdf.autotable.startY=d.doc.autoTableEndPosY()+e.margin.top});la(d.doc,"undefined"!=typeof d.images&&!1===jQuery.isEmptyObject(d.images));"undefined"!=typeof d.headerrows&&(d.headerrows.length=0);"undefined"!=typeof d.columns&&(d.columns.length=
  6396. 0);"undefined"!=typeof d.rows&&(d.rows.length=0);delete d.doc;d.doc=null})}return this}})})(jQuery);
  6397. define("tableexport", ["jquery"], (function (global) {
  6398. return function () {
  6399. var ret, fn;
  6400. return ret || global.$.fn.extend;
  6401. };
  6402. }(this)));
  6403. /*
  6404. * bootstrap-table - v1.11.1 - 2017-02-22
  6405. * https://github.com/wenzhixin/bootstrap-table
  6406. * Copyright (c) 2017 zhixin wen
  6407. * Licensed MIT License
  6408. */
  6409. !function(a){"use strict";var b=a.fn.bootstrapTable.utils.sprintf,c={json:"JSON",xml:"XML",png:"PNG",csv:"CSV",txt:"TXT",sql:"SQL",doc:"MS-Word",excel:"MS-Excel",xlsx:"MS-Excel (OpenXML)",powerpoint:"MS-Powerpoint",pdf:"PDF"};a.extend(a.fn.bootstrapTable.defaults,{showExport:!1,exportDataType:"basic",exportTypes:["json","xml","csv","txt","sql","excel"],exportOptions:{}}),a.extend(a.fn.bootstrapTable.defaults.icons,{"export":"glyphicon-export icon-share"}),a.extend(a.fn.bootstrapTable.locales,{formatExport:function(){return"Export data"}}),a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales);var d=a.fn.bootstrapTable.Constructor,e=d.prototype.initToolbar;d.prototype.initToolbar=function(){if(this.showToolbar=this.options.showExport,e.apply(this,Array.prototype.slice.apply(arguments)),this.options.showExport){var d=this,f=this.$toolbar.find(">.btn-group"),g=f.find("div.export");if(!g.length){g=a(['<div class="export btn-group">','<button class="btn'+b(" btn-%s",this.options.buttonsClass)+b(" btn-%s",this.options.iconSize)+' dropdown-toggle" aria-label="export type" title="'+this.options.formatExport()+'" data-toggle="dropdown" type="button">',b('<i class="%s %s"></i> ',this.options.iconsPrefix,this.options.icons["export"]),'<span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">',"</ul>","</div>"].join("")).appendTo(f);var h=g.find(".dropdown-menu"),i=this.options.exportTypes;if("string"==typeof this.options.exportTypes){var j=this.options.exportTypes.slice(1,-1).replace(/ /g,"").split(",");i=[],a.each(j,function(a,b){i.push(b.slice(1,-1))})}a.each(i,function(a,b){c.hasOwnProperty(b)&&h.append(['<li role="menuitem" data-type="'+b+'">','<a href="javascript:void(0)">',c[b],"</a>","</li>"].join(""))}),h.find("li").click(function(){var b=a(this).data("type"),c=function(){d.$el.tableExport(a.extend({},d.options.exportOptions,{type:b,escape:!1}))};if("all"===d.options.exportDataType&&d.options.pagination)d.$el.one("server"===d.options.sidePagination?"post-body.bs.table":"page-change.bs.table",function(){c(),d.togglePagination()}),d.togglePagination();else if("selected"===d.options.exportDataType){var e=d.getData(),f=d.getAllSelections();"server"===d.options.sidePagination&&(e={total:d.options.totalRows},e[d.options.dataField]=d.getData(),f={total:d.options.totalRows},f[d.options.dataField]=d.getAllSelections()),d.load(f),c(),d.load(e)}else c()})}}}}(jQuery);
  6410. define("bootstrap-table-export", ["bootstrap-table","tableexport"], (function (global) {
  6411. return function () {
  6412. var ret, fn;
  6413. return ret || global.$.fn.bootstrapTable.defaults;
  6414. };
  6415. }(this)));
  6416. !function(a){"use strict";if("function"==typeof define&&define.amd)define('bootstrap-datetimepicker',["jquery","moment"],a);else if("object"==typeof exports)module.exports=a(require("jquery"),require("moment"));else{if("undefined"==typeof jQuery)throw"bootstrap-datetimepicker requires jQuery to be loaded first";if("undefined"==typeof moment)throw"bootstrap-datetimepicker requires Moment.js to be loaded first";a(jQuery,moment)}}(function(a,b){"use strict";if(!b)throw new Error("bootstrap-datetimepicker requires Moment.js to be loaded first");var c=function(c,d){var e,f,g,h,i,j,k,l={},m=!0,n=!1,o=!1,p=0,q=[{clsName:"days",navFnc:"M",navStep:1},{clsName:"months",navFnc:"y",navStep:1},{clsName:"years",navFnc:"y",navStep:10},{clsName:"decades",navFnc:"y",navStep:100}],r=["days","months","years","decades"],s=["top","bottom","auto"],t=["left","right","auto"],u=["default","top","bottom"],v={up:38,38:"up",down:40,40:"down",left:37,37:"left",right:39,39:"right",tab:9,9:"tab",escape:27,27:"escape",enter:13,13:"enter",pageUp:33,33:"pageUp",pageDown:34,34:"pageDown",shift:16,16:"shift",control:17,17:"control",space:32,32:"space",t:84,84:"t",delete:46,46:"delete"},w={},x=function(){return void 0!==b.tz&&void 0!==d.timeZone&&null!==d.timeZone&&""!==d.timeZone},y=function(a){var c;return c=void 0===a||null===a?b():b.isDate(a)||b.isMoment(a)?b(a):x()?b.tz(a,j,d.useStrict,d.timeZone):b(a,j,d.useStrict),x()&&c.tz(d.timeZone),c},z=function(a){if("string"!=typeof a||a.length>1)throw new TypeError("isEnabled expects a single character string parameter");switch(a){case"y":return i.indexOf("Y")!==-1;case"M":return i.indexOf("M")!==-1;case"d":return i.toLowerCase().indexOf("d")!==-1;case"h":case"H":return i.toLowerCase().indexOf("h")!==-1;case"m":return i.indexOf("m")!==-1;case"s":return i.indexOf("s")!==-1;default:return!1}},A=function(){return z("h")||z("m")||z("s")},B=function(){return z("y")||z("M")||z("d")},C=function(){var b=a("<thead>").append(a("<tr>").append(a("<th>").addClass("prev").attr("data-action","previous").append(a("<span>").addClass(d.icons.previous))).append(a("<th>").addClass("picker-switch").attr("data-action","pickerSwitch").attr("colspan",d.calendarWeeks?"6":"5")).append(a("<th>").addClass("next").attr("data-action","next").append(a("<span>").addClass(d.icons.next)))),c=a("<tbody>").append(a("<tr>").append(a("<td>").attr("colspan",d.calendarWeeks?"8":"7")));return[a("<div>").addClass("datepicker-days").append(a("<table>").addClass("table-condensed").append(b).append(a("<tbody>"))),a("<div>").addClass("datepicker-months").append(a("<table>").addClass("table-condensed").append(b.clone()).append(c.clone())),a("<div>").addClass("datepicker-years").append(a("<table>").addClass("table-condensed").append(b.clone()).append(c.clone())),a("<div>").addClass("datepicker-decades").append(a("<table>").addClass("table-condensed").append(b.clone()).append(c.clone()))]},D=function(){var b=a("<tr>"),c=a("<tr>"),e=a("<tr>");return z("h")&&(b.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.incrementHour}).addClass("btn").attr("data-action","incrementHours").append(a("<span>").addClass(d.icons.up)))),c.append(a("<td>").append(a("<span>").addClass("timepicker-hour").attr({"data-time-component":"hours",title:d.tooltips.pickHour}).attr("data-action","showHours"))),e.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.decrementHour}).addClass("btn").attr("data-action","decrementHours").append(a("<span>").addClass(d.icons.down))))),z("m")&&(z("h")&&(b.append(a("<td>").addClass("separator")),c.append(a("<td>").addClass("separator").html(":")),e.append(a("<td>").addClass("separator"))),b.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.incrementMinute}).addClass("btn").attr("data-action","incrementMinutes").append(a("<span>").addClass(d.icons.up)))),c.append(a("<td>").append(a("<span>").addClass("timepicker-minute").attr({"data-time-component":"minutes",title:d.tooltips.pickMinute}).attr("data-action","showMinutes"))),e.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.decrementMinute}).addClass("btn").attr("data-action","decrementMinutes").append(a("<span>").addClass(d.icons.down))))),z("s")&&(z("m")&&(b.append(a("<td>").addClass("separator")),c.append(a("<td>").addClass("separator").html(":")),e.append(a("<td>").addClass("separator"))),b.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.incrementSecond}).addClass("btn").attr("data-action","incrementSeconds").append(a("<span>").addClass(d.icons.up)))),c.append(a("<td>").append(a("<span>").addClass("timepicker-second").attr({"data-time-component":"seconds",title:d.tooltips.pickSecond}).attr("data-action","showSeconds"))),e.append(a("<td>").append(a("<a>").attr({href:"#",tabindex:"-1",title:d.tooltips.decrementSecond}).addClass("btn").attr("data-action","decrementSeconds").append(a("<span>").addClass(d.icons.down))))),h||(b.append(a("<td>").addClass("separator")),c.append(a("<td>").append(a("<button>").addClass("btn btn-primary").attr({"data-action":"togglePeriod",tabindex:"-1",title:d.tooltips.togglePeriod}))),e.append(a("<td>").addClass("separator"))),a("<div>").addClass("timepicker-picker").append(a("<table>").addClass("table-condensed").append([b,c,e]))},E=function(){var b=a("<div>").addClass("timepicker-hours").append(a("<table>").addClass("table-condensed")),c=a("<div>").addClass("timepicker-minutes").append(a("<table>").addClass("table-condensed")),d=a("<div>").addClass("timepicker-seconds").append(a("<table>").addClass("table-condensed")),e=[D()];return z("h")&&e.push(b),z("m")&&e.push(c),z("s")&&e.push(d),e},F=function(){var b=[];return d.showTodayButton&&b.push(a("<td>").append(a("<a>").attr({"data-action":"today",title:d.tooltips.today}).append(a("<span>").addClass(d.icons.today)))),!d.sideBySide&&B()&&A()&&b.push(a("<td>").append(a("<a>").attr({"data-action":"togglePicker",title:d.tooltips.selectTime}).append(a("<span>").addClass(d.icons.time)))),d.showClear&&b.push(a("<td>").append(a("<a>").attr({"data-action":"clear",title:d.tooltips.clear}).append(a("<span>").addClass(d.icons.clear)))),d.showClose&&b.push(a("<td>").append(a("<a>").attr({"data-action":"close",title:d.tooltips.close}).append(a("<span>").addClass(d.icons.close)))),a("<table>").addClass("table-condensed").append(a("<tbody>").append(a("<tr>").append(b)))},G=function(){var b=a("<div>").addClass("bootstrap-datetimepicker-widget dropdown-menu"),c=a("<div>").addClass("datepicker").append(C()),e=a("<div>").addClass("timepicker").append(E()),f=a("<ul>").addClass("list-unstyled"),g=a("<li>").addClass("picker-switch"+(d.collapse?" accordion-toggle":"")).append(F());return d.inline&&b.removeClass("dropdown-menu"),h&&b.addClass("usetwentyfour"),z("s")&&!h&&b.addClass("wider"),d.sideBySide&&B()&&A()?(b.addClass("timepicker-sbs"),"top"===d.toolbarPlacement&&b.append(g),b.append(a("<div>").addClass("row").append(c.addClass("col-md-6")).append(e.addClass("col-md-6"))),"bottom"===d.toolbarPlacement&&b.append(g),b):("top"===d.toolbarPlacement&&f.append(g),B()&&f.append(a("<li>").addClass(d.collapse&&A()?"collapse in":"").append(c)),"default"===d.toolbarPlacement&&f.append(g),A()&&f.append(a("<li>").addClass(d.collapse&&B()?"collapse":"").append(e)),"bottom"===d.toolbarPlacement&&f.append(g),b.append(f))},H=function(){var b,e={};return b=c.is("input")||d.inline?c.data():c.find("input").data(),b.dateOptions&&b.dateOptions instanceof Object&&(e=a.extend(!0,e,b.dateOptions)),a.each(d,function(a){var c="date"+a.charAt(0).toUpperCase()+a.slice(1);void 0!==b[c]&&(e[a]=b[c])}),e},I=function(){var b,e=(n||c).position(),f=(n||c).offset(),g=d.widgetPositioning.vertical,h=d.widgetPositioning.horizontal;if(d.widgetParent)b=d.widgetParent.append(o);else if(c.is("input"))b=c.after(o).parent();else{if(d.inline)return void(b=c.append(o));b=c,c.children().first().after(o)}if("auto"===g&&(g=f.top+1.5*o.height()>=a(window).height()+a(window).scrollTop()&&o.height()+c.outerHeight()<f.top?"top":"bottom"),"auto"===h&&(h=b.width()<f.left+o.outerWidth()/2&&f.left+o.outerWidth()>a(window).width()?"right":"left"),"top"===g?o.addClass("top").removeClass("bottom"):o.addClass("bottom").removeClass("top"),"right"===h?o.addClass("pull-right"):o.removeClass("pull-right"),"static"===b.css("position")&&(b=b.parents().filter(function(){return"static"!==a(this).css("position")}).first()),0===b.length)throw new Error("datetimepicker component should be placed within a non-static positioned container");o.css({top:"top"===g?"auto":e.top+c.outerHeight(),bottom:"top"===g?b.outerHeight()-(b===c?0:e.top):"auto",left:"left"===h?b===c?0:e.left:"auto",right:"left"===h?"auto":b.outerWidth()-c.outerWidth()-(b===c?0:e.left)})},J=function(a){"dp.change"===a.type&&(a.date&&a.date.isSame(a.oldDate)||!a.date&&!a.oldDate)||c.trigger(a)},K=function(a){"y"===a&&(a="YYYY"),J({type:"dp.update",change:a,viewDate:f.clone()})},L=function(a){o&&(a&&(k=Math.max(p,Math.min(3,k+a))),o.find(".datepicker > div").hide().filter(".datepicker-"+q[k].clsName).show())},M=function(){var b=a("<tr>"),c=f.clone().startOf("w").startOf("d");for(d.calendarWeeks===!0&&b.append(a("<th>").addClass("cw").text("#"));c.isBefore(f.clone().endOf("w"));)b.append(a("<th>").addClass("dow").text(c.format("dd"))),c.add(1,"d");o.find(".datepicker-days thead").append(b)},N=function(a){return d.disabledDates[a.format("YYYY-MM-DD")]===!0},O=function(a){return d.enabledDates[a.format("YYYY-MM-DD")]===!0},P=function(a){return d.disabledHours[a.format("H")]===!0},Q=function(a){return d.enabledHours[a.format("H")]===!0},R=function(b,c){if(!b.isValid())return!1;if(d.disabledDates&&"d"===c&&N(b))return!1;if(d.enabledDates&&"d"===c&&!O(b))return!1;if(d.minDate&&b.isBefore(d.minDate,c))return!1;if(d.maxDate&&b.isAfter(d.maxDate,c))return!1;if(d.daysOfWeekDisabled&&"d"===c&&d.daysOfWeekDisabled.indexOf(b.day())!==-1)return!1;if(d.disabledHours&&("h"===c||"m"===c||"s"===c)&&P(b))return!1;if(d.enabledHours&&("h"===c||"m"===c||"s"===c)&&!Q(b))return!1;if(d.disabledTimeIntervals&&("h"===c||"m"===c||"s"===c)){var e=!1;if(a.each(d.disabledTimeIntervals,function(){if(b.isBetween(this[0],this[1]))return e=!0,!1}),e)return!1}return!0},S=function(){for(var b=[],c=f.clone().startOf("y").startOf("d");c.isSame(f,"y");)b.push(a("<span>").attr("data-action","selectMonth").addClass("month").text(c.format("MMM"))),c.add(1,"M");o.find(".datepicker-months td").empty().append(b)},T=function(){var b=o.find(".datepicker-months"),c=b.find("th"),g=b.find("tbody").find("span");c.eq(0).find("span").attr("title",d.tooltips.prevYear),c.eq(1).attr("title",d.tooltips.selectYear),c.eq(2).find("span").attr("title",d.tooltips.nextYear),b.find(".disabled").removeClass("disabled"),R(f.clone().subtract(1,"y"),"y")||c.eq(0).addClass("disabled"),c.eq(1).text(f.year()),R(f.clone().add(1,"y"),"y")||c.eq(2).addClass("disabled"),g.removeClass("active"),e.isSame(f,"y")&&!m&&g.eq(e.month()).addClass("active"),g.each(function(b){R(f.clone().month(b),"M")||a(this).addClass("disabled")})},U=function(){var a=o.find(".datepicker-years"),b=a.find("th"),c=f.clone().subtract(5,"y"),g=f.clone().add(6,"y"),h="";for(b.eq(0).find("span").attr("title",d.tooltips.prevDecade),b.eq(1).attr("title",d.tooltips.selectDecade),b.eq(2).find("span").attr("title",d.tooltips.nextDecade),a.find(".disabled").removeClass("disabled"),d.minDate&&d.minDate.isAfter(c,"y")&&b.eq(0).addClass("disabled"),b.eq(1).text(c.year()+"-"+g.year()),d.maxDate&&d.maxDate.isBefore(g,"y")&&b.eq(2).addClass("disabled");!c.isAfter(g,"y");)h+='<span data-action="selectYear" class="year'+(c.isSame(e,"y")&&!m?" active":"")+(R(c,"y")?"":" disabled")+'">'+c.year()+"</span>",c.add(1,"y");a.find("td").html(h)},V=function(){var a,c=o.find(".datepicker-decades"),g=c.find("th"),h=b({y:f.year()-f.year()%100-1}),i=h.clone().add(100,"y"),j=h.clone(),k=!1,l=!1,m="";for(g.eq(0).find("span").attr("title",d.tooltips.prevCentury),g.eq(2).find("span").attr("title",d.tooltips.nextCentury),c.find(".disabled").removeClass("disabled"),(h.isSame(b({y:1900}))||d.minDate&&d.minDate.isAfter(h,"y"))&&g.eq(0).addClass("disabled"),g.eq(1).text(h.year()+"-"+i.year()),(h.isSame(b({y:2e3}))||d.maxDate&&d.maxDate.isBefore(i,"y"))&&g.eq(2).addClass("disabled");!h.isAfter(i,"y");)a=h.year()+12,k=d.minDate&&d.minDate.isAfter(h,"y")&&d.minDate.year()<=a,l=d.maxDate&&d.maxDate.isAfter(h,"y")&&d.maxDate.year()<=a,m+='<span data-action="selectDecade" class="decade'+(e.isAfter(h)&&e.year()<=a?" active":"")+(R(h,"y")||k||l?"":" disabled")+'" data-selection="'+(h.year()+6)+'">'+(h.year()+1)+" - "+(h.year()+12)+"</span>",h.add(12,"y");m+="<span></span><span></span><span></span>",c.find("td").html(m),g.eq(1).text(j.year()+1+"-"+h.year())},W=function(){var b,c,g,h=o.find(".datepicker-days"),i=h.find("th"),j=[],k=[];if(B()){for(i.eq(0).find("span").attr("title",d.tooltips.prevMonth),i.eq(1).attr("title",d.tooltips.selectMonth),i.eq(2).find("span").attr("title",d.tooltips.nextMonth),h.find(".disabled").removeClass("disabled"),i.eq(1).text(f.format(d.dayViewHeaderFormat)),R(f.clone().subtract(1,"M"),"M")||i.eq(0).addClass("disabled"),R(f.clone().add(1,"M"),"M")||i.eq(2).addClass("disabled"),b=f.clone().startOf("M").startOf("w").startOf("d"),g=0;g<42;g++)0===b.weekday()&&(c=a("<tr>"),d.calendarWeeks&&c.append('<td class="cw">'+b.week()+"</td>"),j.push(c)),k=["day"],b.isBefore(f,"M")&&k.push("old"),b.isAfter(f,"M")&&k.push("new"),b.isSame(e,"d")&&!m&&k.push("active"),R(b,"d")||k.push("disabled"),b.isSame(y(),"d")&&k.push("today"),0!==b.day()&&6!==b.day()||k.push("weekend"),J({type:"dp.classify",date:b,classNames:k}),c.append('<td data-action="selectDay" data-day="'+b.format("L")+'" class="'+k.join(" ")+'">'+b.date()+"</td>"),b.add(1,"d");h.find("tbody").empty().append(j),T(),U(),V()}},X=function(){var b=o.find(".timepicker-hours table"),c=f.clone().startOf("d"),d=[],e=a("<tr>");for(f.hour()>11&&!h&&c.hour(12);c.isSame(f,"d")&&(h||f.hour()<12&&c.hour()<12||f.hour()>11);)c.hour()%4===0&&(e=a("<tr>"),d.push(e)),e.append('<td data-action="selectHour" class="hour'+(R(c,"h")?"":" disabled")+'">'+c.format(h?"HH":"hh")+"</td>"),c.add(1,"h");b.empty().append(d)},Y=function(){for(var b=o.find(".timepicker-minutes table"),c=f.clone().startOf("h"),e=[],g=a("<tr>"),h=1===d.stepping?5:d.stepping;f.isSame(c,"h");)c.minute()%(4*h)===0&&(g=a("<tr>"),e.push(g)),g.append('<td data-action="selectMinute" class="minute'+(R(c,"m")?"":" disabled")+'">'+c.format("mm")+"</td>"),c.add(h,"m");b.empty().append(e)},Z=function(){for(var b=o.find(".timepicker-seconds table"),c=f.clone().startOf("m"),d=[],e=a("<tr>");f.isSame(c,"m");)c.second()%20===0&&(e=a("<tr>"),d.push(e)),e.append('<td data-action="selectSecond" class="second'+(R(c,"s")?"":" disabled")+'">'+c.format("ss")+"</td>"),c.add(5,"s");b.empty().append(d)},$=function(){var a,b,c=o.find(".timepicker span[data-time-component]");h||(a=o.find(".timepicker [data-action=togglePeriod]"),b=e.clone().add(e.hours()>=12?-12:12,"h"),a.text(e.format("A")),R(b,"h")?a.removeClass("disabled"):a.addClass("disabled")),c.filter("[data-time-component=hours]").text(e.format(h?"HH":"hh")),c.filter("[data-time-component=minutes]").text(e.format("mm")),c.filter("[data-time-component=seconds]").text(e.format("ss")),X(),Y(),Z()},_=function(){o&&(W(),$())},aa=function(a){var b=m?null:e;if(!a)return m=!0,g.val(""),c.data("date",""),J({type:"dp.change",date:!1,oldDate:b}),void _();if(a=a.clone().locale(d.locale),x()&&a.tz(d.timeZone),1!==d.stepping)for(a.minutes(Math.round(a.minutes()/d.stepping)*d.stepping).seconds(0);d.minDate&&a.isBefore(d.minDate);)a.add(d.stepping,"minutes");R(a)?(e=a,f=e.clone(),g.val(e.format(i)),c.data("date",e.format(i)),m=!1,_(),J({type:"dp.change",date:e.clone(),oldDate:b})):(d.keepInvalid?J({type:"dp.change",date:a,oldDate:b}):g.val(m?"":e.format(i)),J({type:"dp.error",date:a,oldDate:b}))},ba=function(){var b=!1;return o?(o.find(".collapse").each(function(){var c=a(this).data("collapse");return!c||!c.transitioning||(b=!0,!1)}),b?l:(n&&n.hasClass("btn")&&n.toggleClass("active"),o.hide(),a(window).off("resize",I),o.off("click","[data-action]"),o.off("mousedown",!1),o.remove(),o=!1,J({type:"dp.hide",date:e.clone()}),g.blur(),f=e.clone(),l)):l},ca=function(){aa(null)},da=function(a){return void 0===d.parseInputDate?(!b.isMoment(a)||a instanceof Date)&&(a=y(a)):a=d.parseInputDate(a),a},ea={next:function(){var a=q[k].navFnc;f.add(q[k].navStep,a),W(),K(a)},previous:function(){var a=q[k].navFnc;f.subtract(q[k].navStep,a),W(),K(a)},pickerSwitch:function(){L(1)},selectMonth:function(b){var c=a(b.target).closest("tbody").find("span").index(a(b.target));f.month(c),k===p?(aa(e.clone().year(f.year()).month(f.month())),d.inline||ba()):(L(-1),W()),K("M")},selectYear:function(b){var c=parseInt(a(b.target).text(),10)||0;f.year(c),k===p?(aa(e.clone().year(f.year())),d.inline||ba()):(L(-1),W()),K("YYYY")},selectDecade:function(b){var c=parseInt(a(b.target).data("selection"),10)||0;f.year(c),k===p?(aa(e.clone().year(f.year())),d.inline||ba()):(L(-1),W()),K("YYYY")},selectDay:function(b){var c=f.clone();a(b.target).is(".old")&&c.subtract(1,"M"),a(b.target).is(".new")&&c.add(1,"M"),aa(c.date(parseInt(a(b.target).text(),10))),A()||d.keepOpen||d.inline||ba()},incrementHours:function(){var a=e.clone().add(1,"h");R(a,"h")&&aa(a)},incrementMinutes:function(){var a=e.clone().add(d.stepping,"m");R(a,"m")&&aa(a)},incrementSeconds:function(){var a=e.clone().add(1,"s");R(a,"s")&&aa(a)},decrementHours:function(){var a=e.clone().subtract(1,"h");R(a,"h")&&aa(a)},decrementMinutes:function(){var a=e.clone().subtract(d.stepping,"m");R(a,"m")&&aa(a)},decrementSeconds:function(){var a=e.clone().subtract(1,"s");R(a,"s")&&aa(a)},togglePeriod:function(){aa(e.clone().add(e.hours()>=12?-12:12,"h"))},togglePicker:function(b){var c,e=a(b.target),f=e.closest("ul"),g=f.find(".in"),h=f.find(".collapse:not(.in)");if(g&&g.length){if(c=g.data("collapse"),c&&c.transitioning)return;g.collapse?(g.collapse("hide"),h.collapse("show")):(g.removeClass("in"),h.addClass("in")),e.is("span")?e.toggleClass(d.icons.time+" "+d.icons.date):e.find("span").toggleClass(d.icons.time+" "+d.icons.date)}},showPicker:function(){o.find(".timepicker > div:not(.timepicker-picker)").hide(),o.find(".timepicker .timepicker-picker").show()},showHours:function(){o.find(".timepicker .timepicker-picker").hide(),o.find(".timepicker .timepicker-hours").show()},showMinutes:function(){o.find(".timepicker .timepicker-picker").hide(),o.find(".timepicker .timepicker-minutes").show()},showSeconds:function(){o.find(".timepicker .timepicker-picker").hide(),o.find(".timepicker .timepicker-seconds").show()},selectHour:function(b){var c=parseInt(a(b.target).text(),10);h||(e.hours()>=12?12!==c&&(c+=12):12===c&&(c=0)),aa(e.clone().hours(c)),ea.showPicker.call(l)},selectMinute:function(b){aa(e.clone().minutes(parseInt(a(b.target).text(),10))),ea.showPicker.call(l)},selectSecond:function(b){aa(e.clone().seconds(parseInt(a(b.target).text(),10))),ea.showPicker.call(l)},clear:ca,today:function(){var a=y();R(a,"d")&&aa(a)},close:ba},fa=function(b){return!a(b.currentTarget).is(".disabled")&&(ea[a(b.currentTarget).data("action")].apply(l,arguments),!1)},ga=function(){var b,c={year:function(a){return a.month(0).date(1).hours(0).seconds(0).minutes(0)},month:function(a){return a.date(1).hours(0).seconds(0).minutes(0)},day:function(a){return a.hours(0).seconds(0).minutes(0)},hour:function(a){return a.seconds(0).minutes(0)},minute:function(a){return a.seconds(0)}};return g.prop("disabled")||!d.ignoreReadonly&&g.prop("readonly")||o?l:(void 0!==g.val()&&0!==g.val().trim().length?aa(da(g.val().trim())):m&&d.useCurrent&&(d.inline||g.is("input")&&0===g.val().trim().length)&&(b=y(),"string"==typeof d.useCurrent&&(b=c[d.useCurrent](b)),aa(b)),o=G(),M(),S(),o.find(".timepicker-hours").hide(),o.find(".timepicker-minutes").hide(),o.find(".timepicker-seconds").hide(),_(),L(),a(window).on("resize",I),o.on("click","[data-action]",fa),o.on("mousedown",!1),n&&n.hasClass("btn")&&n.toggleClass("active"),I(),o.show(),d.focusOnShow&&!g.is(":focus")&&g.focus(),J({type:"dp.show"}),l)},ha=function(){return o?ba():ga()},ia=function(a){var b,c,e,f,g=null,h=[],i={},j=a.which,k="p";w[j]=k;for(b in w)w.hasOwnProperty(b)&&w[b]===k&&(h.push(b),parseInt(b,10)!==j&&(i[b]=!0));for(b in d.keyBinds)if(d.keyBinds.hasOwnProperty(b)&&"function"==typeof d.keyBinds[b]&&(e=b.split(" "),e.length===h.length&&v[j]===e[e.length-1])){for(f=!0,c=e.length-2;c>=0;c--)if(!(v[e[c]]in i)){f=!1;break}if(f){g=d.keyBinds[b];break}}g&&(g.call(l,o),a.stopPropagation(),a.preventDefault())},ja=function(a){w[a.which]="r",a.stopPropagation(),a.preventDefault()},ka=function(b){var c=a(b.target).val().trim(),d=c?da(c):null;return aa(d),b.stopImmediatePropagation(),!1},la=function(){g.on({change:ka,blur:d.debug?"":ba,keydown:ia,keyup:ja,focus:d.allowInputToggle?ga:""}),c.is("input")?g.on({focus:ga}):n&&(n.on("click",ha),n.on("mousedown",!1))},ma=function(){g.off({change:ka,blur:blur,keydown:ia,keyup:ja,focus:d.allowInputToggle?ba:""}),c.is("input")?g.off({focus:ga}):n&&(n.off("click",ha),n.off("mousedown",!1))},na=function(b){var c={};return a.each(b,function(){var a=da(this);a.isValid()&&(c[a.format("YYYY-MM-DD")]=!0)}),!!Object.keys(c).length&&c},oa=function(b){var c={};return a.each(b,function(){c[this]=!0}),!!Object.keys(c).length&&c},pa=function(){var a=d.format||"L LT";i=a.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,function(a){var b=e.localeData().longDateFormat(a)||a;return b.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,function(a){return e.localeData().longDateFormat(a)||a})}),j=d.extraFormats?d.extraFormats.slice():[],j.indexOf(a)<0&&j.indexOf(i)<0&&j.push(i),h=i.toLowerCase().indexOf("a")<1&&i.replace(/\[.*?\]/g,"").indexOf("h")<1,z("y")&&(p=2),z("M")&&(p=1),z("d")&&(p=0),k=Math.max(p,k),m||aa(e)};if(l.destroy=function(){ba(),ma(),c.removeData("DateTimePicker"),c.removeData("date")},l.toggle=ha,l.show=ga,l.hide=ba,l.disable=function(){return ba(),n&&n.hasClass("btn")&&n.addClass("disabled"),g.prop("disabled",!0),l},l.enable=function(){return n&&n.hasClass("btn")&&n.removeClass("disabled"),g.prop("disabled",!1),l},l.ignoreReadonly=function(a){if(0===arguments.length)return d.ignoreReadonly;if("boolean"!=typeof a)throw new TypeError("ignoreReadonly () expects a boolean parameter");return d.ignoreReadonly=a,l},l.options=function(b){if(0===arguments.length)return a.extend(!0,{},d);if(!(b instanceof Object))throw new TypeError("options() options parameter should be an object");return a.extend(!0,d,b),a.each(d,function(a,b){if(void 0===l[a])throw new TypeError("option "+a+" is not recognized!");l[a](b)}),l},l.date=function(a){if(0===arguments.length)return m?null:e.clone();if(!(null===a||"string"==typeof a||b.isMoment(a)||a instanceof Date))throw new TypeError("date() parameter must be one of [null, string, moment or Date]");return aa(null===a?null:da(a)),l},l.format=function(a){if(0===arguments.length)return d.format;if("string"!=typeof a&&("boolean"!=typeof a||a!==!1))throw new TypeError("format() expects a string or boolean:false parameter "+a);return d.format=a,i&&pa(),l},l.timeZone=function(a){if(0===arguments.length)return d.timeZone;if("string"!=typeof a)throw new TypeError("newZone() expects a string parameter");return d.timeZone=a,l},l.dayViewHeaderFormat=function(a){if(0===arguments.length)return d.dayViewHeaderFormat;if("string"!=typeof a)throw new TypeError("dayViewHeaderFormat() expects a string parameter");return d.dayViewHeaderFormat=a,l},l.extraFormats=function(a){if(0===arguments.length)return d.extraFormats;if(a!==!1&&!(a instanceof Array))throw new TypeError("extraFormats() expects an array or false parameter");return d.extraFormats=a,j&&pa(),l},l.disabledDates=function(b){if(0===arguments.length)return d.disabledDates?a.extend({},d.disabledDates):d.disabledDates;if(!b)return d.disabledDates=!1,_(),l;if(!(b instanceof Array))throw new TypeError("disabledDates() expects an array parameter");return d.disabledDates=na(b),d.enabledDates=!1,_(),l},l.enabledDates=function(b){if(0===arguments.length)return d.enabledDates?a.extend({},d.enabledDates):d.enabledDates;if(!b)return d.enabledDates=!1,_(),l;if(!(b instanceof Array))throw new TypeError("enabledDates() expects an array parameter");return d.enabledDates=na(b),d.disabledDates=!1,_(),l},l.daysOfWeekDisabled=function(a){if(0===arguments.length)return d.daysOfWeekDisabled.splice(0);if("boolean"==typeof a&&!a)return d.daysOfWeekDisabled=!1,_(),l;if(!(a instanceof Array))throw new TypeError("daysOfWeekDisabled() expects an array parameter");if(d.daysOfWeekDisabled=a.reduce(function(a,b){return b=parseInt(b,10),b>6||b<0||isNaN(b)?a:(a.indexOf(b)===-1&&a.push(b),a)},[]).sort(),d.useCurrent&&!d.keepInvalid){for(var b=0;!R(e,"d");){if(e.add(1,"d"),31===b)throw"Tried 31 times to find a valid date";b++}aa(e)}return _(),l},l.maxDate=function(a){if(0===arguments.length)return d.maxDate?d.maxDate.clone():d.maxDate;if("boolean"==typeof a&&a===!1)return d.maxDate=!1,_(),l;"string"==typeof a&&("now"!==a&&"moment"!==a||(a=y()));var b=da(a);if(!b.isValid())throw new TypeError("maxDate() Could not parse date parameter: "+a);if(d.minDate&&b.isBefore(d.minDate))throw new TypeError("maxDate() date parameter is before options.minDate: "+b.format(i));return d.maxDate=b,d.useCurrent&&!d.keepInvalid&&e.isAfter(a)&&aa(d.maxDate),f.isAfter(b)&&(f=b.clone().subtract(d.stepping,"m")),_(),l},l.minDate=function(a){if(0===arguments.length)return d.minDate?d.minDate.clone():d.minDate;if("boolean"==typeof a&&a===!1)return d.minDate=!1,_(),l;"string"==typeof a&&("now"!==a&&"moment"!==a||(a=y()));var b=da(a);if(!b.isValid())throw new TypeError("minDate() Could not parse date parameter: "+a);if(d.maxDate&&b.isAfter(d.maxDate))throw new TypeError("minDate() date parameter is after options.maxDate: "+b.format(i));return d.minDate=b,d.useCurrent&&!d.keepInvalid&&e.isBefore(a)&&aa(d.minDate),f.isBefore(b)&&(f=b.clone().add(d.stepping,"m")),_(),l},l.defaultDate=function(a){if(0===arguments.length)return d.defaultDate?d.defaultDate.clone():d.defaultDate;if(!a)return d.defaultDate=!1,l;"string"==typeof a&&(a="now"===a||"moment"===a?y():y(a));var b=da(a);if(!b.isValid())throw new TypeError("defaultDate() Could not parse date parameter: "+a);if(!R(b))throw new TypeError("defaultDate() date passed is invalid according to component setup validations");return d.defaultDate=b,(d.defaultDate&&d.inline||""===g.val().trim())&&aa(d.defaultDate),l},l.locale=function(a){if(0===arguments.length)return d.locale;if(!b.localeData(a))throw new TypeError("locale() locale "+a+" is not loaded from moment locales!");return d.locale=a,e.locale(d.locale),f.locale(d.locale),i&&pa(),o&&(ba(),ga()),l},l.stepping=function(a){return 0===arguments.length?d.stepping:(a=parseInt(a,10),(isNaN(a)||a<1)&&(a=1),d.stepping=a,l)},l.useCurrent=function(a){var b=["year","month","day","hour","minute"];if(0===arguments.length)return d.useCurrent;if("boolean"!=typeof a&&"string"!=typeof a)throw new TypeError("useCurrent() expects a boolean or string parameter");if("string"==typeof a&&b.indexOf(a.toLowerCase())===-1)throw new TypeError("useCurrent() expects a string parameter of "+b.join(", "));return d.useCurrent=a,l},l.collapse=function(a){if(0===arguments.length)return d.collapse;if("boolean"!=typeof a)throw new TypeError("collapse() expects a boolean parameter");return d.collapse===a?l:(d.collapse=a,o&&(ba(),ga()),l)},l.icons=function(b){if(0===arguments.length)return a.extend({},d.icons);if(!(b instanceof Object))throw new TypeError("icons() expects parameter to be an Object");return a.extend(d.icons,b),o&&(ba(),ga()),l},l.tooltips=function(b){if(0===arguments.length)return a.extend({},d.tooltips);if(!(b instanceof Object))throw new TypeError("tooltips() expects parameter to be an Object");return a.extend(d.tooltips,b),o&&(ba(),ga()),l},l.useStrict=function(a){if(0===arguments.length)return d.useStrict;if("boolean"!=typeof a)throw new TypeError("useStrict() expects a boolean parameter");return d.useStrict=a,l},l.sideBySide=function(a){if(0===arguments.length)return d.sideBySide;if("boolean"!=typeof a)throw new TypeError("sideBySide() expects a boolean parameter");return d.sideBySide=a,o&&(ba(),ga()),l},l.viewMode=function(a){if(0===arguments.length)return d.viewMode;if("string"!=typeof a)throw new TypeError("viewMode() expects a string parameter");if(r.indexOf(a)===-1)throw new TypeError("viewMode() parameter must be one of ("+r.join(", ")+") value");return d.viewMode=a,k=Math.max(r.indexOf(a),p),L(),l},l.toolbarPlacement=function(a){if(0===arguments.length)return d.toolbarPlacement;if("string"!=typeof a)throw new TypeError("toolbarPlacement() expects a string parameter");if(u.indexOf(a)===-1)throw new TypeError("toolbarPlacement() parameter must be one of ("+u.join(", ")+") value");return d.toolbarPlacement=a,o&&(ba(),ga()),l},l.widgetPositioning=function(b){if(0===arguments.length)return a.extend({},d.widgetPositioning);if("[object Object]"!=={}.toString.call(b))throw new TypeError("widgetPositioning() expects an object variable");if(b.horizontal){if("string"!=typeof b.horizontal)throw new TypeError("widgetPositioning() horizontal variable must be a string");if(b.horizontal=b.horizontal.toLowerCase(),t.indexOf(b.horizontal)===-1)throw new TypeError("widgetPositioning() expects horizontal parameter to be one of ("+t.join(", ")+")");d.widgetPositioning.horizontal=b.horizontal}if(b.vertical){if("string"!=typeof b.vertical)throw new TypeError("widgetPositioning() vertical variable must be a string");if(b.vertical=b.vertical.toLowerCase(),s.indexOf(b.vertical)===-1)throw new TypeError("widgetPositioning() expects vertical parameter to be one of ("+s.join(", ")+")");d.widgetPositioning.vertical=b.vertical}return _(),l},l.calendarWeeks=function(a){if(0===arguments.length)return d.calendarWeeks;if("boolean"!=typeof a)throw new TypeError("calendarWeeks() expects parameter to be a boolean value");return d.calendarWeeks=a,_(),l},l.showTodayButton=function(a){if(0===arguments.length)return d.showTodayButton;if("boolean"!=typeof a)throw new TypeError("showTodayButton() expects a boolean parameter");return d.showTodayButton=a,o&&(ba(),ga()),l},l.showClear=function(a){if(0===arguments.length)return d.showClear;if("boolean"!=typeof a)throw new TypeError("showClear() expects a boolean parameter");return d.showClear=a,o&&(ba(),ga()),l},l.widgetParent=function(b){if(0===arguments.length)return d.widgetParent;if("string"==typeof b&&(b=a(b)),null!==b&&"string"!=typeof b&&!(b instanceof a))throw new TypeError("widgetParent() expects a string or a jQuery object parameter");return d.widgetParent=b,o&&(ba(),ga()),l},l.keepOpen=function(a){if(0===arguments.length)return d.keepOpen;if("boolean"!=typeof a)throw new TypeError("keepOpen() expects a boolean parameter");return d.keepOpen=a,l},l.focusOnShow=function(a){if(0===arguments.length)return d.focusOnShow;if("boolean"!=typeof a)throw new TypeError("focusOnShow() expects a boolean parameter");return d.focusOnShow=a,l},l.inline=function(a){if(0===arguments.length)return d.inline;if("boolean"!=typeof a)throw new TypeError("inline() expects a boolean parameter");return d.inline=a,l},l.clear=function(){return ca(),l},l.keyBinds=function(a){return 0===arguments.length?d.keyBinds:(d.keyBinds=a,l)},l.getMoment=function(a){return y(a)},l.debug=function(a){if("boolean"!=typeof a)throw new TypeError("debug() expects a boolean parameter");return d.debug=a,l},l.allowInputToggle=function(a){if(0===arguments.length)return d.allowInputToggle;if("boolean"!=typeof a)throw new TypeError("allowInputToggle() expects a boolean parameter");return d.allowInputToggle=a,l},l.showClose=function(a){if(0===arguments.length)return d.showClose;if("boolean"!=typeof a)throw new TypeError("showClose() expects a boolean parameter");return d.showClose=a,l},l.keepInvalid=function(a){if(0===arguments.length)return d.keepInvalid;if("boolean"!=typeof a)throw new TypeError("keepInvalid() expects a boolean parameter");
  6417. return d.keepInvalid=a,l},l.datepickerInput=function(a){if(0===arguments.length)return d.datepickerInput;if("string"!=typeof a)throw new TypeError("datepickerInput() expects a string parameter");return d.datepickerInput=a,l},l.parseInputDate=function(a){if(0===arguments.length)return d.parseInputDate;if("function"!=typeof a)throw new TypeError("parseInputDate() sholud be as function");return d.parseInputDate=a,l},l.disabledTimeIntervals=function(b){if(0===arguments.length)return d.disabledTimeIntervals?a.extend({},d.disabledTimeIntervals):d.disabledTimeIntervals;if(!b)return d.disabledTimeIntervals=!1,_(),l;if(!(b instanceof Array))throw new TypeError("disabledTimeIntervals() expects an array parameter");return d.disabledTimeIntervals=b,_(),l},l.disabledHours=function(b){if(0===arguments.length)return d.disabledHours?a.extend({},d.disabledHours):d.disabledHours;if(!b)return d.disabledHours=!1,_(),l;if(!(b instanceof Array))throw new TypeError("disabledHours() expects an array parameter");if(d.disabledHours=oa(b),d.enabledHours=!1,d.useCurrent&&!d.keepInvalid){for(var c=0;!R(e,"h");){if(e.add(1,"h"),24===c)throw"Tried 24 times to find a valid date";c++}aa(e)}return _(),l},l.enabledHours=function(b){if(0===arguments.length)return d.enabledHours?a.extend({},d.enabledHours):d.enabledHours;if(!b)return d.enabledHours=!1,_(),l;if(!(b instanceof Array))throw new TypeError("enabledHours() expects an array parameter");if(d.enabledHours=oa(b),d.disabledHours=!1,d.useCurrent&&!d.keepInvalid){for(var c=0;!R(e,"h");){if(e.add(1,"h"),24===c)throw"Tried 24 times to find a valid date";c++}aa(e)}return _(),l},l.viewDate=function(a){if(0===arguments.length)return f.clone();if(!a)return f=e.clone(),l;if(!("string"==typeof a||b.isMoment(a)||a instanceof Date))throw new TypeError("viewDate() parameter must be one of [string, moment or Date]");return f=da(a),K(),l},c.is("input"))g=c;else if(g=c.find(d.datepickerInput),0===g.length)g=c.find("input");else if(!g.is("input"))throw new Error('CSS class "'+d.datepickerInput+'" cannot be applied to non input element');if(c.hasClass("input-group")&&(n=0===c.find(".datepickerbutton").length?c.find(".input-group-addon"):c.find(".datepickerbutton")),!d.inline&&!g.is("input"))throw new Error("Could not initialize DateTimePicker without an input element");return e=y(),f=e.clone(),a.extend(!0,d,H()),l.options(d),pa(),la(),g.prop("disabled")&&l.disable(),g.is("input")&&0!==g.val().trim().length?aa(da(g.val().trim())):d.defaultDate&&void 0===g.attr("placeholder")&&aa(d.defaultDate),d.inline&&ga(),l};return a.fn.datetimepicker=function(b){b=b||{};var d,e=Array.prototype.slice.call(arguments,1),f=!0,g=["destroy","hide","show","toggle"];if("object"==typeof b)return this.each(function(){var d,e=a(this);e.data("DateTimePicker")||(d=a.extend(!0,{},a.fn.datetimepicker.defaults,b),e.data("DateTimePicker",c(e,d)))});if("string"==typeof b)return this.each(function(){var c=a(this),g=c.data("DateTimePicker");if(!g)throw new Error('bootstrap-datetimepicker("'+b+'") method was called on an element that is not using DateTimePicker');d=g[b].apply(g,e),f=d===g}),f||a.inArray(b,g)>-1?this:d;throw new TypeError("Invalid arguments for DateTimePicker: "+b)},a.fn.datetimepicker.defaults={timeZone:"",format:!1,dayViewHeaderFormat:"MMMM YYYY",extraFormats:!1,stepping:1,minDate:!1,maxDate:!1,useCurrent:!0,collapse:!0,locale:b.locale(),defaultDate:!1,disabledDates:!1,enabledDates:!1,icons:{time:"glyphicon glyphicon-time",date:"glyphicon glyphicon-calendar",up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down",previous:"glyphicon glyphicon-chevron-left",next:"glyphicon glyphicon-chevron-right",today:"glyphicon glyphicon-screenshot",clear:"glyphicon glyphicon-trash",close:"glyphicon glyphicon-remove"},tooltips:{today:"Go to today",clear:"Clear selection",close:"Close the picker",selectMonth:"Select Month",prevMonth:"Previous Month",nextMonth:"Next Month",selectYear:"Select Year",prevYear:"Previous Year",nextYear:"Next Year",selectDecade:"Select Decade",prevDecade:"Previous Decade",nextDecade:"Next Decade",prevCentury:"Previous Century",nextCentury:"Next Century",pickHour:"Pick Hour",incrementHour:"Increment Hour",decrementHour:"Decrement Hour",pickMinute:"Pick Minute",incrementMinute:"Increment Minute",decrementMinute:"Decrement Minute",pickSecond:"Pick Second",incrementSecond:"Increment Second",decrementSecond:"Decrement Second",togglePeriod:"Toggle Period",selectTime:"Select Time"},useStrict:!1,sideBySide:!1,daysOfWeekDisabled:!1,calendarWeeks:!1,viewMode:"days",toolbarPlacement:"default",showTodayButton:!1,showClear:!1,showClose:!1,widgetPositioning:{horizontal:"auto",vertical:"auto"},widgetParent:null,ignoreReadonly:!1,keepOpen:!1,focusOnShow:!0,inline:!1,keepInvalid:!1,datepickerInput:".datepickerinput",keyBinds:{up:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")?this.date(b.clone().subtract(7,"d")):this.date(b.clone().add(this.stepping(),"m"))}},down:function(a){if(!a)return void this.show();var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")?this.date(b.clone().add(7,"d")):this.date(b.clone().subtract(this.stepping(),"m"))},"control up":function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")?this.date(b.clone().subtract(1,"y")):this.date(b.clone().add(1,"h"))}},"control down":function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")?this.date(b.clone().add(1,"y")):this.date(b.clone().subtract(1,"h"))}},left:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")&&this.date(b.clone().subtract(1,"d"))}},right:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")&&this.date(b.clone().add(1,"d"))}},pageUp:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")&&this.date(b.clone().subtract(1,"M"))}},pageDown:function(a){if(a){var b=this.date()||this.getMoment();a.find(".datepicker").is(":visible")&&this.date(b.clone().add(1,"M"))}},enter:function(){this.hide()},escape:function(){this.hide()},"control space":function(a){a&&a.find(".timepicker").is(":visible")&&a.find('.btn[data-action="togglePeriod"]').click()},t:function(){this.date(this.getMoment())},delete:function(){this.clear()}},debug:!1,allowInputToggle:!1,disabledTimeIntervals:!1,disabledHours:!1,enabledHours:!1,viewDate:!1},a.fn.datetimepicker});
  6418. /**
  6419. * @version: 2.1.25
  6420. * @author: Dan Grossman http://www.dangrossman.info/
  6421. * @copyright: Copyright (c) 2012-2017 Dan Grossman. All rights reserved.
  6422. * @license: Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php
  6423. * @website: https://www.daterangepicker.com/
  6424. */
  6425. // Follow the UMD template https://github.com/umdjs/umd/blob/master/templates/returnExportsGlobal.js
  6426. (function (root, factory) {
  6427. if (typeof define === 'function' && define.amd) {
  6428. // AMD. Make globaly available as well
  6429. define('bootstrap-daterangepicker',['moment', 'jquery'], function (moment, jquery) {
  6430. return (root.daterangepicker = factory(moment, jquery));
  6431. });
  6432. } else if (typeof module === 'object' && module.exports) {
  6433. // Node / Browserify
  6434. //isomorphic issue
  6435. var jQuery = (typeof window != 'undefined') ? window.jQuery : undefined;
  6436. if (!jQuery) {
  6437. jQuery = require('jquery');
  6438. if (!jQuery.fn) jQuery.fn = {};
  6439. }
  6440. module.exports = factory(require('moment'), jQuery);
  6441. } else {
  6442. // Browser globals
  6443. root.daterangepicker = factory(root.moment, root.jQuery);
  6444. }
  6445. }(this, function(moment, $) {
  6446. var DateRangePicker = function(element, options, cb) {
  6447. //default settings for options
  6448. this.parentEl = 'body';
  6449. this.element = $(element);
  6450. this.startDate = moment().startOf('day');
  6451. this.endDate = moment().endOf('day');
  6452. this.minDate = false;
  6453. this.maxDate = false;
  6454. this.dateLimit = false;
  6455. this.autoApply = false;
  6456. this.singleDatePicker = false;
  6457. this.showDropdowns = false;
  6458. this.showWeekNumbers = false;
  6459. this.showISOWeekNumbers = false;
  6460. this.showCustomRangeLabel = true;
  6461. this.timePicker = false;
  6462. this.timePicker24Hour = false;
  6463. this.timePickerIncrement = 1;
  6464. this.timePickerSeconds = false;
  6465. this.linkedCalendars = true;
  6466. this.autoUpdateInput = true;
  6467. this.alwaysShowCalendars = false;
  6468. this.ranges = {};
  6469. this.opens = 'right';
  6470. if (this.element.hasClass('pull-right'))
  6471. this.opens = 'left';
  6472. this.drops = 'down';
  6473. if (this.element.hasClass('dropup'))
  6474. this.drops = 'up';
  6475. this.buttonClasses = 'btn btn-sm';
  6476. this.applyClass = 'btn-success';
  6477. this.cancelClass = 'btn-default';
  6478. this.locale = {
  6479. direction: 'ltr',
  6480. format: moment.localeData().longDateFormat('L'),
  6481. separator: ' - ',
  6482. applyLabel: 'Apply',
  6483. cancelLabel: 'Cancel',
  6484. weekLabel: 'W',
  6485. customRangeLabel: 'Custom Range',
  6486. daysOfWeek: moment.weekdaysMin(),
  6487. monthNames: moment.monthsShort(),
  6488. firstDay: moment.localeData().firstDayOfWeek()
  6489. };
  6490. this.callback = function() { };
  6491. //some state information
  6492. this.isShowing = false;
  6493. this.leftCalendar = {};
  6494. this.rightCalendar = {};
  6495. //custom options from user
  6496. if (typeof options !== 'object' || options === null)
  6497. options = {};
  6498. //allow setting options with data attributes
  6499. //data-api options will be overwritten with custom javascript options
  6500. options = $.extend(this.element.data(), options);
  6501. //html template for the picker UI
  6502. if (typeof options.template !== 'string' && !(options.template instanceof $))
  6503. options.template = '<div class="daterangepicker dropdown-menu">' +
  6504. '<div class="calendar left">' +
  6505. '<div class="daterangepicker_input">' +
  6506. '<input class="input-mini form-control" type="text" name="daterangepicker_start" value="" />' +
  6507. '<i class="fa fa-calendar glyphicon glyphicon-calendar"></i>' +
  6508. '<div class="calendar-time">' +
  6509. '<div></div>' +
  6510. '<i class="fa fa-clock-o glyphicon glyphicon-time"></i>' +
  6511. '</div>' +
  6512. '</div>' +
  6513. '<div class="calendar-table"></div>' +
  6514. '</div>' +
  6515. '<div class="calendar right">' +
  6516. '<div class="daterangepicker_input">' +
  6517. '<input class="input-mini form-control" type="text" name="daterangepicker_end" value="" />' +
  6518. '<i class="fa fa-calendar glyphicon glyphicon-calendar"></i>' +
  6519. '<div class="calendar-time">' +
  6520. '<div></div>' +
  6521. '<i class="fa fa-clock-o glyphicon glyphicon-time"></i>' +
  6522. '</div>' +
  6523. '</div>' +
  6524. '<div class="calendar-table"></div>' +
  6525. '</div>' +
  6526. '<div class="ranges">' +
  6527. '<div class="range_inputs">' +
  6528. '<button class="applyBtn" disabled="disabled" type="button"></button> ' +
  6529. '<button class="cancelBtn" type="button"></button>' +
  6530. '</div>' +
  6531. '</div>' +
  6532. '</div>';
  6533. this.parentEl = (options.parentEl && $(options.parentEl).length) ? $(options.parentEl) : $(this.parentEl);
  6534. this.container = $(options.template).appendTo(this.parentEl);
  6535. //
  6536. // handle all the possible options overriding defaults
  6537. //
  6538. if (typeof options.locale === 'object') {
  6539. if (typeof options.locale.direction === 'string')
  6540. this.locale.direction = options.locale.direction;
  6541. if (typeof options.locale.format === 'string')
  6542. this.locale.format = options.locale.format;
  6543. if (typeof options.locale.separator === 'string')
  6544. this.locale.separator = options.locale.separator;
  6545. if (typeof options.locale.daysOfWeek === 'object')
  6546. this.locale.daysOfWeek = options.locale.daysOfWeek.slice();
  6547. if (typeof options.locale.monthNames === 'object')
  6548. this.locale.monthNames = options.locale.monthNames.slice();
  6549. if (typeof options.locale.firstDay === 'number')
  6550. this.locale.firstDay = options.locale.firstDay;
  6551. if (typeof options.locale.applyLabel === 'string')
  6552. this.locale.applyLabel = options.locale.applyLabel;
  6553. if (typeof options.locale.cancelLabel === 'string')
  6554. this.locale.cancelLabel = options.locale.cancelLabel;
  6555. if (typeof options.locale.weekLabel === 'string')
  6556. this.locale.weekLabel = options.locale.weekLabel;
  6557. if (typeof options.locale.customRangeLabel === 'string'){
  6558. //Support unicode chars in the custom range name.
  6559. var elem = document.createElement('textarea');
  6560. elem.innerHTML = options.locale.customRangeLabel;
  6561. var rangeHtml = elem.value;
  6562. this.locale.customRangeLabel = rangeHtml;
  6563. }
  6564. }
  6565. this.container.addClass(this.locale.direction);
  6566. if (typeof options.startDate === 'string')
  6567. this.startDate = moment(options.startDate, this.locale.format);
  6568. if (typeof options.endDate === 'string')
  6569. this.endDate = moment(options.endDate, this.locale.format);
  6570. if (typeof options.minDate === 'string')
  6571. this.minDate = moment(options.minDate, this.locale.format);
  6572. if (typeof options.maxDate === 'string')
  6573. this.maxDate = moment(options.maxDate, this.locale.format);
  6574. if (typeof options.startDate === 'object')
  6575. this.startDate = moment(options.startDate);
  6576. if (typeof options.endDate === 'object')
  6577. this.endDate = moment(options.endDate);
  6578. if (typeof options.minDate === 'object')
  6579. this.minDate = moment(options.minDate);
  6580. if (typeof options.maxDate === 'object')
  6581. this.maxDate = moment(options.maxDate);
  6582. // sanity check for bad options
  6583. if (this.minDate && this.startDate.isBefore(this.minDate))
  6584. this.startDate = this.minDate.clone();
  6585. // sanity check for bad options
  6586. if (this.maxDate && this.endDate.isAfter(this.maxDate))
  6587. this.endDate = this.maxDate.clone();
  6588. if (typeof options.applyClass === 'string')
  6589. this.applyClass = options.applyClass;
  6590. if (typeof options.cancelClass === 'string')
  6591. this.cancelClass = options.cancelClass;
  6592. if (typeof options.dateLimit === 'object')
  6593. this.dateLimit = options.dateLimit;
  6594. if (typeof options.opens === 'string')
  6595. this.opens = options.opens;
  6596. if (typeof options.drops === 'string')
  6597. this.drops = options.drops;
  6598. if (typeof options.showWeekNumbers === 'boolean')
  6599. this.showWeekNumbers = options.showWeekNumbers;
  6600. if (typeof options.showISOWeekNumbers === 'boolean')
  6601. this.showISOWeekNumbers = options.showISOWeekNumbers;
  6602. if (typeof options.buttonClasses === 'string')
  6603. this.buttonClasses = options.buttonClasses;
  6604. if (typeof options.buttonClasses === 'object')
  6605. this.buttonClasses = options.buttonClasses.join(' ');
  6606. if (typeof options.showDropdowns === 'boolean')
  6607. this.showDropdowns = options.showDropdowns;
  6608. if (typeof options.showCustomRangeLabel === 'boolean')
  6609. this.showCustomRangeLabel = options.showCustomRangeLabel;
  6610. if (typeof options.singleDatePicker === 'boolean') {
  6611. this.singleDatePicker = options.singleDatePicker;
  6612. if (this.singleDatePicker)
  6613. this.endDate = this.startDate.clone();
  6614. }
  6615. if (typeof options.timePicker === 'boolean')
  6616. this.timePicker = options.timePicker;
  6617. if (typeof options.timePickerSeconds === 'boolean')
  6618. this.timePickerSeconds = options.timePickerSeconds;
  6619. if (typeof options.timePickerIncrement === 'number')
  6620. this.timePickerIncrement = options.timePickerIncrement;
  6621. if (typeof options.timePicker24Hour === 'boolean')
  6622. this.timePicker24Hour = options.timePicker24Hour;
  6623. if (typeof options.autoApply === 'boolean')
  6624. this.autoApply = options.autoApply;
  6625. if (typeof options.autoUpdateInput === 'boolean')
  6626. this.autoUpdateInput = options.autoUpdateInput;
  6627. if (typeof options.linkedCalendars === 'boolean')
  6628. this.linkedCalendars = options.linkedCalendars;
  6629. if (typeof options.isInvalidDate === 'function')
  6630. this.isInvalidDate = options.isInvalidDate;
  6631. if (typeof options.isCustomDate === 'function')
  6632. this.isCustomDate = options.isCustomDate;
  6633. if (typeof options.alwaysShowCalendars === 'boolean')
  6634. this.alwaysShowCalendars = options.alwaysShowCalendars;
  6635. // update day names order to firstDay
  6636. if (this.locale.firstDay != 0) {
  6637. var iterator = this.locale.firstDay;
  6638. while (iterator > 0) {
  6639. this.locale.daysOfWeek.push(this.locale.daysOfWeek.shift());
  6640. iterator--;
  6641. }
  6642. }
  6643. var start, end, range;
  6644. //if no start/end dates set, check if an input element contains initial values
  6645. if (typeof options.startDate === 'undefined' && typeof options.endDate === 'undefined') {
  6646. if ($(this.element).is('input[type=text]')) {
  6647. var val = $(this.element).val(),
  6648. split = val.split(this.locale.separator);
  6649. start = end = null;
  6650. if (split.length == 2) {
  6651. start = moment(split[0], this.locale.format);
  6652. end = moment(split[1], this.locale.format);
  6653. } else if (this.singleDatePicker && val !== "") {
  6654. start = moment(val, this.locale.format);
  6655. end = moment(val, this.locale.format);
  6656. }
  6657. if (start !== null && end !== null) {
  6658. this.setStartDate(start);
  6659. this.setEndDate(end);
  6660. }
  6661. }
  6662. }
  6663. if (typeof options.ranges === 'object') {
  6664. for (range in options.ranges) {
  6665. if (typeof options.ranges[range][0] === 'string')
  6666. start = moment(options.ranges[range][0], this.locale.format);
  6667. else
  6668. start = moment(options.ranges[range][0]);
  6669. if (typeof options.ranges[range][1] === 'string')
  6670. end = moment(options.ranges[range][1], this.locale.format);
  6671. else
  6672. end = moment(options.ranges[range][1]);
  6673. // If the start or end date exceed those allowed by the minDate or dateLimit
  6674. // options, shorten the range to the allowable period.
  6675. if (this.minDate && start.isBefore(this.minDate))
  6676. start = this.minDate.clone();
  6677. var maxDate = this.maxDate;
  6678. if (this.dateLimit && maxDate && start.clone().add(this.dateLimit).isAfter(maxDate))
  6679. maxDate = start.clone().add(this.dateLimit);
  6680. if (maxDate && end.isAfter(maxDate))
  6681. end = maxDate.clone();
  6682. // If the end of the range is before the minimum or the start of the range is
  6683. // after the maximum, don't display this range option at all.
  6684. if ((this.minDate && end.isBefore(this.minDate, this.timepicker ? 'minute' : 'day'))
  6685. || (maxDate && start.isAfter(maxDate, this.timepicker ? 'minute' : 'day')))
  6686. continue;
  6687. //Support unicode chars in the range names.
  6688. var elem = document.createElement('textarea');
  6689. elem.innerHTML = range;
  6690. var rangeHtml = elem.value;
  6691. this.ranges[rangeHtml] = [start, end];
  6692. }
  6693. var list = '<ul>';
  6694. for (range in this.ranges) {
  6695. list += '<li data-range-key="' + range + '">' + range + '</li>';
  6696. }
  6697. if (this.showCustomRangeLabel) {
  6698. list += '<li data-range-key="' + this.locale.customRangeLabel + '">' + this.locale.customRangeLabel + '</li>';
  6699. }
  6700. list += '</ul>';
  6701. this.container.find('.ranges').prepend(list);
  6702. }
  6703. if (typeof cb === 'function') {
  6704. this.callback = cb;
  6705. }
  6706. if (!this.timePicker) {
  6707. this.startDate = this.startDate.startOf('day');
  6708. this.endDate = this.endDate.endOf('day');
  6709. this.container.find('.calendar-time').hide();
  6710. }
  6711. //can't be used together for now
  6712. if (this.timePicker && this.autoApply)
  6713. this.autoApply = false;
  6714. if (this.autoApply && typeof options.ranges !== 'object') {
  6715. this.container.find('.ranges').hide();
  6716. } else if (this.autoApply) {
  6717. this.container.find('.applyBtn, .cancelBtn').addClass('hide');
  6718. }
  6719. if (this.singleDatePicker) {
  6720. this.container.addClass('single');
  6721. this.container.find('.calendar.left').addClass('single');
  6722. this.container.find('.calendar.left').show();
  6723. this.container.find('.calendar.right').hide();
  6724. this.container.find('.daterangepicker_input input, .daterangepicker_input > i').hide();
  6725. if (this.timePicker) {
  6726. this.container.find('.ranges ul').hide();
  6727. } else {
  6728. this.container.find('.ranges').hide();
  6729. }
  6730. }
  6731. if ((typeof options.ranges === 'undefined' && !this.singleDatePicker) || this.alwaysShowCalendars) {
  6732. this.container.addClass('show-calendar');
  6733. }
  6734. this.container.addClass('opens' + this.opens);
  6735. //swap the position of the predefined ranges if opens right
  6736. if (typeof options.ranges !== 'undefined' && this.opens == 'right') {
  6737. this.container.find('.ranges').prependTo( this.container.find('.calendar.left').parent() );
  6738. }
  6739. //apply CSS classes and labels to buttons
  6740. this.container.find('.applyBtn, .cancelBtn').addClass(this.buttonClasses);
  6741. if (this.applyClass.length)
  6742. this.container.find('.applyBtn').addClass(this.applyClass);
  6743. if (this.cancelClass.length)
  6744. this.container.find('.cancelBtn').addClass(this.cancelClass);
  6745. this.container.find('.applyBtn').html(this.locale.applyLabel);
  6746. this.container.find('.cancelBtn').html(this.locale.cancelLabel);
  6747. //
  6748. // event listeners
  6749. //
  6750. this.container.find('.calendar')
  6751. .on('click.daterangepicker', '.prev', $.proxy(this.clickPrev, this))
  6752. .on('click.daterangepicker', '.next', $.proxy(this.clickNext, this))
  6753. .on('mousedown.daterangepicker', 'td.available', $.proxy(this.clickDate, this))
  6754. .on('mouseenter.daterangepicker', 'td.available', $.proxy(this.hoverDate, this))
  6755. .on('mouseleave.daterangepicker', 'td.available', $.proxy(this.updateFormInputs, this))
  6756. .on('change.daterangepicker', 'select.yearselect', $.proxy(this.monthOrYearChanged, this))
  6757. .on('change.daterangepicker', 'select.monthselect', $.proxy(this.monthOrYearChanged, this))
  6758. .on('change.daterangepicker', 'select.hourselect,select.minuteselect,select.secondselect,select.ampmselect', $.proxy(this.timeChanged, this))
  6759. .on('click.daterangepicker', '.daterangepicker_input input', $.proxy(this.showCalendars, this))
  6760. .on('focus.daterangepicker', '.daterangepicker_input input', $.proxy(this.formInputsFocused, this))
  6761. .on('blur.daterangepicker', '.daterangepicker_input input', $.proxy(this.formInputsBlurred, this))
  6762. .on('change.daterangepicker', '.daterangepicker_input input', $.proxy(this.formInputsChanged, this));
  6763. this.container.find('.ranges')
  6764. .on('click.daterangepicker', 'button.applyBtn', $.proxy(this.clickApply, this))
  6765. .on('click.daterangepicker', 'button.cancelBtn', $.proxy(this.clickCancel, this))
  6766. .on('click.daterangepicker', 'li', $.proxy(this.clickRange, this))
  6767. .on('mouseenter.daterangepicker', 'li', $.proxy(this.hoverRange, this))
  6768. .on('mouseleave.daterangepicker', 'li', $.proxy(this.updateFormInputs, this));
  6769. if (this.element.is('input') || this.element.is('button')) {
  6770. this.element.on({
  6771. 'click.daterangepicker': $.proxy(this.show, this),
  6772. 'focus.daterangepicker': $.proxy(this.show, this),
  6773. 'keyup.daterangepicker': $.proxy(this.elementChanged, this),
  6774. 'keydown.daterangepicker': $.proxy(this.keydown, this)
  6775. });
  6776. } else {
  6777. this.element.on('click.daterangepicker', $.proxy(this.toggle, this));
  6778. }
  6779. //
  6780. // if attached to a text input, set the initial value
  6781. //
  6782. if (this.element.is('input') && !this.singleDatePicker && this.autoUpdateInput) {
  6783. this.element.val(this.startDate.format(this.locale.format) + this.locale.separator + this.endDate.format(this.locale.format));
  6784. this.element.trigger('change');
  6785. } else if (this.element.is('input') && this.autoUpdateInput) {
  6786. this.element.val(this.startDate.format(this.locale.format));
  6787. this.element.trigger('change');
  6788. }
  6789. };
  6790. DateRangePicker.prototype = {
  6791. constructor: DateRangePicker,
  6792. setStartDate: function(startDate) {
  6793. if (typeof startDate === 'string')
  6794. this.startDate = moment(startDate, this.locale.format);
  6795. if (typeof startDate === 'object')
  6796. this.startDate = moment(startDate);
  6797. if (!this.timePicker)
  6798. this.startDate = this.startDate.startOf('day');
  6799. if (this.timePicker && this.timePickerIncrement)
  6800. this.startDate.minute(Math.round(this.startDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
  6801. if (this.minDate && this.startDate.isBefore(this.minDate)) {
  6802. this.startDate = this.minDate.clone();
  6803. if (this.timePicker && this.timePickerIncrement)
  6804. this.startDate.minute(Math.round(this.startDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
  6805. }
  6806. if (this.maxDate && this.startDate.isAfter(this.maxDate)) {
  6807. this.startDate = this.maxDate.clone();
  6808. if (this.timePicker && this.timePickerIncrement)
  6809. this.startDate.minute(Math.floor(this.startDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
  6810. }
  6811. if (!this.isShowing)
  6812. this.updateElement();
  6813. this.updateMonthsInView();
  6814. },
  6815. setEndDate: function(endDate) {
  6816. if (typeof endDate === 'string')
  6817. this.endDate = moment(endDate, this.locale.format);
  6818. if (typeof endDate === 'object')
  6819. this.endDate = moment(endDate);
  6820. if (!this.timePicker)
  6821. this.endDate = this.endDate.endOf('day');
  6822. if (this.timePicker && this.timePickerIncrement)
  6823. this.endDate.minute(Math.round(this.endDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
  6824. if (this.endDate.isBefore(this.startDate))
  6825. this.endDate = this.startDate.clone();
  6826. if (this.maxDate && this.endDate.isAfter(this.maxDate))
  6827. this.endDate = this.maxDate.clone();
  6828. if (this.dateLimit && this.startDate.clone().add(this.dateLimit).isBefore(this.endDate))
  6829. this.endDate = this.startDate.clone().add(this.dateLimit);
  6830. this.previousRightTime = this.endDate.clone();
  6831. if (!this.isShowing)
  6832. this.updateElement();
  6833. this.updateMonthsInView();
  6834. },
  6835. isInvalidDate: function() {
  6836. return false;
  6837. },
  6838. isCustomDate: function() {
  6839. return false;
  6840. },
  6841. updateView: function() {
  6842. if (this.timePicker) {
  6843. this.renderTimePicker('left');
  6844. this.renderTimePicker('right');
  6845. if (!this.endDate) {
  6846. this.container.find('.right .calendar-time select').attr('disabled', 'disabled').addClass('disabled');
  6847. } else {
  6848. this.container.find('.right .calendar-time select').removeAttr('disabled').removeClass('disabled');
  6849. }
  6850. }
  6851. if (this.endDate) {
  6852. this.container.find('input[name="daterangepicker_end"]').removeClass('active');
  6853. this.container.find('input[name="daterangepicker_start"]').addClass('active');
  6854. } else {
  6855. this.container.find('input[name="daterangepicker_end"]').addClass('active');
  6856. this.container.find('input[name="daterangepicker_start"]').removeClass('active');
  6857. }
  6858. this.updateMonthsInView();
  6859. this.updateCalendars();
  6860. this.updateFormInputs();
  6861. },
  6862. updateMonthsInView: function() {
  6863. if (this.endDate) {
  6864. //if both dates are visible already, do nothing
  6865. if (!this.singleDatePicker && this.leftCalendar.month && this.rightCalendar.month &&
  6866. (this.startDate.format('YYYY-MM') == this.leftCalendar.month.format('YYYY-MM') || this.startDate.format('YYYY-MM') == this.rightCalendar.month.format('YYYY-MM'))
  6867. &&
  6868. (this.endDate.format('YYYY-MM') == this.leftCalendar.month.format('YYYY-MM') || this.endDate.format('YYYY-MM') == this.rightCalendar.month.format('YYYY-MM'))
  6869. ) {
  6870. return;
  6871. }
  6872. this.leftCalendar.month = this.startDate.clone().date(2);
  6873. if (!this.linkedCalendars && (this.endDate.month() != this.startDate.month() || this.endDate.year() != this.startDate.year())) {
  6874. this.rightCalendar.month = this.endDate.clone().date(2);
  6875. } else {
  6876. this.rightCalendar.month = this.startDate.clone().date(2).add(1, 'month');
  6877. }
  6878. } else {
  6879. if (this.leftCalendar.month.format('YYYY-MM') != this.startDate.format('YYYY-MM') && this.rightCalendar.month.format('YYYY-MM') != this.startDate.format('YYYY-MM')) {
  6880. this.leftCalendar.month = this.startDate.clone().date(2);
  6881. this.rightCalendar.month = this.startDate.clone().date(2).add(1, 'month');
  6882. }
  6883. }
  6884. if (this.maxDate && this.linkedCalendars && !this.singleDatePicker && this.rightCalendar.month > this.maxDate) {
  6885. this.rightCalendar.month = this.maxDate.clone().date(2);
  6886. this.leftCalendar.month = this.maxDate.clone().date(2).subtract(1, 'month');
  6887. }
  6888. },
  6889. updateCalendars: function() {
  6890. if (this.timePicker) {
  6891. var hour, minute, second;
  6892. if (this.endDate) {
  6893. hour = parseInt(this.container.find('.left .hourselect').val(), 10);
  6894. minute = parseInt(this.container.find('.left .minuteselect').val(), 10);
  6895. second = this.timePickerSeconds ? parseInt(this.container.find('.left .secondselect').val(), 10) : 0;
  6896. if (!this.timePicker24Hour) {
  6897. var ampm = this.container.find('.left .ampmselect').val();
  6898. if (ampm === 'PM' && hour < 12)
  6899. hour += 12;
  6900. if (ampm === 'AM' && hour === 12)
  6901. hour = 0;
  6902. }
  6903. } else {
  6904. hour = parseInt(this.container.find('.right .hourselect').val(), 10);
  6905. minute = parseInt(this.container.find('.right .minuteselect').val(), 10);
  6906. second = this.timePickerSeconds ? parseInt(this.container.find('.right .secondselect').val(), 10) : 0;
  6907. if (!this.timePicker24Hour) {
  6908. var ampm = this.container.find('.right .ampmselect').val();
  6909. if (ampm === 'PM' && hour < 12)
  6910. hour += 12;
  6911. if (ampm === 'AM' && hour === 12)
  6912. hour = 0;
  6913. }
  6914. }
  6915. this.leftCalendar.month.hour(hour).minute(minute).second(second);
  6916. this.rightCalendar.month.hour(hour).minute(minute).second(second);
  6917. }
  6918. this.renderCalendar('left');
  6919. this.renderCalendar('right');
  6920. //highlight any predefined range matching the current start and end dates
  6921. this.container.find('.ranges li').removeClass('active');
  6922. if (this.endDate == null) return;
  6923. this.calculateChosenLabel();
  6924. },
  6925. renderCalendar: function(side) {
  6926. //
  6927. // Build the matrix of dates that will populate the calendar
  6928. //
  6929. var calendar = side == 'left' ? this.leftCalendar : this.rightCalendar;
  6930. var month = calendar.month.month();
  6931. var year = calendar.month.year();
  6932. var hour = calendar.month.hour();
  6933. var minute = calendar.month.minute();
  6934. var second = calendar.month.second();
  6935. var daysInMonth = moment([year, month]).daysInMonth();
  6936. var firstDay = moment([year, month, 1]);
  6937. var lastDay = moment([year, month, daysInMonth]);
  6938. var lastMonth = moment(firstDay).subtract(1, 'month').month();
  6939. var lastYear = moment(firstDay).subtract(1, 'month').year();
  6940. var daysInLastMonth = moment([lastYear, lastMonth]).daysInMonth();
  6941. var dayOfWeek = firstDay.day();
  6942. //initialize a 6 rows x 7 columns array for the calendar
  6943. var calendar = [];
  6944. calendar.firstDay = firstDay;
  6945. calendar.lastDay = lastDay;
  6946. for (var i = 0; i < 6; i++) {
  6947. calendar[i] = [];
  6948. }
  6949. //populate the calendar with date objects
  6950. var startDay = daysInLastMonth - dayOfWeek + this.locale.firstDay + 1;
  6951. if (startDay > daysInLastMonth)
  6952. startDay -= 7;
  6953. if (dayOfWeek == this.locale.firstDay)
  6954. startDay = daysInLastMonth - 6;
  6955. var curDate = moment([lastYear, lastMonth, startDay, 12, minute, second]);
  6956. var col, row;
  6957. for (var i = 0, col = 0, row = 0; i < 42; i++, col++, curDate = moment(curDate).add(24, 'hour')) {
  6958. if (i > 0 && col % 7 === 0) {
  6959. col = 0;
  6960. row++;
  6961. }
  6962. calendar[row][col] = curDate.clone().hour(hour).minute(minute).second(second);
  6963. curDate.hour(12);
  6964. if (this.minDate && calendar[row][col].format('YYYY-MM-DD') == this.minDate.format('YYYY-MM-DD') && calendar[row][col].isBefore(this.minDate) && side == 'left') {
  6965. calendar[row][col] = this.minDate.clone();
  6966. }
  6967. if (this.maxDate && calendar[row][col].format('YYYY-MM-DD') == this.maxDate.format('YYYY-MM-DD') && calendar[row][col].isAfter(this.maxDate) && side == 'right') {
  6968. calendar[row][col] = this.maxDate.clone();
  6969. }
  6970. }
  6971. //make the calendar object available to hoverDate/clickDate
  6972. if (side == 'left') {
  6973. this.leftCalendar.calendar = calendar;
  6974. } else {
  6975. this.rightCalendar.calendar = calendar;
  6976. }
  6977. //
  6978. // Display the calendar
  6979. //
  6980. var minDate = side == 'left' ? this.minDate : this.startDate;
  6981. var maxDate = this.maxDate;
  6982. var selected = side == 'left' ? this.startDate : this.endDate;
  6983. var arrow = this.locale.direction == 'ltr' ? {left: 'chevron-left', right: 'chevron-right'} : {left: 'chevron-right', right: 'chevron-left'};
  6984. var html = '<table class="table-condensed">';
  6985. html += '<thead>';
  6986. html += '<tr>';
  6987. // add empty cell for week number
  6988. if (this.showWeekNumbers || this.showISOWeekNumbers)
  6989. html += '<th></th>';
  6990. if ((!minDate || minDate.isBefore(calendar.firstDay)) && (!this.linkedCalendars || side == 'left')) {
  6991. html += '<th class="prev available"><i class="fa fa-' + arrow.left + ' glyphicon glyphicon-' + arrow.left + '"></i></th>';
  6992. } else {
  6993. html += '<th></th>';
  6994. }
  6995. var dateHtml = this.locale.monthNames[calendar[1][1].month()] + calendar[1][1].format(" YYYY");
  6996. if (this.showDropdowns) {
  6997. var currentMonth = calendar[1][1].month();
  6998. var currentYear = calendar[1][1].year();
  6999. var maxYear = (maxDate && maxDate.year()) || (currentYear + 5);
  7000. var minYear = (minDate && minDate.year()) || (currentYear - 50);
  7001. var inMinYear = currentYear == minYear;
  7002. var inMaxYear = currentYear == maxYear;
  7003. var monthHtml = '<select class="monthselect">';
  7004. for (var m = 0; m < 12; m++) {
  7005. if ((!inMinYear || m >= minDate.month()) && (!inMaxYear || m <= maxDate.month())) {
  7006. monthHtml += "<option value='" + m + "'" +
  7007. (m === currentMonth ? " selected='selected'" : "") +
  7008. ">" + this.locale.monthNames[m] + "</option>";
  7009. } else {
  7010. monthHtml += "<option value='" + m + "'" +
  7011. (m === currentMonth ? " selected='selected'" : "") +
  7012. " disabled='disabled'>" + this.locale.monthNames[m] + "</option>";
  7013. }
  7014. }
  7015. monthHtml += "</select>";
  7016. var yearHtml = '<select class="yearselect">';
  7017. for (var y = minYear; y <= maxYear; y++) {
  7018. yearHtml += '<option value="' + y + '"' +
  7019. (y === currentYear ? ' selected="selected"' : '') +
  7020. '>' + y + '</option>';
  7021. }
  7022. yearHtml += '</select>';
  7023. dateHtml = monthHtml + yearHtml;
  7024. }
  7025. html += '<th colspan="5" class="month">' + dateHtml + '</th>';
  7026. if ((!maxDate || maxDate.isAfter(calendar.lastDay)) && (!this.linkedCalendars || side == 'right' || this.singleDatePicker)) {
  7027. html += '<th class="next available"><i class="fa fa-' + arrow.right + ' glyphicon glyphicon-' + arrow.right + '"></i></th>';
  7028. } else {
  7029. html += '<th></th>';
  7030. }
  7031. html += '</tr>';
  7032. html += '<tr>';
  7033. // add week number label
  7034. if (this.showWeekNumbers || this.showISOWeekNumbers)
  7035. html += '<th class="week">' + this.locale.weekLabel + '</th>';
  7036. $.each(this.locale.daysOfWeek, function(index, dayOfWeek) {
  7037. html += '<th>' + dayOfWeek + '</th>';
  7038. });
  7039. html += '</tr>';
  7040. html += '</thead>';
  7041. html += '<tbody>';
  7042. //adjust maxDate to reflect the dateLimit setting in order to
  7043. //grey out end dates beyond the dateLimit
  7044. if (this.endDate == null && this.dateLimit) {
  7045. var maxLimit = this.startDate.clone().add(this.dateLimit).endOf('day');
  7046. if (!maxDate || maxLimit.isBefore(maxDate)) {
  7047. maxDate = maxLimit;
  7048. }
  7049. }
  7050. for (var row = 0; row < 6; row++) {
  7051. html += '<tr>';
  7052. // add week number
  7053. if (this.showWeekNumbers)
  7054. html += '<td class="week">' + calendar[row][0].week() + '</td>';
  7055. else if (this.showISOWeekNumbers)
  7056. html += '<td class="week">' + calendar[row][0].isoWeek() + '</td>';
  7057. for (var col = 0; col < 7; col++) {
  7058. var classes = [];
  7059. //highlight today's date
  7060. if (calendar[row][col].isSame(new Date(), "day"))
  7061. classes.push('today');
  7062. //highlight weekends
  7063. if (calendar[row][col].isoWeekday() > 5)
  7064. classes.push('weekend');
  7065. //grey out the dates in other months displayed at beginning and end of this calendar
  7066. if (calendar[row][col].month() != calendar[1][1].month())
  7067. classes.push('off');
  7068. //don't allow selection of dates before the minimum date
  7069. if (this.minDate && calendar[row][col].isBefore(this.minDate, 'day'))
  7070. classes.push('off', 'disabled');
  7071. //don't allow selection of dates after the maximum date
  7072. if (maxDate && calendar[row][col].isAfter(maxDate, 'day'))
  7073. classes.push('off', 'disabled');
  7074. //don't allow selection of date if a custom function decides it's invalid
  7075. if (this.isInvalidDate(calendar[row][col]))
  7076. classes.push('off', 'disabled');
  7077. //highlight the currently selected start date
  7078. if (calendar[row][col].format('YYYY-MM-DD') == this.startDate.format('YYYY-MM-DD'))
  7079. classes.push('active', 'start-date');
  7080. //highlight the currently selected end date
  7081. if (this.endDate != null && calendar[row][col].format('YYYY-MM-DD') == this.endDate.format('YYYY-MM-DD'))
  7082. classes.push('active', 'end-date');
  7083. //highlight dates in-between the selected dates
  7084. if (this.endDate != null && calendar[row][col] > this.startDate && calendar[row][col] < this.endDate)
  7085. classes.push('in-range');
  7086. //apply custom classes for this date
  7087. var isCustom = this.isCustomDate(calendar[row][col]);
  7088. if (isCustom !== false) {
  7089. if (typeof isCustom === 'string')
  7090. classes.push(isCustom);
  7091. else
  7092. Array.prototype.push.apply(classes, isCustom);
  7093. }
  7094. var cname = '', disabled = false;
  7095. for (var i = 0; i < classes.length; i++) {
  7096. cname += classes[i] + ' ';
  7097. if (classes[i] == 'disabled')
  7098. disabled = true;
  7099. }
  7100. if (!disabled)
  7101. cname += 'available';
  7102. html += '<td class="' + cname.replace(/^\s+|\s+$/g, '') + '" data-title="' + 'r' + row + 'c' + col + '">' + calendar[row][col].date() + '</td>';
  7103. }
  7104. html += '</tr>';
  7105. }
  7106. html += '</tbody>';
  7107. html += '</table>';
  7108. this.container.find('.calendar.' + side + ' .calendar-table').html(html);
  7109. },
  7110. renderTimePicker: function(side) {
  7111. // Don't bother updating the time picker if it's currently disabled
  7112. // because an end date hasn't been clicked yet
  7113. if (side == 'right' && !this.endDate) return;
  7114. var html, selected, minDate, maxDate = this.maxDate;
  7115. if (this.dateLimit && (!this.maxDate || this.startDate.clone().add(this.dateLimit).isAfter(this.maxDate)))
  7116. maxDate = this.startDate.clone().add(this.dateLimit);
  7117. if (side == 'left') {
  7118. selected = this.startDate.clone();
  7119. minDate = this.minDate;
  7120. } else if (side == 'right') {
  7121. selected = this.endDate.clone();
  7122. minDate = this.startDate;
  7123. //Preserve the time already selected
  7124. var timeSelector = this.container.find('.calendar.right .calendar-time div');
  7125. if (timeSelector.html() != '') {
  7126. selected.hour(timeSelector.find('.hourselect option:selected').val() || selected.hour());
  7127. selected.minute(timeSelector.find('.minuteselect option:selected').val() || selected.minute());
  7128. selected.second(timeSelector.find('.secondselect option:selected').val() || selected.second());
  7129. if (!this.timePicker24Hour) {
  7130. var ampm = timeSelector.find('.ampmselect option:selected').val();
  7131. if (ampm === 'PM' && selected.hour() < 12)
  7132. selected.hour(selected.hour() + 12);
  7133. if (ampm === 'AM' && selected.hour() === 12)
  7134. selected.hour(0);
  7135. }
  7136. }
  7137. if (selected.isBefore(this.startDate))
  7138. selected = this.startDate.clone();
  7139. if (maxDate && selected.isAfter(maxDate))
  7140. selected = maxDate.clone();
  7141. }
  7142. //
  7143. // hours
  7144. //
  7145. html = '<select class="hourselect">';
  7146. var start = this.timePicker24Hour ? 0 : 1;
  7147. var end = this.timePicker24Hour ? 23 : 12;
  7148. for (var i = start; i <= end; i++) {
  7149. var i_in_24 = i;
  7150. if (!this.timePicker24Hour)
  7151. i_in_24 = selected.hour() >= 12 ? (i == 12 ? 12 : i + 12) : (i == 12 ? 0 : i);
  7152. var time = selected.clone().hour(i_in_24);
  7153. var disabled = false;
  7154. if (minDate && time.minute(59).isBefore(minDate))
  7155. disabled = true;
  7156. if (maxDate && time.minute(0).isAfter(maxDate))
  7157. disabled = true;
  7158. if (i_in_24 == selected.hour() && !disabled) {
  7159. html += '<option value="' + i + '" selected="selected">' + i + '</option>';
  7160. } else if (disabled) {
  7161. html += '<option value="' + i + '" disabled="disabled" class="disabled">' + i + '</option>';
  7162. } else {
  7163. html += '<option value="' + i + '">' + i + '</option>';
  7164. }
  7165. }
  7166. html += '</select> ';
  7167. //
  7168. // minutes
  7169. //
  7170. html += ': <select class="minuteselect">';
  7171. for (var i = 0; i < 60; i += this.timePickerIncrement) {
  7172. var padded = i < 10 ? '0' + i : i;
  7173. var time = selected.clone().minute(i);
  7174. var disabled = false;
  7175. if (minDate && time.second(59).isBefore(minDate))
  7176. disabled = true;
  7177. if (maxDate && time.second(0).isAfter(maxDate))
  7178. disabled = true;
  7179. if (selected.minute() == i && !disabled) {
  7180. html += '<option value="' + i + '" selected="selected">' + padded + '</option>';
  7181. } else if (disabled) {
  7182. html += '<option value="' + i + '" disabled="disabled" class="disabled">' + padded + '</option>';
  7183. } else {
  7184. html += '<option value="' + i + '">' + padded + '</option>';
  7185. }
  7186. }
  7187. html += '</select> ';
  7188. //
  7189. // seconds
  7190. //
  7191. if (this.timePickerSeconds) {
  7192. html += ': <select class="secondselect">';
  7193. for (var i = 0; i < 60; i++) {
  7194. var padded = i < 10 ? '0' + i : i;
  7195. var time = selected.clone().second(i);
  7196. var disabled = false;
  7197. if (minDate && time.isBefore(minDate))
  7198. disabled = true;
  7199. if (maxDate && time.isAfter(maxDate))
  7200. disabled = true;
  7201. if (selected.second() == i && !disabled) {
  7202. html += '<option value="' + i + '" selected="selected">' + padded + '</option>';
  7203. } else if (disabled) {
  7204. html += '<option value="' + i + '" disabled="disabled" class="disabled">' + padded + '</option>';
  7205. } else {
  7206. html += '<option value="' + i + '">' + padded + '</option>';
  7207. }
  7208. }
  7209. html += '</select> ';
  7210. }
  7211. //
  7212. // AM/PM
  7213. //
  7214. if (!this.timePicker24Hour) {
  7215. html += '<select class="ampmselect">';
  7216. var am_html = '';
  7217. var pm_html = '';
  7218. if (minDate && selected.clone().hour(12).minute(0).second(0).isBefore(minDate))
  7219. am_html = ' disabled="disabled" class="disabled"';
  7220. if (maxDate && selected.clone().hour(0).minute(0).second(0).isAfter(maxDate))
  7221. pm_html = ' disabled="disabled" class="disabled"';
  7222. if (selected.hour() >= 12) {
  7223. html += '<option value="AM"' + am_html + '>AM</option><option value="PM" selected="selected"' + pm_html + '>PM</option>';
  7224. } else {
  7225. html += '<option value="AM" selected="selected"' + am_html + '>AM</option><option value="PM"' + pm_html + '>PM</option>';
  7226. }
  7227. html += '</select>';
  7228. }
  7229. this.container.find('.calendar.' + side + ' .calendar-time div').html(html);
  7230. },
  7231. updateFormInputs: function() {
  7232. //ignore mouse movements while an above-calendar text input has focus
  7233. if (this.container.find('input[name=daterangepicker_start]').is(":focus") || this.container.find('input[name=daterangepicker_end]').is(":focus"))
  7234. return;
  7235. this.container.find('input[name=daterangepicker_start]').val(this.startDate.format(this.locale.format));
  7236. if (this.endDate)
  7237. this.container.find('input[name=daterangepicker_end]').val(this.endDate.format(this.locale.format));
  7238. if (this.singleDatePicker || (this.endDate && (this.startDate.isBefore(this.endDate) || this.startDate.isSame(this.endDate)))) {
  7239. this.container.find('button.applyBtn').removeAttr('disabled');
  7240. } else {
  7241. this.container.find('button.applyBtn').attr('disabled', 'disabled');
  7242. }
  7243. },
  7244. move: function() {
  7245. var parentOffset = { top: 0, left: 0 },
  7246. containerTop;
  7247. var parentRightEdge = $(window).width();
  7248. if (!this.parentEl.is('body')) {
  7249. parentOffset = {
  7250. top: this.parentEl.offset().top - this.parentEl.scrollTop(),
  7251. left: this.parentEl.offset().left - this.parentEl.scrollLeft()
  7252. };
  7253. parentRightEdge = this.parentEl[0].clientWidth + this.parentEl.offset().left;
  7254. }
  7255. if (this.drops == 'up')
  7256. containerTop = this.element.offset().top - this.container.outerHeight() - parentOffset.top;
  7257. else
  7258. containerTop = this.element.offset().top + this.element.outerHeight() - parentOffset.top;
  7259. this.container[this.drops == 'up' ? 'addClass' : 'removeClass']('dropup');
  7260. if (this.opens == 'left') {
  7261. this.container.css({
  7262. top: containerTop,
  7263. right: parentRightEdge - this.element.offset().left - this.element.outerWidth(),
  7264. left: 'auto'
  7265. });
  7266. if (this.container.offset().left < 0) {
  7267. this.container.css({
  7268. right: 'auto',
  7269. left: 9
  7270. });
  7271. }
  7272. } else if (this.opens == 'center') {
  7273. this.container.css({
  7274. top: containerTop,
  7275. left: this.element.offset().left - parentOffset.left + this.element.outerWidth() / 2
  7276. - this.container.outerWidth() / 2,
  7277. right: 'auto'
  7278. });
  7279. if (this.container.offset().left < 0) {
  7280. this.container.css({
  7281. right: 'auto',
  7282. left: 9
  7283. });
  7284. }
  7285. } else {
  7286. this.container.css({
  7287. top: containerTop,
  7288. left: this.element.offset().left - parentOffset.left,
  7289. right: 'auto'
  7290. });
  7291. if (this.container.offset().left + this.container.outerWidth() > $(window).width()) {
  7292. this.container.css({
  7293. left: 'auto',
  7294. right: 0
  7295. });
  7296. }
  7297. }
  7298. },
  7299. show: function(e) {
  7300. if (this.isShowing) return;
  7301. // Create a click proxy that is private to this instance of datepicker, for unbinding
  7302. this._outsideClickProxy = $.proxy(function(e) { this.outsideClick(e); }, this);
  7303. // Bind global datepicker mousedown for hiding and
  7304. $(document)
  7305. .on('mousedown.daterangepicker', this._outsideClickProxy)
  7306. // also support mobile devices
  7307. .on('touchend.daterangepicker', this._outsideClickProxy)
  7308. // also explicitly play nice with Bootstrap dropdowns, which stopPropagation when clicking them
  7309. .on('click.daterangepicker', '[data-toggle=dropdown]', this._outsideClickProxy)
  7310. // and also close when focus changes to outside the picker (eg. tabbing between controls)
  7311. .on('focusin.daterangepicker', this._outsideClickProxy);
  7312. // Reposition the picker if the window is resized while it's open
  7313. $(window).on('resize.daterangepicker', $.proxy(function(e) { this.move(e); }, this));
  7314. this.oldStartDate = this.startDate.clone();
  7315. this.oldEndDate = this.endDate.clone();
  7316. this.previousRightTime = this.endDate.clone();
  7317. this.updateView();
  7318. this.container.show();
  7319. this.move();
  7320. this.element.trigger('show.daterangepicker', this);
  7321. this.isShowing = true;
  7322. },
  7323. hide: function(e) {
  7324. if (!this.isShowing) return;
  7325. //incomplete date selection, revert to last values
  7326. if (!this.endDate) {
  7327. this.startDate = this.oldStartDate.clone();
  7328. this.endDate = this.oldEndDate.clone();
  7329. }
  7330. //if a new date range was selected, invoke the user callback function
  7331. if (!this.startDate.isSame(this.oldStartDate) || !this.endDate.isSame(this.oldEndDate))
  7332. this.callback(this.startDate, this.endDate, this.chosenLabel);
  7333. //if picker is attached to a text input, update it
  7334. this.updateElement();
  7335. $(document).off('.daterangepicker');
  7336. $(window).off('.daterangepicker');
  7337. this.container.hide();
  7338. this.element.trigger('hide.daterangepicker', this);
  7339. this.isShowing = false;
  7340. },
  7341. toggle: function(e) {
  7342. if (this.isShowing) {
  7343. this.hide();
  7344. } else {
  7345. this.show();
  7346. }
  7347. },
  7348. outsideClick: function(e) {
  7349. var target = $(e.target);
  7350. // if the page is clicked anywhere except within the daterangerpicker/button
  7351. // itself then call this.hide()
  7352. if (
  7353. // ie modal dialog fix
  7354. e.type == "focusin" ||
  7355. target.closest(this.element).length ||
  7356. target.closest(this.container).length ||
  7357. target.closest('.calendar-table').length
  7358. ) return;
  7359. this.hide();
  7360. this.element.trigger('outsideClick.daterangepicker', this);
  7361. },
  7362. showCalendars: function() {
  7363. this.container.addClass('show-calendar');
  7364. this.move();
  7365. this.element.trigger('showCalendar.daterangepicker', this);
  7366. },
  7367. hideCalendars: function() {
  7368. this.container.removeClass('show-calendar');
  7369. this.element.trigger('hideCalendar.daterangepicker', this);
  7370. },
  7371. hoverRange: function(e) {
  7372. //ignore mouse movements while an above-calendar text input has focus
  7373. if (this.container.find('input[name=daterangepicker_start]').is(":focus") || this.container.find('input[name=daterangepicker_end]').is(":focus"))
  7374. return;
  7375. var label = e.target.getAttribute('data-range-key');
  7376. if (label == this.locale.customRangeLabel) {
  7377. this.updateView();
  7378. } else {
  7379. var dates = this.ranges[label];
  7380. this.container.find('input[name=daterangepicker_start]').val(dates[0].format(this.locale.format));
  7381. this.container.find('input[name=daterangepicker_end]').val(dates[1].format(this.locale.format));
  7382. }
  7383. },
  7384. clickRange: function(e) {
  7385. var label = e.target.getAttribute('data-range-key');
  7386. this.chosenLabel = label;
  7387. if (label == this.locale.customRangeLabel) {
  7388. this.showCalendars();
  7389. } else {
  7390. var dates = this.ranges[label];
  7391. this.startDate = dates[0];
  7392. this.endDate = dates[1];
  7393. if (!this.timePicker) {
  7394. this.startDate.startOf('day');
  7395. this.endDate.endOf('day');
  7396. }
  7397. if (!this.alwaysShowCalendars)
  7398. this.hideCalendars();
  7399. this.clickApply();
  7400. }
  7401. },
  7402. clickPrev: function(e) {
  7403. var cal = $(e.target).parents('.calendar');
  7404. if (cal.hasClass('left')) {
  7405. this.leftCalendar.month.subtract(1, 'month');
  7406. if (this.linkedCalendars)
  7407. this.rightCalendar.month.subtract(1, 'month');
  7408. } else {
  7409. this.rightCalendar.month.subtract(1, 'month');
  7410. }
  7411. this.updateCalendars();
  7412. },
  7413. clickNext: function(e) {
  7414. var cal = $(e.target).parents('.calendar');
  7415. if (cal.hasClass('left')) {
  7416. this.leftCalendar.month.add(1, 'month');
  7417. } else {
  7418. this.rightCalendar.month.add(1, 'month');
  7419. if (this.linkedCalendars)
  7420. this.leftCalendar.month.add(1, 'month');
  7421. }
  7422. this.updateCalendars();
  7423. },
  7424. hoverDate: function(e) {
  7425. //ignore mouse movements while an above-calendar text input has focus
  7426. //if (this.container.find('input[name=daterangepicker_start]').is(":focus") || this.container.find('input[name=daterangepicker_end]').is(":focus"))
  7427. // return;
  7428. //ignore dates that can't be selected
  7429. if (!$(e.target).hasClass('available')) return;
  7430. //have the text inputs above calendars reflect the date being hovered over
  7431. var title = $(e.target).attr('data-title');
  7432. var row = title.substr(1, 1);
  7433. var col = title.substr(3, 1);
  7434. var cal = $(e.target).parents('.calendar');
  7435. var date = cal.hasClass('left') ? this.leftCalendar.calendar[row][col] : this.rightCalendar.calendar[row][col];
  7436. if (this.endDate && !this.container.find('input[name=daterangepicker_start]').is(":focus")) {
  7437. this.container.find('input[name=daterangepicker_start]').val(date.format(this.locale.format));
  7438. } else if (!this.endDate && !this.container.find('input[name=daterangepicker_end]').is(":focus")) {
  7439. this.container.find('input[name=daterangepicker_end]').val(date.format(this.locale.format));
  7440. }
  7441. //highlight the dates between the start date and the date being hovered as a potential end date
  7442. var leftCalendar = this.leftCalendar;
  7443. var rightCalendar = this.rightCalendar;
  7444. var startDate = this.startDate;
  7445. if (!this.endDate) {
  7446. this.container.find('.calendar tbody td').each(function(index, el) {
  7447. //skip week numbers, only look at dates
  7448. if ($(el).hasClass('week')) return;
  7449. var title = $(el).attr('data-title');
  7450. var row = title.substr(1, 1);
  7451. var col = title.substr(3, 1);
  7452. var cal = $(el).parents('.calendar');
  7453. var dt = cal.hasClass('left') ? leftCalendar.calendar[row][col] : rightCalendar.calendar[row][col];
  7454. if ((dt.isAfter(startDate) && dt.isBefore(date)) || dt.isSame(date, 'day')) {
  7455. $(el).addClass('in-range');
  7456. } else {
  7457. $(el).removeClass('in-range');
  7458. }
  7459. });
  7460. }
  7461. },
  7462. clickDate: function(e) {
  7463. if (!$(e.target).hasClass('available')) return;
  7464. var title = $(e.target).attr('data-title');
  7465. var row = title.substr(1, 1);
  7466. var col = title.substr(3, 1);
  7467. var cal = $(e.target).parents('.calendar');
  7468. var date = cal.hasClass('left') ? this.leftCalendar.calendar[row][col] : this.rightCalendar.calendar[row][col];
  7469. //
  7470. // this function needs to do a few things:
  7471. // * alternate between selecting a start and end date for the range,
  7472. // * if the time picker is enabled, apply the hour/minute/second from the select boxes to the clicked date
  7473. // * if autoapply is enabled, and an end date was chosen, apply the selection
  7474. // * if single date picker mode, and time picker isn't enabled, apply the selection immediately
  7475. // * if one of the inputs above the calendars was focused, cancel that manual input
  7476. //
  7477. if (this.endDate || date.isBefore(this.startDate, 'day')) { //picking start
  7478. if (this.timePicker) {
  7479. var hour = parseInt(this.container.find('.left .hourselect').val(), 10);
  7480. if (!this.timePicker24Hour) {
  7481. var ampm = this.container.find('.left .ampmselect').val();
  7482. if (ampm === 'PM' && hour < 12)
  7483. hour += 12;
  7484. if (ampm === 'AM' && hour === 12)
  7485. hour = 0;
  7486. }
  7487. var minute = parseInt(this.container.find('.left .minuteselect').val(), 10);
  7488. var second = this.timePickerSeconds ? parseInt(this.container.find('.left .secondselect').val(), 10) : 0;
  7489. date = date.clone().hour(hour).minute(minute).second(second);
  7490. }
  7491. this.endDate = null;
  7492. this.setStartDate(date.clone());
  7493. } else if (!this.endDate && date.isBefore(this.startDate)) {
  7494. //special case: clicking the same date for start/end,
  7495. //but the time of the end date is before the start date
  7496. this.setEndDate(this.startDate.clone());
  7497. } else { // picking end
  7498. if (this.timePicker) {
  7499. var hour = parseInt(this.container.find('.right .hourselect').val(), 10);
  7500. if (!this.timePicker24Hour) {
  7501. var ampm = this.container.find('.right .ampmselect').val();
  7502. if (ampm === 'PM' && hour < 12)
  7503. hour += 12;
  7504. if (ampm === 'AM' && hour === 12)
  7505. hour = 0;
  7506. }
  7507. var minute = parseInt(this.container.find('.right .minuteselect').val(), 10);
  7508. var second = this.timePickerSeconds ? parseInt(this.container.find('.right .secondselect').val(), 10) : 0;
  7509. date = date.clone().hour(hour).minute(minute).second(second);
  7510. }
  7511. this.setEndDate(date.clone());
  7512. if (this.autoApply) {
  7513. this.calculateChosenLabel();
  7514. this.clickApply();
  7515. }
  7516. }
  7517. if (this.singleDatePicker) {
  7518. this.setEndDate(this.startDate);
  7519. if (!this.timePicker)
  7520. this.clickApply();
  7521. }
  7522. this.updateView();
  7523. //This is to cancel the blur event handler if the mouse was in one of the inputs
  7524. e.stopPropagation();
  7525. },
  7526. calculateChosenLabel: function () {
  7527. var customRange = true;
  7528. var i = 0;
  7529. for (var range in this.ranges) {
  7530. if (this.timePicker) {
  7531. if (this.startDate.isSame(this.ranges[range][0]) && this.endDate.isSame(this.ranges[range][1])) {
  7532. customRange = false;
  7533. this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')').addClass('active').html();
  7534. break;
  7535. }
  7536. } else {
  7537. //ignore times when comparing dates if time picker is not enabled
  7538. if (this.startDate.format('YYYY-MM-DD') == this.ranges[range][0].format('YYYY-MM-DD') && this.endDate.format('YYYY-MM-DD') == this.ranges[range][1].format('YYYY-MM-DD')) {
  7539. customRange = false;
  7540. this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')').addClass('active').html();
  7541. break;
  7542. }
  7543. }
  7544. i++;
  7545. }
  7546. if (customRange) {
  7547. if (this.showCustomRangeLabel) {
  7548. this.chosenLabel = this.container.find('.ranges li:last').addClass('active').html();
  7549. } else {
  7550. this.chosenLabel = null;
  7551. }
  7552. this.showCalendars();
  7553. }
  7554. },
  7555. clickApply: function(e) {
  7556. this.hide();
  7557. this.element.trigger('apply.daterangepicker', this);
  7558. },
  7559. clickCancel: function(e) {
  7560. this.startDate = this.oldStartDate;
  7561. this.endDate = this.oldEndDate;
  7562. this.hide();
  7563. this.element.trigger('cancel.daterangepicker', this);
  7564. },
  7565. monthOrYearChanged: function(e) {
  7566. var isLeft = $(e.target).closest('.calendar').hasClass('left'),
  7567. leftOrRight = isLeft ? 'left' : 'right',
  7568. cal = this.container.find('.calendar.'+leftOrRight);
  7569. // Month must be Number for new moment versions
  7570. var month = parseInt(cal.find('.monthselect').val(), 10);
  7571. var year = cal.find('.yearselect').val();
  7572. if (!isLeft) {
  7573. if (year < this.startDate.year() || (year == this.startDate.year() && month < this.startDate.month())) {
  7574. month = this.startDate.month();
  7575. year = this.startDate.year();
  7576. }
  7577. }
  7578. if (this.minDate) {
  7579. if (year < this.minDate.year() || (year == this.minDate.year() && month < this.minDate.month())) {
  7580. month = this.minDate.month();
  7581. year = this.minDate.year();
  7582. }
  7583. }
  7584. if (this.maxDate) {
  7585. if (year > this.maxDate.year() || (year == this.maxDate.year() && month > this.maxDate.month())) {
  7586. month = this.maxDate.month();
  7587. year = this.maxDate.year();
  7588. }
  7589. }
  7590. if (isLeft) {
  7591. this.leftCalendar.month.month(month).year(year);
  7592. if (this.linkedCalendars)
  7593. this.rightCalendar.month = this.leftCalendar.month.clone().add(1, 'month');
  7594. } else {
  7595. this.rightCalendar.month.month(month).year(year);
  7596. if (this.linkedCalendars)
  7597. this.leftCalendar.month = this.rightCalendar.month.clone().subtract(1, 'month');
  7598. }
  7599. this.updateCalendars();
  7600. },
  7601. timeChanged: function(e) {
  7602. var cal = $(e.target).closest('.calendar'),
  7603. isLeft = cal.hasClass('left');
  7604. var hour = parseInt(cal.find('.hourselect').val(), 10);
  7605. var minute = parseInt(cal.find('.minuteselect').val(), 10);
  7606. var second = this.timePickerSeconds ? parseInt(cal.find('.secondselect').val(), 10) : 0;
  7607. if (!this.timePicker24Hour) {
  7608. var ampm = cal.find('.ampmselect').val();
  7609. if (ampm === 'PM' && hour < 12)
  7610. hour += 12;
  7611. if (ampm === 'AM' && hour === 12)
  7612. hour = 0;
  7613. }
  7614. if (isLeft) {
  7615. var start = this.startDate.clone();
  7616. start.hour(hour);
  7617. start.minute(minute);
  7618. start.second(second);
  7619. this.setStartDate(start);
  7620. if (this.singleDatePicker) {
  7621. this.endDate = this.startDate.clone();
  7622. } else if (this.endDate && this.endDate.format('YYYY-MM-DD') == start.format('YYYY-MM-DD') && this.endDate.isBefore(start)) {
  7623. this.setEndDate(start.clone());
  7624. }
  7625. } else if (this.endDate) {
  7626. var end = this.endDate.clone();
  7627. end.hour(hour);
  7628. end.minute(minute);
  7629. end.second(second);
  7630. this.setEndDate(end);
  7631. }
  7632. //update the calendars so all clickable dates reflect the new time component
  7633. this.updateCalendars();
  7634. //update the form inputs above the calendars with the new time
  7635. this.updateFormInputs();
  7636. //re-render the time pickers because changing one selection can affect what's enabled in another
  7637. this.renderTimePicker('left');
  7638. this.renderTimePicker('right');
  7639. },
  7640. formInputsChanged: function(e) {
  7641. var isRight = $(e.target).closest('.calendar').hasClass('right');
  7642. var start = moment(this.container.find('input[name="daterangepicker_start"]').val(), this.locale.format);
  7643. var end = moment(this.container.find('input[name="daterangepicker_end"]').val(), this.locale.format);
  7644. if (start.isValid() && end.isValid()) {
  7645. if (isRight && end.isBefore(start))
  7646. start = end.clone();
  7647. this.setStartDate(start);
  7648. this.setEndDate(end);
  7649. if (isRight) {
  7650. this.container.find('input[name="daterangepicker_start"]').val(this.startDate.format(this.locale.format));
  7651. } else {
  7652. this.container.find('input[name="daterangepicker_end"]').val(this.endDate.format(this.locale.format));
  7653. }
  7654. }
  7655. this.updateView();
  7656. },
  7657. formInputsFocused: function(e) {
  7658. // Highlight the focused input
  7659. this.container.find('input[name="daterangepicker_start"], input[name="daterangepicker_end"]').removeClass('active');
  7660. $(e.target).addClass('active');
  7661. // Set the state such that if the user goes back to using a mouse,
  7662. // the calendars are aware we're selecting the end of the range, not
  7663. // the start. This allows someone to edit the end of a date range without
  7664. // re-selecting the beginning, by clicking on the end date input then
  7665. // using the calendar.
  7666. var isRight = $(e.target).closest('.calendar').hasClass('right');
  7667. if (isRight) {
  7668. this.endDate = null;
  7669. this.setStartDate(this.startDate.clone());
  7670. this.updateView();
  7671. }
  7672. },
  7673. formInputsBlurred: function(e) {
  7674. // this function has one purpose right now: if you tab from the first
  7675. // text input to the second in the UI, the endDate is nulled so that
  7676. // you can click another, but if you tab out without clicking anything
  7677. // or changing the input value, the old endDate should be retained
  7678. if (!this.endDate) {
  7679. var val = this.container.find('input[name="daterangepicker_end"]').val();
  7680. var end = moment(val, this.locale.format);
  7681. if (end.isValid()) {
  7682. this.setEndDate(end);
  7683. this.updateView();
  7684. }
  7685. }
  7686. },
  7687. elementChanged: function() {
  7688. if (!this.element.is('input')) return;
  7689. if (!this.element.val().length) return;
  7690. if (this.element.val().length < this.locale.format.length) return;
  7691. var dateString = this.element.val().split(this.locale.separator),
  7692. start = null,
  7693. end = null;
  7694. if (dateString.length === 2) {
  7695. start = moment(dateString[0], this.locale.format);
  7696. end = moment(dateString[1], this.locale.format);
  7697. }
  7698. if (this.singleDatePicker || start === null || end === null) {
  7699. start = moment(this.element.val(), this.locale.format);
  7700. end = start;
  7701. }
  7702. if (!start.isValid() || !end.isValid()) return;
  7703. this.setStartDate(start);
  7704. this.setEndDate(end);
  7705. this.updateView();
  7706. },
  7707. keydown: function(e) {
  7708. //hide on tab or enter
  7709. if ((e.keyCode === 9) || (e.keyCode === 13)) {
  7710. this.hide();
  7711. }
  7712. },
  7713. updateElement: function() {
  7714. if (this.element.is('input') && !this.singleDatePicker && this.autoUpdateInput) {
  7715. this.element.val(this.startDate.format(this.locale.format) + this.locale.separator + this.endDate.format(this.locale.format));
  7716. this.element.trigger('change');
  7717. } else if (this.element.is('input') && this.autoUpdateInput) {
  7718. this.element.val(this.startDate.format(this.locale.format));
  7719. this.element.trigger('change');
  7720. }
  7721. },
  7722. remove: function() {
  7723. this.container.remove();
  7724. this.element.off('.daterangepicker');
  7725. this.element.removeData();
  7726. }
  7727. };
  7728. $.fn.daterangepicker = function(options, callback) {
  7729. this.each(function() {
  7730. var el = $(this);
  7731. if (el.data('daterangepicker'))
  7732. el.data('daterangepicker').remove();
  7733. el.data('daterangepicker', new DateRangePicker(el, options, callback));
  7734. });
  7735. return this;
  7736. };
  7737. return DateRangePicker;
  7738. }));
  7739. /**
  7740. * @author: pppscn <35696959@qq.com>
  7741. * @version: v0.0.1
  7742. *
  7743. * @update 2017-05-07 <http://git.oschina.net/pp/fastadmin>
  7744. * @update 2017-09-17 <http://git.oschina.net/karson/fastadmin>
  7745. */
  7746. !function ($) {
  7747. 'use strict';
  7748. var ColumnsForSearch = [];
  7749. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  7750. var initCommonSearch = function (pColumns, that) {
  7751. var vFormCommon = createFormCommon(pColumns, that);
  7752. var vModal = sprintf("<div class=\"commonsearch-table %s\">", that.options.searchFormVisible ? "" : "hidden");
  7753. vModal += vFormCommon.join('');
  7754. vModal += "</div>";
  7755. that.$container.prepend($(vModal));
  7756. that.$commonsearch = $(".commonsearch-table", that.$container);
  7757. var form = $("form.form-commonsearch", that.$commonsearch);
  7758. //绑定日期时间元素事件
  7759. if ($(".datetimepicker", form).size() > 0) {
  7760. require(['bootstrap-datetimepicker'], function () {
  7761. $('.datetimepicker', form).parent().css('position', 'relative');
  7762. $('.datetimepicker', form).datetimepicker({
  7763. //format: 'YYYY-MM-DD',
  7764. icons: {
  7765. time: 'fa fa-clock-o',
  7766. date: 'fa fa-calendar',
  7767. up: 'fa fa-chevron-up',
  7768. down: 'fa fa-chevron-down',
  7769. previous: 'fa fa-chevron-left',
  7770. next: 'fa fa-chevron-right',
  7771. today: 'fa fa-history',
  7772. clear: 'fa fa-trash',
  7773. close: 'fa fa-remove'
  7774. },
  7775. showTodayButton: true,
  7776. showClose: true
  7777. });
  7778. });
  7779. }
  7780. if ($(".datetimerange", form).size() > 0) {
  7781. var ranges = {};
  7782. ranges[__('Today')] = [Moment().startOf('day'), Moment().endOf('day')];
  7783. ranges[__('Yesterday')] = [Moment().subtract(1, 'days').startOf('day'), Moment().subtract(1, 'days').endOf('day')];
  7784. ranges[__('Last 7 Days')] = [Moment().subtract(6, 'days').startOf('day'), Moment().endOf('day')];
  7785. ranges[__('Last 30 Days')] = [Moment().subtract(29, 'days').startOf('day'), Moment().endOf('day')];
  7786. ranges[__('This Month')] = [Moment().startOf('month'), Moment().endOf('month')];
  7787. ranges[__('Last Month')] = [Moment().subtract(1, 'month').startOf('month'), Moment().subtract(1, 'month').endOf('month')];
  7788. var options = {
  7789. timePicker: false,
  7790. autoUpdateInput: false,
  7791. timePickerSeconds: true,
  7792. timePicker24Hour: true,
  7793. autoApply: true,
  7794. locale: {
  7795. format: 'YYYY-MM-DD HH:mm:ss',
  7796. customRangeLabel: __("Custom Range"),
  7797. applyLabel: __("Apply"),
  7798. cancelLabel: __("Clear"),
  7799. },
  7800. ranges: ranges,
  7801. };
  7802. var callback = function (start, end) {
  7803. $(this.element).val(start.format(options.locale.format) + " - " + end.format(options.locale.format));
  7804. };
  7805. var column, index;
  7806. require(['bootstrap-daterangepicker'], function () {
  7807. $(".datetimerange", form).each(function () {
  7808. $(this).on('apply.daterangepicker', function (ev, picker) {
  7809. callback.call(picker, picker.startDate, picker.endDate);
  7810. });
  7811. $(this).on('cancel.daterangepicker', function (ev, picker) {
  7812. $(this).val('');
  7813. });
  7814. index = $(this).data("index");
  7815. column = pColumns[index];
  7816. $(this).daterangepicker($.extend({}, options, column.options || {}), callback);
  7817. });
  7818. });
  7819. }
  7820. // 表单提交
  7821. form.on("submit", function (event) {
  7822. event.preventDefault();
  7823. that.onCommonSearch();
  7824. return false;
  7825. });
  7826. // 重置搜索
  7827. form.on("click", "button[type=reset]", function (event) {
  7828. form[0].reset();
  7829. that.onCommonSearch();
  7830. });
  7831. };
  7832. var createFormCommon = function (pColumns, that) {
  7833. var htmlForm = [];
  7834. var opList = ['=', '>', '>=', '<', '<=', '!=', 'LIKE', 'LIKE %...%', 'NOT LIKE', 'IN', 'NOT IN', 'IN(...)', 'NOT IN(...)', 'BETWEEN', 'NOT BETWEEN', 'RANGE', 'NOT RANGE', 'IS NULL', 'IS NOT NULL'];
  7835. htmlForm.push(sprintf('<form class="form-horizontal form-commonsearch" action="%s" >', that.options.actionForm));
  7836. htmlForm.push('<fieldset>');
  7837. if (that.options.titleForm.length > 0)
  7838. htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
  7839. htmlForm.push('<div class="row">');
  7840. for (var i in pColumns) {
  7841. var vObjCol = pColumns[i];
  7842. if (!vObjCol.checkbox && vObjCol.field !== 'operate' && vObjCol.searchable && vObjCol.operate !== false) {
  7843. var query = Backend.api.query(vObjCol.field);
  7844. query = query ? query : '';
  7845. vObjCol.defaultValue = that.options.renderDefault && query != '' ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue);
  7846. ColumnsForSearch.push(vObjCol);
  7847. htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
  7848. htmlForm.push(sprintf('<label for="%s" class="control-label col-xs-4">%s</label>', vObjCol.field, vObjCol.title));
  7849. htmlForm.push('<div class="col-xs-8">');
  7850. vObjCol.operate = (typeof vObjCol.operate === 'undefined' || $.inArray(vObjCol.operate.toUpperCase(), opList) === -1) ? '=' : vObjCol.operate.toUpperCase();
  7851. htmlForm.push(sprintf('<input type="hidden" class="form-control operate" name="field-%s" data-name="%s" value="%s" readonly>', vObjCol.field, vObjCol.field, vObjCol.operate));
  7852. var style = typeof vObjCol.style === 'undefined' ? '' : sprintf('style="%s"', vObjCol.style);
  7853. if (vObjCol.searchList) {
  7854. if (typeof vObjCol.searchList === 'object' && typeof vObjCol.searchList.then === 'function') {
  7855. htmlForm.push(sprintf('<select class="form-control" name="%s" %s>%s</select>', vObjCol.field, style, sprintf('<option value="">%s</option>', that.options.formatCommonChoose())));
  7856. (function (vObjCol, that) {
  7857. $.when(vObjCol.searchList).done(function (ret) {
  7858. var isArray = false;
  7859. if (ret.data && ret.data.searchlist && $.isArray(ret.data.searchlist)) {
  7860. var resultlist = {};
  7861. $.each(ret.data.searchlist, function (key, value) {
  7862. resultlist[value.id] = value.name;
  7863. });
  7864. } else if (ret.constructor === Array || ret.constructor === Object) {
  7865. var resultlist = ret;
  7866. isArray = ret.constructor === Array ? true : isArray;
  7867. }
  7868. var optionList = [];
  7869. $.each(resultlist, function (key, value) {
  7870. var isSelect = (isArray ? value : key) == vObjCol.defaultValue ? 'selected' : '';
  7871. optionList.push(sprintf("<option value='" + (isArray ? value : key) + "' %s>" + value + "</option>", isSelect));
  7872. });
  7873. $("form.form-commonsearch select[name='" + vObjCol.field + "']", that.$container).append(optionList.join(''));
  7874. });
  7875. })(vObjCol, that);
  7876. } else if (typeof vObjCol.searchList == 'function') {
  7877. htmlForm.push(vObjCol.searchList.call(this, vObjCol));
  7878. } else {
  7879. var isArray = vObjCol.searchList.constructor === Array;
  7880. var searchList = [];
  7881. searchList.push(sprintf('<option value="">%s</option>', that.options.formatCommonChoose()));
  7882. $.each(vObjCol.searchList, function (key, value) {
  7883. var isSelect = (isArray ? value : key) == vObjCol.defaultValue ? 'selected' : '';
  7884. searchList.push(sprintf("<option value='" + (isArray ? value : key) + "' %s>" + value + "</option>", isSelect));
  7885. });
  7886. htmlForm.push(sprintf('<select class="form-control" name="%s" %s>%s</select>', vObjCol.field, style, searchList.join('')));
  7887. }
  7888. } else {
  7889. var placeholder = typeof vObjCol.placeholder === 'undefined' ? vObjCol.title : vObjCol.placeholder;
  7890. var type = typeof vObjCol.type === 'undefined' ? 'text' : vObjCol.type;
  7891. var addclass = typeof vObjCol.addclass === 'undefined' ? 'form-control' : 'form-control ' + vObjCol.addclass;
  7892. var data = typeof vObjCol.data === 'undefined' ? '' : vObjCol.data;
  7893. var defaultValue = typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue;
  7894. if (/BETWEEN$/.test(vObjCol.operate)) {
  7895. var defaultValueArr = defaultValue.toString().match(/\|/) ? defaultValue.split('|') : ['', ''];
  7896. var placeholderArr = placeholder.toString().match(/\|/) ? placeholder.split('|') : [placeholder, placeholder];
  7897. htmlForm.push('<div class="row row-between">');
  7898. htmlForm.push(sprintf('<div class="col-xs-6 11"><input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" data-index="%s" %s %s></div>', type, addclass, vObjCol.field, defaultValueArr[0], placeholderArr[0], vObjCol.field, i, style, data));
  7899. htmlForm.push(sprintf('<div class="col-xs-6 22"><input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" data-index="%s" %s %s></div>', type, addclass, vObjCol.field, defaultValueArr[1], placeholderArr[1], vObjCol.field, i, style, data));
  7900. htmlForm.push('</div>');
  7901. } else {
  7902. htmlForm.push(sprintf('<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" data-index="%s" %s %s>', type, addclass, vObjCol.field, defaultValue, placeholder, vObjCol.field, i, style, data));
  7903. }
  7904. }
  7905. htmlForm.push('</div>');
  7906. htmlForm.push('</div>');
  7907. }
  7908. }
  7909. htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
  7910. htmlForm.push(createFormBtn(that).join(''));
  7911. htmlForm.push('</div>');
  7912. htmlForm.push('</div>');
  7913. htmlForm.push('</fieldset>');
  7914. htmlForm.push('</form>');
  7915. return htmlForm;
  7916. };
  7917. var createFormBtn = function (that) {
  7918. var htmlBtn = [];
  7919. var searchSubmit = that.options.formatCommonSubmitButton();
  7920. var searchReset = that.options.formatCommonResetButton();
  7921. htmlBtn.push('<div class="col-sm-8 col-xs-offset-4">');
  7922. htmlBtn.push(sprintf('<button type="submit" class="btn btn-success" >%s</button> ', searchSubmit));
  7923. htmlBtn.push(sprintf('<button type="reset" class="btn btn-default" >%s</button> ', searchReset));
  7924. htmlBtn.push('</div>');
  7925. return htmlBtn;
  7926. };
  7927. var isSearchAvailble = function (that) {
  7928. //只支持服务端搜索
  7929. if (!that.options.commonSearch || that.options.sidePagination != 'server' || !that.options.url) {
  7930. return false;
  7931. }
  7932. return true;
  7933. };
  7934. var getSearchQuery = function (that, removeempty) {
  7935. var op = {};
  7936. var filter = {};
  7937. var value = '';
  7938. $("form.form-commonsearch input.operate", that.$commonsearch).each(function (i) {
  7939. var name = $(this).data("name");
  7940. var sym = $(this).val().toUpperCase();
  7941. var obj = $("[name='" + name + "']", that.$commonsearch);
  7942. if (obj.size() == 0)
  7943. return true;
  7944. var vObjCol = ColumnsForSearch[i];
  7945. if (obj.size() > 1) {
  7946. if (/BETWEEN$/.test(sym)) {
  7947. var value_begin = $.trim($("[name='" + name + "']:first", that.$commonsearch).val()), value_end = $.trim($("[name='" + name + "']:last", that.$commonsearch).val());
  7948. if (value_begin.length || value_end.length) {
  7949. if (typeof vObjCol.process === 'function') {
  7950. value_begin = vObjCol.process(value_begin, 'begin');
  7951. value_end = vObjCol.process(value_end, 'end');
  7952. }
  7953. value = value_begin + ',' + value_end;
  7954. } else {
  7955. value = '';
  7956. }
  7957. //如果是时间筛选,将operate置为RANGE
  7958. if ($("[name='" + name + "']:first", that.$commonsearch).hasClass("datetimepicker")) {
  7959. sym = 'RANGE';
  7960. }
  7961. } else {
  7962. value = $("[name='" + name + "']:checked", that.$commonsearch).val();
  7963. }
  7964. } else {
  7965. value = (vObjCol && typeof vObjCol.process === 'function') ? vObjCol.process(obj.val()) : (sym == 'LIKE %...%' ? obj.val().replace(/\*/g, '%') : obj.val());
  7966. }
  7967. if (removeempty && value == '' && sym.indexOf("NULL") == -1) {
  7968. return true;
  7969. }
  7970. op[name] = sym;
  7971. filter[name] = value;
  7972. });
  7973. return {op: op, filter: filter};
  7974. };
  7975. var getQueryParams = function (params, searchQuery, removeempty) {
  7976. params.filter = typeof params.filter === 'Object' ? params.filter : (params.filter ? JSON.parse(params.filter) : {});
  7977. params.op = typeof params.op === 'Object' ? params.op : (params.op ? JSON.parse(params.op) : {});
  7978. params.filter = $.extend(params.filter, searchQuery.filter);
  7979. params.op = $.extend(params.op, searchQuery.op);
  7980. //移除empty的值
  7981. if (removeempty) {
  7982. $.each(params.filter, function (i, j) {
  7983. if (j === '') {
  7984. delete params.filter[i];
  7985. delete params.op[i];
  7986. }
  7987. });
  7988. }
  7989. params.filter = JSON.stringify(params.filter);
  7990. params.op = JSON.stringify(params.op);
  7991. return params;
  7992. };
  7993. $.extend($.fn.bootstrapTable.defaults, {
  7994. commonSearch: false,
  7995. titleForm: "Common search",
  7996. actionForm: "",
  7997. searchFormVisible: true,
  7998. searchClass: 'searchit',
  7999. renderDefault: true,
  8000. onCommonSearch: function (field, text) {
  8001. return false;
  8002. },
  8003. onPostCommonSearch: function (table) {
  8004. return false;
  8005. }
  8006. });
  8007. $.extend($.fn.bootstrapTable.defaults.icons, {
  8008. commonSearchIcon: 'glyphicon-search'
  8009. });
  8010. $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
  8011. 'common-search.bs.table': 'onCommonSearch',
  8012. 'post-common-search.bs.table': 'onPostCommonSearch'
  8013. });
  8014. $.extend($.fn.bootstrapTable.locales[$.fn.bootstrapTable.defaults.locale], {
  8015. formatCommonSearch: function () {
  8016. return "Common search";
  8017. },
  8018. formatCommonSubmitButton: function () {
  8019. return "Submit";
  8020. },
  8021. formatCommonResetButton: function () {
  8022. return "Reset";
  8023. },
  8024. formatCommonCloseButton: function () {
  8025. return "Close";
  8026. },
  8027. formatCommonChoose: function () {
  8028. return "Choose";
  8029. }
  8030. });
  8031. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  8032. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  8033. _initHeader = BootstrapTable.prototype.initHeader,
  8034. _initToolbar = BootstrapTable.prototype.initToolbar,
  8035. _load = BootstrapTable.prototype.load,
  8036. _initSearch = BootstrapTable.prototype.initSearch;
  8037. BootstrapTable.prototype.initHeader = function () {
  8038. _initHeader.apply(this, Array.prototype.slice.apply(arguments));
  8039. this.$header.find('th[data-field]').each(function (i) {
  8040. var column = $(this).data();
  8041. if (typeof column['width'] !== 'undefined') {
  8042. $(this).css("min-width", column['width']);
  8043. }
  8044. });
  8045. };
  8046. BootstrapTable.prototype.initToolbar = function () {
  8047. _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
  8048. if (!isSearchAvailble(this)) {
  8049. return;
  8050. }
  8051. var that = this,
  8052. html = [];
  8053. html.push(sprintf('<div class="columns-%s pull-%s" style="margin-top:10px;">', this.options.buttonsAlign, this.options.buttonsAlign));
  8054. html.push(sprintf('<button class="btn btn-default%s' + '" type="button" name="commonSearch" title="%s">', that.options.iconSize === undefined ? '' : ' btn-' + that.options.iconSize, that.options.formatCommonSearch()));
  8055. html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.commonSearchIcon))
  8056. html.push('</button></div>');
  8057. that.$toolbar.prepend(html.join(''));
  8058. initCommonSearch(that.columns, that);
  8059. that.$toolbar.find('button[name="commonSearch"]')
  8060. .off('click').on('click', function () {
  8061. that.$commonsearch.toggleClass("hidden");
  8062. return;
  8063. });
  8064. that.$container.on("click", "." + that.options.searchClass, function () {
  8065. var obj = $("form [name='" + $(this).data("field") + "']", that.$commonsearch);
  8066. if (obj.size() > 0) {
  8067. obj.val($(this).data("value"));
  8068. $("form", that.$commonsearch).trigger("submit");
  8069. }
  8070. });
  8071. var searchQuery = getSearchQuery(that, true);
  8072. var queryParams = that.options.queryParams;
  8073. //匹配默认搜索值
  8074. this.options.queryParams = function (params) {
  8075. var params = getQueryParams(queryParams(params), searchQuery);
  8076. return params;
  8077. };
  8078. this.trigger('post-common-search', that);
  8079. };
  8080. BootstrapTable.prototype.onCommonSearch = function () {
  8081. var searchQuery = getSearchQuery(this);
  8082. var params = getQueryParams(this.options.queryParams({}), searchQuery, true);
  8083. this.trigger('common-search', this, params, searchQuery);
  8084. this.options.pageNumber = 1;
  8085. this.options.queryParams = function (options) {
  8086. return $.extend({}, options, params);
  8087. };
  8088. this.refresh({query: params});
  8089. };
  8090. BootstrapTable.prototype.load = function (data) {
  8091. _load.apply(this, Array.prototype.slice.apply(arguments));
  8092. if (!isSearchAvailble(this)) {
  8093. return;
  8094. }
  8095. };
  8096. BootstrapTable.prototype.initSearch = function () {
  8097. _initSearch.apply(this, Array.prototype.slice.apply(arguments));
  8098. if (!isSearchAvailble(this)) {
  8099. return;
  8100. }
  8101. var that = this;
  8102. var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
  8103. this.data = fp ? $.grep(this.data, function (item, i) {
  8104. for (var key in fp) {
  8105. var fval = fp[key].toLowerCase();
  8106. var value = item[key];
  8107. value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
  8108. that.header.formatters[$.inArray(key, that.header.fields)],
  8109. [value, item, i], value);
  8110. if (!($.inArray(key, that.header.fields) !== -1 &&
  8111. (typeof value === 'string' || typeof value === 'number') &&
  8112. (value + '').toLowerCase().indexOf(fval) !== -1)) {
  8113. return false;
  8114. }
  8115. }
  8116. return true;
  8117. }) : this.data;
  8118. };
  8119. }(jQuery);
  8120. define("bootstrap-table-commonsearch", ["bootstrap-table"], (function (global) {
  8121. return function () {
  8122. var ret, fn;
  8123. return ret || global.$.fn.bootstrapTable.defaults;
  8124. };
  8125. }(this)));
  8126. /*!art-template - Template Engine | http://aui.github.com/artTemplate/*/
  8127. !function(){function a(a){return a.replace(t,"").replace(u,",").replace(v,"").replace(w,"").replace(x,"").split(y)}function b(a){return"'"+a.replace(/('|\\)/g,"\\$1").replace(/\r/g,"\\r").replace(/\n/g,"\\n")+"'"}function c(c,d){function e(a){return m+=a.split(/\n/).length-1,k&&(a=a.replace(/\s+/g," ").replace(/<!--[\w\W]*?-->/g,"")),a&&(a=s[1]+b(a)+s[2]+"\n"),a}function f(b){var c=m;if(j?b=j(b,d):g&&(b=b.replace(/\n/g,function(){return m++,"$line="+m+";"})),0===b.indexOf("=")){var e=l&&!/^=[=#]/.test(b);if(b=b.replace(/^=[=#]?|[\s;]*$/g,""),e){var f=b.replace(/\s*\([^\)]+\)/,"");n[f]||/^(include|print)$/.test(f)||(b="$escape("+b+")")}else b="$string("+b+")";b=s[1]+b+s[2]}return g&&(b="$line="+c+";"+b),r(a(b),function(a){if(a&&!p[a]){var b;b="print"===a?u:"include"===a?v:n[a]?"$utils."+a:o[a]?"$helpers."+a:"$data."+a,w+=a+"="+b+",",p[a]=!0}}),b+"\n"}var g=d.debug,h=d.openTag,i=d.closeTag,j=d.parser,k=d.compress,l=d.escape,m=1,p={$data:1,$filename:1,$utils:1,$helpers:1,$out:1,$line:1},q="".trim,s=q?["$out='';","$out+=",";","$out"]:["$out=[];","$out.push(",");","$out.join('')"],t=q?"$out+=text;return $out;":"$out.push(text);",u="function(){var text=''.concat.apply('',arguments);"+t+"}",v="function(filename,data){data=data||$data;var text=$utils.$include(filename,data,$filename);"+t+"}",w="'use strict';var $utils=this,$helpers=$utils.$helpers,"+(g?"$line=0,":""),x=s[0],y="return new String("+s[3]+");";r(c.split(h),function(a){a=a.split(i);var b=a[0],c=a[1];1===a.length?x+=e(b):(x+=f(b),c&&(x+=e(c)))});var z=w+x+y;g&&(z="try{"+z+"}catch(e){throw {filename:$filename,name:'Render Error',message:e.message,line:$line,source:"+b(c)+".split(/\\n/)[$line-1].replace(/^\\s+/,'')};}");try{var A=new Function("$data","$filename",z);return A.prototype=n,A}catch(a){throw a.temp="function anonymous($data,$filename) {"+z+"}",a}}var d=function(a,b){return"string"==typeof b?q(b,{filename:a}):g(a,b)};d.version="3.0.0",d.config=function(a,b){e[a]=b};var e=d.defaults={openTag:"<%",closeTag:"%>",escape:!0,cache:!0,compress:!1,parser:null},f=d.cache={};d.render=function(a,b){return q(a)(b)};var g=d.renderFile=function(a,b){var c=d.get(a)||p({filename:a,name:"Render Error",message:"Template not found"});return b?c(b):c};d.get=function(a){var b;if(f[a])b=f[a];else if("object"==typeof document){var c=document.getElementById(a);if(c){var d=(c.value||c.innerHTML).replace(/^\s*|\s*$/g,"");b=q(d,{filename:a})}}return b};var h=function(a,b){return"string"!=typeof a&&(b=typeof a,"number"===b?a+="":a="function"===b?h(a.call(a)):""),a},i={"<":"&#60;",">":"&#62;",'"':"&#34;","'":"&#39;","&":"&#38;"},j=function(a){return i[a]},k=function(a){return h(a).replace(/&(?![\w#]+;)|[<>"']/g,j)},l=Array.isArray||function(a){return"[object Array]"==={}.toString.call(a)},m=function(a,b){var c,d;if(l(a))for(c=0,d=a.length;c<d;c++)b.call(a,a[c],c,a);else for(c in a)b.call(a,a[c],c)},n=d.utils={$helpers:{},$include:g,$string:h,$escape:k,$each:m};d.helper=function(a,b){o[a]=b};var o=d.helpers=n.$helpers;d.onerror=function(a){var b="Template Error\n\n";for(var c in a)b+="<"+c+">\n"+a[c]+"\n\n";"object"==typeof console&&console.error(b)};var p=function(a){return d.onerror(a),function(){return"{Template Error}"}},q=d.compile=function(a,b){function d(c){try{return new i(c,h)+""}catch(d){return b.debug?p(d)():(b.debug=!0,q(a,b)(c))}}b=b||{};for(var g in e)void 0===b[g]&&(b[g]=e[g]);var h=b.filename;try{var i=c(a,b)}catch(a){return a.filename=h||"anonymous",a.name="Syntax Error",p(a)}return d.prototype=i.prototype,d.toString=function(){return i.toString()},h&&b.cache&&(f[h]=d),d},r=n.$each,s="break,case,catch,continue,debugger,default,delete,do,else,false,finally,for,function,if,in,instanceof,new,null,return,switch,this,throw,true,try,typeof,var,void,while,with,abstract,boolean,byte,char,class,const,double,enum,export,extends,final,float,goto,implements,import,int,interface,long,native,package,private,protected,public,short,static,super,synchronized,throws,transient,volatile,arguments,let,yield,undefined",t=/\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|\s*\.\s*[$\w\.]+/g,u=/[^\w$]+/g,v=new RegExp(["\\b"+s.replace(/,/g,"\\b|\\b")+"\\b"].join("|"),"g"),w=/^\d[^,]*|,\d[^,]*/g,x=/^,+|,+$/g,y=/^$|,+/;"object"==typeof exports&&"undefined"!=typeof module?module.exports=d:"function"==typeof define?define('template',[],function(){return d}):this.template=d}();
  8128. /**
  8129. * 将BootstrapTable的行使用自定义的模板来渲染
  8130. *
  8131. * @author: karson
  8132. * @version: v0.0.1
  8133. *
  8134. * @update 2017-06-24 <http://github.com/karsonzhang/fastadmin>
  8135. */
  8136. !function ($) {
  8137. 'use strict';
  8138. $.extend($.fn.bootstrapTable.defaults, {
  8139. //是否启用模板渲染
  8140. templateView: false,
  8141. //数据格式化的模板ID或格式函数
  8142. templateFormatter: "itemtpl",
  8143. //添加的父类的class
  8144. templateParentClass: "row row-flex",
  8145. //向table添加的class
  8146. templateTableClass: "table-template",
  8147. });
  8148. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  8149. _initContainer = BootstrapTable.prototype.initContainer,
  8150. _initBody = BootstrapTable.prototype.initBody,
  8151. _initRow = BootstrapTable.prototype.initRow;
  8152. BootstrapTable.prototype.initContainer = function () {
  8153. _initContainer.apply(this, Array.prototype.slice.apply(arguments));
  8154. var that = this;
  8155. if (!that.options.templateView) {
  8156. return;
  8157. }
  8158. };
  8159. BootstrapTable.prototype.initBody = function () {
  8160. var that = this;
  8161. $.extend(that.options, {
  8162. showHeader: !that.options.templateView ? $.fn.bootstrapTable.defaults.showHeader : false,
  8163. showFooter: !that.options.templateView ? $.fn.bootstrapTable.defaults.showFooter : false,
  8164. });
  8165. $(that.$el).toggleClass(that.options.templateTableClass, that.options.templateView);
  8166. _initBody.apply(this, Array.prototype.slice.apply(arguments));
  8167. if (!that.options.templateView) {
  8168. return;
  8169. } else {
  8170. //由于Bootstrap是基于Table的,添加一个父类容器
  8171. $("> *:not(.no-records-found)", that.$body).wrapAll($("<div />").addClass(that.options.templateParentClass));
  8172. }
  8173. };
  8174. BootstrapTable.prototype.initRow = function (item, i, data, parentDom) {
  8175. var that = this;
  8176. //如果未启用则使用原生的initRow方法
  8177. if (!that.options.templateView) {
  8178. return _initRow.apply(that, Array.prototype.slice.apply(arguments));
  8179. }
  8180. var $content = '';
  8181. if (typeof that.options.templateFormatter === 'function') {
  8182. $content = that.options.templateFormatter.call(that, item, i, data);
  8183. } else {
  8184. var Template = require('template');
  8185. $content = Template(that.options.templateFormatter, {item: item, i: i, data: data});
  8186. }
  8187. return $content;
  8188. };
  8189. }(jQuery);
  8190. define("bootstrap-table-template", ["bootstrap-table","template"], (function (global) {
  8191. return function () {
  8192. var ret, fn;
  8193. return ret || global.$.fn.bootstrapTable.defaults;
  8194. };
  8195. }(this)));
  8196. define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table', 'bootstrap-table-lang', 'bootstrap-table-mobile', 'bootstrap-table-export', 'bootstrap-table-commonsearch', 'bootstrap-table-template'], function ($, undefined, Moment) {
  8197. var Table = {
  8198. list: {},
  8199. // Bootstrap-table 基础配置
  8200. defaults: {
  8201. url: '',
  8202. sidePagination: 'server',
  8203. method: 'get', //请求方法
  8204. toolbar: ".toolbar", //工具栏
  8205. search: true, //是否启用快速搜索
  8206. cache: false,
  8207. commonSearch: true, //是否启用通用搜索
  8208. searchFormVisible: false, //是否始终显示搜索表单
  8209. titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索
  8210. idTable: 'commonTable',
  8211. showExport: true,
  8212. exportDataType: "all",
  8213. exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'],
  8214. pageSize: 10,
  8215. pageList: [10, 25, 50, 'All'],
  8216. pagination: true,
  8217. clickToSelect: true, //是否启用点击选中
  8218. singleSelect: false, //是否启用单选
  8219. showRefresh: false,
  8220. locale: 'zh-CN',
  8221. showToggle: true,
  8222. showColumns: true,
  8223. pk: 'id',
  8224. sortName: 'id',
  8225. sortOrder: 'desc',
  8226. paginationFirstText: __("First"),
  8227. paginationPreText: __("Previous"),
  8228. paginationNextText: __("Next"),
  8229. paginationLastText: __("Last"),
  8230. mobileResponsive: true, //是否自适应移动端
  8231. cardView: false, //卡片视图
  8232. checkOnInit: true, //是否在初始化时判断
  8233. escape: true, //是否对内容进行转义
  8234. extend: {
  8235. index_url: '',
  8236. add_url: '',
  8237. edit_url: '',
  8238. del_url: '',
  8239. import_url: '',
  8240. multi_url: '',
  8241. dragsort_url: 'ajax/weigh',
  8242. }
  8243. },
  8244. // Bootstrap-table 列配置
  8245. columnDefaults: {
  8246. align: 'center',
  8247. valign: 'middle',
  8248. },
  8249. config: {
  8250. firsttd: 'tbody tr td:first-child:not(:has(div.card-views))',
  8251. toolbar: '.toolbar',
  8252. refreshbtn: '.btn-refresh',
  8253. addbtn: '.btn-add',
  8254. editbtn: '.btn-edit',
  8255. delbtn: '.btn-del',
  8256. importbtn: '.btn-import',
  8257. multibtn: '.btn-multi',
  8258. disabledbtn: '.btn-disabled',
  8259. editonebtn: '.btn-editone',
  8260. dragsortfield: 'weigh',
  8261. },
  8262. api: {
  8263. init: function (defaults, columnDefaults, locales) {
  8264. defaults = defaults ? defaults : {};
  8265. columnDefaults = columnDefaults ? columnDefaults : {};
  8266. locales = locales ? locales : {};
  8267. // 写入bootstrap-table默认配置
  8268. $.extend(true, $.fn.bootstrapTable.defaults, Table.defaults, defaults);
  8269. // 写入bootstrap-table column配置
  8270. $.extend($.fn.bootstrapTable.columnDefaults, Table.columnDefaults, columnDefaults);
  8271. // 写入bootstrap-table locale配置
  8272. $.extend($.fn.bootstrapTable.locales[Table.defaults.locale], {
  8273. formatCommonSearch: function () {
  8274. return __('Common search');
  8275. },
  8276. formatCommonSubmitButton: function () {
  8277. return __('Submit');
  8278. },
  8279. formatCommonResetButton: function () {
  8280. return __('Reset');
  8281. },
  8282. formatCommonCloseButton: function () {
  8283. return __('Close');
  8284. },
  8285. formatCommonChoose: function () {
  8286. return __('Choose');
  8287. }
  8288. }, locales);
  8289. },
  8290. // 绑定事件
  8291. bindevent: function (table) {
  8292. //Bootstrap-table的父元素,包含table,toolbar,pagnation
  8293. var parenttable = table.closest('.bootstrap-table');
  8294. //Bootstrap-table配置
  8295. var options = table.bootstrapTable('getOptions');
  8296. //Bootstrap操作区
  8297. var toolbar = $(options.toolbar, parenttable);
  8298. //当刷新表格时
  8299. table.on('load-error.bs.table', function (status, res) {
  8300. Toastr.error(__('Unknown data format'));
  8301. });
  8302. //当刷新表格时
  8303. table.on('refresh.bs.table', function (e, settings, data) {
  8304. $(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
  8305. });
  8306. //当双击单元格时
  8307. table.on('dbl-click-row.bs.table', function (e, row, element, field) {
  8308. $(Table.config.editonebtn, element).trigger("click");
  8309. });
  8310. //当内容渲染完成后
  8311. table.on('post-body.bs.table', function (e, settings, json, xhr) {
  8312. $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin");
  8313. $(Table.config.disabledbtn, toolbar).toggleClass('disabled', true);
  8314. if ($(Table.config.firsttd, table).find("input[type='checkbox'][data-index]").size() > 0) {
  8315. // 挺拽选择,需要重新绑定事件
  8316. require(['drag', 'drop'], function () {
  8317. $(Table.config.firsttd, table).drag("start", function (ev, dd) {
  8318. return $('<div class="selection" />').css('opacity', .65).appendTo(document.body);
  8319. }).drag(function (ev, dd) {
  8320. $(dd.proxy).css({
  8321. top: Math.min(ev.pageY, dd.startY),
  8322. left: Math.min(ev.pageX, dd.startX),
  8323. height: Math.abs(ev.pageY - dd.startY),
  8324. width: Math.abs(ev.pageX - dd.startX)
  8325. });
  8326. }).drag("end", function (ev, dd) {
  8327. $(dd.proxy).remove();
  8328. });
  8329. $(Table.config.firsttd, table).drop("start", function () {
  8330. Table.api.toggleattr(this);
  8331. }).drop(function () {
  8332. Table.api.toggleattr(this);
  8333. }).drop("end", function () {
  8334. Table.api.toggleattr(this);
  8335. });
  8336. $.drop({
  8337. multi: true
  8338. });
  8339. });
  8340. }
  8341. });
  8342. // 处理选中筛选框后按钮的状态统一变更
  8343. table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table fa.event.check', function () {
  8344. var ids = Table.api.selectedids(table);
  8345. $(Table.config.disabledbtn, toolbar).toggleClass('disabled', !ids.length);
  8346. });
  8347. // 刷新按钮事件
  8348. $(toolbar).on('click', Table.config.refreshbtn, function () {
  8349. table.bootstrapTable('refresh');
  8350. });
  8351. // 添加按钮事件
  8352. $(toolbar).on('click', Table.config.addbtn, function () {
  8353. var ids = Table.api.selectedids(table);
  8354. var url = options.extend.add_url;
  8355. url = Table.api.replaceurl(url, {ids: ids.length > 0 ? ids.join(",") : 0}, table);
  8356. Fast.api.open(url, __('Add'), $(this).data() || {});
  8357. });
  8358. // 导入按钮事件
  8359. if ($(Table.config.importbtn, toolbar).size() > 0) {
  8360. require(['upload'], function (Upload) {
  8361. Upload.api.plupload($(Table.config.importbtn, toolbar), function (data, ret) {
  8362. Fast.api.ajax({
  8363. url: options.extend.import_url,
  8364. data: {file: data.url},
  8365. }, function () {
  8366. table.bootstrapTable('refresh');
  8367. });
  8368. });
  8369. });
  8370. }
  8371. // 批量编辑按钮事件
  8372. $(toolbar).on('click', Table.config.editbtn, function () {
  8373. var that = this;
  8374. //循环弹出多个编辑框
  8375. $.each(table.bootstrapTable('getSelections'), function (index, row) {
  8376. var url = options.extend.edit_url;
  8377. row = $.extend({}, row ? row : {}, {ids: row[options.pk]});
  8378. var url = Table.api.replaceurl(url, row, table);
  8379. Fast.api.open(url, __('Edit'), $(that).data() || {});
  8380. });
  8381. });
  8382. // 批量操作按钮事件
  8383. $(toolbar).on('click', Table.config.multibtn, function () {
  8384. var ids = Table.api.selectedids(table);
  8385. Table.api.multi($(this).data("action"), ids, table, this);
  8386. });
  8387. // 批量删除按钮事件
  8388. $(toolbar).on('click', Table.config.delbtn, function () {
  8389. var that = this;
  8390. var ids = Table.api.selectedids(table);
  8391. Layer.confirm(
  8392. __('Are you sure you want to delete the %s selected item?', ids.length),
  8393. {icon: 3, title: __('Warning'), offset: 0, shadeClose: true},
  8394. function (index) {
  8395. Table.api.multi("del", ids, table, that);
  8396. Layer.close(index);
  8397. }
  8398. );
  8399. });
  8400. // 拖拽排序
  8401. require(['dragsort'], function () {
  8402. //绑定拖动排序
  8403. $("tbody", table).dragsort({
  8404. itemSelector: 'tr',
  8405. dragSelector: "a.btn-dragsort",
  8406. dragEnd: function () {
  8407. var data = table.bootstrapTable('getData');
  8408. var current = data[parseInt($(this).data("index"))];
  8409. var options = table.bootstrapTable('getOptions');
  8410. //改变的值和改变的ID集合
  8411. var ids = $.map($("tbody tr:visible", table), function (tr) {
  8412. return data[parseInt($(tr).data("index"))][options.pk];
  8413. });
  8414. var changeid = current[options.pk];
  8415. var pid = typeof current.pid != 'undefined' ? current.pid : '';
  8416. var params = {
  8417. url: table.bootstrapTable('getOptions').extend.dragsort_url,
  8418. data: {
  8419. ids: ids.join(','),
  8420. changeid: changeid,
  8421. pid: pid,
  8422. field: Table.config.dragsortfield,
  8423. orderway: options.sortOrder,
  8424. table: options.extend.table
  8425. }
  8426. };
  8427. Fast.api.ajax(params, function (data) {
  8428. table.bootstrapTable('refresh');
  8429. });
  8430. },
  8431. placeHolderTemplate: ""
  8432. });
  8433. });
  8434. $(table).on("click", "input[data-id][name='checkbox']", function (e) {
  8435. table.trigger('fa.event.check');
  8436. });
  8437. $(table).on("click", "[data-id].btn-change", function (e) {
  8438. e.preventDefault();
  8439. Table.api.multi($(this).data("action") ? $(this).data("action") : '', [$(this).data("id")], table, this);
  8440. });
  8441. $(table).on("click", "[data-id].btn-edit", function (e) {
  8442. e.preventDefault();
  8443. var ids = $(this).data("id");
  8444. var row = {};
  8445. var options = table.bootstrapTable("getOptions");
  8446. $.each(table.bootstrapTable('getData'), function (i, j) {
  8447. if (j[options.pk] == ids) {
  8448. row = j;
  8449. return false;
  8450. }
  8451. });
  8452. row.ids = ids;
  8453. var url = Table.api.replaceurl(options.extend.edit_url, row, table);
  8454. Fast.api.open(url, __('Edit'), $(this).data() || {});
  8455. });
  8456. $(table).on("click", "[data-id].btn-del", function (e) {
  8457. e.preventDefault();
  8458. var id = $(this).data("id");
  8459. var that = this;
  8460. Layer.confirm(
  8461. __('Are you sure you want to delete this item?'),
  8462. {icon: 3, title: __('Warning'), shadeClose: true},
  8463. function (index) {
  8464. Table.api.multi("del", id, table, that);
  8465. Layer.close(index);
  8466. }
  8467. );
  8468. });
  8469. var id = table.attr("id");
  8470. Table.list[id] = table;
  8471. return table;
  8472. },
  8473. // 批量操作请求
  8474. multi: function (action, ids, table, element) {
  8475. var options = table.bootstrapTable('getOptions');
  8476. var data = element ? $(element).data() : {};
  8477. var ids = ($.isArray(ids) ? ids.join(",") : ids);
  8478. var url = typeof data.url !== "undefined" ? data.url : (action == "del" ? options.extend.del_url : options.extend.multi_url);
  8479. url = this.replaceurl(url, {ids: ids}, table);
  8480. var params = typeof data.params !== "undefined" ? (typeof data.params == 'object' ? $.param(data.params) : data.params) : '';
  8481. var options = {url: url, data: {action: action, ids: ids, params: params}};
  8482. Fast.api.ajax(options, function (data) {
  8483. table.bootstrapTable('refresh');
  8484. });
  8485. },
  8486. // 单元格元素事件
  8487. events: {
  8488. operate: {
  8489. 'click .btn-editone': function (e, value, row, index) {
  8490. e.stopPropagation();
  8491. e.preventDefault();
  8492. var table = $(this).closest('table');
  8493. var options = table.bootstrapTable('getOptions');
  8494. var ids = row[options.pk];
  8495. row = $.extend({}, row ? row : {}, {ids: ids});
  8496. var url = options.extend.edit_url;
  8497. Fast.api.open(Table.api.replaceurl(url, row, table), __('Edit'), $(this).data() || {});
  8498. },
  8499. 'click .btn-delone': function (e, value, row, index) {
  8500. e.stopPropagation();
  8501. e.preventDefault();
  8502. var that = this;
  8503. var top = $(that).offset().top - $(window).scrollTop();
  8504. var left = $(that).offset().left - $(window).scrollLeft() - 260;
  8505. if (top + 154 > $(window).height()) {
  8506. top = top - 154;
  8507. }
  8508. if ($(window).width() < 480) {
  8509. top = left = undefined;
  8510. }
  8511. Layer.confirm(
  8512. __('Are you sure you want to delete this item?'),
  8513. {icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true},
  8514. function (index) {
  8515. var table = $(that).closest('table');
  8516. var options = table.bootstrapTable('getOptions');
  8517. Table.api.multi("del", row[options.pk], table, that);
  8518. Layer.close(index);
  8519. }
  8520. );
  8521. }
  8522. }
  8523. },
  8524. // 单元格数据格式化
  8525. formatter: {
  8526. icon: function (value, row, index) {
  8527. if (!value)
  8528. return '';
  8529. value = value.indexOf(" ") > -1 ? value : "fa fa-" + value;
  8530. //渲染fontawesome图标
  8531. return '<i class="' + value + '"></i> ' + value;
  8532. },
  8533. image: function (value, row, index) {
  8534. value = value ? value : '/assets/img/blank.gif';
  8535. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  8536. return '<img class="' + classname + '" src="' + Fast.api.cdnurl(value) + '" />';
  8537. },
  8538. images: function (value, row, index) {
  8539. value = value.toString();
  8540. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  8541. var arr = value.toString().split(',');
  8542. var html = [];
  8543. $.each(arr, function (i, value) {
  8544. value = value ? value : '/assets/img/blank.gif';
  8545. html.push('<img class="' + classname + '" src="' + Fast.api.cdnurl(value) + '" />');
  8546. });
  8547. return html.join(' ');
  8548. },
  8549. status: function (value, row, index) {
  8550. //颜色状态数组,可使用red/yellow/aqua/blue/navy/teal/olive/lime/fuchsia/purple/maroon
  8551. var colorArr = {normal: 'success', hidden: 'grey', deleted: 'danger', locked: 'info'};
  8552. //如果字段列有定义custom
  8553. if (typeof this.custom !== 'undefined') {
  8554. colorArr = $.extend(colorArr, this.custom);
  8555. }
  8556. value = value.toString();
  8557. var color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary';
  8558. value = value.charAt(0).toUpperCase() + value.slice(1);
  8559. //渲染状态
  8560. var html = '<span class="text-' + color + '"><i class="fa fa-circle"></i> ' + __(value) + '</span>';
  8561. return html;
  8562. },
  8563. url: function (value, row, index) {
  8564. return '<div class="input-group input-group-sm" style="width:250px;"><input type="text" class="form-control input-sm" value="' + value + '"><span class="input-group-btn input-group-sm"><a href="' + value + '" target="_blank" class="btn btn-default btn-sm"><i class="fa fa-link"></i></a></span></div>';
  8565. },
  8566. search: function (value, row, index) {
  8567. return '<a href="javascript:;" class="searchit" data-field="' + this.field + '" data-value="' + value + '">' + value + '</a>';
  8568. },
  8569. addtabs: function (value, row, index) {
  8570. var url = Table.api.replaceurl(this.url, row, this.table);
  8571. var title = this.atitle ? this.atitle : __("Search %s", value);
  8572. return '<a href="' + Fast.api.fixurl(url) + '" class="addtabsit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
  8573. },
  8574. dialog: function (value, row, index) {
  8575. var url = Table.api.replaceurl(this.url, row, this.table);
  8576. var title = this.atitle ? this.atitle : __("View %s", value);
  8577. return '<a href="' + Fast.api.fixurl(url) + '" class="dialogit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
  8578. },
  8579. flag: function (value, row, index) {
  8580. var colorArr = {index: 'success', hot: 'warning', recommend: 'danger', 'new': 'info'};
  8581. //如果字段列有定义custom
  8582. if (typeof this.custom !== 'undefined') {
  8583. colorArr = $.extend(colorArr, this.custom);
  8584. }
  8585. if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
  8586. value = row[this.customField];
  8587. }
  8588. //渲染Flag
  8589. var html = [];
  8590. var arr = value.toString().split(',');
  8591. $.each(arr, function (i, value) {
  8592. value = value.toString();
  8593. if (value == '')
  8594. return true;
  8595. var color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary';
  8596. value = value.charAt(0).toUpperCase() + value.slice(1);
  8597. html.push('<span class="label label-' + color + '">' + __(value) + '</span>');
  8598. });
  8599. return html.join(' ');
  8600. },
  8601. label: function (value, row, index) {
  8602. return Table.api.formatter.flag.call(this, value, row, index);
  8603. },
  8604. datetime: function (value, row, index) {
  8605. return value ? Moment(parseInt(value) * 1000).format("YYYY-MM-DD HH:mm:ss") : __('None');
  8606. },
  8607. operate: function (value, row, index) {
  8608. var table = this.table;
  8609. // 操作配置
  8610. var options = table ? table.bootstrapTable('getOptions') : {};
  8611. // 默认按钮组
  8612. var buttons = $.extend([], this.buttons || []);
  8613. buttons.push({name: 'dragsort', icon: 'fa fa-arrows', classname: 'btn btn-xs btn-primary btn-dragsort'});
  8614. buttons.push({name: 'edit', icon: 'fa fa-pencil', classname: 'btn btn-xs btn-success btn-editone', url: options.extend.edit_url});
  8615. buttons.push({name: 'del', icon: 'fa fa-trash', classname: 'btn btn-xs btn-danger btn-delone'});
  8616. return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
  8617. },
  8618. buttons: function (value, row, index) {
  8619. // 默认按钮组
  8620. var buttons = $.extend([], this.buttons || []);
  8621. return Table.api.buttonlink(this, buttons, value, row, index, 'buttons');
  8622. }
  8623. },
  8624. buttonlink: function (column, buttons, value, row, index, type) {
  8625. var table = column.table;
  8626. type = typeof type === 'undefined' ? 'buttons' : type;
  8627. var options = table ? table.bootstrapTable('getOptions') : {};
  8628. var html = [];
  8629. var url, classname, icon, text, title, extend;
  8630. var columnIndex = options.columns[0].findIndex(function (element) {
  8631. return element === column;
  8632. });
  8633. $.each(buttons, function (i, j) {
  8634. if (type === 'operate') {
  8635. if (j.name === 'dragsort' && typeof row[Table.config.dragsortfield] === 'undefined') {
  8636. return true;
  8637. }
  8638. if (['add', 'edit', 'del', 'multi', 'dragsort'].indexOf(j.name) > -1 && !options.extend[j.name + "_url"]) {
  8639. return true;
  8640. }
  8641. }
  8642. var attr = table.data(type + "-" + j.name);
  8643. if (typeof attr === 'undefined' || attr) {
  8644. url = j.url ? j.url : '';
  8645. url = url ? Fast.api.fixurl(Table.api.replaceurl(url, row, table)) : 'javascript:;';
  8646. classname = j.classname ? j.classname : 'btn-primary btn-' + name + 'one';
  8647. icon = j.icon ? j.icon : '';
  8648. text = j.text ? j.text : '';
  8649. title = j.title ? j.title : text;
  8650. refresh = j.refresh ? 'data-refresh="' + j.refresh + '"' : '';
  8651. confirm = j.confirm ? 'data-confirm="' + j.confirm + '"' : '';
  8652. extend = j.extend ? j.extend : '';
  8653. html.push('<a href="' + url + '" class="' + classname + '" ' + (confirm ? confirm + ' ' : '') + (refresh ? refresh + ' ' : '') + extend + ' title="' + title + '" data-table-id="' + (table ? table.attr("id") : '') + '" data-column-index="' + columnIndex + '" data-row-index="' + index + '" data-button-index="' + i + '"><i class="' + icon + '"></i>' + (text ? ' ' + text : '') + '</a>');
  8654. }
  8655. });
  8656. return html.join(' ');
  8657. },
  8658. //替换URL中的数据
  8659. replaceurl: function (url, row, table) {
  8660. var options = table ? table.bootstrapTable('getOptions') : null;
  8661. var ids = options ? row[options.pk] : 0;
  8662. row.ids = ids ? ids : (typeof row.ids !== 'undefined' ? row.ids : 0);
  8663. //自动添加ids参数
  8664. url = !url.match(/\{ids\}/i) ? url + (url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + '{ids}' : url;
  8665. url = url.replace(/\{(.*?)\}/gi, function (matched) {
  8666. matched = matched.substring(1, matched.length - 1);
  8667. if (matched.indexOf(".") !== -1) {
  8668. var temp = row;
  8669. var arr = matched.split(/\./);
  8670. for (var i = 0; i < arr.length; i++) {
  8671. if (typeof temp[arr[i]] !== 'undefined') {
  8672. temp = temp[arr[i]];
  8673. }
  8674. }
  8675. return typeof temp === 'object' ? '' : temp;
  8676. }
  8677. return row[matched];
  8678. });
  8679. return url;
  8680. },
  8681. // 获取选中的条目ID集合
  8682. selectedids: function (table) {
  8683. var options = table.bootstrapTable('getOptions');
  8684. if (options.templateView) {
  8685. return $.map($("input[data-id][name='checkbox']:checked"), function (dom) {
  8686. return $(dom).data("id");
  8687. });
  8688. } else {
  8689. return $.map(table.bootstrapTable('getSelections'), function (row) {
  8690. return row[options.pk];
  8691. });
  8692. }
  8693. },
  8694. // 切换复选框状态
  8695. toggleattr: function (table) {
  8696. $("input[type='checkbox']", table).trigger('click');
  8697. },
  8698. // 根据行索引获取行数据
  8699. getrowdata: function (table, index) {
  8700. index = parseInt(index);
  8701. var data = table.bootstrapTable('getData');
  8702. return typeof data[index] !== 'undefined' ? data[index] : null;
  8703. }
  8704. },
  8705. };
  8706. return Table;
  8707. });
  8708. /**
  8709. * mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
  8710. * v1.5.7
  8711. *
  8712. * Copyright 2013, Moxiecode Systems AB
  8713. * Released under GPL License.
  8714. *
  8715. * License: http://www.plupload.com/license
  8716. * Contributing: http://www.plupload.com/contributing
  8717. *
  8718. * Date: 2017-11-03
  8719. */
  8720. !function(e,t){var i=function(){var e={};return t.apply(e,arguments),e.moxie};"function"==typeof define&&define.amd?define("moxie",[],i):"object"==typeof module&&module.exports?module.exports=i():e.moxie=i()}(this||window,function(){!function(e,t){"use strict";function i(e,t){for(var i,n=[],r=0;r<e.length;++r){if(i=s[e[r]]||o(e[r]),!i)throw"module definition dependecy not found: "+e[r];n.push(i)}t.apply(null,n)}function n(e,n,r){if("string"!=typeof e)throw"invalid module definition, module id must be defined and be a string";if(n===t)throw"invalid module definition, dependencies must be specified";if(r===t)throw"invalid module definition, definition function must be specified";i(n,function(){s[e]=r.apply(null,arguments)})}function r(e){return!!s[e]}function o(t){for(var i=e,n=t.split(/[.\/]/),r=0;r<n.length;++r){if(!i[n[r]])return;i=i[n[r]]}return i}function a(i){for(var n=0;n<i.length;n++){for(var r=e,o=i[n],a=o.split(/[.\/]/),u=0;u<a.length-1;++u)r[a[u]]===t&&(r[a[u]]={}),r=r[a[u]];r[a[a.length-1]]=s[o]}}var s={};n("moxie/core/utils/Basic",[],function(){function e(e){var t;return e===t?"undefined":null===e?"null":e.nodeType?"node":{}.toString.call(e).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()}function t(){return s(!1,!1,arguments)}function i(){return s(!0,!1,arguments)}function n(){return s(!1,!0,arguments)}function r(){return s(!0,!0,arguments)}function o(t){switch(e(t)){case"array":return s(!1,!0,[[],t]);case"object":return s(!1,!0,[{},t]);default:return t}}function a(i){switch(e(i)){case"array":return Array.prototype.slice.call(i);case"object":return t({},i)}return i}function s(t,i,n){var r,o=n[0];return c(n,function(n,u){u>0&&c(n,function(n,u){var c=-1!==h(e(n),["array","object"]);return n===r||t&&o[u]===r?!0:(c&&i&&(n=a(n)),e(o[u])===e(n)&&c?s(t,i,[o[u],n]):o[u]=n,void 0)})}),o}function u(e,t){function i(){this.constructor=e}for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n]);return i.prototype=t.prototype,e.prototype=new i,e.parent=t.prototype,e}function c(e,t){var i,n,r,o;if(e){try{i=e.length}catch(a){i=o}if(i===o||"number"!=typeof i){for(n in e)if(e.hasOwnProperty(n)&&t(e[n],n)===!1)return}else for(r=0;i>r;r++)if(t(e[r],r)===!1)return}}function l(t){var i;if(!t||"object"!==e(t))return!0;for(i in t)return!1;return!0}function d(t,i){function n(r){"function"===e(t[r])&&t[r](function(e){++r<o&&!e?n(r):i(e)})}var r=0,o=t.length;"function"!==e(i)&&(i=function(){}),t&&t.length||i(),n(r)}function m(e,t){var i=0,n=e.length,r=new Array(n);c(e,function(e,o){e(function(e){if(e)return t(e);var a=[].slice.call(arguments);a.shift(),r[o]=a,i++,i===n&&(r.unshift(null),t.apply(this,r))})})}function h(e,t){if(t){if(Array.prototype.indexOf)return Array.prototype.indexOf.call(t,e);for(var i=0,n=t.length;n>i;i++)if(t[i]===e)return i}return-1}function f(t,i){var n=[];"array"!==e(t)&&(t=[t]),"array"!==e(i)&&(i=[i]);for(var r in t)-1===h(t[r],i)&&n.push(t[r]);return n.length?n:!1}function p(e,t){var i=[];return c(e,function(e){-1!==h(e,t)&&i.push(e)}),i.length?i:null}function g(e){var t,i=[];for(t=0;t<e.length;t++)i[t]=e[t];return i}function x(e){return e?String.prototype.trim?String.prototype.trim.call(e):e.toString().replace(/^\s*/,"").replace(/\s*$/,""):e}function v(e){if("string"!=typeof e)return e;var t,i={t:1099511627776,g:1073741824,m:1048576,k:1024};return e=/^([0-9\.]+)([tmgk]?)$/.exec(e.toLowerCase().replace(/[^0-9\.tmkg]/g,"")),t=e[2],e=+e[1],i.hasOwnProperty(t)&&(e*=i[t]),Math.floor(e)}function w(e){var t=[].slice.call(arguments,1);return e.replace(/%([a-z])/g,function(e,i){var n=t.shift();switch(i){case"s":return n+"";case"d":return parseInt(n,10);case"f":return parseFloat(n);case"c":return"";default:return n}})}function y(e,t){var i=this;setTimeout(function(){e.call(i)},t||1)}var E=function(){var e=0;return function(t){var i,n=(new Date).getTime().toString(32);for(i=0;5>i;i++)n+=Math.floor(65535*Math.random()).toString(32);return(t||"o_")+n+(e++).toString(32)}}();return{guid:E,typeOf:e,extend:t,extendIf:i,extendImmutable:n,extendImmutableIf:r,clone:o,inherit:u,each:c,isEmptyObj:l,inSeries:d,inParallel:m,inArray:h,arrayDiff:f,arrayIntersect:p,toArray:g,trim:x,sprintf:w,parseSizeStr:v,delay:y}}),n("moxie/core/utils/Encode",[],function(){var e=function(e){return unescape(encodeURIComponent(e))},t=function(e){return decodeURIComponent(escape(e))},i=function(e,i){if("function"==typeof window.atob)return i?t(window.atob(e)):window.atob(e);var n,r,o,a,s,u,c,l,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,h=0,f="",p=[];if(!e)return e;e+="";do a=d.indexOf(e.charAt(m++)),s=d.indexOf(e.charAt(m++)),u=d.indexOf(e.charAt(m++)),c=d.indexOf(e.charAt(m++)),l=a<<18|s<<12|u<<6|c,n=255&l>>16,r=255&l>>8,o=255&l,p[h++]=64==u?String.fromCharCode(n):64==c?String.fromCharCode(n,r):String.fromCharCode(n,r,o);while(m<e.length);return f=p.join(""),i?t(f):f},n=function(t,i){if(i&&(t=e(t)),"function"==typeof window.btoa)return window.btoa(t);var n,r,o,a,s,u,c,l,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,h=0,f="",p=[];if(!t)return t;do n=t.charCodeAt(m++),r=t.charCodeAt(m++),o=t.charCodeAt(m++),l=n<<16|r<<8|o,a=63&l>>18,s=63&l>>12,u=63&l>>6,c=63&l,p[h++]=d.charAt(a)+d.charAt(s)+d.charAt(u)+d.charAt(c);while(m<t.length);f=p.join("");var g=t.length%3;return(g?f.slice(0,g-3):f)+"===".slice(g||3)};return{utf8_encode:e,utf8_decode:t,atob:i,btoa:n}}),n("moxie/core/utils/Env",["moxie/core/utils/Basic"],function(e){function i(e,t,i){var n=0,r=0,o=0,a={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},s=function(e){return e=(""+e).replace(/[_\-+]/g,"."),e=e.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,"."),e.length?e.split("."):[-8]},u=function(e){return e?isNaN(e)?a[e]||-7:parseInt(e,10):0};for(e=s(e),t=s(t),r=Math.max(e.length,t.length),n=0;r>n;n++)if(e[n]!=t[n]){if(e[n]=u(e[n]),t[n]=u(t[n]),e[n]<t[n]){o=-1;break}if(e[n]>t[n]){o=1;break}}if(!i)return o;switch(i){case">":case"gt":return o>0;case">=":case"ge":return o>=0;case"<=":case"le":return 0>=o;case"==":case"=":case"eq":return 0===o;case"<>":case"!=":case"ne":return 0!==o;case"":case"<":case"lt":return 0>o;default:return null}}var n=function(e){var t="",i="?",n="function",r="undefined",o="object",a="name",s="version",u={has:function(e,t){return-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()}},c={rgx:function(){for(var t,i,a,s,u,c,l,d=0,m=arguments;d<m.length;d+=2){var h=m[d],f=m[d+1];if(typeof t===r){t={};for(s in f)u=f[s],typeof u===o?t[u[0]]=e:t[u]=e}for(i=a=0;i<h.length;i++)if(c=h[i].exec(this.getUA())){for(s=0;s<f.length;s++)l=c[++a],u=f[s],typeof u===o&&u.length>0?2==u.length?t[u[0]]=typeof u[1]==n?u[1].call(this,l):u[1]:3==u.length?t[u[0]]=typeof u[1]!==n||u[1].exec&&u[1].test?l?l.replace(u[1],u[2]):e:l?u[1].call(this,l,u[2]):e:4==u.length&&(t[u[0]]=l?u[3].call(this,l.replace(u[1],u[2])):e):t[u]=l?l:e;break}if(c)break}return t},str:function(t,n){for(var r in n)if(typeof n[r]===o&&n[r].length>0){for(var a=0;a<n[r].length;a++)if(u.has(n[r][a],t))return r===i?e:r}else if(u.has(n[r],t))return r===i?e:r;return t}},l={browser:{oldsafari:{major:{1:["/8","/1","/3"],2:"/4","?":"/"},version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2000:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",RT:"ARM"}}}},d={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[a,s],[/\s(opr)\/([\w\.]+)/i],[[a,"Opera"],s],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi)\/([\w\.-]+)/i],[a,s],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[a,"IE"],s],[/(edge)\/((\d+)?[\w\.]+)/i],[a,s],[/(yabrowser)\/([\w\.]+)/i],[[a,"Yandex"],s],[/(comodo_dragon)\/([\w\.]+)/i],[[a,/_/g," "],s],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i,/(uc\s?browser|qqbrowser)[\/\s]?([\w\.]+)/i],[a,s],[/(dolfin)\/([\w\.]+)/i],[[a,"Dolphin"],s],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[[a,"Chrome"],s],[/XiaoMi\/MiuiBrowser\/([\w\.]+)/i],[s,[a,"MIUI Browser"]],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i],[s,[a,"Android Browser"]],[/FBAV\/([\w\.]+);/i],[s,[a,"Facebook"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[s,[a,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[s,a],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[a,[s,c.str,l.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],[a,s],[/(navigator|netscape)\/([\w\.-]+)/i],[[a,"Netscape"],s],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]+)*/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[a,s]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[s,[a,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[a,s],[/rv\:([\w\.]+).*(gecko)/i],[s,a]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[a,s],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[a,[s,c.str,l.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[a,"Windows"],[s,c.str,l.os.windows.version]],[/\((bb)(10);/i],[[a,"BlackBerry"],s],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i,/linux;.+(sailfish);/i],[a,s],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[a,"Symbian"],s],[/\((series40);/i],[a],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[a,"Firefox OS"],s],[/(nintendo|playstation)\s([wids3portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[a,s],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[a,"Chromium OS"],s],[/(sunos)\s?([\w\.]+\d)*/i],[[a,"Solaris"],s],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],[a,s],[/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[[a,"iOS"],[s,/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i,/(macintosh|mac(?=_powerpc)\s)/i],[[a,"Mac OS"],[s,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i,/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]+)*/i],[a,s]]},m=function(e){var i=e||(window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:t);this.getBrowser=function(){return c.rgx.apply(this,d.browser)},this.getEngine=function(){return c.rgx.apply(this,d.engine)},this.getOS=function(){return c.rgx.apply(this,d.os)},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS()}},this.getUA=function(){return i},this.setUA=function(e){return i=e,this},this.setUA(i)};return m}(),r=function(){var i={access_global_ns:function(){return!!window.moxie},define_property:function(){return!1}(),create_canvas:function(){var e=document.createElement("canvas"),t=!(!e.getContext||!e.getContext("2d"));return i.create_canvas=t,t},return_response_type:function(t){try{if(-1!==e.inArray(t,["","text","document"]))return!0;if(window.XMLHttpRequest){var i=new XMLHttpRequest;if(i.open("get","/"),"responseType"in i)return i.responseType=t,i.responseType!==t?!1:!0}}catch(n){}return!1},use_blob_uri:function(){var e=window.URL;return i.use_blob_uri=e&&"createObjectURL"in e&&"revokeObjectURL"in e&&("IE"!==a.browser||a.verComp(a.version,"11.0.46",">=")),i.use_blob_uri},use_data_uri:function(){var e=new Image;return e.onload=function(){i.use_data_uri=1===e.width&&1===e.height},setTimeout(function(){e.src="data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="},1),!1}(),use_data_uri_over32kb:function(){return i.use_data_uri&&("IE"!==a.browser||a.version>=9)},use_data_uri_of:function(e){return i.use_data_uri&&33e3>e||i.use_data_uri_over32kb()},use_fileinput:function(){if(navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/))return!1;var e=document.createElement("input");return e.setAttribute("type","file"),i.use_fileinput=!e.disabled},use_webgl:function(){var e,n=document.createElement("canvas"),r=null;try{r=n.getContext("webgl")||n.getContext("experimental-webgl")}catch(o){}return r||(r=null),e=!!r,i.use_webgl=e,n=t,e}};return function(t){var n=[].slice.call(arguments);return n.shift(),"function"===e.typeOf(i[t])?i[t].apply(this,n):!!i[t]}}(),o=(new n).getResult(),a={can:r,uaParser:n,browser:o.browser.name,version:o.browser.version,os:o.os.name,osVersion:o.os.version,verComp:i,swf_url:"../flash/Moxie.swf",xap_url:"../silverlight/Moxie.xap",global_event_dispatcher:"moxie.core.EventTarget.instance.dispatchEvent"};return a.OS=a.os,a}),n("moxie/core/Exceptions",["moxie/core/utils/Basic"],function(e){function t(e,t){var i;for(i in e)if(e[i]===t)return i;return null}return{RuntimeError:function(){function i(e,i){this.code=e,this.name=t(n,e),this.message=this.name+(i||": RuntimeError "+this.code)}var n={NOT_INIT_ERR:1,EXCEPTION_ERR:3,NOT_SUPPORTED_ERR:9,JS_ERR:4};return e.extend(i,n),i.prototype=Error.prototype,i}(),OperationNotAllowedException:function(){function t(e){this.code=e,this.name="OperationNotAllowedException"}return e.extend(t,{NOT_ALLOWED_ERR:1}),t.prototype=Error.prototype,t}(),ImageError:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": ImageError "+this.code}var n={WRONG_FORMAT:1,MAX_RESOLUTION_ERR:2,INVALID_META_ERR:3};return e.extend(i,n),i.prototype=Error.prototype,i}(),FileException:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": FileException "+this.code}var n={NOT_FOUND_ERR:1,SECURITY_ERR:2,ABORT_ERR:3,NOT_READABLE_ERR:4,ENCODING_ERR:5,NO_MODIFICATION_ALLOWED_ERR:6,INVALID_STATE_ERR:7,SYNTAX_ERR:8};return e.extend(i,n),i.prototype=Error.prototype,i}(),DOMException:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": DOMException "+this.code}var n={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};return e.extend(i,n),i.prototype=Error.prototype,i}(),EventException:function(){function t(e){this.code=e,this.name="EventException"}return e.extend(t,{UNSPECIFIED_EVENT_TYPE_ERR:0}),t.prototype=Error.prototype,t}()}}),n("moxie/core/utils/Dom",["moxie/core/utils/Env"],function(e){var t=function(e){return"string"!=typeof e?e:document.getElementById(e)},i=function(e,t){if(!e.className)return!1;var i=new RegExp("(^|\\s+)"+t+"(\\s+|$)");return i.test(e.className)},n=function(e,t){i(e,t)||(e.className=e.className?e.className.replace(/\s+$/,"")+" "+t:t)},r=function(e,t){if(e.className){var i=new RegExp("(^|\\s+)"+t+"(\\s+|$)");e.className=e.className.replace(i,function(e,t,i){return" "===t&&" "===i?" ":""})}},o=function(e,t){return e.currentStyle?e.currentStyle[t]:window.getComputedStyle?window.getComputedStyle(e,null)[t]:void 0},a=function(t,i){function n(e){var t,i,n=0,r=0;return e&&(i=e.getBoundingClientRect(),t="CSS1Compat"===c.compatMode?c.documentElement:c.body,n=i.left+t.scrollLeft,r=i.top+t.scrollTop),{x:n,y:r}}var r,o,a,s=0,u=0,c=document;if(t=t,i=i||c.body,t&&t.getBoundingClientRect&&"IE"===e.browser&&(!c.documentMode||c.documentMode<8))return o=n(t),a=n(i),{x:o.x-a.x,y:o.y-a.y};for(r=t;r&&r!=i&&r.nodeType;)s+=r.offsetLeft||0,u+=r.offsetTop||0,r=r.offsetParent;for(r=t.parentNode;r&&r!=i&&r.nodeType;)s-=r.scrollLeft||0,u-=r.scrollTop||0,r=r.parentNode;return{x:s,y:u}},s=function(e){return{w:e.offsetWidth||e.clientWidth,h:e.offsetHeight||e.clientHeight}};return{get:t,hasClass:i,addClass:n,removeClass:r,getStyle:o,getPos:a,getSize:s}}),n("moxie/core/EventTarget",["moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Basic"],function(e,t,i){function n(){this.uid=i.guid()}var r={};return i.extend(n.prototype,{init:function(){this.uid||(this.uid=i.guid("uid_"))},addEventListener:function(e,t,n,o){var a,s=this;return this.hasOwnProperty("uid")||(this.uid=i.guid("uid_")),e=i.trim(e),/\s/.test(e)?(i.each(e.split(/\s+/),function(e){s.addEventListener(e,t,n,o)}),void 0):(e=e.toLowerCase(),n=parseInt(n,10)||0,a=r[this.uid]&&r[this.uid][e]||[],a.push({fn:t,priority:n,scope:o||this}),r[this.uid]||(r[this.uid]={}),r[this.uid][e]=a,void 0)},hasEventListener:function(e){var t;return e?(e=e.toLowerCase(),t=r[this.uid]&&r[this.uid][e]):t=r[this.uid],t?t:!1},removeEventListener:function(e,t){var n,o,a=this;if(e=e.toLowerCase(),/\s/.test(e))return i.each(e.split(/\s+/),function(e){a.removeEventListener(e,t)}),void 0;if(n=r[this.uid]&&r[this.uid][e]){if(t){for(o=n.length-1;o>=0;o--)if(n[o].fn===t){n.splice(o,1);break}}else n=[];n.length||(delete r[this.uid][e],i.isEmptyObj(r[this.uid])&&delete r[this.uid])}},removeAllEventListeners:function(){r[this.uid]&&delete r[this.uid]},dispatchEvent:function(e){var n,o,a,s,u,c={},l=!0;if("string"!==i.typeOf(e)){if(s=e,"string"!==i.typeOf(s.type))throw new t.EventException(t.EventException.UNSPECIFIED_EVENT_TYPE_ERR);e=s.type,s.total!==u&&s.loaded!==u&&(c.total=s.total,c.loaded=s.loaded),c.async=s.async||!1}if(-1!==e.indexOf("::")?function(t){n=t[0],e=t[1]}(e.split("::")):n=this.uid,e=e.toLowerCase(),o=r[n]&&r[n][e]){o.sort(function(e,t){return t.priority-e.priority}),a=[].slice.call(arguments),a.shift(),c.type=e,a.unshift(c);var d=[];i.each(o,function(e){a[0].target=e.scope,c.async?d.push(function(t){setTimeout(function(){t(e.fn.apply(e.scope,a)===!1)},1)}):d.push(function(t){t(e.fn.apply(e.scope,a)===!1)})}),d.length&&i.inSeries(d,function(e){l=!e})}return l},bindOnce:function(e,t,i,n){var r=this;r.bind.call(this,e,function o(){return r.unbind(e,o),t.apply(this,arguments)},i,n)},bind:function(){this.addEventListener.apply(this,arguments)},unbind:function(){this.removeEventListener.apply(this,arguments)},unbindAll:function(){this.removeAllEventListeners.apply(this,arguments)},trigger:function(){return this.dispatchEvent.apply(this,arguments)},handleEventProps:function(e){var t=this;this.bind(e.join(" "),function(e){var t="on"+e.type.toLowerCase();"function"===i.typeOf(this[t])&&this[t].apply(this,arguments)}),i.each(e,function(e){e="on"+e.toLowerCase(e),"undefined"===i.typeOf(t[e])&&(t[e]=null)})}}),n.instance=new n,n}),n("moxie/runtime/Runtime",["moxie/core/utils/Env","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/EventTarget"],function(e,t,i,n){function r(e,n,o,s,u){var c,l=this,d=t.guid(n+"_"),m=u||"browser";e=e||{},a[d]=this,o=t.extend({access_binary:!1,access_image_binary:!1,display_media:!1,do_cors:!1,drag_and_drop:!1,filter_by_extension:!0,resize_image:!1,report_upload_progress:!1,return_response_headers:!1,return_response_type:!1,return_status_code:!0,send_custom_headers:!1,select_file:!1,select_folder:!1,select_multiple:!0,send_binary_string:!1,send_browser_cookies:!0,send_multipart:!0,slice_blob:!1,stream_upload:!1,summon_file_dialog:!1,upload_filesize:!0,use_http_method:!0},o),e.preferred_caps&&(m=r.getMode(s,e.preferred_caps,m)),c=function(){var e={};return{exec:function(t,i,n,r){return c[i]&&(e[t]||(e[t]={context:this,instance:new c[i]}),e[t].instance[n])?e[t].instance[n].apply(this,r):void 0},removeInstance:function(t){delete e[t]},removeAllInstances:function(){var i=this;t.each(e,function(e,n){"function"===t.typeOf(e.instance.destroy)&&e.instance.destroy.call(e.context),i.removeInstance(n)})}}}(),t.extend(this,{initialized:!1,uid:d,type:n,mode:r.getMode(s,e.required_caps,m),shimid:d+"_container",clients:0,options:e,can:function(e,i){var n=arguments[2]||o;if("string"===t.typeOf(e)&&"undefined"===t.typeOf(i)&&(e=r.parseCaps(e)),"object"===t.typeOf(e)){for(var a in e)if(!this.can(a,e[a],n))return!1;return!0}return"function"===t.typeOf(n[e])?n[e].call(this,i):i===n[e]},getShimContainer:function(){var e,n=i.get(this.shimid);return n||(e=i.get(this.options.container)||document.body,n=document.createElement("div"),n.id=this.shimid,n.className="moxie-shim moxie-shim-"+this.type,t.extend(n.style,{position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),e.appendChild(n),e=null),n},getShim:function(){return c},shimExec:function(e,t){var i=[].slice.call(arguments,2);return l.getShim().exec.call(this,this.uid,e,t,i)},exec:function(e,t){var i=[].slice.call(arguments,2);return l[e]&&l[e][t]?l[e][t].apply(this,i):l.shimExec.apply(this,arguments)},destroy:function(){if(l){var e=i.get(this.shimid);e&&e.parentNode.removeChild(e),c&&c.removeAllInstances(),this.unbindAll(),delete a[this.uid],this.uid=null,d=l=c=e=null}}}),this.mode&&e.required_caps&&!this.can(e.required_caps)&&(this.mode=!1)}var o={},a={};return r.order="html5,flash,silverlight,html4",r.getRuntime=function(e){return a[e]?a[e]:!1},r.addConstructor=function(e,t){t.prototype=n.instance,o[e]=t},r.getConstructor=function(e){return o[e]||null},r.getInfo=function(e){var t=r.getRuntime(e);return t?{uid:t.uid,type:t.type,mode:t.mode,can:function(){return t.can.apply(t,arguments)}}:null},r.parseCaps=function(e){var i={};return"string"!==t.typeOf(e)?e||{}:(t.each(e.split(","),function(e){i[e]=!0}),i)},r.can=function(e,t){var i,n,o=r.getConstructor(e);return o?(i=new o({required_caps:t}),n=i.mode,i.destroy(),!!n):!1},r.thatCan=function(e,t){var i=(t||r.order).split(/\s*,\s*/);for(var n in i)if(r.can(i[n],e))return i[n];return null},r.getMode=function(e,i,n){var r=null;if("undefined"===t.typeOf(n)&&(n="browser"),i&&!t.isEmptyObj(e)){if(t.each(i,function(i,n){if(e.hasOwnProperty(n)){var o=e[n](i);if("string"==typeof o&&(o=[o]),r){if(!(r=t.arrayIntersect(r,o)))return r=!1}else r=o}}),r)return-1!==t.inArray(n,r)?n:r[0];if(r===!1)return!1}return n},r.getGlobalEventTarget=function(){if(/^moxie\./.test(e.global_event_dispatcher)&&!e.can("access_global_ns")){var i=t.guid("moxie_event_target_");window[i]=function(e,t){n.instance.dispatchEvent(e,t)},e.global_event_dispatcher=i}return e.global_event_dispatcher},r.capTrue=function(){return!0},r.capFalse=function(){return!1},r.capTest=function(e){return function(){return!!e}},r}),n("moxie/runtime/RuntimeClient",["moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/Runtime"],function(e,t,i,n){return function(){var e;i.extend(this,{connectRuntime:function(r){function o(i){var a,u;return i.length?(a=i.shift().toLowerCase(),(u=n.getConstructor(a))?(e=new u(r),e.bind("Init",function(){e.initialized=!0,setTimeout(function(){e.clients++,s.ruid=e.uid,s.trigger("RuntimeInit",e)},1)}),e.bind("Error",function(){e.destroy(),o(i)}),e.bind("Exception",function(e,i){var n=i.name+"(#"+i.code+")"+(i.message?", from: "+i.message:"");s.trigger("RuntimeError",new t.RuntimeError(t.RuntimeError.EXCEPTION_ERR,n))}),e.mode?(e.init(),void 0):(e.trigger("Error"),void 0)):(o(i),void 0)):(s.trigger("RuntimeError",new t.RuntimeError(t.RuntimeError.NOT_INIT_ERR)),e=null,void 0)}var a,s=this;if("string"===i.typeOf(r)?a=r:"string"===i.typeOf(r.ruid)&&(a=r.ruid),a){if(e=n.getRuntime(a))return s.ruid=a,e.clients++,e;throw new t.RuntimeError(t.RuntimeError.NOT_INIT_ERR)}o((r.runtime_order||n.order).split(/\s*,\s*/))},disconnectRuntime:function(){e&&--e.clients<=0&&e.destroy(),e=null},getRuntime:function(){return e&&e.uid?e:e=null},exec:function(){return e?e.exec.apply(this,arguments):null},can:function(t){return e?e.can(t):!1}})}}),n("moxie/file/Blob",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient"],function(e,t,i){function n(o,a){function s(t,i,o){var a,s=r[this.uid];return"string"===e.typeOf(s)&&s.length?(a=new n(null,{type:o,size:i-t}),a.detach(s.substr(t,a.size)),a):null}i.call(this),o&&this.connectRuntime(o),a?"string"===e.typeOf(a)&&(a={data:a}):a={},e.extend(this,{uid:a.uid||e.guid("uid_"),ruid:o,size:a.size||0,type:a.type||"",slice:function(e,t,i){return this.isDetached()?s.apply(this,arguments):this.getRuntime().exec.call(this,"Blob","slice",this.getSource(),e,t,i)},getSource:function(){return r[this.uid]?r[this.uid]:null},detach:function(e){if(this.ruid&&(this.getRuntime().exec.call(this,"Blob","destroy"),this.disconnectRuntime(),this.ruid=null),e=e||"","data:"==e.substr(0,5)){var i=e.indexOf(";base64,");this.type=e.substring(5,i),e=t.atob(e.substring(i+8))}this.size=e.length,r[this.uid]=e},isDetached:function(){return!this.ruid&&"string"===e.typeOf(r[this.uid])},destroy:function(){this.detach(),delete r[this.uid]}}),a.data?this.detach(a.data):r[this.uid]=a}var r={};return n}),n("moxie/core/I18n",["moxie/core/utils/Basic"],function(e){var t={};return{addI18n:function(i){return e.extend(t,i)},translate:function(e){return t[e]||e},_:function(e){return this.translate(e)},sprintf:function(t){var i=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=i.shift();return"undefined"!==e.typeOf(t)?t:""})}}}),n("moxie/core/utils/Mime",["moxie/core/utils/Basic","moxie/core/I18n"],function(e,t){var i="application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb xlt xla,application/vnd.ms-powerpoint,ppt pps pot ppa,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/x-m4a,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe",n={},r={},o=function(e){var t,i,o,a=e.split(/,/);for(t=0;t<a.length;t+=2){for(o=a[t+1].split(/ /),i=0;i<o.length;i++)n[o[i]]=a[t];r[a[t]]=o}},a=function(t,i){var n,r,o,a,s=[];for(r=0;r<t.length;r++)for(n=t[r].extensions.toLowerCase().split(/\s*,\s*/),o=0;o<n.length;o++){if("*"===n[o])return[];if(a=s[n[o]],i&&/^\w+$/.test(n[o]))s.push("."+n[o]);else if(a&&-1===e.inArray(a,s))s.push(a);else if(!a)return[]}return s},s=function(t){var i=[];return e.each(t,function(t){if(t=t.toLowerCase(),"*"===t)return i=[],!1;var n=t.match(/^(\w+)\/(\*|\w+)$/);n&&("*"===n[2]?e.each(r,function(e,t){new RegExp("^"+n[1]+"/").test(t)&&[].push.apply(i,r[t])}):r[t]&&[].push.apply(i,r[t]))}),i},u=function(i){var n=[],r=[];return"string"===e.typeOf(i)&&(i=e.trim(i).split(/\s*,\s*/)),r=s(i),n.push({title:t.translate("Files"),extensions:r.length?r.join(","):"*"}),n},c=function(e){var t=e&&e.match(/\.([^.]+)$/);return t?t[1].toLowerCase():""},l=function(e){return n[c(e)]||""};return o(i),{mimes:n,extensions:r,addMimeType:o,extList2mimes:a,mimes2exts:s,mimes2extList:u,getFileExtension:c,getFileMime:l}}),n("moxie/file/FileInput",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Mime","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/I18n","moxie/runtime/Runtime","moxie/runtime/RuntimeClient"],function(e,t,i,n,r,o,a,s,u){function c(t){var o,c,d;if(-1!==e.inArray(e.typeOf(t),["string","node"])&&(t={browse_button:t}),c=n.get(t.browse_button),!c)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR);d={accept:[{title:a.translate("All Files"),extensions:"*"}],multiple:!1,required_caps:!1,container:c.parentNode||document.body},t=e.extend({},d,t),"string"==typeof t.required_caps&&(t.required_caps=s.parseCaps(t.required_caps)),"string"==typeof t.accept&&(t.accept=i.mimes2extList(t.accept)),o=n.get(t.container),o||(o=document.body),"static"===n.getStyle(o,"position")&&(o.style.position="relative"),o=c=null,u.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,shimid:null,files:null,init:function(){var i=this;i.bind("RuntimeInit",function(r,o){i.ruid=o.uid,i.shimid=o.shimid,i.bind("Ready",function(){i.trigger("Refresh")},999),i.bind("Refresh",function(){var i,r,a,s,u;a=n.get(t.browse_button),s=n.get(o.shimid),a&&(i=n.getPos(a,n.get(t.container)),r=n.getSize(a),u=parseInt(n.getStyle(a,"z-index"),10)||0,s&&e.extend(s.style,{top:i.y+"px",left:i.x+"px",width:r.w+"px",height:r.h+"px",zIndex:u+1})),s=a=null}),o.exec.call(i,"FileInput","init",t)}),i.connectRuntime(e.extend({},t,{required_caps:{select_file:!0}}))},getOption:function(e){return t[e]},setOption:function(e,n){if(t.hasOwnProperty(e)){var o=t[e];switch(e){case"accept":"string"==typeof n&&(n=i.mimes2extList(n));break;case"container":case"required_caps":throw new r.FileException(r.FileException.NO_MODIFICATION_ALLOWED_ERR)}t[e]=n,this.exec("FileInput","setOption",e,n),this.trigger("OptionChanged",e,n,o)}},disable:function(t){var i=this.getRuntime();i&&this.exec("FileInput","disable","undefined"===e.typeOf(t)?!0:t)},refresh:function(){this.trigger("Refresh")},destroy:function(){var t=this.getRuntime();t&&(t.exec.call(this,"FileInput","destroy"),this.disconnectRuntime()),"array"===e.typeOf(this.files)&&e.each(this.files,function(e){e.destroy()}),this.files=null,this.unbindAll()}}),this.handleEventProps(l)}var l=["ready","change","cancel","mouseenter","mouseleave","mousedown","mouseup"];return c.prototype=o.instance,c}),n("moxie/file/File",["moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/file/Blob"],function(e,t,i){function n(n,r){r||(r={}),i.apply(this,arguments),this.type||(this.type=t.getFileMime(r.name));var o;if(r.name)o=r.name.replace(/\\/g,"/"),o=o.substr(o.lastIndexOf("/")+1);else if(this.type){var a=this.type.split("/")[0];o=e.guid((""!==a?a:"file")+"_"),t.extensions[this.type]&&(o+="."+t.extensions[this.type][0])}e.extend(this,{name:o||e.guid("file_"),relativePath:"",lastModifiedDate:r.lastModifiedDate||(new Date).toLocaleString()})}return n.prototype=i.prototype,n}),n("moxie/file/FileDrop",["moxie/core/I18n","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/core/utils/Env","moxie/file/File","moxie/runtime/RuntimeClient","moxie/core/EventTarget","moxie/core/utils/Mime"],function(e,t,i,n,r,o,a,s,u){function c(i){var r,o=this;"string"==typeof i&&(i={drop_zone:i}),r={accept:[{title:e.translate("All Files"),extensions:"*"}],required_caps:{drag_and_drop:!0}},i="object"==typeof i?n.extend({},r,i):r,i.container=t.get(i.drop_zone)||document.body,"static"===t.getStyle(i.container,"position")&&(i.container.style.position="relative"),"string"==typeof i.accept&&(i.accept=u.mimes2extList(i.accept)),a.call(o),n.extend(o,{uid:n.guid("uid_"),ruid:null,files:null,init:function(){o.bind("RuntimeInit",function(e,t){o.ruid=t.uid,t.exec.call(o,"FileDrop","init",i),o.dispatchEvent("ready")
  8721. }),o.connectRuntime(i)},destroy:function(){var e=this.getRuntime();e&&(e.exec.call(this,"FileDrop","destroy"),this.disconnectRuntime()),this.files=null,this.unbindAll()}}),this.handleEventProps(l)}var l=["ready","dragenter","dragleave","drop","error"];return c.prototype=s.instance,c}),n("moxie/file/FileReader",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/core/Exceptions","moxie/core/EventTarget","moxie/file/Blob","moxie/runtime/RuntimeClient"],function(e,t,i,n,r,o){function a(){function n(e,n){if(this.trigger("loadstart"),this.readyState===a.LOADING)return this.trigger("error",new i.DOMException(i.DOMException.INVALID_STATE_ERR)),this.trigger("loadend"),void 0;if(!(n instanceof r))return this.trigger("error",new i.DOMException(i.DOMException.NOT_FOUND_ERR)),this.trigger("loadend"),void 0;if(this.result=null,this.readyState=a.LOADING,n.isDetached()){var o=n.getSource();switch(e){case"readAsText":case"readAsBinaryString":this.result=o;break;case"readAsDataURL":this.result="data:"+n.type+";base64,"+t.btoa(o)}this.readyState=a.DONE,this.trigger("load"),this.trigger("loadend")}else this.connectRuntime(n.ruid),this.exec("FileReader","read",e,n)}o.call(this),e.extend(this,{uid:e.guid("uid_"),readyState:a.EMPTY,result:null,error:null,readAsBinaryString:function(e){n.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){n.call(this,"readAsDataURL",e)},readAsText:function(e){n.call(this,"readAsText",e)},abort:function(){this.result=null,-1===e.inArray(this.readyState,[a.EMPTY,a.DONE])&&(this.readyState===a.LOADING&&(this.readyState=a.DONE),this.exec("FileReader","abort"),this.trigger("abort"),this.trigger("loadend"))},destroy:function(){this.abort(),this.exec("FileReader","destroy"),this.disconnectRuntime(),this.unbindAll()}}),this.handleEventProps(s),this.bind("Error",function(e,t){this.readyState=a.DONE,this.error=t},999),this.bind("Load",function(){this.readyState=a.DONE},999)}var s=["loadstart","progress","load","abort","error","loadend"];return a.EMPTY=0,a.LOADING=1,a.DONE=2,a.prototype=n.instance,a}),n("moxie/core/utils/Url",["moxie/core/utils/Basic"],function(e){var t=function(i,n){var r,o=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],a=o.length,s={http:80,https:443},u={},c=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?(\[[\da-fA-F:]+\]|[^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,l=c.exec(i||""),d=/^\/\/\w/.test(i);switch(e.typeOf(n)){case"undefined":n=t(document.location.href,!1);break;case"string":n=t(n,!1)}for(;a--;)l[a]&&(u[o[a]]=l[a]);if(r=!d&&!u.scheme,(d||r)&&(u.scheme=n.scheme),r){u.host=n.host,u.port=n.port;var m="";/^[^\/]/.test(u.path)&&(m=n.path,m=/\/[^\/]*\.[^\/]*$/.test(m)?m.replace(/\/[^\/]+$/,"/"):m.replace(/\/?$/,"/")),u.path=m+(u.path||"")}return u.port||(u.port=s[u.scheme]||80),u.port=parseInt(u.port,10),u.path||(u.path="/"),delete u.source,u},i=function(e){var i={http:80,https:443},n="object"==typeof e?e:t(e);return n.scheme+"://"+n.host+(n.port!==i[n.scheme]?":"+n.port:"")+n.path+(n.query?n.query:"")},n=function(e){function i(e){return[e.scheme,e.host,e.port].join("/")}return"string"==typeof e&&(e=t(e)),i(t())===i(e)};return{parseUrl:t,resolveUrl:i,hasSameOrigin:n}}),n("moxie/runtime/RuntimeTarget",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(e,t,i){function n(){this.uid=e.guid("uid_"),t.call(this),this.destroy=function(){this.disconnectRuntime(),this.unbindAll()}}return n.prototype=i.instance,n}),n("moxie/file/FileReaderSync",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/utils/Encode"],function(e,t,i){return function(){function n(e,t){if(!t.isDetached()){var n=this.connectRuntime(t.ruid).exec.call(this,"FileReaderSync","read",e,t);return this.disconnectRuntime(),n}var r=t.getSource();switch(e){case"readAsBinaryString":return r;case"readAsDataURL":return"data:"+t.type+";base64,"+i.btoa(r);case"readAsText":for(var o="",a=0,s=r.length;s>a;a++)o+=String.fromCharCode(r[a]);return o}}t.call(this),e.extend(this,{uid:e.guid("uid_"),readAsBinaryString:function(e){return n.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){return n.call(this,"readAsDataURL",e)},readAsText:function(e){return n.call(this,"readAsText",e)}})}}),n("moxie/xhr/FormData",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/file/Blob"],function(e,t,i){function n(){var e,n=[];t.extend(this,{append:function(r,o){var a=this,s=t.typeOf(o);o instanceof i?e={name:r,value:o}:"array"===s?(r+="[]",t.each(o,function(e){a.append(r,e)})):"object"===s?t.each(o,function(e,t){a.append(r+"["+t+"]",e)}):"null"===s||"undefined"===s||"number"===s&&isNaN(o)?a.append(r,"false"):n.push({name:r,value:o.toString()})},hasBlob:function(){return!!this.getBlob()},getBlob:function(){return e&&e.value||null},getBlobName:function(){return e&&e.name||null},each:function(i){t.each(n,function(e){i(e.value,e.name)}),e&&i(e.value,e.name)},destroy:function(){e=null,n=[]}})}return n}),n("moxie/xhr/XMLHttpRequest",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/utils/Encode","moxie/core/utils/Url","moxie/runtime/Runtime","moxie/runtime/RuntimeTarget","moxie/file/Blob","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/core/utils/Env","moxie/core/utils/Mime"],function(e,t,i,n,r,o,a,s,u,c,l,d){function m(){this.uid=e.guid("uid_")}function h(){function i(e,t){return I.hasOwnProperty(e)?1===arguments.length?l.can("define_property")?I[e]:A[e]:(l.can("define_property")?I[e]=t:A[e]=t,void 0):void 0}function u(t){function n(){_&&(_.destroy(),_=null),s.dispatchEvent("loadend"),s=null}function r(r){_.bind("LoadStart",function(e){i("readyState",h.LOADING),s.dispatchEvent("readystatechange"),s.dispatchEvent(e),L&&s.upload.dispatchEvent(e)}),_.bind("Progress",function(e){i("readyState")!==h.LOADING&&(i("readyState",h.LOADING),s.dispatchEvent("readystatechange")),s.dispatchEvent(e)}),_.bind("UploadProgress",function(e){L&&s.upload.dispatchEvent({type:"progress",lengthComputable:!1,total:e.total,loaded:e.loaded})}),_.bind("Load",function(t){i("readyState",h.DONE),i("status",Number(r.exec.call(_,"XMLHttpRequest","getStatus")||0)),i("statusText",f[i("status")]||""),i("response",r.exec.call(_,"XMLHttpRequest","getResponse",i("responseType"))),~e.inArray(i("responseType"),["text",""])?i("responseText",i("response")):"document"===i("responseType")&&i("responseXML",i("response")),U=r.exec.call(_,"XMLHttpRequest","getAllResponseHeaders"),s.dispatchEvent("readystatechange"),i("status")>0?(L&&s.upload.dispatchEvent(t),s.dispatchEvent(t)):(F=!0,s.dispatchEvent("error")),n()}),_.bind("Abort",function(e){s.dispatchEvent(e),n()}),_.bind("Error",function(e){F=!0,i("readyState",h.DONE),s.dispatchEvent("readystatechange"),M=!0,s.dispatchEvent(e),n()}),r.exec.call(_,"XMLHttpRequest","send",{url:x,method:v,async:T,user:w,password:y,headers:S,mimeType:D,encoding:O,responseType:s.responseType,withCredentials:s.withCredentials,options:k},t)}var s=this;E=(new Date).getTime(),_=new a,"string"==typeof k.required_caps&&(k.required_caps=o.parseCaps(k.required_caps)),k.required_caps=e.extend({},k.required_caps,{return_response_type:s.responseType}),t instanceof c&&(k.required_caps.send_multipart=!0),e.isEmptyObj(S)||(k.required_caps.send_custom_headers=!0),B||(k.required_caps.do_cors=!0),k.ruid?r(_.connectRuntime(k)):(_.bind("RuntimeInit",function(e,t){r(t)}),_.bind("RuntimeError",function(e,t){s.dispatchEvent("RuntimeError",t)}),_.connectRuntime(k))}function g(){i("responseText",""),i("responseXML",null),i("response",null),i("status",0),i("statusText",""),E=b=null}var x,v,w,y,E,b,_,R,A=this,I={timeout:0,readyState:h.UNSENT,withCredentials:!1,status:0,statusText:"",responseType:"",responseXML:null,responseText:null,response:null},T=!0,S={},O=null,D=null,N=!1,C=!1,L=!1,M=!1,F=!1,B=!1,P=null,H=null,k={},U="";e.extend(this,I,{uid:e.guid("uid_"),upload:new m,open:function(o,a,s,u,c){var l;if(!o||!a)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(/[\u0100-\uffff]/.test(o)||n.utf8_encode(o)!==o)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(~e.inArray(o.toUpperCase(),["CONNECT","DELETE","GET","HEAD","OPTIONS","POST","PUT","TRACE","TRACK"])&&(v=o.toUpperCase()),~e.inArray(v,["CONNECT","TRACE","TRACK"]))throw new t.DOMException(t.DOMException.SECURITY_ERR);if(a=n.utf8_encode(a),l=r.parseUrl(a),B=r.hasSameOrigin(l),x=r.resolveUrl(a),(u||c)&&!B)throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);if(w=u||l.user,y=c||l.pass,T=s||!0,T===!1&&(i("timeout")||i("withCredentials")||""!==i("responseType")))throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);N=!T,C=!1,S={},g.call(this),i("readyState",h.OPENED),this.dispatchEvent("readystatechange")},setRequestHeader:function(r,o){var a=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];if(i("readyState")!==h.OPENED||C)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(/[\u0100-\uffff]/.test(r)||n.utf8_encode(r)!==r)throw new t.DOMException(t.DOMException.SYNTAX_ERR);return r=e.trim(r).toLowerCase(),~e.inArray(r,a)||/^(proxy\-|sec\-)/.test(r)?!1:(S[r]?S[r]+=", "+o:S[r]=o,!0)},hasRequestHeader:function(e){return e&&S[e.toLowerCase()]||!1},getAllResponseHeaders:function(){return U||""},getResponseHeader:function(t){return t=t.toLowerCase(),F||~e.inArray(t,["set-cookie","set-cookie2"])?null:U&&""!==U&&(R||(R={},e.each(U.split(/\r\n/),function(t){var i=t.split(/:\s+/);2===i.length&&(i[0]=e.trim(i[0]),R[i[0].toLowerCase()]={header:i[0],value:e.trim(i[1])})})),R.hasOwnProperty(t))?R[t].header+": "+R[t].value:null},overrideMimeType:function(n){var r,o;if(~e.inArray(i("readyState"),[h.LOADING,h.DONE]))throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(n=e.trim(n.toLowerCase()),/;/.test(n)&&(r=n.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))&&(n=r[1],r[2]&&(o=r[2])),!d.mimes[n])throw new t.DOMException(t.DOMException.SYNTAX_ERR);P=n,H=o},send:function(i,r){if(k="string"===e.typeOf(r)?{ruid:r}:r?r:{},this.readyState!==h.OPENED||C)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(i instanceof s)k.ruid=i.ruid,D=i.type||"application/octet-stream";else if(i instanceof c){if(i.hasBlob()){var o=i.getBlob();k.ruid=o.ruid,D=o.type||"application/octet-stream"}}else"string"==typeof i&&(O="UTF-8",D="text/plain;charset=UTF-8",i=n.utf8_encode(i));this.withCredentials||(this.withCredentials=k.required_caps&&k.required_caps.send_browser_cookies&&!B),L=!N&&this.upload.hasEventListener(),F=!1,M=!i,N||(C=!0),u.call(this,i)},abort:function(){if(F=!0,N=!1,~e.inArray(i("readyState"),[h.UNSENT,h.OPENED,h.DONE]))i("readyState",h.UNSENT);else{if(i("readyState",h.DONE),C=!1,!_)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);_.getRuntime().exec.call(_,"XMLHttpRequest","abort",M),M=!0}},destroy:function(){_&&("function"===e.typeOf(_.destroy)&&_.destroy(),_=null),this.unbindAll(),this.upload&&(this.upload.unbindAll(),this.upload=null)}}),this.handleEventProps(p.concat(["readystatechange"])),this.upload.handleEventProps(p)}var f={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Reserved",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",510:"Not Extended"};m.prototype=i.instance;var p=["loadstart","progress","abort","error","load","timeout","loadend"];return h.UNSENT=0,h.OPENED=1,h.HEADERS_RECEIVED=2,h.LOADING=3,h.DONE=4,h.prototype=i.instance,h}),n("moxie/runtime/Transporter",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(e,t,i,n){function r(){function n(){l=d=0,c=this.result=null}function o(t,i){var n=this;u=i,n.bind("TransportingProgress",function(t){d=t.loaded,l>d&&-1===e.inArray(n.state,[r.IDLE,r.DONE])&&a.call(n)},999),n.bind("TransportingComplete",function(){d=l,n.state=r.DONE,c=null,n.result=u.exec.call(n,"Transporter","getAsBlob",t||"")},999),n.state=r.BUSY,n.trigger("TransportingStarted"),a.call(n)}function a(){var e,i=this,n=l-d;m>n&&(m=n),e=t.btoa(c.substr(d,m)),u.exec.call(i,"Transporter","receive",e,l)}var s,u,c,l,d,m;i.call(this),e.extend(this,{uid:e.guid("uid_"),state:r.IDLE,result:null,transport:function(t,i,r){var a=this;if(r=e.extend({chunk_size:204798},r),(s=r.chunk_size%3)&&(r.chunk_size+=3-s),m=r.chunk_size,n.call(this),c=t,l=t.length,"string"===e.typeOf(r)||r.ruid)o.call(a,i,this.connectRuntime(r));else{var u=function(e,t){a.unbind("RuntimeInit",u),o.call(a,i,t)};this.bind("RuntimeInit",u),this.connectRuntime(r)}},abort:function(){var e=this;e.state=r.IDLE,u&&(u.exec.call(e,"Transporter","clear"),e.trigger("TransportingAborted")),n.call(e)},destroy:function(){this.unbindAll(),u=null,this.disconnectRuntime(),n.call(this)}})}return r.IDLE=0,r.BUSY=1,r.DONE=2,r.prototype=n.instance,r}),n("moxie/image/Image",["moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/file/FileReaderSync","moxie/xhr/XMLHttpRequest","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/runtime/Transporter","moxie/core/utils/Env","moxie/core/EventTarget","moxie/file/Blob","moxie/file/File","moxie/core/utils/Encode"],function(e,t,i,n,r,o,a,s,u,c,l,d,m){function h(){function n(e){try{return e||(e=this.exec("Image","getInfo")),this.size=e.size,this.width=e.width,this.height=e.height,this.type=e.type,this.meta=e.meta,""===this.name&&(this.name=e.name),!0}catch(t){return this.trigger("error",t.code),!1}}function c(t){var n=e.typeOf(t);try{if(t instanceof h){if(!t.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);p.apply(this,arguments)}else if(t instanceof l){if(!~e.inArray(t.type,["image/jpeg","image/png"]))throw new i.ImageError(i.ImageError.WRONG_FORMAT);g.apply(this,arguments)}else if(-1!==e.inArray(n,["blob","file"]))c.call(this,new d(null,t),arguments[1]);else if("string"===n)"data:"===t.substr(0,5)?c.call(this,new l(null,{data:t}),arguments[1]):x.apply(this,arguments);else{if("node"!==n||"img"!==t.nodeName.toLowerCase())throw new i.DOMException(i.DOMException.TYPE_MISMATCH_ERR);c.call(this,t.src,arguments[1])}}catch(r){this.trigger("error",r.code)}}function p(t,i){var n=this.connectRuntime(t.ruid);this.ruid=n.uid,n.exec.call(this,"Image","loadFromImage",t,"undefined"===e.typeOf(i)?!0:i)}function g(t,i){function n(e){r.ruid=e.uid,e.exec.call(r,"Image","loadFromBlob",t)}var r=this;r.name=t.name||"",t.isDetached()?(this.bind("RuntimeInit",function(e,t){n(t)}),i&&"string"==typeof i.required_caps&&(i.required_caps=o.parseCaps(i.required_caps)),this.connectRuntime(e.extend({required_caps:{access_image_binary:!0,resize_image:!0}},i))):n(this.connectRuntime(t.ruid))}function x(e,t){var i,n=this;i=new r,i.open("get",e),i.responseType="blob",i.onprogress=function(e){n.trigger(e)},i.onload=function(){g.call(n,i.response,!0)},i.onerror=function(e){n.trigger(e)},i.onloadend=function(){i.destroy()},i.bind("RuntimeError",function(e,t){n.trigger("RuntimeError",t)}),i.send(null,t)}a.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,name:"",size:0,width:0,height:0,type:"",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){c.apply(this,arguments)},resize:function(t){var n,r,o=this,a={x:0,y:0,width:o.width,height:o.height},s=e.extendIf({width:o.width,height:o.height,type:o.type||"image/jpeg",quality:90,crop:!1,fit:!0,preserveHeaders:!0,resample:"default",multipass:!0},t);try{if(!o.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);if(o.width>h.MAX_RESIZE_WIDTH||o.height>h.MAX_RESIZE_HEIGHT)throw new i.ImageError(i.ImageError.MAX_RESOLUTION_ERR);if(n=o.meta&&o.meta.tiff&&o.meta.tiff.Orientation||1,-1!==e.inArray(n,[5,6,7,8])){var u=s.width;s.width=s.height,s.height=u}if(s.crop){switch(r=Math.max(s.width/o.width,s.height/o.height),t.fit?(a.width=Math.min(Math.ceil(s.width/r),o.width),a.height=Math.min(Math.ceil(s.height/r),o.height),r=s.width/a.width):(a.width=Math.min(s.width,o.width),a.height=Math.min(s.height,o.height),r=1),"boolean"==typeof s.crop&&(s.crop="cc"),s.crop.toLowerCase().replace(/_/,"-")){case"rb":case"right-bottom":a.x=o.width-a.width,a.y=o.height-a.height;break;case"cb":case"center-bottom":a.x=Math.floor((o.width-a.width)/2),a.y=o.height-a.height;break;case"lb":case"left-bottom":a.x=0,a.y=o.height-a.height;break;case"lt":case"left-top":a.x=0,a.y=0;break;case"ct":case"center-top":a.x=Math.floor((o.width-a.width)/2),a.y=0;break;case"rt":case"right-top":a.x=o.width-a.width,a.y=0;break;case"rc":case"right-center":case"right-middle":a.x=o.width-a.width,a.y=Math.floor((o.height-a.height)/2);break;case"lc":case"left-center":case"left-middle":a.x=0,a.y=Math.floor((o.height-a.height)/2);break;case"cc":case"center-center":case"center-middle":default:a.x=Math.floor((o.width-a.width)/2),a.y=Math.floor((o.height-a.height)/2)}a.x=Math.max(a.x,0),a.y=Math.max(a.y,0)}else r=Math.min(s.width/o.width,s.height/o.height),r>1&&!s.fit&&(r=1);this.exec("Image","resize",a,r,s)}catch(c){o.trigger("error",c.code)}},downsize:function(t){var i,n={width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90,crop:!1,fit:!1,preserveHeaders:!0,resample:"default"};i="object"==typeof t?e.extend(n,t):e.extend(n,{width:arguments[0],height:arguments[1],crop:arguments[2],preserveHeaders:arguments[3]}),this.resize(i)},crop:function(e,t,i){this.downsize(e,t,!0,i)},getAsCanvas:function(){if(!u.can("create_canvas"))throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);return this.exec("Image","getAsCanvas")},getAsBlob:function(e,t){if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsBlob",e||"image/jpeg",t||90)},getAsDataURL:function(e,t){if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsDataURL",e||"image/jpeg",t||90)},getAsBinaryString:function(e,t){var i=this.getAsDataURL(e,t);return m.atob(i.substring(i.indexOf("base64,")+7))},embed:function(n,r){function o(t,r){var o=this;if(u.can("create_canvas")){var l=o.getAsCanvas();if(l)return n.appendChild(l),l=null,o.destroy(),c.trigger("embedded"),void 0}var d=o.getAsDataURL(t,r);if(!d)throw new i.ImageError(i.ImageError.WRONG_FORMAT);if(u.can("use_data_uri_of",d.length))n.innerHTML='<img src="'+d+'" width="'+o.width+'" height="'+o.height+'" alt="" />',o.destroy(),c.trigger("embedded");else{var h=new s;h.bind("TransportingComplete",function(){a=c.connectRuntime(this.result.ruid),c.bind("Embedded",function(){e.extend(a.getShimContainer().style,{top:"0px",left:"0px",width:o.width+"px",height:o.height+"px"}),a=null},999),a.exec.call(c,"ImageView","display",this.result.uid,width,height),o.destroy()}),h.transport(m.atob(d.substring(d.indexOf("base64,")+7)),t,{required_caps:{display_media:!0},runtime_order:"flash,silverlight",container:n})}}var a,c=this,l=e.extend({width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90,fit:!0,resample:"nearest"},r);try{if(!(n=t.get(n)))throw new i.DOMException(i.DOMException.INVALID_NODE_TYPE_ERR);if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);this.width>h.MAX_RESIZE_WIDTH||this.height>h.MAX_RESIZE_HEIGHT;var d=new h;return d.bind("Resize",function(){o.call(this,l.type,l.quality)}),d.bind("Load",function(){this.downsize(l)}),this.meta.thumb&&this.meta.thumb.width>=l.width&&this.meta.thumb.height>=l.height?d.load(this.meta.thumb.data):d.clone(this,!1),d}catch(f){this.trigger("error",f.code)}},destroy:function(){this.ruid&&(this.getRuntime().exec.call(this,"Image","destroy"),this.disconnectRuntime()),this.meta&&this.meta.thumb&&this.meta.thumb.data.destroy(),this.unbindAll()}}),this.handleEventProps(f),this.bind("Load Resize",function(){return n.call(this)},999)}var f=["progress","load","error","resize","embedded"];return h.MAX_RESIZE_WIDTH=8192,h.MAX_RESIZE_HEIGHT=8192,h.prototype=c.instance,h}),n("moxie/runtime/html5/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(e,t,i,n){function o(t){var o=this,u=i.capTest,c=i.capTrue,l=e.extend({access_binary:u(window.FileReader||window.File&&window.File.getAsDataURL),access_image_binary:function(){return o.can("access_binary")&&!!s.Image},display_media:u((n.can("create_canvas")||n.can("use_data_uri_over32kb"))&&r("moxie/image/Image")),do_cors:u(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),drag_and_drop:u(function(){var e=document.createElement("div");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&("IE"!==n.browser||n.verComp(n.version,9,">"))}()),filter_by_extension:u(function(){return!("Chrome"===n.browser&&n.verComp(n.version,28,"<")||"IE"===n.browser&&n.verComp(n.version,10,"<")||"Safari"===n.browser&&n.verComp(n.version,7,"<")||"Firefox"===n.browser&&n.verComp(n.version,37,"<"))}()),return_response_headers:c,return_response_type:function(e){return"json"===e&&window.JSON?!0:n.can("return_response_type",e)},return_status_code:c,report_upload_progress:u(window.XMLHttpRequest&&(new XMLHttpRequest).upload),resize_image:function(){return o.can("access_binary")&&n.can("create_canvas")},select_file:function(){return n.can("use_fileinput")&&window.File},select_folder:function(){return o.can("select_file")&&("Chrome"===n.browser&&n.verComp(n.version,21,">=")||"Firefox"===n.browser&&n.verComp(n.version,42,">="))},select_multiple:function(){return!(!o.can("select_file")||"Safari"===n.browser&&"Windows"===n.os||"iOS"===n.os&&n.verComp(n.osVersion,"7.0.0",">")&&n.verComp(n.osVersion,"8.0.0","<"))},send_binary_string:u(window.XMLHttpRequest&&((new XMLHttpRequest).sendAsBinary||window.Uint8Array&&window.ArrayBuffer)),send_custom_headers:u(window.XMLHttpRequest),send_multipart:function(){return!!(window.XMLHttpRequest&&(new XMLHttpRequest).upload&&window.FormData)||o.can("send_binary_string")},slice_blob:u(window.File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice)),stream_upload:function(){return o.can("slice_blob")&&o.can("send_multipart")},summon_file_dialog:function(){return o.can("select_file")&&!("Firefox"===n.browser&&n.verComp(n.version,4,"<")||"Opera"===n.browser&&n.verComp(n.version,12,"<")||"IE"===n.browser&&n.verComp(n.version,10,"<"))},upload_filesize:c,use_http_method:c},arguments[2]);i.call(this,t,arguments[1]||a,l),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(o),e=o=null}}(this.destroy)}),e.extend(this.getShim(),s)}var a="html5",s={};return i.addConstructor(a,o),s}),n("moxie/runtime/html5/file/Blob",["moxie/runtime/html5/Runtime","moxie/file/Blob"],function(e,t){function i(){function e(e,t,i){var n;if(!window.File.prototype.slice)return(n=window.File.prototype.webkitSlice||window.File.prototype.mozSlice)?n.call(e,t,i):null;try{return e.slice(),e.slice(t,i)}catch(r){return e.slice(t,i-t)}}this.slice=function(){return new t(this.getRuntime().uid,e.apply(this,arguments))},this.destroy=function(){this.getRuntime().getShim().removeInstance(this.uid)}}return e.Blob=i}),n("moxie/core/utils/Events",["moxie/core/utils/Basic"],function(e){function t(){this.returnValue=!1}function i(){this.cancelBubble=!0}var n={},r="moxie_"+e.guid(),o=function(o,a,s,u){var c,l;a=a.toLowerCase(),o.addEventListener?(c=s,o.addEventListener(a,c,!1)):o.attachEvent&&(c=function(){var e=window.event;e.target||(e.target=e.srcElement),e.preventDefault=t,e.stopPropagation=i,s(e)},o.attachEvent("on"+a,c)),o[r]||(o[r]=e.guid()),n.hasOwnProperty(o[r])||(n[o[r]]={}),l=n[o[r]],l.hasOwnProperty(a)||(l[a]=[]),l[a].push({func:c,orig:s,key:u})},a=function(t,i,o){var a,s;if(i=i.toLowerCase(),t[r]&&n[t[r]]&&n[t[r]][i]){a=n[t[r]][i];for(var u=a.length-1;u>=0&&(a[u].orig!==o&&a[u].key!==o||(t.removeEventListener?t.removeEventListener(i,a[u].func,!1):t.detachEvent&&t.detachEvent("on"+i,a[u].func),a[u].orig=null,a[u].func=null,a.splice(u,1),o===s));u--);if(a.length||delete n[t[r]][i],e.isEmptyObj(n[t[r]])){delete n[t[r]];try{delete t[r]}catch(c){t[r]=s}}}},s=function(t,i){t&&t[r]&&e.each(n[t[r]],function(e,n){a(t,n,i)})};return{addEvent:o,removeEvent:a,removeAllEvents:s}}),n("moxie/runtime/html5/file/FileInput",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,i,n,r,o,a){function s(){var e,s;i.extend(this,{init:function(u){var c,l,d,m,h,f,p=this,g=p.getRuntime();e=u,d=o.extList2mimes(e.accept,g.can("filter_by_extension")),l=g.getShimContainer(),l.innerHTML='<input id="'+g.uid+'" type="file" style="font-size:999px;opacity:0;"'+(e.multiple&&g.can("select_multiple")?"multiple":"")+(e.directory&&g.can("select_folder")?"webkitdirectory directory":"")+(d?' accept="'+d.join(",")+'"':"")+" />",c=n.get(g.uid),i.extend(c.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),m=n.get(e.browse_button),s=n.getStyle(m,"z-index")||"auto",g.can("summon_file_dialog")&&("static"===n.getStyle(m,"position")&&(m.style.position="relative"),r.addEvent(m,"click",function(e){var t=n.get(g.uid);t&&!t.disabled&&t.click(),e.preventDefault()},p.uid),p.bind("Refresh",function(){h=parseInt(s,10)||1,n.get(e.browse_button).style.zIndex=h,this.getRuntime().getShimContainer().style.zIndex=h-1})),f=g.can("summon_file_dialog")?m:l,r.addEvent(f,"mouseover",function(){p.trigger("mouseenter")},p.uid),r.addEvent(f,"mouseout",function(){p.trigger("mouseleave")},p.uid),r.addEvent(f,"mousedown",function(){p.trigger("mousedown")},p.uid),r.addEvent(n.get(e.container),"mouseup",function(){p.trigger("mouseup")},p.uid),(g.can("summon_file_dialog")?c:m).setAttribute("tabindex",-1),c.onchange=function x(){if(p.files=[],i.each(this.files,function(i){var n="";return e.directory&&"."==i.name?!0:(i.webkitRelativePath&&(n="/"+i.webkitRelativePath.replace(/^\//,"")),i=new t(g.uid,i),i.relativePath=n,p.files.push(i),void 0)}),"IE"!==a.browser&&"IEMobile"!==a.browser)this.value="";else{var n=this.cloneNode(!0);this.parentNode.replaceChild(n,this),n.onchange=x}p.files.length&&p.trigger("change")},p.trigger({type:"ready",async:!0}),l=null},setOption:function(e,t){var i=this.getRuntime(),r=n.get(i.uid);switch(e){case"accept":if(t){var a=t.mimes||o.extList2mimes(t,i.can("filter_by_extension"));r.setAttribute("accept",a.join(","))}else r.removeAttribute("accept");break;case"directory":t&&i.can("select_folder")?(r.setAttribute("directory",""),r.setAttribute("webkitdirectory","")):(r.removeAttribute("directory"),r.removeAttribute("webkitdirectory"));break;case"multiple":t&&i.can("select_multiple")?r.setAttribute("multiple",""):r.removeAttribute("multiple")}},disable:function(e){var t,i=this.getRuntime();(t=n.get(i.uid))&&(t.disabled=!!e)},destroy:function(){var t=this.getRuntime(),i=t.getShim(),o=t.getShimContainer(),a=e&&n.get(e.container),u=e&&n.get(e.browse_button);a&&r.removeAllEvents(a,this.uid),u&&(r.removeAllEvents(u,this.uid),u.style.zIndex=s),o&&(r.removeAllEvents(o,this.uid),o.innerHTML=""),i.removeInstance(this.uid),e=o=a=u=i=null}})}return e.FileInput=s}),n("moxie/runtime/html5/file/FileDrop",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime"],function(e,t,i,n,r,o){function a(){function e(e){if(!e.dataTransfer||!e.dataTransfer.types)return!1;var t=i.toArray(e.dataTransfer.types||[]);return-1!==i.inArray("Files",t)||-1!==i.inArray("public.file-url",t)||-1!==i.inArray("application/x-moz-file",t)}function a(e,i){if(u(e)){var n=new t(f,e);n.relativePath=i||"",p.push(n)}}function s(e){for(var t=[],n=0;n<e.length;n++)[].push.apply(t,e[n].extensions.split(/\s*,\s*/));return-1===i.inArray("*",t)?t:[]}function u(e){if(!g.length)return!0;var t=o.getFileExtension(e.name);return!t||-1!==i.inArray(t,g)}function c(e,t){var n=[];i.each(e,function(e){var t=e.webkitGetAsEntry();t&&(t.isFile?a(e.getAsFile(),t.fullPath):n.push(t))}),n.length?l(n,t):t()}function l(e,t){var n=[];i.each(e,function(e){n.push(function(t){d(e,t)})}),i.inSeries(n,function(){t()})}function d(e,t){e.isFile?e.file(function(i){a(i,e.fullPath),t()},function(){t()}):e.isDirectory?m(e,t):t()}function m(e,t){function i(e){r.readEntries(function(t){t.length?([].push.apply(n,t),i(e)):e()},e)}var n=[],r=e.createReader();i(function(){l(n,t)})}var h,f,p=[],g=[];i.extend(this,{init:function(t){var n,o=this;h=t,f=o.ruid,g=s(h.accept),n=h.container,r.addEvent(n,"dragover",function(t){e(t)&&(t.preventDefault(),t.dataTransfer.dropEffect="copy")},o.uid),r.addEvent(n,"drop",function(t){e(t)&&(t.preventDefault(),p=[],t.dataTransfer.items&&t.dataTransfer.items[0].webkitGetAsEntry?c(t.dataTransfer.items,function(){o.files=p,o.trigger("drop")}):(i.each(t.dataTransfer.files,function(e){a(e)}),o.files=p,o.trigger("drop")))},o.uid),r.addEvent(n,"dragenter",function(){o.trigger("dragenter")},o.uid),r.addEvent(n,"dragleave",function(){o.trigger("dragleave")},o.uid)},destroy:function(){r.removeAllEvents(h&&n.get(h.container),this.uid),f=p=g=h=null,this.getRuntime().getShim().removeInstance(this.uid)}})}return e.FileDrop=a}),n("moxie/runtime/html5/file/FileReader",["moxie/runtime/html5/Runtime","moxie/core/utils/Encode","moxie/core/utils/Basic"],function(e,t,i){function n(){function e(e){return t.atob(e.substring(e.indexOf("base64,")+7))}var n,r=!1;i.extend(this,{read:function(t,o){var a=this;a.result="",n=new window.FileReader,n.addEventListener("progress",function(e){a.trigger(e)}),n.addEventListener("load",function(t){a.result=r?e(n.result):n.result,a.trigger(t)}),n.addEventListener("error",function(e){a.trigger(e,n.error)}),n.addEventListener("loadend",function(e){n=null,a.trigger(e)}),"function"===i.typeOf(n[t])?(r=!1,n[t](o.getSource())):"readAsBinaryString"===t&&(r=!0,n.readAsDataURL(o.getSource()))},abort:function(){n&&n.abort()},destroy:function(){n=null,this.getRuntime().getShim().removeInstance(this.uid)}})}return e.FileReader=n}),n("moxie/runtime/html5/xhr/XMLHttpRequest",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/core/utils/Url","moxie/file/File","moxie/file/Blob","moxie/xhr/FormData","moxie/core/Exceptions","moxie/core/utils/Env"],function(e,t,i,n,r,o,a,s,u){function c(){function e(e,t){var i,n,r=this;i=t.getBlob().getSource(),n=new window.FileReader,n.onload=function(){t.append(t.getBlobName(),new o(null,{type:i.type,data:n.result})),f.send.call(r,e,t)},n.readAsBinaryString(i)}function c(){return!window.XMLHttpRequest||"IE"===u.browser&&u.verComp(u.version,8,"<")?function(){for(var e=["Msxml2.XMLHTTP.6.0","Microsoft.XMLHTTP"],t=0;t<e.length;t++)try{return new ActiveXObject(e[t])}catch(i){}}():new window.XMLHttpRequest}function l(e){var t=e.responseXML,i=e.responseText;return"IE"===u.browser&&i&&t&&!t.documentElement&&/[^\/]+\/[^\+]+\+xml/.test(e.getResponseHeader("Content-Type"))&&(t=new window.ActiveXObject("Microsoft.XMLDOM"),t.async=!1,t.validateOnParse=!1,t.loadXML(i)),t&&("IE"===u.browser&&0!==t.parseError||!t.documentElement||"parsererror"===t.documentElement.tagName)?null:t
  8722. }function d(e){var t="----moxieboundary"+(new Date).getTime(),i="--",n="\r\n",r="",a=this.getRuntime();if(!a.can("send_binary_string"))throw new s.RuntimeError(s.RuntimeError.NOT_SUPPORTED_ERR);return m.setRequestHeader("Content-Type","multipart/form-data; boundary="+t),e.each(function(e,a){r+=e instanceof o?i+t+n+'Content-Disposition: form-data; name="'+a+'"; filename="'+unescape(encodeURIComponent(e.name||"blob"))+'"'+n+"Content-Type: "+(e.type||"application/octet-stream")+n+n+e.getSource()+n:i+t+n+'Content-Disposition: form-data; name="'+a+'"'+n+n+unescape(encodeURIComponent(e))+n}),r+=i+t+i+n}var m,h,f=this;t.extend(this,{send:function(i,r){var s=this,l="Mozilla"===u.browser&&u.verComp(u.version,4,">=")&&u.verComp(u.version,7,"<"),f="Android Browser"===u.browser,p=!1;if(h=i.url.replace(/^.+?\/([\w\-\.]+)$/,"$1").toLowerCase(),m=c(),m.open(i.method,i.url,i.async,i.user,i.password),r instanceof o)r.isDetached()&&(p=!0),r=r.getSource();else if(r instanceof a){if(r.hasBlob())if(r.getBlob().isDetached())r=d.call(s,r),p=!0;else if((l||f)&&"blob"===t.typeOf(r.getBlob().getSource())&&window.FileReader)return e.call(s,i,r),void 0;if(r instanceof a){var g=new window.FormData;r.each(function(e,t){e instanceof o?g.append(t,e.getSource()):g.append(t,e)}),r=g}}m.upload?(i.withCredentials&&(m.withCredentials=!0),m.addEventListener("load",function(e){s.trigger(e)}),m.addEventListener("error",function(e){s.trigger(e)}),m.addEventListener("progress",function(e){s.trigger(e)}),m.upload.addEventListener("progress",function(e){s.trigger({type:"UploadProgress",loaded:e.loaded,total:e.total})})):m.onreadystatechange=function(){switch(m.readyState){case 1:break;case 2:break;case 3:var e,t;try{n.hasSameOrigin(i.url)&&(e=m.getResponseHeader("Content-Length")||0),m.responseText&&(t=m.responseText.length)}catch(r){e=t=0}s.trigger({type:"progress",lengthComputable:!!e,total:parseInt(e,10),loaded:t});break;case 4:m.onreadystatechange=function(){};try{if(m.status>=200&&m.status<400){s.trigger("load");break}}catch(r){}s.trigger("error")}},t.isEmptyObj(i.headers)||t.each(i.headers,function(e,t){m.setRequestHeader(t,e)}),""!==i.responseType&&"responseType"in m&&(m.responseType="json"!==i.responseType||u.can("return_response_type","json")?i.responseType:"text"),p?m.sendAsBinary?m.sendAsBinary(r):function(){for(var e=new Uint8Array(r.length),t=0;t<r.length;t++)e[t]=255&r.charCodeAt(t);m.send(e.buffer)}():m.send(r),s.trigger("loadstart")},getStatus:function(){try{if(m)return m.status}catch(e){}return 0},getResponse:function(e){var t=this.getRuntime();try{switch(e){case"blob":var n=new r(t.uid,m.response),o=m.getResponseHeader("Content-Disposition");if(o){var a=o.match(/filename=([\'\"'])([^\1]+)\1/);a&&(h=a[2])}return n.name=h,n.type||(n.type=i.getFileMime(h)),n;case"json":return u.can("return_response_type","json")?m.response:200===m.status&&window.JSON?JSON.parse(m.responseText):null;case"document":return l(m);default:return""!==m.responseText?m.responseText:null}}catch(s){return null}},getAllResponseHeaders:function(){try{return m.getAllResponseHeaders()}catch(e){}return""},abort:function(){m&&m.abort()},destroy:function(){f=h=null,this.getRuntime().getShim().removeInstance(this.uid)}})}return e.XMLHttpRequest=c}),n("moxie/runtime/html5/utils/BinaryReader",["moxie/core/utils/Basic"],function(e){function t(e){e instanceof ArrayBuffer?i.apply(this,arguments):n.apply(this,arguments)}function i(t){var i=new DataView(t);e.extend(this,{readByteAt:function(e){return i.getUint8(e)},writeByteAt:function(e,t){i.setUint8(e,t)},SEGMENT:function(e,n,r){switch(arguments.length){case 2:return t.slice(e,e+n);case 1:return t.slice(e);case 3:if(null===r&&(r=new ArrayBuffer),r instanceof ArrayBuffer){var o=new Uint8Array(this.length()-n+r.byteLength);e>0&&o.set(new Uint8Array(t.slice(0,e)),0),o.set(new Uint8Array(r),e),o.set(new Uint8Array(t.slice(e+n)),e+r.byteLength),this.clear(),t=o.buffer,i=new DataView(t);break}default:return t}},length:function(){return t?t.byteLength:0},clear:function(){i=t=null}})}function n(t){function i(e,i,n){n=3===arguments.length?n:t.length-i-1,t=t.substr(0,i)+e+t.substr(n+i)}e.extend(this,{readByteAt:function(e){return t.charCodeAt(e)},writeByteAt:function(e,t){i(String.fromCharCode(t),e,1)},SEGMENT:function(e,n,r){switch(arguments.length){case 1:return t.substr(e);case 2:return t.substr(e,n);case 3:i(null!==r?r:"",e,n);break;default:return t}},length:function(){return t?t.length:0},clear:function(){t=null}})}return e.extend(t.prototype,{littleEndian:!1,read:function(e,t){var i,n,r;if(e+t>this.length())throw new Error("You are trying to read outside the source boundaries.");for(n=this.littleEndian?0:-8*(t-1),r=0,i=0;t>r;r++)i|=this.readByteAt(e+r)<<Math.abs(n+8*r);return i},write:function(e,t,i){var n,r;if(e>this.length())throw new Error("You are trying to write outside the source boundaries.");for(n=this.littleEndian?0:-8*(i-1),r=0;i>r;r++)this.writeByteAt(e+r,255&t>>Math.abs(n+8*r))},BYTE:function(e){return this.read(e,1)},SHORT:function(e){return this.read(e,2)},LONG:function(e){return this.read(e,4)},SLONG:function(e){var t=this.read(e,4);return t>2147483647?t-4294967296:t},CHAR:function(e){return String.fromCharCode(this.read(e,1))},STRING:function(e,t){return this.asArray("CHAR",e,t).join("")},asArray:function(e,t,i){for(var n=[],r=0;i>r;r++)n[r]=this[e](t+r);return n}}),t}),n("moxie/runtime/html5/image/JPEGHeaders",["moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(e,t){return function i(n){var r,o,a,s=[],u=0;if(r=new e(n),65496!==r.SHORT(0))throw r.clear(),new t.ImageError(t.ImageError.WRONG_FORMAT);for(o=2;o<=r.length();)if(a=r.SHORT(o),a>=65488&&65495>=a)o+=2;else{if(65498===a||65497===a)break;u=r.SHORT(o+2)+2,a>=65505&&65519>=a&&s.push({hex:a,name:"APP"+(15&a),start:o,length:u,segment:r.SEGMENT(o,u)}),o+=u}return r.clear(),{headers:s,restore:function(t){var i,n,r;for(r=new e(t),o=65504==r.SHORT(2)?4+r.SHORT(4):2,n=0,i=s.length;i>n;n++)r.SEGMENT(o,0,s[n].segment),o+=s[n].length;return t=r.SEGMENT(),r.clear(),t},strip:function(t){var n,r,o,a;for(o=new i(t),r=o.headers,o.purge(),n=new e(t),a=r.length;a--;)n.SEGMENT(r[a].start,r[a].length,"");return t=n.SEGMENT(),n.clear(),t},get:function(e){for(var t=[],i=0,n=s.length;n>i;i++)s[i].name===e.toUpperCase()&&t.push(s[i].segment);return t},set:function(e,t){var i,n,r,o=[];for("string"==typeof t?o.push(t):o=t,i=n=0,r=s.length;r>i&&(s[i].name===e.toUpperCase()&&(s[i].segment=o[n],s[i].length=o[n].length,n++),!(n>=o.length));i++);},purge:function(){this.headers=s=[]}}}}),n("moxie/runtime/html5/image/ExifParser",["moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(e,i,n){function r(o){function a(i,r){var o,a,s,u,c,m,h,f,p=this,g=[],x={},v={1:"BYTE",7:"UNDEFINED",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",9:"SLONG",10:"SRATIONAL"},w={BYTE:1,UNDEFINED:1,ASCII:1,SHORT:2,LONG:4,RATIONAL:8,SLONG:4,SRATIONAL:8};for(o=p.SHORT(i),a=0;o>a;a++)if(g=[],h=i+2+12*a,s=r[p.SHORT(h)],s!==t){if(u=v[p.SHORT(h+=2)],c=p.LONG(h+=2),m=w[u],!m)throw new n.ImageError(n.ImageError.INVALID_META_ERR);if(h+=4,m*c>4&&(h=p.LONG(h)+d.tiffHeader),h+m*c>=this.length())throw new n.ImageError(n.ImageError.INVALID_META_ERR);"ASCII"!==u?(g=p.asArray(u,h,c),f=1==c?g[0]:g,x[s]=l.hasOwnProperty(s)&&"object"!=typeof f?l[s][f]:f):x[s]=e.trim(p.STRING(h,c).replace(/\0$/,""))}return x}function s(e,t,i){var n,r,o,a=0;if("string"==typeof t){var s=c[e.toLowerCase()];for(var u in s)if(s[u]===t){t=u;break}}n=d[e.toLowerCase()+"IFD"],r=this.SHORT(n);for(var l=0;r>l;l++)if(o=n+12*l+2,this.SHORT(o)==t){a=o+8;break}if(!a)return!1;try{this.write(a,i,4)}catch(m){return!1}return!0}var u,c,l,d,m,h;if(i.call(this,o),c={tiff:{274:"Orientation",270:"ImageDescription",271:"Make",272:"Model",305:"Software",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",37377:"ShutterSpeedValue",37378:"ApertureValue",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",41986:"ExposureMode",41987:"WhiteBalance",41990:"SceneCaptureType",41988:"DigitalZoomRatio",41992:"Contrast",41993:"Saturation",41994:"Sharpness"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude"},thumb:{513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength"}},l={ColorSpace:{1:"sRGB",0:"Uncalibrated"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{1:"Daylight",2:"Fliorescent",3:"Tungsten",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 -5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},ExposureMode:{0:"Auto exposure",1:"Manual exposure",2:"Auto bracket"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},GPSLatitudeRef:{N:"North latitude",S:"South latitude"},GPSLongitudeRef:{E:"East longitude",W:"West longitude"}},d={tiffHeader:10},m=d.tiffHeader,u={clear:this.clear},e.extend(this,{read:function(){try{return r.prototype.read.apply(this,arguments)}catch(e){throw new n.ImageError(n.ImageError.INVALID_META_ERR)}},write:function(){try{return r.prototype.write.apply(this,arguments)}catch(e){throw new n.ImageError(n.ImageError.INVALID_META_ERR)}},UNDEFINED:function(){return this.BYTE.apply(this,arguments)},RATIONAL:function(e){return this.LONG(e)/this.LONG(e+4)},SRATIONAL:function(e){return this.SLONG(e)/this.SLONG(e+4)},ASCII:function(e){return this.CHAR(e)},TIFF:function(){return h||null},EXIF:function(){var t=null;if(d.exifIFD){try{t=a.call(this,d.exifIFD,c.exif)}catch(i){return null}if(t.ExifVersion&&"array"===e.typeOf(t.ExifVersion)){for(var n=0,r="";n<t.ExifVersion.length;n++)r+=String.fromCharCode(t.ExifVersion[n]);t.ExifVersion=r}}return t},GPS:function(){var t=null;if(d.gpsIFD){try{t=a.call(this,d.gpsIFD,c.gps)}catch(i){return null}t.GPSVersionID&&"array"===e.typeOf(t.GPSVersionID)&&(t.GPSVersionID=t.GPSVersionID.join("."))}return t},thumb:function(){if(d.IFD1)try{var e=a.call(this,d.IFD1,c.thumb);if("JPEGInterchangeFormat"in e)return this.SEGMENT(d.tiffHeader+e.JPEGInterchangeFormat,e.JPEGInterchangeFormatLength)}catch(t){}return null},setExif:function(e,t){return"PixelXDimension"!==e&&"PixelYDimension"!==e?!1:s.call(this,"exif",e,t)},clear:function(){u.clear(),o=c=l=h=d=u=null}}),65505!==this.SHORT(0)||"EXIF\0"!==this.STRING(4,5).toUpperCase())throw new n.ImageError(n.ImageError.INVALID_META_ERR);if(this.littleEndian=18761==this.SHORT(m),42!==this.SHORT(m+=2))throw new n.ImageError(n.ImageError.INVALID_META_ERR);d.IFD0=d.tiffHeader+this.LONG(m+=2),h=a.call(this,d.IFD0,c.tiff),"ExifIFDPointer"in h&&(d.exifIFD=d.tiffHeader+h.ExifIFDPointer,delete h.ExifIFDPointer),"GPSInfoIFDPointer"in h&&(d.gpsIFD=d.tiffHeader+h.GPSInfoIFDPointer,delete h.GPSInfoIFDPointer),e.isEmptyObj(h)&&(h=null);var f=this.LONG(d.IFD0+12*this.SHORT(d.IFD0)+2);f&&(d.IFD1=d.tiffHeader+f)}return r.prototype=i.prototype,r}),n("moxie/runtime/html5/image/JPEG",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/html5/image/JPEGHeaders","moxie/runtime/html5/utils/BinaryReader","moxie/runtime/html5/image/ExifParser"],function(e,t,i,n,r){function o(o){function a(e){var t,i,n=0;for(e||(e=c);n<=e.length();){if(t=e.SHORT(n+=2),t>=65472&&65475>=t)return n+=5,{height:e.SHORT(n),width:e.SHORT(n+=2)};i=e.SHORT(n+=2),n+=i-2}return null}function s(){var e,t,i=d.thumb();return i&&(e=new n(i),t=a(e),e.clear(),t)?(t.data=i,t):null}function u(){d&&l&&c&&(d.clear(),l.purge(),c.clear(),m=l=d=c=null)}var c,l,d,m;if(c=new n(o),65496!==c.SHORT(0))throw new t.ImageError(t.ImageError.WRONG_FORMAT);l=new i(o);try{d=new r(l.get("app1")[0])}catch(h){}m=a.call(this),e.extend(this,{type:"image/jpeg",size:c.length(),width:m&&m.width||0,height:m&&m.height||0,setExif:function(t,i){return d?("object"===e.typeOf(t)?e.each(t,function(e,t){d.setExif(t,e)}):d.setExif(t,i),l.set("app1",d.SEGMENT()),void 0):!1},writeHeaders:function(){return arguments.length?l.restore(arguments[0]):l.restore(o)},stripHeaders:function(e){return l.strip(e)},purge:function(){u.call(this)}}),d&&(this.meta={tiff:d.TIFF(),exif:d.EXIF(),gps:d.GPS(),thumb:s()})}return o}),n("moxie/runtime/html5/image/PNG",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader"],function(e,t,i){function n(n){function r(){var e,t;return e=a.call(this,8),"IHDR"==e.type?(t=e.start,{width:s.LONG(t),height:s.LONG(t+=4)}):null}function o(){s&&(s.clear(),n=l=u=c=s=null)}function a(e){var t,i,n,r;return t=s.LONG(e),i=s.STRING(e+=4,4),n=e+=4,r=s.LONG(e+t),{length:t,type:i,start:n,CRC:r}}var s,u,c,l;s=new i(n),function(){var t=0,i=0,n=[35152,20039,3338,6666];for(i=0;i<n.length;i++,t+=2)if(n[i]!=s.SHORT(t))throw new e.ImageError(e.ImageError.WRONG_FORMAT)}(),l=r.call(this),t.extend(this,{type:"image/png",size:s.length(),width:l.width,height:l.height,purge:function(){o.call(this)}}),o.call(this)}return n}),n("moxie/runtime/html5/image/ImageInfo",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/html5/image/JPEG","moxie/runtime/html5/image/PNG"],function(e,t,i,n){return function(r){var o,a=[i,n];o=function(){for(var e=0;e<a.length;e++)try{return new a[e](r)}catch(i){}throw new t.ImageError(t.ImageError.WRONG_FORMAT)}(),e.extend(this,{type:"",size:0,width:0,height:0,setExif:function(){},writeHeaders:function(e){return e},stripHeaders:function(e){return e},purge:function(){r=null}}),e.extend(this,o),this.purge=function(){o.purge(),o=null}}}),n("moxie/runtime/html5/image/ResizerCanvas",[],function(){function e(i,n,r){var o=i.width>i.height?"width":"height",a=Math.round(i[o]*n),s=!1;"nearest"!==r&&(.5>n||n>2)&&(n=.5>n?.5:2,s=!0);var u=t(i,n);return s?e(u,a/u[o],r):u}function t(e,t){var i=e.width,n=e.height,r=Math.round(i*t),o=Math.round(n*t),a=document.createElement("canvas");return a.width=r,a.height=o,a.getContext("2d").drawImage(e,0,0,i,n,0,0,r,o),e=null,a}return{scale:e}}),n("moxie/runtime/html5/image/Image",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/utils/Encode","moxie/file/Blob","moxie/file/File","moxie/runtime/html5/image/ImageInfo","moxie/runtime/html5/image/ResizerCanvas","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,i,n,r,o,a,s,u){function c(){function e(){if(!v&&!g)throw new i.ImageError(i.DOMException.INVALID_STATE_ERR);return v||g}function c(){var t=e();return"canvas"==t.nodeName.toLowerCase()?t:(v=document.createElement("canvas"),v.width=t.width,v.height=t.height,v.getContext("2d").drawImage(t,0,0),v)}function l(e){return n.atob(e.substring(e.indexOf("base64,")+7))}function d(e,t){return"data:"+(t||"")+";base64,"+n.btoa(e)}function m(e){var t=this;g=new Image,g.onerror=function(){p.call(this),t.trigger("error",i.ImageError.WRONG_FORMAT)},g.onload=function(){t.trigger("load")},g.src="data:"==e.substr(0,5)?e:d(e,y.type)}function h(e,t){var n,r=this;return window.FileReader?(n=new FileReader,n.onload=function(){t.call(r,this.result)},n.onerror=function(){r.trigger("error",i.ImageError.WRONG_FORMAT)},n.readAsDataURL(e),void 0):t.call(this,e.getAsDataURL())}function f(e,i){var n=Math.PI/180,r=document.createElement("canvas"),o=r.getContext("2d"),a=e.width,s=e.height;switch(t.inArray(i,[5,6,7,8])>-1?(r.width=s,r.height=a):(r.width=a,r.height=s),i){case 2:o.translate(a,0),o.scale(-1,1);break;case 3:o.translate(a,s),o.rotate(180*n);break;case 4:o.translate(0,s),o.scale(1,-1);break;case 5:o.rotate(90*n),o.scale(1,-1);break;case 6:o.rotate(90*n),o.translate(0,-s);break;case 7:o.rotate(90*n),o.translate(a,-s),o.scale(-1,1);break;case 8:o.rotate(-90*n),o.translate(-a,0)}return o.drawImage(e,0,0,a,s),r}function p(){x&&(x.purge(),x=null),w=g=v=y=null,b=!1}var g,x,v,w,y,E=this,b=!1,_=!0;t.extend(this,{loadFromBlob:function(e){var t=this.getRuntime(),n=arguments.length>1?arguments[1]:!0;if(!t.can("access_binary"))throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);return y=e,e.isDetached()?(w=e.getSource(),m.call(this,w),void 0):(h.call(this,e.getSource(),function(e){n&&(w=l(e)),m.call(this,e)}),void 0)},loadFromImage:function(e,t){this.meta=e.meta,y=new o(null,{name:e.name,size:e.size,type:e.type}),m.call(this,t?w=e.getAsBinaryString():e.getAsDataURL())},getInfo:function(){var t,i=this.getRuntime();return!x&&w&&i.can("access_image_binary")&&(x=new a(w)),t={width:e().width||0,height:e().height||0,type:y.type||u.getFileMime(y.name),size:w&&w.length||y.size||0,name:y.name||"",meta:null},_&&(t.meta=x&&x.meta||this.meta||{},!t.meta||!t.meta.thumb||t.meta.thumb.data instanceof r||(t.meta.thumb.data=new r(null,{type:"image/jpeg",data:t.meta.thumb.data}))),t},resize:function(t,i,n){var r=document.createElement("canvas");if(r.width=t.width,r.height=t.height,r.getContext("2d").drawImage(e(),t.x,t.y,t.width,t.height,0,0,r.width,r.height),v=s.scale(r,i),_=n.preserveHeaders,!_){var o=this.meta&&this.meta.tiff&&this.meta.tiff.Orientation||1;v=f(v,o)}this.width=v.width,this.height=v.height,b=!0,this.trigger("Resize")},getAsCanvas:function(){return v||(v=c()),v.id=this.uid+"_canvas",v},getAsBlob:function(e,t){return e!==this.type?(b=!0,new o(null,{name:y.name||"",type:e,data:E.getAsDataURL(e,t)})):new o(null,{name:y.name||"",type:e,data:E.getAsBinaryString(e,t)})},getAsDataURL:function(e){var t=arguments[1]||90;if(!b)return g.src;if(c(),"image/jpeg"!==e)return v.toDataURL("image/png");try{return v.toDataURL("image/jpeg",t/100)}catch(i){return v.toDataURL("image/jpeg")}},getAsBinaryString:function(e,t){if(!b)return w||(w=l(E.getAsDataURL(e,t))),w;if("image/jpeg"!==e)w=l(E.getAsDataURL(e,t));else{var i;t||(t=90),c();try{i=v.toDataURL("image/jpeg",t/100)}catch(n){i=v.toDataURL("image/jpeg")}w=l(i),x&&(w=x.stripHeaders(w),_&&(x.meta&&x.meta.exif&&x.setExif({PixelXDimension:this.width,PixelYDimension:this.height}),w=x.writeHeaders(w)),x.purge(),x=null)}return b=!1,w},destroy:function(){E=null,p.call(this),this.getRuntime().getShim().removeInstance(this.uid)}})}return e.Image=c}),n("moxie/runtime/flash/Runtime",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/runtime/Runtime"],function(e,t,i,n,o){function a(){var e;try{e=navigator.plugins["Shockwave Flash"],e=e.description}catch(t){try{e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(i){e="0.0"}}return e=e.match(/\d+/g),parseFloat(e[0]+"."+e[1])}function s(e){var n=i.get(e);n&&"OBJECT"==n.nodeName&&("IE"===t.browser?(n.style.display="none",function r(){4==n.readyState?u(e):setTimeout(r,10)}()):n.parentNode.removeChild(n))}function u(e){var t=i.get(e);if(t){for(var n in t)"function"==typeof t[n]&&(t[n]=null);t.parentNode.removeChild(t)}}function c(u){var c,m=this;u=e.extend({swf_url:t.swf_url},u),o.call(this,u,l,{access_binary:function(e){return e&&"browser"===m.mode},access_image_binary:function(e){return e&&"browser"===m.mode},display_media:o.capTest(r("moxie/image/Image")),do_cors:o.capTrue,drag_and_drop:!1,report_upload_progress:function(){return"client"===m.mode},resize_image:o.capTrue,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!e.arrayDiff(t,["","text","document"])||"browser"===m.mode},return_status_code:function(t){return"browser"===m.mode||!e.arrayDiff(t,[200,404])},select_file:o.capTrue,select_multiple:o.capTrue,send_binary_string:function(e){return e&&"browser"===m.mode},send_browser_cookies:function(e){return e&&"browser"===m.mode},send_custom_headers:function(e){return e&&"browser"===m.mode},send_multipart:o.capTrue,slice_blob:function(e){return e&&"browser"===m.mode},stream_upload:function(e){return e&&"browser"===m.mode},summon_file_dialog:!1,upload_filesize:function(t){return e.parseSizeStr(t)<=2097152||"client"===m.mode},use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}},{access_binary:function(e){return e?"browser":"client"},access_image_binary:function(e){return e?"browser":"client"},report_upload_progress:function(e){return e?"browser":"client"},return_response_type:function(t){return e.arrayDiff(t,["","text","json","document"])?"browser":["client","browser"]},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"browser":["client","browser"]},send_binary_string:function(e){return e?"browser":"client"},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"browser":"client"},slice_blob:function(e){return e?"browser":"client"},stream_upload:function(e){return e?"client":"browser"},upload_filesize:function(t){return e.parseSizeStr(t)>=2097152?"client":"browser"}},"client"),a()<11.3&&(this.mode=!1),e.extend(this,{getShim:function(){return i.get(this.uid)},shimExec:function(e,t){var i=[].slice.call(arguments,2);return m.getShim().exec(this.uid,e,t,i)},init:function(){var i,r,a;a=this.getShimContainer(),e.extend(a.style,{position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),i='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+u.swf_url+'" ',"IE"===t.browser&&(i+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '),i+='width="100%" height="100%" style="outline:0"><param name="movie" value="'+u.swf_url+'" />'+'<param name="flashvars" value="uid='+escape(this.uid)+"&target="+o.getGlobalEventTarget()+'" />'+'<param name="wmode" value="transparent" />'+'<param name="allowscriptaccess" value="always" />'+"</object>","IE"===t.browser?(r=document.createElement("div"),a.appendChild(r),r.outerHTML=i,r=a=null):a.innerHTML=i,c=setTimeout(function(){m&&!m.initialized&&m.trigger("Error",new n.RuntimeError(n.RuntimeError.NOT_INIT_ERR))},5e3)},destroy:function(e){return function(){s(m.uid),e.call(m),clearTimeout(c),u=c=e=m=null}}(this.destroy)},d)}var l="flash",d={};return o.addConstructor(l,c),d}),n("moxie/runtime/flash/file/Blob",["moxie/runtime/flash/Runtime","moxie/file/Blob"],function(e,t){var i={slice:function(e,i,n,r){var o=this.getRuntime();return 0>i?i=Math.max(e.size+i,0):i>0&&(i=Math.min(i,e.size)),0>n?n=Math.max(e.size+n,0):n>0&&(n=Math.min(n,e.size)),e=o.shimExec.call(this,"Blob","slice",i,n,r||""),e&&(e=new t(o.uid,e)),e}};return e.Blob=i}),n("moxie/runtime/flash/file/FileInput",["moxie/runtime/flash/Runtime","moxie/file/File","moxie/core/utils/Dom","moxie/core/utils/Basic"],function(e,t,i,n){var r={init:function(e){var r=this,o=this.getRuntime(),a=i.get(e.browse_button);a&&(a.setAttribute("tabindex",-1),a=null),this.bind("Change",function(){var e=o.shimExec.call(r,"FileInput","getFiles");r.files=[],n.each(e,function(e){r.files.push(new t(o.uid,e))})},999),this.getRuntime().shimExec.call(this,"FileInput","init",{accept:e.accept,multiple:e.multiple}),this.trigger("ready")}};return e.FileInput=r}),n("moxie/runtime/flash/file/FileReader",["moxie/runtime/flash/Runtime","moxie/core/utils/Encode"],function(e,t){function i(e,i){switch(i){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var n={read:function(e,t){var n=this;return n.result="","readAsDataURL"===e&&(n.result="data:"+(t.type||"")+";base64,"),n.bind("Progress",function(t,r){r&&(n.result+=i(r,e))},999),n.getRuntime().shimExec.call(this,"FileReader","readAsBase64",t.uid)}};return e.FileReader=n}),n("moxie/runtime/flash/file/FileReaderSync",["moxie/runtime/flash/Runtime","moxie/core/utils/Encode"],function(e,t){function i(e,i){switch(i){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var n={read:function(e,t){var n,r=this.getRuntime();return(n=r.shimExec.call(this,"FileReaderSync","readAsBase64",t.uid))?("readAsDataURL"===e&&(n="data:"+(t.type||"")+";base64,"+n),i(n,e,t.type)):null}};return e.FileReaderSync=n}),n("moxie/runtime/flash/runtime/Transporter",["moxie/runtime/flash/Runtime","moxie/file/Blob"],function(e,t){var i={getAsBlob:function(e){var i=this.getRuntime(),n=i.shimExec.call(this,"Transporter","getAsBlob",e);return n?new t(i.uid,n):null}};return e.Transporter=i}),n("moxie/runtime/flash/xhr/XMLHttpRequest",["moxie/runtime/flash/Runtime","moxie/core/utils/Basic","moxie/file/Blob","moxie/file/File","moxie/file/FileReaderSync","moxie/runtime/flash/file/FileReaderSync","moxie/xhr/FormData","moxie/runtime/Transporter","moxie/runtime/flash/runtime/Transporter"],function(e,t,i,n,r,o,a,s){var u={send:function(e,n){function r(){e.transport=l.mode,l.shimExec.call(c,"XMLHttpRequest","send",e,n)}function o(e,t){l.shimExec.call(c,"XMLHttpRequest","appendBlob",e,t.uid),n=null,r()}function u(e,t){var i=new s;i.bind("TransportingComplete",function(){t(this.result)}),i.transport(e.getSource(),e.type,{ruid:l.uid})}var c=this,l=c.getRuntime();if(t.isEmptyObj(e.headers)||t.each(e.headers,function(e,t){l.shimExec.call(c,"XMLHttpRequest","setRequestHeader",t,e.toString())}),n instanceof a){var d;if(n.each(function(e,t){e instanceof i?d=t:l.shimExec.call(c,"XMLHttpRequest","append",t,e)}),n.hasBlob()){var m=n.getBlob();m.isDetached()?u(m,function(e){m.destroy(),o(d,e)}):o(d,m)}else n=null,r()}else n instanceof i?n.isDetached()?u(n,function(e){n.destroy(),n=e.uid,r()}):(n=n.uid,r()):r()},getResponse:function(e){var i,o,a=this.getRuntime();if(o=a.shimExec.call(this,"XMLHttpRequest","getResponseAsBlob")){if(o=new n(a.uid,o),"blob"===e)return o;try{if(i=new r,~t.inArray(e,["","text"]))return i.readAsText(o);if("json"===e&&window.JSON)return JSON.parse(i.readAsText(o))}finally{o.destroy()}}return null},abort:function(){var e=this.getRuntime();e.shimExec.call(this,"XMLHttpRequest","abort"),this.dispatchEvent("readystatechange"),this.dispatchEvent("abort")}};return e.XMLHttpRequest=u}),n("moxie/runtime/flash/image/Image",["moxie/runtime/flash/Runtime","moxie/core/utils/Basic","moxie/runtime/Transporter","moxie/file/Blob","moxie/file/FileReaderSync"],function(e,t,i,n,r){var o={loadFromBlob:function(e){function t(e){r.shimExec.call(n,"Image","loadFromBlob",e.uid),n=r=null}var n=this,r=n.getRuntime();if(e.isDetached()){var o=new i;o.bind("TransportingComplete",function(){t(o.result.getSource())}),o.transport(e.getSource(),e.type,{ruid:r.uid})}else t(e.getSource())},loadFromImage:function(e){var t=this.getRuntime();return t.shimExec.call(this,"Image","loadFromImage",e.uid)},getInfo:function(){var e=this.getRuntime(),t=e.shimExec.call(this,"Image","getInfo");return t.meta&&t.meta.thumb&&t.meta.thumb.data&&!(e.meta.thumb.data instanceof n)&&(t.meta.thumb.data=new n(e.uid,t.meta.thumb.data)),t},getAsBlob:function(e,t){var i=this.getRuntime(),r=i.shimExec.call(this,"Image","getAsBlob",e,t);return r?new n(i.uid,r):null},getAsDataURL:function(){var e,t=this.getRuntime(),i=t.Image.getAsBlob.apply(this,arguments);return i?(e=new r,e.readAsDataURL(i)):null}};return e.Image=o}),n("moxie/runtime/silverlight/Runtime",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/runtime/Runtime"],function(e,t,i,n,o){function a(e){var t,i,n,r,o,a=!1,s=null,u=0;try{try{s=new ActiveXObject("AgControl.AgControl"),s.IsVersionSupported(e)&&(a=!0),s=null}catch(c){var l=navigator.plugins["Silverlight Plug-In"];if(l){for(t=l.description,"1.0.30226.2"===t&&(t="2.0.30226.2"),i=t.split(".");i.length>3;)i.pop();for(;i.length<4;)i.push(0);for(n=e.split(".");n.length>4;)n.pop();do r=parseInt(n[u],10),o=parseInt(i[u],10),u++;while(u<n.length&&r===o);o>=r&&!isNaN(r)&&(a=!0)}}}catch(d){a=!1}return a}function s(s){var l,d=this;s=e.extend({xap_url:t.xap_url},s),o.call(this,s,u,{access_binary:o.capTrue,access_image_binary:o.capTrue,display_media:o.capTest(r("moxie/image/Image")),do_cors:o.capTrue,drag_and_drop:!1,report_upload_progress:o.capTrue,resize_image:o.capTrue,return_response_headers:function(e){return e&&"client"===d.mode},return_response_type:function(e){return"json"!==e?!0:!!window.JSON},return_status_code:function(t){return"client"===d.mode||!e.arrayDiff(t,[200,404])},select_file:o.capTrue,select_multiple:o.capTrue,send_binary_string:o.capTrue,send_browser_cookies:function(e){return e&&"browser"===d.mode},send_custom_headers:function(e){return e&&"client"===d.mode},send_multipart:o.capTrue,slice_blob:o.capTrue,stream_upload:!0,summon_file_dialog:!1,upload_filesize:o.capTrue,use_http_method:function(t){return"client"===d.mode||!e.arrayDiff(t,["GET","POST"])}},{return_response_headers:function(e){return e?"client":"browser"},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"client":["client","browser"]},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"client":"browser"},use_http_method:function(t){return e.arrayDiff(t,["GET","POST"])?"client":["client","browser"]}}),a("2.0.31005.0")&&"Opera"!==t.browser||(this.mode=!1),e.extend(this,{getShim:function(){return i.get(this.uid).content.Moxie},shimExec:function(e,t){var i=[].slice.call(arguments,2);return d.getShim().exec(this.uid,e,t,i)},init:function(){var e;e=this.getShimContainer(),e.innerHTML='<object id="'+this.uid+'" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%" style="outline:none;">'+'<param name="source" value="'+s.xap_url+'"/>'+'<param name="background" value="Transparent"/>'+'<param name="windowless" value="true"/>'+'<param name="enablehtmlaccess" value="true"/>'+'<param name="initParams" value="uid='+this.uid+",target="+o.getGlobalEventTarget()+'"/>'+"</object>",l=setTimeout(function(){d&&!d.initialized&&d.trigger("Error",new n.RuntimeError(n.RuntimeError.NOT_INIT_ERR))},"Windows"!==t.OS?1e4:5e3)},destroy:function(e){return function(){e.call(d),clearTimeout(l),s=l=e=d=null}}(this.destroy)},c)}var u="silverlight",c={};return o.addConstructor(u,s),c}),n("moxie/runtime/silverlight/file/Blob",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/Blob"],function(e,t,i){return e.Blob=t.extend({},i)}),n("moxie/runtime/silverlight/file/FileInput",["moxie/runtime/silverlight/Runtime","moxie/file/File","moxie/core/utils/Dom","moxie/core/utils/Basic"],function(e,t,i,n){function r(e){for(var t="",i=0;i<e.length;i++)t+=(""!==t?"|":"")+e[i].title+" | *."+e[i].extensions.replace(/,/g,";*.");return t}var o={init:function(e){var o=this,a=this.getRuntime(),s=i.get(e.browse_button);s&&(s.setAttribute("tabindex",-1),s=null),this.bind("Change",function(){var e=a.shimExec.call(o,"FileInput","getFiles");
  8723. o.files=[],n.each(e,function(e){o.files.push(new t(a.uid,e))})},999),a.shimExec.call(this,"FileInput","init",r(e.accept),e.multiple),this.trigger("ready")},setOption:function(e,t){"accept"==e&&(t=r(t)),this.getRuntime().shimExec.call(this,"FileInput","setOption",e,t)}};return e.FileInput=o}),n("moxie/runtime/silverlight/file/FileDrop",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Dom","moxie/core/utils/Events"],function(e,t,i){var n={init:function(){var e,n=this,r=n.getRuntime();return e=r.getShimContainer(),i.addEvent(e,"dragover",function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"},n.uid),i.addEvent(e,"dragenter",function(e){e.preventDefault();var i=t.get(r.uid).dragEnter(e);i&&e.stopPropagation()},n.uid),i.addEvent(e,"drop",function(e){e.preventDefault();var i=t.get(r.uid).dragDrop(e);i&&e.stopPropagation()},n.uid),r.shimExec.call(this,"FileDrop","init")}};return e.FileDrop=n}),n("moxie/runtime/silverlight/file/FileReader",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/FileReader"],function(e,t,i){return e.FileReader=t.extend({},i)}),n("moxie/runtime/silverlight/file/FileReaderSync",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/FileReaderSync"],function(e,t,i){return e.FileReaderSync=t.extend({},i)}),n("moxie/runtime/silverlight/runtime/Transporter",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/runtime/Transporter"],function(e,t,i){return e.Transporter=t.extend({},i)}),n("moxie/runtime/silverlight/xhr/XMLHttpRequest",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/xhr/XMLHttpRequest","moxie/runtime/silverlight/file/FileReaderSync","moxie/runtime/silverlight/runtime/Transporter"],function(e,t,i){return e.XMLHttpRequest=t.extend({},i)}),n("moxie/runtime/silverlight/image/Image",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/file/Blob","moxie/runtime/flash/image/Image"],function(e,t,i,n){return e.Image=t.extend({},n,{getInfo:function(){var e=this.getRuntime(),n=["tiff","exif","gps","thumb"],r={meta:{}},o=e.shimExec.call(this,"Image","getInfo");return o.meta&&(t.each(n,function(e){var t,i,n,a,s=o.meta[e];if(s&&s.keys)for(r.meta[e]={},i=0,n=s.keys.length;n>i;i++)t=s.keys[i],a=s[t],a&&(/^(\d|[1-9]\d+)$/.test(a)?a=parseInt(a,10):/^\d*\.\d+$/.test(a)&&(a=parseFloat(a)),r.meta[e][t]=a)}),r.meta&&r.meta.thumb&&r.meta.thumb.data&&!(e.meta.thumb.data instanceof i)&&(r.meta.thumb.data=new i(e.uid,r.meta.thumb.data))),r.width=parseInt(o.width,10),r.height=parseInt(o.height,10),r.size=parseInt(o.size,10),r.type=o.type,r.name=o.name,r},resize:function(e,t,i){this.getRuntime().shimExec.call(this,"Image","resize",e.x,e.y,e.width,e.height,t,i.preserveHeaders,i.resample)}})}),n("moxie/runtime/html4/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(e,t,i,n){function o(t){var o=this,u=i.capTest,c=i.capTrue;i.call(this,t,a,{access_binary:u(window.FileReader||window.File&&File.getAsDataURL),access_image_binary:!1,display_media:u((n.can("create_canvas")||n.can("use_data_uri_over32kb"))&&r("moxie/image/Image")),do_cors:!1,drag_and_drop:!1,filter_by_extension:u(function(){return!("Chrome"===n.browser&&n.verComp(n.version,28,"<")||"IE"===n.browser&&n.verComp(n.version,10,"<")||"Safari"===n.browser&&n.verComp(n.version,7,"<")||"Firefox"===n.browser&&n.verComp(n.version,37,"<"))}()),resize_image:function(){return s.Image&&o.can("access_binary")&&n.can("create_canvas")},report_upload_progress:!1,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!!~e.inArray(t,["text","document",""])},return_status_code:function(t){return!e.arrayDiff(t,[200,404])},select_file:function(){return n.can("use_fileinput")},select_multiple:!1,send_binary_string:!1,send_custom_headers:!1,send_multipart:!0,slice_blob:!1,stream_upload:function(){return o.can("select_file")},summon_file_dialog:function(){return o.can("select_file")&&!("Firefox"===n.browser&&n.verComp(n.version,4,"<")||"Opera"===n.browser&&n.verComp(n.version,12,"<")||"IE"===n.browser&&n.verComp(n.version,10,"<"))},upload_filesize:c,use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}}),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(o),e=o=null}}(this.destroy)}),e.extend(this.getShim(),s)}var a="html4",s={};return i.addConstructor(a,o),s}),n("moxie/runtime/html4/file/FileInput",["moxie/runtime/html4/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,i,n,r,o,a){function s(){function e(){var o,c,d,m,h,f,p=this,g=p.getRuntime();f=i.guid("uid_"),o=g.getShimContainer(),s&&(d=n.get(s+"_form"),d&&(i.extend(d.style,{top:"100%"}),d.firstChild.setAttribute("tabindex",-1))),m=document.createElement("form"),m.setAttribute("id",f+"_form"),m.setAttribute("method","post"),m.setAttribute("enctype","multipart/form-data"),m.setAttribute("encoding","multipart/form-data"),i.extend(m.style,{overflow:"hidden",position:"absolute",top:0,left:0,width:"100%",height:"100%"}),h=document.createElement("input"),h.setAttribute("id",f),h.setAttribute("type","file"),h.setAttribute("accept",l.join(",")),g.can("summon_file_dialog")&&h.setAttribute("tabindex",-1),i.extend(h.style,{fontSize:"999px",opacity:0}),m.appendChild(h),o.appendChild(m),i.extend(h.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),"IE"===a.browser&&a.verComp(a.version,10,"<")&&i.extend(h.style,{filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}),h.onchange=function(){var i;this.value&&(i=this.files?this.files[0]:{name:this.value},i=new t(g.uid,i),this.onchange=function(){},e.call(p),p.files=[i],h.setAttribute("id",i.uid),m.setAttribute("id",i.uid+"_form"),p.trigger("change"),h=m=null)},g.can("summon_file_dialog")&&(c=n.get(u.browse_button),r.removeEvent(c,"click",p.uid),r.addEvent(c,"click",function(e){h&&!h.disabled&&h.click(),e.preventDefault()},p.uid)),s=f,o=d=c=null}var s,u,c,l=[];i.extend(this,{init:function(t){var i,a=this,s=a.getRuntime();u=t,l=o.extList2mimes(t.accept,s.can("filter_by_extension")),i=s.getShimContainer(),function(){var e,o,l;e=n.get(t.browse_button),c=n.getStyle(e,"z-index")||"auto",s.can("summon_file_dialog")?("static"===n.getStyle(e,"position")&&(e.style.position="relative"),a.bind("Refresh",function(){o=parseInt(c,10)||1,n.get(u.browse_button).style.zIndex=o,this.getRuntime().getShimContainer().style.zIndex=o-1})):e.setAttribute("tabindex",-1),l=s.can("summon_file_dialog")?e:i,r.addEvent(l,"mouseover",function(){a.trigger("mouseenter")},a.uid),r.addEvent(l,"mouseout",function(){a.trigger("mouseleave")},a.uid),r.addEvent(l,"mousedown",function(){a.trigger("mousedown")},a.uid),r.addEvent(n.get(t.container),"mouseup",function(){a.trigger("mouseup")},a.uid),e=null}(),e.call(this),i=null,a.trigger({type:"ready",async:!0})},setOption:function(e,t){var i,r=this.getRuntime();"accept"==e&&(l=t.mimes||o.extList2mimes(t,r.can("filter_by_extension"))),i=n.get(s),i&&i.setAttribute("accept",l.join(","))},disable:function(e){var t;(t=n.get(s))&&(t.disabled=!!e)},destroy:function(){var e=this.getRuntime(),t=e.getShim(),i=e.getShimContainer(),o=u&&n.get(u.container),a=u&&n.get(u.browse_button);o&&r.removeAllEvents(o,this.uid),a&&(r.removeAllEvents(a,this.uid),a.style.zIndex=c),i&&(r.removeAllEvents(i,this.uid),i.innerHTML=""),t.removeInstance(this.uid),s=l=u=i=o=a=t=null}})}return e.FileInput=s}),n("moxie/runtime/html4/file/FileReader",["moxie/runtime/html4/Runtime","moxie/runtime/html5/file/FileReader"],function(e,t){return e.FileReader=t}),n("moxie/runtime/html4/xhr/XMLHttpRequest",["moxie/runtime/html4/Runtime","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Url","moxie/core/Exceptions","moxie/core/utils/Events","moxie/file/Blob","moxie/xhr/FormData"],function(e,t,i,n,r,o,a,s){function u(){function e(e){var t,n,r,a,s=this,u=!1;if(l){if(t=l.id.replace(/_iframe$/,""),n=i.get(t+"_form")){for(r=n.getElementsByTagName("input"),a=r.length;a--;)switch(r[a].getAttribute("type")){case"hidden":r[a].parentNode.removeChild(r[a]);break;case"file":u=!0}r=[],u||n.parentNode.removeChild(n),n=null}setTimeout(function(){o.removeEvent(l,"load",s.uid),l.parentNode&&l.parentNode.removeChild(l);var t=s.getRuntime().getShimContainer();t.children.length||t.parentNode.removeChild(t),t=l=null,e()},1)}}var u,c,l;t.extend(this,{send:function(d,m){function h(){var i=w.getShimContainer()||document.body,r=document.createElement("div");r.innerHTML='<iframe id="'+f+'_iframe" name="'+f+'_iframe" src="javascript:&quot;&quot;" style="display:none"></iframe>',l=r.firstChild,i.appendChild(l),o.addEvent(l,"load",function(){var i;try{i=l.contentWindow.document||l.contentDocument||window.frames[l.id].document,/^4(0[0-9]|1[0-7]|2[2346])\s/.test(i.title)?u=i.title.replace(/^(\d+).*$/,"$1"):(u=200,c=t.trim(i.body.innerHTML),v.trigger({type:"progress",loaded:c.length,total:c.length}),x&&v.trigger({type:"uploadprogress",loaded:x.size||1025,total:x.size||1025}))}catch(r){if(!n.hasSameOrigin(d.url))return e.call(v,function(){v.trigger("error")}),void 0;u=404}e.call(v,function(){v.trigger("load")})},v.uid)}var f,p,g,x,v=this,w=v.getRuntime();if(u=c=null,m instanceof s&&m.hasBlob()){if(x=m.getBlob(),f=x.uid,g=i.get(f),p=i.get(f+"_form"),!p)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR)}else f=t.guid("uid_"),p=document.createElement("form"),p.setAttribute("id",f+"_form"),p.setAttribute("method",d.method),p.setAttribute("enctype","multipart/form-data"),p.setAttribute("encoding","multipart/form-data"),w.getShimContainer().appendChild(p);p.setAttribute("target",f+"_iframe"),m instanceof s&&m.each(function(e,i){if(e instanceof a)g&&g.setAttribute("name",i);else{var n=document.createElement("input");t.extend(n,{type:"hidden",name:i,value:e}),g?p.insertBefore(n,g):p.appendChild(n)}}),p.setAttribute("action",d.url),h(),p.submit(),v.trigger("loadstart")},getStatus:function(){return u},getResponse:function(e){if("json"===e&&"string"===t.typeOf(c)&&window.JSON)try{return JSON.parse(c.replace(/^\s*<pre[^>]*>/,"").replace(/<\/pre>\s*$/,""))}catch(i){return null}return c},abort:function(){var t=this;l&&l.contentWindow&&(l.contentWindow.stop?l.contentWindow.stop():l.contentWindow.document.execCommand?l.contentWindow.document.execCommand("Stop"):l.src="about:blank"),e.call(this,function(){t.dispatchEvent("abort")})},destroy:function(){this.getRuntime().getShim().removeInstance(this.uid)}})}return e.XMLHttpRequest=u}),n("moxie/runtime/html4/image/Image",["moxie/runtime/html4/Runtime","moxie/runtime/html5/image/Image"],function(e,t){return e.Image=t}),a(["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Dom","moxie/core/EventTarget","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/file/Blob","moxie/core/I18n","moxie/core/utils/Mime","moxie/file/FileInput","moxie/file/File","moxie/file/FileDrop","moxie/file/FileReader","moxie/core/utils/Url","moxie/runtime/RuntimeTarget","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","moxie/image/Image","moxie/core/utils/Events","moxie/runtime/html5/image/ResizerCanvas"])}(this)});
  8724. define("../libs/plupload/js/moxie.min", function(){});
  8725. /**
  8726. * Plupload - multi-runtime File Uploader
  8727. * v2.3.6
  8728. *
  8729. * Copyright 2013, Moxiecode Systems AB
  8730. * Released under GPL License.
  8731. *
  8732. * License: http://www.plupload.com/license
  8733. * Contributing: http://www.plupload.com/contributing
  8734. *
  8735. * Date: 2017-11-03
  8736. */
  8737. !function(e,t){var i=function(){var e={};return t.apply(e,arguments),e.plupload};"function"==typeof define&&define.amd?define("plupload",["./moxie"],i):"object"==typeof module&&module.exports?module.exports=i(require("./moxie")):e.plupload=i(e.moxie)}(this||window,function(e){!function(e,t,i){function n(e){function t(e,t,i){var r={chunks:"slice_blob",jpgresize:"send_binary_string",pngresize:"send_binary_string",progress:"report_upload_progress",multi_selection:"select_multiple",dragdrop:"drag_and_drop",drop_element:"drag_and_drop",headers:"send_custom_headers",urlstream_upload:"send_binary_string",canSendBinary:"send_binary",triggerDialog:"summon_file_dialog"};r[e]?n[r[e]]=t:i||(n[e]=t)}var i=e.required_features,n={};return"string"==typeof i?l.each(i.split(/\s*,\s*/),function(e){t(e,!0)}):"object"==typeof i?l.each(i,function(e,i){t(i,e)}):i===!0&&(e.chunk_size&&e.chunk_size>0&&(n.slice_blob=!0),l.isEmptyObj(e.resize)&&e.multipart!==!1||(n.send_binary_string=!0),e.http_method&&(n.use_http_method=e.http_method),l.each(e,function(e,i){t(i,!!e,!0)})),n}var r=window.setTimeout,s={},a=t.core.utils,o=t.runtime.Runtime,l={VERSION:"2.3.6",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,FILE_DUPLICATE_ERROR:-602,IMAGE_FORMAT_ERROR:-700,MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,moxie:t,mimeTypes:a.Mime.mimes,ua:a.Env,typeOf:a.Basic.typeOf,extend:a.Basic.extend,guid:a.Basic.guid,getAll:function(e){var t,i=[];"array"!==l.typeOf(e)&&(e=[e]);for(var n=e.length;n--;)t=l.get(e[n]),t&&i.push(t);return i.length?i:null},get:a.Dom.get,each:a.Basic.each,getPos:a.Dom.getPos,getSize:a.Dom.getSize,xmlEncode:function(e){var t={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},i=/[<>&\"\']/g;return e?(""+e).replace(i,function(e){return t[e]?"&"+t[e]+";":e}):e},toArray:a.Basic.toArray,inArray:a.Basic.inArray,inSeries:a.Basic.inSeries,addI18n:t.core.I18n.addI18n,translate:t.core.I18n.translate,sprintf:a.Basic.sprintf,isEmptyObj:a.Basic.isEmptyObj,hasClass:a.Dom.hasClass,addClass:a.Dom.addClass,removeClass:a.Dom.removeClass,getStyle:a.Dom.getStyle,addEvent:a.Events.addEvent,removeEvent:a.Events.removeEvent,removeAllEvents:a.Events.removeAllEvents,cleanName:function(e){var t,i;for(i=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"],t=0;t<i.length;t+=2)e=e.replace(i[t],i[t+1]);return e=e.replace(/\s+/g,"_"),e=e.replace(/[^a-z0-9_\-\.]+/gi,"")},buildUrl:function(e,t){var i="";return l.each(t,function(e,t){i+=(i?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(e)}),i&&(e+=(e.indexOf("?")>0?"&":"?")+i),e},formatSize:function(e){function t(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}if(e===i||/\D/.test(e))return l.translate("N/A");var n=Math.pow(1024,4);return e>n?t(e/n,1)+" "+l.translate("tb"):e>(n/=1024)?t(e/n,1)+" "+l.translate("gb"):e>(n/=1024)?t(e/n,1)+" "+l.translate("mb"):e>1024?Math.round(e/1024)+" "+l.translate("kb"):e+" "+l.translate("b")},parseSize:a.Basic.parseSizeStr,predictRuntime:function(e,t){var i,n;return i=new l.Uploader(e),n=o.thatCan(i.getOption().required_features,t||e.runtimes),i.destroy(),n},addFileFilter:function(e,t){s[e]=t}};l.addFileFilter("mime_types",function(e,t,i){e.length&&!e.regexp.test(t.name)?(this.trigger("Error",{code:l.FILE_EXTENSION_ERROR,message:l.translate("File extension error."),file:t}),i(!1)):i(!0)}),l.addFileFilter("max_file_size",function(e,t,i){var n;e=l.parseSize(e),t.size!==n&&e&&t.size>e?(this.trigger("Error",{code:l.FILE_SIZE_ERROR,message:l.translate("File size error."),file:t}),i(!1)):i(!0)}),l.addFileFilter("prevent_duplicates",function(e,t,i){if(e)for(var n=this.files.length;n--;)if(t.name===this.files[n].name&&t.size===this.files[n].size)return this.trigger("Error",{code:l.FILE_DUPLICATE_ERROR,message:l.translate("Duplicate file error."),file:t}),i(!1),void 0;i(!0)}),l.addFileFilter("prevent_empty",function(e,t,n){e&&!t.size&&t.size!==i?(this.trigger("Error",{code:l.FILE_SIZE_ERROR,message:l.translate("File size error."),file:t}),n(!1)):n(!0)}),l.Uploader=function(e){function a(){var e,t,i=0;if(this.state==l.STARTED){for(t=0;t<D.length;t++)e||D[t].status!=l.QUEUED?i++:(e=D[t],this.trigger("BeforeUpload",e)&&(e.status=l.UPLOADING,this.trigger("UploadFile",e)));i==D.length&&(this.state!==l.STOPPED&&(this.state=l.STOPPED,this.trigger("StateChanged")),this.trigger("UploadComplete",D))}}function u(e){e.percent=e.size>0?Math.ceil(100*(e.loaded/e.size)):100,d()}function d(){var e,t,n,r=0;for(I.reset(),e=0;e<D.length;e++)t=D[e],t.size!==i?(I.size+=t.origSize,n=t.loaded*t.origSize/t.size,(!t.completeTimestamp||t.completeTimestamp>S)&&(r+=n),I.loaded+=n):I.size=i,t.status==l.DONE?I.uploaded++:t.status==l.FAILED?I.failed++:I.queued++;I.size===i?I.percent=D.length>0?Math.ceil(100*(I.uploaded/D.length)):0:(I.bytesPerSec=Math.ceil(r/((+new Date-S||1)/1e3)),I.percent=I.size>0?Math.ceil(100*(I.loaded/I.size)):0)}function c(){var e=F[0]||P[0];return e?e.getRuntime().uid:!1}function f(){this.bind("FilesAdded FilesRemoved",function(e){e.trigger("QueueChanged"),e.refresh()}),this.bind("CancelUpload",b),this.bind("BeforeUpload",m),this.bind("UploadFile",_),this.bind("UploadProgress",E),this.bind("StateChanged",v),this.bind("QueueChanged",d),this.bind("Error",R),this.bind("FileUploaded",y),this.bind("Destroy",z)}function p(e,i){var n=this,r=0,s=[],a={runtime_order:e.runtimes,required_caps:e.required_features,preferred_caps:x,swf_url:e.flash_swf_url,xap_url:e.silverlight_xap_url};l.each(e.runtimes.split(/\s*,\s*/),function(t){e[t]&&(a[t]=e[t])}),e.browse_button&&l.each(e.browse_button,function(i){s.push(function(s){var u=new t.file.FileInput(l.extend({},a,{accept:e.filters.mime_types,name:e.file_data_name,multiple:e.multi_selection,container:e.container,browse_button:i}));u.onready=function(){var e=o.getInfo(this.ruid);l.extend(n.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),multi_selection:e.can("select_multiple")}),r++,F.push(this),s()},u.onchange=function(){n.addFile(this.files)},u.bind("mouseenter mouseleave mousedown mouseup",function(t){U||(e.browse_button_hover&&("mouseenter"===t.type?l.addClass(i,e.browse_button_hover):"mouseleave"===t.type&&l.removeClass(i,e.browse_button_hover)),e.browse_button_active&&("mousedown"===t.type?l.addClass(i,e.browse_button_active):"mouseup"===t.type&&l.removeClass(i,e.browse_button_active)))}),u.bind("mousedown",function(){n.trigger("Browse")}),u.bind("error runtimeerror",function(){u=null,s()}),u.init()})}),e.drop_element&&l.each(e.drop_element,function(e){s.push(function(i){var s=new t.file.FileDrop(l.extend({},a,{drop_zone:e}));s.onready=function(){var e=o.getInfo(this.ruid);l.extend(n.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),dragdrop:e.can("drag_and_drop")}),r++,P.push(this),i()},s.ondrop=function(){n.addFile(this.files)},s.bind("error runtimeerror",function(){s=null,i()}),s.init()})}),l.inSeries(s,function(){"function"==typeof i&&i(r)})}function g(e,n,r,s){var a=new t.image.Image;try{a.onload=function(){n.width>this.width&&n.height>this.height&&n.quality===i&&n.preserve_headers&&!n.crop?(this.destroy(),s(e)):a.downsize(n.width,n.height,n.crop,n.preserve_headers)},a.onresize=function(){var t=this.getAsBlob(e.type,n.quality);this.destroy(),s(t)},a.bind("error runtimeerror",function(){this.destroy(),s(e)}),a.load(e,r)}catch(o){s(e)}}function h(e,i,r){function s(e,i,n){var r=O[e];switch(e){case"max_file_size":"max_file_size"===e&&(O.max_file_size=O.filters.max_file_size=i);break;case"chunk_size":(i=l.parseSize(i))&&(O[e]=i,O.send_file_name=!0);break;case"multipart":O[e]=i,i||(O.send_file_name=!0);break;case"http_method":O[e]="PUT"===i.toUpperCase()?"PUT":"POST";break;case"unique_names":O[e]=i,i&&(O.send_file_name=!0);break;case"filters":"array"===l.typeOf(i)&&(i={mime_types:i}),n?l.extend(O.filters,i):O.filters=i,i.mime_types&&("string"===l.typeOf(i.mime_types)&&(i.mime_types=t.core.utils.Mime.mimes2extList(i.mime_types)),i.mime_types.regexp=function(e){var t=[];return l.each(e,function(e){l.each(e.extensions.split(/,/),function(e){/^\s*\*\s*$/.test(e)?t.push("\\.*"):t.push("\\."+e.replace(new RegExp("["+"/^$.*+?|()[]{}\\".replace(/./g,"\\$&")+"]","g"),"\\$&"))})}),new RegExp("("+t.join("|")+")$","i")}(i.mime_types),O.filters.mime_types=i.mime_types);break;case"resize":O.resize=i?l.extend({preserve_headers:!0,crop:!1},i):!1;break;case"prevent_duplicates":O.prevent_duplicates=O.filters.prevent_duplicates=!!i;break;case"container":case"browse_button":case"drop_element":i="container"===e?l.get(i):l.getAll(i);case"runtimes":case"multi_selection":case"flash_swf_url":case"silverlight_xap_url":O[e]=i,n||(u=!0);break;default:O[e]=i}n||a.trigger("OptionChanged",e,i,r)}var a=this,u=!1;"object"==typeof e?l.each(e,function(e,t){s(t,e,r)}):s(e,i,r),r?(O.required_features=n(l.extend({},O)),x=n(l.extend({},O,{required_features:!0}))):u&&(a.trigger("Destroy"),p.call(a,O,function(e){e?(a.runtime=o.getInfo(c()).type,a.trigger("Init",{runtime:a.runtime}),a.trigger("PostInit")):a.trigger("Error",{code:l.INIT_ERROR,message:l.translate("Init error.")})}))}function m(e,t){if(e.settings.unique_names){var i=t.name.match(/\.([^.]+)$/),n="part";i&&(n=i[1]),t.target_name=t.id+"."+n}}function _(e,i){function n(){c-->0?r(s,1e3):(i.loaded=p,e.trigger("Error",{code:l.HTTP_ERROR,message:l.translate("HTTP Error."),file:i,response:T.responseText,status:T.status,responseHeaders:T.getAllResponseHeaders()}))}function s(){var t,n,r={};i.status===l.UPLOADING&&e.state!==l.STOPPED&&(e.settings.send_file_name&&(r.name=i.target_name||i.name),d&&f.chunks&&o.size>d?(n=Math.min(d,o.size-p),t=o.slice(p,p+n)):(n=o.size,t=o),d&&f.chunks&&(e.settings.send_chunk_number?(r.chunk=Math.ceil(p/d),r.chunks=Math.ceil(o.size/d)):(r.offset=p,r.total=o.size)),e.trigger("BeforeChunkUpload",i,r,t,p)&&a(r,t,n))}function a(a,d,g){var m;T=new t.xhr.XMLHttpRequest,T.upload&&(T.upload.onprogress=function(t){i.loaded=Math.min(i.size,p+t.loaded),e.trigger("UploadProgress",i)}),T.onload=function(){return T.status<200||T.status>=400?(n(),void 0):(c=e.settings.max_retries,g<o.size?(d.destroy(),p+=g,i.loaded=Math.min(p,o.size),e.trigger("ChunkUploaded",i,{offset:i.loaded,total:o.size,response:T.responseText,status:T.status,responseHeaders:T.getAllResponseHeaders()}),"Android Browser"===l.ua.browser&&e.trigger("UploadProgress",i)):i.loaded=i.size,d=m=null,!p||p>=o.size?(i.size!=i.origSize&&(o.destroy(),o=null),e.trigger("UploadProgress",i),i.status=l.DONE,i.completeTimestamp=+new Date,e.trigger("FileUploaded",i,{response:T.responseText,status:T.status,responseHeaders:T.getAllResponseHeaders()})):r(s,1),void 0)},T.onerror=function(){n()},T.onloadend=function(){this.destroy()},e.settings.multipart&&f.multipart?(T.open(e.settings.http_method,u,!0),l.each(e.settings.headers,function(e,t){T.setRequestHeader(t,e)}),m=new t.xhr.FormData,l.each(l.extend(a,e.settings.multipart_params),function(e,t){m.append(t,e)}),m.append(e.settings.file_data_name,d),T.send(m,h)):(u=l.buildUrl(e.settings.url,l.extend(a,e.settings.multipart_params)),T.open(e.settings.http_method,u,!0),l.each(e.settings.headers,function(e,t){T.setRequestHeader(t,e)}),T.hasRequestHeader("Content-Type")||T.setRequestHeader("Content-Type","application/octet-stream"),T.send(d,h))}var o,u=e.settings.url,d=e.settings.chunk_size,c=e.settings.max_retries,f=e.features,p=0,h={runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:x,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url};i.loaded&&(p=i.loaded=d?d*Math.floor(i.loaded/d):0),o=i.getSource(),l.isEmptyObj(e.settings.resize)||-1===l.inArray(o.type,["image/jpeg","image/png"])?s():g(o,e.settings.resize,h,function(e){o=e,i.size=e.size,s()})}function E(e,t){u(t)}function v(e){if(e.state==l.STARTED)S=+new Date;else if(e.state==l.STOPPED)for(var t=e.files.length-1;t>=0;t--)e.files[t].status==l.UPLOADING&&(e.files[t].status=l.QUEUED,d())}function b(){T&&T.abort()}function y(e){d(),r(function(){a.call(e)},1)}function R(e,t){t.code===l.INIT_ERROR?e.destroy():t.code===l.HTTP_ERROR&&(t.file.status=l.FAILED,t.file.completeTimestamp=+new Date,u(t.file),e.state==l.STARTED&&(e.trigger("CancelUpload"),r(function(){a.call(e)},1)))}function z(e){e.stop(),l.each(D,function(e){e.destroy()}),D=[],F.length&&(l.each(F,function(e){e.destroy()}),F=[]),P.length&&(l.each(P,function(e){e.destroy()}),P=[]),x={},U=!1,S=T=null,I.reset()}var O,S,I,T,w=l.guid(),D=[],x={},F=[],P=[],U=!1;O={chunk_size:0,file_data_name:"file",filters:{mime_types:[],max_file_size:0,prevent_duplicates:!1,prevent_empty:!0},flash_swf_url:"js/Moxie.swf",http_method:"POST",max_retries:0,multipart:!0,multi_selection:!0,resize:!1,runtimes:o.order,send_file_name:!0,send_chunk_number:!0,silverlight_xap_url:"js/Moxie.xap"},h.call(this,e,null,!0),I=new l.QueueProgress,l.extend(this,{id:w,uid:w,state:l.STOPPED,features:{},runtime:null,files:D,settings:O,total:I,init:function(){var e,t,i=this;return e=i.getOption("preinit"),"function"==typeof e?e(i):l.each(e,function(e,t){i.bind(t,e)}),f.call(i),l.each(["container","browse_button","drop_element"],function(e){return null===i.getOption(e)?(t={code:l.INIT_ERROR,message:l.sprintf(l.translate("%s specified, but cannot be found."),e)},!1):void 0}),t?i.trigger("Error",t):O.browse_button||O.drop_element?(p.call(i,O,function(e){var t=i.getOption("init");"function"==typeof t?t(i):l.each(t,function(e,t){i.bind(t,e)}),e?(i.runtime=o.getInfo(c()).type,i.trigger("Init",{runtime:i.runtime}),i.trigger("PostInit")):i.trigger("Error",{code:l.INIT_ERROR,message:l.translate("Init error.")})}),void 0):i.trigger("Error",{code:l.INIT_ERROR,message:l.translate("You must specify either browse_button or drop_element.")})},setOption:function(e,t){h.call(this,e,t,!this.runtime)},getOption:function(e){return e?O[e]:O},refresh:function(){F.length&&l.each(F,function(e){e.trigger("Refresh")}),this.trigger("Refresh")},start:function(){this.state!=l.STARTED&&(this.state=l.STARTED,this.trigger("StateChanged"),a.call(this))},stop:function(){this.state!=l.STOPPED&&(this.state=l.STOPPED,this.trigger("StateChanged"),this.trigger("CancelUpload"))},disableBrowse:function(){U=arguments[0]!==i?arguments[0]:!0,F.length&&l.each(F,function(e){e.disable(U)}),this.trigger("DisableBrowse",U)},getFile:function(e){var t;for(t=D.length-1;t>=0;t--)if(D[t].id===e)return D[t]},addFile:function(e,i){function n(e,t){var i=[];l.each(u.settings.filters,function(t,n){s[n]&&i.push(function(i){s[n].call(u,t,e,function(e){i(!e)})})}),l.inSeries(i,t)}function a(e){var s=l.typeOf(e);if(e instanceof t.file.File){if(!e.ruid&&!e.isDetached()){if(!o)return!1;e.ruid=o,e.connectRuntime(o)}a(new l.File(e))}else e instanceof t.file.Blob?(a(e.getSource()),e.destroy()):e instanceof l.File?(i&&(e.name=i),d.push(function(t){n(e,function(i){i||(D.push(e),f.push(e),u.trigger("FileFiltered",e)),r(t,1)})})):-1!==l.inArray(s,["file","blob"])?a(new t.file.File(null,e)):"node"===s&&"filelist"===l.typeOf(e.files)?l.each(e.files,a):"array"===s&&(i=null,l.each(e,a))}var o,u=this,d=[],f=[];o=c(),a(e),d.length&&l.inSeries(d,function(){f.length&&u.trigger("FilesAdded",f)})},removeFile:function(e){for(var t="string"==typeof e?e:e.id,i=D.length-1;i>=0;i--)if(D[i].id===t)return this.splice(i,1)[0]},splice:function(e,t){var n=D.splice(e===i?0:e,t===i?D.length:t),r=!1;return this.state==l.STARTED&&(l.each(n,function(e){return e.status===l.UPLOADING?(r=!0,!1):void 0}),r&&this.stop()),this.trigger("FilesRemoved",n),l.each(n,function(e){e.destroy()}),r&&this.start(),n},dispatchEvent:function(e){var t,i;if(e=e.toLowerCase(),t=this.hasEventListener(e)){t.sort(function(e,t){return t.priority-e.priority}),i=[].slice.call(arguments),i.shift(),i.unshift(this);for(var n=0;n<t.length;n++)if(t[n].fn.apply(t[n].scope,i)===!1)return!1}return!0},bind:function(e,t,i,n){l.Uploader.prototype.bind.call(this,e,t,n,i)},destroy:function(){this.trigger("Destroy"),O=I=null,this.unbindAll()}})},l.Uploader.prototype=t.core.EventTarget.instance,l.File=function(){function e(e){l.extend(this,{id:l.guid(),name:e.name||e.fileName,type:e.type||"",relativePath:e.relativePath||"",size:e.fileSize||e.size,origSize:e.fileSize||e.size,loaded:0,percent:0,status:l.QUEUED,lastModifiedDate:e.lastModifiedDate||(new Date).toLocaleString(),completeTimestamp:0,getNative:function(){var e=this.getSource().getSource();return-1!==l.inArray(l.typeOf(e),["blob","file"])?e:null},getSource:function(){return t[this.id]?t[this.id]:null},destroy:function(){var e=this.getSource();e&&(e.destroy(),delete t[this.id])}}),t[this.id]=e}var t={};return e}(),l.QueueProgress=function(){var e=this;e.size=0,e.loaded=0,e.uploaded=0,e.failed=0,e.queued=0,e.percent=0,e.bytesPerSec=0,e.reset=function(){e.size=e.loaded=e.uploaded=e.failed=e.queued=e.percent=e.bytesPerSec=0}},e.plupload=l}(this,e)});
  8738. define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, undefined, Plupload, Template) {
  8739. var Upload = {
  8740. list: {},
  8741. config: {
  8742. container: document.body,
  8743. classname: '.plupload:not([initialized])',
  8744. previewtpl: '<li class="col-xs-3"><a href="<%=fullurl%>" data-url="<%=url%>" target="_blank" class="thumbnail"><img src="<%=fullurl%>" class="img-responsive"></a><a href="javascript:;" class="btn btn-danger btn-xs btn-trash"><i class="fa fa-trash"></i></a></li>',
  8745. },
  8746. events: {
  8747. //初始化完成
  8748. onPostInit: function (up) {
  8749. },
  8750. //文件添加成功后
  8751. onFileAdded: function (up, files) {
  8752. var button = up.settings.button;
  8753. $(button).data("bakup-html", $(button).html());
  8754. var maxcount = $(button).data("maxcount");
  8755. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  8756. maxcount = typeof maxcount !== "undefined" ? maxcount : 0;
  8757. if (maxcount > 0 && input_id) {
  8758. var inputObj = $("#" + input_id);
  8759. if (inputObj.size() > 0) {
  8760. var value = $.trim(inputObj.val());
  8761. var nums = value === '' ? 0 : value.split(/\,/).length;
  8762. var remains = maxcount - nums;
  8763. if (files.length > remains) {
  8764. for (var i = 0; i < files.length; i++) {
  8765. up.removeFile(files[i]);
  8766. }
  8767. Toastr.error(__('You can upload up to %d file%s', remains));
  8768. return false;
  8769. }
  8770. }
  8771. }
  8772. //添加后立即上传
  8773. setTimeout(function () {
  8774. up.start();
  8775. }, 1);
  8776. },
  8777. onBeforeUpload: function (up, file) {
  8778. console.log("before", up.settings);
  8779. },
  8780. //上传成功的回调
  8781. onUploadSuccess: function (ret, onUploadSuccess, button) {
  8782. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  8783. //上传成功后回调
  8784. if (button) {
  8785. //如果有文本框则填充
  8786. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  8787. if (input_id) {
  8788. var urlArr = [];
  8789. var inputObj = $("#" + input_id);
  8790. if ($(button).data("multiple") && inputObj.val() !== "") {
  8791. urlArr.push(inputObj.val());
  8792. }
  8793. urlArr.push(data.url);
  8794. inputObj.val(urlArr.join(",")).trigger("change");
  8795. }
  8796. //如果有回调函数
  8797. var onDomUploadSuccess = $(button).data("upload-success");
  8798. if (onDomUploadSuccess) {
  8799. if (typeof onDomUploadSuccess !== 'function' && typeof Upload.api.custom[onDomUploadSuccess] === 'function') {
  8800. onDomUploadSuccess = Upload.api.custom[onDomUploadSuccess];
  8801. }
  8802. if (typeof onDomUploadSuccess === 'function') {
  8803. var result = onDomUploadSuccess.call(button, data, ret);
  8804. if (result === false)
  8805. return;
  8806. }
  8807. }
  8808. }
  8809. if (typeof onUploadSuccess === 'function') {
  8810. var result = onUploadSuccess.call(button, data, ret);
  8811. if (result === false)
  8812. return;
  8813. }
  8814. },
  8815. //上传错误的回调
  8816. onUploadError: function (ret, onUploadError, button) {
  8817. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  8818. if (button) {
  8819. var onDomUploadError = $(button).data("upload-error");
  8820. if (onDomUploadError) {
  8821. if (typeof onDomUploadError !== 'function' && typeof Upload.api.custom[onDomUploadError] === 'function') {
  8822. onDomUploadError = Upload.api.custom[onDomUploadError];
  8823. }
  8824. if (typeof onDomUploadError === 'function') {
  8825. var result = onDomUploadError.call(button, data, ret);
  8826. if (result === false)
  8827. return;
  8828. }
  8829. }
  8830. }
  8831. if (typeof onUploadError === 'function') {
  8832. var result = onUploadError.call(button, data, ret);
  8833. if (result === false) {
  8834. return;
  8835. }
  8836. }
  8837. Toastr.error(ret.msg + "(code:" + ret.code + ")");
  8838. },
  8839. //服务器响应数据后
  8840. onUploadResponse: function (response) {
  8841. try {
  8842. var ret = typeof response === 'object' ? response : JSON.parse(response);
  8843. if (!ret.hasOwnProperty('code')) {
  8844. $.extend(ret, {code: -2, msg: response, data: null});
  8845. }
  8846. } catch (e) {
  8847. var ret = {code: -1, msg: e.message, data: null};
  8848. }
  8849. return ret;
  8850. }
  8851. },
  8852. api: {
  8853. //Plupload上传
  8854. plupload: function (element, onUploadSuccess, onUploadError) {
  8855. element = typeof element === 'undefined' ? Upload.config.classname : element;
  8856. $(element, Upload.config.container).each(function () {
  8857. if ($(this).attr("initialized")) {
  8858. return true;
  8859. }
  8860. $(this).attr("initialized", true);
  8861. var that = this;
  8862. var id = $(this).prop("id");
  8863. var url = $(this).data("url");
  8864. var maxsize = $(this).data("maxsize");
  8865. var mimetype = $(this).data("mimetype");
  8866. var multipart = $(this).data("multipart");
  8867. var multiple = $(this).data("multiple");
  8868. //填充ID
  8869. var input_id = $(that).data("input-id") ? $(that).data("input-id") : "";
  8870. //预览ID
  8871. var preview_id = $(that).data("preview-id") ? $(that).data("preview-id") : "";
  8872. //上传URL
  8873. url = url ? url : Config.upload.uploadurl;
  8874. url = Fast.api.fixurl(url);
  8875. //最大可上传文件大小
  8876. maxsize = typeof maxsize !== "undefined" ? maxsize : Config.upload.maxsize;
  8877. //文件类型
  8878. mimetype = typeof mimetype !== "undefined" ? mimetype : Config.upload.mimetype;
  8879. //请求的表单参数
  8880. multipart = typeof multipart !== "undefined" ? multipart : Config.upload.multipart;
  8881. //是否支持批量上传
  8882. multiple = typeof multiple !== "undefined" ? multiple : Config.upload.multiple;
  8883. var mimetypeArr = new Array();
  8884. //支持后缀和Mimetype格式,以,分隔
  8885. if (mimetype && mimetype !== "*" && mimetype.indexOf("/") === -1)
  8886. {
  8887. var tempArr = mimetype.split(',');
  8888. for (var i = 0; i < tempArr.length; i++)
  8889. {
  8890. mimetypeArr.push({title: __('Files'), extensions: tempArr[i]});
  8891. }
  8892. mimetype = mimetypeArr;
  8893. }
  8894. //生成Plupload实例
  8895. Upload.list[id] = new Plupload.Uploader({
  8896. runtimes: 'html5,flash,silverlight,html4',
  8897. multi_selection: multiple, //是否允许多选批量上传
  8898. browse_button: id, // 浏览按钮的ID
  8899. container: $(this).parent().get(0), //取按钮的上级元素
  8900. flash_swf_url: '/assets/libs/plupload/js/Moxie.swf',
  8901. silverlight_xap_url: '/assets/libs/plupload/js/Moxie.xap',
  8902. filters: {
  8903. max_file_size: maxsize,
  8904. mime_types: mimetype,
  8905. },
  8906. url: url,
  8907. multipart_params: $.isArray(multipart) ? {} : multipart,
  8908. init: {
  8909. PostInit: Upload.events.onPostInit,
  8910. FilesAdded: Upload.events.onFileAdded,
  8911. BeforeUpload: Upload.events.onBeforeUpload,
  8912. UploadProgress: function (up, file) {
  8913. var button = up.settings.button;
  8914. //这里可以改成其它的表现形式
  8915. //document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
  8916. $(button).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + file.percent + "%");
  8917. },
  8918. FileUploaded: function (up, file, info) {
  8919. var button = up.settings.button;
  8920. //还原按钮文字及状态
  8921. $(button).prop("disabled", false).html($(button).data("bakup-html"));
  8922. var ret = Upload.events.onUploadResponse(info.response, info, up, file);
  8923. if (ret.code === 1) {
  8924. Upload.events.onUploadSuccess(ret, onUploadSuccess, button, up, file);
  8925. } else {
  8926. Upload.events.onUploadError(ret, onUploadError, button, up, file);
  8927. }
  8928. },
  8929. Error: function (up, err) {
  8930. var button = up.settings.button;
  8931. $(button).prop("disabled", false).html($(button).data("bakup-html"));
  8932. var ret = {code: err.code, msg: err.message, data: null};
  8933. Upload.events.onUploadError(ret, onUploadError, button, up, null);
  8934. }
  8935. },
  8936. onUploadSuccess: onUploadSuccess,
  8937. onUploadError: onUploadError,
  8938. button: that
  8939. });
  8940. //拖动排序
  8941. if (preview_id && multiple) {
  8942. require(['dragsort'], function () {
  8943. $("#" + preview_id).dragsort({
  8944. dragSelector: "li",
  8945. dragEnd: function () {
  8946. $("#" + preview_id).trigger("fa.preview.change");
  8947. },
  8948. placeHolderTemplate: '<li class="col-xs-3"></li>'
  8949. });
  8950. });
  8951. }
  8952. if (preview_id && input_id) {
  8953. $(document.body).on("keyup change", "#" + input_id, function () {
  8954. var inputStr = $("#" + input_id).val();
  8955. var inputArr = inputStr.split(/\,/);
  8956. $("#" + preview_id).empty();
  8957. var tpl = $("#" + preview_id).data("template") ? $("#" + preview_id).data("template") : "";
  8958. $.each(inputArr, function (i, j) {
  8959. if (!j) {
  8960. return true;
  8961. }
  8962. var data = {url: j, fullurl: Fast.api.cdnurl(j), data: $(that).data()};
  8963. var html = tpl ? Template(tpl, data) : Template.render(Upload.config.previewtpl, data);
  8964. $("#" + preview_id).append(html);
  8965. });
  8966. });
  8967. $("#" + input_id).trigger("change");
  8968. }
  8969. if (preview_id) {
  8970. // 监听事件
  8971. $(document.body).on("fa.preview.change", "#" + preview_id, function () {
  8972. var urlArr = new Array();
  8973. $("#" + preview_id + " [data-url]").each(function (i, j) {
  8974. urlArr.push($(this).data("url"));
  8975. });
  8976. if (input_id) {
  8977. $("#" + input_id).val(urlArr.join(","));
  8978. }
  8979. });
  8980. // 移除按钮事件
  8981. $(document.body).on("click", "#" + preview_id + " .btn-trash", function () {
  8982. $(this).closest("li").remove();
  8983. $("#" + preview_id).trigger("fa.preview.change");
  8984. });
  8985. }
  8986. Upload.list[id].init();
  8987. });
  8988. },
  8989. // AJAX异步上传
  8990. send: function (file, onUploadSuccess, onUploadError) {
  8991. var data = new FormData();
  8992. data.append("file", file);
  8993. $.each(Config.upload.multipart, function (k, v) {
  8994. data.append(k, v);
  8995. });
  8996. $.ajax({
  8997. url: Config.upload.uploadurl,
  8998. data: data,
  8999. cache: false,
  9000. contentType: false,
  9001. processData: false,
  9002. type: 'POST',
  9003. success: function (ret) {
  9004. ret = Upload.events.onUploadResponse(ret);
  9005. if (ret.code === 1) {
  9006. Upload.events.onUploadSuccess(ret, onUploadSuccess);
  9007. } else {
  9008. Upload.events.onUploadError(ret, onUploadError);
  9009. }
  9010. }, error: function (e) {
  9011. var ret = {code: 500, msg: e.message, data: null};
  9012. Upload.events.onUploadError(ret, onUploadError);
  9013. }
  9014. });
  9015. },
  9016. custom: {
  9017. //自定义上传完成回调
  9018. afteruploadcallback: function (response) {
  9019. console.log(this, response);
  9020. alert("Custom Callback,Response URL:" + response.url);
  9021. },
  9022. },
  9023. }
  9024. };
  9025. return Upload;
  9026. });
  9027. /*! nice-validator 1.1.2
  9028. * (c) 2012-2017 Jony Zhang <niceue@live.com>, MIT Licensed
  9029. * https://github.com/niceue/nice-validator
  9030. */
  9031. ;(function(factory) {
  9032. typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
  9033. typeof define === 'function' && define.amd ? define('validator-core',['jquery'], factory) :
  9034. factory(jQuery);
  9035. }(function($, undefined) {
  9036. "use strict";
  9037. var NS = 'validator',
  9038. CLS_NS = '.' + NS,
  9039. CLS_NS_RULE = '.rule',
  9040. CLS_NS_FIELD = '.field',
  9041. CLS_NS_FORM = '.form',
  9042. CLS_WRAPPER = 'nice-' + NS,
  9043. CLS_MSG_BOX = 'msg-box',
  9044. ARIA_INVALID = 'aria-invalid',
  9045. DATA_RULE = 'data-rule',
  9046. DATA_MSG = 'data-msg',
  9047. DATA_TIP = 'data-tip',
  9048. DATA_OK = 'data-ok',
  9049. DATA_TIMELY = 'data-timely',
  9050. DATA_TARGET = 'data-target',
  9051. DATA_DISPLAY = 'data-display',
  9052. DATA_MUST = 'data-must',
  9053. NOVALIDATE = 'novalidate',
  9054. INPUT_SELECTOR = ':verifiable',
  9055. rRules = /(&)?(!)?\b(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?\s*(;|\|)?/g,
  9056. rRule = /(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?/,
  9057. rDisplay = /(?:([^:;\(\[]*):)?(.*)/,
  9058. rDoubleBytes = /[^\x00-\xff]/g,
  9059. rPos = /top|right|bottom|left/,
  9060. rAjaxType = /(?:(cors|jsonp):)?(?:(post|get):)?(.+)/i,
  9061. rUnsafe = /[<>'"`\\]|&#x?\d+[A-F]?;?|%3[A-F]/gmi,
  9062. noop = $.noop,
  9063. proxy = $.proxy,
  9064. trim = $.trim,
  9065. isFunction = $.isFunction,
  9066. isString = function(s) {
  9067. return typeof s === 'string';
  9068. },
  9069. isObject = function(o) {
  9070. return o && Object.prototype.toString.call(o) === '[object Object]';
  9071. },
  9072. isIE = document.documentMode || +(navigator.userAgent.match(/MSIE (\d+)/) && RegExp.$1),
  9073. attr = function(el, key, value) {
  9074. if (!el || !el.tagName) return null;
  9075. if (value !== undefined) {
  9076. if (value === null) el.removeAttribute(key);
  9077. else el.setAttribute(key, '' + value);
  9078. } else {
  9079. return el.getAttribute(key);
  9080. }
  9081. },
  9082. novalidateonce,
  9083. preinitialized = {},
  9084. defaults = {
  9085. debug: 0,
  9086. theme: 'default',
  9087. ignore: '',
  9088. focusInvalid: true,
  9089. focusCleanup: false,
  9090. stopOnError: false,
  9091. beforeSubmit: null,
  9092. valid: null,
  9093. invalid: null,
  9094. validation: null,
  9095. formClass: 'n-default',
  9096. validClass: 'n-valid',
  9097. invalidClass: 'n-invalid',
  9098. bindClassTo: null
  9099. },
  9100. fieldDefaults = {
  9101. timely: 1,
  9102. display: null,
  9103. target: null,
  9104. ignoreBlank: false,
  9105. showOk: true,
  9106. // Translate ajax response to validation result
  9107. dataFilter: function (data) {
  9108. if ( isString(data) || ( isObject(data) && ('error' in data || 'ok' in data) ) ) {
  9109. return data;
  9110. }
  9111. },
  9112. msgMaker: function(opt) {
  9113. var html;
  9114. html = '<span role="alert" class="msg-wrap n-'+ opt.type + '">' + opt.arrow;
  9115. if (opt.result) {
  9116. $.each(opt.result, function(i, obj){
  9117. html += '<span class="n-'+ obj.type +'">' + opt.icon + '<span class="n-msg">' + obj.msg + '</span></span>';
  9118. });
  9119. } else {
  9120. html += opt.icon + '<span class="n-msg">' + opt.msg + '</span>';
  9121. }
  9122. html += '</span>';
  9123. return html;
  9124. },
  9125. msgWrapper: 'span',
  9126. msgArrow: '',
  9127. msgIcon: '<span class="n-icon"></span>',
  9128. msgClass: 'n-right',
  9129. msgStyle: '',
  9130. msgShow: null,
  9131. msgHide: null
  9132. },
  9133. themes = {};
  9134. /** jQuery Plugin
  9135. * @param {Object} options
  9136. debug {Boolean} 0 Whether to enable debug mode
  9137. timely {Number} 1 Whether to enable timely validation
  9138. theme {String} 'default' Theme name
  9139. stopOnError {Boolean} false Whether to stop validate when found an error input
  9140. focusCleanup {Boolean} false Whether to clean up the field message when focus the field
  9141. focusInvalid {Boolean} true Whether to focus the field that is invalid
  9142. ignoreBlank {Boolean} false When the field has no value, whether to ignore validation
  9143. ignore {jqSelector} '' Ignored fields (Using jQuery selector)
  9144. beforeSubmit {Function} Do something before submit form
  9145. dataFilter {Function} Convert ajax results
  9146. valid {Function} Triggered when the form is valid
  9147. invalid {Function} Triggered when the form is invalid
  9148. validClass {String} 'n-valid' Add this class name to a valid field
  9149. invalidClass {String} 'n-invalid' Add this class name to a invalid field
  9150. bindClassTo {jqSelector} ':verifiable' Which element should the className binding to
  9151. display {Function} Callback function to get dynamic display
  9152. target {Function} Callback function to get dynamic target
  9153. msgShow {Function} Trigger this callback when show message
  9154. msgHide {Function} Trigger this callback when hide message
  9155. msgWrapper {String} 'span' Message wrapper tag name
  9156. msgMaker {Function} Callback function to make message HTML
  9157. msgArrow {String} Message arrow template
  9158. msgIcon {String} Message icon template
  9159. msgStyle {String} Custom message css style
  9160. msgClass {String} Additional added to the message class names
  9161. formClass {String} Additional added to the form class names
  9162. messages {Object} Custom messages for the current instance
  9163. rules {Object} Custom rules for the current instance
  9164. fields {Object} Field validation configuration
  9165. {String} key name|#id
  9166. {String|Object} value Rule string or an object which can pass more arguments
  9167. fields[key][rule] {String} Rule string
  9168. fields[key][display] {String|Function}
  9169. fields[key][tip] {String} Custom tip message
  9170. fields[key][ok] {String} Custom success message
  9171. fields[key][msg] {Object} Custom error message
  9172. fields[key][msgStyle] {String} Custom message style
  9173. fields[key][msgClass] {String} A className which added to message placeholder element
  9174. fields[key][msgWrapper] {String} Tag name of the message placeholder element
  9175. fields[key][msgMaker] {Function} A function to custom message HTML
  9176. fields[key][dataFilter] {Function} A function to convert ajax results
  9177. fields[key][valid] {Function} A function triggered when field is valid
  9178. fields[key][invalid] {Function} A function triggered when field is invalid
  9179. fields[key][must] {Boolean} If set true, we always check the field even has remote checking
  9180. fields[key][timely] {Boolean} Whether to enable timely validation
  9181. fields[key][target] {jqSelector} Define placement of a message
  9182. */
  9183. $.fn.validator = function(options) {
  9184. var that = this,
  9185. args = arguments;
  9186. if (that.is(INPUT_SELECTOR)) return that;
  9187. if (!that.is('form')) that = this.find('form');
  9188. if (!that.length) that = this;
  9189. that.each(function() {
  9190. var instance = $(this).data(NS);
  9191. if (instance) {
  9192. if ( isString(options) ) {
  9193. if ( options.charAt(0) === '_' ) return;
  9194. instance[options].apply(instance, [].slice.call(args, 1));
  9195. }
  9196. else if (options) {
  9197. instance._reset(true);
  9198. instance._init(this, options);
  9199. }
  9200. } else {
  9201. new Validator(this, options);
  9202. }
  9203. });
  9204. return this;
  9205. };
  9206. // Validate a field, or an area
  9207. $.fn.isValid = function(callback, hideMsg) {
  9208. var me = _getInstance(this[0]),
  9209. hasCallback = isFunction(callback),
  9210. ret, opt;
  9211. if (!me) return true;
  9212. if (!hasCallback && hideMsg === undefined) hideMsg = callback;
  9213. me.checkOnly = !!hideMsg;
  9214. opt = me.options;
  9215. ret = me._multiValidate(
  9216. this.is(INPUT_SELECTOR) ? this : this.find(INPUT_SELECTOR),
  9217. function(isValid){
  9218. if (!isValid && opt.focusInvalid && !me.checkOnly) {
  9219. // navigate to the error element
  9220. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  9221. }
  9222. if (hasCallback) {
  9223. if (callback.length) {
  9224. callback(isValid);
  9225. } else if (isValid) {
  9226. callback();
  9227. }
  9228. }
  9229. me.checkOnly = false;
  9230. }
  9231. );
  9232. // If you pass a callback, we maintain the jQuery object chain
  9233. return hasCallback ? this : ret;
  9234. };
  9235. $.extend($.expr.pseudos || $.expr[':'], {
  9236. // A faster selector than ":input:not(:submit,:button,:reset,:image,:disabled,[contenteditable])"
  9237. verifiable: function(elem) {
  9238. var name = elem.nodeName.toLowerCase();
  9239. return ( name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] ||
  9240. name === 'select' ||
  9241. name === 'textarea' ||
  9242. elem.contentEditable === 'true'
  9243. ) && !elem.disabled;
  9244. },
  9245. // any value, but not only whitespace
  9246. filled: function(elem) {
  9247. return !!trim($(elem).val());
  9248. }
  9249. });
  9250. /**
  9251. * Creates a new Validator
  9252. *
  9253. * @class
  9254. * @param {Element} element - form element
  9255. * @param {Object} options - options for validator
  9256. */
  9257. function Validator(element, options) {
  9258. var me = this;
  9259. if ( !(me instanceof Validator) ) {
  9260. return new Validator(element, options);
  9261. }
  9262. if (Validator.pending) {
  9263. $(window).on('validatorready', init);
  9264. } else {
  9265. init();
  9266. }
  9267. function init() {
  9268. me.$el = $(element);
  9269. if (me.$el.length) {
  9270. me._init(me.$el[0], options);
  9271. }
  9272. else if (isString(element)) {
  9273. preinitialized[element] = options;
  9274. }
  9275. }
  9276. }
  9277. Validator.prototype = {
  9278. _init: function(element, options) {
  9279. var me = this,
  9280. opt, themeOpt, dataOpt;
  9281. // Initialization options
  9282. if ( isFunction(options) ) {
  9283. options = {
  9284. valid: options
  9285. };
  9286. }
  9287. options = me._opt = options || {};
  9288. dataOpt = attr(element, 'data-'+ NS +'-option');
  9289. dataOpt = me._dataOpt = dataOpt && dataOpt.charAt(0) === '{' ? (new Function("return " + dataOpt))() : {};
  9290. themeOpt = me._themeOpt = themes[ options.theme || dataOpt.theme || defaults.theme ];
  9291. opt = me.options = $.extend({}, defaults, fieldDefaults, themeOpt, me.options, options, dataOpt);
  9292. me.rules = new Rules(opt.rules, true);
  9293. me.messages = new Messages(opt.messages, true);
  9294. me.Field = _createFieldFactory(me);
  9295. me.elements = me.elements || {};
  9296. me.deferred = {};
  9297. me.errors = {};
  9298. me.fields = {};
  9299. // Initialization fields
  9300. me._initFields(opt.fields);
  9301. // Initialization events and make a cache
  9302. if ( !me.$el.data(NS) ) {
  9303. me.$el.data(NS, me).addClass(CLS_WRAPPER +' '+ opt.formClass)
  9304. .on('form-submit-validate', function(e, a, $form, opts, veto) {
  9305. me.vetoed = veto.veto = !me.isValid;
  9306. me.ajaxFormOptions = opts;
  9307. })
  9308. .on('submit'+ CLS_NS +' validate'+ CLS_NS, proxy(me, '_submit'))
  9309. .on('reset'+ CLS_NS, proxy(me, '_reset'))
  9310. .on('showmsg'+ CLS_NS, proxy(me, '_showmsg'))
  9311. .on('hidemsg'+ CLS_NS, proxy(me, '_hidemsg'))
  9312. .on('focusin'+ CLS_NS + ' click'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusin'))
  9313. .on('focusout'+ CLS_NS +' validate'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusout'))
  9314. .on('keyup'+ CLS_NS +' input'+ CLS_NS + ' compositionstart compositionend', INPUT_SELECTOR, proxy(me, '_focusout'))
  9315. .on('click'+ CLS_NS, ':radio,:checkbox', 'click', proxy(me, '_focusout'))
  9316. .on('change'+ CLS_NS, 'select,input[type="file"]', 'change', proxy(me, '_focusout'));
  9317. // cache the novalidate attribute value
  9318. me._NOVALIDATE = attr(element, NOVALIDATE);
  9319. // Initialization is complete, stop off default HTML5 form validation
  9320. // If use "jQuery.attr('novalidate')" in IE7 will complain: "SCRIPT3: Member not found."
  9321. attr(element, NOVALIDATE, NOVALIDATE);
  9322. }
  9323. // Display all messages in target container
  9324. if ( isString(opt.target) ) {
  9325. me.$el.find(opt.target).addClass('msg-container');
  9326. }
  9327. },
  9328. // Guess whether the form use ajax submit
  9329. _guessAjax: function(form) {
  9330. var me = this;
  9331. if ( !(me.isAjaxSubmit = !!me.options.valid) ) {
  9332. // if there is a "valid.form" event
  9333. var events = ($._data || $.data)(form, "events");
  9334. me.isAjaxSubmit = issetEvent(events, 'valid', 'form') || issetEvent(events, 'submit', 'form-plugin');
  9335. }
  9336. function issetEvent(events, name, namespace) {
  9337. if ( events && events[name] &&
  9338. $.map(events[name], function(e){
  9339. return ~e.namespace.indexOf(namespace) ? 1 : null;
  9340. }).length
  9341. ) {
  9342. return true;
  9343. }
  9344. return false;
  9345. }
  9346. },
  9347. _initFields: function(fields) {
  9348. var me = this, k, arr, i,
  9349. clear = fields === null;
  9350. // Processing field information
  9351. if (clear) fields = me.fields;
  9352. if ( isObject(fields) ) {
  9353. for (k in fields) {
  9354. if (~k.indexOf(',')) {
  9355. arr = k.split(',');
  9356. i = arr.length;
  9357. while (i--) {
  9358. initField(trim(arr[i]), fields[k]);
  9359. }
  9360. } else {
  9361. initField(k, fields[k]);
  9362. }
  9363. }
  9364. }
  9365. // Parsing DOM rules
  9366. me.$el.find(INPUT_SELECTOR).each(function() {
  9367. me._parse(this);
  9368. });
  9369. function initField(k, v) {
  9370. // delete a field from settings
  9371. if ( v === null || clear ) {
  9372. var el = me.elements[k];
  9373. if (el) me._resetElement(el, true);
  9374. delete me.fields[k];
  9375. } else {
  9376. me.fields[k] = new me.Field(k, isString(v) ? {rule: v} : v, me.fields[k]);
  9377. }
  9378. }
  9379. },
  9380. // Parsing a field
  9381. _parse: function(el) {
  9382. var me = this,
  9383. field,
  9384. key = el.name,
  9385. display,
  9386. timely,
  9387. dataRule = attr(el, DATA_RULE);
  9388. dataRule && attr(el, DATA_RULE, null);
  9389. // If the field has passed the key as id mode, or it doesn't has a name
  9390. if ( el.id && (
  9391. ('#' + el.id in me.fields) ||
  9392. !key ||
  9393. // If dataRule and element are diffrent from old's, we use ID mode.
  9394. (dataRule !== null && (field = me.fields[key]) && dataRule !== field.rule && el.id !== field.key)
  9395. )
  9396. ) {
  9397. key = '#' + el.id;
  9398. }
  9399. // Generate id
  9400. if (!key) {
  9401. key = '#' + (el.id = 'N' + String(Math.random()).slice(-12));
  9402. }
  9403. field = me.getField(key, true);
  9404. // The priority of passing parameter by DOM is higher than by JS.
  9405. field.rule = dataRule || field.rule;
  9406. if (display = attr(el, DATA_DISPLAY)) {
  9407. field.display = display;
  9408. }
  9409. if (field.rule) {
  9410. if ( attr(el, DATA_MUST) !== null || /\b(?:match|checked)\b/.test(field.rule) ) {
  9411. field.must = true;
  9412. }
  9413. if ( /\brequired\b/.test(field.rule) ) {
  9414. field.required = true;
  9415. }
  9416. if (timely = attr(el, DATA_TIMELY)) {
  9417. field.timely = +timely;
  9418. } else if (field.timely > 3) {
  9419. attr(el, DATA_TIMELY, field.timely);
  9420. }
  9421. me._parseRule(field);
  9422. field.old = {};
  9423. }
  9424. if ( isString(field.target) ) {
  9425. attr(el, DATA_TARGET, field.target);
  9426. }
  9427. if ( isString(field.tip) ) {
  9428. attr(el, DATA_TIP, field.tip);
  9429. }
  9430. return me.fields[key] = field;
  9431. },
  9432. // Parsing field rules
  9433. _parseRule: function(field) {
  9434. var arr = rDisplay.exec(field.rule);
  9435. if (!arr) return;
  9436. // current rule index
  9437. field._i = 0;
  9438. if (arr[1]) {
  9439. field.display = arr[1];
  9440. }
  9441. if (arr[2]) {
  9442. field._rules = [];
  9443. arr[2].replace(rRules, function(){
  9444. var args = arguments;
  9445. args[4] = args[4] || args[5];
  9446. field._rules.push({
  9447. and: args[1] === "&",
  9448. not: args[2] === "!",
  9449. or: args[6] === "|",
  9450. method: args[3],
  9451. params: args[4] ? $.map( args[4].split(', '), trim ) : undefined
  9452. });
  9453. });
  9454. }
  9455. },
  9456. // Verify a zone
  9457. _multiValidate: function($inputs, doneCallback){
  9458. var me = this,
  9459. opt = me.options;
  9460. me.hasError = false;
  9461. if (opt.ignore) {
  9462. $inputs = $inputs.not(opt.ignore);
  9463. }
  9464. $inputs.each(function() {
  9465. me._validate(this);
  9466. if (me.hasError && opt.stopOnError) {
  9467. // stop the validation
  9468. return false;
  9469. }
  9470. });
  9471. // Need to wait for all fields validation complete, especially asynchronous validation
  9472. if (doneCallback) {
  9473. me.validating = true;
  9474. $.when.apply(
  9475. null,
  9476. $.map(me.deferred, function(v){return v;})
  9477. ).done(function(){
  9478. doneCallback.call(me, !me.hasError);
  9479. me.validating = false;
  9480. });
  9481. }
  9482. // If the form does not contain asynchronous validation, the return value is correct.
  9483. // Otherwise, you should detect form validation result through "doneCallback".
  9484. return !$.isEmptyObject(me.deferred) ? undefined : !me.hasError;
  9485. },
  9486. // Validate the whole form
  9487. _submit: function(e) {
  9488. var me = this,
  9489. opt = me.options,
  9490. form = e.target,
  9491. canSubmit = e.type === 'submit' && !e.isDefaultPrevented();
  9492. e.preventDefault();
  9493. if (
  9494. novalidateonce && ~(novalidateonce = false) ||
  9495. // Prevent duplicate submission
  9496. me.submiting ||
  9497. // Receive the "validate" event only from the form.
  9498. e.type === 'validate' && me.$el[0] !== form ||
  9499. // trigger the beforeSubmit callback.
  9500. isFunction(opt.beforeSubmit) && opt.beforeSubmit.call(me, form) === false
  9501. ) {
  9502. return;
  9503. }
  9504. if (me.isAjaxSubmit === undefined) {
  9505. me._guessAjax(form);
  9506. }
  9507. me._debug('log', '\n<<< event: ' + e.type);
  9508. me._reset();
  9509. me.submiting = true;
  9510. me._multiValidate(
  9511. me.$el.find(INPUT_SELECTOR),
  9512. function(isValid){
  9513. var ret = (isValid || opt.debug === 2) ? 'valid' : 'invalid',
  9514. errors;
  9515. if (!isValid) {
  9516. if (opt.focusInvalid) {
  9517. // navigate to the error element
  9518. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  9519. }
  9520. errors = $.map(me.errors, function(err){return err;});
  9521. }
  9522. // releasing submit
  9523. me.submiting = false;
  9524. me.isValid = isValid;
  9525. // trigger callback and event
  9526. isFunction(opt[ret]) && opt[ret].call(me, form, errors);
  9527. me.$el.trigger(ret + CLS_NS_FORM, [form, errors]);
  9528. me._debug('log', '>>> ' + ret);
  9529. if (!isValid) return;
  9530. // For jquery.form plugin
  9531. if (me.vetoed) {
  9532. $(form).ajaxSubmit(me.ajaxFormOptions);
  9533. }
  9534. else if (canSubmit && !me.isAjaxSubmit) {
  9535. document.createElement('form').submit.call(form);
  9536. }
  9537. }
  9538. );
  9539. },
  9540. _reset: function(e) {
  9541. var me = this;
  9542. me.errors = {};
  9543. if (e) {
  9544. me.reseting = true;
  9545. me.$el.find(INPUT_SELECTOR).each( function(){
  9546. me._resetElement(this);
  9547. });
  9548. delete me.reseting;
  9549. }
  9550. },
  9551. _resetElement: function(el, all) {
  9552. this._setClass(el, null);
  9553. this.hideMsg(el);
  9554. },
  9555. // Handle events: "focusin/click"
  9556. _focusin: function(e) {
  9557. var me = this,
  9558. opt = me.options,
  9559. el = e.target,
  9560. timely,
  9561. msg;
  9562. if ( me.validating || ( e.type==='click' && document.activeElement === el ) ) {
  9563. return;
  9564. }
  9565. if (opt.focusCleanup) {
  9566. if ( attr(el, ARIA_INVALID) === 'true' ) {
  9567. me._setClass(el, null);
  9568. me.hideMsg(el);
  9569. }
  9570. }
  9571. msg = attr(el, DATA_TIP);
  9572. if (msg) {
  9573. me.showMsg(el, {
  9574. type: 'tip',
  9575. msg: msg
  9576. });
  9577. } else {
  9578. if (attr(el, DATA_RULE)) {
  9579. me._parse(el);
  9580. }
  9581. if (timely = attr(el, DATA_TIMELY)) {
  9582. if ( timely === 8 || timely === 9 ) {
  9583. me._focusout(e);
  9584. }
  9585. }
  9586. }
  9587. },
  9588. // Handle events: "focusout/validate/keyup/click/change/input/compositionstart/compositionend"
  9589. _focusout: function(e) {
  9590. var me = this,
  9591. opt = me.options,
  9592. el = e.target,
  9593. etype = e.type,
  9594. etype0,
  9595. focusin = etype === 'focusin',
  9596. special = etype === 'validate',
  9597. elem,
  9598. field,
  9599. old,
  9600. value,
  9601. timestamp,
  9602. key, specialKey,
  9603. timely,
  9604. timer = 0;
  9605. if (etype === 'compositionstart') {
  9606. me.pauseValidate = true;
  9607. }
  9608. if (etype === 'compositionend') {
  9609. me.pauseValidate = false;
  9610. }
  9611. if (me.pauseValidate) {
  9612. return;
  9613. }
  9614. // For checkbox and radio
  9615. elem = el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]').get(0) : el;
  9616. // Get field
  9617. if (!(field = me.getField(elem)) || !field.rule) {
  9618. return;
  9619. }
  9620. // Cache event type
  9621. etype0 = field._e;
  9622. field._e = etype;
  9623. timely = field.timely;
  9624. if (!special) {
  9625. if (!timely || (_checkable(el) && etype !== 'click')) {
  9626. return;
  9627. }
  9628. value = field.getValue();
  9629. // not validate field unless fill a value
  9630. if ( field.ignoreBlank && !value && !focusin ) {
  9631. me.hideMsg(el);
  9632. return;
  9633. }
  9634. if ( etype === 'focusout' ) {
  9635. if (etype0 === 'change') {
  9636. return;
  9637. }
  9638. if ( timely === 2 || timely === 8 ) {
  9639. old = field.old;
  9640. if (value && old) {
  9641. if (field.isValid && !old.showOk) {
  9642. me.hideMsg(el);
  9643. } else {
  9644. me._makeMsg(el, field, old);
  9645. }
  9646. } else {
  9647. return;
  9648. }
  9649. }
  9650. }
  9651. else {
  9652. if ( timely < 2 && !e.data ) {
  9653. return;
  9654. }
  9655. // mark timestamp to reduce the frequency of the received event
  9656. timestamp = +new Date();
  9657. if ( timestamp - (el._ts || 0) < 100 ) {
  9658. return;
  9659. }
  9660. el._ts = timestamp;
  9661. // handle keyup
  9662. if ( etype === 'keyup' ) {
  9663. if (etype0 === 'input') {
  9664. return;
  9665. }
  9666. key = e.keyCode;
  9667. specialKey = {
  9668. 8: 1, // Backspace
  9669. 9: 1, // Tab
  9670. 16: 1, // Shift
  9671. 32: 1, // Space
  9672. 46: 1 // Delete
  9673. };
  9674. // only gets focus, no validation
  9675. if ( key === 9 && !value ) {
  9676. return;
  9677. }
  9678. // do not validate, if triggered by these keys
  9679. if ( key < 48 && !specialKey[key] ) {
  9680. return;
  9681. }
  9682. }
  9683. if ( !focusin ) {
  9684. // keyboard events, reducing the frequency of validation
  9685. timer = timely <100 ? (etype === 'click' || el.tagName === 'SELECT') ? 0 : 400 : timely;
  9686. }
  9687. }
  9688. }
  9689. // if the current field is ignored
  9690. if ( opt.ignore && $(el).is(opt.ignore) ) {
  9691. return;
  9692. }
  9693. clearTimeout(field._t);
  9694. if (timer) {
  9695. field._t = setTimeout(function() {
  9696. me._validate(el, field);
  9697. }, timer);
  9698. } else {
  9699. if (special) field.old = {};
  9700. me._validate(el, field);
  9701. }
  9702. },
  9703. _setClass: function(el, isValid) {
  9704. var $el = $(el), opt = this.options;
  9705. if (opt.bindClassTo) {
  9706. $el = $el.closest(opt.bindClassTo);
  9707. }
  9708. $el.removeClass( opt.invalidClass + ' ' + opt.validClass );
  9709. if (isValid !== null) {
  9710. $el.addClass( isValid ? opt.validClass : opt.invalidClass );
  9711. }
  9712. },
  9713. _showmsg: function(e, type, msg) {
  9714. var me = this,
  9715. el = e.target;
  9716. if ( me.$el.is(el) ) {
  9717. if (isObject(type)) {
  9718. me.showMsg(type)
  9719. }
  9720. else if ( type === 'tip' ) {
  9721. me.$el.find(INPUT_SELECTOR +"["+ DATA_TIP +"]", el).each(function(){
  9722. me.showMsg(this, {type: type, msg: msg});
  9723. });
  9724. }
  9725. }
  9726. else {
  9727. me.showMsg(el, {type: type, msg: msg});
  9728. }
  9729. },
  9730. _hidemsg: function(e) {
  9731. var $el = $(e.target);
  9732. if ( $el.is(INPUT_SELECTOR) ) {
  9733. this.hideMsg($el);
  9734. }
  9735. },
  9736. // Validated a field
  9737. _validatedField: function(el, field, ret) {
  9738. var me = this,
  9739. opt = me.options,
  9740. isValid = field.isValid = ret.isValid = !!ret.isValid,
  9741. callback = isValid ? 'valid' : 'invalid';
  9742. ret.key = field.key;
  9743. ret.ruleName = field._r;
  9744. ret.id = el.id;
  9745. ret.value = field.value;
  9746. me.elements[field.key] = ret.element = el;
  9747. me.isValid = me.$el[0].isValid = isValid ? me.isFormValid() : isValid;
  9748. if (isValid) {
  9749. ret.type = 'ok';
  9750. } else {
  9751. if (me.submiting) {
  9752. me.errors[field.key] = ret.msg;
  9753. }
  9754. me.hasError = true;
  9755. }
  9756. // cache result
  9757. field.old = ret;
  9758. // trigger callback
  9759. isFunction(field[callback]) && field[callback].call(me, el, ret);
  9760. isFunction(opt.validation) && opt.validation.call(me, el, ret);
  9761. // trigger event
  9762. $(el).attr( ARIA_INVALID, isValid ? null : true )
  9763. .trigger( callback + CLS_NS_FIELD, [ret, me] );
  9764. me.$el.triggerHandler('validation', [ret, me]);
  9765. if (me.checkOnly) return;
  9766. // set className
  9767. me._setClass(el, ret.skip || ret.type === 'tip' ? null : isValid);
  9768. me._makeMsg.apply(me, arguments);
  9769. },
  9770. _makeMsg: function(el, field, ret) {
  9771. // show or hide the message
  9772. if (field.msgMaker) {
  9773. ret = $.extend({}, ret);
  9774. if (field._e === 'focusin') {
  9775. ret.type = 'tip';
  9776. }
  9777. this[ ret.showOk || ret.msg || ret.type === 'tip' ? 'showMsg' : 'hideMsg' ](el, ret, field);
  9778. }
  9779. },
  9780. // Validated a rule
  9781. _validatedRule: function(el, field, ret, msgOpt) {
  9782. field = field || me.getField(el);
  9783. msgOpt = msgOpt || {};
  9784. var me = this,
  9785. msg,
  9786. rule,
  9787. method = field._r,
  9788. timely = field.timely,
  9789. special = timely === 9 || timely === 8,
  9790. transfer,
  9791. temp,
  9792. isValid = false;
  9793. // use null to break validation from a field
  9794. if (ret === null) {
  9795. me._validatedField(el, field, {isValid: true, skip: true});
  9796. field._i = 0;
  9797. return;
  9798. }
  9799. else if (ret === undefined) {
  9800. transfer = true;
  9801. }
  9802. else if (ret === true || ret === '') {
  9803. isValid = true;
  9804. }
  9805. else if (isString(ret)) {
  9806. msg = ret;
  9807. }
  9808. else if (isObject(ret)) {
  9809. if (ret.error) {
  9810. msg = ret.error;
  9811. } else {
  9812. msg = ret.ok;
  9813. isValid = true;
  9814. }
  9815. }
  9816. rule = field._rules[field._i];
  9817. if (rule.not) {
  9818. msg = undefined;
  9819. isValid = method === "required" || !isValid;
  9820. }
  9821. if (rule.or) {
  9822. if (isValid) {
  9823. while ( field._i < field._rules.length && field._rules[field._i].or ) {
  9824. field._i++;
  9825. }
  9826. } else {
  9827. transfer = true;
  9828. }
  9829. }
  9830. else if (rule.and) {
  9831. if (!field.isValid) transfer = true;
  9832. }
  9833. if (transfer) {
  9834. isValid = true;
  9835. }
  9836. // message analysis, and throw rule level event
  9837. else {
  9838. if (isValid) {
  9839. if (field.showOk !== false) {
  9840. temp = attr(el, DATA_OK);
  9841. msg = temp === null ? isString(field.ok) ? field.ok : msg : temp;
  9842. if (!isString(msg) && isString(field.showOk)) {
  9843. msg = field.showOk;
  9844. }
  9845. if (isString(msg)) {
  9846. msgOpt.showOk = isValid;
  9847. }
  9848. }
  9849. }
  9850. if (!isValid || special) {
  9851. /* rule message priority:
  9852. 1. custom DOM message
  9853. 2. custom field message;
  9854. 3. global defined message;
  9855. 4. rule returned message;
  9856. 5. default message;
  9857. */
  9858. msg = (_getDataMsg(el, field, msg || rule.msg || me.messages[method]) || me.messages.fallback).replace(/\{0\|?([^\}]*)\}/, function(m, defaultDisplay){
  9859. return me._getDisplay(el, field.display) || defaultDisplay || me.messages[0];
  9860. });
  9861. }
  9862. if (!isValid) field.isValid = isValid;
  9863. msgOpt.msg = msg;
  9864. $(el).trigger( (isValid ? 'valid' : 'invalid') + CLS_NS_RULE, [method, msg]);
  9865. }
  9866. if (special && (!transfer || rule.and)) {
  9867. if (!isValid && !field._m) field._m = msg;
  9868. field._v = field._v || [];
  9869. field._v.push({
  9870. type: isValid ? !transfer ? 'ok' : 'tip' : 'error',
  9871. msg: msg || rule.msg
  9872. });
  9873. }
  9874. me._debug('log', ' ' + field._i + ': ' + method + ' => ' + (isValid || msg));
  9875. // the current rule has passed, continue to validate
  9876. if ( (isValid || special) && field._i < field._rules.length - 1) {
  9877. field._i++;
  9878. me._checkRule(el, field);
  9879. }
  9880. // field was invalid, or all fields was valid
  9881. else {
  9882. field._i = 0;
  9883. if (special) {
  9884. msgOpt.isValid = field.isValid;
  9885. msgOpt.result = field._v;
  9886. msgOpt.msg = field._m || '';
  9887. if (!field.value && (field._e === 'focusin')) {
  9888. msgOpt.type = 'tip';
  9889. }
  9890. } else {
  9891. msgOpt.isValid = isValid;
  9892. }
  9893. me._validatedField(el, field, msgOpt);
  9894. delete field._m;
  9895. delete field._v;
  9896. }
  9897. },
  9898. // Verify a rule form a field
  9899. _checkRule: function(el, field) {
  9900. var me = this,
  9901. ret,
  9902. fn,
  9903. old,
  9904. key = field.key,
  9905. rule = field._rules[field._i],
  9906. method = rule.method,
  9907. params = rule.params;
  9908. // request has been sent, wait it
  9909. if (me.submiting && me.deferred[key]) {
  9910. return;
  9911. }
  9912. old = field.old;
  9913. field._r = method;
  9914. if (old && !field.must && !rule.must && rule.result !== undefined &&
  9915. old.ruleName === method && old.id === el.id &&
  9916. field.value && old.value === field.value )
  9917. {
  9918. // get result from cache
  9919. ret = rule.result;
  9920. }
  9921. else {
  9922. // get result from current rule
  9923. fn = _getDataRule(el, method) || me.rules[method] || noop;
  9924. ret = fn.call(field, el, params, field);
  9925. if (fn.msg) rule.msg = fn.msg;
  9926. }
  9927. // asynchronous validation
  9928. if (isObject(ret) && isFunction(ret.then)) {
  9929. me.deferred[key] = ret;
  9930. // whether the field valid is unknown
  9931. field.isValid = undefined;
  9932. // show loading message
  9933. !me.checkOnly && me.showMsg(el, {
  9934. type: 'loading',
  9935. msg: me.messages.loading
  9936. }, field);
  9937. // waiting to parse the response data
  9938. ret.then(
  9939. function(d, textStatus, jqXHR) {
  9940. var data = trim(jqXHR.responseText),
  9941. result,
  9942. dataFilter = field.dataFilter;
  9943. // detect if data is json or jsonp format
  9944. if (/jsonp?/.test(this.dataType)) {
  9945. data = d;
  9946. } else if (data.charAt(0) === '{') {
  9947. data = $.parseJSON(data);
  9948. }
  9949. // filter data
  9950. result = dataFilter.call(this, data, field);
  9951. if (result === undefined) result = dataFilter.call(this, data.data, field);
  9952. rule.data = this.data;
  9953. rule.result = field.old ? result : undefined;
  9954. me._validatedRule(el, field, result);
  9955. },
  9956. function(jqXHR, textStatus){
  9957. me._validatedRule(el, field, me.messages[textStatus] || textStatus);
  9958. }
  9959. ).always(function(){
  9960. delete me.deferred[key];
  9961. });
  9962. }
  9963. // other result
  9964. else {
  9965. me._validatedRule(el, field, ret);
  9966. }
  9967. },
  9968. // Processing the validation
  9969. _validate: function(el, field) {
  9970. var me = this;
  9971. // doesn't validate the element that has "disabled" or "novalidate" attribute
  9972. if ( el.disabled || attr(el, NOVALIDATE) !== null ) {
  9973. return;
  9974. }
  9975. field = field || me.getField(el);
  9976. if (!field) return;
  9977. if (!field._rules) me._parse(el);
  9978. if (!field._rules) return;
  9979. me._debug('info', field.key);
  9980. field.isValid = true;
  9981. field.element = el;
  9982. // Cache the value
  9983. field.value = field.getValue();
  9984. // if the field is not required, and that has a blank value
  9985. if (!field.required && !field.must && !field.value) {
  9986. if (!_checkable(el)) {
  9987. me._validatedField(el, field, {isValid: true});
  9988. return true;
  9989. }
  9990. }
  9991. me._checkRule(el, field);
  9992. return field.isValid;
  9993. },
  9994. _debug: function(type, messages) {
  9995. if (window.console && this.options.debug) {
  9996. console[type](messages);
  9997. }
  9998. },
  9999. /**
  10000. * Detecting whether the value of an element that matches a rule
  10001. *
  10002. * @method test
  10003. * @param {Element} el - input element
  10004. * @param {String} rule - rule name
  10005. */
  10006. test: function(el, rule) {
  10007. var me = this,
  10008. ret,
  10009. parts = rRule.exec(rule),
  10010. field,
  10011. method,
  10012. params;
  10013. if (parts) {
  10014. method = parts[1];
  10015. if (method in me.rules) {
  10016. params = parts[2] || parts[3];
  10017. params = params ? params.split(', ') : undefined;
  10018. field = me.getField(el, true);
  10019. field._r = method;
  10020. field.value = field.getValue();
  10021. ret = me.rules[method].call(field, el, params);
  10022. }
  10023. }
  10024. return ret === true || ret === undefined || ret === null;
  10025. },
  10026. _getDisplay: function(el, str) {
  10027. return !isString(str) ? isFunction(str) ? str.call(this, el) : '' : str;
  10028. },
  10029. _getMsgOpt: function(obj, field) {
  10030. var opt = field ? field : this.options;
  10031. return $.extend({
  10032. type: 'error',
  10033. pos: _getPos(opt.msgClass),
  10034. target: opt.target,
  10035. wrapper: opt.msgWrapper,
  10036. style: opt.msgStyle,
  10037. cls: opt.msgClass,
  10038. arrow: opt.msgArrow,
  10039. icon: opt.msgIcon
  10040. }, isString(obj) ? {msg: obj} : obj);
  10041. },
  10042. _getMsgDOM: function(el, msgOpt) {
  10043. var $el = $(el), $msgbox, datafor, tgt, container;
  10044. if ( $el.is(INPUT_SELECTOR) ) {
  10045. tgt = msgOpt.target || attr(el, DATA_TARGET);
  10046. if (tgt) {
  10047. tgt = !isFunction(tgt) ? tgt.charAt(0) === '#' ? $(tgt) : this.$el.find(tgt) : tgt.call(this, el);
  10048. if (tgt.length) {
  10049. if ( tgt.is(INPUT_SELECTOR) ) {
  10050. $el = tgt
  10051. el = tgt.get(0);
  10052. } else if ( tgt.hasClass(CLS_MSG_BOX) ) {
  10053. $msgbox = tgt;
  10054. } else {
  10055. container = tgt;
  10056. }
  10057. }
  10058. }
  10059. if (!$msgbox) {
  10060. datafor = (!_checkable(el) || !el.name) && el.id ? el.id : el.name;
  10061. $msgbox = (container || this.$el).find(msgOpt.wrapper + '.' + CLS_MSG_BOX + '[for="' + datafor + '"]');
  10062. }
  10063. } else {
  10064. $msgbox = $el;
  10065. }
  10066. // Create new message box
  10067. if (!msgOpt.hide && !$msgbox.length) {
  10068. $msgbox = $('<'+ msgOpt.wrapper + '>').attr({
  10069. 'class': CLS_MSG_BOX + (msgOpt.cls ? ' ' + msgOpt.cls : ''),
  10070. 'style': msgOpt.style || undefined,
  10071. 'for': datafor
  10072. });
  10073. if (container) {
  10074. $msgbox.appendTo(container);
  10075. } else {
  10076. if ( _checkable(el) ) {
  10077. var $parent = $el.parent();
  10078. $msgbox.appendTo( $parent.is('label') ? $parent.parent() : $parent );
  10079. } else {
  10080. $msgbox[!msgOpt.pos || msgOpt.pos === 'right' ? 'insertAfter' : 'insertBefore']($el);
  10081. }
  10082. }
  10083. }
  10084. return $msgbox;
  10085. },
  10086. /**
  10087. * Show validation message
  10088. *
  10089. * @method showMsg
  10090. * @param {Element} el - input element
  10091. * @param {Object} msgOpt
  10092. */
  10093. showMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  10094. if (!el) return;
  10095. var me = this,
  10096. opt = me.options,
  10097. msgShow,
  10098. msgMaker,
  10099. temp,
  10100. $msgbox;
  10101. if (isObject(el) && !el.jquery && !msgOpt) {
  10102. $.each(el, function(key, msg) {
  10103. var el = me.elements[key] || me.$el.find(_key2selector(key))[0];
  10104. me.showMsg(el, msg);
  10105. });
  10106. return;
  10107. }
  10108. if ($(el).is(INPUT_SELECTOR)) {
  10109. field = field || me.getField(el);
  10110. }
  10111. if (!(msgMaker = (field || opt).msgMaker)) {
  10112. return;
  10113. }
  10114. msgOpt = me._getMsgOpt(msgOpt, field);
  10115. el = (el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]') : $(el)).get(0);
  10116. // ok or tip
  10117. if (!msgOpt.msg && msgOpt.type !== 'error') {
  10118. temp = attr(el, 'data-' + msgOpt.type);
  10119. if (temp !== null) msgOpt.msg = temp;
  10120. }
  10121. if ( !isString(msgOpt.msg) ) {
  10122. return;
  10123. }
  10124. $msgbox = me._getMsgDOM(el, msgOpt);
  10125. !rPos.test($msgbox[0].className) && $msgbox.addClass(msgOpt.cls);
  10126. if ( isIE === 6 && msgOpt.pos === 'bottom' ) {
  10127. $msgbox[0].style.marginTop = $(el).outerHeight() + 'px';
  10128. }
  10129. $msgbox.html( msgMaker.call(me, msgOpt) )[0].style.display = '';
  10130. if (isFunction(msgShow = field && field.msgShow || opt.msgShow)) {
  10131. msgShow.call(me, $msgbox, msgOpt.type);
  10132. }
  10133. },
  10134. /**
  10135. * Hide validation message
  10136. *
  10137. * @method hideMsg
  10138. * @param {Element} el - input element
  10139. * @param {Object} msgOpt optional
  10140. */
  10141. hideMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  10142. var me = this,
  10143. opt = me.options,
  10144. msgHide,
  10145. $msgbox;
  10146. el = $(el).get(0);
  10147. if ($(el).is(INPUT_SELECTOR)) {
  10148. field = field || me.getField(el);
  10149. if (field) {
  10150. if (field.isValid || me.reseting) attr(el, ARIA_INVALID, null);
  10151. }
  10152. }
  10153. msgOpt = me._getMsgOpt(msgOpt, field);
  10154. msgOpt.hide = true;
  10155. $msgbox = me._getMsgDOM(el, msgOpt);
  10156. if (!$msgbox.length) return;
  10157. if ( isFunction(msgHide = field && field.msgHide || opt.msgHide) ) {
  10158. msgHide.call(me, $msgbox, msgOpt.type);
  10159. } else {
  10160. $msgbox[0].style.display = 'none';
  10161. $msgbox[0].innerHTML = null;
  10162. }
  10163. },
  10164. /**
  10165. * Get field information
  10166. *
  10167. * @method getField
  10168. * @param {Element} - input element
  10169. * @return {Object} field
  10170. */
  10171. getField: function(el, must) {
  10172. var me = this,
  10173. key,
  10174. field;
  10175. if (isString(el)) {
  10176. key = el;
  10177. el = undefined;
  10178. } else {
  10179. if (attr(el, DATA_RULE)) {
  10180. return me._parse(el);
  10181. }
  10182. if (el.id && '#' + el.id in me.fields || !el.name) {
  10183. key = '#' + el.id;
  10184. } else {
  10185. key = el.name;
  10186. }
  10187. }
  10188. if ( (field = me.fields[key]) || must && (field = new me.Field(key)) ) {
  10189. field.element = el;
  10190. }
  10191. return field;
  10192. },
  10193. /**
  10194. * Config a field
  10195. *
  10196. * @method: setField
  10197. * @param {String} key
  10198. * @param {Object} obj
  10199. */
  10200. setField: function(key, obj) {
  10201. var fields = {};
  10202. if (!key) return;
  10203. // update this field
  10204. if (isString(key)) {
  10205. fields[key] = obj;
  10206. }
  10207. // update fields
  10208. else {
  10209. fields = key;
  10210. }
  10211. this._initFields(fields);
  10212. },
  10213. /**
  10214. * Detecting whether the form is valid
  10215. *
  10216. * @method isFormValid
  10217. * @return {Boolean}
  10218. */
  10219. isFormValid: function() {
  10220. var fields = this.fields, k, field;
  10221. for (k in fields) {
  10222. field = fields[k];
  10223. if (!field._rules || !field.required && !field.must && !field.value) continue;
  10224. if (!field.isValid) return false;
  10225. }
  10226. return true;
  10227. },
  10228. /**
  10229. * Prevent submission form
  10230. *
  10231. * @method holdSubmit
  10232. * @param {Boolean} hold - If set to false, will release the hold
  10233. */
  10234. holdSubmit: function(hold) {
  10235. this.submiting = hold === undefined || hold;
  10236. },
  10237. /**
  10238. * Clean validation messages
  10239. *
  10240. * @method cleanUp
  10241. */
  10242. cleanUp: function() {
  10243. this._reset(1);
  10244. },
  10245. /**
  10246. * Destroy the validation
  10247. *
  10248. * @method destroy
  10249. */
  10250. destroy: function() {
  10251. this._reset(1);
  10252. this.$el.off(CLS_NS).removeData(NS);
  10253. attr(this.$el[0], NOVALIDATE, this._NOVALIDATE);
  10254. }
  10255. };
  10256. /**
  10257. * Create Field Factory
  10258. *
  10259. * @class
  10260. * @param {Object} context
  10261. * @return {Function} Factory
  10262. */
  10263. function _createFieldFactory(context) {
  10264. function FieldFactory() {
  10265. var options = this.options;
  10266. for (var i in options) {
  10267. if (i in fieldDefaults) this[i] = options[i];
  10268. }
  10269. $.extend(this, {
  10270. _valHook: function() {
  10271. return this.element.contentEditable === 'true' ? 'text' : 'val';
  10272. },
  10273. getValue: function() {
  10274. var elem = this.element;
  10275. if (elem.type === "number" && elem.validity && elem.validity.badInput) {
  10276. return 'NaN';
  10277. }
  10278. return $(elem)[this._valHook()]();
  10279. },
  10280. setValue: function(value) {
  10281. $(this.element)[this._valHook()](this.value = value);
  10282. },
  10283. // Get a range of validation messages
  10284. getRangeMsg: function(value, params, suffix) {
  10285. if (!params) return;
  10286. var me = this,
  10287. msg = me.messages[me._r] || '',
  10288. result,
  10289. p = params[0].split('~'),
  10290. e = params[1] === 'false',
  10291. a = p[0],
  10292. b = p[1],
  10293. c = 'rg',
  10294. args = [''],
  10295. isNumber = trim(value) && +value === +value;
  10296. function compare(large, small) {
  10297. return !e ? large >= small : large > small;
  10298. }
  10299. if (p.length === 2) {
  10300. if (a && b) {
  10301. if (isNumber && compare(value, +a) && compare(+b, value)) {
  10302. result = true;
  10303. }
  10304. args = args.concat(p);
  10305. c = e ? 'gtlt' : 'rg';
  10306. }
  10307. else if (a && !b) {
  10308. if (isNumber && compare(value, +a)) {
  10309. result = true;
  10310. }
  10311. args.push(a);
  10312. c = e ? 'gt' : 'gte';
  10313. }
  10314. else if (!a && b) {
  10315. if (isNumber && compare(+b, value)) {
  10316. result = true;
  10317. }
  10318. args.push(b);
  10319. c = e ? 'lt' : 'lte';
  10320. }
  10321. }
  10322. else {
  10323. if (value === +a) {
  10324. result = true;
  10325. }
  10326. args.push(a);
  10327. c = 'eq';
  10328. }
  10329. if (msg) {
  10330. if (suffix && msg[c + suffix]) {
  10331. c += suffix;
  10332. }
  10333. args[0] = msg[c];
  10334. }
  10335. return result || me._rules && ( me._rules[me._i].msg = me.renderMsg.apply(null, args) );
  10336. },
  10337. // Render message template
  10338. renderMsg: function() {
  10339. var args = arguments,
  10340. tpl = args[0],
  10341. i = args.length;
  10342. if (!tpl) return;
  10343. while (--i) {
  10344. tpl = tpl.replace('{' + i + '}', args[i]);
  10345. }
  10346. return tpl;
  10347. }
  10348. });
  10349. }
  10350. function Field(key, obj, oldField) {
  10351. this.key = key;
  10352. this.validator = context;
  10353. $.extend(this, oldField, obj);
  10354. }
  10355. FieldFactory.prototype = context;
  10356. Field.prototype = new FieldFactory();
  10357. return Field;
  10358. }
  10359. /**
  10360. * Create Rules
  10361. *
  10362. * @class
  10363. * @param {Object} obj rules
  10364. * @param {Object} context context
  10365. */
  10366. function Rules(obj, context) {
  10367. if (!isObject(obj)) return;
  10368. var k, that = context ? context === true ? this : context : Rules.prototype;
  10369. for (k in obj) {
  10370. if (_checkRuleName(k))
  10371. that[k] = _getRule(obj[k]);
  10372. }
  10373. }
  10374. /**
  10375. * Create Messages
  10376. *
  10377. * @class
  10378. * @param {Object} obj rules
  10379. * @param {Object} context context
  10380. */
  10381. function Messages(obj, context) {
  10382. if (!isObject(obj)) return;
  10383. var k, that = context ? context === true ? this : context : Messages.prototype;
  10384. for (k in obj) {
  10385. that[k] = obj[k];
  10386. }
  10387. }
  10388. // Rule converted factory
  10389. function _getRule(fn) {
  10390. switch ($.type(fn)) {
  10391. case 'function':
  10392. return fn;
  10393. case 'array':
  10394. var f = function() {
  10395. return fn[0].test(this.value) || fn[1] || false;
  10396. };
  10397. f.msg = fn[1];
  10398. return f;
  10399. case 'regexp':
  10400. return function() {
  10401. return fn.test(this.value);
  10402. };
  10403. }
  10404. }
  10405. // Get instance by an element
  10406. function _getInstance(el) {
  10407. var wrap, k, options;
  10408. if (!el || !el.tagName) return;
  10409. switch (el.tagName) {
  10410. case 'INPUT':
  10411. case 'SELECT':
  10412. case 'TEXTAREA':
  10413. case 'BUTTON':
  10414. case 'FIELDSET':
  10415. wrap = el.form || $(el).closest('.' + CLS_WRAPPER);
  10416. break;
  10417. case 'FORM':
  10418. wrap = el;
  10419. break;
  10420. default:
  10421. wrap = $(el).closest('.' + CLS_WRAPPER);
  10422. }
  10423. for (k in preinitialized) {
  10424. if ($(wrap).is(k)) {
  10425. options = preinitialized[k];
  10426. break;
  10427. }
  10428. }
  10429. return $(wrap).data(NS) || $(wrap)[NS](options).data(NS);
  10430. }
  10431. // Get custom rules on the node
  10432. function _getDataRule(el, method) {
  10433. var fn = trim(attr(el, DATA_RULE + '-' + method));
  10434. if ( fn && (fn = new Function("return " + fn)()) ) {
  10435. return _getRule(fn);
  10436. }
  10437. }
  10438. // Get custom messages on the node
  10439. function _getDataMsg(el, field, m) {
  10440. var msg = field.msg,
  10441. item = field._r;
  10442. if ( isObject(msg) ) msg = msg[item];
  10443. if ( !isString(msg) ) {
  10444. msg = attr(el, DATA_MSG + '-' + item) || attr(el, DATA_MSG) || ( m ? isString(m) ? m : m[item] : '');
  10445. }
  10446. return msg;
  10447. }
  10448. // Get message position
  10449. function _getPos(str) {
  10450. var pos;
  10451. if (str) pos = rPos.exec(str);
  10452. return pos && pos[0];
  10453. }
  10454. // Check whether the element is checkbox or radio
  10455. function _checkable(el) {
  10456. return el.tagName === 'INPUT' && el.type === 'checkbox' || el.type === 'radio';
  10457. }
  10458. // Parse date string to timestamp
  10459. function _parseDate(str) {
  10460. return Date.parse(str.replace(/\.|\-/g, '/'));
  10461. }
  10462. // Rule name only allows alphanumeric characters and underscores
  10463. function _checkRuleName(name) {
  10464. return /^\w+$/.test(name);
  10465. }
  10466. // Translate field key to jQuery selector.
  10467. function _key2selector(key) {
  10468. var isID = key.charAt(0) === "#";
  10469. key = key.replace(/([:.{(|)}/\[\]])/g, "\\$1");
  10470. return isID ? key : '[name="'+ key +'"]:first';
  10471. }
  10472. // Fixed a issue cause by refresh page in IE.
  10473. $(window).on('beforeunload', function(){
  10474. this.focus();
  10475. });
  10476. $(document)
  10477. .on('click', ':submit', function(){
  10478. var input = this, attrNode;
  10479. if (!input.form) return;
  10480. // Shim for "formnovalidate"
  10481. attrNode = input.getAttributeNode('formnovalidate');
  10482. if (attrNode && attrNode.nodeValue !== null || attr(input, NOVALIDATE)!== null) {
  10483. novalidateonce = true;
  10484. }
  10485. })
  10486. // Automatic initializing form validation
  10487. .on('focusin submit validate', 'form,.'+CLS_WRAPPER, function(e) {
  10488. if ( attr(this, NOVALIDATE) !== null ) return;
  10489. var $form = $(this), me;
  10490. if ( !$form.data(NS) && (me = _getInstance(this)) ) {
  10491. if ( !$.isEmptyObject(me.fields) ) {
  10492. // Execute event handler
  10493. if (e.type === 'focusin') {
  10494. me._focusin(e);
  10495. } else {
  10496. me._submit(e);
  10497. }
  10498. } else {
  10499. attr(this, NOVALIDATE, NOVALIDATE);
  10500. $form.off(CLS_NS).removeData(NS);
  10501. }
  10502. }
  10503. });
  10504. new Messages({
  10505. fallback: "This field is not valid.",
  10506. loading: 'Validating...'
  10507. });
  10508. // Built-in rules (global)
  10509. new Rules({
  10510. /**
  10511. * required
  10512. *
  10513. * @example:
  10514. required
  10515. required(anotherRule)
  10516. required(not, -1)
  10517. required(from, .contact)
  10518. */
  10519. required: function(element, params) {
  10520. var me = this,
  10521. val = trim(me.value),
  10522. isValid = true;
  10523. if (params) {
  10524. if ( params.length === 1 ) {
  10525. if ( !_checkRuleName(params[0]) ) {
  10526. if (!val && !$(params[0], me.$el).length ) {
  10527. return null;
  10528. }
  10529. }
  10530. else if ( me.rules[params[0]] ) {
  10531. if ( !val && !me.test(element, params[0]) ) {
  10532. return null;
  10533. }
  10534. }
  10535. }
  10536. else if ( params[0] === 'not' ) {
  10537. $.each(params.slice(1), function() {
  10538. return (isValid = val !== trim(this));
  10539. });
  10540. }
  10541. else if ( params[0] === 'from' ) {
  10542. var $elements = me.$el.find(params[1]),
  10543. VALIDATED = '_validated_',
  10544. ret;
  10545. isValid = $elements.filter(function(){
  10546. var field = me.getField(this);
  10547. return field && !!trim(field.getValue());
  10548. }).length >= (params[2] || 1);
  10549. if (isValid) {
  10550. if (!val) ret = null;
  10551. } else {
  10552. ret = _getDataMsg($elements[0], me) || false;
  10553. }
  10554. if ( !$(element).data(VALIDATED) ) {
  10555. $elements.data(VALIDATED, 1).each(function(){
  10556. if (element !== this) {
  10557. me._validate(this);
  10558. }
  10559. }).removeData(VALIDATED);
  10560. }
  10561. return ret;
  10562. }
  10563. }
  10564. return isValid && !!val;
  10565. },
  10566. /**
  10567. * integer
  10568. *
  10569. * @example:
  10570. integer
  10571. integer[+]
  10572. integer[+0]
  10573. integer[-]
  10574. integer[-0]
  10575. */
  10576. integer: function(element, params) {
  10577. var re, z = '0|',
  10578. p = '[1-9]\\d*',
  10579. key = params ? params[0] : '*';
  10580. switch (key) {
  10581. case '+':
  10582. re = p;
  10583. break;
  10584. case '-':
  10585. re = '-' + p;
  10586. break;
  10587. case '+0':
  10588. re = z + p;
  10589. break;
  10590. case '-0':
  10591. re = z + '-' + p;
  10592. break;
  10593. default:
  10594. re = z + '-?' + p;
  10595. }
  10596. re = '^(?:' + re + ')$';
  10597. return new RegExp(re).test(this.value) || (this.messages.integer && this.messages.integer[key]);
  10598. },
  10599. /**
  10600. * match another field
  10601. *
  10602. * @example:
  10603. match[password] Match the password field (two values ​​must be the same)
  10604. match[eq, password] Ditto
  10605. match[neq, count] The value must be not equal to the value of the count field
  10606. match[lt, count] The value must be less than the value of the count field
  10607. match[lte, count] The value must be less than or equal to the value of the count field
  10608. match[gt, count] The value must be greater than the value of the count field
  10609. match[gte, count] The value must be greater than or equal to the value of the count field
  10610. match[gte, startDate, date]
  10611. match[gte, startTime, time]
  10612. **/
  10613. match: function(element, params) {
  10614. if (!params) return;
  10615. var me = this,
  10616. isValid = true,
  10617. a, b,
  10618. key, msg, type = 'eq', parser,
  10619. selector2, elem2, field2;
  10620. if (params.length === 1) {
  10621. key = params[0];
  10622. } else {
  10623. type = params[0];
  10624. key = params[1];
  10625. }
  10626. selector2 = _key2selector(key);
  10627. elem2 = me.$el.find(selector2)[0];
  10628. // If the compared field is not exist
  10629. if (!elem2) return;
  10630. field2 = me.getField(elem2);
  10631. a = me.value;
  10632. b = field2.getValue();
  10633. if (!me._match) {
  10634. me.$el.on('valid'+CLS_NS_FIELD+CLS_NS, selector2, function(){
  10635. $(element).trigger('validate');
  10636. });
  10637. me._match = field2._match = 1;
  10638. }
  10639. // If both fields are blank
  10640. if (!me.required && a === "" && b === "") {
  10641. return null;
  10642. }
  10643. parser = params[2];
  10644. if (parser) {
  10645. if (/^date(time)?$/i.test(parser)) {
  10646. a = _parseDate(a);
  10647. b = _parseDate(b);
  10648. } else if (parser === 'time') {
  10649. a = +a.replace(/:/g, '');
  10650. b = +b.replace(/:/g, '');
  10651. }
  10652. }
  10653. // If the compared field is incorrect, we only ensure that this field is correct.
  10654. if (type !== "eq" && !isNaN(+a) && isNaN(+b)) {
  10655. return true;
  10656. }
  10657. switch (type) {
  10658. case 'lt':
  10659. isValid = +a < +b; break;
  10660. case 'lte':
  10661. isValid = +a <= +b; break;
  10662. case 'gte':
  10663. isValid = +a >= +b; break;
  10664. case 'gt':
  10665. isValid = +a > +b; break;
  10666. case 'neq':
  10667. isValid = a !== b; break;
  10668. default:
  10669. isValid = a === b;
  10670. }
  10671. return isValid || (
  10672. isObject(me.messages.match)
  10673. && me.messages.match[type].replace( '{1}', me._getDisplay( element, field2.display || key ) )
  10674. );
  10675. },
  10676. /**
  10677. * range numbers
  10678. *
  10679. * @example:
  10680. range[0~99] Number 0-99
  10681. range[0~] Number greater than or equal to 0
  10682. range[~100] Number less than or equal to 100
  10683. **/
  10684. range: function(element, params) {
  10685. return this.getRangeMsg(this.value, params);
  10686. },
  10687. /**
  10688. * how many checkbox or radio inputs that checked
  10689. *
  10690. * @example:
  10691. checked; no empty, same to required
  10692. checked[1~3] 1-3 items
  10693. checked[1~] greater than 1 item
  10694. checked[~3] less than 3 items
  10695. checked[3] 3 items
  10696. **/
  10697. checked: function(element, params) {
  10698. if ( !_checkable(element) ) return;
  10699. var me = this,
  10700. elem, count;
  10701. if (element.name) {
  10702. count = me.$el.find('input[name="' + element.name + '"]').filter(function() {
  10703. var el = this;
  10704. if (!elem && _checkable(el)) elem = el;
  10705. return !el.disabled && el.checked;
  10706. }).length;
  10707. } else {
  10708. elem = element;
  10709. count = elem.checked;
  10710. }
  10711. if (params) {
  10712. return me.getRangeMsg(count, params);
  10713. } else {
  10714. return !!count || _getDataMsg(elem, me, '') || me.messages.required || false;
  10715. }
  10716. },
  10717. /**
  10718. * length of a characters (You can pass the second parameter "true", will calculate the length in bytes)
  10719. *
  10720. * @example:
  10721. length[6~16] 6-16 characters
  10722. length[6~] Greater than 6 characters
  10723. length[~16] Less than 16 characters
  10724. length[~16, true] Less than 16 characters, non-ASCII characters calculating two-character
  10725. **/
  10726. length: function(element, params) {
  10727. var value = this.value,
  10728. len = (params[1] === 'true' ? value.replace(rDoubleBytes, 'xx') : value).length;
  10729. return this.getRangeMsg(len, params, (params[1] ? '_2' : ''));
  10730. },
  10731. /**
  10732. * remote validation
  10733. *
  10734. * @description
  10735. * remote([get:]url [, name1, [name2 ...]]);
  10736. * Adaptation three kinds of results (Front for the successful, followed by a failure):
  10737. 1. text:
  10738. '' 'Error Message'
  10739. 2. json:
  10740. {"ok": ""} {"error": "Error Message"}
  10741. 3. json wrapper:
  10742. {"status": 1, "data": {"ok": ""}} {"status": 1, "data": {"error": "Error Message"}}
  10743. * @example
  10744. The simplest: remote(path/to/server);
  10745. With parameters: remote(path/to/server, name1, name2, ...);
  10746. By GET: remote(get:path/to/server, name1, name2, ...);
  10747. Name proxy: remote(path/to/server, name1, proxyname2:name2, proxyname3:#id3, ...)
  10748. Query String remote(path/to/server, foo=1&bar=2, name1, name2, ...)
  10749. */
  10750. remote: function(element, params) {
  10751. if (!params) return;
  10752. var me = this,
  10753. arr = rAjaxType.exec(params[0]),
  10754. rule = me._rules[me._i],
  10755. data = {},
  10756. queryString = '',
  10757. url = arr[3],
  10758. type = arr[2] || 'POST', // GET / POST
  10759. rType = (arr[1]||'').toLowerCase(), // CORS / JSONP
  10760. dataType;
  10761. rule.must = true;
  10762. data[element.name] = me.value;
  10763. // There are extra fields
  10764. if (params[1]) {
  10765. $.map(params.slice(1), function(name) {
  10766. var arr, key;
  10767. if (~name.indexOf('=')) {
  10768. queryString += '&' + name;
  10769. } else {
  10770. arr = name.split(':');
  10771. name = trim(arr[0]);
  10772. key = trim(arr[1]) || name;
  10773. data[ name ] = me.$el.find( _key2selector(key) ).val();
  10774. }
  10775. });
  10776. }
  10777. data = $.param(data) + queryString;
  10778. if (!me.must && rule.data && rule.data === data) {
  10779. return rule.result;
  10780. }
  10781. // Cross-domain request, force jsonp dataType
  10782. if (rType !== 'cors' && /^https?:/.test(url) && !~url.indexOf(location.host)) {
  10783. dataType = 'jsonp';
  10784. }
  10785. // Asynchronous validation need return jqXHR objects
  10786. return $.ajax({
  10787. url: url,
  10788. type: type,
  10789. data: data,
  10790. dataType: dataType
  10791. });
  10792. },
  10793. /**
  10794. * filter characters, direct filtration without prompting error (support custom regular expressions)
  10795. *
  10796. * @example
  10797. * filter filtering unsafe characters
  10798. * filter(regexp) filtering the "regexp" matched characters
  10799. */
  10800. filter: function(element, params) {
  10801. var value = this.value,
  10802. temp = value.replace( params ? (new RegExp("[" + params[0] + "]", "gm")) : rUnsafe, '' );
  10803. if (temp !== value) this.setValue(temp);
  10804. }
  10805. });
  10806. /**
  10807. * Config global options
  10808. *
  10809. * @static config
  10810. * @param {Object} options
  10811. */
  10812. Validator.config = function(key, value) {
  10813. if (isObject(key)) {
  10814. $.each(key, _config);
  10815. }
  10816. else if (isString(key)) {
  10817. _config(key, value);
  10818. }
  10819. function _config(k, o) {
  10820. if (k === 'rules') {
  10821. new Rules(o);
  10822. }
  10823. else if (k === 'messages') {
  10824. new Messages(o);
  10825. }
  10826. else if (k in fieldDefaults) {
  10827. fieldDefaults[k] = o;
  10828. }
  10829. else {
  10830. defaults[k] = o;
  10831. }
  10832. }
  10833. };
  10834. /**
  10835. * Config themes
  10836. *
  10837. * @static setTheme
  10838. * @param {String|Object} name
  10839. * @param {Object} obj
  10840. * @example
  10841. .setTheme( themeName, themeOptions )
  10842. .setTheme( multiThemes )
  10843. */
  10844. Validator.setTheme = function(name, obj) {
  10845. if ( isObject(name) ) {
  10846. $.extend(true, themes, name);
  10847. }
  10848. else if ( isString(name) && isObject(obj) ) {
  10849. themes[name] = $.extend(themes[name], obj);
  10850. }
  10851. };
  10852. /**
  10853. * Resource loader
  10854. *
  10855. * @static load
  10856. * @param {String} str
  10857. * @example
  10858. .load('local=zh-CN') // load: local/zh-CN.js and jquery.validator.css
  10859. .load('local=zh-CN&css=') // load: local/zh-CN.js
  10860. .load('local&css') // load: local/en.js (set <html lang="en">) and jquery.validator.css
  10861. .load('local') // dito
  10862. */
  10863. Validator.load = function(str) {
  10864. if (!str) return;
  10865. var doc = document,
  10866. params = {},
  10867. node = doc.scripts[0],
  10868. dir, el, ONLOAD;
  10869. str.replace(/([^?=&]+)=([^&#]*)/g, function(m, key, value){
  10870. params[key] = value;
  10871. });
  10872. dir = params.dir || Validator.dir;
  10873. if (!Validator.css && params.css !== '') {
  10874. el = doc.createElement('link');
  10875. el.rel = 'stylesheet';
  10876. el.href = Validator.css = dir + 'jquery.validator.css';
  10877. node.parentNode.insertBefore(el, node);
  10878. }
  10879. if (!Validator.local && ~str.indexOf('local') && params.local !== '') {
  10880. Validator.local = (params.local || doc.documentElement.lang || 'en').replace('_','-');
  10881. Validator.pending = 1;
  10882. el = doc.createElement('script');
  10883. el.src = dir + 'local/' + Validator.local + '.js';
  10884. ONLOAD = 'onload' in el ? 'onload' : 'onreadystatechange';
  10885. el[ONLOAD] = function() {
  10886. if (!el.readyState || /loaded|complete/.test(el.readyState)) {
  10887. el = el[ONLOAD] = null;
  10888. delete Validator.pending;
  10889. $(window).triggerHandler('validatorready');
  10890. }
  10891. };
  10892. node.parentNode.insertBefore(el, node);
  10893. }
  10894. };
  10895. // Auto loading resources
  10896. (function(){
  10897. var scripts = document.scripts,
  10898. i = scripts.length, node, arr,
  10899. re = /(.*validator(?:\.min)?.js)(\?.*(?:local|css|dir)(?:=[\w\-]*)?)?/;
  10900. while (i-- && !arr) {
  10901. node = scripts[i];
  10902. arr = (node.hasAttribute ? node.src : node.getAttribute('src',4)||'').match(re);
  10903. }
  10904. if (!arr) return;
  10905. Validator.dir = arr[1].split('/').slice(0, -1).join('/')+'/';
  10906. Validator.load(arr[2]);
  10907. })();
  10908. return $[NS] = Validator;
  10909. }));
  10910. /*********************************
  10911. * Themes, rules, and i18n support
  10912. * Locale: Chinese; 中文
  10913. *********************************/
  10914. (function(factory) {
  10915. typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
  10916. typeof define === 'function' && define.amd ? define('validator-lang',['jquery'], factory) :
  10917. factory(jQuery);
  10918. }(function($) {
  10919. /* Global configuration
  10920. */
  10921. $.validator.config({
  10922. //stopOnError: true,
  10923. //focusCleanup: true,
  10924. //theme: 'yellow_right',
  10925. //timely: 2,
  10926. // Custom rules
  10927. rules: {
  10928. digits: [/^\d+$/, "请填写数字"]
  10929. ,letters: [/^[a-z]+$/i, "请填写字母"]
  10930. ,date: [/^\d{4}-\d{2}-\d{2}$/, "请填写有效的日期,格式:yyyy-mm-dd"]
  10931. ,time: [/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "请填写有效的时间,00:00到23:59之间"]
  10932. ,email: [/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/i, "请填写有效的邮箱"]
  10933. ,url: [/^(https?|s?ftp):\/\/\S+$/i, "请填写有效的网址"]
  10934. ,qq: [/^[1-9]\d{4,}$/, "请填写有效的QQ号"]
  10935. ,IDcard: [/^\d{6}(19|2\d)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)?$/, "请填写正确的身份证号码"]
  10936. ,tel: [/^(?:(?:0\d{2,3}[\- ]?[1-9]\d{6,7})|(?:[48]00[\- ]?[1-9]\d{6}))$/, "请填写有效的电话号码"]
  10937. ,mobile: [/^1[3-9]\d{9}$/, "请填写有效的手机号"]
  10938. ,zipcode: [/^\d{6}$/, "请检查邮政编码格式"]
  10939. ,chinese: [/^[\u0391-\uFFE5]+$/, "请填写中文字符"]
  10940. ,username: [/^\w{3,12}$/, "请填写3-12位数字、字母、下划线"]
  10941. ,password: [/^[\S]{6,16}$/, "请填写6-16位字符,不能包含空格"]
  10942. ,accept: function (element, params){
  10943. if (!params) return true;
  10944. var ext = params[0],
  10945. value = $(element).val();
  10946. return (ext === '*') ||
  10947. (new RegExp(".(?:" + ext + ")$", "i")).test(value) ||
  10948. this.renderMsg("只接受{1}后缀的文件", ext.replace(/\|/g, ','));
  10949. }
  10950. },
  10951. // Default error messages
  10952. messages: {
  10953. 0: "此处",
  10954. fallback: "{0}格式不正确",
  10955. loading: "正在验证...",
  10956. error: "网络异常",
  10957. timeout: "请求超时",
  10958. required: "{0}不能为空",
  10959. remote: "{0}已被使用",
  10960. integer: {
  10961. '*': "请填写整数",
  10962. '+': "请填写正整数",
  10963. '+0': "请填写正整数或0",
  10964. '-': "请填写负整数",
  10965. '-0': "请填写负整数或0"
  10966. },
  10967. match: {
  10968. eq: "{0}与{1}不一致",
  10969. neq: "{0}与{1}不能相同",
  10970. lt: "{0}必须小于{1}",
  10971. gt: "{0}必须大于{1}",
  10972. lte: "{0}不能大于{1}",
  10973. gte: "{0}不能小于{1}"
  10974. },
  10975. range: {
  10976. rg: "请填写{1}到{2}的数",
  10977. gte: "请填写不小于{1}的数",
  10978. lte: "请填写最大{1}的数",
  10979. gtlt: "请填写{1}到{2}之间的数",
  10980. gt: "请填写大于{1}的数",
  10981. lt: "请填写小于{1}的数"
  10982. },
  10983. checked: {
  10984. eq: "请选择{1}项",
  10985. rg: "请选择{1}到{2}项",
  10986. gte: "请至少选择{1}项",
  10987. lte: "请最多选择{1}项"
  10988. },
  10989. length: {
  10990. eq: "请填写{1}个字符",
  10991. rg: "请填写{1}到{2}个字符",
  10992. gte: "请至少填写{1}个字符",
  10993. lte: "请最多填写{1}个字符",
  10994. eq_2: "",
  10995. rg_2: "",
  10996. gte_2: "",
  10997. lte_2: ""
  10998. }
  10999. }
  11000. });
  11001. /* Themes
  11002. */
  11003. var TPL_ARROW = '<span class="n-arrow"><b>◆</b><i>◆</i></span>';
  11004. $.validator.setTheme({
  11005. 'simple_right': {
  11006. formClass: 'n-simple',
  11007. msgClass: 'n-right'
  11008. },
  11009. 'simple_bottom': {
  11010. formClass: 'n-simple',
  11011. msgClass: 'n-bottom'
  11012. },
  11013. 'yellow_top': {
  11014. formClass: 'n-yellow',
  11015. msgClass: 'n-top',
  11016. msgArrow: TPL_ARROW
  11017. },
  11018. 'yellow_right': {
  11019. formClass: 'n-yellow',
  11020. msgClass: 'n-right',
  11021. msgArrow: TPL_ARROW
  11022. },
  11023. 'yellow_right_effect': {
  11024. formClass: 'n-yellow',
  11025. msgClass: 'n-right',
  11026. msgArrow: TPL_ARROW,
  11027. msgShow: function($msgbox, type){
  11028. var $el = $msgbox.children();
  11029. if ($el.is(':animated')) return;
  11030. if (type === 'error') {
  11031. $el.css({left: '20px', opacity: 0})
  11032. .delay(100).show().stop()
  11033. .animate({left: '-4px', opacity: 1}, 150)
  11034. .animate({left: '3px'}, 80)
  11035. .animate({left: 0}, 80);
  11036. } else {
  11037. $el.css({left: 0, opacity: 1}).fadeIn(200);
  11038. }
  11039. },
  11040. msgHide: function($msgbox, type){
  11041. var $el = $msgbox.children();
  11042. $el.stop().delay(100).show()
  11043. .animate({left: '20px', opacity: 0}, 300, function(){
  11044. $msgbox.hide();
  11045. });
  11046. }
  11047. }
  11048. });
  11049. }));
  11050. define('validator',['validator-core', 'validator-lang'], function (Validator, undefined) {
  11051. return Validator;
  11052. });
  11053. define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, Upload, Validator) {
  11054. var Form = {
  11055. config: {
  11056. },
  11057. events: {
  11058. validator: function (form, success, error, submit) {
  11059. if (!form.is("form"))
  11060. return;
  11061. //绑定表单事件
  11062. form.validator($.extend({
  11063. validClass: 'has-success',
  11064. invalidClass: 'has-error',
  11065. bindClassTo: '.form-group',
  11066. formClass: 'n-default n-bootstrap',
  11067. msgClass: 'n-right',
  11068. stopOnError: true,
  11069. display: function (elem) {
  11070. return $(elem).closest('.form-group').find(".control-label").text().replace(/\:/, '');
  11071. },
  11072. target: function (input) {
  11073. var $formitem = $(input).closest('.form-group'),
  11074. $msgbox = $formitem.find('span.msg-box');
  11075. if (!$msgbox.length) {
  11076. return [];
  11077. }
  11078. return $msgbox;
  11079. },
  11080. valid: function (ret) {
  11081. var that = this, submitBtn = $(".layer-footer [type=submit]", form);
  11082. that.holdSubmit();
  11083. $(".layer-footer [type=submit]", form).addClass("disabled");
  11084. //验证通过提交表单
  11085. Form.api.submit($(ret), function (data, ret) {
  11086. that.holdSubmit(false);
  11087. submitBtn.removeClass("disabled");
  11088. if (typeof success === 'function') {
  11089. if (false === success.call($(this), data, ret)) {
  11090. return false;
  11091. }
  11092. }
  11093. //提示及关闭当前窗口
  11094. var msg = ret.hasOwnProperty("msg") && ret.msg !== "" ? ret.msg : __('Operation completed');
  11095. parent.Toastr.success(msg);
  11096. parent.$(".btn-refresh").trigger("click");
  11097. var index = parent.Layer.getFrameIndex(window.name);
  11098. parent.Layer.close(index);
  11099. return false;
  11100. }, function (data, ret) {
  11101. that.holdSubmit(false);
  11102. submitBtn.removeClass("disabled");
  11103. if (typeof error === 'function') {
  11104. if (false === error.call($(this), data, ret)) {
  11105. return false;
  11106. }
  11107. }
  11108. }, submit);
  11109. return false;
  11110. }
  11111. }, form.data("validator-options") || {}));
  11112. //移除提交按钮的disabled类
  11113. $(".layer-footer [type=submit],.fixed-footer [type=submit],.normal-footer [type=submit]", form).removeClass("disabled");
  11114. },
  11115. selectpicker: function (form) {
  11116. //绑定select元素事件
  11117. if ($(".selectpicker", form).size() > 0) {
  11118. require(['bootstrap-select', 'bootstrap-select-lang'], function () {
  11119. $('.selectpicker', form).selectpicker();
  11120. });
  11121. }
  11122. },
  11123. selectpage: function (form) {
  11124. //绑定selectpage元素事件
  11125. if ($(".selectpage", form).size() > 0) {
  11126. require(['selectpage'], function () {
  11127. $('.selectpage', form).selectPage({
  11128. source: 'ajax/selectpage',
  11129. });
  11130. });
  11131. //给隐藏的元素添加上validate验证触发事件
  11132. $(form).on("change", ".selectpage-input-hidden", function () {
  11133. $(this).trigger("validate");
  11134. });
  11135. }
  11136. },
  11137. cxselect: function (form) {
  11138. //绑定cxselect元素事件
  11139. if ($("[data-toggle='cxselect']", form).size() > 0) {
  11140. require(['cxselect'], function () {
  11141. $.cxSelect.defaults.jsonName = 'name';
  11142. $.cxSelect.defaults.jsonValue = 'value';
  11143. $.cxSelect.defaults.jsonSpace = 'data';
  11144. $("[data-toggle='cxselect']", form).cxSelect();
  11145. });
  11146. }
  11147. },
  11148. citypicker: function (form) {
  11149. //绑定城市远程插件
  11150. if ($("[data-toggle='city-picker']", form).size() > 0) {
  11151. require(['citypicker'], function () {});
  11152. }
  11153. },
  11154. datetimepicker: function (form) {
  11155. //绑定日期时间元素事件
  11156. if ($(".datetimepicker", form).size() > 0) {
  11157. require(['bootstrap-datetimepicker'], function () {
  11158. var options = {
  11159. format: 'YYYY-MM-DD HH:mm:ss',
  11160. icons: {
  11161. time: 'fa fa-clock-o',
  11162. date: 'fa fa-calendar',
  11163. up: 'fa fa-chevron-up',
  11164. down: 'fa fa-chevron-down',
  11165. previous: 'fa fa-chevron-left',
  11166. next: 'fa fa-chevron-right',
  11167. today: 'fa fa-history',
  11168. clear: 'fa fa-trash',
  11169. close: 'fa fa-remove'
  11170. },
  11171. showTodayButton: true,
  11172. showClose: true
  11173. };
  11174. $('.datetimepicker', form).parent().css('position', 'relative');
  11175. $('.datetimepicker', form).datetimepicker(options);
  11176. });
  11177. }
  11178. },
  11179. plupload: function (form) {
  11180. //绑定plupload上传元素事件
  11181. if ($(".plupload", form).size() > 0) {
  11182. Upload.api.plupload($(".plupload", form));
  11183. }
  11184. },
  11185. faselect: function (form) {
  11186. //绑定fachoose选择附件事件
  11187. if ($(".fachoose", form).size() > 0) {
  11188. $(".fachoose", form).on('click', function () {
  11189. var that = this;
  11190. var multiple = $(this).data("multiple") ? $(this).data("multiple") : false;
  11191. var mimetype = $(this).data("mimetype") ? $(this).data("mimetype") : '';
  11192. parent.Fast.api.open("general/attachment/select?element_id=" + $(this).attr("id") + "&multiple=" + multiple + "&mimetype=" + mimetype, __('Choose'), {
  11193. callback: function (data) {
  11194. var button = $("#" + $(that).attr("id"));
  11195. var maxcount = $(button).data("maxcount");
  11196. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  11197. maxcount = typeof maxcount !== "undefined" ? maxcount : 0;
  11198. if (input_id && data.multiple) {
  11199. var urlArr = [];
  11200. var inputObj = $("#" + input_id);
  11201. var value = $.trim(inputObj.val());
  11202. if (value !== "") {
  11203. urlArr.push(inputObj.val());
  11204. }
  11205. urlArr.push(data.url)
  11206. var result = urlArr.join(",");
  11207. if (maxcount > 0) {
  11208. var nums = value === '' ? 0 : value.split(/\,/).length;
  11209. var files = data.url !== "" ? data.url.split(/\,/) : [];
  11210. var remains = maxcount - nums;
  11211. if (files.length > remains) {
  11212. Toastr.error(__('You can choose up to %d file%s', remains));
  11213. return false;
  11214. }
  11215. }
  11216. inputObj.val(result).trigger("change");
  11217. } else {
  11218. $("#" + input_id).val(data.url).trigger("change");
  11219. }
  11220. }
  11221. });
  11222. return false;
  11223. });
  11224. }
  11225. },
  11226. fieldlist: function (form) {
  11227. if ($(".fieldlist", form).size() > 0) {
  11228. $(".fieldlist", form).on("click", ".append", function () {
  11229. var rel = parseInt($(this).closest("dl").attr("rel")) + 1;
  11230. var name = $(this).closest("dl").data("name");
  11231. $(this).closest("dl").attr("rel", rel);
  11232. $('<dd class="form-inline"><input type="text" name="' + name + '[field][' + rel + ']" class="form-control" value="" size="10" /> <input type="text" name="' + name + '[value][' + rel + ']" class="form-control" value="" size="40" /> <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span></dd>').insertBefore($(this).parent());
  11233. });
  11234. $(".fieldlist", form).on("click", "dd .btn-remove", function () {
  11235. $(this).parent().remove();
  11236. });
  11237. //拖拽排序
  11238. require(['dragsort'], function () {
  11239. //绑定拖动排序
  11240. $("dl.fieldlist", form).dragsort({
  11241. itemSelector: 'dd',
  11242. dragSelector: ".btn-dragsort",
  11243. dragEnd: function () {
  11244. },
  11245. placeHolderTemplate: "<dd></dd>"
  11246. });
  11247. });
  11248. }
  11249. },
  11250. bindevent: function (form) {
  11251. }
  11252. },
  11253. api: {
  11254. submit: function (form, success, error, submit) {
  11255. if (form.size() === 0)
  11256. return Toastr.error("表单未初始化完成,无法提交");
  11257. if (typeof submit === 'function') {
  11258. if (false === submit.call(form)) {
  11259. return false;
  11260. }
  11261. }
  11262. var type = form.attr("method").toUpperCase();
  11263. type = type && (type === 'GET' || type === 'POST') ? type : 'GET';
  11264. url = form.attr("action");
  11265. url = url ? url : location.href;
  11266. //修复当存在多选项元素时提交的BUG
  11267. var params = {};
  11268. var multipleList = $("[name$='[]']", form);
  11269. if (multipleList.size() > 0) {
  11270. var postFields = form.serializeArray().map(function (obj) {
  11271. return $(obj).prop("name");
  11272. });
  11273. $.each(multipleList, function (i, j) {
  11274. if (postFields.indexOf($(this).prop("name")) < 0) {
  11275. params[$(this).prop("name")] = '';
  11276. }
  11277. });
  11278. }
  11279. //调用Ajax请求方法
  11280. Fast.api.ajax({
  11281. type: type,
  11282. url: url,
  11283. data: form.serialize() + (Object.keys(params).length > 0 ? '&' + $.param(params) : ''),
  11284. dataType: 'json',
  11285. complete: function (xhr) {
  11286. var token = xhr.getResponseHeader('__token__');
  11287. if (token) {
  11288. $("input[name='__token__']", form).val(token);
  11289. }
  11290. }
  11291. }, function (data, ret) {
  11292. $('.form-group', form).removeClass('has-feedback has-success has-error');
  11293. if (data && typeof data === 'object') {
  11294. //刷新客户端token
  11295. if (typeof data.token !== 'undefined') {
  11296. $("input[name='__token__']", form).val(data.token);
  11297. }
  11298. //调用客户端事件
  11299. if (typeof data.callback !== 'undefined' && typeof data.callback === 'function') {
  11300. data.callback.call(form, data);
  11301. }
  11302. }
  11303. if (typeof success === 'function') {
  11304. if (false === success.call(form, data, ret)) {
  11305. return false;
  11306. }
  11307. }
  11308. }, function (data, ret) {
  11309. if (data && typeof data === 'object' && typeof data.token !== 'undefined') {
  11310. $("input[name='__token__']", form).val(data.token);
  11311. }
  11312. if (typeof error === 'function') {
  11313. if (false === error.call(form, data, ret)) {
  11314. return false;
  11315. }
  11316. }
  11317. });
  11318. return false;
  11319. },
  11320. bindevent: function (form, success, error, submit) {
  11321. form = typeof form === 'object' ? form : $(form);
  11322. var events = Form.events;
  11323. events.bindevent(form);
  11324. events.validator(form, success, error, submit);
  11325. events.selectpicker(form);
  11326. events.selectpage(form);
  11327. events.cxselect(form);
  11328. events.citypicker(form);
  11329. events.datetimepicker(form);
  11330. events.plupload(form);
  11331. events.faselect(form);
  11332. events.fieldlist(form);
  11333. },
  11334. custom: {}
  11335. },
  11336. };
  11337. return Form;
  11338. });
  11339. // jQuery List DragSort v0.5.2
  11340. // Website: http://dragsort.codeplex.com/
  11341. // License: http://dragsort.codeplex.com/license
  11342. (function($) {
  11343. $.fn.dragsort = function(options) {
  11344. if (options == "destroy") {
  11345. $(this.selector).trigger("dragsort-uninit");
  11346. return;
  11347. }
  11348. var opts = $.extend({}, $.fn.dragsort.defaults, options);
  11349. var lists = [];
  11350. var list = null, lastPos = null;
  11351. this.each(function(i, cont) {
  11352. //if list container is table, the browser automatically wraps rows in tbody if not specified so change list container to tbody so that children returns rows as user expected
  11353. if ($(cont).is("table") && $(cont).children().size() == 1 && $(cont).children().is("tbody"))
  11354. cont = $(cont).children().get(0);
  11355. var newList = {
  11356. draggedItem: null,
  11357. placeHolderItem: null,
  11358. pos: null,
  11359. offset: null,
  11360. offsetLimit: null,
  11361. scroll: null,
  11362. container: cont,
  11363. init: function() {
  11364. //set options to default values if not set
  11365. opts.tagName = opts.tagName == "" ? ($(this.container).children().size() == 0 ? "li" : $(this.container).children().get(0).tagName.toLowerCase()) : opts.tagName;
  11366. if (opts.itemSelector == "")
  11367. opts.itemSelector = opts.tagName;
  11368. if (opts.dragSelector == "")
  11369. opts.dragSelector = opts.tagName;
  11370. if (opts.placeHolderTemplate == "")
  11371. opts.placeHolderTemplate = "<" + opts.tagName + ">&nbsp;</" + opts.tagName + ">";
  11372. //listidx allows reference back to correct list variable instance
  11373. $(this.container).attr("data-listidx", i).mousedown(this.grabItem).bind("dragsort-uninit", this.uninit);
  11374. this.styleDragHandlers(true);
  11375. },
  11376. uninit: function() {
  11377. var list = lists[$(this).attr("data-listidx")];
  11378. $(list.container).unbind("mousedown", list.grabItem).unbind("dragsort-uninit");
  11379. list.styleDragHandlers(false);
  11380. },
  11381. getItems: function() {
  11382. return $(this.container).children(opts.itemSelector);
  11383. },
  11384. styleDragHandlers: function(cursor) {
  11385. this.getItems().map(function() { return $(this).is(opts.dragSelector) ? this : $(this).find(opts.dragSelector).get(); }).css("cursor", cursor ? "pointer" : "");
  11386. },
  11387. grabItem: function(e) {
  11388. var list = lists[$(this).attr("data-listidx")];
  11389. var item = $(e.target).closest("[data-listidx] > " + opts.tagName).get(0);
  11390. var insideMoveableItem = list.getItems().filter(function() { return this == item; }).size() > 0;
  11391. //if not left click or if clicked on excluded element (e.g. text box) or not a moveable list item return
  11392. if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude) || $(e.target).closest(opts.dragSelectorExclude).size() > 0 || !insideMoveableItem)
  11393. return;
  11394. //prevents selection, stops issue on Fx where dragging hyperlink doesn't work and on IE where it triggers mousemove even though mouse hasn't moved,
  11395. //does also stop being able to click text boxes hence dragging on text boxes by default is disabled in dragSelectorExclude
  11396. //e.preventDefault();
  11397. //change cursor to move while dragging
  11398. var dragHandle = e.target;
  11399. while (!$(dragHandle).is(opts.dragSelector)) {
  11400. if (dragHandle == this) return;
  11401. dragHandle = dragHandle.parentNode;
  11402. }
  11403. $(dragHandle).attr("data-cursor", $(dragHandle).css("cursor"));
  11404. $(dragHandle).css("cursor", "move");
  11405. //on mousedown wait for movement of mouse before triggering dragsort script (dragStart) to allow clicking of hyperlinks to work
  11406. var listElem = this;
  11407. var trigger = function() {
  11408. list.dragStart.call(listElem, e);
  11409. $(list.container).unbind("mousemove", trigger);
  11410. };
  11411. $(list.container).mousemove(trigger).mouseup(function() { $(list.container).unbind("mousemove", trigger); $(dragHandle).css("cursor", $(dragHandle).attr("data-cursor")); });
  11412. },
  11413. dragStart: function(e) {
  11414. if (list != null && list.draggedItem != null)
  11415. list.dropItem();
  11416. list = lists[$(this).attr("data-listidx")];
  11417. list.draggedItem = $(e.target).closest("[data-listidx] > " + opts.tagName)
  11418. //record current position so on dragend we know if the dragged item changed position or not, not using getItems to allow dragsort to restore dragged item to original location in relation to fixed items
  11419. list.draggedItem.attr("data-origpos", $(this).attr("data-listidx") + "-" + $(list.container).children().index(list.draggedItem));
  11420. //calculate mouse offset relative to draggedItem
  11421. var mt = parseInt(list.draggedItem.css("marginTop"));
  11422. var ml = parseInt(list.draggedItem.css("marginLeft"));
  11423. list.offset = list.draggedItem.offset();
  11424. list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1;
  11425. list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1;
  11426. //calculate box the dragged item can't be dragged outside of
  11427. if (!opts.dragBetween) {
  11428. var containerHeight = $(list.container).outerHeight() == 0 ? Math.max(1, Math.round(0.5 + list.getItems().size() * list.draggedItem.outerWidth() / $(list.container).outerWidth())) * list.draggedItem.outerHeight() : $(list.container).outerHeight();
  11429. list.offsetLimit = $(list.container).offset();
  11430. list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth();
  11431. list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight();
  11432. }
  11433. //create placeholder item
  11434. var h = list.draggedItem.height();
  11435. var w = list.draggedItem.width();
  11436. if (opts.tagName == "tr") {
  11437. list.draggedItem.children().each(function() { $(this).width($(this).width()); });
  11438. list.placeHolderItem = list.draggedItem.clone().attr("data-placeholder", true);
  11439. list.draggedItem.after(list.placeHolderItem);
  11440. //list.placeHolderItem.children().each(function() { $(this).css({ borderWidth:0, width: $(this).width() + 1, height: $(this).height() + 1 }).html("&nbsp;"); });
  11441. list.placeHolderItem.children().each(function() { $(this).html("&nbsp;"); });
  11442. } else {
  11443. list.draggedItem.after(opts.placeHolderTemplate);
  11444. list.placeHolderItem = list.draggedItem.next().css({ height: h, width: w }).attr("data-placeholder", true);
  11445. }
  11446. if (opts.tagName == "td") {
  11447. var listTable = list.draggedItem.closest("table").get(0);
  11448. $("<table id='" + listTable.id + "' style='border-width: 0px;' class='dragSortItem " + listTable.className + "'><tr></tr></table>").appendTo("body").children().append(list.draggedItem);
  11449. }
  11450. //style draggedItem while dragging
  11451. var orig = list.draggedItem.attr("style");
  11452. list.draggedItem.attr("data-origstyle", orig ? orig : "");
  11453. list.draggedItem.css({ position: "absolute", opacity: 0.8, "z-index": 999, height: h, width: w });
  11454. //auto-scroll setup
  11455. list.scroll = { moveX: 0, moveY: 0, maxX: $(document).width() - $(window).width(), maxY: $(document).height() - $(window).height() };
  11456. list.scroll.scrollY = window.setInterval(function() {
  11457. if (opts.scrollContainer != window) {
  11458. $(opts.scrollContainer).scrollTop($(opts.scrollContainer).scrollTop() + list.scroll.moveY);
  11459. return;
  11460. }
  11461. var t = $(opts.scrollContainer).scrollTop();
  11462. if (list.scroll.moveY > 0 && t < list.scroll.maxY || list.scroll.moveY < 0 && t > 0) {
  11463. $(opts.scrollContainer).scrollTop(t + list.scroll.moveY);
  11464. list.draggedItem.css("top", list.draggedItem.offset().top + list.scroll.moveY + 1);
  11465. }
  11466. }, 10);
  11467. list.scroll.scrollX = window.setInterval(function() {
  11468. if (opts.scrollContainer != window) {
  11469. $(opts.scrollContainer).scrollLeft($(opts.scrollContainer).scrollLeft() + list.scroll.moveX);
  11470. return;
  11471. }
  11472. var l = $(opts.scrollContainer).scrollLeft();
  11473. if (list.scroll.moveX > 0 && l < list.scroll.maxX || list.scroll.moveX < 0 && l > 0) {
  11474. $(opts.scrollContainer).scrollLeft(l + list.scroll.moveX);
  11475. list.draggedItem.css("left", list.draggedItem.offset().left + list.scroll.moveX + 1);
  11476. }
  11477. }, 10);
  11478. //misc
  11479. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  11480. list.setPos(e.pageX, e.pageY);
  11481. $(document).bind("mousemove", list.swapItems);
  11482. $(document).bind("mouseup", list.dropItem);
  11483. if (opts.scrollContainer != window)
  11484. $(window).bind("wheel", list.wheel);
  11485. },
  11486. //set position of draggedItem
  11487. setPos: function(x, y) {
  11488. //remove mouse offset so mouse cursor remains in same place on draggedItem instead of top left corner
  11489. var top = y - this.offset.top;
  11490. var left = x - this.offset.left;
  11491. //limit top, left to within box draggedItem can't be dragged outside of
  11492. if (!opts.dragBetween) {
  11493. top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top));
  11494. left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left));
  11495. }
  11496. //adjust top & left calculations to parent offset
  11497. var parent = this.draggedItem.offsetParent().not("body").offset(); //offsetParent returns body even when it's static, if not static offset is only factoring margin
  11498. if (parent != null) {
  11499. top -= parent.top;
  11500. left -= parent.left;
  11501. }
  11502. //set x or y auto-scroll amount
  11503. if (opts.scrollContainer == window) {
  11504. y -= $(window).scrollTop();
  11505. x -= $(window).scrollLeft();
  11506. y = Math.max(0, y - $(window).height() + 5) + Math.min(0, y - 5);
  11507. x = Math.max(0, x - $(window).width() + 5) + Math.min(0, x - 5);
  11508. } else {
  11509. var cont = $(opts.scrollContainer);
  11510. var offset = cont.offset();
  11511. y = Math.max(0, y - cont.height() - offset.top) + Math.min(0, y - offset.top);
  11512. x = Math.max(0, x - cont.width() - offset.left) + Math.min(0, x - offset.left);
  11513. }
  11514. list.scroll.moveX = x == 0 ? 0 : x * opts.scrollSpeed / Math.abs(x);
  11515. list.scroll.moveY = y == 0 ? 0 : y * opts.scrollSpeed / Math.abs(y);
  11516. //move draggedItem to new mouse cursor location
  11517. this.draggedItem.css({ top: top, left: left });
  11518. },
  11519. //if scroll container is a div allow mouse wheel to scroll div instead of window when mouse is hovering over
  11520. wheel: function(e) {
  11521. if (list && opts.scrollContainer != window) {
  11522. var cont = $(opts.scrollContainer);
  11523. var offset = cont.offset();
  11524. e = e.originalEvent;
  11525. if (e.clientX > offset.left && e.clientX < offset.left + cont.width() && e.clientY > offset.top && e.clientY < offset.top + cont.height()) {
  11526. var deltaY = (e.deltaMode == 0 ? 1 : 10) * e.deltaY;
  11527. cont.scrollTop(cont.scrollTop() + deltaY);
  11528. e.preventDefault();
  11529. }
  11530. }
  11531. },
  11532. //build a table recording all the positions of the moveable list items
  11533. buildPositionTable: function() {
  11534. var pos = [];
  11535. this.getItems().not([list.draggedItem[0], list.placeHolderItem[0]]).each(function(i) {
  11536. var loc = $(this).offset();
  11537. loc.right = loc.left + $(this).outerWidth();
  11538. loc.bottom = loc.top + $(this).outerHeight();
  11539. loc.elm = this;
  11540. pos[i] = loc;
  11541. });
  11542. this.pos = pos;
  11543. },
  11544. dropItem: function() {
  11545. if (list.draggedItem == null)
  11546. return;
  11547. //list.draggedItem.attr("style", "") doesn't work on IE8 and jQuery 1.5 or lower
  11548. //list.draggedItem.removeAttr("style") doesn't work on chrome and jQuery 1.6 (works jQuery 1.5 or lower)
  11549. var orig = list.draggedItem.attr("data-origstyle");
  11550. list.draggedItem.attr("style", orig);
  11551. if (orig == "")
  11552. list.draggedItem.removeAttr("style");
  11553. list.draggedItem.removeAttr("data-origstyle");
  11554. list.styleDragHandlers(true);
  11555. list.placeHolderItem.before(list.draggedItem);
  11556. list.placeHolderItem.remove();
  11557. $("[data-droptarget], .dragSortItem").remove();
  11558. window.clearInterval(list.scroll.scrollY);
  11559. window.clearInterval(list.scroll.scrollX);
  11560. //if position changed call dragEnd
  11561. if (list.draggedItem.attr("data-origpos") != $(lists).index(list) + "-" + $(list.container).children().index(list.draggedItem))
  11562. if (opts.dragEnd.apply(list.draggedItem) == false) { //if dragEnd returns false revert order
  11563. var pos = list.draggedItem.attr("data-origpos").split('-');
  11564. var nextItem = $(lists[pos[0]].container).children().not(list.draggedItem).eq(pos[1]);
  11565. if (nextItem.size() > 0)
  11566. nextItem.before(list.draggedItem);
  11567. else if (pos[1] == 0) //was the only item in list
  11568. $(lists[pos[0]].container).prepend(list.draggedItem);
  11569. else //was the last item in list
  11570. $(lists[pos[0]].container).append(list.draggedItem);
  11571. }
  11572. list.draggedItem.removeAttr("data-origpos");
  11573. list.draggedItem = null;
  11574. $(document).unbind("mousemove", list.swapItems);
  11575. $(document).unbind("mouseup", list.dropItem);
  11576. if (opts.scrollContainer != window)
  11577. $(window).unbind("wheel", list.wheel);
  11578. return false;
  11579. },
  11580. //swap the draggedItem (represented visually by placeholder) with the list item the it has been dragged on top of
  11581. swapItems: function(e) {
  11582. if (list.draggedItem == null)
  11583. return false;
  11584. //move draggedItem to mouse location
  11585. list.setPos(e.pageX, e.pageY);
  11586. //retrieve list and item position mouse cursor is over
  11587. var ei = list.findPos(e.pageX, e.pageY);
  11588. var nlist = list;
  11589. for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) {
  11590. ei = lists[i].findPos(e.pageX, e.pageY);
  11591. nlist = lists[i];
  11592. }
  11593. //if not over another moveable list item return
  11594. if (ei == -1)
  11595. return false;
  11596. //save fixed items locations
  11597. var children = function() { return $(nlist.container).children().not(nlist.draggedItem); };
  11598. var fixed = children().not(opts.itemSelector).each(function(i) { this.idx = children().index(this); });
  11599. //if moving draggedItem up or left place placeHolder before list item the dragged item is hovering over otherwise place it after
  11600. if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left)
  11601. $(nlist.pos[ei].elm).before(list.placeHolderItem);
  11602. else
  11603. $(nlist.pos[ei].elm).after(list.placeHolderItem);
  11604. //restore fixed items location
  11605. fixed.each(function() {
  11606. var elm = children().eq(this.idx).get(0);
  11607. if (this != elm && children().index(this) < this.idx)
  11608. $(this).insertAfter(elm);
  11609. else if (this != elm)
  11610. $(this).insertBefore(elm);
  11611. });
  11612. //misc
  11613. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  11614. lastPos = list.draggedItem.offset();
  11615. return false;
  11616. },
  11617. //returns the index of the list item the mouse is over
  11618. findPos: function(x, y) {
  11619. for (var i = 0; i < this.pos.length; i++) {
  11620. if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y)
  11621. return i;
  11622. }
  11623. return -1;
  11624. },
  11625. //create drop targets which are placeholders at the end of other lists to allow dragging straight to the last position
  11626. createDropTargets: function() {
  11627. if (!opts.dragBetween)
  11628. return;
  11629. $(lists).each(function() {
  11630. var ph = $(this.container).find("[data-placeholder]");
  11631. var dt = $(this.container).find("[data-droptarget]");
  11632. if (ph.size() > 0 && dt.size() > 0)
  11633. dt.remove();
  11634. else if (ph.size() == 0 && dt.size() == 0) {
  11635. if (opts.tagName == "td")
  11636. $(opts.placeHolderTemplate).attr("data-droptarget", true).appendTo(this.container);
  11637. else
  11638. //list.placeHolderItem.clone().removeAttr("data-placeholder") crashes in IE7 and jquery 1.5.1 (doesn't in jquery 1.4.2 or IE8)
  11639. $(this.container).append(list.placeHolderItem.removeAttr("data-placeholder").clone().attr("data-droptarget", true));
  11640. list.placeHolderItem.attr("data-placeholder", true);
  11641. }
  11642. });
  11643. }
  11644. };
  11645. newList.init();
  11646. lists.push(newList);
  11647. });
  11648. return this;
  11649. };
  11650. $.fn.dragsort.defaults = {
  11651. tagName:"",
  11652. itemSelector: "",
  11653. dragSelector: "",
  11654. dragSelectorExclude: "input, textarea",
  11655. dragEnd: function() { },
  11656. dragBetween: false,
  11657. placeHolderTemplate: "",
  11658. scrollContainer: window,
  11659. scrollSpeed: 5
  11660. };
  11661. })(jQuery);
  11662. define("dragsort", function(){});
  11663. /*!
  11664. * jquery.event.drag - v 2.2
  11665. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  11666. * Open Source MIT License - http://threedubmedia.com/code/license
  11667. */
  11668. ;(function(e){e.fn.drag=function(k,g,j){var i=typeof k=="string"?k:"",h=e.isFunction(k)?k:e.isFunction(g)?g:null;if(i.indexOf("drag")!==0){i="drag"+i}j=(k==h?g:j)||{};return h?this.bind(i,j,h):this.trigger(i)};var b=e.event,a=b.special,d=a.drag={defaults:{which:1,distance:0,not:":input",handle:null,relative:false,drop:true,click:false},datakey:"dragdata",noBubble:true,add:function(i){var h=e.data(this,d.datakey),g=i.data||{};h.related+=1;e.each(d.defaults,function(j,k){if(g[j]!==undefined){h[j]=g[j]}})},remove:function(){e.data(this,d.datakey).related-=1},setup:function(){if(e.data(this,d.datakey)){return}var g=e.extend({related:0},d.defaults);e.data(this,d.datakey,g);b.add(this,"touchstart mousedown",d.init,g);if(this.attachEvent){this.attachEvent("ondragstart",d.dontstart)}},teardown:function(){var g=e.data(this,d.datakey)||{};if(g.related){return}e.removeData(this,d.datakey);b.remove(this,"touchstart mousedown",d.init);d.textselect(true);if(this.detachEvent){this.detachEvent("ondragstart",d.dontstart)}},init:function(i){if(d.touched){return}var g=i.data,h;if(i.which!=0&&g.which>0&&i.which!=g.which){return}if(e(i.target).is(g.not)){return}if(g.handle&&!e(i.target).closest(g.handle,i.currentTarget).length){return}d.touched=i.type=="touchstart"?this:null;g.propagates=1;g.mousedown=this;g.interactions=[d.interaction(this,g)];g.target=i.target;g.pageX=i.pageX;g.pageY=i.pageY;g.dragging=null;h=d.hijack(i,"draginit",g);if(!g.propagates){return}h=d.flatten(h);if(h&&h.length){g.interactions=[];e.each(h,function(){g.interactions.push(d.interaction(this,g))})}g.propagates=g.interactions.length;if(g.drop!==false&&a.drop){a.drop.handler(i,g)}d.textselect(false);if(d.touched){b.add(d.touched,"touchmove touchend",d.handler,g)}else{b.add(document,"mousemove mouseup",d.handler,g)}if(!d.touched||g.live){return false}},interaction:function(h,g){var i=e(h)[g.relative?"position":"offset"]()||{top:0,left:0};return{drag:h,callback:new d.callback(),droppable:[],offset:i}},handler:function(h){var g=h.data;switch(h.type){case !g.dragging&&"touchmove":h.preventDefault();case !g.dragging&&"mousemove":if(Math.pow(h.pageX-g.pageX,2)+Math.pow(h.pageY-g.pageY,2)<Math.pow(g.distance,2)){break}h.target=g.target;d.hijack(h,"dragstart",g);if(g.propagates){g.dragging=true}case"touchmove":h.preventDefault();case"mousemove":if(g.dragging){d.hijack(h,"drag",g);if(g.propagates){if(g.drop!==false&&a.drop){a.drop.handler(h,g)}break}h.type="mouseup"}case"touchend":case"mouseup":default:if(d.touched){b.remove(d.touched,"touchmove touchend",d.handler)}else{b.remove(document,"mousemove mouseup",d.handler)}if(g.dragging){if(g.drop!==false&&a.drop){a.drop.handler(h,g)}d.hijack(h,"dragend",g)}d.textselect(true);if(g.click===false&&g.dragging){e.data(g.mousedown,"suppress.click",new Date().getTime()+5)}g.dragging=d.touched=false;break}},hijack:function(h,o,r,p,k){if(!r){return}var q={event:h.originalEvent,type:h.type},m=o.indexOf("drop")?"drag":"drop",t,l=p||0,j,g,s,n=!isNaN(p)?p:r.interactions.length;h.type=o;h.originalEvent=null;r.results=[];do{if(j=r.interactions[l]){if(o!=="dragend"&&j.cancelled){continue}s=d.properties(h,r,j);j.results=[];e(k||j[m]||r.droppable).each(function(u,i){s.target=i;h.isPropagationStopped=function(){return false};t=i?b.dispatch.call(i,h,s):null;if(t===false){if(m=="drag"){j.cancelled=true;r.propagates-=1}if(o=="drop"){j[m][u]=null}}else{if(o=="dropinit"){j.droppable.push(d.element(t)||i)}}if(o=="dragstart"){j.proxy=e(d.element(t)||j.drag)[0]}j.results.push(t);delete h.result;if(o!=="dropinit"){return t}});r.results[l]=d.flatten(j.results);if(o=="dropinit"){j.droppable=d.flatten(j.droppable)}if(o=="dragstart"&&!j.cancelled){s.update()}}}while(++l<n);h.type=q.type;h.originalEvent=q.event;return d.flatten(r.results)},properties:function(i,g,h){var j=h.callback;j.drag=h.drag;j.proxy=h.proxy||h.drag;j.startX=g.pageX;j.startY=g.pageY;j.deltaX=i.pageX-g.pageX;j.deltaY=i.pageY-g.pageY;j.originalX=h.offset.left;j.originalY=h.offset.top;j.offsetX=j.originalX+j.deltaX;j.offsetY=j.originalY+j.deltaY;j.drop=d.flatten((h.drop||[]).slice());j.available=d.flatten((h.droppable||[]).slice());return j},element:function(g){if(g&&(g.jquery||g.nodeType==1)){return g}},flatten:function(g){return e.map(g,function(h){return h&&h.jquery?e.makeArray(h):h&&h.length?d.flatten(h):h})},textselect:function(g){e(document)[g?"unbind":"bind"]("selectstart",d.dontstart).css("MozUserSelect",g?"":"none");document.unselectable=g?"off":"on"},dontstart:function(){return false},callback:function(){}};d.callback.prototype={update:function(){if(a.drop&&this.available.length){e.each(this.available,function(g){a.drop.locate(this,g)})}}};var f=b.dispatch;b.dispatch=function(g){if(e.data(this,"suppress."+g.type)-new Date().getTime()>0){e.removeData(this,"suppress."+g.type);return}return f.apply(this,arguments)};var c=b.fixHooks.touchstart=b.fixHooks.touchmove=b.fixHooks.touchend=b.fixHooks.touchcancel={props:"clientX clientY pageX pageY screenX screenY".split(" "),filter:function(h,i){if(i){var g=(i.touches&&i.touches[0])||(i.changedTouches&&i.changedTouches[0])||null;if(g){e.each(c.props,function(j,k){h[k]=g[k]})}}return h}};a.draginit=a.dragstart=a.dragend=d})(jQuery);
  11669. define("drag", function(){});
  11670. /*!
  11671. * jquery.event.drop - v 2.2
  11672. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  11673. * Open Source MIT License - http://threedubmedia.com/code/license
  11674. */
  11675. ;(function(d){d.fn.drop=function(i,e,h){var g=typeof i=="string"?i:"",f=d.isFunction(i)?i:d.isFunction(e)?e:null;if(g.indexOf("drop")!==0){g="drop"+g}h=(i==f?e:h)||{};return f?this.bind(g,h,f):this.trigger(g)};d.drop=function(e){e=e||{};b.multi=e.multi===true?Infinity:e.multi===false?1:!isNaN(e.multi)?e.multi:b.multi;b.delay=e.delay||b.delay;b.tolerance=d.isFunction(e.tolerance)?e.tolerance:e.tolerance===null?null:b.tolerance;b.mode=e.mode||b.mode||"intersect"};var c=d.event,a=c.special,b=d.event.special.drop={multi:1,delay:20,mode:"overlap",targets:[],datakey:"dropdata",noBubble:true,add:function(f){var e=d.data(this,b.datakey);e.related+=1},remove:function(){d.data(this,b.datakey).related-=1},setup:function(){if(d.data(this,b.datakey)){return}var e={related:0,active:[],anyactive:0,winner:0,location:{}};d.data(this,b.datakey,e);b.targets.push(this);return false},teardown:function(){var f=d.data(this,b.datakey)||{};if(f.related){return}d.removeData(this,b.datakey);var e=this;b.targets=d.grep(b.targets,function(g){return(g!==e)})},handler:function(g,e){var f,h;if(!e){return}switch(g.type){case"mousedown":case"touchstart":h=d(b.targets);if(typeof e.drop=="string"){h=h.filter(e.drop)}h.each(function(){var i=d.data(this,b.datakey);i.active=[];i.anyactive=0;i.winner=0});e.droppable=h;a.drag.hijack(g,"dropinit",e);break;case"mousemove":case"touchmove":b.event=g;if(!b.timer){b.tolerate(e)}break;case"mouseup":case"touchend":b.timer=clearTimeout(b.timer);if(e.propagates){a.drag.hijack(g,"drop",e);a.drag.hijack(g,"dropend",e)}break}},locate:function(k,h){var l=d.data(k,b.datakey),g=d(k),i=g.offset()||{},e=g.outerHeight(),j=g.outerWidth(),f={elem:k,width:j,height:e,top:i.top,left:i.left,right:i.left+j,bottom:i.top+e};if(l){l.location=f;l.index=h;l.elem=k}return f},contains:function(e,f){return((f[0]||f.left)>=e.left&&(f[0]||f.right)<=e.right&&(f[1]||f.top)>=e.top&&(f[1]||f.bottom)<=e.bottom)},modes:{intersect:function(f,e,g){return this.contains(g,[f.pageX,f.pageY])?1000000000:this.modes.overlap.apply(this,arguments)},overlap:function(f,e,g){return Math.max(0,Math.min(g.bottom,e.bottom)-Math.max(g.top,e.top))*Math.max(0,Math.min(g.right,e.right)-Math.max(g.left,e.left))},fit:function(f,e,g){return this.contains(g,e)?1:0},middle:function(f,e,g){return this.contains(g,[e.left+e.width*0.5,e.top+e.height*0.5])?1:0}},sort:function(f,e){return(e.winner-f.winner)||(f.index-e.index)},tolerate:function(q){var k,e,n,j,l,m,g,p=0,f,h=q.interactions.length,r=[b.event.pageX,b.event.pageY],o=b.tolerance||b.modes[b.mode];do{if(f=q.interactions[p]){if(!f){return}f.drop=[];l=[];m=f.droppable.length;if(o){n=b.locate(f.proxy)}k=0;do{if(g=f.droppable[k]){j=d.data(g,b.datakey);e=j.location;if(!e){continue}j.winner=o?o.call(b,b.event,n,e):b.contains(e,r)?1:0;l.push(j)}}while(++k<m);l.sort(b.sort);k=0;do{if(j=l[k]){if(j.winner&&f.drop.length<b.multi){if(!j.active[p]&&!j.anyactive){if(a.drag.hijack(b.event,"dropstart",q,p,j.elem)[0]!==false){j.active[p]=1;j.anyactive+=1}else{j.winner=0}}if(j.winner){f.drop.push(j.elem)}}else{if(j.active[p]&&j.anyactive==1){a.drag.hijack(b.event,"dropend",q,p,j.elem);j.active[p]=0;j.anyactive-=1}}}}while(++k<m)}}while(++p<h);if(b.last&&r[0]==b.last.pageX&&r[1]==b.last.pageY){delete b.timer}else{b.timer=setTimeout(function(){b.tolerate(q)},b.delay)}b.last=b.event}};a.dropinit=a.dropstart=a.dropend=b})(jQuery);
  11676. define("drop", function(){});
  11677. /**
  11678. * http://git.oschina.net/hbbcs/bootStrap-addTabs
  11679. * Created by joe on 2015-12-19.
  11680. */
  11681. $.fn.addtabs = function (options) {
  11682. var obj = $(this);
  11683. options = $.extend({
  11684. content: '', //直接指定所有页面TABS内容
  11685. close: true, //是否可以关闭
  11686. monitor: 'body', //监视的区域
  11687. nav: '.nav-addtabs',
  11688. tab: '.tab-addtabs',
  11689. iframeUse: true, //使用iframe还是ajax
  11690. iframeHeight: $(window).height() - 50, //固定TAB中IFRAME高度,根据需要自己修改
  11691. iframeForceRefresh: false, //点击后强制刷新对应的iframe
  11692. callback: function () {
  11693. //关闭后回调函数
  11694. }
  11695. }, options || {});
  11696. var navobj = $(options.nav);
  11697. var tabobj = $(options.tab);
  11698. if (history.pushState) {
  11699. //浏览器前进后退事件
  11700. $(window).on("popstate", function (e) {
  11701. var state = e.originalEvent.state;
  11702. if (state) {
  11703. $("a[addtabs=" + state.id + "]", options.monitor).data("pushstate", true).trigger("click");
  11704. }
  11705. });
  11706. }
  11707. $(options.monitor).on('click', '[addtabs]', function (e) {
  11708. if ($(this).attr('url').indexOf("javascript:") !== 0) {
  11709. if ($(this).is("a")) {
  11710. e.preventDefault();
  11711. }
  11712. var id = $(this).attr('addtabs');
  11713. var title = $(this).attr('title') ? $(this).attr('title') : $.trim($(this).text());
  11714. var url = $(this).attr('url');
  11715. var content = options.content ? options.content : $(this).attr('content');
  11716. var ajax = $(this).attr('ajax') ? true : false;
  11717. var state = ({
  11718. url: url, title: title, id: id, content: content, ajax: ajax
  11719. });
  11720. document.title = title;
  11721. if (history.pushState && !$(this).data("pushstate")) {
  11722. var pushurl = url.indexOf("ref=addtabs") == -1 ? (url + (url.indexOf("?") > -1 ? "&" : "?") + "ref=addtabs") : url;
  11723. window.history.pushState(state, title, pushurl);
  11724. }
  11725. $(this).data("pushstate", null);
  11726. _add.call(this, {
  11727. id: id,
  11728. title: $(this).attr('title') ? $(this).attr('title') : $(this).html(),
  11729. content: content,
  11730. url: url,
  11731. ajax: ajax
  11732. });
  11733. }
  11734. });
  11735. navobj.on('click', '.close-tab', function (e) {
  11736. id = $(this).prev("a").attr("aria-controls");
  11737. _close(id);
  11738. return false;
  11739. });
  11740. navobj.on('dblclick', 'li[role=presentation]', function (e) {
  11741. $(this).find(".close-tab").trigger("click");
  11742. });
  11743. navobj.on('click', 'li[role=presentation]', function (e) {
  11744. $("a[addtabs=" + $("a", this).attr("node-id") + "]").trigger("click");
  11745. });
  11746. $(window).resize(function () {
  11747. $("#nav").width($("#header > .navbar").width() - $(".sidebar-toggle").outerWidth() - $(".navbar-custom-menu").outerWidth() - 20);
  11748. _drop();
  11749. });
  11750. _add = function (opts) {
  11751. var id, tabid, conid, url;
  11752. id = opts.id;
  11753. tabid = 'tab_' + opts.id;
  11754. conid = 'con_' + opts.id;
  11755. url = opts.url;
  11756. url += (opts.url.indexOf("?") > -1 ? "&addtabs=1" : "?addtabs=1");
  11757. navobj.find("[role='presentation']").removeClass('active');
  11758. tabobj.find("[role='tabpanel']").removeClass('active');
  11759. //如果TAB不存在,创建一个新的TAB
  11760. if ($("#" + tabid).size() == 0) {
  11761. //创建新TAB的title
  11762. title = $('<li role="presentation" id="' + tabid + '"><a href="#' + conid + '" node-id="' + opts.id + '" aria-controls="' + id + '" role="tab" data-toggle="tab">' + opts.title + '</a></li>');
  11763. //是否允许关闭
  11764. if (options.close && $("li", navobj).size() > 0) {
  11765. title.append(' <i class="close-tab fa fa-remove"></i>');
  11766. }
  11767. //创建新TAB的内容
  11768. content = $('<div role="tabpanel" class="tab-pane" id="' + conid + '"></div>');
  11769. //是否指定TAB内容
  11770. if (opts.content) {
  11771. content.append(opts.content);
  11772. } else if (options.iframeUse && !opts.ajax) {//没有内容,使用IFRAME打开链接
  11773. var height = options.iframeHeight;
  11774. content.append('<iframe src="' + url + '" width="100%" height="' + height + '" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling-x="no" scrolling-y="auto" allowtransparency="yes"></iframe></div>');
  11775. } else {
  11776. $.get(url, function (data) {
  11777. content.append(data);
  11778. });
  11779. }
  11780. //加入TABS
  11781. if ($('.tabdrop li').size() > 0) {
  11782. $('.tabdrop ul').append(title);
  11783. } else {
  11784. navobj.append(title);
  11785. }
  11786. tabobj.append(content);
  11787. } else {
  11788. //强制刷新iframe
  11789. if (options.iframeForceRefresh) {
  11790. $("#" + conid + " iframe").attr('src', function (i, val) {
  11791. return val;
  11792. });
  11793. }
  11794. }
  11795. localStorage.setItem("addtabs", $(this).prop('outerHTML'));
  11796. //激活TAB
  11797. $("#" + tabid).addClass('active');
  11798. $("#" + conid).addClass("active");
  11799. _drop();
  11800. };
  11801. _close = function (id) {
  11802. var tabid = 'tab_' + id;
  11803. var conid = 'con_' + id;
  11804. //如果关闭的是当前激活的TAB,激活他的前一个TAB
  11805. if (obj.find("li.active").attr('id') == tabid) {
  11806. if ($("#" + tabid).prev().not(".tabdrop").size() > 0) {
  11807. $("#" + tabid).prev().not(".tabdrop").find("a").trigger("click");
  11808. } else if ($("#" + tabid).next().size() > 0) {
  11809. $("#" + tabid).next().trigger("click");
  11810. }
  11811. }
  11812. //关闭TAB
  11813. $("#" + tabid).remove();
  11814. $("#" + conid).remove();
  11815. _drop();
  11816. options.callback();
  11817. };
  11818. _drop = function () {
  11819. //创建下拉标签
  11820. var dropdown = $('<li class="dropdown pull-right hide tabdrop"><a class="dropdown-toggle" data-toggle="dropdown" href="javascript:;">' +
  11821. '<i class="glyphicon glyphicon-align-justify"></i>' +
  11822. ' <b class="caret"></b></a><ul class="dropdown-menu"></ul></li>');
  11823. //检测是否已增加
  11824. if (!$('.tabdrop').html()) {
  11825. dropdown.prependTo(navobj);
  11826. } else {
  11827. dropdown = navobj.find('.tabdrop');
  11828. }
  11829. //检测是否有下拉样式
  11830. if (navobj.parent().is('.tabs-below')) {
  11831. dropdown.addClass('dropup');
  11832. }
  11833. var collection = 0;
  11834. var maxwidth = navobj.width() - 60;
  11835. var liwidth = 0;
  11836. //检查超过一行的标签页
  11837. var litabs = navobj.append(dropdown.find('li')).find('>li').not('.tabdrop');
  11838. var lisize = litabs.size();
  11839. litabs.each(function (i, j) {
  11840. liwidth += $(this).width();
  11841. if (collection == 0 && i == lisize - 1 && liwidth <= navobj.width()) {
  11842. return true;
  11843. }
  11844. if (liwidth > maxwidth) {
  11845. dropdown.find('ul').append($(this));
  11846. collection++;
  11847. }
  11848. });
  11849. //如果有超出的,显示下拉标签
  11850. if (collection > 0) {
  11851. dropdown.removeClass('hide');
  11852. if (dropdown.find('.active').length == 1) {
  11853. dropdown.addClass('active');
  11854. } else {
  11855. dropdown.removeClass('active');
  11856. }
  11857. } else {
  11858. dropdown.addClass('hide');
  11859. }
  11860. };
  11861. };
  11862. define("addtabs", function(){});
  11863. /**
  11864. * @summary SelectPage
  11865. * @desc 基于jQuery及使用Bootstrap环境开发的,下拉列表带输入快速查找及结果分页展示的多功能选择器
  11866. * @file selectpage.js
  11867. * @version 2.7
  11868. * @author TerryZeng
  11869. * @contact https://terryz.github.io/
  11870. * @license MIT License
  11871. *
  11872. * 插件的部分功能使用、借鉴了
  11873. * jQuery Plugin: jquery.ajax-combobox
  11874. * 作者:Yuusaku Miyazaki <toumin.m7@gmail.com>(宮崎 雄策)
  11875. *
  11876. * 插件依赖:
  11877. * jQuery1.x
  11878. * font-awesome(图标库)
  11879. *
  11880. * 基本功能:
  11881. * 可实时搜索的下拉列表
  11882. * 对待选择的下拉项目可进行分页
  11883. * 可使用键盘快捷分页操作
  11884. * 使用标签的方式支持下拉项目多选
  11885. *
  11886. * 修改记录:
  11887. * 2016.04.20
  11888. * 增加参数autoSelectFirst(是否自动选择列表中的第一项内容)
  11889. * 解决下拉分页有初始化内容,并删除部分关键字时显示的结果集列表不足一页时,分页栏没有被生成的问题
  11890. * 增加参数autoFillResult(是否自动填充内容)
  11891. * 增加参数noResultClean(是否清空无匹配结果的输入关键字)
  11892. * 2016.06.29
  11893. * 修复分页栏鼠标点击时跳转的页数不正常的问题
  11894. * 2016.08.04
  11895. * 修复因宽度变化导致下拉触发按钮位置在出现下拉列表后发生偏移,原因是原控件的触发按钮是在输入框外部扩展,现已移入输入框内部
  11896. * 2016.08.10
  11897. * 弹出下拉列表时,若有已选中的项目,则将已选中的项目进行高亮,否则对第一行进行高亮
  11898. * 下拉列表展开时,鼠标点击列表区域外,若当前列表已有选中项目,则直接隐藏列表;若当前列表没有默认选中项目,则使用当前高亮项目的内容进行设置
  11899. * 2016.08.12
  11900. * 解决控件对于原始input设置的样式(bootstrap原生提供的宽度样式),宽度显示不正常的问题
  11901. * 增加若设置了formatItem格式函数,则进行匹配的数据源从showField改为formatItem后的结果进行匹配
  11902. * 2016.10
  11903. * 增加光标进入输入框时,打开下拉列表的功能
  11904. * 2017.01.16
  11905. * 解决输入关键进行搜索并有匹配结果时,失去焦点后,没有自动选中第一项
  11906. * 2017.01.19
  11907. * 取消在输入状态时,判断到输入框里内容为空时,隐藏下拉列表的操作
  11908. * 在展示下拉列表时,判断默认与输入框左对齐的列表是否会超出屏幕边界,是则右对齐,否则默认左对齐
  11909. * 2017.01.20
  11910. * 增加下拉列表展示之前判断列表的面板是否会超出底部区域,若超出则将列表向上对齐展示
  11911. * 处理下拉列表显示一次操作显示多次的问题
  11912. * 增加控件已有选中值时,在显示下拉列表时,直接跳转到该项目所在的页
  11913. * 修复一些点击输入框出现下拉列表的Bug
  11914. * 2017.03.24
  11915. * 解决下拉分页插件向上浮动时位置不正确的问题
  11916. * 解决下拉分页插件在已有选中值时,再次点击输入框后,打开的列表分页栏翻页功能无效的问题
  11917. * 2017.04.21
  11918. * 解决打开noResultClean参数,没有匹配输入关键词的项目时,列表不隐藏的问题
  11919. * 2017.04.24
  11920. * 解决控件在设置disabled="disabled"禁用状态时,点击向下的三角尖也可以打开列表的问题
  11921. * 增加控件在已有选中项目时,直接删除输入框中的内容,作为清空控件内容的功能
  11922. * 修改失去焦点的范围从document.body到document
  11923. * 优化键盘输入捕捉的方式
  11924. * 原列表有多页的情况下,再输入关键字,没有匹配到任何项目时,分页条的下一页,最后一页为可点击的样式,且分页信息的内容也不正确
  11925. * 2017.05
  11926. * 代码重构
  11927. * 增加多项选择东西,并以标签(Tag)的形式展现在输入框中
  11928. * 修正插件外框宽度问题
  11929. * 修改选中事件回调的入参从key,value改为选中行的原始数据对象,以便更灵活的数据处理
  11930. * 2017.06
  11931. * 修复部分样式问题
  11932. * 2017.06.13
  11933. * 改名SelectPage
  11934. * 2017.06.24
  11935. * 增加Bootstrap3样式支持
  11936. * 2017.08.08
  11937. * 修复界面上排版内容较少时,列表会向上展示开的问题
  11938. * 增加多选模式下的控制按钮区域,功能:“全选本页”、“取消本页”、“清空全部”
  11939. * 修复最大宽度下超出父容器的宽度问题
  11940. * 修复ajax模式报错的问题
  11941. * 增加eAjaxSuccess请求成功后的数据处理回调
  11942. * 2017.08.13(v2.0)
  11943. * 代码重构
  11944. * 修改默认样式,使用更简洁的风格
  11945. * 增加maxSelectLimit参数,设置多选模式下最大选择个数限制
  11946. * 增加eTagRemove回调函数,在多选模式下,移除标签时触发的回调
  11947. * 优化错误信息展示的交互方式
  11948. * 增加初始化选中项目时(多选模式),允许设置多个内容,例如:data-init="1,2,3,4"
  11949. * 修复键盘操作分页部分情况下会失效的问题
  11950. * 增加selectToCloseList参数,用于设置在多选模式下,选择项目后不关闭列表
  11951. * 修复selectToCloseList:false状态下,键盘操作会失去焦点,操作不连贯的问题
  11952. * 增加$.fn.selectPageClear的API,用于清空控件所有已选中的项目
  11953. * 增加$.fn.selectPageText的API,用于获得已选择的项目文本内容
  11954. * 增加$.fn.selectPageData的API,用于动态修改插件数据源
  11955. * 增加$.fn.SelectedRefresh的API,用于在使用.val()的方式修改了插件的选中项目后,刷新显示在输入框中的文本内容
  11956. * 优化控件内部对象缓存机制
  11957. * 去除快速使用脚本b.selectpage.js
  11958. * 初始化入口从原来的$('').bSelectPage({})修改为$('').selectPage({})
  11959. * 重新调整参数名称
  11960. * 修正Bootstrap3下控件宽度、高度应用的BUG
  11961. * 2017.08.19(v2.2)
  11962. * 增加为原始输入框的value属性设置初始化值,以初始化插件选中项目
  11963. * 修复多选模式下关闭标签出错的问题
  11964. * 修复输入查询关键字后失去焦点,再次获得焦点时,插件没有根据已存在的关键进行过滤
  11965. * 增加inputDelay配置项目,设置ajax数据源模式下,延迟输入查询的时间,避免在单位时间内连续输入发起的连续ajax查询,单位:秒,默认值:0.5
  11966. * 修正对数字类型的列进行排序时,仍然以字符串的方式进行排序
  11967. * 2017.08.23(v2.3)
  11968. * 修复在查询关键字状态下,分页数据没有被更新,导致分页按钮功能不正常问题
  11969. * 清理整理内部对象
  11970. * 修复多选模式下,若设置了最大选中项目个数,点击“全选本页”按钮时,仅选中指定的最大数量
  11971. * 增加selectpage.base.css兼容无UI框架的方案,但建议要至少使用normalize.css
  11972. * 2017.08.26(v2.4)
  11973. * 增加pagination参数,指定稿件是否使用分页加载数据,以及显示分页栏
  11974. * 增加listSize参数,指定了不使用分页的列表,显示的高度,单位为个(选项个数),默认显示10个项目的高度
  11975. * 设置selectOnly:true的情况下,输入框为只读模式,不允许输入查询过滤
  11976. * 修复多选模式下及设置了最大选中项目时,选中了项目再次点击“全选本页”按钮会在已选择的基础上增加最大选中项目个数的项目
  11977. * 调整下拉列表样式及位置
  11978. * 增加单选模式下,选中项目后,自动显示清空按钮
  11979. * 修复多选模式下,移除本页和清除所有两个按钮点击后,回调出错的问题
  11980. * 增加搜索无结果时显示提示信息
  11981. * 2017.09.07(v2.5)
  11982. * 修复多选模式下,初始化项目的显示文本没有使用formatItem回调进行格式化
  11983. * 修复ajax数据源模式下,输入查询关键字时,翻页始终为第一页的问题
  11984. * 2017.09.07(v2.6)
  11985. * 修复单选模式下初始化项目的显示文本没有使用formatItem回调格式化的问题
  11986. * 修复单选模式存在初始化项目时,再打开下拉列表时,仅显示匹配的项目一条数据的问题
  11987. * 修复多选模式下,动态修改选中值selectPageRefresh功能无效
  11988. * 2017.09.12(v2.7)
  11989. * 增加eClear回调,单选模式下,清除按钮的功能回调
  11990. * 单选,多选模式下,输入框禁用或只读状态,不显示清除按钮
  11991. * 2017.09.23(v2.8)
  11992. * 调整部分样式
  11993. * 修复可视区域高度较小时,列表始终会向上展开的问题
  11994. * 分离键盘事件处理,对键盘输入精准控制
  11995. * 优化区域外点击处理
  11996. * 优化数据展示渲染效率
  11997. * 优化列表位置定位的准确性
  11998. */
  11999. ;
  12000. (function (factory) {
  12001. if (typeof define === "function" && define.amd) {
  12002. // AMD模式
  12003. define('selectpage',["jquery"], factory);
  12004. } else {
  12005. // 全局模式
  12006. factory(jQuery);
  12007. }
  12008. }(function ($) {
  12009. "use strict";
  12010. /**
  12011. * @desc 默认参数集
  12012. */
  12013. var defaults = {
  12014. /**
  12015. * @desc 数据源(String:Ajax查询的URL|Object:JSON格式的数据源)
  12016. * @type {string|Object}
  12017. * @example
  12018. * string:服务端请求的URL地址
  12019. * Object:JSON格式数组,推荐格式:[{a:1,b:2,c:3},{...}]
  12020. */
  12021. data: undefined,
  12022. /**
  12023. * @desc 插件显示语言 ('ja', 'en', 'es', 'pt-br'等)
  12024. * @type string 默认'cn'
  12025. */
  12026. lang: 'cn',
  12027. /**
  12028. * @desc 是否为多选模式(标签模式)
  12029. * @type boolean 默认值false
  12030. */
  12031. multiple: false,
  12032. /**
  12033. * @desc 是否分页
  12034. * @type boolean 默认值 true
  12035. */
  12036. pagination: true,
  12037. /**
  12038. * @desc 关闭分页的状态下,列表显示的项目个数,其它的项目以滚动条滚动方式展现
  12039. * @type number 默认值 10
  12040. */
  12041. listSize: 10,
  12042. /**
  12043. * @desc 是否启用多选模式的控制按钮区域
  12044. * 仅multiple: true模式下可用
  12045. * @type boolean 默认值true
  12046. */
  12047. multipleControlbar: true,
  12048. /**
  12049. * @desc 多选模式下最大选择个数,0为不限制
  12050. * @type number 默认0
  12051. */
  12052. maxSelectLimit: 0,
  12053. /**
  12054. * @desc 选中项目后关闭列表
  12055. * 该设置仅在多选模式下multiple:true有效
  12056. * @type boolean 默认值true
  12057. */
  12058. selectToCloseList: true,
  12059. /**
  12060. * @desc 插件初始值指定,该值会与option.keyField字段进行匹配,若匹配到,则自动设置选中并高亮
  12061. * @type string
  12062. */
  12063. initRecord: undefined,
  12064. /**
  12065. * @desc 使用ajax方式获取数据时,使用该参数设置对应的数据表名
  12066. * @type string
  12067. */
  12068. dbTable: 'tbl',
  12069. /**
  12070. * @desc 值字段,通常该字段的内容会自动保存在隐藏域中
  12071. * @type string 默认值为'id'
  12072. */
  12073. keyField: 'id',
  12074. /**
  12075. * @desc 结果集中用于显示的属性名
  12076. * @type string 默认字段为'name'
  12077. */
  12078. showField: 'name',
  12079. /**
  12080. * @desc 查询字段,仅为使用URL(ajax)方式查询服务端时,设置后端查询的字段,不设置则默认使用showField设置的字段
  12081. * @type string
  12082. */
  12083. searchField: undefined,
  12084. /**
  12085. * @desc 查询方式 ('AND' or 'OR')
  12086. * @type string 默认为'AND'
  12087. */
  12088. andOr: 'AND',
  12089. /**
  12090. * @desc 数据排序方式
  12091. * @type array 若不设置则默认对showField指定的字段进行排序
  12092. * @example
  12093. * orderBy : ['id desc']//对ID字段进行降序排序
  12094. */
  12095. orderBy: undefined,
  12096. /**
  12097. * @desc 每页显示的记录数
  12098. * @type number
  12099. */
  12100. pageSize: 10,
  12101. /**
  12102. * @desc 使用URL进行AJAX查询时,可传递查询参数
  12103. * @type function
  12104. * @return object
  12105. * @example params : function(){return {'name':'aa','sex':1};}
  12106. */
  12107. params: undefined,
  12108. /**
  12109. * 列表项目显示内容格式化
  12110. * 参数类型:function
  12111. * @type boolean
  12112. * @param data {object} 行数据object格式
  12113. * @return string
  12114. */
  12115. formatItem: undefined,
  12116. /**
  12117. * 是否在输入框获得焦点时,展开下拉窗口
  12118. * @type boolean 默认值true
  12119. */
  12120. focusDropList: true,
  12121. /**
  12122. * 是否自动选择列表中的第一项内容(输入关键字查询模式,直接使用鼠标下拉并不触发)
  12123. * @type boolean 默认值false
  12124. */
  12125. autoSelectFirst: true,
  12126. /**
  12127. * 是否自动填充内容
  12128. * 若有列表项目被高亮显示,在焦点离开控件后,自动设置该项为选中内容
  12129. * @type boolean 默认值false
  12130. */
  12131. autoFillResult: true,
  12132. /**
  12133. * 是否清空输入关键字
  12134. * 在输入框中输入内容进行查询,但没有匹配的内容返回,在焦点离开控件后,自动清空输入框输入的内容
  12135. * @type boolean 默认值false
  12136. */
  12137. noResultClean: true,
  12138. /**
  12139. * @desc 只选择模式
  12140. * @type boolean
  12141. */
  12142. selectOnly: false,
  12143. /**
  12144. * @desc 输入关键字查询延迟(仅ajax数据源模式下可用)
  12145. * @type number 默认值:0.5秒
  12146. */
  12147. inputDelay: 0.5,
  12148. /**
  12149. * -----------------------------------------事件回调--------------------------------------------
  12150. */
  12151. /**
  12152. * @type function
  12153. * @param object
  12154. * @param dom
  12155. */
  12156. eSelect: undefined,
  12157. /**
  12158. * ajax请求模式,请求成功后的数据处理回调
  12159. * 回调的功能用于自定义处理服务端返回的数据
  12160. * @type function
  12161. * @param data {object} ajax服务端返回的json数据
  12162. * @return {object} 函数返回的数据结构如下:
  12163. * @example
  12164. * {
  12165. * list : [{name:'aa',sex:1},{name:'bb',sex:1}...],
  12166. * totalRow : 100
  12167. * }
  12168. */
  12169. eAjaxSuccess: undefined,
  12170. /**
  12171. * 多选模式下,关闭标签是的回调函数
  12172. * @type function
  12173. * @param removeCount 被移除的个数
  12174. */
  12175. eTagRemove: undefined,
  12176. /**
  12177. * 单选模式下,选中项目后的清除按钮功能回调
  12178. * @type function
  12179. */
  12180. eClear: undefined
  12181. };
  12182. /**
  12183. * @constructor
  12184. * @classdesc 插件初始化
  12185. * @param {Object} input - 插件的初始化输入框元素。
  12186. * @param {Object} option - 初始化参数
  12187. */
  12188. var SelectPage = function (input, option) {
  12189. var option = $.extend({}, option, $(input).data());
  12190. //特殊字段处理
  12191. $.each({data: 'source', keyField: 'primaryKey', showField: 'field', pageSize: 'perPage'}, function (i, j) {
  12192. if (typeof option[j] !== 'undefined') {
  12193. option[i] = option[j];
  12194. delete option[j];
  12195. }
  12196. });
  12197. this.setOption(option);
  12198. this.setLanguage();
  12199. this.setCssClass();
  12200. this.setProp();
  12201. this.setElem(input, option);
  12202. this.setButtonAttrDefault();
  12203. this.setInitRecord();
  12204. this.eDropdownButton();
  12205. this.eInput();
  12206. this.eWhole();
  12207. };
  12208. /**
  12209. * 插件版本号
  12210. */
  12211. SelectPage.version = '2.7';
  12212. /**
  12213. * 插件缓存内部对象的KEY
  12214. */
  12215. SelectPage.dataKey = 'selectPageObject';
  12216. /**
  12217. * 全局范围设置当前点击是否为插件自身的标识
  12218. */
  12219. SelectPage.objStatusKey = 'selectPage-self-mark';
  12220. /**
  12221. * 全局范围设置当前点击的selectpage的索引下标
  12222. */
  12223. SelectPage.objStatusIndex = 'selectPage-self-index';
  12224. /**
  12225. * @desc 参数初始化
  12226. * @param {Object} option - 参数集
  12227. */
  12228. SelectPage.prototype.setOption = function (option) {
  12229. //若没有设置搜索字段,则使用显示字段作为搜索字段
  12230. option.searchField = (option.searchField === undefined) ? option.showField : option.searchField;
  12231. //统一大写
  12232. option.andOr = option.andOr.toUpperCase();
  12233. if (option.andOr !== 'AND' && option.andOr !== 'OR')
  12234. option.andOr = 'AND';
  12235. //将参数内容从使用","分隔的字符串转换为数组
  12236. var arr = ['searchField'];
  12237. for (var i = 0; i < arr.length; i++) {
  12238. option[arr[i]] = this.strToArray(option[arr[i]]);
  12239. }
  12240. //设置排序字段
  12241. option.orderBy = (option.orderBy === undefined) ? option.searchField : option.orderBy;
  12242. //设置多字段排序
  12243. //例: [ ['id', 'ASC'], ['name', 'DESC'] ]
  12244. option.orderBy = this.setOrderbyOption(option.orderBy, option.showField);
  12245. //多选模式下,若设置了选择项目不关闭列表功能,则强制关闭自动选择第一项功能和自动选中高亮的项目功能
  12246. //原因是打开了会总是莫明选择了第一项,体验不佳
  12247. if (option.multiple && !option.selectToCloseList) {
  12248. option.autoFillResult = false;
  12249. option.autoSelectFirst = false;
  12250. }
  12251. if ($.type(option.data) === 'string') {
  12252. option.autoSelectFirst = false;
  12253. }
  12254. //若不需要分页功能,则将所有数据都显示出来,上限200项
  12255. if (!option.pagination)
  12256. option.pageSize = 200;
  12257. if ($.type(option.listSize) !== 'number' || option.listSize < 0)
  12258. option.listSize = 10;
  12259. this.option = option;
  12260. };
  12261. /**
  12262. * @desc 字符串转换为数组
  12263. * @param str {string} - 字符串
  12264. * @return {Array} - 数组
  12265. */
  12266. SelectPage.prototype.strToArray = function (str) {
  12267. if (!str)
  12268. return '';
  12269. return str.replace(/[\s ]+/g, '').split(',');
  12270. };
  12271. /**
  12272. * @desc 设置多字段排序
  12273. * @param {Array} arg_order - 排序顺序
  12274. * @param {string} arg_field - 字段
  12275. * @return {Array} - 处理后的排序字段内容
  12276. */
  12277. SelectPage.prototype.setOrderbyOption = function (arg_order, arg_field) {
  12278. var arr = [], orders = [];
  12279. if (typeof arg_order == 'object') {
  12280. for (var i = 0; i < arg_order.length; i++) {
  12281. orders = $.trim(arg_order[i]).split(' ');
  12282. arr[i] = (orders.length == 2) ? orders : [orders[0], 'ASC'];
  12283. }
  12284. } else {
  12285. orders = $.trim(arg_order).split(' ');
  12286. arr[0] = (orders.length == 2) ? orders : (orders[0].match(/^(ASC|DESC)$/i)) ? [arg_field, orders[0]] : [orders[0], 'ASC'];
  12287. }
  12288. return arr;
  12289. };
  12290. /**
  12291. * @desc 界面文字国际化
  12292. */
  12293. SelectPage.prototype.setLanguage = function () {
  12294. var message;
  12295. switch (this.option.lang) {
  12296. // German
  12297. case 'de':
  12298. message = {
  12299. add_btn: 'Hinzufügen-Button',
  12300. add_title: 'Box hinzufügen',
  12301. del_btn: 'Löschen-Button',
  12302. del_title: 'Box löschen',
  12303. next: 'Nächsten',
  12304. next_title: 'Nächsten' + this.option.pageSize + ' (Pfeil-rechts)',
  12305. prev: 'Vorherigen',
  12306. prev_title: 'Vorherigen' + this.option.pageSize + ' (Pfeil-links)',
  12307. first_title: 'Ersten (Umschalt + Pfeil-links)',
  12308. last_title: 'Letzten (Umschalt + Pfeil-rechts)',
  12309. get_all_btn: 'alle (Pfeil-runter)',
  12310. get_all_alt: '(Button)',
  12311. close_btn: 'Schließen (Tab)',
  12312. close_alt: '(Button)',
  12313. loading: 'lade...',
  12314. loading_alt: '(lade)',
  12315. page_info: 'num_page_top - num_page_end von cnt_whole',
  12316. select_ng: 'Achtung: Bitte wählen Sie aus der Liste aus.',
  12317. select_ok: 'OK : Richtig ausgewählt.',
  12318. not_found: 'nicht gefunden',
  12319. ajax_error: 'Bei der Verbindung zum Server ist ein Fehler aufgetreten.'
  12320. };
  12321. break;
  12322. // English
  12323. case 'en':
  12324. message = {
  12325. add_btn: 'Add button',
  12326. add_title: 'add a box',
  12327. del_btn: 'Del button',
  12328. del_title: 'delete a box',
  12329. next: 'Next',
  12330. next_title: 'Next' + this.option.pageSize + ' (Right key)',
  12331. prev: 'Prev',
  12332. prev_title: 'Prev' + this.option.pageSize + ' (Left key)',
  12333. first_title: 'First (Shift + Left key)',
  12334. last_title: 'Last (Shift + Right key)',
  12335. get_all_btn: 'Get All (Down key)',
  12336. get_all_alt: '(button)',
  12337. close_btn: 'Close (Tab key)',
  12338. close_alt: '(button)',
  12339. loading: 'loading...',
  12340. loading_alt: '(loading)',
  12341. page_info: 'num_page_top - num_page_end of cnt_whole',
  12342. select_ng: 'Attention : Please choose from among the list.',
  12343. select_ok: 'OK : Correctly selected.',
  12344. not_found: 'not found',
  12345. ajax_error: 'An error occurred while connecting to server.'
  12346. };
  12347. break;
  12348. // 中文
  12349. case 'cn':
  12350. message = {
  12351. add_btn: '添加按钮',
  12352. add_title: '添加区域',
  12353. del_btn: '删除按钮',
  12354. del_title: '删除区域',
  12355. next: '下一页',
  12356. next_title: '下' + this.option.pageSize + ' (→)',
  12357. prev: '上一页',
  12358. prev_title: '上' + this.option.pageSize + ' (←)',
  12359. first_title: '首页 (Shift + ←)',
  12360. last_title: '尾页 (Shift + →)',
  12361. get_all_btn: '获得全部 (↓)',
  12362. get_all_alt: '(按钮)',
  12363. close_btn: '关闭 (Tab键)',
  12364. close_alt: '(按钮)',
  12365. loading: '读取中...',
  12366. loading_alt: '(读取中)',
  12367. page_info: 'num_page_top - num_page_end (共 cnt_whole)',
  12368. select_ng: '请注意:请从列表中选择.',
  12369. select_ok: 'OK : 已经选择.',
  12370. not_found: '无查询结果',
  12371. ajax_error: '连接到服务器时发生错误!'
  12372. };
  12373. break;
  12374. // Spanish
  12375. case 'es':
  12376. message = {
  12377. add_btn: 'Agregar boton',
  12378. add_title: 'Agregar una opcion',
  12379. del_btn: 'Borrar boton',
  12380. del_title: 'Borrar una opcion',
  12381. next: 'Siguiente',
  12382. next_title: 'Proximas ' + this.option.pageSize + ' (tecla derecha)',
  12383. prev: 'Anterior',
  12384. prev_title: 'Anteriores ' + this.option.pageSize + ' (tecla izquierda)',
  12385. first_title: 'Primera (Shift + Left)',
  12386. last_title: 'Ultima (Shift + Right)',
  12387. get_all_btn: 'Ver todos (tecla abajo)',
  12388. get_all_alt: '(boton)',
  12389. close_btn: 'Cerrar (tecla TAB)',
  12390. close_alt: '(boton)',
  12391. loading: 'Cargando...',
  12392. loading_alt: '(Cargando)',
  12393. page_info: 'num_page_top - num_page_end de cnt_whole',
  12394. select_ng: 'Atencion: Elija una opcion de la lista.',
  12395. select_ok: 'OK: Correctamente seleccionado.',
  12396. not_found: 'no encuentre',
  12397. ajax_error: 'Un error ocurrió mientras conectando al servidor.'
  12398. };
  12399. break;
  12400. // Brazilian Portuguese
  12401. case 'pt-br':
  12402. message = {
  12403. add_btn: 'Adicionar botão',
  12404. add_title: 'Adicionar uma caixa',
  12405. del_btn: 'Apagar botão',
  12406. del_title: 'Apagar uma caixa',
  12407. next: 'Próxima',
  12408. next_title: 'Próxima ' + this.option.pageSize + ' (tecla direita)',
  12409. prev: 'Anterior',
  12410. prev_title: 'Anterior ' + this.option.pageSize + ' (tecla esquerda)',
  12411. first_title: 'Primeira (Shift + Left)',
  12412. last_title: 'Última (Shift + Right)',
  12413. get_all_btn: 'Ver todos (Seta para baixo)',
  12414. get_all_alt: '(botão)',
  12415. close_btn: 'Fechar (tecla TAB)',
  12416. close_alt: '(botão)',
  12417. loading: 'Carregando...',
  12418. loading_alt: '(Carregando)',
  12419. page_info: 'num_page_top - num_page_end de cnt_whole',
  12420. select_ng: 'Atenção: Escolha uma opção da lista.',
  12421. select_ok: 'OK: Selecionado Corretamente.',
  12422. not_found: 'não encontrado',
  12423. ajax_error: 'Um erro aconteceu enquanto conectando a servidor.'
  12424. };
  12425. break;
  12426. // Japanese
  12427. case 'ja':
  12428. message = {
  12429. add_btn: '追加ボタン',
  12430. add_title: '入力ボックスを追加します',
  12431. del_btn: '削除ボタン',
  12432. del_title: '入力ボックスを削除します',
  12433. next: '次へ',
  12434. next_title: '次の' + this.option.pageSize + '件 (右キー)',
  12435. prev: '前へ',
  12436. prev_title: '前の' + this.option.pageSize + '件 (左キー)',
  12437. first_title: '最初のページへ (Shift + 左キー)',
  12438. last_title: '最後のページへ (Shift + 右キー)',
  12439. get_all_btn: '全件取得 (下キー)',
  12440. get_all_alt: '画像:ボタン',
  12441. close_btn: '閉じる (Tabキー)',
  12442. close_alt: '画像:ボタン',
  12443. loading: '読み込み中...',
  12444. loading_alt: '画像:読み込み中...',
  12445. page_info: 'num_page_top - num_page_end 件 (全 cnt_whole 件)',
  12446. select_ng: '注意 : リストの中から選択してください',
  12447. select_ok: 'OK : 正しく選択されました。',
  12448. not_found: '(0 件)',
  12449. ajax_error: 'サーバとの通信でエラーが発生しました。'
  12450. };
  12451. break;
  12452. }
  12453. this.message = message;
  12454. };
  12455. /**
  12456. * @desc CSS样式表名称字义
  12457. */
  12458. SelectPage.prototype.setCssClass = function () {
  12459. var css_class = {
  12460. container: 'sp_container',
  12461. // SelectPage最外层DIV的打开状态
  12462. container_open: 'sp_container_open',
  12463. re_area: 'sp_result_area',
  12464. control_box: 'sp_control_box',
  12465. //标签及输入框的
  12466. element_box: 'sp_element_box',
  12467. // 分页导航
  12468. navi: 'pagination',
  12469. // 下拉结果列表
  12470. results: 'sp_results',
  12471. re_off: 'sp_results_off',
  12472. select: 'sp_over',
  12473. select_ok: 'sp_select_ok',
  12474. select_ng: 'sp_select_ng',
  12475. selected: 'sp_selected',
  12476. input_off: 'sp_input_off',
  12477. message_box: 'sp_message_box',
  12478. // 多选模式的禁用状态样式
  12479. disabled: 'sp_disabled',
  12480. button: 'sp_button',
  12481. btn_on: 'sp_btn_on',
  12482. btn_out: 'sp_btn_out',
  12483. input: 'sp_input',
  12484. clear_btn: 'sp_clear_btn'
  12485. };
  12486. this.css_class = css_class;
  12487. };
  12488. /**
  12489. * @desc 设置属性默认值
  12490. */
  12491. SelectPage.prototype.setProp = function () {
  12492. this.prop = {
  12493. //当前页
  12494. current_page: 1,
  12495. //总页数
  12496. max_page: 1,
  12497. //是否正在Ajax请求
  12498. is_loading: false,
  12499. xhr: false,
  12500. //使用键盘进行分页
  12501. key_paging: false,
  12502. //使用键盘进行选择
  12503. key_select: false,
  12504. //上一个选择的项目值
  12505. prev_value: '',
  12506. //选中项目的文本内容
  12507. selected_text: '',
  12508. //上一次键盘输入的时间
  12509. last_input_time: undefined
  12510. };
  12511. this.template = {
  12512. tag: {
  12513. content: '<li class="selected_tag" itemvalue="#item_value#">#item_text#<span class="tag_close">×</span></li>',
  12514. textKey: '#item_text#',
  12515. valueKey: '#item_value#'
  12516. }
  12517. };
  12518. };
  12519. /**
  12520. * @desc 插件HTML结构生成
  12521. * @param {Object} combo_input - 输入框源对象
  12522. * @param {Object} option - 插件参数
  12523. */
  12524. SelectPage.prototype.setElem = function (combo_input, option) {
  12525. // 1. 生成、替换DOM对象
  12526. var elem = {};//本体
  12527. var orgWidth = $(combo_input).outerWidth();
  12528. elem.combo_input = $(combo_input).attr({'autocomplete': 'off'}).addClass(this.css_class.input).wrap('<div>');
  12529. //只选择模式设置输入框为只读状态
  12530. if (option.selectOnly)
  12531. $(elem.combo_input).prop('readonly', true);
  12532. elem.container = $(elem.combo_input).parent().addClass(this.css_class.container);
  12533. if ($(elem.combo_input).prop('disabled')) {
  12534. if (option.multiple)
  12535. $(elem.container).addClass(this.css_class.disabled);
  12536. else
  12537. $(elem.combo_input).addClass(this.css_class.input_off);
  12538. }
  12539. //$(elem.container).width(orgWidth);
  12540. elem.button = $('<div>').addClass(this.css_class.button);
  12541. //bootstrap风格的向下三角箭头
  12542. elem.dropdown = $('<span class="bs-caret"><span class="caret"></span></span>');
  12543. //单选模式下清除的按钮X
  12544. elem.clear_btn = $('<div>').append('×').addClass(this.css_class.clear_btn).attr('title', '清除内容');
  12545. //多选模式下带标签显示及文本输入的组合框
  12546. elem.element_box = $('<ul>').addClass(this.css_class.element_box);
  12547. if (option.multiple && option.multipleControlbar)
  12548. elem.control = $('<div>').addClass(this.css_class.control_box);
  12549. //结果集列表
  12550. elem.result_area = $('<div>').addClass(this.css_class.re_area);
  12551. //列表中的分页栏pagination
  12552. if (option.pagination)
  12553. elem.navi = $('<ul>').addClass(this.css_class.navi).addClass("hide");
  12554. elem.results = $('<ul>').addClass(this.css_class.results);
  12555. /**
  12556. * 将原输入框的Name交换到Hidden中,因为具体需要保存传递到后端的是ID,而非Title
  12557. */
  12558. var namePrefix = '_text';
  12559. //将keyField的值放入"input:hidden"
  12560. var input_id = ($(elem.combo_input).attr('id') !== undefined) ? $(elem.combo_input).attr('id') : $(elem.combo_input).attr('name');
  12561. var input_name = ($(elem.combo_input).attr('name') !== undefined) ? $(elem.combo_input).attr('name') : 'selectPage';
  12562. var hidden_name = input_name,
  12563. hidden_id = input_id;
  12564. // CakePHP使用的措施 例:data[search][user] -> data[search][user_primary_key]
  12565. if (input_name.match(/\]$/))
  12566. input_name = input_name.replace(/\]?$/, namePrefix);
  12567. else
  12568. input_name += namePrefix;
  12569. if (input_id.match(/\]$/))
  12570. input_id = input_id.replace(/\]?$/, namePrefix);
  12571. else
  12572. input_id += namePrefix;
  12573. //将输入框的Name与Hidden的Name进行交换,使得可以将项目的具体ID被保存到后端进行处理
  12574. elem.hidden = $('<input type="hidden" class="sp_hidden" />').attr({
  12575. name: hidden_name,
  12576. id: hidden_id
  12577. }).val('');
  12578. $(elem.combo_input).attr({
  12579. name: input_name,
  12580. id: input_id
  12581. });
  12582. // 2. DOM内容放置
  12583. $(elem.container).append(elem.button).append(elem.result_area).append(elem.hidden);
  12584. $(elem.button).append(elem.dropdown);
  12585. $(elem.result_area).append(elem.results);
  12586. if (option.pagination)
  12587. $(elem.result_area).append(elem.navi);
  12588. //多选模式下的特殊处理
  12589. if (option.multiple) {
  12590. if (option.multipleControlbar) {
  12591. $(elem.control).append('<button type="button" class="btn btn-default sp_select_all" ><i class="fa fa-check-square-o"></i> 全选本页</button>');
  12592. $(elem.control).append('<button type="button" class="btn btn-default sp_unselect_all" ><i class="fa fa-square-o"></i> 取消本页</button>');
  12593. $(elem.control).append('<button type="button" class="btn btn-default sp_clear_all" ><i class="fa fa-ban"></i> 清除全部</button>');
  12594. $(elem.result_area).prepend(elem.control);
  12595. }
  12596. $(elem.container).addClass('sp_container_combo');
  12597. $(elem.combo_input).addClass('sp_combo_input').before($(elem.element_box));
  12598. var li = $('<li>').addClass('input_box');
  12599. $(li).append($(elem.combo_input));
  12600. $(elem.element_box).append($(li));
  12601. if ($(elem.combo_input).attr('placeholder'))
  12602. $(elem.combo_input).attr('placeholder_bak', $(elem.combo_input).attr('placeholder'));
  12603. }
  12604. this.elem = elem;
  12605. };
  12606. /**
  12607. * @desc 将控件的部分内容设置为默认状态
  12608. */
  12609. SelectPage.prototype.setButtonAttrDefault = function () {
  12610. /*
  12611. if (this.option.selectOnly) {
  12612. if ($(this.elem.combo_input).val() !== '') {
  12613. if ($(this.elem.hidden).val() !== '') {
  12614. //选择条件
  12615. $(this.elem.combo_input).attr('title', this.message.select_ok).removeClass(this.css_class.select_ng).addClass(this.css_class.select_ok);
  12616. } else {
  12617. //输入方式
  12618. $(this.elem.combo_input).attr('title', this.message.select_ng).removeClass(this.css_class.select_ok).addClass(this.css_class.select_ng);
  12619. }
  12620. } else {
  12621. $(this.elem.hidden).val('');
  12622. $(this.elem.combo_input).removeAttr('title').removeClass(this.css_class.select_ng);
  12623. }
  12624. }
  12625. */
  12626. $(this.elem.button).attr('title', this.message.get_all_btn);
  12627. //按钮的title属性修改
  12628. $(this.elem.button).attr('title', this.message.close_btn);
  12629. };
  12630. /**
  12631. * @desc 为插件设置初始化的选中值(若有指定的话),执行第一步,数据匹配
  12632. */
  12633. SelectPage.prototype.setInitRecord = function (refresh) {
  12634. var self = this;
  12635. if ($.type($(self.elem.combo_input).data('init')) != 'undefined')
  12636. self.option.initRecord = String($(self.elem.combo_input).data('init'));
  12637. //若在输入框中放入了初始化值,则将它放到隐藏域中进行选中项目初始化
  12638. //若输入框设置了初始值,同时又设置了data-init属性,那么以data-init属性为优先选择
  12639. if (!self.option.initRecord)
  12640. if ($(self.elem.combo_input).val())
  12641. self.option.initRecord = $(self.elem.combo_input).val();
  12642. $(self.elem.combo_input).val('');
  12643. if ((refresh && $(self.elem.hidden).val()) || $.type(self.option.initRecord) === 'string') {
  12644. // 初始的KEY值放入隐藏域
  12645. if (!refresh)
  12646. $(self.elem.hidden).val(self.option.initRecord);
  12647. //将初始值放入控件
  12648. if (typeof self.option.data === 'object') {//json数据源模式
  12649. var data = new Array();
  12650. var keyarr = refresh ? $(self.elem.hidden).val().split(',') : self.option.initRecord.split(',');
  12651. $.each(keyarr, function (index, row) {
  12652. for (var i = 0; i < self.option.data.length; i++) {
  12653. if (self.option.data[i][self.option.keyField] == row) {
  12654. data.push(self.option.data[i]);
  12655. break;
  12656. }
  12657. }
  12658. });
  12659. //在单选模式下,若使用了多选模式的初始化值(“key1,key2,...”多选方式),则不进行初始化选中操作
  12660. if (!self.option.multiple && data.length > 1)
  12661. data = null;
  12662. self.afterInit(self, data);
  12663. } else {//ajax数据源模式
  12664. $.ajax({
  12665. dataType: 'json',
  12666. type: 'POST',
  12667. url: self.option.data,
  12668. data: {
  12669. searchTable: self.option.dbTable,
  12670. searchKey: self.option.keyField,
  12671. searchValue: refresh ? $(self.elem.hidden).val() : self.option.initRecord,
  12672. field: self.option.showField,
  12673. order_by: self.option.orderBy,
  12674. pkey_name: self.option.keyField,
  12675. pkey_value: refresh ? $(self.elem.hidden).val() : self.option.initRecord
  12676. },
  12677. success: function (returnData) {
  12678. var data;
  12679. if (self.option.eAjaxSuccess && $.isFunction(self.option.eAjaxSuccess)) {
  12680. data = self.option.eAjaxSuccess(returnData);
  12681. } else {
  12682. data = returnData;
  12683. }
  12684. self.afterInit(self, data.list);
  12685. },
  12686. error: function (jqXHR, textStatus, errorThrown) {
  12687. self.ajaxErrorNotify(self, errorThrown);
  12688. }
  12689. });
  12690. }
  12691. }
  12692. };
  12693. /**
  12694. * @desc 匹配后的数据在插件中进行展示
  12695. * @param {Object} self - 插件的内部对象
  12696. * @param {Object} data - 列表数据
  12697. */
  12698. SelectPage.prototype.afterInit = function (self, data) {
  12699. if (!data)
  12700. return;
  12701. if (!$.isArray(data))
  12702. data = [data];
  12703. if (data.length === 0)
  12704. return;
  12705. var getText = function (row) {
  12706. var text = row[self.option.showField];
  12707. if (self.option.formatItem && $.isFunction(self.option.formatItem)) {
  12708. try {
  12709. text = self.option.formatItem(row);
  12710. } catch (e) {
  12711. }
  12712. }
  12713. return text;
  12714. };
  12715. if (self.option.multiple) {//多选模式初始化
  12716. self.clearAll(self);
  12717. $.each(data, function (i, row) {
  12718. var item = {text: getText(row), value: row[self.option.keyField]};
  12719. if (!self.isAlreadySelected(self, item))
  12720. self.addNewTag(self, item);
  12721. });
  12722. self.tagValuesSet(self);
  12723. self.inputResize(self);
  12724. } else {//单选模式初始化
  12725. var row = data[0];
  12726. $(self.elem.combo_input).val(getText(row));
  12727. $(self.elem.hidden).val(row[self.option.keyField]);
  12728. self.prop.prev_value = getText(row);
  12729. self.prop.selected_text = getText(row);
  12730. if (self.option.selectOnly) {
  12731. $(self.elem.combo_input).attr('title', self.message.select_ok).removeClass(self.css_class.select_ng).addClass(self.css_class.select_ok);
  12732. }
  12733. self.putClearButton();
  12734. }
  12735. };
  12736. /**
  12737. * @desc 下拉按钮的事件处理
  12738. */
  12739. SelectPage.prototype.eDropdownButton = function () {
  12740. var self = this;
  12741. $(self.elem.button).mouseup(function (ev) {
  12742. ev.stopPropagation();
  12743. if ($(self.elem.result_area).is(':hidden') && !$(self.elem.combo_input).prop('disabled')) {
  12744. $(self.elem.combo_input).focus();
  12745. } else
  12746. self.hideResults(self);
  12747. }).mouseout(); // default: mouseout
  12748. };
  12749. /**
  12750. * @desc 输入框的事件绑定
  12751. */
  12752. SelectPage.prototype.eInput = function () {
  12753. var self = this;
  12754. var showList = function () {
  12755. self.prop.page_move = false;
  12756. self.suggest(self);
  12757. self.setCssFocusedInput(self);
  12758. };
  12759. $(self.elem.combo_input).keyup(function (e) {
  12760. self.processKey(self, e);
  12761. }).keydown(function (e) {
  12762. self.processControl(self, e);
  12763. }).focus(function (e) {
  12764. //增加输入框获得焦点后,显示数据列表
  12765. if ($(self.elem.result_area).is(':hidden')) {
  12766. e.stopPropagation();
  12767. self.prop.first_show = true;
  12768. showList();
  12769. }
  12770. });
  12771. $(self.elem.container).on('click.SelectPage', 'div.' + self.css_class.clear_btn, function (e) {
  12772. e.stopPropagation();
  12773. self.clearAll(self);
  12774. $(self.elem.clear_btn).remove();
  12775. if (self.option.eClear && $.isFunction(self.option.eClear))
  12776. self.option.eClear();
  12777. });
  12778. if (self.option.multiple) {
  12779. if (self.option.multipleControlbar) {
  12780. //全选本页按钮
  12781. $('.sp_select_all', self.elem.control).on('click.SelectPage', function (e) {
  12782. self.selectAllLine(self);
  12783. });
  12784. //取消全选本页按钮
  12785. $('.sp_unselect_all', self.elem.control).on('click.SelectPage', function (e) {
  12786. self.unselectAllLine(self);
  12787. });
  12788. //清除全部按钮
  12789. $('.sp_clear_all', self.elem.control).on('click.SelectPage', function (e) {
  12790. self.clearAll(self);
  12791. });
  12792. }
  12793. $(self.elem.element_box).on('click.SelectPage', function (e) {
  12794. var srcEl = e.target || e.srcElement;
  12795. if ($(srcEl).is('ul'))
  12796. $(self.elem.combo_input).focus();
  12797. });
  12798. //标签关闭操作
  12799. //关闭同时需要将该标签的key从已保存的隐藏域中删除
  12800. $(self.elem.element_box).on('click.SelectPage', 'span.tag_close', function () {
  12801. var li = $(this).closest('li');
  12802. self.removeTag(self, li);
  12803. showList();
  12804. if (self.option.eTagRemove && $.isFunction(self.option.eTagRemove))
  12805. self.option.eTagRemove(1);
  12806. });
  12807. self.inputResize(self);
  12808. }
  12809. };
  12810. /**
  12811. * 插件之外区域的事件处理
  12812. */
  12813. SelectPage.prototype.eWhole = function () {
  12814. var self = this;
  12815. /*
  12816. //如果是点击了控件本身则不响应外部鼠标点击事件
  12817. $(self.elem.container).mousedown(function() {
  12818. var thisindex = $('div.sp_container').index(this);
  12819. var lastindex = $(document.body).data(SelectPage.objStatusIndex);
  12820. if(lastindex != undefined && thisindex != lastindex)
  12821. $(document.body).data(SelectPage.objStatusKey,false);
  12822. else
  12823. $(document.body).data(SelectPage.objStatusKey,true);
  12824. $(document.body).data(SelectPage.objStatusIndex,thisindex);
  12825. });
  12826. */
  12827. //控件外部的鼠标点击事件处理
  12828. $(document).off('mousedown.selectPage').on('mousedown.selectPage', function (e) {
  12829. var ele = e.target || e.srcElement;
  12830. var sm = $(ele).closest('div.' + self.css_class.container);
  12831. //清除内容
  12832. var cleanContent = function (obj) {
  12833. $(obj.elem.combo_input).val('');
  12834. if (!obj.option.multiple)
  12835. $(obj.elem.hidden).val('');
  12836. obj.prop.selected_text = '';
  12837. };
  12838. //列表是打开的状态
  12839. $('div.' + self.css_class.container + '.' + self.css_class.container_open).each(function () {
  12840. if (this == sm[0])
  12841. return;
  12842. var d = $('input.' + self.css_class.input, this).data(SelectPage.dataKey);
  12843. //若控件已有选中的的项目,而文本输入框中清空了关键字,则清空控件已选中的项目
  12844. if (!$(d.elem.combo_input).val() && $(d.elem.hidden).val() && !d.option.multiple) {
  12845. d.prop.current_page = 1;//重置当前页为1
  12846. cleanContent(d);
  12847. d.hideResults(d);
  12848. return true;
  12849. }
  12850. //匹配项且高亮时,下拉分页控件失去焦点后,自动选择该项目
  12851. if ($('li', $(d.elem.results)).size() > 0) {
  12852. if (d.option.autoFillResult) {//打开自动内容填充功能
  12853. //若已有选中项目,则直接隐藏列表
  12854. if ($('li.sp_selected', $(d.elem.results)).size() > 0) {
  12855. d.hideResults(d);
  12856. } else if ($('li.sp_over', $(d.elem.results)).size() > 0) {
  12857. //若控件已有选中的值,则忽略高亮的项目
  12858. if ($(d.elem.hidden).val())
  12859. d.hideResults(d);
  12860. //若没有已选中的项目,且列表中有高亮项目时,选中当前高亮的行
  12861. else
  12862. d.selectCurrentLine(d, true);
  12863. } else if (d.option.autoSelectFirst) {
  12864. //若控件已有选中的值,则忽略自动选择第一项的功能
  12865. if ($(d.elem.hidden).val())
  12866. d.hideResults(d);
  12867. else {
  12868. //对于没有选中,没有高亮的情况,若插件设置了自动选中第一项时,则选中第一项
  12869. d.nextLine(d);
  12870. //self.nextLine(self);
  12871. d.selectCurrentLine(d, true);
  12872. }
  12873. } else
  12874. d.hideResults(d);
  12875. } else
  12876. d.hideResults(d);
  12877. } else {
  12878. //无匹配项目时,自动清空用户输入的关键词
  12879. if (d.option.noResultClean)
  12880. cleanContent(d);
  12881. else {
  12882. if (!d.option.multiple)
  12883. $(d.elem.hidden).val('');
  12884. }
  12885. d.hideResults(d);
  12886. }
  12887. });
  12888. /*
  12889. if ($(document.body).data(SelectPage.objStatusKey)) $(document.body).data(SelectPage.objStatusKey,false);
  12890. else {
  12891. //清除内容
  12892. var cleanContent = function(obj){
  12893. $(obj.elem.combo_input).val('');
  12894. if(!obj.option.multiple) $(obj.elem.hidden).val('');
  12895. obj.prop.selected_text = '';
  12896. };
  12897. //列表是打开的状态
  12898. $('div.' + self.css_class.container + '.' + self.css_class.container_open).each(function(){
  12899. var d = $('input.'+self.css_class.input,this).data(SelectPage.dataKey);
  12900. //若控件已有选中的的项目,而文本输入框中清空了关键字,则清空控件已选中的项目
  12901. if(!$(d.elem.combo_input).val() && $(d.elem.hidden).val() && !d.option.multiple){
  12902. d.prop.current_page = 1;//重置当前页为1
  12903. cleanContent(d);
  12904. d.hideResults(d);
  12905. return true;
  12906. }
  12907. //匹配项且高亮时,下拉分页控件失去焦点后,自动选择该项目
  12908. if ($('li', $(d.elem.results)).size() > 0) {
  12909. if(d.option.autoFillResult) {//打开自动内容填充功能
  12910. //若已有选中项目,则直接隐藏列表
  12911. if ($('li.sp_selected', $(d.elem.results)).size() > 0) {
  12912. d.hideResults(d);
  12913. }else if($('li.sp_over', $(d.elem.results)).size() > 0){
  12914. //若控件已有选中的值,则忽略高亮的项目
  12915. if($(d.elem.hidden).val()) d.hideResults(d);
  12916. //若没有已选中的项目,且列表中有高亮项目时,选中当前高亮的行
  12917. else d.selectCurrentLine(d, true);
  12918. }else if(d.option.autoSelectFirst){
  12919. //若控件已有选中的值,则忽略自动选择第一项的功能
  12920. if($(d.elem.hidden).val()) d.hideResults(d);
  12921. else{
  12922. //对于没有选中,没有高亮的情况,若插件设置了自动选中第一项时,则选中第一项
  12923. d.nextLine(d);
  12924. //self.nextLine(self);
  12925. d.selectCurrentLine(d, true);
  12926. }
  12927. }else d.hideResults(d);
  12928. }else d.hideResults(d);
  12929. } else {
  12930. //无匹配项目时,自动清空用户输入的关键词
  12931. if (d.option.noResultClean) cleanContent(d);
  12932. else{
  12933. if(!d.option.multiple) $(d.elem.hidden).val('');
  12934. }
  12935. d.hideResults(d);
  12936. }
  12937. });
  12938. }
  12939. */
  12940. });
  12941. };
  12942. /**
  12943. * @desc 结果列表的事件处理
  12944. */
  12945. SelectPage.prototype.eResultList = function () {
  12946. var self = this;
  12947. $(self.elem.results).children('li').mouseenter(function () {
  12948. if (self.prop.key_select) {
  12949. self.prop.key_select = false;
  12950. return;
  12951. }
  12952. if (!$(this).hasClass(self.css_class.selected) && !$(this).hasClass('sp_message_box')) {
  12953. $(this).addClass(self.css_class.select);
  12954. self.setCssFocusedResults(self);
  12955. }
  12956. }).mouseleave(function () {
  12957. $(this).removeClass(self.css_class.select);
  12958. }).click(function (e) {
  12959. if (self.prop.key_select) {
  12960. self.prop.key_select = false;
  12961. return;
  12962. }
  12963. e.preventDefault();
  12964. e.stopPropagation();
  12965. if (!$(this).hasClass(self.css_class.selected))
  12966. self.selectCurrentLine(self, false);
  12967. });
  12968. };
  12969. /**
  12970. * @desc 分页导航按钮的事件处理
  12971. */
  12972. SelectPage.prototype.ehNaviPaging = function () {
  12973. var self = this;
  12974. if (!self.option.pagination)
  12975. return;
  12976. $('li.csFirstPage', $(self.elem.navi)).off('click').on('click', function (ev) {
  12977. //$(self.elem.combo_input).focus();
  12978. ev.preventDefault();
  12979. self.firstPage(self);
  12980. });
  12981. $('li.csPreviousPage', $(self.elem.navi)).off('click').on('click', function (ev) {
  12982. //$(self.elem.combo_input).focus();
  12983. ev.preventDefault();
  12984. self.prevPage(self);
  12985. });
  12986. $('li.csNextPage', $(self.elem.navi)).off('click').on('click', function (ev) {
  12987. //$(self.elem.combo_input).focus();
  12988. ev.preventDefault();
  12989. self.nextPage(self);
  12990. });
  12991. $('li.csLastPage', $(self.elem.navi)).off('click').on('click', function (ev) {
  12992. //$(self.elem.combo_input).focus();
  12993. ev.preventDefault();
  12994. self.lastPage(self);
  12995. });
  12996. };
  12997. /**
  12998. * @desc Ajax请求失败的处理
  12999. * @param {Object} self - 插件内部对象
  13000. * @param {string} errorThrown - Ajax的错误输出内容
  13001. */
  13002. SelectPage.prototype.ajaxErrorNotify = function (self, errorThrown) {
  13003. self.showMessage(self.message.ajax_error);
  13004. };
  13005. /**
  13006. * @desc 交互消息显示
  13007. * @param {Object} self - 插件内部对象
  13008. * @param msg {string} 需要提示的文本
  13009. */
  13010. SelectPage.prototype.showMessage = function (self, msg) {
  13011. if (!msg)
  13012. return;
  13013. var msgLi = '<li class="sp_message_box"><i class="fa fa-exclamation-triangle"></i> ' + msg + '</li>';
  13014. $(self.elem.results).empty().append(msgLi);
  13015. self.calcResultsSize(self);
  13016. $(self.elem.container).addClass(self.css_class.container_open);
  13017. $(self.elem.control).hide();
  13018. if (self.option.pagination)
  13019. $(self.elem.navi).hide();
  13020. };
  13021. /**
  13022. * @desc 窗口滚动处理
  13023. * @param {Object} self - 插件内部对象
  13024. * @param {boolean} enforce - 是否定位到输入框的位置
  13025. */
  13026. SelectPage.prototype.scrollWindow = function (self, enforce) {
  13027. var current_result = self.getCurrentLine(self);
  13028. var target_top = (current_result && !enforce) ? current_result.offset().top : $(self.elem.container).offset().top;
  13029. var target_size;
  13030. self.prop.size_li = $(self.elem.results).children('li:first').outerHeight();
  13031. target_size = self.prop.size_li;
  13032. var client_height = $(window).height();
  13033. var scroll_top = $(window).scrollTop();
  13034. var scroll_bottom = scroll_top + client_height - target_size;
  13035. // 滚动处理
  13036. var gap;
  13037. if ($(current_result).length) {
  13038. if (target_top < scroll_top || target_size > client_height) {
  13039. //滚动到顶部
  13040. gap = target_top - scroll_top;
  13041. } else if (target_top > scroll_bottom) {
  13042. //向下滚动
  13043. gap = target_top - scroll_bottom;
  13044. } else
  13045. return; //不进行滚动
  13046. } else if (target_top < scroll_top)
  13047. gap = target_top - scroll_top;
  13048. window.scrollBy(0, gap);
  13049. };
  13050. /**
  13051. * @desc 输入框获得焦点的样式设置
  13052. * @param {Object} self - 插件内部对象
  13053. */
  13054. SelectPage.prototype.setCssFocusedInput = function (self) {
  13055. //$(self.elem.results).addClass(self.css_class.re_off);
  13056. //$(self.elem.combo_input).removeClass(self.css_class.input_off);
  13057. };
  13058. /**
  13059. * @desc 设置结果列表高亮,输入框失去焦点
  13060. * @param {Object} self - 插件内部对象
  13061. */
  13062. SelectPage.prototype.setCssFocusedResults = function (self) {
  13063. //$(self.elem.results).removeClass(self.css_class.re_off);
  13064. //$(self.elem.combo_input).addClass(self.css_class.input_off);
  13065. };
  13066. /**
  13067. * @desc 输入框输入值的变化监控
  13068. * @param {Object} self - 插件内部对象
  13069. */
  13070. SelectPage.prototype.checkValue = function (self) {
  13071. var now_value = $(self.elem.combo_input).val();
  13072. if (now_value != self.prop.prev_value) {
  13073. self.prop.prev_value = now_value;
  13074. self.prop.first_show = false;
  13075. if (self.option.selectOnly)
  13076. self.setButtonAttrDefault();
  13077. if (!self.option.multiple && !now_value) {
  13078. self.clearAll(self);
  13079. $(self.elem.clear_btn).remove();
  13080. }
  13081. self.suggest(self);
  13082. }
  13083. };
  13084. /**
  13085. * @desc 文本输入框键盘事件处理(普通字符输入处理)
  13086. * @param {Object} self - 插件内部对象
  13087. * @param {Object} e - 事件event对象
  13088. */
  13089. SelectPage.prototype.processKey = function (self, e) {
  13090. if ($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9, 13]) === -1) {
  13091. if (e.keyCode != 16)
  13092. self.setCssFocusedInput(self); // except Shift(16)
  13093. self.inputResize(self);
  13094. if ($.type(self.option.data) === 'string') {
  13095. self.prop.last_input_time = e.timeStamp;
  13096. setTimeout(function () {
  13097. if ((e.timeStamp - self.prop.last_input_time) === 0)
  13098. self.checkValue(self);
  13099. }, self.option.inputDelay * 1000);
  13100. } else {
  13101. self.checkValue(self);
  13102. }
  13103. }
  13104. }
  13105. /**
  13106. * @desc 文本输入框键盘事件处理(控制键处理)
  13107. * @param {Object} self - 插件内部对象
  13108. * @param {Object} e - 事件event对象
  13109. */
  13110. SelectPage.prototype.processControl = function (self, e) {
  13111. if (($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9]) > -1 && $(self.elem.result_area).is(':visible')) ||
  13112. ($.inArray(e.keyCode, [13, 9]) > -1 && self.getCurrentLine(self))) {
  13113. e.preventDefault();
  13114. e.stopPropagation();
  13115. e.cancelBubble = true;
  13116. e.returnValue = false;
  13117. switch (e.keyCode) {
  13118. case 37:
  13119. // left
  13120. if (e.shiftKey)
  13121. self.firstPage(self);
  13122. else
  13123. self.prevPage(self);
  13124. break;
  13125. case 38:
  13126. // up
  13127. self.prop.key_select = true;
  13128. self.prevLine(self);
  13129. break;
  13130. case 39:
  13131. // right
  13132. if (e.shiftKey)
  13133. self.lastPage(self);
  13134. else
  13135. self.nextPage(self);
  13136. break;
  13137. case 40:
  13138. // down
  13139. if ($(self.elem.results).children('li').length) {
  13140. self.prop.key_select = true;
  13141. self.nextLine(self);
  13142. } else
  13143. self.suggest(self);
  13144. break;
  13145. case 9:
  13146. // tab
  13147. self.prop.key_paging = true;
  13148. self.selectCurrentLine(self, true);
  13149. //self.hideResults(self);
  13150. break;
  13151. case 13:
  13152. // return
  13153. self.selectCurrentLine(self, true);
  13154. break;
  13155. case 27:
  13156. // escape
  13157. self.prop.key_paging = true;
  13158. self.hideResults(self);
  13159. break;
  13160. }
  13161. }
  13162. };
  13163. /**
  13164. * @desc 中断Ajax请求
  13165. * @param {Object} self - 插件内部对象
  13166. */
  13167. SelectPage.prototype.abortAjax = function (self) {
  13168. if (self.prop.xhr) {
  13169. self.prop.xhr.abort();
  13170. self.prop.xhr = false;
  13171. }
  13172. };
  13173. /**
  13174. * @desc 数据查询
  13175. * @param {Object} self - 插件内部对象
  13176. */
  13177. SelectPage.prototype.suggest = function (self) {
  13178. //搜索关键字
  13179. var q_word;
  13180. var val = $.trim($(self.elem.combo_input).val());
  13181. if (self.option.multiple)
  13182. q_word = val;
  13183. else {
  13184. if (val && val === self.prop.selected_text)
  13185. q_word = '';
  13186. else
  13187. q_word = val;
  13188. }
  13189. q_word = q_word.split(/[\s ]+/);
  13190. self.abortAjax(self);
  13191. self.setLoading(self);
  13192. var which_page_num = self.prop.current_page > 0 ? self.prop.current_page : 1;
  13193. // 数据查询
  13194. if (typeof self.option.data == 'object')
  13195. self.searchForJson(self, q_word, which_page_num);
  13196. else
  13197. self.searchForDb(self, q_word, which_page_num);
  13198. };
  13199. /**
  13200. * @private
  13201. * @desc 读取中状态显示
  13202. * @param {Object} self - 插件内部对象
  13203. */
  13204. SelectPage.prototype.setLoading = function (self) {
  13205. //加载中的状态提示
  13206. if ($(self.elem.results).html() === '') {
  13207. //self.calcResultsSize(self);
  13208. $(self.elem.container).addClass(self.css_class.container_open);
  13209. }
  13210. };
  13211. /**
  13212. * @desc 服务端数据查询
  13213. * @param {Object} self - 插件内部对象
  13214. * @param {Array} q_word - 查询关键字
  13215. * @param {number} which_page_num - 目标页
  13216. */
  13217. SelectPage.prototype.searchForDb = function (self, q_word, which_page_num) {
  13218. if (!self.option.eAjaxSuccess || !$.isFunction(self.option.eAjaxSuccess))
  13219. self.hideResults(self);
  13220. /**
  13221. * 增加自定义查询参数
  13222. */
  13223. var _paramsFunc = self.option.params;
  13224. var _params = {};
  13225. //原始参数
  13226. var searchKey = self.option.searchField;
  13227. //若有查询关键字,则重置当前页码为1
  13228. if (q_word.length > 0 && q_word[0] && q_word[0] !== self.prop.prev_value)
  13229. which_page_num = 1;
  13230. var _orgParams = {
  13231. q_word: q_word,
  13232. pageNumber: which_page_num,
  13233. pageSize: self.option.pageSize,
  13234. andOr: self.option.andOr,
  13235. orderBy: self.option.orderBy,
  13236. searchTable: self.option.dbTable,
  13237. page: which_page_num,
  13238. per_page: self.option.pageSize,
  13239. and_or: self.option.andOr,
  13240. order_by: self.option.orderBy,
  13241. field: self.option.showField,
  13242. pkey_name: self.option.keyField,
  13243. search_field: searchKey
  13244. };
  13245. _orgParams[searchKey] = q_word[0];
  13246. if (_paramsFunc) {
  13247. var result = $.isFunction(_paramsFunc) ? _paramsFunc() : _paramsFunc;
  13248. if (result && $.isPlainObject(result)) {
  13249. _params = $.extend({}, _orgParams, result);
  13250. } else {
  13251. _params = _orgParams;
  13252. }
  13253. } else {
  13254. _params = _orgParams;
  13255. }
  13256. //增加自定义查询参数End
  13257. self.prop.xhr = $.ajax({
  13258. dataType: 'json',
  13259. url: self.option.data,
  13260. type: 'POST',
  13261. data: _params,
  13262. success: function (returnData) {
  13263. if (!returnData || !$.isPlainObject(returnData)) {
  13264. self.hideResults(self);
  13265. self.ajaxErrorNotify(self);
  13266. return;
  13267. }
  13268. var data;
  13269. if (self.option.eAjaxSuccess && $.isFunction(self.option.eAjaxSuccess)) {
  13270. data = self.option.eAjaxSuccess(returnData);
  13271. } else {
  13272. data = returnData;
  13273. }
  13274. //数据结构处理
  13275. var json = {};
  13276. json.originalResult = data.list;
  13277. json.cnt_whole = typeof data.total !== 'undefined' ? data.total : (typeof data.totalRow !== 'undefined' ? data.totalRow : data.list.length);
  13278. json.candidate = [];
  13279. json.keyField = [];
  13280. if (typeof json.originalResult != 'object') {
  13281. self.prop.xhr = null;
  13282. self.notFoundSearch(self);
  13283. return;
  13284. }
  13285. json.cnt_page = json.originalResult.length;
  13286. for (var i = 0; i < json.cnt_page; i++) {
  13287. for (var key in json.originalResult[i]) {
  13288. if (key == self.option.keyField) {
  13289. json.keyField.push(json.originalResult[i][key]);
  13290. }
  13291. if (key == self.option.showField) {
  13292. json.candidate.push(json.originalResult[i][key]);
  13293. }
  13294. }
  13295. }
  13296. self.prepareResults(self, json, q_word, which_page_num);
  13297. },
  13298. error: function (jqXHR, textStatus, errorThrown) {
  13299. if (textStatus != 'abort') {
  13300. self.hideResults(self);
  13301. self.ajaxErrorNotify(self, errorThrown);
  13302. }
  13303. },
  13304. complete: function () {
  13305. self.prop.xhr = null;
  13306. }
  13307. });
  13308. };
  13309. /**
  13310. * @desc 对JSON源数据进行搜索
  13311. * @param {Object} self - 插件内部对象
  13312. * @param {Array} q_word - 搜索关键字
  13313. * @param {number} which_page_num - 目标页数
  13314. */
  13315. SelectPage.prototype.searchForJson = function (self, q_word, which_page_num) {
  13316. var matched = [];
  13317. var esc_q = [];
  13318. var sorted = [];
  13319. var json = {};
  13320. var i = 0;
  13321. var arr_reg = [];
  13322. //查询条件过滤
  13323. do {
  13324. //'/\W/g'正则代表全部不是字母,数字,下划线,汉字的字符
  13325. //将非法字符进行转义
  13326. esc_q[i] = q_word[i].replace(/\W/g, '\\$&').toString();
  13327. arr_reg[i] = new RegExp(esc_q[i], 'gi');
  13328. i++;
  13329. } while (i < q_word.length);
  13330. // SELECT * FROM data WHERE field LIKE q_word;
  13331. for (i = 0; i < self.option.data.length; i++) {
  13332. var flag = false;
  13333. var row = self.option.data[i];
  13334. for (var j = 0; j < arr_reg.length; j++) {
  13335. var itemText = row[self.option.showField];//默认获取showField字段的文本
  13336. if (self.option.formatItem && $.isFunction(self.option.formatItem))
  13337. itemText = self.option.formatItem(row);
  13338. if (itemText.match(arr_reg[j])) {
  13339. flag = true;
  13340. if (self.option.andOr == 'OR')
  13341. break;
  13342. } else {
  13343. flag = false;
  13344. if (self.option.andOr == 'AND')
  13345. break;
  13346. }
  13347. }
  13348. if (flag)
  13349. matched.push(row);
  13350. }
  13351. // (CASE WHEN ...) 然后 く order 指定列
  13352. var reg1 = new RegExp('^' + esc_q[0] + '$', 'gi');
  13353. var reg2 = new RegExp('^' + esc_q[0], 'gi');
  13354. var matched1 = [];
  13355. var matched2 = [];
  13356. var matched3 = [];
  13357. for (i = 0; i < matched.length; i++) {
  13358. var orderField = self.option.orderBy[0][0];
  13359. var orderValue = String(matched[i][orderField]);
  13360. if (orderValue.match(reg1)) {
  13361. matched1.push(matched[i]);
  13362. } else if (orderValue.match(reg2)) {
  13363. matched2.push(matched[i]);
  13364. } else {
  13365. matched3.push(matched[i]);
  13366. }
  13367. }
  13368. if (self.option.orderBy[0][1].match(/^asc$/i)) {
  13369. matched1 = self.sortAsc(self, matched1);
  13370. matched2 = self.sortAsc(self, matched2);
  13371. matched3 = self.sortAsc(self, matched3);
  13372. } else {
  13373. matched1 = self.sortDesc(self, matched1);
  13374. matched2 = self.sortDesc(self, matched2);
  13375. matched3 = self.sortDesc(self, matched3);
  13376. }
  13377. sorted = sorted.concat(matched1).concat(matched2).concat(matched3);
  13378. //若没有匹配项目,则结束搜索
  13379. /*
  13380. if (sorted.length === undefined || sorted.length === 0 ) {
  13381. self.notFoundSearch(self);
  13382. return;
  13383. }
  13384. */
  13385. json.cnt_whole = sorted.length;
  13386. //page_move参数用于区别数据加载是在初始化列表还是在进行分页的翻页操作
  13387. if (!self.prop.page_move) {
  13388. //仅单选模式进行选中项目定位页功能
  13389. if (!self.option.multiple) {
  13390. //若控件当前已有选中值,则获得该项目所在的页数,并跳转到该页进行显示
  13391. var currentValue = $(self.elem.hidden).val();
  13392. if ($.type(currentValue) !== 'undefined' && $.trim(currentValue) !== '') {
  13393. var index = 0;
  13394. $.each(sorted, function (i, row) {
  13395. if (row[self.option.keyField] == currentValue) {
  13396. index = i + 1;
  13397. return false;
  13398. }
  13399. });
  13400. which_page_num = Math.ceil(index / self.option.pageSize);
  13401. if (which_page_num < 1)
  13402. which_page_num = 1;
  13403. self.prop.current_page = which_page_num;
  13404. }
  13405. }
  13406. } else {
  13407. //过滤后的数据个数不足一页显示的个数时,强制设置页码
  13408. if (sorted.length <= ((which_page_num - 1) * self.option.pageSize)) {
  13409. which_page_num = 1;
  13410. self.prop.current_page = 1;
  13411. }
  13412. }
  13413. // LIMIT xx OFFSET xx
  13414. var start = (which_page_num - 1) * self.option.pageSize;
  13415. var end = start + self.option.pageSize;
  13416. //储存原始行数据,包括所有属性
  13417. json.originalResult = [];
  13418. // 查询后的数据处理
  13419. for (i = start; i < end; i++) {
  13420. if (sorted[i] === undefined)
  13421. break;
  13422. json.originalResult.push(sorted[i]);
  13423. for (var key in sorted[i]) {
  13424. if (key == self.option.keyField) {
  13425. if (json.keyField === undefined)
  13426. json.keyField = [];
  13427. json.keyField.push(sorted[i][key]);
  13428. }
  13429. if (key == self.option.showField) {
  13430. if (json.candidate === undefined)
  13431. json.candidate = [];
  13432. json.candidate.push(sorted[i][key]);
  13433. }
  13434. }
  13435. }
  13436. if (json.candidate === undefined)
  13437. json.candidate = [];
  13438. json.cnt_page = json.candidate.length;
  13439. self.prepareResults(self, json, q_word, which_page_num);
  13440. };
  13441. /**
  13442. * @desc 升序排序
  13443. * @param {Object} self - 插件内部对象
  13444. * @param {Array} arr - 结果集数组
  13445. */
  13446. SelectPage.prototype.sortAsc = function (self, arr) {
  13447. arr.sort(function (a, b) {
  13448. var valA = a[self.option.orderBy[0][0]];
  13449. var valB = b[self.option.orderBy[0][0]];
  13450. return $.type(valA) === 'number' ? valA - valB : String(valA).localeCompare(String(valB));
  13451. });
  13452. return arr;
  13453. };
  13454. /**
  13455. * @desc 降序排序
  13456. * @param {Object} self - 插件内部对象
  13457. * @param {Array} arr - 结果集数组
  13458. */
  13459. SelectPage.prototype.sortDesc = function (self, arr) {
  13460. arr.sort(function (a, b) {
  13461. var valA = a[self.option.orderBy[0][0]];
  13462. var valB = b[self.option.orderBy[0][0]];
  13463. return $.type(valA) === 'number' ? valB - valA : String(valB).localeCompare(String(valA));
  13464. });
  13465. return arr;
  13466. };
  13467. /**
  13468. * @desc 查询无结果的处理
  13469. * @param {Object} self - 插件内部对象
  13470. */
  13471. SelectPage.prototype.notFoundSearch = function (self) {
  13472. $(self.elem.results).empty();
  13473. self.calcResultsSize(self);
  13474. $(self.elem.container).addClass(self.css_class.container_open);
  13475. self.setCssFocusedInput(self);
  13476. };
  13477. /**
  13478. * @desc 查询结果处理
  13479. * @param {Object} self - 插件内部对象
  13480. * @param {Object} json - 数据结果
  13481. * @param {Array} q_word - 查询关键字
  13482. * @param {number} which_page_num - 目标页
  13483. */
  13484. SelectPage.prototype.prepareResults = function (self, json, q_word, which_page_num) {
  13485. //处理分页栏
  13486. if (self.option.pagination)
  13487. self.setNavi(self, json.cnt_whole, json.cnt_page, which_page_num);
  13488. if (!json.keyField)
  13489. json.keyField = false;
  13490. //仅选择模式
  13491. if (self.option.selectOnly && json.candidate.length === 1 && json.candidate[0] == q_word[0]) {
  13492. $(self.elem.hidden).val(json.keyField[0]);
  13493. this.setButtonAttrDefault();
  13494. }
  13495. //是否是输入关键词进行查找
  13496. var is_query = false;
  13497. if (q_word && q_word.length > 0 && q_word[0])
  13498. is_query = true;
  13499. //显示结果列表
  13500. self.displayResults(self, json, is_query);
  13501. };
  13502. /**
  13503. * @desc 生成分页栏
  13504. * @param {Object} self - 插件内部对象
  13505. * @param {number} cnt_whole - 数据总条数
  13506. * @param {number} cnt_page - 页面显示记录数
  13507. * @param {number} page_num - 当前页数
  13508. */
  13509. SelectPage.prototype.setNavi = function (self, cnt_whole, cnt_page, page_num) {
  13510. /**
  13511. * 生成分页条
  13512. */
  13513. var buildPageNav = function (self, pagebar, page_num, last_page) {
  13514. if ($('li', $(pagebar)).size() == 0) {
  13515. $(pagebar).empty();
  13516. //处理当当前页码为1时,首页和上一页按钮不允许点击
  13517. var btnclass = '', isNewFontAwesome = true;
  13518. //判断是否使用了font-awesome3.2.1
  13519. $.each(document.styleSheets, function (i, n) {
  13520. if (n && n.href && n.href.indexOf('font-awesome-3.2.1') != -1) {
  13521. isNewFontAwesome = false;
  13522. return false;
  13523. }
  13524. });
  13525. //为不同版本图标设置样式
  13526. var iconFist = 'fa fa-angle-double-left', iconPrev = 'fa fa-angle-left', iconNext = 'fa fa-angle-right', iconLast = 'fa fa-angle-double-right';
  13527. if (!isNewFontAwesome) {
  13528. iconFist = 'icon-step-backward';
  13529. iconPrev = 'icon-backward';
  13530. iconNext = 'icon-forward';
  13531. iconLast = 'icon-step-forward';
  13532. }
  13533. if (page_num == 1)
  13534. btnclass = ' disabled ';
  13535. //首页
  13536. $(pagebar).append('<li class="csFirstPage' + btnclass + '" title="' + self.message.first_title + '" ><a href="javascript:void(0);"> <i class="' + iconFist + '"></i> </a></li>');
  13537. //上一页
  13538. $(pagebar).append('<li class="csPreviousPage' + btnclass + '" title="' + self.message.prev_title + '" ><a href="javascript:void(0);"><i class="' + iconPrev + '"></i></a></li>');
  13539. var pageInfo = '第 ' + page_num + ' 页(共' + last_page + '页)';
  13540. //设置分页信息
  13541. $(pagebar).append('<li class="pageInfoBox"><a href="javascript:void(0);"> ' + pageInfo + ' </a></li>');
  13542. if (page_num == last_page)
  13543. btnclass = ' disabled ';
  13544. else
  13545. btnclass = '';
  13546. //首页
  13547. $(pagebar).append('<li class="csNextPage' + btnclass + '" title="' + self.message.next_title + '" ><a href="javascript:void(0);"><i class="' + iconNext + '"></i></a></li>');
  13548. //上一页
  13549. $(pagebar).append('<li class="csLastPage' + btnclass + '" title="' + self.message.last_title + '" ><a href="javascript:void(0);"> <i class="' + iconLast + '"></i> </a></li>');
  13550. }
  13551. };
  13552. var pagebar = $(self.elem.navi);
  13553. var last_page = Math.ceil(cnt_whole / self.option.pageSize); //计算总页数
  13554. if (last_page == 0)
  13555. page_num = 0;
  13556. else {
  13557. if (last_page < page_num)
  13558. page_num = last_page;
  13559. else if (page_num == 0)
  13560. page_num = 1;
  13561. }
  13562. self.prop.current_page = page_num;//更新当前页参数
  13563. self.prop.max_page = last_page;//更新总页数参数
  13564. buildPageNav(self, pagebar, page_num, last_page);
  13565. //刷新分页信息
  13566. var pageInfoBox = $('li.pageInfoBox', $(pagebar));
  13567. var pageInfo = '第 ' + page_num + ' 页(共' + last_page + '页)';
  13568. $(pageInfoBox).html('<a href="javascript:void(0);"> ' + pageInfo + ' </a>');
  13569. //更新分页样式
  13570. var dClass = 'disabled';
  13571. var first = $('li.csFirstPage', $(pagebar));
  13572. var previous = $('li.csPreviousPage', $(pagebar));
  13573. var next = $('li.csNextPage', $(pagebar));
  13574. var last = $('li.csLastPage', $(pagebar));
  13575. //处理首页,上一页按钮样式
  13576. if (page_num === 1 || page_num === 0) {
  13577. if (!$(first).hasClass(dClass))
  13578. $(first).addClass(dClass);
  13579. if (!$(previous).hasClass(dClass))
  13580. $(previous).addClass(dClass);
  13581. } else {
  13582. if ($(first).hasClass(dClass))
  13583. $(first).removeClass(dClass);
  13584. if ($(previous).hasClass(dClass))
  13585. $(previous).removeClass(dClass);
  13586. }
  13587. //处理下一页,最后一页按钮的样式
  13588. if (page_num == last_page || last_page == 0) {
  13589. if (!$(next).hasClass(dClass))
  13590. $(next).addClass(dClass);
  13591. if (!$(last).hasClass(dClass))
  13592. $(last).addClass(dClass);
  13593. } else {
  13594. if ($(next).hasClass(dClass))
  13595. $(next).removeClass(dClass);
  13596. if ($(last).hasClass(dClass))
  13597. $(last).removeClass(dClass);
  13598. }
  13599. if (last_page > 1)
  13600. self.ehNaviPaging(); //导航按钮的事件设置
  13601. };
  13602. /**
  13603. * @desc 显示结果集列表
  13604. * @param {Object} self - 插件内部对象
  13605. * @param {Object} json 源数据
  13606. * @param {boolean} is_query - 是否是通过关键字搜索(用于区分是鼠标点击下拉还是输入框输入关键字进行查找)
  13607. */
  13608. SelectPage.prototype.displayResults = function (self, json, is_query) {
  13609. $(self.elem.results).empty();
  13610. if (self.option.multiple && $.type(self.option.maxSelectLimit) === 'number' && self.option.maxSelectLimit > 0) {
  13611. var selectedSize = $('li.selected_tag', self.elem.element_box).size();
  13612. if (selectedSize > 0 && selectedSize >= self.option.maxSelectLimit) {
  13613. self.showMessage(self, '最多只能选择 ' + self.option.maxSelectLimit + ' 个项目');
  13614. return;
  13615. }
  13616. }
  13617. if (json.candidate.length > 0) {
  13618. var arr_candidate = json.candidate;
  13619. var arr_primary_key = json.keyField;
  13620. var keystr = $(self.elem.hidden).val();
  13621. var keyArr = keystr ? keystr.split(',') : new Array();
  13622. for (var i = 0; i < arr_candidate.length; i++) {
  13623. var itemText = '';
  13624. if (self.option.formatItem && $.isFunction(self.option.formatItem)) {
  13625. try {
  13626. itemText = self.option.formatItem(json.originalResult[i]);
  13627. } catch (e) {
  13628. console.error('formatItem内容格式化函数内容设置不正确!');
  13629. itemText = arr_candidate[i];
  13630. }
  13631. } else
  13632. itemText = arr_candidate[i];
  13633. //XSS対策
  13634. var list = $('<li>').html(itemText).attr({
  13635. pkey: arr_primary_key[i],
  13636. title: itemText
  13637. });
  13638. //选中项目设置高亮样式
  13639. if ($.inArray(arr_primary_key[i].toString(), keyArr) !== -1) {
  13640. $(list).addClass(self.css_class.selected);
  13641. }
  13642. //缓存原始行对象
  13643. $(list).data('dataObj', json.originalResult[i]);
  13644. $(self.elem.results).append(list);
  13645. }
  13646. } else {
  13647. var li = '<li class="sp_message_box"><i class="fa fa-exclamation-triangle"></i> ' + self.message.not_found + '</li>';
  13648. $(self.elem.results).append(li);
  13649. }
  13650. if (self.option.multiple && self.option.multipleControlbar)
  13651. $(self.elem.control).show();
  13652. if (self.option.pagination)
  13653. $(self.elem.navi).toggleClass("hide", json.cnt_whole <= json.cnt_page);
  13654. //显示结果集列表并调整位置
  13655. self.calcResultsSize(self);
  13656. $(self.elem.container).addClass(self.css_class.container_open);
  13657. //结果集列表事件绑定
  13658. self.eResultList();
  13659. //若是键盘输入关键字进行查询且有内容时,列表自动选中第一行(autoSelectFirst为true时)
  13660. if (is_query && json.candidate.length > 0 && self.option.autoSelectFirst)
  13661. self.nextLine(self);
  13662. };
  13663. /**
  13664. * @desc 处理结果列表尺寸及位置
  13665. * @param {Object} self - 插件内部对象
  13666. */
  13667. SelectPage.prototype.calcResultsSize = function (self) {
  13668. var rePosition = function () {
  13669. if ($(self.elem.container).css('position') === 'static') {
  13670. // position: static
  13671. var offset = $(self.elem.combo_input).offset();
  13672. $(self.elem.result_area).css({
  13673. top: offset.top + $(self.elem.combo_input).outerHeight() + 'px',
  13674. left: offset.left + 'px'
  13675. });
  13676. } else {
  13677. if (!self.option.pagination) {
  13678. var itemHeight = $('li:first', self.elem.results).outerHeight(true);
  13679. var listHeight = itemHeight * self.option.listSize;
  13680. $(self.elem.results).css({
  13681. 'max-height': listHeight,
  13682. 'overflow-y': 'auto'
  13683. });
  13684. }
  13685. //在展示下拉列表时,判断默认与输入框左对齐的列表是否会超出屏幕边界,是则右对齐,否则默认左对齐
  13686. var docWidth = $(document).width();
  13687. var docHeight = $(document).height();//文档全部高度
  13688. var viewHeight = $(window).height();//可视区域高度
  13689. var offset = $(self.elem.container).offset();
  13690. var screenScrollTop = $(window).scrollTop();
  13691. var listWidth = $(self.elem.result_area).outerWidth();
  13692. //当前状态,列表并未被显示,数据未被填充,列表并未展现最终高度,所以只能使用默认一页显示10条数据的固定高度进行计算
  13693. var listHeight = $(self.elem.result_area).outerHeight();
  13694. //默认方向的坐标,在多选模式下,因为外框架是DIV,所以需要向左靠一个像素
  13695. var defaultLeft = self.option.multiple ? -1 : 0;
  13696. //输入框高度
  13697. var inputHeight = $(self.elem.container).outerHeight();
  13698. var left = (offset.left + listWidth) > docWidth ? -(listWidth - $(self.elem.container).outerWidth()) : defaultLeft;
  13699. //控件在全文档范围中的实际TOP(非当前可视区域中的相对TOP)
  13700. var screenTop = offset.top;//$(self.elem.container).scrollTop();//offset.top - screenScrollTop;
  13701. var top = 0, dist = 5;//设置偏移量,让列表与输入框有5px的间距
  13702. //列表展开后的坐标高度
  13703. var listBottom = screenTop + inputHeight + listHeight + dist;
  13704. var hasOverflow = docHeight > viewHeight;
  13705. if ((screenTop - screenScrollTop - dist > listHeight) &&
  13706. (hasOverflow && listBottom > (viewHeight + screenScrollTop)) ||
  13707. (!hasOverflow && listBottom > viewHeight)) {
  13708. //控件当前位置+控件高度+列表高度超过实际body高度
  13709. //列表则需要向上展示
  13710. top = -(listHeight + 1) - dist;
  13711. $(self.elem.result_area).removeClass('shadowUp shadowDown').addClass('shadowUp');
  13712. } else {
  13713. //列表正常向下展示
  13714. top = self.option.multiple ? $(self.elem.container).innerHeight() + 1 : $(self.elem.container).outerHeight();
  13715. $(self.elem.result_area).removeClass('shadowUp shadowDown').addClass('shadowDown');
  13716. top += dist;
  13717. }
  13718. /*
  13719. $(self.elem.result_area).css({
  13720. top : top + 'px',
  13721. left: left + 'px'
  13722. });
  13723. */
  13724. return {
  13725. top: top + 'px',
  13726. left: left + 'px'
  13727. };
  13728. }
  13729. };
  13730. if ($(self.elem.result_area).is(':visible')) {
  13731. $(self.elem.result_area).css(rePosition());
  13732. } else {
  13733. $(self.elem.result_area).show(1, function () {
  13734. $(this).css(rePosition());
  13735. });
  13736. }
  13737. };
  13738. /**
  13739. * @desc 隐藏结果列表
  13740. * @param {Object} self - 插件内部对象
  13741. */
  13742. SelectPage.prototype.hideResults = function (self) {
  13743. if (self.prop.key_paging) {
  13744. self.scrollWindow(self, true);
  13745. self.prop.key_paging = false;
  13746. }
  13747. self.setCssFocusedInput(self);
  13748. if (self.option.autoFillResult) {
  13749. //self.selectCurrentLine(self, true);
  13750. }
  13751. $(self.elem.results).empty();
  13752. $(self.elem.result_area).hide();
  13753. $(self.elem.container).removeClass(self.css_class.container_open);
  13754. self.abortAjax(self);
  13755. self.setButtonAttrDefault(); // 按钮title属性初期化
  13756. };
  13757. /**
  13758. * @desc 跳转到首页
  13759. * @param {Object} self - 插件内部对象
  13760. */
  13761. SelectPage.prototype.firstPage = function (self) {
  13762. if (self.prop.current_page > 1) {
  13763. self.prop.current_page = 1;
  13764. self.prop.page_move = true;
  13765. self.suggest(self);
  13766. }
  13767. };
  13768. /**
  13769. * @desc 跳转到上一页
  13770. * @param {Object} self - 插件内部对象
  13771. */
  13772. SelectPage.prototype.prevPage = function (self) {
  13773. if (self.prop.current_page > 1) {
  13774. self.prop.current_page--;
  13775. self.prop.page_move = true;
  13776. self.suggest(self);
  13777. }
  13778. };
  13779. /**
  13780. * @desc 跳转到下一页
  13781. * @param {Object} self - 插件内部对象
  13782. */
  13783. SelectPage.prototype.nextPage = function (self) {
  13784. if (self.prop.current_page < self.prop.max_page) {
  13785. self.prop.current_page++;
  13786. self.prop.page_move = true;
  13787. self.suggest(self);
  13788. }
  13789. };
  13790. /**
  13791. * @desc 跳转到尾页
  13792. * @param {Object} self - 插件内部对象
  13793. */
  13794. SelectPage.prototype.lastPage = function (self) {
  13795. if (self.prop.current_page < self.prop.max_page) {
  13796. self.prop.current_page = self.prop.max_page;
  13797. self.prop.page_move = true;
  13798. self.suggest(self);
  13799. }
  13800. };
  13801. /**
  13802. * @desc 跳转到指定页
  13803. * @param {Object} self
  13804. * @param {number} page 目标页数
  13805. */
  13806. SelectPage.prototype.goPage = function (self, page) {
  13807. if (typeof (page) === 'undefined')
  13808. page = 1;
  13809. if (self.prop.current_page < self.prop.max_page) {
  13810. self.prop.current_page = page;
  13811. self.prop.page_move = true;
  13812. self.suggest(self);
  13813. }
  13814. };
  13815. /**
  13816. * @desc 操作结束后的一些收尾工作
  13817. */
  13818. SelectPage.prototype.afterAction = function (self) {
  13819. self.inputResize(self);
  13820. $(self.elem.combo_input).trigger("change");
  13821. $(self.elem.hidden).trigger("change");
  13822. self.setCssFocusedInput(self);
  13823. if (self.option.multiple) {
  13824. if (self.option.selectToCloseList) {
  13825. self.hideResults(self);
  13826. $(self.elem.combo_input).blur();
  13827. } else {
  13828. self.suggest(self);
  13829. $(self.elem.combo_input).focus();
  13830. }
  13831. } else {
  13832. self.hideResults(self);
  13833. $(self.elem.combo_input).blur();
  13834. }
  13835. };
  13836. /**
  13837. * @desc 选择当前行
  13838. * @param {Object} self - 插件内部对象
  13839. * @param {boolean} is_enter_key - 是否为回车键
  13840. */
  13841. SelectPage.prototype.selectCurrentLine = function (self, is_enter_key) {
  13842. self.scrollWindow(self, true);
  13843. var current = self.getCurrentLine(self);
  13844. if (current) {
  13845. if (!self.option.multiple) {
  13846. $(self.elem.combo_input).val($(current).text());
  13847. $(self.elem.hidden).val($(current).attr('pkey'));
  13848. } else {
  13849. //多选模式的项目选择处理
  13850. $(self.elem.combo_input).val('');
  13851. var item = {text: $(current).text(), value: $(current).attr('pkey')};
  13852. if (!self.isAlreadySelected(self, item)) {
  13853. self.addNewTag(self, item);
  13854. self.tagValuesSet(self);
  13855. }
  13856. }
  13857. if (self.option.selectOnly)
  13858. self.setButtonAttrDefault();
  13859. //项目选择回调函数触发
  13860. if (self.option.eSelect && $.isFunction(self.option.eSelect))
  13861. self.option.eSelect($(current).data('dataObj'));
  13862. self.prop.prev_value = $(self.elem.combo_input).val();
  13863. self.prop.selected_text = $(self.elem.combo_input).val();
  13864. self.putClearButton();
  13865. }
  13866. self.afterAction(self);
  13867. };
  13868. /**
  13869. * 单选模式下选中项目后,显示清空按钮
  13870. */
  13871. SelectPage.prototype.putClearButton = function () {
  13872. if (!this.option.multiple && !$(this.elem.combo_input).prop('disabled'))
  13873. $(this.elem.container).append(this.elem.clear_btn);
  13874. };
  13875. /**
  13876. * @desc 全选当前页的行
  13877. * @param {Object} self - 插件内部对象
  13878. */
  13879. SelectPage.prototype.selectAllLine = function (self) {
  13880. var jsonarr = new Array();
  13881. $('li', self.elem.results).each(function (i, row) {
  13882. var item = {text: $(row).text(), value: $(row).attr('pkey')};
  13883. if (!self.isAlreadySelected(self, item)) {
  13884. self.addNewTag(self, item);
  13885. self.tagValuesSet(self);
  13886. }
  13887. jsonarr.push($(row).data('dataObj'));
  13888. //若有最大选择数量限制,则添加最大个数后,不再添加
  13889. if ($.type(self.option.maxSelectLimit) === 'number' &&
  13890. self.option.maxSelectLimit > 0 &&
  13891. self.option.maxSelectLimit === $('li.selected_tag', self.elem.element_box).size()) {
  13892. return false;
  13893. }
  13894. });
  13895. if (self.option.eSelect && $.isFunction(self.option.eSelect))
  13896. self.option.eSelect(jsonarr);
  13897. self.afterAction(self);
  13898. };
  13899. /**
  13900. * @desc 取消选择本页全部项目
  13901. * @param {Object} self - 插件内部对象
  13902. */
  13903. SelectPage.prototype.unselectAllLine = function (self) {
  13904. var size = $('li', self.elem.results).size();
  13905. $('li', self.elem.results).each(function (i, row) {
  13906. var key = $(row).attr('pkey');
  13907. var tag = $('li.selected_tag[itemvalue="' + key + '"]', self.elem.element_box);
  13908. self.removeTag(self, tag);
  13909. });
  13910. self.afterAction(self);
  13911. if (self.option.eTagRemove && $.isFunction(self.option.eTagRemove))
  13912. self.option.eTagRemove(size);
  13913. };
  13914. /**
  13915. * @desc 清除所有选中的项目
  13916. * @param {Object} self - 插件内部对象
  13917. */
  13918. SelectPage.prototype.clearAll = function (self) {
  13919. var size = 0;
  13920. if (self.option.multiple) {
  13921. size = $('li.selected_tag', self.elem.element_box).size();
  13922. $('li.selected_tag', self.elem.element_box).remove();
  13923. }
  13924. $(self.elem.combo_input).val('');
  13925. $(self.elem.hidden).val('');
  13926. self.afterAction(self);
  13927. if (self.option.multiple) {
  13928. if (self.option.eTagRemove && $.isFunction(self.option.eTagRemove))
  13929. self.option.eTagRemove(size);
  13930. }
  13931. };
  13932. /**
  13933. * @desc 获得当前行对象
  13934. * @param {Object} self - 插件内部对象
  13935. */
  13936. SelectPage.prototype.getCurrentLine = function (self) {
  13937. if ($(self.elem.result_area).is(':hidden'))
  13938. return false;
  13939. var obj = $('li.' + self.css_class.select, self.elem.results);
  13940. if ($(obj).size())
  13941. return obj;
  13942. else
  13943. return false;
  13944. };
  13945. /**
  13946. * @desc 多选模式下判断当前选中项目是否已经存在已选中列表中
  13947. * @param {Object} self - 插件内部对象
  13948. * @param {Object} item - 选中行对象
  13949. */
  13950. SelectPage.prototype.isAlreadySelected = function (self, item) {
  13951. var isExist = false;
  13952. if (item.value) {
  13953. var keys = $(self.elem.hidden).val();
  13954. if (keys) {
  13955. var karr = keys.split(',');
  13956. if (karr && karr.length > 0 && $.inArray(item.value, karr) != -1)
  13957. isExist = true;
  13958. }
  13959. }
  13960. return isExist;
  13961. };
  13962. /**
  13963. * @desc 多选模式下增加一个标签
  13964. * @param {Object} self - 插件内部对象
  13965. * @param {Object} item - 选中行对象
  13966. */
  13967. SelectPage.prototype.addNewTag = function (self, item) {
  13968. if (!self.option.multiple || !item)
  13969. return;
  13970. var tmp = self.template.tag.content, tag;
  13971. tmp = tmp.replace(self.template.tag.textKey, item.text);
  13972. tmp = tmp.replace(self.template.tag.valueKey, item.value);
  13973. tag = $(tmp);
  13974. if ($(self.elem.combo_input).prop('disabled'))
  13975. $('span.tag_close', tag).hide();
  13976. $(self.elem.combo_input).closest('li').before(tag);
  13977. };
  13978. /**
  13979. * @desc 多选模式下移除一个标签
  13980. * @param {Object} self - 插件内部对象
  13981. * @param {Object} item - 标签对象
  13982. */
  13983. SelectPage.prototype.removeTag = function (self, item) {
  13984. var key = $(item).attr('itemvalue');
  13985. var keys = $(self.elem.hidden).val();
  13986. //从已保存的key列表中删除该标签对应的项目
  13987. if ($.type(key) != 'undefined' && keys) {
  13988. var keyarr = keys.split(',');
  13989. var index = $.inArray(key.toString(), keyarr);
  13990. if (index != -1) {
  13991. keyarr.splice(index, 1);
  13992. $(self.elem.hidden).val(keyarr.toString());
  13993. }
  13994. }
  13995. $(item).remove();
  13996. self.inputResize(self);
  13997. };
  13998. /**
  13999. * @desc 多选模式下标签结果值放入隐藏域
  14000. * @param {Object} self - 插件内部对象
  14001. */
  14002. SelectPage.prototype.tagValuesSet = function (self) {
  14003. if (!self.option.multiple)
  14004. return;
  14005. var tags = $('li.selected_tag', $(self.elem.element_box));
  14006. if (tags && $(tags).size() > 0) {
  14007. var result = new Array();
  14008. $.each(tags, function (i, li) {
  14009. var v = $(li).attr('itemvalue');
  14010. if ($.type(v) !== 'undefined')
  14011. result.push(v);
  14012. });
  14013. if (result.length > 0) {
  14014. $(self.elem.hidden).val(result.join(','));
  14015. }
  14016. }
  14017. };
  14018. /**
  14019. * @desc 多选模式下输入框根据输入内容调整输入框宽度
  14020. * @param {Object} self - 插件内部对象
  14021. */
  14022. SelectPage.prototype.inputResize = function (self) {
  14023. if (!self.option.multiple)
  14024. return;
  14025. var width = '';
  14026. var inputLi = self.elem.combo_input.closest('li');
  14027. //设置默认宽度
  14028. var setDefaultSize = function (self, inputLi) {
  14029. inputLi.removeClass('full_width');
  14030. var minimumWidth = self.elem.combo_input.val().length + 1;
  14031. var width = (minimumWidth * 0.75) + 'em';
  14032. self.elem.combo_input.css('width', width);
  14033. self.elem.combo_input.removeAttr('placeholder');
  14034. };
  14035. if ($('li.selected_tag', $(self.elem.element_box)).size() === 0) {
  14036. if (self.elem.combo_input.attr('placeholder_bak')) {
  14037. if (!inputLi.hasClass('full_width'))
  14038. inputLi.addClass('full_width');
  14039. self.elem.combo_input.attr('placeholder', self.elem.combo_input.attr('placeholder_bak'));
  14040. self.elem.combo_input.removeAttr('style');
  14041. } else
  14042. setDefaultSize(self, inputLi);
  14043. } else
  14044. setDefaultSize(self, inputLi);
  14045. };
  14046. /**
  14047. * @desc 选择下一行
  14048. * @param {Object} self - 插件内部对象
  14049. */
  14050. SelectPage.prototype.nextLine = function (self) {
  14051. var obj = self.getCurrentLine(self);
  14052. var idx;
  14053. if (!obj)
  14054. idx = -1;
  14055. else {
  14056. idx = $(self.elem.results).children('li').index(obj);
  14057. $(obj).removeClass(self.css_class.select);
  14058. }
  14059. idx++;
  14060. if (idx < $(self.elem.results).children('li').length) {
  14061. var next = $(self.elem.results).children('li').eq(idx);
  14062. $(next).addClass(self.css_class.select);
  14063. self.setCssFocusedResults(self);
  14064. } else
  14065. self.setCssFocusedInput(self);
  14066. self.scrollWindow(self, false);
  14067. };
  14068. /**
  14069. * @desc 选择上一行
  14070. * @param {Object} self - 插件内部对象
  14071. */
  14072. SelectPage.prototype.prevLine = function (self) {
  14073. var obj = self.getCurrentLine(self);
  14074. var idx;
  14075. if (!obj)
  14076. idx = $(self.elem.results).children('li').length;
  14077. else {
  14078. idx = $(self.elem.results).children('li').index(obj);
  14079. $(obj).removeClass(self.css_class.select);
  14080. }
  14081. idx--;
  14082. if (idx > -1) {
  14083. var prev = $(self.elem.results).children('li').eq(idx);
  14084. $(prev).addClass(self.css_class.select);
  14085. self.setCssFocusedResults(self);
  14086. } else
  14087. self.setCssFocusedInput(self);
  14088. self.scrollWindow(self, false);
  14089. };
  14090. /**
  14091. * @desc 下拉分页查询控件初始化入口
  14092. * @global
  14093. * @memberof jQuery,bootstrap2,bootstrap3
  14094. * @param option {Object} 初始化参数集
  14095. */
  14096. function Plugin(option) {
  14097. return this.each(function () {
  14098. var $this = $(this),
  14099. data = $this.data(SelectPage.dataKey),
  14100. params = $.extend({}, defaults, $this.data(), data && data.option, typeof option === 'object' && option);
  14101. if (!data)
  14102. $this.data(SelectPage.dataKey, (data = new SelectPage(this, params)));
  14103. });
  14104. }
  14105. /**
  14106. * 获得稿件内部对象
  14107. * @param {object} obj
  14108. * @returns
  14109. */
  14110. function getPlugin(obj) {
  14111. var container = $(obj).closest('div.sp_container');
  14112. return $('input.sp_input', container);
  14113. }
  14114. /**
  14115. * @desc 清除所有模式下选择的项目
  14116. */
  14117. function ClearSelected() {
  14118. return this.each(function () {
  14119. var $this = getPlugin(this),
  14120. data = $this.data(SelectPage.dataKey);
  14121. if (data)
  14122. data.clearAll(data);
  14123. });
  14124. }
  14125. /**
  14126. * 刷新选中项目内容
  14127. * 使用场景:使用$().val('xxx')修改插件的选中项目ID,此时需要刷新插件在输入框中的显示文本
  14128. */
  14129. function SelectedRefresh() {
  14130. return this.each(function () {
  14131. var $this = getPlugin(this),
  14132. data = $this.data(SelectPage.dataKey);
  14133. if (data && data.elem.hidden.val())
  14134. data.setInitRecord(true);
  14135. });
  14136. }
  14137. /**
  14138. * 修改插件数据源
  14139. * 仅在json数据源模式有效
  14140. * @param {array} data
  14141. * @example
  14142. * [{name:'aa',sex:1},{name:'bb',sex:0},{...}]
  14143. */
  14144. function ModifyDataSource(data) {
  14145. return this.each(function () {
  14146. if (data && $.isArray(data) && data.length > 0) {
  14147. var $this = getPlugin(this),
  14148. plugin = $this.data(SelectPage.dataKey);
  14149. if (plugin) {
  14150. plugin.clearAll(plugin);
  14151. plugin.option.data = data;
  14152. }
  14153. }
  14154. });
  14155. }
  14156. /**
  14157. * @desc 获得选中项目的文本
  14158. * @returns {string}
  14159. */
  14160. function GetInputText() {
  14161. var str = '';
  14162. this.each(function () {
  14163. var $this = getPlugin(this), data = $this.data(SelectPage.dataKey);
  14164. if (data)
  14165. str += data.elem.combo_input.val();
  14166. });
  14167. return str;
  14168. }
  14169. /**
  14170. * @desc 获得选中项目的数据
  14171. * @returns {String}
  14172. */
  14173. function GetInputValue() {
  14174. var str = '';
  14175. this.each(function () {
  14176. var $this = getPlugin(this), data = $this.data(SelectPage.dataKey);
  14177. if (data)
  14178. str += data.elem.hidden.val();
  14179. });
  14180. return str;
  14181. }
  14182. var old = $.fn.selectPage;
  14183. $.fn.selectPage = Plugin;
  14184. $.fn.selectPage.Constructor = SelectPage;
  14185. $.fn.selectPageClear = ClearSelected;
  14186. $.fn.selectPageRefresh = SelectedRefresh;
  14187. $.fn.selectPageData = ModifyDataSource;
  14188. $.fn.selectPageText = GetInputText;
  14189. $.fn.selectPageValue = GetInputValue;
  14190. // 处理新旧版本冲突
  14191. // =================
  14192. $.fn.selectPage.noConflict = function () {
  14193. $.fn.selectPage = old;
  14194. return this;
  14195. };
  14196. }));