jquery-ui-1.13.0.js 676 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087
  1. /*! jQuery UI - v1.13.0 - 2021-10-07
  2. * http://jqueryui.com
  3. * Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
  4. * Copyright jQuery Foundation and other contributors; Licensed MIT */
  5. (function (factory) {
  6. "use strict";
  7. if (typeof define === "function" && define.amd) {
  8. // AMD. Register as an anonymous module.
  9. define(["jquery"], factory);
  10. } else {
  11. // Browser globals
  12. factory(jQuery);
  13. }
  14. }
  15. )(function ($) {
  16. "use strict";
  17. $.ui = $.ui || {};
  18. var version = $.ui.version = "1.13.0";
  19. /*!
  20. * jQuery UI Widget 1.13.0
  21. * http://jqueryui.com
  22. *
  23. * Copyright jQuery Foundation and other contributors
  24. * Released under the MIT license.
  25. * http://jquery.org/license
  26. */
  27. //>>label: Widget
  28. //>>group: Core
  29. //>>description: Provides a factory for creating stateful widgets with a common API.
  30. //>>docs: http://api.jqueryui.com/jQuery.widget/
  31. //>>demos: http://jqueryui.com/widget/
  32. var widgetUuid = 0;
  33. var widgetHasOwnProperty = Array.prototype.hasOwnProperty;
  34. var widgetSlice = Array.prototype.slice;
  35. $.cleanData = (function (orig) {
  36. return function (elems) {
  37. var events, elem, i;
  38. for (i = 0; (elem = elems[i]) != null; i++) {
  39. // Only trigger remove when necessary to save time
  40. events = $._data(elem, "events");
  41. if (events && events.remove) {
  42. $(elem).triggerHandler("remove");
  43. }
  44. }
  45. orig(elems);
  46. }
  47. ;
  48. }
  49. )($.cleanData);
  50. $.widget = function (name, base, prototype) {
  51. var existingConstructor, constructor, basePrototype;
  52. // ProxiedPrototype allows the provided prototype to remain unmodified
  53. // so that it can be used as a mixin for multiple widgets (#8876)
  54. var proxiedPrototype = {};
  55. var namespace = name.split(".")[0];
  56. name = name.split(".")[1];
  57. var fullName = namespace + "-" + name;
  58. if (!prototype) {
  59. prototype = base;
  60. base = $.Widget;
  61. }
  62. if (Array.isArray(prototype)) {
  63. prototype = $.extend.apply(null, [{}].concat(prototype));
  64. }
  65. // Create selector for plugin
  66. $.expr.pseudos[fullName.toLowerCase()] = function (elem) {
  67. return !!$.data(elem, fullName);
  68. }
  69. ;
  70. $[namespace] = $[namespace] || {};
  71. existingConstructor = $[namespace][name];
  72. constructor = $[namespace][name] = function (options, element) {
  73. // Allow instantiation without "new" keyword
  74. if (!this._createWidget) {
  75. return new constructor(options, element);
  76. }
  77. // Allow instantiation without initializing for simple inheritance
  78. // must use "new" keyword (the code above always passes args)
  79. if (arguments.length) {
  80. this._createWidget(options, element);
  81. }
  82. }
  83. ;
  84. // Extend with the existing constructor to carry over any static properties
  85. $.extend(constructor, existingConstructor, {
  86. version: prototype.version,
  87. // Copy the object used to create the prototype in case we need to
  88. // redefine the widget later
  89. _proto: $.extend({}, prototype),
  90. // Track widgets that inherit from this widget in case this widget is
  91. // redefined after a widget inherits from it
  92. _childConstructors: []
  93. });
  94. basePrototype = new base();
  95. // We need to make the options hash a property directly on the new instance
  96. // otherwise we'll modify the options hash on the prototype that we're
  97. // inheriting from
  98. basePrototype.options = $.widget.extend({}, basePrototype.options);
  99. $.each(prototype, function (prop, value) {
  100. if (typeof value !== "function") {
  101. proxiedPrototype[prop] = value;
  102. return;
  103. }
  104. proxiedPrototype[prop] = (function () {
  105. function _super() {
  106. return base.prototype[prop].apply(this, arguments);
  107. }
  108. function _superApply(args) {
  109. return base.prototype[prop].apply(this, args);
  110. }
  111. return function () {
  112. var __super = this._super;
  113. var __superApply = this._superApply;
  114. var returnValue;
  115. this._super = _super;
  116. this._superApply = _superApply;
  117. returnValue = value.apply(this, arguments);
  118. this._super = __super;
  119. this._superApply = __superApply;
  120. return returnValue;
  121. }
  122. ;
  123. }
  124. )();
  125. });
  126. constructor.prototype = $.widget.extend(basePrototype, {
  127. // TODO: remove support for widgetEventPrefix
  128. // always use the name + a colon as the prefix, e.g., draggable:start
  129. // don't prefix for widgets that aren't DOM-based
  130. widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
  131. }, proxiedPrototype, {
  132. constructor: constructor,
  133. namespace: namespace,
  134. widgetName: name,
  135. widgetFullName: fullName
  136. });
  137. // If this widget is being redefined then we need to find all widgets that
  138. // are inheriting from it and redefine all of them so that they inherit from
  139. // the new version of this widget. We're essentially trying to replace one
  140. // level in the prototype chain.
  141. if (existingConstructor) {
  142. $.each(existingConstructor._childConstructors, function (i, child) {
  143. var childPrototype = child.prototype;
  144. // Redefine the child widget using the same prototype that was
  145. // originally used, but inherit from the new version of the base
  146. $.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto);
  147. });
  148. // Remove the list of existing child constructors from the old constructor
  149. // so the old child constructors can be garbage collected
  150. delete existingConstructor._childConstructors;
  151. } else {
  152. base._childConstructors.push(constructor);
  153. }
  154. $.widget.bridge(name, constructor);
  155. return constructor;
  156. }
  157. ;
  158. $.widget.extend = function (target) {
  159. var input = widgetSlice.call(arguments, 1);
  160. var inputIndex = 0;
  161. var inputLength = input.length;
  162. var key;
  163. var value;
  164. for (; inputIndex < inputLength; inputIndex++) {
  165. for (key in input[inputIndex]) {
  166. value = input[inputIndex][key];
  167. if (widgetHasOwnProperty.call(input[inputIndex], key) && value !== undefined) {
  168. // Clone objects
  169. if ($.isPlainObject(value)) {
  170. target[key] = $.isPlainObject(target[key]) ? $.widget.extend({}, target[key], value) :
  171. // Don't extend strings, arrays, etc. with objects
  172. $.widget.extend({}, value);
  173. // Copy everything else by reference
  174. } else {
  175. target[key] = value;
  176. }
  177. }
  178. }
  179. }
  180. return target;
  181. }
  182. ;
  183. $.widget.bridge = function (name, object) {
  184. var fullName = object.prototype.widgetFullName || name;
  185. $.fn[name] = function (options) {
  186. var isMethodCall = typeof options === "string";
  187. var args = widgetSlice.call(arguments, 1);
  188. var returnValue = this;
  189. if (isMethodCall) {
  190. // If this is an empty collection, we need to have the instance method
  191. // return undefined instead of the jQuery instance
  192. if (!this.length && options === "instance") {
  193. returnValue = undefined;
  194. } else {
  195. this.each(function () {
  196. var methodValue;
  197. var instance = $.data(this, fullName);
  198. if (options === "instance") {
  199. returnValue = instance;
  200. return false;
  201. }
  202. if (!instance) {
  203. return $.error("cannot call methods on " + name + " prior to initialization; " + "attempted to call method '" + options + "'");
  204. }
  205. if (typeof instance[options] !== "function" || options.charAt(0) === "_") {
  206. return $.error("no such method '" + options + "' for " + name + " widget instance");
  207. }
  208. methodValue = instance[options].apply(instance, args);
  209. if (methodValue !== instance && methodValue !== undefined) {
  210. returnValue = methodValue && methodValue.jquery ? returnValue.pushStack(methodValue.get()) : methodValue;
  211. return false;
  212. }
  213. });
  214. }
  215. } else {
  216. // Allow multiple hashes to be passed on init
  217. if (args.length) {
  218. options = $.widget.extend.apply(null, [options].concat(args));
  219. }
  220. this.each(function () {
  221. var instance = $.data(this, fullName);
  222. if (instance) {
  223. instance.option(options || {});
  224. if (instance._init) {
  225. instance._init();
  226. }
  227. } else {
  228. $.data(this, fullName, new object(options, this));
  229. }
  230. });
  231. }
  232. return returnValue;
  233. }
  234. ;
  235. }
  236. ;
  237. $.Widget = function (/* options, element */
  238. ) {
  239. }
  240. ;
  241. $.Widget._childConstructors = [];
  242. $.Widget.prototype = {
  243. widgetName: "widget",
  244. widgetEventPrefix: "",
  245. defaultElement: "<div>",
  246. options: {
  247. classes: {},
  248. disabled: false,
  249. // Callbacks
  250. create: null
  251. },
  252. _createWidget: function (options, element) {
  253. element = $(element || this.defaultElement || this)[0];
  254. this.element = $(element);
  255. this.uuid = widgetUuid++;
  256. this.eventNamespace = "." + this.widgetName + this.uuid;
  257. this.bindings = $();
  258. this.hoverable = $();
  259. this.focusable = $();
  260. this.classesElementLookup = {};
  261. if (element !== this) {
  262. $.data(element, this.widgetFullName, this);
  263. this._on(true, this.element, {
  264. remove: function (event) {
  265. if (event.target === element) {
  266. this.destroy();
  267. }
  268. }
  269. });
  270. this.document = $(element.style ?
  271. // Element within the document
  272. element.ownerDocument :
  273. // Element is window or document
  274. element.document || element);
  275. this.window = $(this.document[0].defaultView || this.document[0].parentWindow);
  276. }
  277. this.options = $.widget.extend({}, this.options, this._getCreateOptions(), options);
  278. this._create();
  279. if (this.options.disabled) {
  280. this._setOptionDisabled(this.options.disabled);
  281. }
  282. this._trigger("create", null, this._getCreateEventData());
  283. this._init();
  284. },
  285. _getCreateOptions: function () {
  286. return {};
  287. },
  288. _getCreateEventData: $.noop,
  289. _create: $.noop,
  290. _init: $.noop,
  291. destroy: function () {
  292. var that = this;
  293. this._destroy();
  294. $.each(this.classesElementLookup, function (key, value) {
  295. that._removeClass(value, key);
  296. });
  297. // We can probably remove the unbind calls in 2.0
  298. // all event bindings should go through this._on()
  299. this.element.off(this.eventNamespace).removeData(this.widgetFullName);
  300. this.widget().off(this.eventNamespace).removeAttr("aria-disabled");
  301. // Clean up events and states
  302. this.bindings.off(this.eventNamespace);
  303. },
  304. _destroy: $.noop,
  305. widget: function () {
  306. return this.element;
  307. },
  308. option: function (key, value) {
  309. var options = key;
  310. var parts;
  311. var curOption;
  312. var i;
  313. if (arguments.length === 0) {
  314. // Don't return a reference to the internal hash
  315. return $.widget.extend({}, this.options);
  316. }
  317. if (typeof key === "string") {
  318. // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
  319. options = {};
  320. parts = key.split(".");
  321. key = parts.shift();
  322. if (parts.length) {
  323. curOption = options[key] = $.widget.extend({}, this.options[key]);
  324. for (i = 0; i < parts.length - 1; i++) {
  325. curOption[parts[i]] = curOption[parts[i]] || {};
  326. curOption = curOption[parts[i]];
  327. }
  328. key = parts.pop();
  329. if (arguments.length === 1) {
  330. return curOption[key] === undefined ? null : curOption[key];
  331. }
  332. curOption[key] = value;
  333. } else {
  334. if (arguments.length === 1) {
  335. return this.options[key] === undefined ? null : this.options[key];
  336. }
  337. options[key] = value;
  338. }
  339. }
  340. this._setOptions(options);
  341. return this;
  342. },
  343. _setOptions: function (options) {
  344. var key;
  345. for (key in options) {
  346. this._setOption(key, options[key]);
  347. }
  348. return this;
  349. },
  350. _setOption: function (key, value) {
  351. if (key === "classes") {
  352. this._setOptionClasses(value);
  353. }
  354. this.options[key] = value;
  355. if (key === "disabled") {
  356. this._setOptionDisabled(value);
  357. }
  358. return this;
  359. },
  360. _setOptionClasses: function (value) {
  361. var classKey, elements, currentElements;
  362. for (classKey in value) {
  363. currentElements = this.classesElementLookup[classKey];
  364. if (value[classKey] === this.options.classes[classKey] || !currentElements || !currentElements.length) {
  365. continue;
  366. }
  367. // We are doing this to create a new jQuery object because the _removeClass() call
  368. // on the next line is going to destroy the reference to the current elements being
  369. // tracked. We need to save a copy of this collection so that we can add the new classes
  370. // below.
  371. elements = $(currentElements.get());
  372. this._removeClass(currentElements, classKey);
  373. // We don't use _addClass() here, because that uses this.options.classes
  374. // for generating the string of classes. We want to use the value passed in from
  375. // _setOption(), this is the new value of the classes option which was passed to
  376. // _setOption(). We pass this value directly to _classes().
  377. elements.addClass(this._classes({
  378. element: elements,
  379. keys: classKey,
  380. classes: value,
  381. add: true
  382. }));
  383. }
  384. },
  385. _setOptionDisabled: function (value) {
  386. this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, !!value);
  387. // If the widget is becoming disabled, then nothing is interactive
  388. if (value) {
  389. this._removeClass(this.hoverable, null, "ui-state-hover");
  390. this._removeClass(this.focusable, null, "ui-state-focus");
  391. }
  392. },
  393. enable: function () {
  394. return this._setOptions({
  395. disabled: false
  396. });
  397. },
  398. disable: function () {
  399. return this._setOptions({
  400. disabled: true
  401. });
  402. },
  403. _classes: function (options) {
  404. var full = [];
  405. var that = this;
  406. options = $.extend({
  407. element: this.element,
  408. classes: this.options.classes || {}
  409. }, options);
  410. function bindRemoveEvent() {
  411. options.element.each(function (_, element) {
  412. var isTracked = $.map(that.classesElementLookup, function (elements) {
  413. return elements;
  414. }).some(function (elements) {
  415. return elements.is(element);
  416. });
  417. if (!isTracked) {
  418. that._on($(element), {
  419. remove: "_untrackClassesElement"
  420. });
  421. }
  422. });
  423. }
  424. function processClassString(classes, checkOption) {
  425. var current, i;
  426. for (i = 0; i < classes.length; i++) {
  427. current = that.classesElementLookup[classes[i]] || $();
  428. if (options.add) {
  429. bindRemoveEvent();
  430. current = $($.uniqueSort(current.get().concat(options.element.get())));
  431. } else {
  432. current = $(current.not(options.element).get());
  433. }
  434. that.classesElementLookup[classes[i]] = current;
  435. full.push(classes[i]);
  436. if (checkOption && options.classes[classes[i]]) {
  437. full.push(options.classes[classes[i]]);
  438. }
  439. }
  440. }
  441. if (options.keys) {
  442. processClassString(options.keys.match(/\S+/g) || [], true);
  443. }
  444. if (options.extra) {
  445. processClassString(options.extra.match(/\S+/g) || []);
  446. }
  447. return full.join(" ");
  448. },
  449. _untrackClassesElement: function (event) {
  450. var that = this;
  451. $.each(that.classesElementLookup, function (key, value) {
  452. if ($.inArray(event.target, value) !== -1) {
  453. that.classesElementLookup[key] = $(value.not(event.target).get());
  454. }
  455. });
  456. this._off($(event.target));
  457. },
  458. _removeClass: function (element, keys, extra) {
  459. return this._toggleClass(element, keys, extra, false);
  460. },
  461. _addClass: function (element, keys, extra) {
  462. return this._toggleClass(element, keys, extra, true);
  463. },
  464. _toggleClass: function (element, keys, extra, add) {
  465. add = (typeof add === "boolean") ? add : extra;
  466. var shift = (typeof element === "string" || element === null)
  467. , options = {
  468. extra: shift ? keys : extra,
  469. keys: shift ? element : keys,
  470. element: shift ? this.element : element,
  471. add: add
  472. };
  473. options.element.toggleClass(this._classes(options), add);
  474. return this;
  475. },
  476. _on: function (suppressDisabledCheck, element, handlers) {
  477. var delegateElement;
  478. var instance = this;
  479. // No suppressDisabledCheck flag, shuffle arguments
  480. if (typeof suppressDisabledCheck !== "boolean") {
  481. handlers = element;
  482. element = suppressDisabledCheck;
  483. suppressDisabledCheck = false;
  484. }
  485. // No element argument, shuffle and use this.element
  486. if (!handlers) {
  487. handlers = element;
  488. element = this.element;
  489. delegateElement = this.widget();
  490. } else {
  491. element = delegateElement = $(element);
  492. this.bindings = this.bindings.add(element);
  493. }
  494. $.each(handlers, function (event, handler) {
  495. function handlerProxy() {
  496. // Allow widgets to customize the disabled handling
  497. // - disabled as an array instead of boolean
  498. // - disabled class as method for disabling individual parts
  499. if (!suppressDisabledCheck && (instance.options.disabled === true || $(this).hasClass("ui-state-disabled"))) {
  500. return;
  501. }
  502. return (typeof handler === "string" ? instance[handler] : handler).apply(instance, arguments);
  503. }
  504. // Copy the guid so direct unbinding works
  505. if (typeof handler !== "string") {
  506. handlerProxy.guid = handler.guid = handler.guid || handlerProxy.guid || $.guid++;
  507. }
  508. var match = event.match(/^([\w:-]*)\s*(.*)$/);
  509. var eventName = match[1] + instance.eventNamespace;
  510. var selector = match[2];
  511. if (selector) {
  512. delegateElement.on(eventName, selector, handlerProxy);
  513. } else {
  514. element.on(eventName, handlerProxy);
  515. }
  516. });
  517. },
  518. _off: function (element, eventName) {
  519. eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace;
  520. element.off(eventName);
  521. // Clear the stack to avoid memory leaks (#10056)
  522. this.bindings = $(this.bindings.not(element).get());
  523. this.focusable = $(this.focusable.not(element).get());
  524. this.hoverable = $(this.hoverable.not(element).get());
  525. },
  526. _delay: function (handler, delay) {
  527. function handlerProxy() {
  528. return (typeof handler === "string" ? instance[handler] : handler).apply(instance, arguments);
  529. }
  530. var instance = this;
  531. return setTimeout(handlerProxy, delay || 0);
  532. },
  533. _hoverable: function (element) {
  534. this.hoverable = this.hoverable.add(element);
  535. this._on(element, {
  536. mouseenter: function (event) {
  537. this._addClass($(event.currentTarget), null, "ui-state-hover");
  538. },
  539. mouseleave: function (event) {
  540. this._removeClass($(event.currentTarget), null, "ui-state-hover");
  541. }
  542. });
  543. },
  544. _focusable: function (element) {
  545. this.focusable = this.focusable.add(element);
  546. this._on(element, {
  547. focusin: function (event) {
  548. this._addClass($(event.currentTarget), null, "ui-state-focus");
  549. },
  550. focusout: function (event) {
  551. this._removeClass($(event.currentTarget), null, "ui-state-focus");
  552. }
  553. });
  554. },
  555. _trigger: function (type, event, data) {
  556. var prop, orig;
  557. var callback = this.options[type];
  558. data = data || {};
  559. event = $.Event(event);
  560. event.type = (type === this.widgetEventPrefix ? type : this.widgetEventPrefix + type).toLowerCase();
  561. // The original event may come from any element
  562. // so we need to reset the target on the new event
  563. event.target = this.element[0];
  564. // Copy original event properties over to the new event
  565. orig = event.originalEvent;
  566. if (orig) {
  567. for (prop in orig) {
  568. if (!(prop in event)) {
  569. event[prop] = orig[prop];
  570. }
  571. }
  572. }
  573. this.element.trigger(event, data);
  574. return !(typeof callback === "function" && callback.apply(this.element[0], [event].concat(data)) === false || event.isDefaultPrevented());
  575. }
  576. };
  577. $.each({
  578. show: "fadeIn",
  579. hide: "fadeOut"
  580. }, function (method, defaultEffect) {
  581. $.Widget.prototype["_" + method] = function (element, options, callback) {
  582. if (typeof options === "string") {
  583. options = {
  584. effect: options
  585. };
  586. }
  587. var hasOptions;
  588. var effectName = !options ? method : options === true || typeof options === "number" ? defaultEffect : options.effect || defaultEffect;
  589. options = options || {};
  590. if (typeof options === "number") {
  591. options = {
  592. duration: options
  593. };
  594. } else if (options === true) {
  595. options = {};
  596. }
  597. hasOptions = !$.isEmptyObject(options);
  598. options.complete = callback;
  599. if (options.delay) {
  600. element.delay(options.delay);
  601. }
  602. if (hasOptions && $.effects && $.effects.effect[effectName]) {
  603. element[method](options);
  604. } else if (effectName !== method && element[effectName]) {
  605. element[effectName](options.duration, options.easing, callback);
  606. } else {
  607. element.queue(function (next) {
  608. $(this)[method]();
  609. if (callback) {
  610. callback.call(element[0]);
  611. }
  612. next();
  613. });
  614. }
  615. }
  616. ;
  617. });
  618. var widget = $.widget;
  619. /*!
  620. * jQuery UI Position 1.13.0
  621. * http://jqueryui.com
  622. *
  623. * Copyright jQuery Foundation and other contributors
  624. * Released under the MIT license.
  625. * http://jquery.org/license
  626. *
  627. * http://api.jqueryui.com/position/
  628. */
  629. //>>label: Position
  630. //>>group: Core
  631. //>>description: Positions elements relative to other elements.
  632. //>>docs: http://api.jqueryui.com/position/
  633. //>>demos: http://jqueryui.com/position/
  634. (function () {
  635. var cachedScrollbarWidth, max = Math.max, abs = Math.abs, rhorizontal = /left|center|right/,
  636. rvertical = /top|center|bottom/, roffset = /[\+\-]\d+(\.[\d]+)?%?/, rposition = /^\w+/, rpercent = /%$/,
  637. _position = $.fn.position;
  638. function getOffsets(offsets, width, height) {
  639. return [parseFloat(offsets[0]) * (rpercent.test(offsets[0]) ? width / 100 : 1), parseFloat(offsets[1]) * (rpercent.test(offsets[1]) ? height / 100 : 1)];
  640. }
  641. function parseCss(element, property) {
  642. return parseInt($.css(element, property), 10) || 0;
  643. }
  644. function isWindow(obj) {
  645. return obj != null && obj === obj.window;
  646. }
  647. function getDimensions(elem) {
  648. var raw = elem[0];
  649. if (raw.nodeType === 9) {
  650. return {
  651. width: elem.width(),
  652. height: elem.height(),
  653. offset: {
  654. top: 0,
  655. left: 0
  656. }
  657. };
  658. }
  659. if (isWindow(raw)) {
  660. return {
  661. width: elem.width(),
  662. height: elem.height(),
  663. offset: {
  664. top: elem.scrollTop(),
  665. left: elem.scrollLeft()
  666. }
  667. };
  668. }
  669. if (raw.preventDefault) {
  670. return {
  671. width: 0,
  672. height: 0,
  673. offset: {
  674. top: raw.pageY,
  675. left: raw.pageX
  676. }
  677. };
  678. }
  679. return {
  680. width: elem.outerWidth(),
  681. height: elem.outerHeight(),
  682. offset: elem.offset()
  683. };
  684. }
  685. $.position = {
  686. scrollbarWidth: function () {
  687. if (cachedScrollbarWidth !== undefined) {
  688. return cachedScrollbarWidth;
  689. }
  690. var w1, w2,
  691. div = $("<div style=" + "'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" + "<div style='height:300px;width:auto;'></div></div>"),
  692. innerDiv = div.children()[0];
  693. $("body").append(div);
  694. w1 = innerDiv.offsetWidth;
  695. div.css("overflow", "scroll");
  696. w2 = innerDiv.offsetWidth;
  697. if (w1 === w2) {
  698. w2 = div[0].clientWidth;
  699. }
  700. div.remove();
  701. return (cachedScrollbarWidth = w1 - w2);
  702. },
  703. getScrollInfo: function (within) {
  704. var overflowX = within.isWindow || within.isDocument ? "" : within.element.css("overflow-x")
  705. , overflowY = within.isWindow || within.isDocument ? "" : within.element.css("overflow-y")
  706. ,
  707. hasOverflowX = overflowX === "scroll" || (overflowX === "auto" && within.width < within.element[0].scrollWidth)
  708. ,
  709. hasOverflowY = overflowY === "scroll" || (overflowY === "auto" && within.height < within.element[0].scrollHeight);
  710. return {
  711. width: hasOverflowY ? $.position.scrollbarWidth() : 0,
  712. height: hasOverflowX ? $.position.scrollbarWidth() : 0
  713. };
  714. },
  715. getWithinInfo: function (element) {
  716. var withinElement = $(element || window)
  717. , isElemWindow = isWindow(withinElement[0])
  718. , isDocument = !!withinElement[0] && withinElement[0].nodeType === 9
  719. , hasOffset = !isElemWindow && !isDocument;
  720. return {
  721. element: withinElement,
  722. isWindow: isElemWindow,
  723. isDocument: isDocument,
  724. offset: hasOffset ? $(element).offset() : {
  725. left: 0,
  726. top: 0
  727. },
  728. scrollLeft: withinElement.scrollLeft(),
  729. scrollTop: withinElement.scrollTop(),
  730. width: withinElement.outerWidth(),
  731. height: withinElement.outerHeight()
  732. };
  733. }
  734. };
  735. $.fn.position = function (options) {
  736. if (!options || !options.of) {
  737. return _position.apply(this, arguments);
  738. }
  739. // Make a copy, we don't want to modify arguments
  740. options = $.extend({}, options);
  741. var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
  742. // Make sure string options are treated as CSS selectors
  743. target = typeof options.of === "string" ? $(document).find(options.of) : $(options.of),
  744. within = $.position.getWithinInfo(options.within), scrollInfo = $.position.getScrollInfo(within),
  745. collision = (options.collision || "flip").split(" "), offsets = {};
  746. dimensions = getDimensions(target);
  747. if (target[0].preventDefault) {
  748. // Force left top to allow flipping
  749. options.at = "left top";
  750. }
  751. targetWidth = dimensions.width;
  752. targetHeight = dimensions.height;
  753. targetOffset = dimensions.offset;
  754. // Clone to reuse original targetOffset later
  755. basePosition = $.extend({}, targetOffset);
  756. // Force my and at to have valid horizontal and vertical positions
  757. // if a value is missing or invalid, it will be converted to center
  758. $.each(["my", "at"], function () {
  759. var pos = (options[this] || "").split(" "), horizontalOffset, verticalOffset;
  760. if (pos.length === 1) {
  761. pos = rhorizontal.test(pos[0]) ? pos.concat(["center"]) : rvertical.test(pos[0]) ? ["center"].concat(pos) : ["center", "center"];
  762. }
  763. pos[0] = rhorizontal.test(pos[0]) ? pos[0] : "center";
  764. pos[1] = rvertical.test(pos[1]) ? pos[1] : "center";
  765. // Calculate offsets
  766. horizontalOffset = roffset.exec(pos[0]);
  767. verticalOffset = roffset.exec(pos[1]);
  768. offsets[this] = [horizontalOffset ? horizontalOffset[0] : 0, verticalOffset ? verticalOffset[0] : 0];
  769. // Reduce to just the positions without the offsets
  770. options[this] = [rposition.exec(pos[0])[0], rposition.exec(pos[1])[0]];
  771. });
  772. // Normalize collision option
  773. if (collision.length === 1) {
  774. collision[1] = collision[0];
  775. }
  776. if (options.at[0] === "right") {
  777. basePosition.left += targetWidth;
  778. } else if (options.at[0] === "center") {
  779. basePosition.left += targetWidth / 2;
  780. }
  781. if (options.at[1] === "bottom") {
  782. basePosition.top += targetHeight;
  783. } else if (options.at[1] === "center") {
  784. basePosition.top += targetHeight / 2;
  785. }
  786. atOffset = getOffsets(offsets.at, targetWidth, targetHeight);
  787. basePosition.left += atOffset[0];
  788. basePosition.top += atOffset[1];
  789. return this.each(function () {
  790. var collisionPosition, using, elem = $(this), elemWidth = elem.outerWidth(),
  791. elemHeight = elem.outerHeight(), marginLeft = parseCss(this, "marginLeft"),
  792. marginTop = parseCss(this, "marginTop"),
  793. collisionWidth = elemWidth + marginLeft + parseCss(this, "marginRight") + scrollInfo.width,
  794. collisionHeight = elemHeight + marginTop + parseCss(this, "marginBottom") + scrollInfo.height,
  795. position = $.extend({}, basePosition),
  796. myOffset = getOffsets(offsets.my, elem.outerWidth(), elem.outerHeight());
  797. if (options.my[0] === "right") {
  798. position.left -= elemWidth;
  799. } else if (options.my[0] === "center") {
  800. position.left -= elemWidth / 2;
  801. }
  802. if (options.my[1] === "bottom") {
  803. position.top -= elemHeight;
  804. } else if (options.my[1] === "center") {
  805. position.top -= elemHeight / 2;
  806. }
  807. position.left += myOffset[0];
  808. position.top += myOffset[1];
  809. collisionPosition = {
  810. marginLeft: marginLeft,
  811. marginTop: marginTop
  812. };
  813. $.each(["left", "top"], function (i, dir) {
  814. if ($.ui.position[collision[i]]) {
  815. $.ui.position[collision[i]][dir](position, {
  816. targetWidth: targetWidth,
  817. targetHeight: targetHeight,
  818. elemWidth: elemWidth,
  819. elemHeight: elemHeight,
  820. collisionPosition: collisionPosition,
  821. collisionWidth: collisionWidth,
  822. collisionHeight: collisionHeight,
  823. offset: [atOffset[0] + myOffset[0], atOffset[1] + myOffset[1]],
  824. my: options.my,
  825. at: options.at,
  826. within: within,
  827. elem: elem
  828. });
  829. }
  830. });
  831. if (options.using) {
  832. // Adds feedback as second argument to using callback, if present
  833. using = function (props) {
  834. var left = targetOffset.left - position.left
  835. , right = left + targetWidth - elemWidth
  836. , top = targetOffset.top - position.top
  837. , bottom = top + targetHeight - elemHeight
  838. , feedback = {
  839. target: {
  840. element: target,
  841. left: targetOffset.left,
  842. top: targetOffset.top,
  843. width: targetWidth,
  844. height: targetHeight
  845. },
  846. element: {
  847. element: elem,
  848. left: position.left,
  849. top: position.top,
  850. width: elemWidth,
  851. height: elemHeight
  852. },
  853. horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
  854. vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
  855. };
  856. if (targetWidth < elemWidth && abs(left + right) < targetWidth) {
  857. feedback.horizontal = "center";
  858. }
  859. if (targetHeight < elemHeight && abs(top + bottom) < targetHeight) {
  860. feedback.vertical = "middle";
  861. }
  862. if (max(abs(left), abs(right)) > max(abs(top), abs(bottom))) {
  863. feedback.important = "horizontal";
  864. } else {
  865. feedback.important = "vertical";
  866. }
  867. options.using.call(this, props, feedback);
  868. }
  869. ;
  870. }
  871. elem.offset($.extend(position, {
  872. using: using
  873. }));
  874. });
  875. }
  876. ;
  877. $.ui.position = {
  878. fit: {
  879. left: function (position, data) {
  880. var within = data.within,
  881. withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
  882. outerWidth = within.width,
  883. collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  884. overLeft = withinOffset - collisionPosLeft,
  885. overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
  886. newOverRight;
  887. // Element is wider than within
  888. if (data.collisionWidth > outerWidth) {
  889. // Element is initially over the left side of within
  890. if (overLeft > 0 && overRight <= 0) {
  891. newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
  892. position.left += overLeft - newOverRight;
  893. // Element is initially over right side of within
  894. } else if (overRight > 0 && overLeft <= 0) {
  895. position.left = withinOffset;
  896. // Element is initially over both left and right sides of within
  897. } else {
  898. if (overLeft > overRight) {
  899. position.left = withinOffset + outerWidth - data.collisionWidth;
  900. } else {
  901. position.left = withinOffset;
  902. }
  903. }
  904. // Too far left -> align with left edge
  905. } else if (overLeft > 0) {
  906. position.left += overLeft;
  907. // Too far right -> align with right edge
  908. } else if (overRight > 0) {
  909. position.left -= overRight;
  910. // Adjust based on position and margin
  911. } else {
  912. position.left = max(position.left - collisionPosLeft, position.left);
  913. }
  914. },
  915. top: function (position, data) {
  916. var within = data.within, withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
  917. outerHeight = data.within.height,
  918. collisionPosTop = position.top - data.collisionPosition.marginTop,
  919. overTop = withinOffset - collisionPosTop,
  920. overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
  921. newOverBottom;
  922. // Element is taller than within
  923. if (data.collisionHeight > outerHeight) {
  924. // Element is initially over the top of within
  925. if (overTop > 0 && overBottom <= 0) {
  926. newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
  927. position.top += overTop - newOverBottom;
  928. // Element is initially over bottom of within
  929. } else if (overBottom > 0 && overTop <= 0) {
  930. position.top = withinOffset;
  931. // Element is initially over both top and bottom of within
  932. } else {
  933. if (overTop > overBottom) {
  934. position.top = withinOffset + outerHeight - data.collisionHeight;
  935. } else {
  936. position.top = withinOffset;
  937. }
  938. }
  939. // Too far up -> align with top
  940. } else if (overTop > 0) {
  941. position.top += overTop;
  942. // Too far down -> align with bottom edge
  943. } else if (overBottom > 0) {
  944. position.top -= overBottom;
  945. // Adjust based on position and margin
  946. } else {
  947. position.top = max(position.top - collisionPosTop, position.top);
  948. }
  949. }
  950. },
  951. flip: {
  952. left: function (position, data) {
  953. var within = data.within, withinOffset = within.offset.left + within.scrollLeft,
  954. outerWidth = within.width,
  955. offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
  956. collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  957. overLeft = collisionPosLeft - offsetLeft,
  958. overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
  959. myOffset = data.my[0] === "left" ? -data.elemWidth : data.my[0] === "right" ? data.elemWidth : 0,
  960. atOffset = data.at[0] === "left" ? data.targetWidth : data.at[0] === "right" ? -data.targetWidth : 0,
  961. offset = -2 * data.offset[0], newOverRight, newOverLeft;
  962. if (overLeft < 0) {
  963. newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
  964. if (newOverRight < 0 || newOverRight < abs(overLeft)) {
  965. position.left += myOffset + atOffset + offset;
  966. }
  967. } else if (overRight > 0) {
  968. newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
  969. if (newOverLeft > 0 || abs(newOverLeft) < overRight) {
  970. position.left += myOffset + atOffset + offset;
  971. }
  972. }
  973. },
  974. top: function (position, data) {
  975. var within = data.within, withinOffset = within.offset.top + within.scrollTop,
  976. outerHeight = within.height,
  977. offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
  978. collisionPosTop = position.top - data.collisionPosition.marginTop,
  979. overTop = collisionPosTop - offsetTop,
  980. overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
  981. top = data.my[1] === "top",
  982. myOffset = top ? -data.elemHeight : data.my[1] === "bottom" ? data.elemHeight : 0,
  983. atOffset = data.at[1] === "top" ? data.targetHeight : data.at[1] === "bottom" ? -data.targetHeight : 0,
  984. offset = -2 * data.offset[1], newOverTop, newOverBottom;
  985. if (overTop < 0) {
  986. newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
  987. if (newOverBottom < 0 || newOverBottom < abs(overTop)) {
  988. position.top += myOffset + atOffset + offset;
  989. }
  990. } else if (overBottom > 0) {
  991. newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
  992. if (newOverTop > 0 || abs(newOverTop) < overBottom) {
  993. position.top += myOffset + atOffset + offset;
  994. }
  995. }
  996. }
  997. },
  998. flipfit: {
  999. left: function () {
  1000. $.ui.position.flip.left.apply(this, arguments);
  1001. $.ui.position.fit.left.apply(this, arguments);
  1002. },
  1003. top: function () {
  1004. $.ui.position.flip.top.apply(this, arguments);
  1005. $.ui.position.fit.top.apply(this, arguments);
  1006. }
  1007. }
  1008. };
  1009. }
  1010. )();
  1011. var position = $.ui.position;
  1012. /*!
  1013. * jQuery UI :data 1.13.0
  1014. * http://jqueryui.com
  1015. *
  1016. * Copyright jQuery Foundation and other contributors
  1017. * Released under the MIT license.
  1018. * http://jquery.org/license
  1019. */
  1020. //>>label: :data Selector
  1021. //>>group: Core
  1022. //>>description: Selects elements which have data stored under the specified key.
  1023. //>>docs: http://api.jqueryui.com/data-selector/
  1024. var data = $.extend($.expr.pseudos, {
  1025. data: $.expr.createPseudo ? $.expr.createPseudo(function (dataName) {
  1026. return function (elem) {
  1027. return !!$.data(elem, dataName);
  1028. }
  1029. ;
  1030. }) :
  1031. // Support: jQuery <1.8
  1032. function (elem, i, match) {
  1033. return !!$.data(elem, match[3]);
  1034. }
  1035. });
  1036. /*!
  1037. * jQuery UI Disable Selection 1.13.0
  1038. * http://jqueryui.com
  1039. *
  1040. * Copyright jQuery Foundation and other contributors
  1041. * Released under the MIT license.
  1042. * http://jquery.org/license
  1043. */
  1044. //>>label: disableSelection
  1045. //>>group: Core
  1046. //>>description: Disable selection of text content within the set of matched elements.
  1047. //>>docs: http://api.jqueryui.com/disableSelection/
  1048. // This file is deprecated
  1049. var disableSelection = $.fn.extend({
  1050. disableSelection: (function () {
  1051. var eventType = "onselectstart" in document.createElement("div") ? "selectstart" : "mousedown";
  1052. return function () {
  1053. return this.on(eventType + ".ui-disableSelection", function (event) {
  1054. event.preventDefault();
  1055. });
  1056. }
  1057. ;
  1058. }
  1059. )(),
  1060. enableSelection: function () {
  1061. return this.off(".ui-disableSelection");
  1062. }
  1063. });
  1064. // Create a local jQuery because jQuery Color relies on it and the
  1065. // global may not exist with AMD and a custom build (#10199).
  1066. // This module is a noop if used as a regular AMD module.
  1067. // eslint-disable-next-line no-unused-vars
  1068. var jQuery = $;
  1069. /*!
  1070. * jQuery Color Animations v2.2.0
  1071. * https://github.com/jquery/jquery-color
  1072. *
  1073. * Copyright OpenJS Foundation and other contributors
  1074. * Released under the MIT license.
  1075. * http://jquery.org/license
  1076. *
  1077. * Date: Sun May 10 09:02:36 2020 +0200
  1078. */
  1079. var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " + "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
  1080. class2type = {}, toString = class2type.toString,
  1081. // plusequals test for += 100 -= 100
  1082. rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
  1083. // a set of RE's that can match strings and generate color tuples.
  1084. stringParsers = [{
  1085. re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  1086. parse: function (execResult) {
  1087. return [execResult[1], execResult[2], execResult[3], execResult[4]];
  1088. }
  1089. }, {
  1090. re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  1091. parse: function (execResult) {
  1092. return [execResult[1] * 2.55, execResult[2] * 2.55, execResult[3] * 2.55, execResult[4]];
  1093. }
  1094. }, {
  1095. // this regex ignores A-F because it's compared against an already lowercased string
  1096. re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/,
  1097. parse: function (execResult) {
  1098. return [parseInt(execResult[1], 16), parseInt(execResult[2], 16), parseInt(execResult[3], 16), execResult[4] ? (parseInt(execResult[4], 16) / 255).toFixed(2) : 1];
  1099. }
  1100. }, {
  1101. // this regex ignores A-F because it's compared against an already lowercased string
  1102. re: /#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/,
  1103. parse: function (execResult) {
  1104. return [parseInt(execResult[1] + execResult[1], 16), parseInt(execResult[2] + execResult[2], 16), parseInt(execResult[3] + execResult[3], 16), execResult[4] ? (parseInt(execResult[4] + execResult[4], 16) / 255).toFixed(2) : 1];
  1105. }
  1106. }, {
  1107. re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  1108. space: "hsla",
  1109. parse: function (execResult) {
  1110. return [execResult[1], execResult[2] / 100, execResult[3] / 100, execResult[4]];
  1111. }
  1112. }],
  1113. // jQuery.Color( )
  1114. color = jQuery.Color = function (color, green, blue, alpha) {
  1115. return new jQuery.Color.fn.parse(color, green, blue, alpha);
  1116. }
  1117. , spaces = {
  1118. rgba: {
  1119. props: {
  1120. red: {
  1121. idx: 0,
  1122. type: "byte"
  1123. },
  1124. green: {
  1125. idx: 1,
  1126. type: "byte"
  1127. },
  1128. blue: {
  1129. idx: 2,
  1130. type: "byte"
  1131. }
  1132. }
  1133. },
  1134. hsla: {
  1135. props: {
  1136. hue: {
  1137. idx: 0,
  1138. type: "degrees"
  1139. },
  1140. saturation: {
  1141. idx: 1,
  1142. type: "percent"
  1143. },
  1144. lightness: {
  1145. idx: 2,
  1146. type: "percent"
  1147. }
  1148. }
  1149. }
  1150. }, propTypes = {
  1151. "byte": {
  1152. floor: true,
  1153. max: 255
  1154. },
  1155. "percent": {
  1156. max: 1
  1157. },
  1158. "degrees": {
  1159. mod: 360,
  1160. floor: true
  1161. }
  1162. }, support = color.support = {},
  1163. // element for support tests
  1164. supportElem = jQuery("<p>")[0],
  1165. // colors = jQuery.Color.names
  1166. colors,
  1167. // local aliases of functions called often
  1168. each = jQuery.each;
  1169. // determine rgba support immediately
  1170. supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
  1171. support.rgba = supportElem.style.backgroundColor.indexOf("rgba") > -1;
  1172. // define cache name and alpha properties
  1173. // for rgba and hsla spaces
  1174. each(spaces, function (spaceName, space) {
  1175. space.cache = "_" + spaceName;
  1176. space.props.alpha = {
  1177. idx: 3,
  1178. type: "percent",
  1179. def: 1
  1180. };
  1181. });
  1182. // Populate the class2type map
  1183. jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function (_i, name) {
  1184. class2type["[object " + name + "]"] = name.toLowerCase();
  1185. });
  1186. function getType(obj) {
  1187. if (obj == null) {
  1188. return obj + "";
  1189. }
  1190. return typeof obj === "object" ? class2type[toString.call(obj)] || "object" : typeof obj;
  1191. }
  1192. function clamp(value, prop, allowEmpty) {
  1193. var type = propTypes[prop.type] || {};
  1194. if (value == null) {
  1195. return (allowEmpty || !prop.def) ? null : prop.def;
  1196. }
  1197. // ~~ is an short way of doing floor for positive numbers
  1198. value = type.floor ? ~~value : parseFloat(value);
  1199. // IE will pass in empty strings as value for alpha,
  1200. // which will hit this case
  1201. if (isNaN(value)) {
  1202. return prop.def;
  1203. }
  1204. if (type.mod) {
  1205. // we add mod before modding to make sure that negatives values
  1206. // get converted properly: -10 -> 350
  1207. return (value + type.mod) % type.mod;
  1208. }
  1209. // for now all property types without mod have min and max
  1210. return Math.min(type.max, Math.max(0, value));
  1211. }
  1212. function stringParse(string) {
  1213. var inst = color()
  1214. , rgba = inst._rgba = [];
  1215. string = string.toLowerCase();
  1216. each(stringParsers, function (_i, parser) {
  1217. var parsed, match = parser.re.exec(string), values = match && parser.parse(match),
  1218. spaceName = parser.space || "rgba";
  1219. if (values) {
  1220. parsed = inst[spaceName](values);
  1221. // if this was an rgba parse the assignment might happen twice
  1222. // oh well....
  1223. inst[spaces[spaceName].cache] = parsed[spaces[spaceName].cache];
  1224. rgba = inst._rgba = parsed._rgba;
  1225. // exit each( stringParsers ) here because we matched
  1226. return false;
  1227. }
  1228. });
  1229. // Found a stringParser that handled it
  1230. if (rgba.length) {
  1231. // if this came from a parsed string, force "transparent" when alpha is 0
  1232. // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
  1233. if (rgba.join() === "0,0,0,0") {
  1234. jQuery.extend(rgba, colors.transparent);
  1235. }
  1236. return inst;
  1237. }
  1238. // named colors
  1239. return colors[string];
  1240. }
  1241. color.fn = jQuery.extend(color.prototype, {
  1242. parse: function (red, green, blue, alpha) {
  1243. if (red === undefined) {
  1244. this._rgba = [null, null, null, null];
  1245. return this;
  1246. }
  1247. if (red.jquery || red.nodeType) {
  1248. red = jQuery(red).css(green);
  1249. green = undefined;
  1250. }
  1251. var inst = this
  1252. , type = getType(red)
  1253. , rgba = this._rgba = [];
  1254. // more than 1 argument specified - assume ( red, green, blue, alpha )
  1255. if (green !== undefined) {
  1256. red = [red, green, blue, alpha];
  1257. type = "array";
  1258. }
  1259. if (type === "string") {
  1260. return this.parse(stringParse(red) || colors._default);
  1261. }
  1262. if (type === "array") {
  1263. each(spaces.rgba.props, function (_key, prop) {
  1264. rgba[prop.idx] = clamp(red[prop.idx], prop);
  1265. });
  1266. return this;
  1267. }
  1268. if (type === "object") {
  1269. if (red instanceof color) {
  1270. each(spaces, function (_spaceName, space) {
  1271. if (red[space.cache]) {
  1272. inst[space.cache] = red[space.cache].slice();
  1273. }
  1274. });
  1275. } else {
  1276. each(spaces, function (_spaceName, space) {
  1277. var cache = space.cache;
  1278. each(space.props, function (key, prop) {
  1279. // if the cache doesn't exist, and we know how to convert
  1280. if (!inst[cache] && space.to) {
  1281. // if the value was null, we don't need to copy it
  1282. // if the key was alpha, we don't need to copy it either
  1283. if (key === "alpha" || red[key] == null) {
  1284. return;
  1285. }
  1286. inst[cache] = space.to(inst._rgba);
  1287. }
  1288. // this is the only case where we allow nulls for ALL properties.
  1289. // call clamp with alwaysAllowEmpty
  1290. inst[cache][prop.idx] = clamp(red[key], prop, true);
  1291. });
  1292. // everything defined but alpha?
  1293. if (inst[cache] && jQuery.inArray(null, inst[cache].slice(0, 3)) < 0) {
  1294. // use the default of 1
  1295. if (inst[cache][3] == null) {
  1296. inst[cache][3] = 1;
  1297. }
  1298. if (space.from) {
  1299. inst._rgba = space.from(inst[cache]);
  1300. }
  1301. }
  1302. });
  1303. }
  1304. return this;
  1305. }
  1306. },
  1307. is: function (compare) {
  1308. var is = color(compare)
  1309. , same = true
  1310. , inst = this;
  1311. each(spaces, function (_, space) {
  1312. var localCache, isCache = is[space.cache];
  1313. if (isCache) {
  1314. localCache = inst[space.cache] || space.to && space.to(inst._rgba) || [];
  1315. each(space.props, function (_, prop) {
  1316. if (isCache[prop.idx] != null) {
  1317. same = (isCache[prop.idx] === localCache[prop.idx]);
  1318. return same;
  1319. }
  1320. });
  1321. }
  1322. return same;
  1323. });
  1324. return same;
  1325. },
  1326. _space: function () {
  1327. var used = []
  1328. , inst = this;
  1329. each(spaces, function (spaceName, space) {
  1330. if (inst[space.cache]) {
  1331. used.push(spaceName);
  1332. }
  1333. });
  1334. return used.pop();
  1335. },
  1336. transition: function (other, distance) {
  1337. var end = color(other)
  1338. , spaceName = end._space()
  1339. , space = spaces[spaceName]
  1340. , startColor = this.alpha() === 0 ? color("transparent") : this
  1341. , start = startColor[space.cache] || space.to(startColor._rgba)
  1342. , result = start.slice();
  1343. end = end[space.cache];
  1344. each(space.props, function (_key, prop) {
  1345. var index = prop.idx
  1346. , startValue = start[index]
  1347. , endValue = end[index]
  1348. , type = propTypes[prop.type] || {};
  1349. // if null, don't override start value
  1350. if (endValue === null) {
  1351. return;
  1352. }
  1353. // if null - use end
  1354. if (startValue === null) {
  1355. result[index] = endValue;
  1356. } else {
  1357. if (type.mod) {
  1358. if (endValue - startValue > type.mod / 2) {
  1359. startValue += type.mod;
  1360. } else if (startValue - endValue > type.mod / 2) {
  1361. startValue -= type.mod;
  1362. }
  1363. }
  1364. result[index] = clamp((endValue - startValue) * distance + startValue, prop);
  1365. }
  1366. });
  1367. return this[spaceName](result);
  1368. },
  1369. blend: function (opaque) {
  1370. // if we are already opaque - return ourself
  1371. if (this._rgba[3] === 1) {
  1372. return this;
  1373. }
  1374. var rgb = this._rgba.slice()
  1375. , a = rgb.pop()
  1376. , blend = color(opaque)._rgba;
  1377. return color(jQuery.map(rgb, function (v, i) {
  1378. return (1 - a) * blend[i] + a * v;
  1379. }));
  1380. },
  1381. toRgbaString: function () {
  1382. var prefix = "rgba("
  1383. , rgba = jQuery.map(this._rgba, function (v, i) {
  1384. if (v != null) {
  1385. return v;
  1386. }
  1387. return i > 2 ? 1 : 0;
  1388. });
  1389. if (rgba[3] === 1) {
  1390. rgba.pop();
  1391. prefix = "rgb(";
  1392. }
  1393. return prefix + rgba.join() + ")";
  1394. },
  1395. toHslaString: function () {
  1396. var prefix = "hsla("
  1397. , hsla = jQuery.map(this.hsla(), function (v, i) {
  1398. if (v == null) {
  1399. v = i > 2 ? 1 : 0;
  1400. }
  1401. // catch 1 and 2
  1402. if (i && i < 3) {
  1403. v = Math.round(v * 100) + "%";
  1404. }
  1405. return v;
  1406. });
  1407. if (hsla[3] === 1) {
  1408. hsla.pop();
  1409. prefix = "hsl(";
  1410. }
  1411. return prefix + hsla.join() + ")";
  1412. },
  1413. toHexString: function (includeAlpha) {
  1414. var rgba = this._rgba.slice()
  1415. , alpha = rgba.pop();
  1416. if (includeAlpha) {
  1417. rgba.push(~~(alpha * 255));
  1418. }
  1419. return "#" + jQuery.map(rgba, function (v) {
  1420. // default to 0 when nulls exist
  1421. v = (v || 0).toString(16);
  1422. return v.length === 1 ? "0" + v : v;
  1423. }).join("");
  1424. },
  1425. toString: function () {
  1426. return this._rgba[3] === 0 ? "transparent" : this.toRgbaString();
  1427. }
  1428. });
  1429. color.fn.parse.prototype = color.fn;
  1430. // hsla conversions adapted from:
  1431. // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
  1432. function hue2rgb(p, q, h) {
  1433. h = (h + 1) % 1;
  1434. if (h * 6 < 1) {
  1435. return p + (q - p) * h * 6;
  1436. }
  1437. if (h * 2 < 1) {
  1438. return q;
  1439. }
  1440. if (h * 3 < 2) {
  1441. return p + (q - p) * ((2 / 3) - h) * 6;
  1442. }
  1443. return p;
  1444. }
  1445. spaces.hsla.to = function (rgba) {
  1446. if (rgba[0] == null || rgba[1] == null || rgba[2] == null) {
  1447. return [null, null, null, rgba[3]];
  1448. }
  1449. var r = rgba[0] / 255, g = rgba[1] / 255, b = rgba[2] / 255, a = rgba[3], max = Math.max(r, g, b),
  1450. min = Math.min(r, g, b), diff = max - min, add = max + min, l = add * 0.5, h, s;
  1451. if (min === max) {
  1452. h = 0;
  1453. } else if (r === max) {
  1454. h = (60 * (g - b) / diff) + 360;
  1455. } else if (g === max) {
  1456. h = (60 * (b - r) / diff) + 120;
  1457. } else {
  1458. h = (60 * (r - g) / diff) + 240;
  1459. }
  1460. // chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
  1461. // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
  1462. if (diff === 0) {
  1463. s = 0;
  1464. } else if (l <= 0.5) {
  1465. s = diff / add;
  1466. } else {
  1467. s = diff / (2 - add);
  1468. }
  1469. return [Math.round(h) % 360, s, l, a == null ? 1 : a];
  1470. }
  1471. ;
  1472. spaces.hsla.from = function (hsla) {
  1473. if (hsla[0] == null || hsla[1] == null || hsla[2] == null) {
  1474. return [null, null, null, hsla[3]];
  1475. }
  1476. var h = hsla[0] / 360
  1477. , s = hsla[1]
  1478. , l = hsla[2]
  1479. , a = hsla[3]
  1480. , q = l <= 0.5 ? l * (1 + s) : l + s - l * s
  1481. , p = 2 * l - q;
  1482. return [Math.round(hue2rgb(p, q, h + (1 / 3)) * 255), Math.round(hue2rgb(p, q, h) * 255), Math.round(hue2rgb(p, q, h - (1 / 3)) * 255), a];
  1483. }
  1484. ;
  1485. each(spaces, function (spaceName, space) {
  1486. var props = space.props
  1487. , cache = space.cache
  1488. , to = space.to
  1489. , from = space.from;
  1490. // makes rgba() and hsla()
  1491. color.fn[spaceName] = function (value) {
  1492. // generate a cache for this space if it doesn't exist
  1493. if (to && !this[cache]) {
  1494. this[cache] = to(this._rgba);
  1495. }
  1496. if (value === undefined) {
  1497. return this[cache].slice();
  1498. }
  1499. var ret, type = getType(value), arr = (type === "array" || type === "object") ? value : arguments,
  1500. local = this[cache].slice();
  1501. each(props, function (key, prop) {
  1502. var val = arr[type === "object" ? key : prop.idx];
  1503. if (val == null) {
  1504. val = local[prop.idx];
  1505. }
  1506. local[prop.idx] = clamp(val, prop);
  1507. });
  1508. if (from) {
  1509. ret = color(from(local));
  1510. ret[cache] = local;
  1511. return ret;
  1512. } else {
  1513. return color(local);
  1514. }
  1515. }
  1516. ;
  1517. // makes red() green() blue() alpha() hue() saturation() lightness()
  1518. each(props, function (key, prop) {
  1519. // alpha is included in more than one space
  1520. if (color.fn[key]) {
  1521. return;
  1522. }
  1523. color.fn[key] = function (value) {
  1524. var local, cur, match, fn, vtype = getType(value);
  1525. if (key === "alpha") {
  1526. fn = this._hsla ? "hsla" : "rgba";
  1527. } else {
  1528. fn = spaceName;
  1529. }
  1530. local = this[fn]();
  1531. cur = local[prop.idx];
  1532. if (vtype === "undefined") {
  1533. return cur;
  1534. }
  1535. if (vtype === "function") {
  1536. value = value.call(this, cur);
  1537. vtype = getType(value);
  1538. }
  1539. if (value == null && prop.empty) {
  1540. return this;
  1541. }
  1542. if (vtype === "string") {
  1543. match = rplusequals.exec(value);
  1544. if (match) {
  1545. value = cur + parseFloat(match[2]) * (match[1] === "+" ? 1 : -1);
  1546. }
  1547. }
  1548. local[prop.idx] = value;
  1549. return this[fn](local);
  1550. }
  1551. ;
  1552. });
  1553. });
  1554. // add cssHook and .fx.step function for each named hook.
  1555. // accept a space separated string of properties
  1556. color.hook = function (hook) {
  1557. var hooks = hook.split(" ");
  1558. each(hooks, function (_i, hook) {
  1559. jQuery.cssHooks[hook] = {
  1560. set: function (elem, value) {
  1561. var parsed, curElem, backgroundColor = "";
  1562. if (value !== "transparent" && (getType(value) !== "string" || (parsed = stringParse(value)))) {
  1563. value = color(parsed || value);
  1564. if (!support.rgba && value._rgba[3] !== 1) {
  1565. curElem = hook === "backgroundColor" ? elem.parentNode : elem;
  1566. while ((backgroundColor === "" || backgroundColor === "transparent") && curElem && curElem.style) {
  1567. try {
  1568. backgroundColor = jQuery.css(curElem, "backgroundColor");
  1569. curElem = curElem.parentNode;
  1570. } catch (e) {
  1571. }
  1572. }
  1573. value = value.blend(backgroundColor && backgroundColor !== "transparent" ? backgroundColor : "_default");
  1574. }
  1575. value = value.toRgbaString();
  1576. }
  1577. try {
  1578. elem.style[hook] = value;
  1579. } catch (e) {
  1580. // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
  1581. }
  1582. }
  1583. };
  1584. jQuery.fx.step[hook] = function (fx) {
  1585. if (!fx.colorInit) {
  1586. fx.start = color(fx.elem, hook);
  1587. fx.end = color(fx.end);
  1588. fx.colorInit = true;
  1589. }
  1590. jQuery.cssHooks[hook].set(fx.elem, fx.start.transition(fx.end, fx.pos));
  1591. }
  1592. ;
  1593. });
  1594. }
  1595. ;
  1596. color.hook(stepHooks);
  1597. jQuery.cssHooks.borderColor = {
  1598. expand: function (value) {
  1599. var expanded = {};
  1600. each(["Top", "Right", "Bottom", "Left"], function (_i, part) {
  1601. expanded["border" + part + "Color"] = value;
  1602. });
  1603. return expanded;
  1604. }
  1605. };
  1606. // Basic color names only.
  1607. // Usage of any of the other color names requires adding yourself or including
  1608. // jquery.color.svg-names.js.
  1609. colors = jQuery.Color.names = {
  1610. // 4.1. Basic color keywords
  1611. aqua: "#00ffff",
  1612. black: "#000000",
  1613. blue: "#0000ff",
  1614. fuchsia: "#ff00ff",
  1615. gray: "#808080",
  1616. green: "#008000",
  1617. lime: "#00ff00",
  1618. maroon: "#800000",
  1619. navy: "#000080",
  1620. olive: "#808000",
  1621. purple: "#800080",
  1622. red: "#ff0000",
  1623. silver: "#c0c0c0",
  1624. teal: "#008080",
  1625. white: "#ffffff",
  1626. yellow: "#ffff00",
  1627. // 4.2.3. "transparent" color keyword
  1628. transparent: [null, null, null, 0],
  1629. _default: "#ffffff"
  1630. };
  1631. /*!
  1632. * jQuery UI Effects 1.13.0
  1633. * http://jqueryui.com
  1634. *
  1635. * Copyright jQuery Foundation and other contributors
  1636. * Released under the MIT license.
  1637. * http://jquery.org/license
  1638. */
  1639. //>>label: Effects Core
  1640. //>>group: Effects
  1641. /* eslint-disable max-len */
  1642. //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects.
  1643. /* eslint-enable max-len */
  1644. //>>docs: http://api.jqueryui.com/category/effects-core/
  1645. //>>demos: http://jqueryui.com/effect/
  1646. var dataSpace = "ui-effects-"
  1647. , dataSpaceStyle = "ui-effects-style"
  1648. , dataSpaceAnimated = "ui-effects-animated";
  1649. $.effects = {
  1650. effect: {}
  1651. };
  1652. /******************************************************************************/
  1653. /****************************** CLASS ANIMATIONS ******************************/
  1654. /******************************************************************************/
  1655. (function () {
  1656. var classAnimationActions = ["add", "remove", "toggle"]
  1657. , shorthandStyles = {
  1658. border: 1,
  1659. borderBottom: 1,
  1660. borderColor: 1,
  1661. borderLeft: 1,
  1662. borderRight: 1,
  1663. borderTop: 1,
  1664. borderWidth: 1,
  1665. margin: 1,
  1666. padding: 1
  1667. };
  1668. $.each(["borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle"], function (_, prop) {
  1669. $.fx.step[prop] = function (fx) {
  1670. if (fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr) {
  1671. jQuery.style(fx.elem, prop, fx.end);
  1672. fx.setAttr = true;
  1673. }
  1674. }
  1675. ;
  1676. });
  1677. function camelCase(string) {
  1678. return string.replace(/-([\da-z])/gi, function (all, letter) {
  1679. return letter.toUpperCase();
  1680. });
  1681. }
  1682. function getElementStyles(elem) {
  1683. var key, len,
  1684. style = elem.ownerDocument.defaultView ? elem.ownerDocument.defaultView.getComputedStyle(elem, null) : elem.currentStyle,
  1685. styles = {};
  1686. if (style && style.length && style[0] && style[style[0]]) {
  1687. len = style.length;
  1688. while (len--) {
  1689. key = style[len];
  1690. if (typeof style[key] === "string") {
  1691. styles[camelCase(key)] = style[key];
  1692. }
  1693. }
  1694. // Support: Opera, IE <9
  1695. } else {
  1696. for (key in style) {
  1697. if (typeof style[key] === "string") {
  1698. styles[key] = style[key];
  1699. }
  1700. }
  1701. }
  1702. return styles;
  1703. }
  1704. function styleDifference(oldStyle, newStyle) {
  1705. var diff = {}, name, value;
  1706. for (name in newStyle) {
  1707. value = newStyle[name];
  1708. if (oldStyle[name] !== value) {
  1709. if (!shorthandStyles[name]) {
  1710. if ($.fx.step[name] || !isNaN(parseFloat(value))) {
  1711. diff[name] = value;
  1712. }
  1713. }
  1714. }
  1715. }
  1716. return diff;
  1717. }
  1718. // Support: jQuery <1.8
  1719. if (!$.fn.addBack) {
  1720. $.fn.addBack = function (selector) {
  1721. return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
  1722. }
  1723. ;
  1724. }
  1725. $.effects.animateClass = function (value, duration, easing, callback) {
  1726. var o = $.speed(duration, easing, callback);
  1727. return this.queue(function () {
  1728. var animated = $(this), baseClass = animated.attr("class") || "", applyClassChange,
  1729. allAnimations = o.children ? animated.find("*").addBack() : animated;
  1730. // Map the animated objects to store the original styles.
  1731. allAnimations = allAnimations.map(function () {
  1732. var el = $(this);
  1733. return {
  1734. el: el,
  1735. start: getElementStyles(this)
  1736. };
  1737. });
  1738. // Apply class change
  1739. applyClassChange = function () {
  1740. $.each(classAnimationActions, function (i, action) {
  1741. if (value[action]) {
  1742. animated[action + "Class"](value[action]);
  1743. }
  1744. });
  1745. }
  1746. ;
  1747. applyClassChange();
  1748. // Map all animated objects again - calculate new styles and diff
  1749. allAnimations = allAnimations.map(function () {
  1750. this.end = getElementStyles(this.el[0]);
  1751. this.diff = styleDifference(this.start, this.end);
  1752. return this;
  1753. });
  1754. // Apply original class
  1755. animated.attr("class", baseClass);
  1756. // Map all animated objects again - this time collecting a promise
  1757. allAnimations = allAnimations.map(function () {
  1758. var styleInfo = this
  1759. , dfd = $.Deferred()
  1760. , opts = $.extend({}, o, {
  1761. queue: false,
  1762. complete: function () {
  1763. dfd.resolve(styleInfo);
  1764. }
  1765. });
  1766. this.el.animate(this.diff, opts);
  1767. return dfd.promise();
  1768. });
  1769. // Once all animations have completed:
  1770. $.when.apply($, allAnimations.get()).done(function () {
  1771. // Set the final class
  1772. applyClassChange();
  1773. // For each animated element,
  1774. // clear all css properties that were animated
  1775. $.each(arguments, function () {
  1776. var el = this.el;
  1777. $.each(this.diff, function (key) {
  1778. el.css(key, "");
  1779. });
  1780. });
  1781. // This is guarnteed to be there if you use jQuery.speed()
  1782. // it also handles dequeuing the next anim...
  1783. o.complete.call(animated[0]);
  1784. });
  1785. });
  1786. }
  1787. ;
  1788. $.fn.extend({
  1789. addClass: (function (orig) {
  1790. return function (classNames, speed, easing, callback) {
  1791. return speed ? $.effects.animateClass.call(this, {
  1792. add: classNames
  1793. }, speed, easing, callback) : orig.apply(this, arguments);
  1794. }
  1795. ;
  1796. }
  1797. )($.fn.addClass),
  1798. removeClass: (function (orig) {
  1799. return function (classNames, speed, easing, callback) {
  1800. return arguments.length > 1 ? $.effects.animateClass.call(this, {
  1801. remove: classNames
  1802. }, speed, easing, callback) : orig.apply(this, arguments);
  1803. }
  1804. ;
  1805. }
  1806. )($.fn.removeClass),
  1807. toggleClass: (function (orig) {
  1808. return function (classNames, force, speed, easing, callback) {
  1809. if (typeof force === "boolean" || force === undefined) {
  1810. if (!speed) {
  1811. // Without speed parameter
  1812. return orig.apply(this, arguments);
  1813. } else {
  1814. return $.effects.animateClass.call(this, (force ? {
  1815. add: classNames
  1816. } : {
  1817. remove: classNames
  1818. }), speed, easing, callback);
  1819. }
  1820. } else {
  1821. // Without force parameter
  1822. return $.effects.animateClass.call(this, {
  1823. toggle: classNames
  1824. }, force, speed, easing);
  1825. }
  1826. }
  1827. ;
  1828. }
  1829. )($.fn.toggleClass),
  1830. switchClass: function (remove, add, speed, easing, callback) {
  1831. return $.effects.animateClass.call(this, {
  1832. add: add,
  1833. remove: remove
  1834. }, speed, easing, callback);
  1835. }
  1836. });
  1837. }
  1838. )();
  1839. /******************************************************************************/
  1840. /*********************************** EFFECTS **********************************/
  1841. /******************************************************************************/
  1842. (function () {
  1843. if ($.expr && $.expr.pseudos && $.expr.pseudos.animated) {
  1844. $.expr.pseudos.animated = (function (orig) {
  1845. return function (elem) {
  1846. return !!$(elem).data(dataSpaceAnimated) || orig(elem);
  1847. }
  1848. ;
  1849. }
  1850. )($.expr.pseudos.animated);
  1851. }
  1852. if ($.uiBackCompat !== false) {
  1853. $.extend($.effects, {
  1854. // Saves a set of properties in a data storage
  1855. save: function (element, set) {
  1856. var i = 0
  1857. , length = set.length;
  1858. for (; i < length; i++) {
  1859. if (set[i] !== null) {
  1860. element.data(dataSpace + set[i], element[0].style[set[i]]);
  1861. }
  1862. }
  1863. },
  1864. // Restores a set of previously saved properties from a data storage
  1865. restore: function (element, set) {
  1866. var val, i = 0, length = set.length;
  1867. for (; i < length; i++) {
  1868. if (set[i] !== null) {
  1869. val = element.data(dataSpace + set[i]);
  1870. element.css(set[i], val);
  1871. }
  1872. }
  1873. },
  1874. setMode: function (el, mode) {
  1875. if (mode === "toggle") {
  1876. mode = el.is(":hidden") ? "show" : "hide";
  1877. }
  1878. return mode;
  1879. },
  1880. // Wraps the element around a wrapper that copies position properties
  1881. createWrapper: function (element) {
  1882. // If the element is already wrapped, return it
  1883. if (element.parent().is(".ui-effects-wrapper")) {
  1884. return element.parent();
  1885. }
  1886. // Wrap the element
  1887. var props = {
  1888. width: element.outerWidth(true),
  1889. height: element.outerHeight(true),
  1890. "float": element.css("float")
  1891. }
  1892. , wrapper = $("<div></div>").addClass("ui-effects-wrapper").css({
  1893. fontSize: "100%",
  1894. background: "transparent",
  1895. border: "none",
  1896. margin: 0,
  1897. padding: 0
  1898. })
  1899. ,
  1900. // Store the size in case width/height are defined in % - Fixes #5245
  1901. size = {
  1902. width: element.width(),
  1903. height: element.height()
  1904. }
  1905. , active = document.activeElement;
  1906. // Support: Firefox
  1907. // Firefox incorrectly exposes anonymous content
  1908. // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
  1909. try {
  1910. // eslint-disable-next-line no-unused-expressions
  1911. active.id;
  1912. } catch (e) {
  1913. active = document.body;
  1914. }
  1915. element.wrap(wrapper);
  1916. // Fixes #7595 - Elements lose focus when wrapped.
  1917. if (element[0] === active || $.contains(element[0], active)) {
  1918. $(active).trigger("focus");
  1919. }
  1920. // Hotfix for jQuery 1.4 since some change in wrap() seems to actually
  1921. // lose the reference to the wrapped element
  1922. wrapper = element.parent();
  1923. // Transfer positioning properties to the wrapper
  1924. if (element.css("position") === "static") {
  1925. wrapper.css({
  1926. position: "relative"
  1927. });
  1928. element.css({
  1929. position: "relative"
  1930. });
  1931. } else {
  1932. $.extend(props, {
  1933. position: element.css("position"),
  1934. zIndex: element.css("z-index")
  1935. });
  1936. $.each(["top", "left", "bottom", "right"], function (i, pos) {
  1937. props[pos] = element.css(pos);
  1938. if (isNaN(parseInt(props[pos], 10))) {
  1939. props[pos] = "auto";
  1940. }
  1941. });
  1942. element.css({
  1943. position: "relative",
  1944. top: 0,
  1945. left: 0,
  1946. right: "auto",
  1947. bottom: "auto"
  1948. });
  1949. }
  1950. element.css(size);
  1951. return wrapper.css(props).show();
  1952. },
  1953. removeWrapper: function (element) {
  1954. var active = document.activeElement;
  1955. if (element.parent().is(".ui-effects-wrapper")) {
  1956. element.parent().replaceWith(element);
  1957. // Fixes #7595 - Elements lose focus when wrapped.
  1958. if (element[0] === active || $.contains(element[0], active)) {
  1959. $(active).trigger("focus");
  1960. }
  1961. }
  1962. return element;
  1963. }
  1964. });
  1965. }
  1966. $.extend($.effects, {
  1967. version: "1.13.0",
  1968. define: function (name, mode, effect) {
  1969. if (!effect) {
  1970. effect = mode;
  1971. mode = "effect";
  1972. }
  1973. $.effects.effect[name] = effect;
  1974. $.effects.effect[name].mode = mode;
  1975. return effect;
  1976. },
  1977. scaledDimensions: function (element, percent, direction) {
  1978. if (percent === 0) {
  1979. return {
  1980. height: 0,
  1981. width: 0,
  1982. outerHeight: 0,
  1983. outerWidth: 0
  1984. };
  1985. }
  1986. var x = direction !== "horizontal" ? ((percent || 100) / 100) : 1
  1987. , y = direction !== "vertical" ? ((percent || 100) / 100) : 1;
  1988. return {
  1989. height: element.height() * y,
  1990. width: element.width() * x,
  1991. outerHeight: element.outerHeight() * y,
  1992. outerWidth: element.outerWidth() * x
  1993. };
  1994. },
  1995. clipToBox: function (animation) {
  1996. return {
  1997. width: animation.clip.right - animation.clip.left,
  1998. height: animation.clip.bottom - animation.clip.top,
  1999. left: animation.clip.left,
  2000. top: animation.clip.top
  2001. };
  2002. },
  2003. // Injects recently queued functions to be first in line (after "inprogress")
  2004. unshift: function (element, queueLength, count) {
  2005. var queue = element.queue();
  2006. if (queueLength > 1) {
  2007. queue.splice.apply(queue, [1, 0].concat(queue.splice(queueLength, count)));
  2008. }
  2009. element.dequeue();
  2010. },
  2011. saveStyle: function (element) {
  2012. element.data(dataSpaceStyle, element[0].style.cssText);
  2013. },
  2014. restoreStyle: function (element) {
  2015. element[0].style.cssText = element.data(dataSpaceStyle) || "";
  2016. element.removeData(dataSpaceStyle);
  2017. },
  2018. mode: function (element, mode) {
  2019. var hidden = element.is(":hidden");
  2020. if (mode === "toggle") {
  2021. mode = hidden ? "show" : "hide";
  2022. }
  2023. if (hidden ? mode === "hide" : mode === "show") {
  2024. mode = "none";
  2025. }
  2026. return mode;
  2027. },
  2028. // Translates a [top,left] array into a baseline value
  2029. getBaseline: function (origin, original) {
  2030. var y, x;
  2031. switch (origin[0]) {
  2032. case "top":
  2033. y = 0;
  2034. break;
  2035. case "middle":
  2036. y = 0.5;
  2037. break;
  2038. case "bottom":
  2039. y = 1;
  2040. break;
  2041. default:
  2042. y = origin[0] / original.height;
  2043. }
  2044. switch (origin[1]) {
  2045. case "left":
  2046. x = 0;
  2047. break;
  2048. case "center":
  2049. x = 0.5;
  2050. break;
  2051. case "right":
  2052. x = 1;
  2053. break;
  2054. default:
  2055. x = origin[1] / original.width;
  2056. }
  2057. return {
  2058. x: x,
  2059. y: y
  2060. };
  2061. },
  2062. // Creates a placeholder element so that the original element can be made absolute
  2063. createPlaceholder: function (element) {
  2064. var placeholder, cssPosition = element.css("position"), position = element.position();
  2065. // Lock in margins first to account for form elements, which
  2066. // will change margin if you explicitly set height
  2067. // see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380
  2068. // Support: Safari
  2069. element.css({
  2070. marginTop: element.css("marginTop"),
  2071. marginBottom: element.css("marginBottom"),
  2072. marginLeft: element.css("marginLeft"),
  2073. marginRight: element.css("marginRight")
  2074. }).outerWidth(element.outerWidth()).outerHeight(element.outerHeight());
  2075. if (/^(static|relative)/.test(cssPosition)) {
  2076. cssPosition = "absolute";
  2077. placeholder = $("<" + element[0].nodeName + ">").insertAfter(element).css({
  2078. // Convert inline to inline block to account for inline elements
  2079. // that turn to inline block based on content (like img)
  2080. display: /^(inline|ruby)/.test(element.css("display")) ? "inline-block" : "block",
  2081. visibility: "hidden",
  2082. // Margins need to be set to account for margin collapse
  2083. marginTop: element.css("marginTop"),
  2084. marginBottom: element.css("marginBottom"),
  2085. marginLeft: element.css("marginLeft"),
  2086. marginRight: element.css("marginRight"),
  2087. "float": element.css("float")
  2088. }).outerWidth(element.outerWidth()).outerHeight(element.outerHeight()).addClass("ui-effects-placeholder");
  2089. element.data(dataSpace + "placeholder", placeholder);
  2090. }
  2091. element.css({
  2092. position: cssPosition,
  2093. left: position.left,
  2094. top: position.top
  2095. });
  2096. return placeholder;
  2097. },
  2098. removePlaceholder: function (element) {
  2099. var dataKey = dataSpace + "placeholder"
  2100. , placeholder = element.data(dataKey);
  2101. if (placeholder) {
  2102. placeholder.remove();
  2103. element.removeData(dataKey);
  2104. }
  2105. },
  2106. // Removes a placeholder if it exists and restores
  2107. // properties that were modified during placeholder creation
  2108. cleanUp: function (element) {
  2109. $.effects.restoreStyle(element);
  2110. $.effects.removePlaceholder(element);
  2111. },
  2112. setTransition: function (element, list, factor, value) {
  2113. value = value || {};
  2114. $.each(list, function (i, x) {
  2115. var unit = element.cssUnit(x);
  2116. if (unit[0] > 0) {
  2117. value[x] = unit[0] * factor + unit[1];
  2118. }
  2119. });
  2120. return value;
  2121. }
  2122. });
  2123. // Return an effect options object for the given parameters:
  2124. function _normalizeArguments(effect, options, speed, callback) {
  2125. // Allow passing all options as the first parameter
  2126. if ($.isPlainObject(effect)) {
  2127. options = effect;
  2128. effect = effect.effect;
  2129. }
  2130. // Convert to an object
  2131. effect = {
  2132. effect: effect
  2133. };
  2134. // Catch (effect, null, ...)
  2135. if (options == null) {
  2136. options = {};
  2137. }
  2138. // Catch (effect, callback)
  2139. if (typeof options === "function") {
  2140. callback = options;
  2141. speed = null;
  2142. options = {};
  2143. }
  2144. // Catch (effect, speed, ?)
  2145. if (typeof options === "number" || $.fx.speeds[options]) {
  2146. callback = speed;
  2147. speed = options;
  2148. options = {};
  2149. }
  2150. // Catch (effect, options, callback)
  2151. if (typeof speed === "function") {
  2152. callback = speed;
  2153. speed = null;
  2154. }
  2155. // Add options to effect
  2156. if (options) {
  2157. $.extend(effect, options);
  2158. }
  2159. speed = speed || options.duration;
  2160. effect.duration = $.fx.off ? 0 : typeof speed === "number" ? speed : speed in $.fx.speeds ? $.fx.speeds[speed] : $.fx.speeds._default;
  2161. effect.complete = callback || options.complete;
  2162. return effect;
  2163. }
  2164. function standardAnimationOption(option) {
  2165. // Valid standard speeds (nothing, number, named speed)
  2166. if (!option || typeof option === "number" || $.fx.speeds[option]) {
  2167. return true;
  2168. }
  2169. // Invalid strings - treat as "normal" speed
  2170. if (typeof option === "string" && !$.effects.effect[option]) {
  2171. return true;
  2172. }
  2173. // Complete callback
  2174. if (typeof option === "function") {
  2175. return true;
  2176. }
  2177. // Options hash (but not naming an effect)
  2178. if (typeof option === "object" && !option.effect) {
  2179. return true;
  2180. }
  2181. // Didn't match any standard API
  2182. return false;
  2183. }
  2184. $.fn.extend({
  2185. effect: function (/* effect, options, speed, callback */
  2186. ) {
  2187. var args = _normalizeArguments.apply(this, arguments)
  2188. , effectMethod = $.effects.effect[args.effect]
  2189. , defaultMode = effectMethod.mode
  2190. , queue = args.queue
  2191. , queueName = queue || "fx"
  2192. , complete = args.complete
  2193. , mode = args.mode
  2194. , modes = []
  2195. , prefilter = function (next) {
  2196. var el = $(this)
  2197. , normalizedMode = $.effects.mode(el, mode) || defaultMode;
  2198. // Sentinel for duck-punching the :animated pseudo-selector
  2199. el.data(dataSpaceAnimated, true);
  2200. // Save effect mode for later use,
  2201. // we can't just call $.effects.mode again later,
  2202. // as the .show() below destroys the initial state
  2203. modes.push(normalizedMode);
  2204. // See $.uiBackCompat inside of run() for removal of defaultMode in 1.14
  2205. if (defaultMode && (normalizedMode === "show" || (normalizedMode === defaultMode && normalizedMode === "hide"))) {
  2206. el.show();
  2207. }
  2208. if (!defaultMode || normalizedMode !== "none") {
  2209. $.effects.saveStyle(el);
  2210. }
  2211. if (typeof next === "function") {
  2212. next();
  2213. }
  2214. };
  2215. if ($.fx.off || !effectMethod) {
  2216. // Delegate to the original method (e.g., .show()) if possible
  2217. if (mode) {
  2218. return this[mode](args.duration, complete);
  2219. } else {
  2220. return this.each(function () {
  2221. if (complete) {
  2222. complete.call(this);
  2223. }
  2224. });
  2225. }
  2226. }
  2227. function run(next) {
  2228. var elem = $(this);
  2229. function cleanup() {
  2230. elem.removeData(dataSpaceAnimated);
  2231. $.effects.cleanUp(elem);
  2232. if (args.mode === "hide") {
  2233. elem.hide();
  2234. }
  2235. done();
  2236. }
  2237. function done() {
  2238. if (typeof complete === "function") {
  2239. complete.call(elem[0]);
  2240. }
  2241. if (typeof next === "function") {
  2242. next();
  2243. }
  2244. }
  2245. // Override mode option on a per element basis,
  2246. // as toggle can be either show or hide depending on element state
  2247. args.mode = modes.shift();
  2248. if ($.uiBackCompat !== false && !defaultMode) {
  2249. if (elem.is(":hidden") ? mode === "hide" : mode === "show") {
  2250. // Call the core method to track "olddisplay" properly
  2251. elem[mode]();
  2252. done();
  2253. } else {
  2254. effectMethod.call(elem[0], args, done);
  2255. }
  2256. } else {
  2257. if (args.mode === "none") {
  2258. // Call the core method to track "olddisplay" properly
  2259. elem[mode]();
  2260. done();
  2261. } else {
  2262. effectMethod.call(elem[0], args, cleanup);
  2263. }
  2264. }
  2265. }
  2266. // Run prefilter on all elements first to ensure that
  2267. // any showing or hiding happens before placeholder creation,
  2268. // which ensures that any layout changes are correctly captured.
  2269. return queue === false ? this.each(prefilter).each(run) : this.queue(queueName, prefilter).queue(queueName, run);
  2270. },
  2271. show: (function (orig) {
  2272. return function (option) {
  2273. if (standardAnimationOption(option)) {
  2274. return orig.apply(this, arguments);
  2275. } else {
  2276. var args = _normalizeArguments.apply(this, arguments);
  2277. args.mode = "show";
  2278. return this.effect.call(this, args);
  2279. }
  2280. }
  2281. ;
  2282. }
  2283. )($.fn.show),
  2284. hide: (function (orig) {
  2285. return function (option) {
  2286. if (standardAnimationOption(option)) {
  2287. return orig.apply(this, arguments);
  2288. } else {
  2289. var args = _normalizeArguments.apply(this, arguments);
  2290. args.mode = "hide";
  2291. return this.effect.call(this, args);
  2292. }
  2293. }
  2294. ;
  2295. }
  2296. )($.fn.hide),
  2297. toggle: (function (orig) {
  2298. return function (option) {
  2299. if (standardAnimationOption(option) || typeof option === "boolean") {
  2300. return orig.apply(this, arguments);
  2301. } else {
  2302. var args = _normalizeArguments.apply(this, arguments);
  2303. args.mode = "toggle";
  2304. return this.effect.call(this, args);
  2305. }
  2306. }
  2307. ;
  2308. }
  2309. )($.fn.toggle),
  2310. cssUnit: function (key) {
  2311. var style = this.css(key)
  2312. , val = [];
  2313. $.each(["em", "px", "%", "pt"], function (i, unit) {
  2314. if (style.indexOf(unit) > 0) {
  2315. val = [parseFloat(style), unit];
  2316. }
  2317. });
  2318. return val;
  2319. },
  2320. cssClip: function (clipObj) {
  2321. if (clipObj) {
  2322. return this.css("clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " + clipObj.bottom + "px " + clipObj.left + "px)");
  2323. }
  2324. return parseClip(this.css("clip"), this);
  2325. },
  2326. transfer: function (options, done) {
  2327. var element = $(this)
  2328. , target = $(options.to)
  2329. , targetFixed = target.css("position") === "fixed"
  2330. , body = $("body")
  2331. , fixTop = targetFixed ? body.scrollTop() : 0
  2332. , fixLeft = targetFixed ? body.scrollLeft() : 0
  2333. , endPosition = target.offset()
  2334. , animation = {
  2335. top: endPosition.top - fixTop,
  2336. left: endPosition.left - fixLeft,
  2337. height: target.innerHeight(),
  2338. width: target.innerWidth()
  2339. }
  2340. , startPosition = element.offset()
  2341. , transfer = $("<div class='ui-effects-transfer'></div>");
  2342. transfer.appendTo("body").addClass(options.className).css({
  2343. top: startPosition.top - fixTop,
  2344. left: startPosition.left - fixLeft,
  2345. height: element.innerHeight(),
  2346. width: element.innerWidth(),
  2347. position: targetFixed ? "fixed" : "absolute"
  2348. }).animate(animation, options.duration, options.easing, function () {
  2349. transfer.remove();
  2350. if (typeof done === "function") {
  2351. done();
  2352. }
  2353. });
  2354. }
  2355. });
  2356. function parseClip(str, element) {
  2357. var outerWidth = element.outerWidth()
  2358. , outerHeight = element.outerHeight()
  2359. ,
  2360. clipRegex = /^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/
  2361. , values = clipRegex.exec(str) || ["", 0, outerWidth, outerHeight, 0];
  2362. return {
  2363. top: parseFloat(values[1]) || 0,
  2364. right: values[2] === "auto" ? outerWidth : parseFloat(values[2]),
  2365. bottom: values[3] === "auto" ? outerHeight : parseFloat(values[3]),
  2366. left: parseFloat(values[4]) || 0
  2367. };
  2368. }
  2369. $.fx.step.clip = function (fx) {
  2370. if (!fx.clipInit) {
  2371. fx.start = $(fx.elem).cssClip();
  2372. if (typeof fx.end === "string") {
  2373. fx.end = parseClip(fx.end, fx.elem);
  2374. }
  2375. fx.clipInit = true;
  2376. }
  2377. $(fx.elem).cssClip({
  2378. top: fx.pos * (fx.end.top - fx.start.top) + fx.start.top,
  2379. right: fx.pos * (fx.end.right - fx.start.right) + fx.start.right,
  2380. bottom: fx.pos * (fx.end.bottom - fx.start.bottom) + fx.start.bottom,
  2381. left: fx.pos * (fx.end.left - fx.start.left) + fx.start.left
  2382. });
  2383. }
  2384. ;
  2385. }
  2386. )();
  2387. /******************************************************************************/
  2388. /*********************************** EASING ***********************************/
  2389. /******************************************************************************/
  2390. (function () {
  2391. // Based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
  2392. var baseEasings = {};
  2393. $.each(["Quad", "Cubic", "Quart", "Quint", "Expo"], function (i, name) {
  2394. baseEasings[name] = function (p) {
  2395. return Math.pow(p, i + 2);
  2396. }
  2397. ;
  2398. });
  2399. $.extend(baseEasings, {
  2400. Sine: function (p) {
  2401. return 1 - Math.cos(p * Math.PI / 2);
  2402. },
  2403. Circ: function (p) {
  2404. return 1 - Math.sqrt(1 - p * p);
  2405. },
  2406. Elastic: function (p) {
  2407. return p === 0 || p === 1 ? p : -Math.pow(2, 8 * (p - 1)) * Math.sin(((p - 1) * 80 - 7.5) * Math.PI / 15);
  2408. },
  2409. Back: function (p) {
  2410. return p * p * (3 * p - 2);
  2411. },
  2412. Bounce: function (p) {
  2413. var pow2, bounce = 4;
  2414. while (p < ((pow2 = Math.pow(2, --bounce)) - 1) / 11) {
  2415. }
  2416. return 1 / Math.pow(4, 3 - bounce) - 7.5625 * Math.pow((pow2 * 3 - 2) / 22 - p, 2);
  2417. }
  2418. });
  2419. $.each(baseEasings, function (name, easeIn) {
  2420. $.easing["easeIn" + name] = easeIn;
  2421. $.easing["easeOut" + name] = function (p) {
  2422. return 1 - easeIn(1 - p);
  2423. }
  2424. ;
  2425. $.easing["easeInOut" + name] = function (p) {
  2426. return p < 0.5 ? easeIn(p * 2) / 2 : 1 - easeIn(p * -2 + 2) / 2;
  2427. }
  2428. ;
  2429. });
  2430. }
  2431. )();
  2432. var effect = $.effects;
  2433. /*!
  2434. * jQuery UI Effects Blind 1.13.0
  2435. * http://jqueryui.com
  2436. *
  2437. * Copyright jQuery Foundation and other contributors
  2438. * Released under the MIT license.
  2439. * http://jquery.org/license
  2440. */
  2441. //>>label: Blind Effect
  2442. //>>group: Effects
  2443. //>>description: Blinds the element.
  2444. //>>docs: http://api.jqueryui.com/blind-effect/
  2445. //>>demos: http://jqueryui.com/effect/
  2446. var effectsEffectBlind = $.effects.define("blind", "hide", function (options, done) {
  2447. var map = {
  2448. up: ["bottom", "top"],
  2449. vertical: ["bottom", "top"],
  2450. down: ["top", "bottom"],
  2451. left: ["right", "left"],
  2452. horizontal: ["right", "left"],
  2453. right: ["left", "right"]
  2454. }
  2455. , element = $(this)
  2456. , direction = options.direction || "up"
  2457. , start = element.cssClip()
  2458. , animate = {
  2459. clip: $.extend({}, start)
  2460. }
  2461. , placeholder = $.effects.createPlaceholder(element);
  2462. animate.clip[map[direction][0]] = animate.clip[map[direction][1]];
  2463. if (options.mode === "show") {
  2464. element.cssClip(animate.clip);
  2465. if (placeholder) {
  2466. placeholder.css($.effects.clipToBox(animate));
  2467. }
  2468. animate.clip = start;
  2469. }
  2470. if (placeholder) {
  2471. placeholder.animate($.effects.clipToBox(animate), options.duration, options.easing);
  2472. }
  2473. element.animate(animate, {
  2474. queue: false,
  2475. duration: options.duration,
  2476. easing: options.easing,
  2477. complete: done
  2478. });
  2479. });
  2480. /*!
  2481. * jQuery UI Effects Bounce 1.13.0
  2482. * http://jqueryui.com
  2483. *
  2484. * Copyright jQuery Foundation and other contributors
  2485. * Released under the MIT license.
  2486. * http://jquery.org/license
  2487. */
  2488. //>>label: Bounce Effect
  2489. //>>group: Effects
  2490. //>>description: Bounces an element horizontally or vertically n times.
  2491. //>>docs: http://api.jqueryui.com/bounce-effect/
  2492. //>>demos: http://jqueryui.com/effect/
  2493. var effectsEffectBounce = $.effects.define("bounce", function (options, done) {
  2494. var upAnim, downAnim, refValue, element = $(this),
  2495. // Defaults:
  2496. mode = options.mode, hide = mode === "hide", show = mode === "show", direction = options.direction || "up",
  2497. distance = options.distance, times = options.times || 5,
  2498. // Number of internal animations
  2499. anims = times * 2 + (show || hide ? 1 : 0), speed = options.duration / anims, easing = options.easing,
  2500. // Utility:
  2501. ref = (direction === "up" || direction === "down") ? "top" : "left",
  2502. motion = (direction === "up" || direction === "left"), i = 0,
  2503. queuelen = element.queue().length;
  2504. $.effects.createPlaceholder(element);
  2505. refValue = element.css(ref);
  2506. // Default distance for the BIGGEST bounce is the outer Distance / 3
  2507. if (!distance) {
  2508. distance = element[ref === "top" ? "outerHeight" : "outerWidth"]() / 3;
  2509. }
  2510. if (show) {
  2511. downAnim = {
  2512. opacity: 1
  2513. };
  2514. downAnim[ref] = refValue;
  2515. // If we are showing, force opacity 0 and set the initial position
  2516. // then do the "first" animation
  2517. element.css("opacity", 0).css(ref, motion ? -distance * 2 : distance * 2).animate(downAnim, speed, easing);
  2518. }
  2519. // Start at the smallest distance if we are hiding
  2520. if (hide) {
  2521. distance = distance / Math.pow(2, times - 1);
  2522. }
  2523. downAnim = {};
  2524. downAnim[ref] = refValue;
  2525. // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
  2526. for (; i < times; i++) {
  2527. upAnim = {};
  2528. upAnim[ref] = (motion ? "-=" : "+=") + distance;
  2529. element.animate(upAnim, speed, easing).animate(downAnim, speed, easing);
  2530. distance = hide ? distance * 2 : distance / 2;
  2531. }
  2532. // Last Bounce when Hiding
  2533. if (hide) {
  2534. upAnim = {
  2535. opacity: 0
  2536. };
  2537. upAnim[ref] = (motion ? "-=" : "+=") + distance;
  2538. element.animate(upAnim, speed, easing);
  2539. }
  2540. element.queue(done);
  2541. $.effects.unshift(element, queuelen, anims + 1);
  2542. });
  2543. /*!
  2544. * jQuery UI Effects Clip 1.13.0
  2545. * http://jqueryui.com
  2546. *
  2547. * Copyright jQuery Foundation and other contributors
  2548. * Released under the MIT license.
  2549. * http://jquery.org/license
  2550. */
  2551. //>>label: Clip Effect
  2552. //>>group: Effects
  2553. //>>description: Clips the element on and off like an old TV.
  2554. //>>docs: http://api.jqueryui.com/clip-effect/
  2555. //>>demos: http://jqueryui.com/effect/
  2556. var effectsEffectClip = $.effects.define("clip", "hide", function (options, done) {
  2557. var start, animate = {}, element = $(this), direction = options.direction || "vertical",
  2558. both = direction === "both", horizontal = both || direction === "horizontal",
  2559. vertical = both || direction === "vertical";
  2560. start = element.cssClip();
  2561. animate.clip = {
  2562. top: vertical ? (start.bottom - start.top) / 2 : start.top,
  2563. right: horizontal ? (start.right - start.left) / 2 : start.right,
  2564. bottom: vertical ? (start.bottom - start.top) / 2 : start.bottom,
  2565. left: horizontal ? (start.right - start.left) / 2 : start.left
  2566. };
  2567. $.effects.createPlaceholder(element);
  2568. if (options.mode === "show") {
  2569. element.cssClip(animate.clip);
  2570. animate.clip = start;
  2571. }
  2572. element.animate(animate, {
  2573. queue: false,
  2574. duration: options.duration,
  2575. easing: options.easing,
  2576. complete: done
  2577. });
  2578. });
  2579. /*!
  2580. * jQuery UI Effects Drop 1.13.0
  2581. * http://jqueryui.com
  2582. *
  2583. * Copyright jQuery Foundation and other contributors
  2584. * Released under the MIT license.
  2585. * http://jquery.org/license
  2586. */
  2587. //>>label: Drop Effect
  2588. //>>group: Effects
  2589. //>>description: Moves an element in one direction and hides it at the same time.
  2590. //>>docs: http://api.jqueryui.com/drop-effect/
  2591. //>>demos: http://jqueryui.com/effect/
  2592. var effectsEffectDrop = $.effects.define("drop", "hide", function (options, done) {
  2593. var distance, element = $(this), mode = options.mode, show = mode === "show",
  2594. direction = options.direction || "left",
  2595. ref = (direction === "up" || direction === "down") ? "top" : "left",
  2596. motion = (direction === "up" || direction === "left") ? "-=" : "+=",
  2597. oppositeMotion = (motion === "+=") ? "-=" : "+=", animation = {
  2598. opacity: 0
  2599. };
  2600. $.effects.createPlaceholder(element);
  2601. distance = options.distance || element[ref === "top" ? "outerHeight" : "outerWidth"](true) / 2;
  2602. animation[ref] = motion + distance;
  2603. if (show) {
  2604. element.css(animation);
  2605. animation[ref] = oppositeMotion + distance;
  2606. animation.opacity = 1;
  2607. }
  2608. // Animate
  2609. element.animate(animation, {
  2610. queue: false,
  2611. duration: options.duration,
  2612. easing: options.easing,
  2613. complete: done
  2614. });
  2615. });
  2616. /*!
  2617. * jQuery UI Effects Explode 1.13.0
  2618. * http://jqueryui.com
  2619. *
  2620. * Copyright jQuery Foundation and other contributors
  2621. * Released under the MIT license.
  2622. * http://jquery.org/license
  2623. */
  2624. //>>label: Explode Effect
  2625. //>>group: Effects
  2626. /* eslint-disable max-len */
  2627. //>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness.
  2628. /* eslint-enable max-len */
  2629. //>>docs: http://api.jqueryui.com/explode-effect/
  2630. //>>demos: http://jqueryui.com/effect/
  2631. var effectsEffectExplode = $.effects.define("explode", "hide", function (options, done) {
  2632. var i, j, left, top, mx, my, rows = options.pieces ? Math.round(Math.sqrt(options.pieces)) : 3, cells = rows,
  2633. element = $(this), mode = options.mode, show = mode === "show",
  2634. // Show and then visibility:hidden the element before calculating offset
  2635. offset = element.show().css("visibility", "hidden").offset(),
  2636. // Width and height of a piece
  2637. width = Math.ceil(element.outerWidth() / cells), height = Math.ceil(element.outerHeight() / rows),
  2638. pieces = [];
  2639. // Children animate complete:
  2640. function childComplete() {
  2641. pieces.push(this);
  2642. if (pieces.length === rows * cells) {
  2643. animComplete();
  2644. }
  2645. }
  2646. // Clone the element for each row and cell.
  2647. for (i = 0; i < rows; i++) {
  2648. // ===>
  2649. top = offset.top + i * height;
  2650. my = i - (rows - 1) / 2;
  2651. for (j = 0; j < cells; j++) {
  2652. // |||
  2653. left = offset.left + j * width;
  2654. mx = j - (cells - 1) / 2;
  2655. // Create a clone of the now hidden main element that will be absolute positioned
  2656. // within a wrapper div off the -left and -top equal to size of our pieces
  2657. element.clone().appendTo("body").wrap("<div></div>").css({
  2658. position: "absolute",
  2659. visibility: "visible",
  2660. left: -j * width,
  2661. top: -i * height
  2662. })
  2663. // Select the wrapper - make it overflow: hidden and absolute positioned based on
  2664. // where the original was located +left and +top equal to the size of pieces
  2665. .parent().addClass("ui-effects-explode").css({
  2666. position: "absolute",
  2667. overflow: "hidden",
  2668. width: width,
  2669. height: height,
  2670. left: left + (show ? mx * width : 0),
  2671. top: top + (show ? my * height : 0),
  2672. opacity: show ? 0 : 1
  2673. }).animate({
  2674. left: left + (show ? 0 : mx * width),
  2675. top: top + (show ? 0 : my * height),
  2676. opacity: show ? 1 : 0
  2677. }, options.duration || 500, options.easing, childComplete);
  2678. }
  2679. }
  2680. function animComplete() {
  2681. element.css({
  2682. visibility: "visible"
  2683. });
  2684. $(pieces).remove();
  2685. done();
  2686. }
  2687. });
  2688. /*!
  2689. * jQuery UI Effects Fade 1.13.0
  2690. * http://jqueryui.com
  2691. *
  2692. * Copyright jQuery Foundation and other contributors
  2693. * Released under the MIT license.
  2694. * http://jquery.org/license
  2695. */
  2696. //>>label: Fade Effect
  2697. //>>group: Effects
  2698. //>>description: Fades the element.
  2699. //>>docs: http://api.jqueryui.com/fade-effect/
  2700. //>>demos: http://jqueryui.com/effect/
  2701. var effectsEffectFade = $.effects.define("fade", "toggle", function (options, done) {
  2702. var show = options.mode === "show";
  2703. $(this).css("opacity", show ? 0 : 1).animate({
  2704. opacity: show ? 1 : 0
  2705. }, {
  2706. queue: false,
  2707. duration: options.duration,
  2708. easing: options.easing,
  2709. complete: done
  2710. });
  2711. });
  2712. /*!
  2713. * jQuery UI Effects Fold 1.13.0
  2714. * http://jqueryui.com
  2715. *
  2716. * Copyright jQuery Foundation and other contributors
  2717. * Released under the MIT license.
  2718. * http://jquery.org/license
  2719. */
  2720. //>>label: Fold Effect
  2721. //>>group: Effects
  2722. //>>description: Folds an element first horizontally and then vertically.
  2723. //>>docs: http://api.jqueryui.com/fold-effect/
  2724. //>>demos: http://jqueryui.com/effect/
  2725. var effectsEffectFold = $.effects.define("fold", "hide", function (options, done) {
  2726. // Create element
  2727. var element = $(this)
  2728. , mode = options.mode
  2729. , show = mode === "show"
  2730. , hide = mode === "hide"
  2731. , size = options.size || 15
  2732. , percent = /([0-9]+)%/.exec(size)
  2733. , horizFirst = !!options.horizFirst
  2734. , ref = horizFirst ? ["right", "bottom"] : ["bottom", "right"]
  2735. , duration = options.duration / 2
  2736. ,
  2737. placeholder = $.effects.createPlaceholder(element)
  2738. ,
  2739. start = element.cssClip()
  2740. , animation1 = {
  2741. clip: $.extend({}, start)
  2742. }
  2743. , animation2 = {
  2744. clip: $.extend({}, start)
  2745. }
  2746. ,
  2747. distance = [start[ref[0]], start[ref[1]]]
  2748. ,
  2749. queuelen = element.queue().length;
  2750. if (percent) {
  2751. size = parseInt(percent[1], 10) / 100 * distance[hide ? 0 : 1];
  2752. }
  2753. animation1.clip[ref[0]] = size;
  2754. animation2.clip[ref[0]] = size;
  2755. animation2.clip[ref[1]] = 0;
  2756. if (show) {
  2757. element.cssClip(animation2.clip);
  2758. if (placeholder) {
  2759. placeholder.css($.effects.clipToBox(animation2));
  2760. }
  2761. animation2.clip = start;
  2762. }
  2763. // Animate
  2764. element.queue(function (next) {
  2765. if (placeholder) {
  2766. placeholder.animate($.effects.clipToBox(animation1), duration, options.easing).animate($.effects.clipToBox(animation2), duration, options.easing);
  2767. }
  2768. next();
  2769. }).animate(animation1, duration, options.easing).animate(animation2, duration, options.easing).queue(done);
  2770. $.effects.unshift(element, queuelen, 4);
  2771. });
  2772. /*!
  2773. * jQuery UI Effects Highlight 1.13.0
  2774. * http://jqueryui.com
  2775. *
  2776. * Copyright jQuery Foundation and other contributors
  2777. * Released under the MIT license.
  2778. * http://jquery.org/license
  2779. */
  2780. //>>label: Highlight Effect
  2781. //>>group: Effects
  2782. //>>description: Highlights the background of an element in a defined color for a custom duration.
  2783. //>>docs: http://api.jqueryui.com/highlight-effect/
  2784. //>>demos: http://jqueryui.com/effect/
  2785. var effectsEffectHighlight = $.effects.define("highlight", "show", function (options, done) {
  2786. var element = $(this)
  2787. , animation = {
  2788. backgroundColor: element.css("backgroundColor")
  2789. };
  2790. if (options.mode === "hide") {
  2791. animation.opacity = 0;
  2792. }
  2793. $.effects.saveStyle(element);
  2794. element.css({
  2795. backgroundImage: "none",
  2796. backgroundColor: options.color || "#ffff99"
  2797. }).animate(animation, {
  2798. queue: false,
  2799. duration: options.duration,
  2800. easing: options.easing,
  2801. complete: done
  2802. });
  2803. });
  2804. /*!
  2805. * jQuery UI Effects Size 1.13.0
  2806. * http://jqueryui.com
  2807. *
  2808. * Copyright jQuery Foundation and other contributors
  2809. * Released under the MIT license.
  2810. * http://jquery.org/license
  2811. */
  2812. //>>label: Size Effect
  2813. //>>group: Effects
  2814. //>>description: Resize an element to a specified width and height.
  2815. //>>docs: http://api.jqueryui.com/size-effect/
  2816. //>>demos: http://jqueryui.com/effect/
  2817. var effectsEffectSize = $.effects.define("size", function (options, done) {
  2818. // Create element
  2819. var baseline, factor, temp, element = $(this),
  2820. // Copy for children
  2821. cProps = ["fontSize"], vProps = ["borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"],
  2822. hProps = ["borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight"],
  2823. // Set options
  2824. mode = options.mode, restore = mode !== "effect", scale = options.scale || "both",
  2825. origin = options.origin || ["middle", "center"], position = element.css("position"),
  2826. pos = element.position(), original = $.effects.scaledDimensions(element), from = options.from || original,
  2827. to = options.to || $.effects.scaledDimensions(element, 0);
  2828. $.effects.createPlaceholder(element);
  2829. if (mode === "show") {
  2830. temp = from;
  2831. from = to;
  2832. to = temp;
  2833. }
  2834. // Set scaling factor
  2835. factor = {
  2836. from: {
  2837. y: from.height / original.height,
  2838. x: from.width / original.width
  2839. },
  2840. to: {
  2841. y: to.height / original.height,
  2842. x: to.width / original.width
  2843. }
  2844. };
  2845. // Scale the css box
  2846. if (scale === "box" || scale === "both") {
  2847. // Vertical props scaling
  2848. if (factor.from.y !== factor.to.y) {
  2849. from = $.effects.setTransition(element, vProps, factor.from.y, from);
  2850. to = $.effects.setTransition(element, vProps, factor.to.y, to);
  2851. }
  2852. // Horizontal props scaling
  2853. if (factor.from.x !== factor.to.x) {
  2854. from = $.effects.setTransition(element, hProps, factor.from.x, from);
  2855. to = $.effects.setTransition(element, hProps, factor.to.x, to);
  2856. }
  2857. }
  2858. // Scale the content
  2859. if (scale === "content" || scale === "both") {
  2860. // Vertical props scaling
  2861. if (factor.from.y !== factor.to.y) {
  2862. from = $.effects.setTransition(element, cProps, factor.from.y, from);
  2863. to = $.effects.setTransition(element, cProps, factor.to.y, to);
  2864. }
  2865. }
  2866. // Adjust the position properties based on the provided origin points
  2867. if (origin) {
  2868. baseline = $.effects.getBaseline(origin, original);
  2869. from.top = (original.outerHeight - from.outerHeight) * baseline.y + pos.top;
  2870. from.left = (original.outerWidth - from.outerWidth) * baseline.x + pos.left;
  2871. to.top = (original.outerHeight - to.outerHeight) * baseline.y + pos.top;
  2872. to.left = (original.outerWidth - to.outerWidth) * baseline.x + pos.left;
  2873. }
  2874. delete from.outerHeight;
  2875. delete from.outerWidth;
  2876. element.css(from);
  2877. // Animate the children if desired
  2878. if (scale === "content" || scale === "both") {
  2879. vProps = vProps.concat(["marginTop", "marginBottom"]).concat(cProps);
  2880. hProps = hProps.concat(["marginLeft", "marginRight"]);
  2881. // Only animate children with width attributes specified
  2882. // TODO: is this right? should we include anything with css width specified as well
  2883. element.find("*[width]").each(function () {
  2884. var child = $(this)
  2885. , childOriginal = $.effects.scaledDimensions(child)
  2886. , childFrom = {
  2887. height: childOriginal.height * factor.from.y,
  2888. width: childOriginal.width * factor.from.x,
  2889. outerHeight: childOriginal.outerHeight * factor.from.y,
  2890. outerWidth: childOriginal.outerWidth * factor.from.x
  2891. }
  2892. , childTo = {
  2893. height: childOriginal.height * factor.to.y,
  2894. width: childOriginal.width * factor.to.x,
  2895. outerHeight: childOriginal.height * factor.to.y,
  2896. outerWidth: childOriginal.width * factor.to.x
  2897. };
  2898. // Vertical props scaling
  2899. if (factor.from.y !== factor.to.y) {
  2900. childFrom = $.effects.setTransition(child, vProps, factor.from.y, childFrom);
  2901. childTo = $.effects.setTransition(child, vProps, factor.to.y, childTo);
  2902. }
  2903. // Horizontal props scaling
  2904. if (factor.from.x !== factor.to.x) {
  2905. childFrom = $.effects.setTransition(child, hProps, factor.from.x, childFrom);
  2906. childTo = $.effects.setTransition(child, hProps, factor.to.x, childTo);
  2907. }
  2908. if (restore) {
  2909. $.effects.saveStyle(child);
  2910. }
  2911. // Animate children
  2912. child.css(childFrom);
  2913. child.animate(childTo, options.duration, options.easing, function () {
  2914. // Restore children
  2915. if (restore) {
  2916. $.effects.restoreStyle(child);
  2917. }
  2918. });
  2919. });
  2920. }
  2921. // Animate
  2922. element.animate(to, {
  2923. queue: false,
  2924. duration: options.duration,
  2925. easing: options.easing,
  2926. complete: function () {
  2927. var offset = element.offset();
  2928. if (to.opacity === 0) {
  2929. element.css("opacity", from.opacity);
  2930. }
  2931. if (!restore) {
  2932. element.css("position", position === "static" ? "relative" : position).offset(offset);
  2933. // Need to save style here so that automatic style restoration
  2934. // doesn't restore to the original styles from before the animation.
  2935. $.effects.saveStyle(element);
  2936. }
  2937. done();
  2938. }
  2939. });
  2940. });
  2941. /*!
  2942. * jQuery UI Effects Scale 1.13.0
  2943. * http://jqueryui.com
  2944. *
  2945. * Copyright jQuery Foundation and other contributors
  2946. * Released under the MIT license.
  2947. * http://jquery.org/license
  2948. */
  2949. //>>label: Scale Effect
  2950. //>>group: Effects
  2951. //>>description: Grows or shrinks an element and its content.
  2952. //>>docs: http://api.jqueryui.com/scale-effect/
  2953. //>>demos: http://jqueryui.com/effect/
  2954. var effectsEffectScale = $.effects.define("scale", function (options, done) {
  2955. // Create element
  2956. var el = $(this)
  2957. , mode = options.mode
  2958. ,
  2959. percent = parseInt(options.percent, 10) || (parseInt(options.percent, 10) === 0 ? 0 : (mode !== "effect" ? 0 : 100))
  2960. ,
  2961. newOptions = $.extend(true, {
  2962. from: $.effects.scaledDimensions(el),
  2963. to: $.effects.scaledDimensions(el, percent, options.direction || "both"),
  2964. origin: options.origin || ["middle", "center"]
  2965. }, options);
  2966. // Fade option to support puff
  2967. if (options.fade) {
  2968. newOptions.from.opacity = 1;
  2969. newOptions.to.opacity = 0;
  2970. }
  2971. $.effects.effect.size.call(this, newOptions, done);
  2972. });
  2973. /*!
  2974. * jQuery UI Effects Puff 1.13.0
  2975. * http://jqueryui.com
  2976. *
  2977. * Copyright jQuery Foundation and other contributors
  2978. * Released under the MIT license.
  2979. * http://jquery.org/license
  2980. */
  2981. //>>label: Puff Effect
  2982. //>>group: Effects
  2983. //>>description: Creates a puff effect by scaling the element up and hiding it at the same time.
  2984. //>>docs: http://api.jqueryui.com/puff-effect/
  2985. //>>demos: http://jqueryui.com/effect/
  2986. var effectsEffectPuff = $.effects.define("puff", "hide", function (options, done) {
  2987. var newOptions = $.extend(true, {}, options, {
  2988. fade: true,
  2989. percent: parseInt(options.percent, 10) || 150
  2990. });
  2991. $.effects.effect.scale.call(this, newOptions, done);
  2992. });
  2993. /*!
  2994. * jQuery UI Effects Pulsate 1.13.0
  2995. * http://jqueryui.com
  2996. *
  2997. * Copyright jQuery Foundation and other contributors
  2998. * Released under the MIT license.
  2999. * http://jquery.org/license
  3000. */
  3001. //>>label: Pulsate Effect
  3002. //>>group: Effects
  3003. //>>description: Pulsates an element n times by changing the opacity to zero and back.
  3004. //>>docs: http://api.jqueryui.com/pulsate-effect/
  3005. //>>demos: http://jqueryui.com/effect/
  3006. var effectsEffectPulsate = $.effects.define("pulsate", "show", function (options, done) {
  3007. var element = $(this)
  3008. , mode = options.mode
  3009. , show = mode === "show"
  3010. , hide = mode === "hide"
  3011. , showhide = show || hide
  3012. ,
  3013. // Showing or hiding leaves off the "last" animation
  3014. anims = ((options.times || 5) * 2) + (showhide ? 1 : 0)
  3015. , duration = options.duration / anims
  3016. , animateTo = 0
  3017. , i = 1
  3018. , queuelen = element.queue().length;
  3019. if (show || !element.is(":visible")) {
  3020. element.css("opacity", 0).show();
  3021. animateTo = 1;
  3022. }
  3023. // Anims - 1 opacity "toggles"
  3024. for (; i < anims; i++) {
  3025. element.animate({
  3026. opacity: animateTo
  3027. }, duration, options.easing);
  3028. animateTo = 1 - animateTo;
  3029. }
  3030. element.animate({
  3031. opacity: animateTo
  3032. }, duration, options.easing);
  3033. element.queue(done);
  3034. $.effects.unshift(element, queuelen, anims + 1);
  3035. });
  3036. /*!
  3037. * jQuery UI Effects Shake 1.13.0
  3038. * http://jqueryui.com
  3039. *
  3040. * Copyright jQuery Foundation and other contributors
  3041. * Released under the MIT license.
  3042. * http://jquery.org/license
  3043. */
  3044. //>>label: Shake Effect
  3045. //>>group: Effects
  3046. //>>description: Shakes an element horizontally or vertically n times.
  3047. //>>docs: http://api.jqueryui.com/shake-effect/
  3048. //>>demos: http://jqueryui.com/effect/
  3049. var effectsEffectShake = $.effects.define("shake", function (options, done) {
  3050. var i = 1
  3051. , element = $(this)
  3052. , direction = options.direction || "left"
  3053. , distance = options.distance || 20
  3054. , times = options.times || 3
  3055. , anims = times * 2 + 1
  3056. , speed = Math.round(options.duration / anims)
  3057. , ref = (direction === "up" || direction === "down") ? "top" : "left"
  3058. , positiveMotion = (direction === "up" || direction === "left")
  3059. , animation = {}
  3060. , animation1 = {}
  3061. , animation2 = {}
  3062. ,
  3063. queuelen = element.queue().length;
  3064. $.effects.createPlaceholder(element);
  3065. // Animation
  3066. animation[ref] = (positiveMotion ? "-=" : "+=") + distance;
  3067. animation1[ref] = (positiveMotion ? "+=" : "-=") + distance * 2;
  3068. animation2[ref] = (positiveMotion ? "-=" : "+=") + distance * 2;
  3069. // Animate
  3070. element.animate(animation, speed, options.easing);
  3071. // Shakes
  3072. for (; i < times; i++) {
  3073. element.animate(animation1, speed, options.easing).animate(animation2, speed, options.easing);
  3074. }
  3075. element.animate(animation1, speed, options.easing).animate(animation, speed / 2, options.easing).queue(done);
  3076. $.effects.unshift(element, queuelen, anims + 1);
  3077. });
  3078. /*!
  3079. * jQuery UI Effects Slide 1.13.0
  3080. * http://jqueryui.com
  3081. *
  3082. * Copyright jQuery Foundation and other contributors
  3083. * Released under the MIT license.
  3084. * http://jquery.org/license
  3085. */
  3086. //>>label: Slide Effect
  3087. //>>group: Effects
  3088. //>>description: Slides an element in and out of the viewport.
  3089. //>>docs: http://api.jqueryui.com/slide-effect/
  3090. //>>demos: http://jqueryui.com/effect/
  3091. var effectsEffectSlide = $.effects.define("slide", "show", function (options, done) {
  3092. var startClip, startRef, element = $(this), map = {
  3093. up: ["bottom", "top"],
  3094. down: ["top", "bottom"],
  3095. left: ["right", "left"],
  3096. right: ["left", "right"]
  3097. }, mode = options.mode, direction = options.direction || "left",
  3098. ref = (direction === "up" || direction === "down") ? "top" : "left",
  3099. positiveMotion = (direction === "up" || direction === "left"),
  3100. distance = options.distance || element[ref === "top" ? "outerHeight" : "outerWidth"](true), animation = {};
  3101. $.effects.createPlaceholder(element);
  3102. startClip = element.cssClip();
  3103. startRef = element.position()[ref];
  3104. // Define hide animation
  3105. animation[ref] = (positiveMotion ? -1 : 1) * distance + startRef;
  3106. animation.clip = element.cssClip();
  3107. animation.clip[map[direction][1]] = animation.clip[map[direction][0]];
  3108. // Reverse the animation if we're showing
  3109. if (mode === "show") {
  3110. element.cssClip(animation.clip);
  3111. element.css(ref, animation[ref]);
  3112. animation.clip = startClip;
  3113. animation[ref] = startRef;
  3114. }
  3115. // Actually animate
  3116. element.animate(animation, {
  3117. queue: false,
  3118. duration: options.duration,
  3119. easing: options.easing,
  3120. complete: done
  3121. });
  3122. });
  3123. /*!
  3124. * jQuery UI Effects Transfer 1.13.0
  3125. * http://jqueryui.com
  3126. *
  3127. * Copyright jQuery Foundation and other contributors
  3128. * Released under the MIT license.
  3129. * http://jquery.org/license
  3130. */
  3131. //>>label: Transfer Effect
  3132. //>>group: Effects
  3133. //>>description: Displays a transfer effect from one element to another.
  3134. //>>docs: http://api.jqueryui.com/transfer-effect/
  3135. //>>demos: http://jqueryui.com/effect/
  3136. var effect;
  3137. if ($.uiBackCompat !== false) {
  3138. effect = $.effects.define("transfer", function (options, done) {
  3139. $(this).transfer(options, done);
  3140. });
  3141. }
  3142. var effectsEffectTransfer = effect;
  3143. /*!
  3144. * jQuery UI Focusable 1.13.0
  3145. * http://jqueryui.com
  3146. *
  3147. * Copyright jQuery Foundation and other contributors
  3148. * Released under the MIT license.
  3149. * http://jquery.org/license
  3150. */
  3151. //>>label: :focusable Selector
  3152. //>>group: Core
  3153. //>>description: Selects elements which can be focused.
  3154. //>>docs: http://api.jqueryui.com/focusable-selector/
  3155. // Selectors
  3156. $.ui.focusable = function (element, hasTabindex) {
  3157. var map, mapName, img, focusableIfVisible, fieldset, nodeName = element.nodeName.toLowerCase();
  3158. if ("area" === nodeName) {
  3159. map = element.parentNode;
  3160. mapName = map.name;
  3161. if (!element.href || !mapName || map.nodeName.toLowerCase() !== "map") {
  3162. return false;
  3163. }
  3164. img = $("img[usemap='#" + mapName + "']");
  3165. return img.length > 0 && img.is(":visible");
  3166. }
  3167. if (/^(input|select|textarea|button|object)$/.test(nodeName)) {
  3168. focusableIfVisible = !element.disabled;
  3169. if (focusableIfVisible) {
  3170. // Form controls within a disabled fieldset are disabled.
  3171. // However, controls within the fieldset's legend do not get disabled.
  3172. // Since controls generally aren't placed inside legends, we skip
  3173. // this portion of the check.
  3174. fieldset = $(element).closest("fieldset")[0];
  3175. if (fieldset) {
  3176. focusableIfVisible = !fieldset.disabled;
  3177. }
  3178. }
  3179. } else if ("a" === nodeName) {
  3180. focusableIfVisible = element.href || hasTabindex;
  3181. } else {
  3182. focusableIfVisible = hasTabindex;
  3183. }
  3184. return focusableIfVisible && $(element).is(":visible") && visible($(element));
  3185. }
  3186. ;
  3187. // Support: IE 8 only
  3188. // IE 8 doesn't resolve inherit to visible/hidden for computed values
  3189. function visible(element) {
  3190. var visibility = element.css("visibility");
  3191. while (visibility === "inherit") {
  3192. element = element.parent();
  3193. visibility = element.css("visibility");
  3194. }
  3195. return visibility === "visible";
  3196. }
  3197. $.extend($.expr.pseudos, {
  3198. focusable: function (element) {
  3199. return $.ui.focusable(element, $.attr(element, "tabindex") != null);
  3200. }
  3201. });
  3202. var focusable = $.ui.focusable;
  3203. // Support: IE8 Only
  3204. // IE8 does not support the form attribute and when it is supplied. It overwrites the form prop
  3205. // with a string, so we need to find the proper form.
  3206. var form = $.fn._form = function () {
  3207. return typeof this[0].form === "string" ? this.closest("form") : $(this[0].form);
  3208. }
  3209. ;
  3210. /*!
  3211. * jQuery UI Form Reset Mixin 1.13.0
  3212. * http://jqueryui.com
  3213. *
  3214. * Copyright jQuery Foundation and other contributors
  3215. * Released under the MIT license.
  3216. * http://jquery.org/license
  3217. */
  3218. //>>label: Form Reset Mixin
  3219. //>>group: Core
  3220. //>>description: Refresh input widgets when their form is reset
  3221. //>>docs: http://api.jqueryui.com/form-reset-mixin/
  3222. var formResetMixin = $.ui.formResetMixin = {
  3223. _formResetHandler: function () {
  3224. var form = $(this);
  3225. // Wait for the form reset to actually happen before refreshing
  3226. setTimeout(function () {
  3227. var instances = form.data("ui-form-reset-instances");
  3228. $.each(instances, function () {
  3229. this.refresh();
  3230. });
  3231. });
  3232. },
  3233. _bindFormResetHandler: function () {
  3234. this.form = this.element._form();
  3235. if (!this.form.length) {
  3236. return;
  3237. }
  3238. var instances = this.form.data("ui-form-reset-instances") || [];
  3239. if (!instances.length) {
  3240. // We don't use _on() here because we use a single event handler per form
  3241. this.form.on("reset.ui-form-reset", this._formResetHandler);
  3242. }
  3243. instances.push(this);
  3244. this.form.data("ui-form-reset-instances", instances);
  3245. },
  3246. _unbindFormResetHandler: function () {
  3247. if (!this.form.length) {
  3248. return;
  3249. }
  3250. var instances = this.form.data("ui-form-reset-instances");
  3251. instances.splice($.inArray(this, instances), 1);
  3252. if (instances.length) {
  3253. this.form.data("ui-form-reset-instances", instances);
  3254. } else {
  3255. this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset");
  3256. }
  3257. }
  3258. };
  3259. /*!
  3260. * jQuery UI Support for jQuery core 1.8.x and newer 1.13.0
  3261. * http://jqueryui.com
  3262. *
  3263. * Copyright jQuery Foundation and other contributors
  3264. * Released under the MIT license.
  3265. * http://jquery.org/license
  3266. *
  3267. */
  3268. //>>label: jQuery 1.8+ Support
  3269. //>>group: Core
  3270. //>>description: Support version 1.8.x and newer of jQuery core
  3271. // Support: jQuery 1.9.x or older
  3272. // $.expr[ ":" ] is deprecated.
  3273. if (!$.expr.pseudos) {
  3274. $.expr.pseudos = $.expr[":"];
  3275. }
  3276. // Support: jQuery 1.11.x or older
  3277. // $.unique has been renamed to $.uniqueSort
  3278. if (!$.uniqueSort) {
  3279. $.uniqueSort = $.unique;
  3280. }
  3281. // Support: jQuery 2.2.x or older.
  3282. // This method has been defined in jQuery 3.0.0.
  3283. // Code from https://github.com/jquery/jquery/blob/e539bac79e666bba95bba86d690b4e609dca2286/src/selector/escapeSelector.js
  3284. if (!$.escapeSelector) {
  3285. // CSS string/identifier serialization
  3286. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  3287. var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
  3288. var fcssescape = function (ch, asCodePoint) {
  3289. if (asCodePoint) {
  3290. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  3291. if (ch === "\0") {
  3292. return "\uFFFD";
  3293. }
  3294. // Control characters and (dependent upon position) numbers get escaped as code points
  3295. return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
  3296. }
  3297. // Other potentially-special ASCII characters get backslash-escaped
  3298. return "\\" + ch;
  3299. };
  3300. $.escapeSelector = function (sel) {
  3301. return (sel + "").replace(rcssescape, fcssescape);
  3302. }
  3303. ;
  3304. }
  3305. // Support: jQuery 3.4.x or older
  3306. // These methods have been defined in jQuery 3.5.0.
  3307. if (!$.fn.even || !$.fn.odd) {
  3308. $.fn.extend({
  3309. even: function () {
  3310. return this.filter(function (i) {
  3311. return i % 2 === 0;
  3312. });
  3313. },
  3314. odd: function () {
  3315. return this.filter(function (i) {
  3316. return i % 2 === 1;
  3317. });
  3318. }
  3319. });
  3320. }
  3321. ;/*!
  3322. * jQuery UI Keycode 1.13.0
  3323. * http://jqueryui.com
  3324. *
  3325. * Copyright jQuery Foundation and other contributors
  3326. * Released under the MIT license.
  3327. * http://jquery.org/license
  3328. */
  3329. //>>label: Keycode
  3330. //>>group: Core
  3331. //>>description: Provide keycodes as keynames
  3332. //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
  3333. var keycode = $.ui.keyCode = {
  3334. BACKSPACE: 8,
  3335. COMMA: 188,
  3336. DELETE: 46,
  3337. DOWN: 40,
  3338. END: 35,
  3339. ENTER: 13,
  3340. ESCAPE: 27,
  3341. HOME: 36,
  3342. LEFT: 37,
  3343. PAGE_DOWN: 34,
  3344. PAGE_UP: 33,
  3345. PERIOD: 190,
  3346. RIGHT: 39,
  3347. SPACE: 32,
  3348. TAB: 9,
  3349. UP: 38
  3350. };
  3351. /*!
  3352. * jQuery UI Labels 1.13.0
  3353. * http://jqueryui.com
  3354. *
  3355. * Copyright jQuery Foundation and other contributors
  3356. * Released under the MIT license.
  3357. * http://jquery.org/license
  3358. */
  3359. //>>label: labels
  3360. //>>group: Core
  3361. //>>description: Find all the labels associated with a given input
  3362. //>>docs: http://api.jqueryui.com/labels/
  3363. var labels = $.fn.labels = function () {
  3364. var ancestor, selector, id, labels, ancestors;
  3365. if (!this.length) {
  3366. return this.pushStack([]);
  3367. }
  3368. // Check control.labels first
  3369. if (this[0].labels && this[0].labels.length) {
  3370. return this.pushStack(this[0].labels);
  3371. }
  3372. // Support: IE <= 11, FF <= 37, Android <= 2.3 only
  3373. // Above browsers do not support control.labels. Everything below is to support them
  3374. // as well as document fragments. control.labels does not work on document fragments
  3375. labels = this.eq(0).parents("label");
  3376. // Look for the label based on the id
  3377. id = this.attr("id");
  3378. if (id) {
  3379. // We don't search against the document in case the element
  3380. // is disconnected from the DOM
  3381. ancestor = this.eq(0).parents().last();
  3382. // Get a full set of top level ancestors
  3383. ancestors = ancestor.add(ancestor.length ? ancestor.siblings() : this.siblings());
  3384. // Create a selector for the label based on the id
  3385. selector = "label[for='" + $.escapeSelector(id) + "']";
  3386. labels = labels.add(ancestors.find(selector).addBack(selector));
  3387. }
  3388. // Return whatever we have found for labels
  3389. return this.pushStack(labels);
  3390. }
  3391. ;
  3392. /*!
  3393. * jQuery UI Scroll Parent 1.13.0
  3394. * http://jqueryui.com
  3395. *
  3396. * Copyright jQuery Foundation and other contributors
  3397. * Released under the MIT license.
  3398. * http://jquery.org/license
  3399. */
  3400. //>>label: scrollParent
  3401. //>>group: Core
  3402. //>>description: Get the closest ancestor element that is scrollable.
  3403. //>>docs: http://api.jqueryui.com/scrollParent/
  3404. var scrollParent = $.fn.scrollParent = function (includeHidden) {
  3405. var position = this.css("position")
  3406. , excludeStaticParent = position === "absolute"
  3407. , overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/
  3408. , scrollParent = this.parents().filter(function () {
  3409. var parent = $(this);
  3410. if (excludeStaticParent && parent.css("position") === "static") {
  3411. return false;
  3412. }
  3413. return overflowRegex.test(parent.css("overflow") + parent.css("overflow-y") + parent.css("overflow-x"));
  3414. }).eq(0);
  3415. return position === "fixed" || !scrollParent.length ? $(this[0].ownerDocument || document) : scrollParent;
  3416. }
  3417. ;
  3418. /*!
  3419. * jQuery UI Tabbable 1.13.0
  3420. * http://jqueryui.com
  3421. *
  3422. * Copyright jQuery Foundation and other contributors
  3423. * Released under the MIT license.
  3424. * http://jquery.org/license
  3425. */
  3426. //>>label: :tabbable Selector
  3427. //>>group: Core
  3428. //>>description: Selects elements which can be tabbed to.
  3429. //>>docs: http://api.jqueryui.com/tabbable-selector/
  3430. var tabbable = $.extend($.expr.pseudos, {
  3431. tabbable: function (element) {
  3432. var tabIndex = $.attr(element, "tabindex")
  3433. , hasTabindex = tabIndex != null;
  3434. return (!hasTabindex || tabIndex >= 0) && $.ui.focusable(element, hasTabindex);
  3435. }
  3436. });
  3437. /*!
  3438. * jQuery UI Unique ID 1.13.0
  3439. * http://jqueryui.com
  3440. *
  3441. * Copyright jQuery Foundation and other contributors
  3442. * Released under the MIT license.
  3443. * http://jquery.org/license
  3444. */
  3445. //>>label: uniqueId
  3446. //>>group: Core
  3447. //>>description: Functions to generate and remove uniqueId's
  3448. //>>docs: http://api.jqueryui.com/uniqueId/
  3449. var uniqueId = $.fn.extend({
  3450. uniqueId: (function () {
  3451. var uuid = 0;
  3452. return function () {
  3453. return this.each(function () {
  3454. if (!this.id) {
  3455. this.id = "ui-id-" + (++uuid);
  3456. }
  3457. });
  3458. }
  3459. ;
  3460. }
  3461. )(),
  3462. removeUniqueId: function () {
  3463. return this.each(function () {
  3464. if (/^ui-id-\d+$/.test(this.id)) {
  3465. $(this).removeAttr("id");
  3466. }
  3467. });
  3468. }
  3469. });
  3470. /*!
  3471. * jQuery UI Accordion 1.13.0
  3472. * http://jqueryui.com
  3473. *
  3474. * Copyright jQuery Foundation and other contributors
  3475. * Released under the MIT license.
  3476. * http://jquery.org/license
  3477. */
  3478. //>>label: Accordion
  3479. //>>group: Widgets
  3480. /* eslint-disable max-len */
  3481. //>>description: Displays collapsible content panels for presenting information in a limited amount of space.
  3482. /* eslint-enable max-len */
  3483. //>>docs: http://api.jqueryui.com/accordion/
  3484. //>>demos: http://jqueryui.com/accordion/
  3485. //>>css.structure: ../../themes/base/core.css
  3486. //>>css.structure: ../../themes/base/accordion.css
  3487. //>>css.theme: ../../themes/base/theme.css
  3488. var widgetsAccordion = $.widget("ui.accordion", {
  3489. version: "1.13.0",
  3490. options: {
  3491. active: 0,
  3492. animate: {},
  3493. classes: {
  3494. "ui-accordion-header": "ui-corner-top",
  3495. "ui-accordion-header-collapsed": "ui-corner-all",
  3496. "ui-accordion-content": "ui-corner-bottom"
  3497. },
  3498. collapsible: false,
  3499. event: "click",
  3500. header: function (elem) {
  3501. return elem.find("> li > :first-child").add(elem.find("> :not(li)").even());
  3502. },
  3503. heightStyle: "auto",
  3504. icons: {
  3505. activeHeader: "ui-icon-triangle-1-s",
  3506. header: "ui-icon-triangle-1-e"
  3507. },
  3508. // Callbacks
  3509. activate: null,
  3510. beforeActivate: null
  3511. },
  3512. hideProps: {
  3513. borderTopWidth: "hide",
  3514. borderBottomWidth: "hide",
  3515. paddingTop: "hide",
  3516. paddingBottom: "hide",
  3517. height: "hide"
  3518. },
  3519. showProps: {
  3520. borderTopWidth: "show",
  3521. borderBottomWidth: "show",
  3522. paddingTop: "show",
  3523. paddingBottom: "show",
  3524. height: "show"
  3525. },
  3526. _create: function () {
  3527. var options = this.options;
  3528. this.prevShow = this.prevHide = $();
  3529. this._addClass("ui-accordion", "ui-widget ui-helper-reset");
  3530. this.element.attr("role", "tablist");
  3531. // Don't allow collapsible: false and active: false / null
  3532. if (!options.collapsible && (options.active === false || options.active == null)) {
  3533. options.active = 0;
  3534. }
  3535. this._processPanels();
  3536. // handle negative values
  3537. if (options.active < 0) {
  3538. options.active += this.headers.length;
  3539. }
  3540. this._refresh();
  3541. },
  3542. _getCreateEventData: function () {
  3543. return {
  3544. header: this.active,
  3545. panel: !this.active.length ? $() : this.active.next()
  3546. };
  3547. },
  3548. _createIcons: function () {
  3549. var icon, children, icons = this.options.icons;
  3550. if (icons) {
  3551. icon = $("<span>");
  3552. this._addClass(icon, "ui-accordion-header-icon", "ui-icon " + icons.header);
  3553. icon.prependTo(this.headers);
  3554. children = this.active.children(".ui-accordion-header-icon");
  3555. this._removeClass(children, icons.header)._addClass(children, null, icons.activeHeader)._addClass(this.headers, "ui-accordion-icons");
  3556. }
  3557. },
  3558. _destroyIcons: function () {
  3559. this._removeClass(this.headers, "ui-accordion-icons");
  3560. this.headers.children(".ui-accordion-header-icon").remove();
  3561. },
  3562. _destroy: function () {
  3563. var contents;
  3564. // Clean up main element
  3565. this.element.removeAttr("role");
  3566. // Clean up headers
  3567. this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId();
  3568. this._destroyIcons();
  3569. // Clean up content panels
  3570. contents = this.headers.next().css("display", "").removeAttr("role aria-hidden aria-labelledby").removeUniqueId();
  3571. if (this.options.heightStyle !== "content") {
  3572. contents.css("height", "");
  3573. }
  3574. },
  3575. _setOption: function (key, value) {
  3576. if (key === "active") {
  3577. // _activate() will handle invalid values and update this.options
  3578. this._activate(value);
  3579. return;
  3580. }
  3581. if (key === "event") {
  3582. if (this.options.event) {
  3583. this._off(this.headers, this.options.event);
  3584. }
  3585. this._setupEvents(value);
  3586. }
  3587. this._super(key, value);
  3588. // Setting collapsible: false while collapsed; open first panel
  3589. if (key === "collapsible" && !value && this.options.active === false) {
  3590. this._activate(0);
  3591. }
  3592. if (key === "icons") {
  3593. this._destroyIcons();
  3594. if (value) {
  3595. this._createIcons();
  3596. }
  3597. }
  3598. },
  3599. _setOptionDisabled: function (value) {
  3600. this._super(value);
  3601. this.element.attr("aria-disabled", value);
  3602. // Support: IE8 Only
  3603. // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE
  3604. // so we need to add the disabled class to the headers and panels
  3605. this._toggleClass(null, "ui-state-disabled", !!value);
  3606. this._toggleClass(this.headers.add(this.headers.next()), null, "ui-state-disabled", !!value);
  3607. },
  3608. _keydown: function (event) {
  3609. if (event.altKey || event.ctrlKey) {
  3610. return;
  3611. }
  3612. var keyCode = $.ui.keyCode
  3613. , length = this.headers.length
  3614. , currentIndex = this.headers.index(event.target)
  3615. , toFocus = false;
  3616. switch (event.keyCode) {
  3617. case keyCode.RIGHT:
  3618. case keyCode.DOWN:
  3619. toFocus = this.headers[(currentIndex + 1) % length];
  3620. break;
  3621. case keyCode.LEFT:
  3622. case keyCode.UP:
  3623. toFocus = this.headers[(currentIndex - 1 + length) % length];
  3624. break;
  3625. case keyCode.SPACE:
  3626. case keyCode.ENTER:
  3627. this._eventHandler(event);
  3628. break;
  3629. case keyCode.HOME:
  3630. toFocus = this.headers[0];
  3631. break;
  3632. case keyCode.END:
  3633. toFocus = this.headers[length - 1];
  3634. break;
  3635. }
  3636. if (toFocus) {
  3637. $(event.target).attr("tabIndex", -1);
  3638. $(toFocus).attr("tabIndex", 0);
  3639. $(toFocus).trigger("focus");
  3640. event.preventDefault();
  3641. }
  3642. },
  3643. _panelKeyDown: function (event) {
  3644. if (event.keyCode === $.ui.keyCode.UP && event.ctrlKey) {
  3645. $(event.currentTarget).prev().trigger("focus");
  3646. }
  3647. },
  3648. refresh: function () {
  3649. var options = this.options;
  3650. this._processPanels();
  3651. // Was collapsed or no panel
  3652. if ((options.active === false && options.collapsible === true) || !this.headers.length) {
  3653. options.active = false;
  3654. this.active = $();
  3655. // active false only when collapsible is true
  3656. } else if (options.active === false) {
  3657. this._activate(0);
  3658. // was active, but active panel is gone
  3659. } else if (this.active.length && !$.contains(this.element[0], this.active[0])) {
  3660. // all remaining panel are disabled
  3661. if (this.headers.length === this.headers.find(".ui-state-disabled").length) {
  3662. options.active = false;
  3663. this.active = $();
  3664. // activate previous panel
  3665. } else {
  3666. this._activate(Math.max(0, options.active - 1));
  3667. }
  3668. // was active, active panel still exists
  3669. } else {
  3670. // make sure active index is correct
  3671. options.active = this.headers.index(this.active);
  3672. }
  3673. this._destroyIcons();
  3674. this._refresh();
  3675. },
  3676. _processPanels: function () {
  3677. var prevHeaders = this.headers
  3678. , prevPanels = this.panels;
  3679. if (typeof this.options.header === "function") {
  3680. this.headers = this.options.header(this.element);
  3681. } else {
  3682. this.headers = this.element.find(this.options.header);
  3683. }
  3684. this._addClass(this.headers, "ui-accordion-header ui-accordion-header-collapsed", "ui-state-default");
  3685. this.panels = this.headers.next().filter(":not(.ui-accordion-content-active)").hide();
  3686. this._addClass(this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content");
  3687. // Avoid memory leaks (#10056)
  3688. if (prevPanels) {
  3689. this._off(prevHeaders.not(this.headers));
  3690. this._off(prevPanels.not(this.panels));
  3691. }
  3692. },
  3693. _refresh: function () {
  3694. var maxHeight, options = this.options, heightStyle = options.heightStyle, parent = this.element.parent();
  3695. this.active = this._findActive(options.active);
  3696. this._addClass(this.active, "ui-accordion-header-active", "ui-state-active")._removeClass(this.active, "ui-accordion-header-collapsed");
  3697. this._addClass(this.active.next(), "ui-accordion-content-active");
  3698. this.active.next().show();
  3699. this.headers.attr("role", "tab").each(function () {
  3700. var header = $(this)
  3701. , headerId = header.uniqueId().attr("id")
  3702. , panel = header.next()
  3703. , panelId = panel.uniqueId().attr("id");
  3704. header.attr("aria-controls", panelId);
  3705. panel.attr("aria-labelledby", headerId);
  3706. }).next().attr("role", "tabpanel");
  3707. this.headers.not(this.active).attr({
  3708. "aria-selected": "false",
  3709. "aria-expanded": "false",
  3710. tabIndex: -1
  3711. }).next().attr({
  3712. "aria-hidden": "true"
  3713. }).hide();
  3714. // Make sure at least one header is in the tab order
  3715. if (!this.active.length) {
  3716. this.headers.eq(0).attr("tabIndex", 0);
  3717. } else {
  3718. this.active.attr({
  3719. "aria-selected": "true",
  3720. "aria-expanded": "true",
  3721. tabIndex: 0
  3722. }).next().attr({
  3723. "aria-hidden": "false"
  3724. });
  3725. }
  3726. this._createIcons();
  3727. this._setupEvents(options.event);
  3728. if (heightStyle === "fill") {
  3729. maxHeight = parent.height();
  3730. this.element.siblings(":visible").each(function () {
  3731. var elem = $(this)
  3732. , position = elem.css("position");
  3733. if (position === "absolute" || position === "fixed") {
  3734. return;
  3735. }
  3736. maxHeight -= elem.outerHeight(true);
  3737. });
  3738. this.headers.each(function () {
  3739. maxHeight -= $(this).outerHeight(true);
  3740. });
  3741. this.headers.next().each(function () {
  3742. $(this).height(Math.max(0, maxHeight - $(this).innerHeight() + $(this).height()));
  3743. }).css("overflow", "auto");
  3744. } else if (heightStyle === "auto") {
  3745. maxHeight = 0;
  3746. this.headers.next().each(function () {
  3747. var isVisible = $(this).is(":visible");
  3748. if (!isVisible) {
  3749. $(this).show();
  3750. }
  3751. maxHeight = Math.max(maxHeight, $(this).css("height", "").height());
  3752. if (!isVisible) {
  3753. $(this).hide();
  3754. }
  3755. }).height(maxHeight);
  3756. }
  3757. },
  3758. _activate: function (index) {
  3759. var active = this._findActive(index)[0];
  3760. // Trying to activate the already active panel
  3761. if (active === this.active[0]) {
  3762. return;
  3763. }
  3764. // Trying to collapse, simulate a click on the currently active header
  3765. active = active || this.active[0];
  3766. this._eventHandler({
  3767. target: active,
  3768. currentTarget: active,
  3769. preventDefault: $.noop
  3770. });
  3771. },
  3772. _findActive: function (selector) {
  3773. return typeof selector === "number" ? this.headers.eq(selector) : $();
  3774. },
  3775. _setupEvents: function (event) {
  3776. var events = {
  3777. keydown: "_keydown"
  3778. };
  3779. if (event) {
  3780. $.each(event.split(" "), function (index, eventName) {
  3781. events[eventName] = "_eventHandler";
  3782. });
  3783. }
  3784. this._off(this.headers.add(this.headers.next()));
  3785. this._on(this.headers, events);
  3786. this._on(this.headers.next(), {
  3787. keydown: "_panelKeyDown"
  3788. });
  3789. this._hoverable(this.headers);
  3790. this._focusable(this.headers);
  3791. },
  3792. _eventHandler: function (event) {
  3793. var activeChildren, clickedChildren, options = this.options, active = this.active,
  3794. clicked = $(event.currentTarget), clickedIsActive = clicked[0] === active[0],
  3795. collapsing = clickedIsActive && options.collapsible, toShow = collapsing ? $() : clicked.next(),
  3796. toHide = active.next(), eventData = {
  3797. oldHeader: active,
  3798. oldPanel: toHide,
  3799. newHeader: collapsing ? $() : clicked,
  3800. newPanel: toShow
  3801. };
  3802. event.preventDefault();
  3803. if (
  3804. // click on active header, but not collapsible
  3805. (clickedIsActive && !options.collapsible) ||
  3806. // allow canceling activation
  3807. (this._trigger("beforeActivate", event, eventData) === false)) {
  3808. return;
  3809. }
  3810. options.active = collapsing ? false : this.headers.index(clicked);
  3811. // When the call to ._toggle() comes after the class changes
  3812. // it causes a very odd bug in IE 8 (see #6720)
  3813. this.active = clickedIsActive ? $() : clicked;
  3814. this._toggle(eventData);
  3815. // Switch classes
  3816. // corner classes on the previously active header stay after the animation
  3817. this._removeClass(active, "ui-accordion-header-active", "ui-state-active");
  3818. if (options.icons) {
  3819. activeChildren = active.children(".ui-accordion-header-icon");
  3820. this._removeClass(activeChildren, null, options.icons.activeHeader)._addClass(activeChildren, null, options.icons.header);
  3821. }
  3822. if (!clickedIsActive) {
  3823. this._removeClass(clicked, "ui-accordion-header-collapsed")._addClass(clicked, "ui-accordion-header-active", "ui-state-active");
  3824. if (options.icons) {
  3825. clickedChildren = clicked.children(".ui-accordion-header-icon");
  3826. this._removeClass(clickedChildren, null, options.icons.header)._addClass(clickedChildren, null, options.icons.activeHeader);
  3827. }
  3828. this._addClass(clicked.next(), "ui-accordion-content-active");
  3829. }
  3830. },
  3831. _toggle: function (data) {
  3832. var toShow = data.newPanel
  3833. , toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
  3834. // Handle activating a panel during the animation for another activation
  3835. this.prevShow.add(this.prevHide).stop(true, true);
  3836. this.prevShow = toShow;
  3837. this.prevHide = toHide;
  3838. if (this.options.animate) {
  3839. this._animate(toShow, toHide, data);
  3840. } else {
  3841. toHide.hide();
  3842. toShow.show();
  3843. this._toggleComplete(data);
  3844. }
  3845. toHide.attr({
  3846. "aria-hidden": "true"
  3847. });
  3848. toHide.prev().attr({
  3849. "aria-selected": "false",
  3850. "aria-expanded": "false"
  3851. });
  3852. // if we're switching panels, remove the old header from the tab order
  3853. // if we're opening from collapsed state, remove the previous header from the tab order
  3854. // if we're collapsing, then keep the collapsing header in the tab order
  3855. if (toShow.length && toHide.length) {
  3856. toHide.prev().attr({
  3857. "tabIndex": -1,
  3858. "aria-expanded": "false"
  3859. });
  3860. } else if (toShow.length) {
  3861. this.headers.filter(function () {
  3862. return parseInt($(this).attr("tabIndex"), 10) === 0;
  3863. }).attr("tabIndex", -1);
  3864. }
  3865. toShow.attr("aria-hidden", "false").prev().attr({
  3866. "aria-selected": "true",
  3867. "aria-expanded": "true",
  3868. tabIndex: 0
  3869. });
  3870. },
  3871. _animate: function (toShow, toHide, data) {
  3872. var total, easing, duration, that = this, adjust = 0, boxSizing = toShow.css("box-sizing"),
  3873. down = toShow.length && (!toHide.length || (toShow.index() < toHide.index())),
  3874. animate = this.options.animate || {}, options = down && animate.down || animate,
  3875. complete = function () {
  3876. that._toggleComplete(data);
  3877. };
  3878. if (typeof options === "number") {
  3879. duration = options;
  3880. }
  3881. if (typeof options === "string") {
  3882. easing = options;
  3883. }
  3884. // fall back from options to animation in case of partial down settings
  3885. easing = easing || options.easing || animate.easing;
  3886. duration = duration || options.duration || animate.duration;
  3887. if (!toHide.length) {
  3888. return toShow.animate(this.showProps, duration, easing, complete);
  3889. }
  3890. if (!toShow.length) {
  3891. return toHide.animate(this.hideProps, duration, easing, complete);
  3892. }
  3893. total = toShow.show().outerHeight();
  3894. toHide.animate(this.hideProps, {
  3895. duration: duration,
  3896. easing: easing,
  3897. step: function (now, fx) {
  3898. fx.now = Math.round(now);
  3899. }
  3900. });
  3901. toShow.hide().animate(this.showProps, {
  3902. duration: duration,
  3903. easing: easing,
  3904. complete: complete,
  3905. step: function (now, fx) {
  3906. fx.now = Math.round(now);
  3907. if (fx.prop !== "height") {
  3908. if (boxSizing === "content-box") {
  3909. adjust += fx.now;
  3910. }
  3911. } else if (that.options.heightStyle !== "content") {
  3912. fx.now = Math.round(total - toHide.outerHeight() - adjust);
  3913. adjust = 0;
  3914. }
  3915. }
  3916. });
  3917. },
  3918. _toggleComplete: function (data) {
  3919. var toHide = data.oldPanel
  3920. , prev = toHide.prev();
  3921. this._removeClass(toHide, "ui-accordion-content-active");
  3922. this._removeClass(prev, "ui-accordion-header-active")._addClass(prev, "ui-accordion-header-collapsed");
  3923. // Work around for rendering bug in IE (#5421)
  3924. if (toHide.length) {
  3925. toHide.parent()[0].className = toHide.parent()[0].className;
  3926. }
  3927. this._trigger("activate", null, data);
  3928. }
  3929. });
  3930. var safeActiveElement = $.ui.safeActiveElement = function (document) {
  3931. var activeElement;
  3932. // Support: IE 9 only
  3933. // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
  3934. try {
  3935. activeElement = document.activeElement;
  3936. } catch (error) {
  3937. activeElement = document.body;
  3938. }
  3939. // Support: IE 9 - 11 only
  3940. // IE may return null instead of an element
  3941. // Interestingly, this only seems to occur when NOT in an iframe
  3942. if (!activeElement) {
  3943. activeElement = document.body;
  3944. }
  3945. // Support: IE 11 only
  3946. // IE11 returns a seemingly empty object in some cases when accessing
  3947. // document.activeElement from an <iframe>
  3948. if (!activeElement.nodeName) {
  3949. activeElement = document.body;
  3950. }
  3951. return activeElement;
  3952. }
  3953. ;
  3954. /*!
  3955. * jQuery UI Menu 1.13.0
  3956. * http://jqueryui.com
  3957. *
  3958. * Copyright jQuery Foundation and other contributors
  3959. * Released under the MIT license.
  3960. * http://jquery.org/license
  3961. */
  3962. //>>label: Menu
  3963. //>>group: Widgets
  3964. //>>description: Creates nestable menus.
  3965. //>>docs: http://api.jqueryui.com/menu/
  3966. //>>demos: http://jqueryui.com/menu/
  3967. //>>css.structure: ../../themes/base/core.css
  3968. //>>css.structure: ../../themes/base/menu.css
  3969. //>>css.theme: ../../themes/base/theme.css
  3970. var widgetsMenu = $.widget("ui.menu", {
  3971. version: "1.13.0",
  3972. defaultElement: "<ul>",
  3973. delay: 300,
  3974. options: {
  3975. icons: {
  3976. submenu: "ui-icon-caret-1-e"
  3977. },
  3978. items: "> *",
  3979. menus: "ul",
  3980. position: {
  3981. my: "left top",
  3982. at: "right top"
  3983. },
  3984. role: "menu",
  3985. // Callbacks
  3986. blur: null,
  3987. focus: null,
  3988. select: null
  3989. },
  3990. _create: function () {
  3991. this.activeMenu = this.element;
  3992. // Flag used to prevent firing of the click handler
  3993. // as the event bubbles up through nested menus
  3994. this.mouseHandled = false;
  3995. this.lastMousePosition = {
  3996. x: null,
  3997. y: null
  3998. };
  3999. this.element.uniqueId().attr({
  4000. role: this.options.role,
  4001. tabIndex: 0
  4002. });
  4003. this._addClass("ui-menu", "ui-widget ui-widget-content");
  4004. this._on({
  4005. // Prevent focus from sticking to links inside menu after clicking
  4006. // them (focus should always stay on UL during navigation).
  4007. "mousedown .ui-menu-item": function (event) {
  4008. event.preventDefault();
  4009. this._activateItem(event);
  4010. },
  4011. "click .ui-menu-item": function (event) {
  4012. var target = $(event.target);
  4013. var active = $($.ui.safeActiveElement(this.document[0]));
  4014. if (!this.mouseHandled && target.not(".ui-state-disabled").length) {
  4015. this.select(event);
  4016. // Only set the mouseHandled flag if the event will bubble, see #9469.
  4017. if (!event.isPropagationStopped()) {
  4018. this.mouseHandled = true;
  4019. }
  4020. // Open submenu on click
  4021. if (target.has(".ui-menu").length) {
  4022. this.expand(event);
  4023. } else if (!this.element.is(":focus") && active.closest(".ui-menu").length) {
  4024. // Redirect focus to the menu
  4025. this.element.trigger("focus", [true]);
  4026. // If the active item is on the top level, let it stay active.
  4027. // Otherwise, blur the active item since it is no longer visible.
  4028. if (this.active && this.active.parents(".ui-menu").length === 1) {
  4029. clearTimeout(this.timer);
  4030. }
  4031. }
  4032. }
  4033. },
  4034. "mouseenter .ui-menu-item": "_activateItem",
  4035. "mousemove .ui-menu-item": "_activateItem",
  4036. mouseleave: "collapseAll",
  4037. "mouseleave .ui-menu": "collapseAll",
  4038. focus: function (event, keepActiveItem) {
  4039. // If there's already an active item, keep it active
  4040. // If not, activate the first item
  4041. var item = this.active || this._menuItems().first();
  4042. if (!keepActiveItem) {
  4043. this.focus(event, item);
  4044. }
  4045. },
  4046. blur: function (event) {
  4047. this._delay(function () {
  4048. var notContained = !$.contains(this.element[0], $.ui.safeActiveElement(this.document[0]));
  4049. if (notContained) {
  4050. this.collapseAll(event);
  4051. }
  4052. });
  4053. },
  4054. keydown: "_keydown"
  4055. });
  4056. this.refresh();
  4057. // Clicks outside of a menu collapse any open menus
  4058. this._on(this.document, {
  4059. click: function (event) {
  4060. if (this._closeOnDocumentClick(event)) {
  4061. this.collapseAll(event, true);
  4062. }
  4063. // Reset the mouseHandled flag
  4064. this.mouseHandled = false;
  4065. }
  4066. });
  4067. },
  4068. _activateItem: function (event) {
  4069. // Ignore mouse events while typeahead is active, see #10458.
  4070. // Prevents focusing the wrong item when typeahead causes a scroll while the mouse
  4071. // is over an item in the menu
  4072. if (this.previousFilter) {
  4073. return;
  4074. }
  4075. // If the mouse didn't actually move, but the page was scrolled, ignore the event (#9356)
  4076. if (event.clientX === this.lastMousePosition.x && event.clientY === this.lastMousePosition.y) {
  4077. return;
  4078. }
  4079. this.lastMousePosition = {
  4080. x: event.clientX,
  4081. y: event.clientY
  4082. };
  4083. var actualTarget = $(event.target).closest(".ui-menu-item")
  4084. , target = $(event.currentTarget);
  4085. // Ignore bubbled events on parent items, see #11641
  4086. if (actualTarget[0] !== target[0]) {
  4087. return;
  4088. }
  4089. // If the item is already active, there's nothing to do
  4090. if (target.is(".ui-state-active")) {
  4091. return;
  4092. }
  4093. // Remove ui-state-active class from siblings of the newly focused menu item
  4094. // to avoid a jump caused by adjacent elements both having a class with a border
  4095. this._removeClass(target.siblings().children(".ui-state-active"), null, "ui-state-active");
  4096. this.focus(event, target);
  4097. },
  4098. _destroy: function () {
  4099. var items = this.element.find(".ui-menu-item").removeAttr("role aria-disabled")
  4100. ,
  4101. submenus = items.children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");
  4102. // Destroy (sub)menus
  4103. this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled " + "tabIndex").removeUniqueId().show();
  4104. submenus.children().each(function () {
  4105. var elem = $(this);
  4106. if (elem.data("ui-menu-submenu-caret")) {
  4107. elem.remove();
  4108. }
  4109. });
  4110. },
  4111. _keydown: function (event) {
  4112. var match, prev, character, skip, preventDefault = true;
  4113. switch (event.keyCode) {
  4114. case $.ui.keyCode.PAGE_UP:
  4115. this.previousPage(event);
  4116. break;
  4117. case $.ui.keyCode.PAGE_DOWN:
  4118. this.nextPage(event);
  4119. break;
  4120. case $.ui.keyCode.HOME:
  4121. this._move("first", "first", event);
  4122. break;
  4123. case $.ui.keyCode.END:
  4124. this._move("last", "last", event);
  4125. break;
  4126. case $.ui.keyCode.UP:
  4127. this.previous(event);
  4128. break;
  4129. case $.ui.keyCode.DOWN:
  4130. this.next(event);
  4131. break;
  4132. case $.ui.keyCode.LEFT:
  4133. this.collapse(event);
  4134. break;
  4135. case $.ui.keyCode.RIGHT:
  4136. if (this.active && !this.active.is(".ui-state-disabled")) {
  4137. this.expand(event);
  4138. }
  4139. break;
  4140. case $.ui.keyCode.ENTER:
  4141. case $.ui.keyCode.SPACE:
  4142. this._activate(event);
  4143. break;
  4144. case $.ui.keyCode.ESCAPE:
  4145. this.collapse(event);
  4146. break;
  4147. default:
  4148. preventDefault = false;
  4149. prev = this.previousFilter || "";
  4150. skip = false;
  4151. // Support number pad values
  4152. character = event.keyCode >= 96 && event.keyCode <= 105 ? (event.keyCode - 96).toString() : String.fromCharCode(event.keyCode);
  4153. clearTimeout(this.filterTimer);
  4154. if (character === prev) {
  4155. skip = true;
  4156. } else {
  4157. character = prev + character;
  4158. }
  4159. match = this._filterMenuItems(character);
  4160. match = skip && match.index(this.active.next()) !== -1 ? this.active.nextAll(".ui-menu-item") : match;
  4161. // If no matches on the current filter, reset to the last character pressed
  4162. // to move down the menu to the first item that starts with that character
  4163. if (!match.length) {
  4164. character = String.fromCharCode(event.keyCode);
  4165. match = this._filterMenuItems(character);
  4166. }
  4167. if (match.length) {
  4168. this.focus(event, match);
  4169. this.previousFilter = character;
  4170. this.filterTimer = this._delay(function () {
  4171. delete this.previousFilter;
  4172. }, 1000);
  4173. } else {
  4174. delete this.previousFilter;
  4175. }
  4176. }
  4177. if (preventDefault) {
  4178. event.preventDefault();
  4179. }
  4180. },
  4181. _activate: function (event) {
  4182. if (this.active && !this.active.is(".ui-state-disabled")) {
  4183. if (this.active.children("[aria-haspopup='true']").length) {
  4184. this.expand(event);
  4185. } else {
  4186. this.select(event);
  4187. }
  4188. }
  4189. },
  4190. refresh: function () {
  4191. var menus, items, newSubmenus, newItems, newWrappers, that = this, icon = this.options.icons.submenu,
  4192. submenus = this.element.find(this.options.menus);
  4193. this._toggleClass("ui-menu-icons", null, !!this.element.find(".ui-icon").length);
  4194. // Initialize nested menus
  4195. newSubmenus = submenus.filter(":not(.ui-menu)").hide().attr({
  4196. role: this.options.role,
  4197. "aria-hidden": "true",
  4198. "aria-expanded": "false"
  4199. }).each(function () {
  4200. var menu = $(this)
  4201. , item = menu.prev()
  4202. , submenuCaret = $("<span>").data("ui-menu-submenu-caret", true);
  4203. that._addClass(submenuCaret, "ui-menu-icon", "ui-icon " + icon);
  4204. item.attr("aria-haspopup", "true").prepend(submenuCaret);
  4205. menu.attr("aria-labelledby", item.attr("id"));
  4206. });
  4207. this._addClass(newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front");
  4208. menus = submenus.add(this.element);
  4209. items = menus.find(this.options.items);
  4210. // Initialize menu-items containing spaces and/or dashes only as dividers
  4211. items.not(".ui-menu-item").each(function () {
  4212. var item = $(this);
  4213. if (that._isDivider(item)) {
  4214. that._addClass(item, "ui-menu-divider", "ui-widget-content");
  4215. }
  4216. });
  4217. // Don't refresh list items that are already adapted
  4218. newItems = items.not(".ui-menu-item, .ui-menu-divider");
  4219. newWrappers = newItems.children().not(".ui-menu").uniqueId().attr({
  4220. tabIndex: -1,
  4221. role: this._itemRole()
  4222. });
  4223. this._addClass(newItems, "ui-menu-item")._addClass(newWrappers, "ui-menu-item-wrapper");
  4224. // Add aria-disabled attribute to any disabled menu item
  4225. items.filter(".ui-state-disabled").attr("aria-disabled", "true");
  4226. // If the active item has been removed, blur the menu
  4227. if (this.active && !$.contains(this.element[0], this.active[0])) {
  4228. this.blur();
  4229. }
  4230. },
  4231. _itemRole: function () {
  4232. return {
  4233. menu: "menuitem",
  4234. listbox: "option"
  4235. }[this.options.role];
  4236. },
  4237. _setOption: function (key, value) {
  4238. if (key === "icons") {
  4239. var icons = this.element.find(".ui-menu-icon");
  4240. this._removeClass(icons, null, this.options.icons.submenu)._addClass(icons, null, value.submenu);
  4241. }
  4242. this._super(key, value);
  4243. },
  4244. _setOptionDisabled: function (value) {
  4245. this._super(value);
  4246. this.element.attr("aria-disabled", String(value));
  4247. this._toggleClass(null, "ui-state-disabled", !!value);
  4248. },
  4249. focus: function (event, item) {
  4250. var nested, focused, activeParent;
  4251. this.blur(event, event && event.type === "focus");
  4252. this._scrollIntoView(item);
  4253. this.active = item.first();
  4254. focused = this.active.children(".ui-menu-item-wrapper");
  4255. this._addClass(focused, null, "ui-state-active");
  4256. // Only update aria-activedescendant if there's a role
  4257. // otherwise we assume focus is managed elsewhere
  4258. if (this.options.role) {
  4259. this.element.attr("aria-activedescendant", focused.attr("id"));
  4260. }
  4261. // Highlight active parent menu item, if any
  4262. activeParent = this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper");
  4263. this._addClass(activeParent, null, "ui-state-active");
  4264. if (event && event.type === "keydown") {
  4265. this._close();
  4266. } else {
  4267. this.timer = this._delay(function () {
  4268. this._close();
  4269. }, this.delay);
  4270. }
  4271. nested = item.children(".ui-menu");
  4272. if (nested.length && event && (/^mouse/.test(event.type))) {
  4273. this._startOpening(nested);
  4274. }
  4275. this.activeMenu = item.parent();
  4276. this._trigger("focus", event, {
  4277. item: item
  4278. });
  4279. },
  4280. _scrollIntoView: function (item) {
  4281. var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
  4282. if (this._hasScroll()) {
  4283. borderTop = parseFloat($.css(this.activeMenu[0], "borderTopWidth")) || 0;
  4284. paddingTop = parseFloat($.css(this.activeMenu[0], "paddingTop")) || 0;
  4285. offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
  4286. scroll = this.activeMenu.scrollTop();
  4287. elementHeight = this.activeMenu.height();
  4288. itemHeight = item.outerHeight();
  4289. if (offset < 0) {
  4290. this.activeMenu.scrollTop(scroll + offset);
  4291. } else if (offset + itemHeight > elementHeight) {
  4292. this.activeMenu.scrollTop(scroll + offset - elementHeight + itemHeight);
  4293. }
  4294. }
  4295. },
  4296. blur: function (event, fromFocus) {
  4297. if (!fromFocus) {
  4298. clearTimeout(this.timer);
  4299. }
  4300. if (!this.active) {
  4301. return;
  4302. }
  4303. this._removeClass(this.active.children(".ui-menu-item-wrapper"), null, "ui-state-active");
  4304. this._trigger("blur", event, {
  4305. item: this.active
  4306. });
  4307. this.active = null;
  4308. },
  4309. _startOpening: function (submenu) {
  4310. clearTimeout(this.timer);
  4311. // Don't open if already open fixes a Firefox bug that caused a .5 pixel
  4312. // shift in the submenu position when mousing over the caret icon
  4313. if (submenu.attr("aria-hidden") !== "true") {
  4314. return;
  4315. }
  4316. this.timer = this._delay(function () {
  4317. this._close();
  4318. this._open(submenu);
  4319. }, this.delay);
  4320. },
  4321. _open: function (submenu) {
  4322. var position = $.extend({
  4323. of: this.active
  4324. }, this.options.position);
  4325. clearTimeout(this.timer);
  4326. this.element.find(".ui-menu").not(submenu.parents(".ui-menu")).hide().attr("aria-hidden", "true");
  4327. submenu.show().removeAttr("aria-hidden").attr("aria-expanded", "true").position(position);
  4328. },
  4329. collapseAll: function (event, all) {
  4330. clearTimeout(this.timer);
  4331. this.timer = this._delay(function () {
  4332. // If we were passed an event, look for the submenu that contains the event
  4333. var currentMenu = all ? this.element : $(event && event.target).closest(this.element.find(".ui-menu"));
  4334. // If we found no valid submenu ancestor, use the main menu to close all
  4335. // sub menus anyway
  4336. if (!currentMenu.length) {
  4337. currentMenu = this.element;
  4338. }
  4339. this._close(currentMenu);
  4340. this.blur(event);
  4341. // Work around active item staying active after menu is blurred
  4342. this._removeClass(currentMenu.find(".ui-state-active"), null, "ui-state-active");
  4343. this.activeMenu = currentMenu;
  4344. }, all ? 0 : this.delay);
  4345. },
  4346. // With no arguments, closes the currently active menu - if nothing is active
  4347. // it closes all menus. If passed an argument, it will search for menus BELOW
  4348. _close: function (startMenu) {
  4349. if (!startMenu) {
  4350. startMenu = this.active ? this.active.parent() : this.element;
  4351. }
  4352. startMenu.find(".ui-menu").hide().attr("aria-hidden", "true").attr("aria-expanded", "false");
  4353. },
  4354. _closeOnDocumentClick: function (event) {
  4355. return !$(event.target).closest(".ui-menu").length;
  4356. },
  4357. _isDivider: function (item) {
  4358. // Match hyphen, em dash, en dash
  4359. return !/[^\-\u2014\u2013\s]/.test(item.text());
  4360. },
  4361. collapse: function (event) {
  4362. var newItem = this.active && this.active.parent().closest(".ui-menu-item", this.element);
  4363. if (newItem && newItem.length) {
  4364. this._close();
  4365. this.focus(event, newItem);
  4366. }
  4367. },
  4368. expand: function (event) {
  4369. var newItem = this.active && this._menuItems(this.active.children(".ui-menu")).first();
  4370. if (newItem && newItem.length) {
  4371. this._open(newItem.parent());
  4372. // Delay so Firefox will not hide activedescendant change in expanding submenu from AT
  4373. this._delay(function () {
  4374. this.focus(event, newItem);
  4375. });
  4376. }
  4377. },
  4378. next: function (event) {
  4379. this._move("next", "first", event);
  4380. },
  4381. previous: function (event) {
  4382. this._move("prev", "last", event);
  4383. },
  4384. isFirstItem: function () {
  4385. return this.active && !this.active.prevAll(".ui-menu-item").length;
  4386. },
  4387. isLastItem: function () {
  4388. return this.active && !this.active.nextAll(".ui-menu-item").length;
  4389. },
  4390. _menuItems: function (menu) {
  4391. return (menu || this.element).find(this.options.items).filter(".ui-menu-item");
  4392. },
  4393. _move: function (direction, filter, event) {
  4394. var next;
  4395. if (this.active) {
  4396. if (direction === "first" || direction === "last") {
  4397. next = this.active[direction === "first" ? "prevAll" : "nextAll"](".ui-menu-item").last();
  4398. } else {
  4399. next = this.active[direction + "All"](".ui-menu-item").first();
  4400. }
  4401. }
  4402. if (!next || !next.length || !this.active) {
  4403. next = this._menuItems(this.activeMenu)[filter]();
  4404. }
  4405. this.focus(event, next);
  4406. },
  4407. nextPage: function (event) {
  4408. var item, base, height;
  4409. if (!this.active) {
  4410. this.next(event);
  4411. return;
  4412. }
  4413. if (this.isLastItem()) {
  4414. return;
  4415. }
  4416. if (this._hasScroll()) {
  4417. base = this.active.offset().top;
  4418. height = this.element.innerHeight();
  4419. // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back.
  4420. if ($.fn.jquery.indexOf("3.2.") === 0) {
  4421. height += this.element[0].offsetHeight - this.element.outerHeight();
  4422. }
  4423. this.active.nextAll(".ui-menu-item").each(function () {
  4424. item = $(this);
  4425. return item.offset().top - base - height < 0;
  4426. });
  4427. this.focus(event, item);
  4428. } else {
  4429. this.focus(event, this._menuItems(this.activeMenu)[!this.active ? "first" : "last"]());
  4430. }
  4431. },
  4432. previousPage: function (event) {
  4433. var item, base, height;
  4434. if (!this.active) {
  4435. this.next(event);
  4436. return;
  4437. }
  4438. if (this.isFirstItem()) {
  4439. return;
  4440. }
  4441. if (this._hasScroll()) {
  4442. base = this.active.offset().top;
  4443. height = this.element.innerHeight();
  4444. // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back.
  4445. if ($.fn.jquery.indexOf("3.2.") === 0) {
  4446. height += this.element[0].offsetHeight - this.element.outerHeight();
  4447. }
  4448. this.active.prevAll(".ui-menu-item").each(function () {
  4449. item = $(this);
  4450. return item.offset().top - base + height > 0;
  4451. });
  4452. this.focus(event, item);
  4453. } else {
  4454. this.focus(event, this._menuItems(this.activeMenu).first());
  4455. }
  4456. },
  4457. _hasScroll: function () {
  4458. return this.element.outerHeight() < this.element.prop("scrollHeight");
  4459. },
  4460. select: function (event) {
  4461. // TODO: It should never be possible to not have an active item at this
  4462. // point, but the tests don't trigger mouseenter before click.
  4463. this.active = this.active || $(event.target).closest(".ui-menu-item");
  4464. var ui = {
  4465. item: this.active
  4466. };
  4467. if (!this.active.has(".ui-menu").length) {
  4468. this.collapseAll(event, true);
  4469. }
  4470. this._trigger("select", event, ui);
  4471. },
  4472. _filterMenuItems: function (character) {
  4473. var escapedCharacter = character.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&")
  4474. , regex = new RegExp("^" + escapedCharacter, "i");
  4475. return this.activeMenu.find(this.options.items)
  4476. // Only match on items, not dividers or other content (#10571)
  4477. .filter(".ui-menu-item").filter(function () {
  4478. return regex.test(String.prototype.trim.call($(this).children(".ui-menu-item-wrapper").text()));
  4479. });
  4480. }
  4481. });
  4482. /*!
  4483. * jQuery UI Autocomplete 1.13.0
  4484. * http://jqueryui.com
  4485. *
  4486. * Copyright jQuery Foundation and other contributors
  4487. * Released under the MIT license.
  4488. * http://jquery.org/license
  4489. */
  4490. //>>label: Autocomplete
  4491. //>>group: Widgets
  4492. //>>description: Lists suggested words as the user is typing.
  4493. //>>docs: http://api.jqueryui.com/autocomplete/
  4494. //>>demos: http://jqueryui.com/autocomplete/
  4495. //>>css.structure: ../../themes/base/core.css
  4496. //>>css.structure: ../../themes/base/autocomplete.css
  4497. //>>css.theme: ../../themes/base/theme.css
  4498. $.widget("ui.autocomplete", {
  4499. version: "1.13.0",
  4500. defaultElement: "<input>",
  4501. options: {
  4502. appendTo: null,
  4503. autoFocus: false,
  4504. delay: 300,
  4505. minLength: 1,
  4506. position: {
  4507. my: "left top",
  4508. at: "left bottom",
  4509. collision: "none"
  4510. },
  4511. source: null,
  4512. // Callbacks
  4513. change: null,
  4514. close: null,
  4515. focus: null,
  4516. open: null,
  4517. response: null,
  4518. search: null,
  4519. select: null
  4520. },
  4521. requestIndex: 0,
  4522. pending: 0,
  4523. _create: function () {
  4524. // Some browsers only repeat keydown events, not keypress events,
  4525. // so we use the suppressKeyPress flag to determine if we've already
  4526. // handled the keydown event. #7269
  4527. // Unfortunately the code for & in keypress is the same as the up arrow,
  4528. // so we use the suppressKeyPressRepeat flag to avoid handling keypress
  4529. // events when we know the keydown event was used to modify the
  4530. // search term. #7799
  4531. var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
  4532. nodeName = this.element[0].nodeName.toLowerCase(), isTextarea = nodeName === "textarea",
  4533. isInput = nodeName === "input";
  4534. // Textareas are always multi-line
  4535. // Inputs are always single-line, even if inside a contentEditable element
  4536. // IE also treats inputs as contentEditable
  4537. // All other element types are determined by whether or not they're contentEditable
  4538. this.isMultiLine = isTextarea || !isInput && this._isContentEditable(this.element);
  4539. this.valueMethod = this.element[isTextarea || isInput ? "val" : "text"];
  4540. this.isNewMenu = true;
  4541. this._addClass("ui-autocomplete-input");
  4542. this.element.attr("autocomplete", "off");
  4543. this._on(this.element, {
  4544. keydown: function (event) {
  4545. if (this.element.prop("readOnly")) {
  4546. suppressKeyPress = true;
  4547. suppressInput = true;
  4548. suppressKeyPressRepeat = true;
  4549. return;
  4550. }
  4551. suppressKeyPress = false;
  4552. suppressInput = false;
  4553. suppressKeyPressRepeat = false;
  4554. var keyCode = $.ui.keyCode;
  4555. switch (event.keyCode) {
  4556. case keyCode.PAGE_UP:
  4557. suppressKeyPress = true;
  4558. this._move("previousPage", event);
  4559. break;
  4560. case keyCode.PAGE_DOWN:
  4561. suppressKeyPress = true;
  4562. this._move("nextPage", event);
  4563. break;
  4564. case keyCode.UP:
  4565. suppressKeyPress = true;
  4566. this._keyEvent("previous", event);
  4567. break;
  4568. case keyCode.DOWN:
  4569. suppressKeyPress = true;
  4570. this._keyEvent("next", event);
  4571. break;
  4572. case keyCode.ENTER:
  4573. // when menu is open and has focus
  4574. if (this.menu.active) {
  4575. // #6055 - Opera still allows the keypress to occur
  4576. // which causes forms to submit
  4577. suppressKeyPress = true;
  4578. event.preventDefault();
  4579. this.menu.select(event);
  4580. }
  4581. break;
  4582. case keyCode.TAB:
  4583. if (this.menu.active) {
  4584. this.menu.select(event);
  4585. }
  4586. break;
  4587. case keyCode.ESCAPE:
  4588. if (this.menu.element.is(":visible")) {
  4589. if (!this.isMultiLine) {
  4590. this._value(this.term);
  4591. }
  4592. this.close(event);
  4593. // Different browsers have different default behavior for escape
  4594. // Single press can mean undo or clear
  4595. // Double press in IE means clear the whole form
  4596. event.preventDefault();
  4597. }
  4598. break;
  4599. default:
  4600. suppressKeyPressRepeat = true;
  4601. // search timeout should be triggered before the input value is changed
  4602. this._searchTimeout(event);
  4603. break;
  4604. }
  4605. },
  4606. keypress: function (event) {
  4607. if (suppressKeyPress) {
  4608. suppressKeyPress = false;
  4609. if (!this.isMultiLine || this.menu.element.is(":visible")) {
  4610. event.preventDefault();
  4611. }
  4612. return;
  4613. }
  4614. if (suppressKeyPressRepeat) {
  4615. return;
  4616. }
  4617. // Replicate some key handlers to allow them to repeat in Firefox and Opera
  4618. var keyCode = $.ui.keyCode;
  4619. switch (event.keyCode) {
  4620. case keyCode.PAGE_UP:
  4621. this._move("previousPage", event);
  4622. break;
  4623. case keyCode.PAGE_DOWN:
  4624. this._move("nextPage", event);
  4625. break;
  4626. case keyCode.UP:
  4627. this._keyEvent("previous", event);
  4628. break;
  4629. case keyCode.DOWN:
  4630. this._keyEvent("next", event);
  4631. break;
  4632. }
  4633. },
  4634. input: function (event) {
  4635. if (suppressInput) {
  4636. suppressInput = false;
  4637. event.preventDefault();
  4638. return;
  4639. }
  4640. this._searchTimeout(event);
  4641. },
  4642. focus: function () {
  4643. this.selectedItem = null;
  4644. this.previous = this._value();
  4645. },
  4646. blur: function (event) {
  4647. clearTimeout(this.searching);
  4648. this.close(event);
  4649. this._change(event);
  4650. }
  4651. });
  4652. this._initSource();
  4653. this.menu = $("<ul>").appendTo(this._appendTo()).menu({
  4654. // disable ARIA support, the live region takes care of that
  4655. role: null
  4656. }).hide()
  4657. // Support: IE 11 only, Edge <= 14
  4658. // For other browsers, we preventDefault() on the mousedown event
  4659. // to keep the dropdown from taking focus from the input. This doesn't
  4660. // work for IE/Edge, causing problems with selection and scrolling (#9638)
  4661. // Happily, IE and Edge support an "unselectable" attribute that
  4662. // prevents an element from receiving focus, exactly what we want here.
  4663. .attr({
  4664. "unselectable": "on"
  4665. }).menu("instance");
  4666. this._addClass(this.menu.element, "ui-autocomplete", "ui-front");
  4667. this._on(this.menu.element, {
  4668. mousedown: function (event) {
  4669. // Prevent moving focus out of the text field
  4670. event.preventDefault();
  4671. },
  4672. menufocus: function (event, ui) {
  4673. var label, item;
  4674. // support: Firefox
  4675. // Prevent accidental activation of menu items in Firefox (#7024 #9118)
  4676. if (this.isNewMenu) {
  4677. this.isNewMenu = false;
  4678. if (event.originalEvent && /^mouse/.test(event.originalEvent.type)) {
  4679. this.menu.blur();
  4680. this.document.one("mousemove", function () {
  4681. $(event.target).trigger(event.originalEvent);
  4682. });
  4683. return;
  4684. }
  4685. }
  4686. item = ui.item.data("ui-autocomplete-item");
  4687. if (false !== this._trigger("focus", event, {
  4688. item: item
  4689. })) {
  4690. // use value to match what will end up in the input, if it was a key event
  4691. if (event.originalEvent && /^key/.test(event.originalEvent.type)) {
  4692. this._value(item.value);
  4693. }
  4694. }
  4695. // Announce the value in the liveRegion
  4696. label = ui.item.attr("aria-label") || item.value;
  4697. if (label && String.prototype.trim.call(label).length) {
  4698. this.liveRegion.children().hide();
  4699. $("<div>").text(label).appendTo(this.liveRegion);
  4700. }
  4701. },
  4702. menuselect: function (event, ui) {
  4703. var item = ui.item.data("ui-autocomplete-item")
  4704. , previous = this.previous;
  4705. // Only trigger when focus was lost (click on menu)
  4706. if (this.element[0] !== $.ui.safeActiveElement(this.document[0])) {
  4707. this.element.trigger("focus");
  4708. this.previous = previous;
  4709. // #6109 - IE triggers two focus events and the second
  4710. // is asynchronous, so we need to reset the previous
  4711. // term synchronously and asynchronously :-(
  4712. this._delay(function () {
  4713. this.previous = previous;
  4714. this.selectedItem = item;
  4715. });
  4716. }
  4717. if (false !== this._trigger("select", event, {
  4718. item: item
  4719. })) {
  4720. this._value(item.value);
  4721. }
  4722. // reset the term after the select event
  4723. // this allows custom select handling to work properly
  4724. this.term = this._value();
  4725. this.close(event);
  4726. this.selectedItem = item;
  4727. }
  4728. });
  4729. this.liveRegion = $("<div>", {
  4730. role: "status",
  4731. "aria-live": "assertive",
  4732. "aria-relevant": "additions"
  4733. }).appendTo(this.document[0].body);
  4734. this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible");
  4735. // Turning off autocomplete prevents the browser from remembering the
  4736. // value when navigating through history, so we re-enable autocomplete
  4737. // if the page is unloaded before the widget is destroyed. #7790
  4738. this._on(this.window, {
  4739. beforeunload: function () {
  4740. this.element.removeAttr("autocomplete");
  4741. }
  4742. });
  4743. },
  4744. _destroy: function () {
  4745. clearTimeout(this.searching);
  4746. this.element.removeAttr("autocomplete");
  4747. this.menu.element.remove();
  4748. this.liveRegion.remove();
  4749. },
  4750. _setOption: function (key, value) {
  4751. this._super(key, value);
  4752. if (key === "source") {
  4753. this._initSource();
  4754. }
  4755. if (key === "appendTo") {
  4756. this.menu.element.appendTo(this._appendTo());
  4757. }
  4758. if (key === "disabled" && value && this.xhr) {
  4759. this.xhr.abort();
  4760. }
  4761. },
  4762. _isEventTargetInWidget: function (event) {
  4763. var menuElement = this.menu.element[0];
  4764. return event.target === this.element[0] || event.target === menuElement || $.contains(menuElement, event.target);
  4765. },
  4766. _closeOnClickOutside: function (event) {
  4767. if (!this._isEventTargetInWidget(event)) {
  4768. this.close();
  4769. }
  4770. },
  4771. _appendTo: function () {
  4772. var element = this.options.appendTo;
  4773. if (element) {
  4774. element = element.jquery || element.nodeType ? $(element) : this.document.find(element).eq(0);
  4775. }
  4776. if (!element || !element[0]) {
  4777. element = this.element.closest(".ui-front, dialog");
  4778. }
  4779. if (!element.length) {
  4780. element = this.document[0].body;
  4781. }
  4782. return element;
  4783. },
  4784. _initSource: function () {
  4785. var array, url, that = this;
  4786. if (Array.isArray(this.options.source)) {
  4787. array = this.options.source;
  4788. this.source = function (request, response) {
  4789. response($.ui.autocomplete.filter(array, request.term));
  4790. }
  4791. ;
  4792. } else if (typeof this.options.source === "string") {
  4793. url = this.options.source;
  4794. this.source = function (request, response) {
  4795. if (that.xhr) {
  4796. that.xhr.abort();
  4797. }
  4798. that.xhr = $.ajax({
  4799. url: url,
  4800. data: request,
  4801. dataType: "json",
  4802. success: function (data) {
  4803. response(data);
  4804. },
  4805. error: function () {
  4806. response([]);
  4807. }
  4808. });
  4809. }
  4810. ;
  4811. } else {
  4812. this.source = this.options.source;
  4813. }
  4814. },
  4815. _searchTimeout: function (event) {
  4816. clearTimeout(this.searching);
  4817. this.searching = this._delay(function () {
  4818. // Search if the value has changed, or if the user retypes the same value (see #7434)
  4819. var equalValues = this.term === this._value()
  4820. , menuVisible = this.menu.element.is(":visible")
  4821. , modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
  4822. if (!equalValues || (equalValues && !menuVisible && !modifierKey)) {
  4823. this.selectedItem = null;
  4824. this.search(null, event);
  4825. }
  4826. }, this.options.delay);
  4827. },
  4828. search: function (value, event) {
  4829. value = value != null ? value : this._value();
  4830. // Always save the actual value, not the one passed as an argument
  4831. this.term = this._value();
  4832. if (value.length < this.options.minLength) {
  4833. return this.close(event);
  4834. }
  4835. if (this._trigger("search", event) === false) {
  4836. return;
  4837. }
  4838. return this._search(value);
  4839. },
  4840. _search: function (value) {
  4841. this.pending++;
  4842. this._addClass("ui-autocomplete-loading");
  4843. this.cancelSearch = false;
  4844. this.source({
  4845. term: value
  4846. }, this._response());
  4847. },
  4848. _response: function () {
  4849. var index = ++this.requestIndex;
  4850. return function (content) {
  4851. if (index === this.requestIndex) {
  4852. this.__response(content);
  4853. }
  4854. this.pending--;
  4855. if (!this.pending) {
  4856. this._removeClass("ui-autocomplete-loading");
  4857. }
  4858. }
  4859. .bind(this);
  4860. },
  4861. __response: function (content) {
  4862. if (content) {
  4863. content = this._normalize(content);
  4864. }
  4865. this._trigger("response", null, {
  4866. content: content
  4867. });
  4868. if (!this.options.disabled && content && content.length && !this.cancelSearch) {
  4869. this._suggest(content);
  4870. this._trigger("open");
  4871. } else {
  4872. // use ._close() instead of .close() so we don't cancel future searches
  4873. this._close();
  4874. }
  4875. },
  4876. close: function (event) {
  4877. this.cancelSearch = true;
  4878. this._close(event);
  4879. },
  4880. _close: function (event) {
  4881. // Remove the handler that closes the menu on outside clicks
  4882. this._off(this.document, "mousedown");
  4883. if (this.menu.element.is(":visible")) {
  4884. this.menu.element.hide();
  4885. this.menu.blur();
  4886. this.isNewMenu = true;
  4887. this._trigger("close", event);
  4888. }
  4889. },
  4890. _change: function (event) {
  4891. if (this.previous !== this._value()) {
  4892. this._trigger("change", event, {
  4893. item: this.selectedItem
  4894. });
  4895. }
  4896. },
  4897. _normalize: function (items) {
  4898. // assume all items have the right format when the first item is complete
  4899. if (items.length && items[0].label && items[0].value) {
  4900. return items;
  4901. }
  4902. return $.map(items, function (item) {
  4903. if (typeof item === "string") {
  4904. return {
  4905. label: item,
  4906. value: item
  4907. };
  4908. }
  4909. return $.extend({}, item, {
  4910. label: item.label || item.value,
  4911. value: item.value || item.label
  4912. });
  4913. });
  4914. },
  4915. _suggest: function (items) {
  4916. var ul = this.menu.element.empty();
  4917. this._renderMenu(ul, items);
  4918. this.isNewMenu = true;
  4919. this.menu.refresh();
  4920. // Size and position menu
  4921. ul.show();
  4922. this._resizeMenu();
  4923. ul.position($.extend({
  4924. of: this.element
  4925. }, this.options.position));
  4926. if (this.options.autoFocus) {
  4927. this.menu.next();
  4928. }
  4929. // Listen for interactions outside of the widget (#6642)
  4930. this._on(this.document, {
  4931. mousedown: "_closeOnClickOutside"
  4932. });
  4933. },
  4934. _resizeMenu: function () {
  4935. var ul = this.menu.element;
  4936. ul.outerWidth(Math.max(
  4937. // Firefox wraps long text (possibly a rounding bug)
  4938. // so we add 1px to avoid the wrapping (#7513)
  4939. ul.width("").outerWidth() + 1, this.element.outerWidth()));
  4940. },
  4941. _renderMenu: function (ul, items) {
  4942. var that = this;
  4943. $.each(items, function (index, item) {
  4944. that._renderItemData(ul, item);
  4945. });
  4946. },
  4947. _renderItemData: function (ul, item) {
  4948. return this._renderItem(ul, item).data("ui-autocomplete-item", item);
  4949. },
  4950. _renderItem: function (ul, item) {
  4951. return $("<li>").append($("<div>").text(item.label)).appendTo(ul);
  4952. },
  4953. _move: function (direction, event) {
  4954. if (!this.menu.element.is(":visible")) {
  4955. this.search(null, event);
  4956. return;
  4957. }
  4958. if (this.menu.isFirstItem() && /^previous/.test(direction) || this.menu.isLastItem() && /^next/.test(direction)) {
  4959. if (!this.isMultiLine) {
  4960. this._value(this.term);
  4961. }
  4962. this.menu.blur();
  4963. return;
  4964. }
  4965. this.menu[direction](event);
  4966. },
  4967. widget: function () {
  4968. return this.menu.element;
  4969. },
  4970. _value: function () {
  4971. return this.valueMethod.apply(this.element, arguments);
  4972. },
  4973. _keyEvent: function (keyEvent, event) {
  4974. if (!this.isMultiLine || this.menu.element.is(":visible")) {
  4975. this._move(keyEvent, event);
  4976. // Prevents moving cursor to beginning/end of the text field in some browsers
  4977. event.preventDefault();
  4978. }
  4979. },
  4980. // Support: Chrome <=50
  4981. // We should be able to just use this.element.prop( "isContentEditable" )
  4982. // but hidden elements always report false in Chrome.
  4983. // https://code.google.com/p/chromium/issues/detail?id=313082
  4984. _isContentEditable: function (element) {
  4985. if (!element.length) {
  4986. return false;
  4987. }
  4988. var editable = element.prop("contentEditable");
  4989. if (editable === "inherit") {
  4990. return this._isContentEditable(element.parent());
  4991. }
  4992. return editable === "true";
  4993. }
  4994. });
  4995. $.extend($.ui.autocomplete, {
  4996. escapeRegex: function (value) {
  4997. return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
  4998. },
  4999. filter: function (array, term) {
  5000. var matcher = new RegExp($.ui.autocomplete.escapeRegex(term), "i");
  5001. return $.grep(array, function (value) {
  5002. return matcher.test(value.label || value.value || value);
  5003. });
  5004. }
  5005. });
  5006. // Live region extension, adding a `messages` option
  5007. // NOTE: This is an experimental API. We are still investigating
  5008. // a full solution for string manipulation and internationalization.
  5009. $.widget("ui.autocomplete", $.ui.autocomplete, {
  5010. options: {
  5011. messages: {
  5012. noResults: "No search results.",
  5013. results: function (amount) {
  5014. return amount + (amount > 1 ? " results are" : " result is") + " available, use up and down arrow keys to navigate.";
  5015. }
  5016. }
  5017. },
  5018. __response: function (content) {
  5019. var message;
  5020. this._superApply(arguments);
  5021. if (this.options.disabled || this.cancelSearch) {
  5022. return;
  5023. }
  5024. if (content && content.length) {
  5025. message = this.options.messages.results(content.length);
  5026. } else {
  5027. message = this.options.messages.noResults;
  5028. }
  5029. this.liveRegion.children().hide();
  5030. $("<div>").text(message).appendTo(this.liveRegion);
  5031. }
  5032. });
  5033. var widgetsAutocomplete = $.ui.autocomplete;
  5034. /*!
  5035. * jQuery UI Controlgroup 1.13.0
  5036. * http://jqueryui.com
  5037. *
  5038. * Copyright jQuery Foundation and other contributors
  5039. * Released under the MIT license.
  5040. * http://jquery.org/license
  5041. */
  5042. //>>label: Controlgroup
  5043. //>>group: Widgets
  5044. //>>description: Visually groups form control widgets
  5045. //>>docs: http://api.jqueryui.com/controlgroup/
  5046. //>>demos: http://jqueryui.com/controlgroup/
  5047. //>>css.structure: ../../themes/base/core.css
  5048. //>>css.structure: ../../themes/base/controlgroup.css
  5049. //>>css.theme: ../../themes/base/theme.css
  5050. var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g;
  5051. var widgetsControlgroup = $.widget("ui.controlgroup", {
  5052. version: "1.13.0",
  5053. defaultElement: "<div>",
  5054. options: {
  5055. direction: "horizontal",
  5056. disabled: null,
  5057. onlyVisible: true,
  5058. items: {
  5059. "button": "input[type=button], input[type=submit], input[type=reset], button, a",
  5060. "controlgroupLabel": ".ui-controlgroup-label",
  5061. "checkboxradio": "input[type='checkbox'], input[type='radio']",
  5062. "selectmenu": "select",
  5063. "spinner": ".ui-spinner-input"
  5064. }
  5065. },
  5066. _create: function () {
  5067. this._enhance();
  5068. },
  5069. // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation
  5070. _enhance: function () {
  5071. this.element.attr("role", "toolbar");
  5072. this.refresh();
  5073. },
  5074. _destroy: function () {
  5075. this._callChildMethod("destroy");
  5076. this.childWidgets.removeData("ui-controlgroup-data");
  5077. this.element.removeAttr("role");
  5078. if (this.options.items.controlgroupLabel) {
  5079. this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap();
  5080. }
  5081. },
  5082. _initWidgets: function () {
  5083. var that = this
  5084. , childWidgets = [];
  5085. // First we iterate over each of the items options
  5086. $.each(this.options.items, function (widget, selector) {
  5087. var labels;
  5088. var options = {};
  5089. // Make sure the widget has a selector set
  5090. if (!selector) {
  5091. return;
  5092. }
  5093. if (widget === "controlgroupLabel") {
  5094. labels = that.element.find(selector);
  5095. labels.each(function () {
  5096. var element = $(this);
  5097. if (element.children(".ui-controlgroup-label-contents").length) {
  5098. return;
  5099. }
  5100. element.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>");
  5101. });
  5102. that._addClass(labels, null, "ui-widget ui-widget-content ui-state-default");
  5103. childWidgets = childWidgets.concat(labels.get());
  5104. return;
  5105. }
  5106. // Make sure the widget actually exists
  5107. if (!$.fn[widget]) {
  5108. return;
  5109. }
  5110. // We assume everything is in the middle to start because we can't determine
  5111. // first / last elements until all enhancments are done.
  5112. if (that["_" + widget + "Options"]) {
  5113. options = that["_" + widget + "Options"]("middle");
  5114. } else {
  5115. options = {
  5116. classes: {}
  5117. };
  5118. }
  5119. // Find instances of this widget inside controlgroup and init them
  5120. that.element.find(selector).each(function () {
  5121. var element = $(this);
  5122. var instance = element[widget]("instance");
  5123. // We need to clone the default options for this type of widget to avoid
  5124. // polluting the variable options which has a wider scope than a single widget.
  5125. var instanceOptions = $.widget.extend({}, options);
  5126. // If the button is the child of a spinner ignore it
  5127. // TODO: Find a more generic solution
  5128. if (widget === "button" && element.parent(".ui-spinner").length) {
  5129. return;
  5130. }
  5131. // Create the widget if it doesn't exist
  5132. if (!instance) {
  5133. instance = element[widget]()[widget]("instance");
  5134. }
  5135. if (instance) {
  5136. instanceOptions.classes = that._resolveClassesValues(instanceOptions.classes, instance);
  5137. }
  5138. element[widget](instanceOptions);
  5139. // Store an instance of the controlgroup to be able to reference
  5140. // from the outermost element for changing options and refresh
  5141. var widgetElement = element[widget]("widget");
  5142. $.data(widgetElement[0], "ui-controlgroup-data", instance ? instance : element[widget]("instance"));
  5143. childWidgets.push(widgetElement[0]);
  5144. });
  5145. });
  5146. this.childWidgets = $($.uniqueSort(childWidgets));
  5147. this._addClass(this.childWidgets, "ui-controlgroup-item");
  5148. },
  5149. _callChildMethod: function (method) {
  5150. this.childWidgets.each(function () {
  5151. var element = $(this)
  5152. , data = element.data("ui-controlgroup-data");
  5153. if (data && data[method]) {
  5154. data[method]();
  5155. }
  5156. });
  5157. },
  5158. _updateCornerClass: function (element, position) {
  5159. var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all";
  5160. var add = this._buildSimpleOptions(position, "label").classes.label;
  5161. this._removeClass(element, null, remove);
  5162. this._addClass(element, null, add);
  5163. },
  5164. _buildSimpleOptions: function (position, key) {
  5165. var direction = this.options.direction === "vertical";
  5166. var result = {
  5167. classes: {}
  5168. };
  5169. result.classes[key] = {
  5170. "middle": "",
  5171. "first": "ui-corner-" + (direction ? "top" : "left"),
  5172. "last": "ui-corner-" + (direction ? "bottom" : "right"),
  5173. "only": "ui-corner-all"
  5174. }[position];
  5175. return result;
  5176. },
  5177. _spinnerOptions: function (position) {
  5178. var options = this._buildSimpleOptions(position, "ui-spinner");
  5179. options.classes["ui-spinner-up"] = "";
  5180. options.classes["ui-spinner-down"] = "";
  5181. return options;
  5182. },
  5183. _buttonOptions: function (position) {
  5184. return this._buildSimpleOptions(position, "ui-button");
  5185. },
  5186. _checkboxradioOptions: function (position) {
  5187. return this._buildSimpleOptions(position, "ui-checkboxradio-label");
  5188. },
  5189. _selectmenuOptions: function (position) {
  5190. var direction = this.options.direction === "vertical";
  5191. return {
  5192. width: direction ? "auto" : false,
  5193. classes: {
  5194. middle: {
  5195. "ui-selectmenu-button-open": "",
  5196. "ui-selectmenu-button-closed": ""
  5197. },
  5198. first: {
  5199. "ui-selectmenu-button-open": "ui-corner-" + (direction ? "top" : "tl"),
  5200. "ui-selectmenu-button-closed": "ui-corner-" + (direction ? "top" : "left")
  5201. },
  5202. last: {
  5203. "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr",
  5204. "ui-selectmenu-button-closed": "ui-corner-" + (direction ? "bottom" : "right")
  5205. },
  5206. only: {
  5207. "ui-selectmenu-button-open": "ui-corner-top",
  5208. "ui-selectmenu-button-closed": "ui-corner-all"
  5209. }
  5210. }[position]
  5211. };
  5212. },
  5213. _resolveClassesValues: function (classes, instance) {
  5214. var result = {};
  5215. $.each(classes, function (key) {
  5216. var current = instance.options.classes[key] || "";
  5217. current = String.prototype.trim.call(current.replace(controlgroupCornerRegex, ""));
  5218. result[key] = (current + " " + classes[key]).replace(/\s+/g, " ");
  5219. });
  5220. return result;
  5221. },
  5222. _setOption: function (key, value) {
  5223. if (key === "direction") {
  5224. this._removeClass("ui-controlgroup-" + this.options.direction);
  5225. }
  5226. this._super(key, value);
  5227. if (key === "disabled") {
  5228. this._callChildMethod(value ? "disable" : "enable");
  5229. return;
  5230. }
  5231. this.refresh();
  5232. },
  5233. refresh: function () {
  5234. var children, that = this;
  5235. this._addClass("ui-controlgroup ui-controlgroup-" + this.options.direction);
  5236. if (this.options.direction === "horizontal") {
  5237. this._addClass(null, "ui-helper-clearfix");
  5238. }
  5239. this._initWidgets();
  5240. children = this.childWidgets;
  5241. // We filter here because we need to track all childWidgets not just the visible ones
  5242. if (this.options.onlyVisible) {
  5243. children = children.filter(":visible");
  5244. }
  5245. if (children.length) {
  5246. // We do this last because we need to make sure all enhancment is done
  5247. // before determining first and last
  5248. $.each(["first", "last"], function (index, value) {
  5249. var instance = children[value]().data("ui-controlgroup-data");
  5250. if (instance && that["_" + instance.widgetName + "Options"]) {
  5251. var options = that["_" + instance.widgetName + "Options"](children.length === 1 ? "only" : value);
  5252. options.classes = that._resolveClassesValues(options.classes, instance);
  5253. instance.element[instance.widgetName](options);
  5254. } else {
  5255. that._updateCornerClass(children[value](), value);
  5256. }
  5257. });
  5258. // Finally call the refresh method on each of the child widgets.
  5259. this._callChildMethod("refresh");
  5260. }
  5261. }
  5262. });
  5263. /*!
  5264. * jQuery UI Checkboxradio 1.13.0
  5265. * http://jqueryui.com
  5266. *
  5267. * Copyright jQuery Foundation and other contributors
  5268. * Released under the MIT license.
  5269. * http://jquery.org/license
  5270. */
  5271. //>>label: Checkboxradio
  5272. //>>group: Widgets
  5273. //>>description: Enhances a form with multiple themeable checkboxes or radio buttons.
  5274. //>>docs: http://api.jqueryui.com/checkboxradio/
  5275. //>>demos: http://jqueryui.com/checkboxradio/
  5276. //>>css.structure: ../../themes/base/core.css
  5277. //>>css.structure: ../../themes/base/button.css
  5278. //>>css.structure: ../../themes/base/checkboxradio.css
  5279. //>>css.theme: ../../themes/base/theme.css
  5280. $.widget("ui.checkboxradio", [$.ui.formResetMixin, {
  5281. version: "1.13.0",
  5282. options: {
  5283. disabled: null,
  5284. label: null,
  5285. icon: true,
  5286. classes: {
  5287. "ui-checkboxradio-label": "ui-corner-all",
  5288. "ui-checkboxradio-icon": "ui-corner-all"
  5289. }
  5290. },
  5291. _getCreateOptions: function () {
  5292. var disabled, labels;
  5293. var that = this;
  5294. var options = this._super() || {};
  5295. // We read the type here, because it makes more sense to throw a element type error first,
  5296. // rather then the error for lack of a label. Often if its the wrong type, it
  5297. // won't have a label (e.g. calling on a div, btn, etc)
  5298. this._readType();
  5299. labels = this.element.labels();
  5300. // If there are multiple labels, use the last one
  5301. this.label = $(labels[labels.length - 1]);
  5302. if (!this.label.length) {
  5303. $.error("No label found for checkboxradio widget");
  5304. }
  5305. this.originalLabel = "";
  5306. // We need to get the label text but this may also need to make sure it does not contain the
  5307. // input itself.
  5308. this.label.contents().not(this.element[0]).each(function () {
  5309. // The label contents could be text, html, or a mix. We concat each element to get a
  5310. // string representation of the label, without the input as part of it.
  5311. that.originalLabel += this.nodeType === 3 ? $(this).text() : this.outerHTML;
  5312. });
  5313. // Set the label option if we found label text
  5314. if (this.originalLabel) {
  5315. options.label = this.originalLabel;
  5316. }
  5317. disabled = this.element[0].disabled;
  5318. if (disabled != null) {
  5319. options.disabled = disabled;
  5320. }
  5321. return options;
  5322. },
  5323. _create: function () {
  5324. var checked = this.element[0].checked;
  5325. this._bindFormResetHandler();
  5326. if (this.options.disabled == null) {
  5327. this.options.disabled = this.element[0].disabled;
  5328. }
  5329. this._setOption("disabled", this.options.disabled);
  5330. this._addClass("ui-checkboxradio", "ui-helper-hidden-accessible");
  5331. this._addClass(this.label, "ui-checkboxradio-label", "ui-button ui-widget");
  5332. if (this.type === "radio") {
  5333. this._addClass(this.label, "ui-checkboxradio-radio-label");
  5334. }
  5335. if (this.options.label && this.options.label !== this.originalLabel) {
  5336. this._updateLabel();
  5337. } else if (this.originalLabel) {
  5338. this.options.label = this.originalLabel;
  5339. }
  5340. this._enhance();
  5341. if (checked) {
  5342. this._addClass(this.label, "ui-checkboxradio-checked", "ui-state-active");
  5343. }
  5344. this._on({
  5345. change: "_toggleClasses",
  5346. focus: function () {
  5347. this._addClass(this.label, null, "ui-state-focus ui-visual-focus");
  5348. },
  5349. blur: function () {
  5350. this._removeClass(this.label, null, "ui-state-focus ui-visual-focus");
  5351. }
  5352. });
  5353. },
  5354. _readType: function () {
  5355. var nodeName = this.element[0].nodeName.toLowerCase();
  5356. this.type = this.element[0].type;
  5357. if (nodeName !== "input" || !/radio|checkbox/.test(this.type)) {
  5358. $.error("Can't create checkboxradio on element.nodeName=" + nodeName + " and element.type=" + this.type);
  5359. }
  5360. },
  5361. // Support jQuery Mobile enhanced option
  5362. _enhance: function () {
  5363. this._updateIcon(this.element[0].checked);
  5364. },
  5365. widget: function () {
  5366. return this.label;
  5367. },
  5368. _getRadioGroup: function () {
  5369. var group;
  5370. var name = this.element[0].name;
  5371. var nameSelector = "input[name='" + $.escapeSelector(name) + "']";
  5372. if (!name) {
  5373. return $([]);
  5374. }
  5375. if (this.form.length) {
  5376. group = $(this.form[0].elements).filter(nameSelector);
  5377. } else {
  5378. // Not inside a form, check all inputs that also are not inside a form
  5379. group = $(nameSelector).filter(function () {
  5380. return $(this)._form().length === 0;
  5381. });
  5382. }
  5383. return group.not(this.element);
  5384. },
  5385. _toggleClasses: function () {
  5386. var checked = this.element[0].checked;
  5387. this._toggleClass(this.label, "ui-checkboxradio-checked", "ui-state-active", checked);
  5388. if (this.options.icon && this.type === "checkbox") {
  5389. this._toggleClass(this.icon, null, "ui-icon-check ui-state-checked", checked)._toggleClass(this.icon, null, "ui-icon-blank", !checked);
  5390. }
  5391. if (this.type === "radio") {
  5392. this._getRadioGroup().each(function () {
  5393. var instance = $(this).checkboxradio("instance");
  5394. if (instance) {
  5395. instance._removeClass(instance.label, "ui-checkboxradio-checked", "ui-state-active");
  5396. }
  5397. });
  5398. }
  5399. },
  5400. _destroy: function () {
  5401. this._unbindFormResetHandler();
  5402. if (this.icon) {
  5403. this.icon.remove();
  5404. this.iconSpace.remove();
  5405. }
  5406. },
  5407. _setOption: function (key, value) {
  5408. // We don't allow the value to be set to nothing
  5409. if (key === "label" && !value) {
  5410. return;
  5411. }
  5412. this._super(key, value);
  5413. if (key === "disabled") {
  5414. this._toggleClass(this.label, null, "ui-state-disabled", value);
  5415. this.element[0].disabled = value;
  5416. // Don't refresh when setting disabled
  5417. return;
  5418. }
  5419. this.refresh();
  5420. },
  5421. _updateIcon: function (checked) {
  5422. var toAdd = "ui-icon ui-icon-background ";
  5423. if (this.options.icon) {
  5424. if (!this.icon) {
  5425. this.icon = $("<span>");
  5426. this.iconSpace = $("<span> </span>");
  5427. this._addClass(this.iconSpace, "ui-checkboxradio-icon-space");
  5428. }
  5429. if (this.type === "checkbox") {
  5430. toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank";
  5431. this._removeClass(this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check");
  5432. } else {
  5433. toAdd += "ui-icon-blank";
  5434. }
  5435. this._addClass(this.icon, "ui-checkboxradio-icon", toAdd);
  5436. if (!checked) {
  5437. this._removeClass(this.icon, null, "ui-icon-check ui-state-checked");
  5438. }
  5439. this.icon.prependTo(this.label).after(this.iconSpace);
  5440. } else if (this.icon !== undefined) {
  5441. this.icon.remove();
  5442. this.iconSpace.remove();
  5443. delete this.icon;
  5444. }
  5445. },
  5446. _updateLabel: function () {
  5447. // Remove the contents of the label ( minus the icon, icon space, and input )
  5448. var contents = this.label.contents().not(this.element[0]);
  5449. if (this.icon) {
  5450. contents = contents.not(this.icon[0]);
  5451. }
  5452. if (this.iconSpace) {
  5453. contents = contents.not(this.iconSpace[0]);
  5454. }
  5455. contents.remove();
  5456. this.label.append(this.options.label);
  5457. },
  5458. refresh: function () {
  5459. var checked = this.element[0].checked
  5460. , isDisabled = this.element[0].disabled;
  5461. this._updateIcon(checked);
  5462. this._toggleClass(this.label, "ui-checkboxradio-checked", "ui-state-active", checked);
  5463. if (this.options.label !== null) {
  5464. this._updateLabel();
  5465. }
  5466. if (isDisabled !== this.options.disabled) {
  5467. this._setOptions({
  5468. "disabled": isDisabled
  5469. });
  5470. }
  5471. }
  5472. }]);
  5473. var widgetsCheckboxradio = $.ui.checkboxradio;
  5474. /*!
  5475. * jQuery UI Button 1.13.0
  5476. * http://jqueryui.com
  5477. *
  5478. * Copyright jQuery Foundation and other contributors
  5479. * Released under the MIT license.
  5480. * http://jquery.org/license
  5481. */
  5482. //>>label: Button
  5483. //>>group: Widgets
  5484. //>>description: Enhances a form with themeable buttons.
  5485. //>>docs: http://api.jqueryui.com/button/
  5486. //>>demos: http://jqueryui.com/button/
  5487. //>>css.structure: ../../themes/base/core.css
  5488. //>>css.structure: ../../themes/base/button.css
  5489. //>>css.theme: ../../themes/base/theme.css
  5490. $.widget("ui.button", {
  5491. version: "1.13.0",
  5492. defaultElement: "<button>",
  5493. options: {
  5494. classes: {
  5495. "ui-button": "ui-corner-all"
  5496. },
  5497. disabled: null,
  5498. icon: null,
  5499. iconPosition: "beginning",
  5500. label: null,
  5501. showLabel: true
  5502. },
  5503. _getCreateOptions: function () {
  5504. var disabled,
  5505. // This is to support cases like in jQuery Mobile where the base widget does have
  5506. // an implementation of _getCreateOptions
  5507. options = this._super() || {};
  5508. this.isInput = this.element.is("input");
  5509. disabled = this.element[0].disabled;
  5510. if (disabled != null) {
  5511. options.disabled = disabled;
  5512. }
  5513. this.originalLabel = this.isInput ? this.element.val() : this.element.html();
  5514. if (this.originalLabel) {
  5515. options.label = this.originalLabel;
  5516. }
  5517. return options;
  5518. },
  5519. _create: function () {
  5520. if (!this.option.showLabel & !this.options.icon) {
  5521. this.options.showLabel = true;
  5522. }
  5523. // We have to check the option again here even though we did in _getCreateOptions,
  5524. // because null may have been passed on init which would override what was set in
  5525. // _getCreateOptions
  5526. if (this.options.disabled == null) {
  5527. this.options.disabled = this.element[0].disabled || false;
  5528. }
  5529. this.hasTitle = !!this.element.attr("title");
  5530. // Check to see if the label needs to be set or if its already correct
  5531. if (this.options.label && this.options.label !== this.originalLabel) {
  5532. if (this.isInput) {
  5533. this.element.val(this.options.label);
  5534. } else {
  5535. this.element.html(this.options.label);
  5536. }
  5537. }
  5538. this._addClass("ui-button", "ui-widget");
  5539. this._setOption("disabled", this.options.disabled);
  5540. this._enhance();
  5541. if (this.element.is("a")) {
  5542. this._on({
  5543. "keyup": function (event) {
  5544. if (event.keyCode === $.ui.keyCode.SPACE) {
  5545. event.preventDefault();
  5546. // Support: PhantomJS <= 1.9, IE 8 Only
  5547. // If a native click is available use it so we actually cause navigation
  5548. // otherwise just trigger a click event
  5549. if (this.element[0].click) {
  5550. this.element[0].click();
  5551. } else {
  5552. this.element.trigger("click");
  5553. }
  5554. }
  5555. }
  5556. });
  5557. }
  5558. },
  5559. _enhance: function () {
  5560. if (!this.element.is("button")) {
  5561. this.element.attr("role", "button");
  5562. }
  5563. if (this.options.icon) {
  5564. this._updateIcon("icon", this.options.icon);
  5565. this._updateTooltip();
  5566. }
  5567. },
  5568. _updateTooltip: function () {
  5569. this.title = this.element.attr("title");
  5570. if (!this.options.showLabel && !this.title) {
  5571. this.element.attr("title", this.options.label);
  5572. }
  5573. },
  5574. _updateIcon: function (option, value) {
  5575. var icon = option !== "iconPosition"
  5576. , position = icon ? this.options.iconPosition : value
  5577. , displayBlock = position === "top" || position === "bottom";
  5578. // Create icon
  5579. if (!this.icon) {
  5580. this.icon = $("<span>");
  5581. this._addClass(this.icon, "ui-button-icon", "ui-icon");
  5582. if (!this.options.showLabel) {
  5583. this._addClass("ui-button-icon-only");
  5584. }
  5585. } else if (icon) {
  5586. // If we are updating the icon remove the old icon class
  5587. this._removeClass(this.icon, null, this.options.icon);
  5588. }
  5589. // If we are updating the icon add the new icon class
  5590. if (icon) {
  5591. this._addClass(this.icon, null, value);
  5592. }
  5593. this._attachIcon(position);
  5594. // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove
  5595. // the iconSpace if there is one.
  5596. if (displayBlock) {
  5597. this._addClass(this.icon, null, "ui-widget-icon-block");
  5598. if (this.iconSpace) {
  5599. this.iconSpace.remove();
  5600. }
  5601. } else {
  5602. // Position is beginning or end so remove the ui-widget-icon-block class and add the
  5603. // space if it does not exist
  5604. if (!this.iconSpace) {
  5605. this.iconSpace = $("<span> </span>");
  5606. this._addClass(this.iconSpace, "ui-button-icon-space");
  5607. }
  5608. this._removeClass(this.icon, null, "ui-wiget-icon-block");
  5609. this._attachIconSpace(position);
  5610. }
  5611. },
  5612. _destroy: function () {
  5613. this.element.removeAttr("role");
  5614. if (this.icon) {
  5615. this.icon.remove();
  5616. }
  5617. if (this.iconSpace) {
  5618. this.iconSpace.remove();
  5619. }
  5620. if (!this.hasTitle) {
  5621. this.element.removeAttr("title");
  5622. }
  5623. },
  5624. _attachIconSpace: function (iconPosition) {
  5625. this.icon[/^(?:end|bottom)/.test(iconPosition) ? "before" : "after"](this.iconSpace);
  5626. },
  5627. _attachIcon: function (iconPosition) {
  5628. this.element[/^(?:end|bottom)/.test(iconPosition) ? "append" : "prepend"](this.icon);
  5629. },
  5630. _setOptions: function (options) {
  5631. var newShowLabel = options.showLabel === undefined ? this.options.showLabel : options.showLabel
  5632. , newIcon = options.icon === undefined ? this.options.icon : options.icon;
  5633. if (!newShowLabel && !newIcon) {
  5634. options.showLabel = true;
  5635. }
  5636. this._super(options);
  5637. },
  5638. _setOption: function (key, value) {
  5639. if (key === "icon") {
  5640. if (value) {
  5641. this._updateIcon(key, value);
  5642. } else if (this.icon) {
  5643. this.icon.remove();
  5644. if (this.iconSpace) {
  5645. this.iconSpace.remove();
  5646. }
  5647. }
  5648. }
  5649. if (key === "iconPosition") {
  5650. this._updateIcon(key, value);
  5651. }
  5652. // Make sure we can't end up with a button that has neither text nor icon
  5653. if (key === "showLabel") {
  5654. this._toggleClass("ui-button-icon-only", null, !value);
  5655. this._updateTooltip();
  5656. }
  5657. if (key === "label") {
  5658. if (this.isInput) {
  5659. this.element.val(value);
  5660. } else {
  5661. // If there is an icon, append it, else nothing then append the value
  5662. // this avoids removal of the icon when setting label text
  5663. this.element.html(value);
  5664. if (this.icon) {
  5665. this._attachIcon(this.options.iconPosition);
  5666. this._attachIconSpace(this.options.iconPosition);
  5667. }
  5668. }
  5669. }
  5670. this._super(key, value);
  5671. if (key === "disabled") {
  5672. this._toggleClass(null, "ui-state-disabled", value);
  5673. this.element[0].disabled = value;
  5674. if (value) {
  5675. this.element.trigger("blur");
  5676. }
  5677. }
  5678. },
  5679. refresh: function () {
  5680. // Make sure to only check disabled if its an element that supports this otherwise
  5681. // check for the disabled class to determine state
  5682. var isDisabled = this.element.is("input, button") ? this.element[0].disabled : this.element.hasClass("ui-button-disabled");
  5683. if (isDisabled !== this.options.disabled) {
  5684. this._setOptions({
  5685. disabled: isDisabled
  5686. });
  5687. }
  5688. this._updateTooltip();
  5689. }
  5690. });
  5691. // DEPRECATED
  5692. if ($.uiBackCompat !== false) {
  5693. // Text and Icons options
  5694. $.widget("ui.button", $.ui.button, {
  5695. options: {
  5696. text: true,
  5697. icons: {
  5698. primary: null,
  5699. secondary: null
  5700. }
  5701. },
  5702. _create: function () {
  5703. if (this.options.showLabel && !this.options.text) {
  5704. this.options.showLabel = this.options.text;
  5705. }
  5706. if (!this.options.showLabel && this.options.text) {
  5707. this.options.text = this.options.showLabel;
  5708. }
  5709. if (!this.options.icon && (this.options.icons.primary || this.options.icons.secondary)) {
  5710. if (this.options.icons.primary) {
  5711. this.options.icon = this.options.icons.primary;
  5712. } else {
  5713. this.options.icon = this.options.icons.secondary;
  5714. this.options.iconPosition = "end";
  5715. }
  5716. } else if (this.options.icon) {
  5717. this.options.icons.primary = this.options.icon;
  5718. }
  5719. this._super();
  5720. },
  5721. _setOption: function (key, value) {
  5722. if (key === "text") {
  5723. this._super("showLabel", value);
  5724. return;
  5725. }
  5726. if (key === "showLabel") {
  5727. this.options.text = value;
  5728. }
  5729. if (key === "icon") {
  5730. this.options.icons.primary = value;
  5731. }
  5732. if (key === "icons") {
  5733. if (value.primary) {
  5734. this._super("icon", value.primary);
  5735. this._super("iconPosition", "beginning");
  5736. } else if (value.secondary) {
  5737. this._super("icon", value.secondary);
  5738. this._super("iconPosition", "end");
  5739. }
  5740. }
  5741. this._superApply(arguments);
  5742. }
  5743. });
  5744. $.fn.button = (function (orig) {
  5745. return function (options) {
  5746. var isMethodCall = typeof options === "string";
  5747. var args = Array.prototype.slice.call(arguments, 1);
  5748. var returnValue = this;
  5749. if (isMethodCall) {
  5750. // If this is an empty collection, we need to have the instance method
  5751. // return undefined instead of the jQuery instance
  5752. if (!this.length && options === "instance") {
  5753. returnValue = undefined;
  5754. } else {
  5755. this.each(function () {
  5756. var methodValue;
  5757. var type = $(this).attr("type");
  5758. var name = type !== "checkbox" && type !== "radio" ? "button" : "checkboxradio";
  5759. var instance = $.data(this, "ui-" + name);
  5760. if (options === "instance") {
  5761. returnValue = instance;
  5762. return false;
  5763. }
  5764. if (!instance) {
  5765. return $.error("cannot call methods on button" + " prior to initialization; " + "attempted to call method '" + options + "'");
  5766. }
  5767. if (typeof instance[options] !== "function" || options.charAt(0) === "_") {
  5768. return $.error("no such method '" + options + "' for button" + " widget instance");
  5769. }
  5770. methodValue = instance[options].apply(instance, args);
  5771. if (methodValue !== instance && methodValue !== undefined) {
  5772. returnValue = methodValue && methodValue.jquery ? returnValue.pushStack(methodValue.get()) : methodValue;
  5773. return false;
  5774. }
  5775. });
  5776. }
  5777. } else {
  5778. // Allow multiple hashes to be passed on init
  5779. if (args.length) {
  5780. options = $.widget.extend.apply(null, [options].concat(args));
  5781. }
  5782. this.each(function () {
  5783. var type = $(this).attr("type");
  5784. var name = type !== "checkbox" && type !== "radio" ? "button" : "checkboxradio";
  5785. var instance = $.data(this, "ui-" + name);
  5786. if (instance) {
  5787. instance.option(options || {});
  5788. if (instance._init) {
  5789. instance._init();
  5790. }
  5791. } else {
  5792. if (name === "button") {
  5793. orig.call($(this), options);
  5794. return;
  5795. }
  5796. $(this).checkboxradio($.extend({
  5797. icon: false
  5798. }, options));
  5799. }
  5800. });
  5801. }
  5802. return returnValue;
  5803. }
  5804. ;
  5805. }
  5806. )($.fn.button);
  5807. $.fn.buttonset = function () {
  5808. if (!$.ui.controlgroup) {
  5809. $.error("Controlgroup widget missing");
  5810. }
  5811. if (arguments[0] === "option" && arguments[1] === "items" && arguments[2]) {
  5812. return this.controlgroup.apply(this, [arguments[0], "items.button", arguments[2]]);
  5813. }
  5814. if (arguments[0] === "option" && arguments[1] === "items") {
  5815. return this.controlgroup.apply(this, [arguments[0], "items.button"]);
  5816. }
  5817. if (typeof arguments[0] === "object" && arguments[0].items) {
  5818. arguments[0].items = {
  5819. button: arguments[0].items
  5820. };
  5821. }
  5822. return this.controlgroup.apply(this, arguments);
  5823. }
  5824. ;
  5825. }
  5826. var widgetsButton = $.ui.button;
  5827. /* eslint-disable max-len, camelcase */
  5828. /*!
  5829. * jQuery UI Datepicker 1.13.0
  5830. * http://jqueryui.com
  5831. *
  5832. * Copyright jQuery Foundation and other contributors
  5833. * Released under the MIT license.
  5834. * http://jquery.org/license
  5835. */
  5836. //>>label: Datepicker
  5837. //>>group: Widgets
  5838. //>>description: Displays a calendar from an input or inline for selecting dates.
  5839. //>>docs: http://api.jqueryui.com/datepicker/
  5840. //>>demos: http://jqueryui.com/datepicker/
  5841. //>>css.structure: ../../themes/base/core.css
  5842. //>>css.structure: ../../themes/base/datepicker.css
  5843. //>>css.theme: ../../themes/base/theme.css
  5844. $.extend($.ui, {
  5845. datepicker: {
  5846. version: "1.13.0"
  5847. }
  5848. });
  5849. var datepicker_instActive;
  5850. function datepicker_getZindex(elem) {
  5851. var position, value;
  5852. while (elem.length && elem[0] !== document) {
  5853. // Ignore z-index if position is set to a value where z-index is ignored by the browser
  5854. // This makes behavior of this function consistent across browsers
  5855. // WebKit always returns auto if the element is positioned
  5856. position = elem.css("position");
  5857. if (position === "absolute" || position === "relative" || position === "fixed") {
  5858. // IE returns 0 when zIndex is not specified
  5859. // other browsers return a string
  5860. // we ignore the case of nested elements with an explicit value of 0
  5861. // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
  5862. value = parseInt(elem.css("zIndex"), 10);
  5863. if (!isNaN(value) && value !== 0) {
  5864. return value;
  5865. }
  5866. }
  5867. elem = elem.parent();
  5868. }
  5869. return 0;
  5870. }
  5871. /* Date picker manager.
  5872. Use the singleton instance of this class, $.datepicker, to interact with the date picker.
  5873. Settings for (groups of) date pickers are maintained in an instance object,
  5874. allowing multiple different settings on the same page. */
  5875. function Datepicker() {
  5876. this._curInst = null;
  5877. // The current instance in use
  5878. this._keyEvent = false;
  5879. // If the last event was a key event
  5880. this._disabledInputs = [];
  5881. // List of date picker inputs that have been disabled
  5882. this._datepickerShowing = false;
  5883. // True if the popup picker is showing , false if not
  5884. this._inDialog = false;
  5885. // True if showing within a "dialog", false if not
  5886. this._mainDivId = "ui-datepicker-div";
  5887. // The ID of the main datepicker division
  5888. this._inlineClass = "ui-datepicker-inline";
  5889. // The name of the inline marker class
  5890. this._appendClass = "ui-datepicker-append";
  5891. // The name of the append marker class
  5892. this._triggerClass = "ui-datepicker-trigger";
  5893. // The name of the trigger marker class
  5894. this._dialogClass = "ui-datepicker-dialog";
  5895. // The name of the dialog marker class
  5896. this._disableClass = "ui-datepicker-disabled";
  5897. // The name of the disabled covering marker class
  5898. this._unselectableClass = "ui-datepicker-unselectable";
  5899. // The name of the unselectable cell marker class
  5900. this._currentClass = "ui-datepicker-current-day";
  5901. // The name of the current day marker class
  5902. this._dayOverClass = "ui-datepicker-days-cell-over";
  5903. // The name of the day hover marker class
  5904. this.regional = [];
  5905. // Available regional settings, indexed by language code
  5906. this.regional[""] = {
  5907. // Default regional settings
  5908. closeText: "Done",
  5909. // Display text for close link
  5910. prevText: "Prev",
  5911. // Display text for previous month link
  5912. nextText: "Next",
  5913. // Display text for next month link
  5914. currentText: "Today",
  5915. // Display text for current month link
  5916. monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
  5917. // Names of months for drop-down and formatting
  5918. monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
  5919. // For formatting
  5920. dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
  5921. // For formatting
  5922. dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
  5923. // For formatting
  5924. dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
  5925. // Column headings for days starting at Sunday
  5926. weekHeader: "Wk",
  5927. // Column header for week of the year
  5928. dateFormat: "mm/dd/yy",
  5929. // See format options on parseDate
  5930. firstDay: 0,
  5931. // The first day of the week, Sun = 0, Mon = 1, ...
  5932. isRTL: false,
  5933. // True if right-to-left language, false if left-to-right
  5934. showMonthAfterYear: false,
  5935. // True if the year select precedes month, false for month then year
  5936. yearSuffix: "",
  5937. // Additional text to append to the year in the month headers,
  5938. selectMonthLabel: "Select month",
  5939. // Invisible label for month selector
  5940. selectYearLabel: "Select year"// Invisible label for year selector
  5941. };
  5942. this._defaults = {
  5943. // Global defaults for all the date picker instances
  5944. showOn: "focus",
  5945. // "focus" for popup on focus,
  5946. // "button" for trigger button, or "both" for either
  5947. showAnim: "fadeIn",
  5948. // Name of jQuery animation for popup
  5949. showOptions: {},
  5950. // Options for enhanced animations
  5951. defaultDate: null,
  5952. // Used when field is blank: actual date,
  5953. // +/-number for offset from today, null for today
  5954. appendText: "",
  5955. // Display text following the input box, e.g. showing the format
  5956. buttonText: "...",
  5957. // Text for trigger button
  5958. buttonImage: "",
  5959. // URL for trigger button image
  5960. buttonImageOnly: false,
  5961. // True if the image appears alone, false if it appears on a button
  5962. hideIfNoPrevNext: false,
  5963. // True to hide next/previous month links
  5964. // if not applicable, false to just disable them
  5965. navigationAsDateFormat: false,
  5966. // True if date formatting applied to prev/today/next links
  5967. gotoCurrent: false,
  5968. // True if today link goes back to current selection instead
  5969. changeMonth: false,
  5970. // True if month can be selected directly, false if only prev/next
  5971. changeYear: false,
  5972. // True if year can be selected directly, false if only prev/next
  5973. yearRange: "c-10:c+10",
  5974. // Range of years to display in drop-down,
  5975. // either relative to today's year (-nn:+nn), relative to currently displayed year
  5976. // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
  5977. showOtherMonths: false,
  5978. // True to show dates in other months, false to leave blank
  5979. selectOtherMonths: false,
  5980. // True to allow selection of dates in other months, false for unselectable
  5981. showWeek: false,
  5982. // True to show week of the year, false to not show it
  5983. calculateWeek: this.iso8601Week,
  5984. // How to calculate the week of the year,
  5985. // takes a Date and returns the number of the week for it
  5986. shortYearCutoff: "+10",
  5987. // Short year values < this are in the current century,
  5988. // > this are in the previous century,
  5989. // string value starting with "+" for current year + value
  5990. minDate: null,
  5991. // The earliest selectable date, or null for no limit
  5992. maxDate: null,
  5993. // The latest selectable date, or null for no limit
  5994. duration: "fast",
  5995. // Duration of display/closure
  5996. beforeShowDay: null,
  5997. // Function that takes a date and returns an array with
  5998. // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
  5999. // [2] = cell title (optional), e.g. $.datepicker.noWeekends
  6000. beforeShow: null,
  6001. // Function that takes an input field and
  6002. // returns a set of custom settings for the date picker
  6003. onSelect: null,
  6004. // Define a callback function when a date is selected
  6005. onChangeMonthYear: null,
  6006. // Define a callback function when the month or year is changed
  6007. onClose: null,
  6008. // Define a callback function when the datepicker is closed
  6009. onUpdateDatepicker: null,
  6010. // Define a callback function when the datepicker is updated
  6011. numberOfMonths: 1,
  6012. // Number of months to show at a time
  6013. showCurrentAtPos: 0,
  6014. // The position in multipe months at which to show the current month (starting at 0)
  6015. stepMonths: 1,
  6016. // Number of months to step back/forward
  6017. stepBigMonths: 12,
  6018. // Number of months to step back/forward for the big links
  6019. altField: "",
  6020. // Selector for an alternate field to store selected dates into
  6021. altFormat: "",
  6022. // The date format to use for the alternate field
  6023. constrainInput: true,
  6024. // The input is constrained by the current date format
  6025. showButtonPanel: false,
  6026. // True to show button panel, false to not show it
  6027. autoSize: false,
  6028. // True to size the input for the date format, false to leave as is
  6029. disabled: false // The initial disabled state
  6030. };
  6031. $.extend(this._defaults, this.regional[""]);
  6032. this.regional.en = $.extend(true, {}, this.regional[""]);
  6033. this.regional["en-US"] = $.extend(true, {}, this.regional.en);
  6034. this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"));
  6035. }
  6036. $.extend(Datepicker.prototype, {
  6037. /* Class name added to elements to indicate already configured with a date picker. */
  6038. markerClassName: "hasDatepicker",
  6039. //Keep track of the maximum number of rows displayed (see #7043)
  6040. maxRows: 4,
  6041. // TODO rename to "widget" when switching to widget factory
  6042. _widgetDatepicker: function () {
  6043. return this.dpDiv;
  6044. },
  6045. /* Override the default settings for all instances of the date picker.
  6046. * @param settings object - the new settings to use as defaults (anonymous object)
  6047. * @return the manager object
  6048. */
  6049. setDefaults: function (settings) {
  6050. datepicker_extendRemove(this._defaults, settings || {});
  6051. return this;
  6052. },
  6053. /* Attach the date picker to a jQuery selection.
  6054. * @param target element - the target input field or division or span
  6055. * @param settings object - the new settings to use for this date picker instance (anonymous)
  6056. */
  6057. _attachDatepicker: function (target, settings) {
  6058. var nodeName, inline, inst;
  6059. nodeName = target.nodeName.toLowerCase();
  6060. inline = (nodeName === "div" || nodeName === "span");
  6061. if (!target.id) {
  6062. this.uuid += 1;
  6063. target.id = "dp" + this.uuid;
  6064. }
  6065. inst = this._newInst($(target), inline);
  6066. inst.settings = $.extend({}, settings || {});
  6067. if (nodeName === "input") {
  6068. this._connectDatepicker(target, inst);
  6069. } else if (inline) {
  6070. this._inlineDatepicker(target, inst);
  6071. }
  6072. },
  6073. /* Create a new instance object. */
  6074. _newInst: function (target, inline) {
  6075. var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1");
  6076. // escape jQuery meta chars
  6077. return {
  6078. id: id,
  6079. input: target,
  6080. // associated target
  6081. selectedDay: 0,
  6082. selectedMonth: 0,
  6083. selectedYear: 0,
  6084. // current selection
  6085. drawMonth: 0,
  6086. drawYear: 0,
  6087. // month being drawn
  6088. inline: inline,
  6089. // is datepicker inline or not
  6090. dpDiv: (!inline ? this.dpDiv : // presentation div
  6091. datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")))
  6092. };
  6093. },
  6094. /* Attach the date picker to an input field. */
  6095. _connectDatepicker: function (target, inst) {
  6096. var input = $(target);
  6097. inst.append = $([]);
  6098. inst.trigger = $([]);
  6099. if (input.hasClass(this.markerClassName)) {
  6100. return;
  6101. }
  6102. this._attachments(input, inst);
  6103. input.addClass(this.markerClassName).on("keydown", this._doKeyDown).on("keypress", this._doKeyPress).on("keyup", this._doKeyUp);
  6104. this._autoSize(inst);
  6105. $.data(target, "datepicker", inst);
  6106. //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
  6107. if (inst.settings.disabled) {
  6108. this._disableDatepicker(target);
  6109. }
  6110. },
  6111. /* Make attachments based on settings. */
  6112. _attachments: function (input, inst) {
  6113. var showOn, buttonText, buttonImage, appendText = this._get(inst, "appendText"),
  6114. isRTL = this._get(inst, "isRTL");
  6115. if (inst.append) {
  6116. inst.append.remove();
  6117. }
  6118. if (appendText) {
  6119. inst.append = $("<span>").addClass(this._appendClass).text(appendText);
  6120. input[isRTL ? "before" : "after"](inst.append);
  6121. }
  6122. input.off("focus", this._showDatepicker);
  6123. if (inst.trigger) {
  6124. inst.trigger.remove();
  6125. }
  6126. showOn = this._get(inst, "showOn");
  6127. if (showOn === "focus" || showOn === "both") {
  6128. // pop-up date picker when in the marked field
  6129. input.on("focus", this._showDatepicker);
  6130. }
  6131. if (showOn === "button" || showOn === "both") {
  6132. // pop-up date picker when button clicked
  6133. buttonText = this._get(inst, "buttonText");
  6134. buttonImage = this._get(inst, "buttonImage");
  6135. if (this._get(inst, "buttonImageOnly")) {
  6136. inst.trigger = $("<img>").addClass(this._triggerClass).attr({
  6137. src: buttonImage,
  6138. alt: buttonText,
  6139. title: buttonText
  6140. });
  6141. } else {
  6142. inst.trigger = $("<button type='button'>").addClass(this._triggerClass);
  6143. if (buttonImage) {
  6144. inst.trigger.html($("<img>").attr({
  6145. src: buttonImage,
  6146. alt: buttonText,
  6147. title: buttonText
  6148. }));
  6149. } else {
  6150. inst.trigger.text(buttonText);
  6151. }
  6152. }
  6153. input[isRTL ? "before" : "after"](inst.trigger);
  6154. inst.trigger.on("click", function () {
  6155. if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) {
  6156. $.datepicker._hideDatepicker();
  6157. } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) {
  6158. $.datepicker._hideDatepicker();
  6159. $.datepicker._showDatepicker(input[0]);
  6160. } else {
  6161. $.datepicker._showDatepicker(input[0]);
  6162. }
  6163. return false;
  6164. });
  6165. }
  6166. },
  6167. /* Apply the maximum length for the date format. */
  6168. _autoSize: function (inst) {
  6169. if (this._get(inst, "autoSize") && !inst.inline) {
  6170. var findMax, max, maxI, i, date = new Date(2009, 12 - 1, 20), // Ensure double digits
  6171. dateFormat = this._get(inst, "dateFormat");
  6172. if (dateFormat.match(/[DM]/)) {
  6173. findMax = function (names) {
  6174. max = 0;
  6175. maxI = 0;
  6176. for (i = 0; i < names.length; i++) {
  6177. if (names[i].length > max) {
  6178. max = names[i].length;
  6179. maxI = i;
  6180. }
  6181. }
  6182. return maxI;
  6183. }
  6184. ;
  6185. date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? "monthNames" : "monthNamesShort"))));
  6186. date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? "dayNames" : "dayNamesShort"))) + 20 - date.getDay());
  6187. }
  6188. inst.input.attr("size", this._formatDate(inst, date).length);
  6189. }
  6190. },
  6191. /* Attach an inline date picker to a div. */
  6192. _inlineDatepicker: function (target, inst) {
  6193. var divSpan = $(target);
  6194. if (divSpan.hasClass(this.markerClassName)) {
  6195. return;
  6196. }
  6197. divSpan.addClass(this.markerClassName).append(inst.dpDiv);
  6198. $.data(target, "datepicker", inst);
  6199. this._setDate(inst, this._getDefaultDate(inst), true);
  6200. this._updateDatepicker(inst);
  6201. this._updateAlternate(inst);
  6202. //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
  6203. if (inst.settings.disabled) {
  6204. this._disableDatepicker(target);
  6205. }
  6206. // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
  6207. // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
  6208. inst.dpDiv.css("display", "block");
  6209. },
  6210. /* Pop-up the date picker in a "dialog" box.
  6211. * @param input element - ignored
  6212. * @param date string or Date - the initial date to display
  6213. * @param onSelect function - the function to call when a date is selected
  6214. * @param settings object - update the dialog date picker instance's settings (anonymous object)
  6215. * @param pos int[2] - coordinates for the dialog's position within the screen or
  6216. * event - with x/y coordinates or
  6217. * leave empty for default (screen centre)
  6218. * @return the manager object
  6219. */
  6220. _dialogDatepicker: function (input, date, onSelect, settings, pos) {
  6221. var id, browserWidth, browserHeight, scrollX, scrollY, inst = this._dialogInst;
  6222. // internal instance
  6223. if (!inst) {
  6224. this.uuid += 1;
  6225. id = "dp" + this.uuid;
  6226. this._dialogInput = $("<input type='text' id='" + id + "' style='position: absolute; top: -100px; width: 0px;'/>");
  6227. this._dialogInput.on("keydown", this._doKeyDown);
  6228. $("body").append(this._dialogInput);
  6229. inst = this._dialogInst = this._newInst(this._dialogInput, false);
  6230. inst.settings = {};
  6231. $.data(this._dialogInput[0], "datepicker", inst);
  6232. }
  6233. datepicker_extendRemove(inst.settings, settings || {});
  6234. date = (date && date.constructor === Date ? this._formatDate(inst, date) : date);
  6235. this._dialogInput.val(date);
  6236. this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
  6237. if (!this._pos) {
  6238. browserWidth = document.documentElement.clientWidth;
  6239. browserHeight = document.documentElement.clientHeight;
  6240. scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
  6241. scrollY = document.documentElement.scrollTop || document.body.scrollTop;
  6242. this._pos = // should use actual width/height below
  6243. [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
  6244. }
  6245. // Move input on screen for focus, but hidden behind dialog
  6246. this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px");
  6247. inst.settings.onSelect = onSelect;
  6248. this._inDialog = true;
  6249. this.dpDiv.addClass(this._dialogClass);
  6250. this._showDatepicker(this._dialogInput[0]);
  6251. if ($.blockUI) {
  6252. $.blockUI(this.dpDiv);
  6253. }
  6254. $.data(this._dialogInput[0], "datepicker", inst);
  6255. return this;
  6256. },
  6257. /* Detach a datepicker from its control.
  6258. * @param target element - the target input field or division or span
  6259. */
  6260. _destroyDatepicker: function (target) {
  6261. var nodeName, $target = $(target), inst = $.data(target, "datepicker");
  6262. if (!$target.hasClass(this.markerClassName)) {
  6263. return;
  6264. }
  6265. nodeName = target.nodeName.toLowerCase();
  6266. $.removeData(target, "datepicker");
  6267. if (nodeName === "input") {
  6268. inst.append.remove();
  6269. inst.trigger.remove();
  6270. $target.removeClass(this.markerClassName).off("focus", this._showDatepicker).off("keydown", this._doKeyDown).off("keypress", this._doKeyPress).off("keyup", this._doKeyUp);
  6271. } else if (nodeName === "div" || nodeName === "span") {
  6272. $target.removeClass(this.markerClassName).empty();
  6273. }
  6274. if (datepicker_instActive === inst) {
  6275. datepicker_instActive = null;
  6276. this._curInst = null;
  6277. }
  6278. },
  6279. /* Enable the date picker to a jQuery selection.
  6280. * @param target element - the target input field or division or span
  6281. */
  6282. _enableDatepicker: function (target) {
  6283. var nodeName, inline, $target = $(target), inst = $.data(target, "datepicker");
  6284. if (!$target.hasClass(this.markerClassName)) {
  6285. return;
  6286. }
  6287. nodeName = target.nodeName.toLowerCase();
  6288. if (nodeName === "input") {
  6289. target.disabled = false;
  6290. inst.trigger.filter("button").each(function () {
  6291. this.disabled = false;
  6292. }).end().filter("img").css({
  6293. opacity: "1.0",
  6294. cursor: ""
  6295. });
  6296. } else if (nodeName === "div" || nodeName === "span") {
  6297. inline = $target.children("." + this._inlineClass);
  6298. inline.children().removeClass("ui-state-disabled");
  6299. inline.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled", false);
  6300. }
  6301. this._disabledInputs = $.map(this._disabledInputs,
  6302. // Delete entry
  6303. function (value) {
  6304. return (value === target ? null : value);
  6305. });
  6306. },
  6307. /* Disable the date picker to a jQuery selection.
  6308. * @param target element - the target input field or division or span
  6309. */
  6310. _disableDatepicker: function (target) {
  6311. var nodeName, inline, $target = $(target), inst = $.data(target, "datepicker");
  6312. if (!$target.hasClass(this.markerClassName)) {
  6313. return;
  6314. }
  6315. nodeName = target.nodeName.toLowerCase();
  6316. if (nodeName === "input") {
  6317. target.disabled = true;
  6318. inst.trigger.filter("button").each(function () {
  6319. this.disabled = true;
  6320. }).end().filter("img").css({
  6321. opacity: "0.5",
  6322. cursor: "default"
  6323. });
  6324. } else if (nodeName === "div" || nodeName === "span") {
  6325. inline = $target.children("." + this._inlineClass);
  6326. inline.children().addClass("ui-state-disabled");
  6327. inline.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled", true);
  6328. }
  6329. this._disabledInputs = $.map(this._disabledInputs,
  6330. // Delete entry
  6331. function (value) {
  6332. return (value === target ? null : value);
  6333. });
  6334. this._disabledInputs[this._disabledInputs.length] = target;
  6335. },
  6336. /* Is the first field in a jQuery collection disabled as a datepicker?
  6337. * @param target element - the target input field or division or span
  6338. * @return boolean - true if disabled, false if enabled
  6339. */
  6340. _isDisabledDatepicker: function (target) {
  6341. if (!target) {
  6342. return false;
  6343. }
  6344. for (var i = 0; i < this._disabledInputs.length; i++) {
  6345. if (this._disabledInputs[i] === target) {
  6346. return true;
  6347. }
  6348. }
  6349. return false;
  6350. },
  6351. /* Retrieve the instance data for the target control.
  6352. * @param target element - the target input field or division or span
  6353. * @return object - the associated instance data
  6354. * @throws error if a jQuery problem getting data
  6355. */
  6356. _getInst: function (target) {
  6357. try {
  6358. return $.data(target, "datepicker");
  6359. } catch (err) {
  6360. throw "Missing instance data for this datepicker";
  6361. }
  6362. },
  6363. /* Update or retrieve the settings for a date picker attached to an input field or division.
  6364. * @param target element - the target input field or division or span
  6365. * @param name object - the new settings to update or
  6366. * string - the name of the setting to change or retrieve,
  6367. * when retrieving also "all" for all instance settings or
  6368. * "defaults" for all global defaults
  6369. * @param value any - the new value for the setting
  6370. * (omit if above is an object or to retrieve a value)
  6371. */
  6372. _optionDatepicker: function (target, name, value) {
  6373. var settings, date, minDate, maxDate, inst = this._getInst(target);
  6374. if (arguments.length === 2 && typeof name === "string") {
  6375. return (name === "defaults" ? $.extend({}, $.datepicker._defaults) : (inst ? (name === "all" ? $.extend({}, inst.settings) : this._get(inst, name)) : null));
  6376. }
  6377. settings = name || {};
  6378. if (typeof name === "string") {
  6379. settings = {};
  6380. settings[name] = value;
  6381. }
  6382. if (inst) {
  6383. if (this._curInst === inst) {
  6384. this._hideDatepicker();
  6385. }
  6386. date = this._getDateDatepicker(target, true);
  6387. minDate = this._getMinMaxDate(inst, "min");
  6388. maxDate = this._getMinMaxDate(inst, "max");
  6389. datepicker_extendRemove(inst.settings, settings);
  6390. // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
  6391. if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) {
  6392. inst.settings.minDate = this._formatDate(inst, minDate);
  6393. }
  6394. if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) {
  6395. inst.settings.maxDate = this._formatDate(inst, maxDate);
  6396. }
  6397. if ("disabled" in settings) {
  6398. if (settings.disabled) {
  6399. this._disableDatepicker(target);
  6400. } else {
  6401. this._enableDatepicker(target);
  6402. }
  6403. }
  6404. this._attachments($(target), inst);
  6405. this._autoSize(inst);
  6406. this._setDate(inst, date);
  6407. this._updateAlternate(inst);
  6408. this._updateDatepicker(inst);
  6409. }
  6410. },
  6411. // Change method deprecated
  6412. _changeDatepicker: function (target, name, value) {
  6413. this._optionDatepicker(target, name, value);
  6414. },
  6415. /* Redraw the date picker attached to an input field or division.
  6416. * @param target element - the target input field or division or span
  6417. */
  6418. _refreshDatepicker: function (target) {
  6419. var inst = this._getInst(target);
  6420. if (inst) {
  6421. this._updateDatepicker(inst);
  6422. }
  6423. },
  6424. /* Set the dates for a jQuery selection.
  6425. * @param target element - the target input field or division or span
  6426. * @param date Date - the new date
  6427. */
  6428. _setDateDatepicker: function (target, date) {
  6429. var inst = this._getInst(target);
  6430. if (inst) {
  6431. this._setDate(inst, date);
  6432. this._updateDatepicker(inst);
  6433. this._updateAlternate(inst);
  6434. }
  6435. },
  6436. /* Get the date(s) for the first entry in a jQuery selection.
  6437. * @param target element - the target input field or division or span
  6438. * @param noDefault boolean - true if no default date is to be used
  6439. * @return Date - the current date
  6440. */
  6441. _getDateDatepicker: function (target, noDefault) {
  6442. var inst = this._getInst(target);
  6443. if (inst && !inst.inline) {
  6444. this._setDateFromField(inst, noDefault);
  6445. }
  6446. return (inst ? this._getDate(inst) : null);
  6447. },
  6448. /* Handle keystrokes. */
  6449. _doKeyDown: function (event) {
  6450. var onSelect, dateStr, sel, inst = $.datepicker._getInst(event.target), handled = true,
  6451. isRTL = inst.dpDiv.is(".ui-datepicker-rtl");
  6452. inst._keyEvent = true;
  6453. if ($.datepicker._datepickerShowing) {
  6454. switch (event.keyCode) {
  6455. case 9:
  6456. $.datepicker._hideDatepicker();
  6457. handled = false;
  6458. break;
  6459. // hide on tab out
  6460. case 13:
  6461. sel = $("td." + $.datepicker._dayOverClass + ":not(." + $.datepicker._currentClass + ")", inst.dpDiv);
  6462. if (sel[0]) {
  6463. $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
  6464. }
  6465. onSelect = $.datepicker._get(inst, "onSelect");
  6466. if (onSelect) {
  6467. dateStr = $.datepicker._formatDate(inst);
  6468. // Trigger custom callback
  6469. onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
  6470. } else {
  6471. $.datepicker._hideDatepicker();
  6472. }
  6473. return false;
  6474. // don't submit the form
  6475. case 27:
  6476. $.datepicker._hideDatepicker();
  6477. break;
  6478. // hide on escape
  6479. case 33:
  6480. $.datepicker._adjustDate(event.target, (event.ctrlKey ? -$.datepicker._get(inst, "stepBigMonths") : -$.datepicker._get(inst, "stepMonths")), "M");
  6481. break;
  6482. // previous month/year on page up/+ ctrl
  6483. case 34:
  6484. $.datepicker._adjustDate(event.target, (event.ctrlKey ? +$.datepicker._get(inst, "stepBigMonths") : +$.datepicker._get(inst, "stepMonths")), "M");
  6485. break;
  6486. // next month/year on page down/+ ctrl
  6487. case 35:
  6488. if (event.ctrlKey || event.metaKey) {
  6489. $.datepicker._clearDate(event.target);
  6490. }
  6491. handled = event.ctrlKey || event.metaKey;
  6492. break;
  6493. // clear on ctrl or command +end
  6494. case 36:
  6495. if (event.ctrlKey || event.metaKey) {
  6496. $.datepicker._gotoToday(event.target);
  6497. }
  6498. handled = event.ctrlKey || event.metaKey;
  6499. break;
  6500. // current on ctrl or command +home
  6501. case 37:
  6502. if (event.ctrlKey || event.metaKey) {
  6503. $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D");
  6504. }
  6505. handled = event.ctrlKey || event.metaKey;
  6506. // -1 day on ctrl or command +left
  6507. if (event.originalEvent.altKey) {
  6508. $.datepicker._adjustDate(event.target, (event.ctrlKey ? -$.datepicker._get(inst, "stepBigMonths") : -$.datepicker._get(inst, "stepMonths")), "M");
  6509. }
  6510. // next month/year on alt +left on Mac
  6511. break;
  6512. case 38:
  6513. if (event.ctrlKey || event.metaKey) {
  6514. $.datepicker._adjustDate(event.target, -7, "D");
  6515. }
  6516. handled = event.ctrlKey || event.metaKey;
  6517. break;
  6518. // -1 week on ctrl or command +up
  6519. case 39:
  6520. if (event.ctrlKey || event.metaKey) {
  6521. $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D");
  6522. }
  6523. handled = event.ctrlKey || event.metaKey;
  6524. // +1 day on ctrl or command +right
  6525. if (event.originalEvent.altKey) {
  6526. $.datepicker._adjustDate(event.target, (event.ctrlKey ? +$.datepicker._get(inst, "stepBigMonths") : +$.datepicker._get(inst, "stepMonths")), "M");
  6527. }
  6528. // next month/year on alt +right
  6529. break;
  6530. case 40:
  6531. if (event.ctrlKey || event.metaKey) {
  6532. $.datepicker._adjustDate(event.target, +7, "D");
  6533. }
  6534. handled = event.ctrlKey || event.metaKey;
  6535. break;
  6536. // +1 week on ctrl or command +down
  6537. default:
  6538. handled = false;
  6539. }
  6540. } else if (event.keyCode === 36 && event.ctrlKey) {
  6541. // display the date picker on ctrl+home
  6542. $.datepicker._showDatepicker(this);
  6543. } else {
  6544. handled = false;
  6545. }
  6546. if (handled) {
  6547. event.preventDefault();
  6548. event.stopPropagation();
  6549. }
  6550. },
  6551. /* Filter entered characters - based on date format. */
  6552. _doKeyPress: function (event) {
  6553. var chars, chr, inst = $.datepicker._getInst(event.target);
  6554. if ($.datepicker._get(inst, "constrainInput")) {
  6555. chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat"));
  6556. chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode);
  6557. return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1);
  6558. }
  6559. },
  6560. /* Synchronise manual entry and field/alternate field. */
  6561. _doKeyUp: function (event) {
  6562. var date, inst = $.datepicker._getInst(event.target);
  6563. if (inst.input.val() !== inst.lastVal) {
  6564. try {
  6565. date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), (inst.input ? inst.input.val() : null), $.datepicker._getFormatConfig(inst));
  6566. if (date) {
  6567. // only if valid
  6568. $.datepicker._setDateFromField(inst);
  6569. $.datepicker._updateAlternate(inst);
  6570. $.datepicker._updateDatepicker(inst);
  6571. }
  6572. } catch (err) {
  6573. }
  6574. }
  6575. return true;
  6576. },
  6577. /* Pop-up the date picker for a given input field.
  6578. * If false returned from beforeShow event handler do not show.
  6579. * @param input element - the input field attached to the date picker or
  6580. * event - if triggered by focus
  6581. */
  6582. _showDatepicker: function (input) {
  6583. input = input.target || input;
  6584. if (input.nodeName.toLowerCase() !== "input") {
  6585. // find from button/image trigger
  6586. input = $("input", input.parentNode)[0];
  6587. }
  6588. if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) {
  6589. // already here
  6590. return;
  6591. }
  6592. var inst, beforeShow, beforeShowSettings, isFixed, offset, showAnim, duration;
  6593. inst = $.datepicker._getInst(input);
  6594. if ($.datepicker._curInst && $.datepicker._curInst !== inst) {
  6595. $.datepicker._curInst.dpDiv.stop(true, true);
  6596. if (inst && $.datepicker._datepickerShowing) {
  6597. $.datepicker._hideDatepicker($.datepicker._curInst.input[0]);
  6598. }
  6599. }
  6600. beforeShow = $.datepicker._get(inst, "beforeShow");
  6601. beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
  6602. if (beforeShowSettings === false) {
  6603. return;
  6604. }
  6605. datepicker_extendRemove(inst.settings, beforeShowSettings);
  6606. inst.lastVal = null;
  6607. $.datepicker._lastInput = input;
  6608. $.datepicker._setDateFromField(inst);
  6609. if ($.datepicker._inDialog) {
  6610. // hide cursor
  6611. input.value = "";
  6612. }
  6613. if (!$.datepicker._pos) {
  6614. // position below input
  6615. $.datepicker._pos = $.datepicker._findPos(input);
  6616. $.datepicker._pos[1] += input.offsetHeight;
  6617. // add the height
  6618. }
  6619. isFixed = false;
  6620. $(input).parents().each(function () {
  6621. isFixed |= $(this).css("position") === "fixed";
  6622. return !isFixed;
  6623. });
  6624. offset = {
  6625. left: $.datepicker._pos[0],
  6626. top: $.datepicker._pos[1]
  6627. };
  6628. $.datepicker._pos = null;
  6629. //to avoid flashes on Firefox
  6630. inst.dpDiv.empty();
  6631. // determine sizing offscreen
  6632. inst.dpDiv.css({
  6633. position: "absolute",
  6634. display: "block",
  6635. top: "-1000px"
  6636. });
  6637. $.datepicker._updateDatepicker(inst);
  6638. // fix width for dynamic number of date pickers
  6639. // and adjust position before showing
  6640. offset = $.datepicker._checkOffset(inst, offset, isFixed);
  6641. inst.dpDiv.css({
  6642. position: ($.datepicker._inDialog && $.blockUI ? "static" : (isFixed ? "fixed" : "absolute")),
  6643. display: "none",
  6644. left: offset.left + "px",
  6645. top: offset.top + "px"
  6646. });
  6647. if (!inst.inline) {
  6648. showAnim = $.datepicker._get(inst, "showAnim");
  6649. duration = $.datepicker._get(inst, "duration");
  6650. inst.dpDiv.css("z-index", datepicker_getZindex($(input)) + 1);
  6651. $.datepicker._datepickerShowing = true;
  6652. if ($.effects && $.effects.effect[showAnim]) {
  6653. inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration);
  6654. } else {
  6655. inst.dpDiv[showAnim || "show"](showAnim ? duration : null);
  6656. }
  6657. if ($.datepicker._shouldFocusInput(inst)) {
  6658. inst.input.trigger("focus");
  6659. }
  6660. $.datepicker._curInst = inst;
  6661. }
  6662. },
  6663. /* Generate the date picker content. */
  6664. _updateDatepicker: function (inst) {
  6665. this.maxRows = 4;
  6666. //Reset the max number of rows being displayed (see #7043)
  6667. datepicker_instActive = inst;
  6668. // for delegate hover events
  6669. inst.dpDiv.empty().append(this._generateHTML(inst));
  6670. this._attachHandlers(inst);
  6671. var origyearshtml, numMonths = this._getNumberOfMonths(inst), cols = numMonths[1], width = 17,
  6672. activeCell = inst.dpDiv.find("." + this._dayOverClass + " a"),
  6673. onUpdateDatepicker = $.datepicker._get(inst, "onUpdateDatepicker");
  6674. if (activeCell.length > 0) {
  6675. datepicker_handleMouseover.apply(activeCell.get(0));
  6676. }
  6677. inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");
  6678. if (cols > 1) {
  6679. inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em");
  6680. }
  6681. inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") + "Class"]("ui-datepicker-multi");
  6682. inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") + "Class"]("ui-datepicker-rtl");
  6683. if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput(inst)) {
  6684. inst.input.trigger("focus");
  6685. }
  6686. // Deffered render of the years select (to avoid flashes on Firefox)
  6687. if (inst.yearshtml) {
  6688. origyearshtml = inst.yearshtml;
  6689. setTimeout(function () {
  6690. //assure that inst.yearshtml didn't change.
  6691. if (origyearshtml === inst.yearshtml && inst.yearshtml) {
  6692. inst.dpDiv.find("select.ui-datepicker-year").first().replaceWith(inst.yearshtml);
  6693. }
  6694. origyearshtml = inst.yearshtml = null;
  6695. }, 0);
  6696. }
  6697. if (onUpdateDatepicker) {
  6698. onUpdateDatepicker.apply((inst.input ? inst.input[0] : null), [inst]);
  6699. }
  6700. },
  6701. // #6694 - don't focus the input if it's already focused
  6702. // this breaks the change event in IE
  6703. // Support: IE and jQuery <1.9
  6704. _shouldFocusInput: function (inst) {
  6705. return inst.input && inst.input.is(":visible") && !inst.input.is(":disabled") && !inst.input.is(":focus");
  6706. },
  6707. /* Check positioning to remain on screen. */
  6708. _checkOffset: function (inst, offset, isFixed) {
  6709. var dpWidth = inst.dpDiv.outerWidth()
  6710. , dpHeight = inst.dpDiv.outerHeight()
  6711. , inputWidth = inst.input ? inst.input.outerWidth() : 0
  6712. , inputHeight = inst.input ? inst.input.outerHeight() : 0
  6713. , viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft())
  6714. , viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop());
  6715. offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0);
  6716. offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0;
  6717. offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
  6718. // Now check if datepicker is showing outside window viewport - move to a better place if so.
  6719. offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? Math.abs(offset.left + dpWidth - viewWidth) : 0);
  6720. offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? Math.abs(dpHeight + inputHeight) : 0);
  6721. return offset;
  6722. },
  6723. /* Find an object's position on the screen. */
  6724. _findPos: function (obj) {
  6725. var position, inst = this._getInst(obj), isRTL = this._get(inst, "isRTL");
  6726. while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.pseudos.hidden(obj))) {
  6727. obj = obj[isRTL ? "previousSibling" : "nextSibling"];
  6728. }
  6729. position = $(obj).offset();
  6730. return [position.left, position.top];
  6731. },
  6732. /* Hide the date picker from view.
  6733. * @param input element - the input field attached to the date picker
  6734. */
  6735. _hideDatepicker: function (input) {
  6736. var showAnim, duration, postProcess, onClose, inst = this._curInst;
  6737. if (!inst || (input && inst !== $.data(input, "datepicker"))) {
  6738. return;
  6739. }
  6740. if (this._datepickerShowing) {
  6741. showAnim = this._get(inst, "showAnim");
  6742. duration = this._get(inst, "duration");
  6743. postProcess = function () {
  6744. $.datepicker._tidyDialog(inst);
  6745. }
  6746. ;
  6747. // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
  6748. if ($.effects && ($.effects.effect[showAnim] || $.effects[showAnim])) {
  6749. inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess);
  6750. } else {
  6751. inst.dpDiv[(showAnim === "slideDown" ? "slideUp" : (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess);
  6752. }
  6753. if (!showAnim) {
  6754. postProcess();
  6755. }
  6756. this._datepickerShowing = false;
  6757. onClose = this._get(inst, "onClose");
  6758. if (onClose) {
  6759. onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]);
  6760. }
  6761. this._lastInput = null;
  6762. if (this._inDialog) {
  6763. this._dialogInput.css({
  6764. position: "absolute",
  6765. left: "0",
  6766. top: "-100px"
  6767. });
  6768. if ($.blockUI) {
  6769. $.unblockUI();
  6770. $("body").append(this.dpDiv);
  6771. }
  6772. }
  6773. this._inDialog = false;
  6774. }
  6775. },
  6776. /* Tidy up after a dialog display. */
  6777. _tidyDialog: function (inst) {
  6778. inst.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar");
  6779. },
  6780. /* Close date picker if clicked elsewhere. */
  6781. _checkExternalClick: function (event) {
  6782. if (!$.datepicker._curInst) {
  6783. return;
  6784. }
  6785. var $target = $(event.target)
  6786. , inst = $.datepicker._getInst($target[0]);
  6787. if ((($target[0].id !== $.datepicker._mainDivId && $target.parents("#" + $.datepicker._mainDivId).length === 0 && !$target.hasClass($.datepicker.markerClassName) && !$target.closest("." + $.datepicker._triggerClass).length && $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))) || ($target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst)) {
  6788. $.datepicker._hideDatepicker();
  6789. }
  6790. },
  6791. /* Adjust one of the date sub-fields. */
  6792. _adjustDate: function (id, offset, period) {
  6793. var target = $(id)
  6794. , inst = this._getInst(target[0]);
  6795. if (this._isDisabledDatepicker(target[0])) {
  6796. return;
  6797. }
  6798. this._adjustInstDate(inst, offset, period);
  6799. this._updateDatepicker(inst);
  6800. },
  6801. /* Action for current link. */
  6802. _gotoToday: function (id) {
  6803. var date, target = $(id), inst = this._getInst(target[0]);
  6804. if (this._get(inst, "gotoCurrent") && inst.currentDay) {
  6805. inst.selectedDay = inst.currentDay;
  6806. inst.drawMonth = inst.selectedMonth = inst.currentMonth;
  6807. inst.drawYear = inst.selectedYear = inst.currentYear;
  6808. } else {
  6809. date = new Date();
  6810. inst.selectedDay = date.getDate();
  6811. inst.drawMonth = inst.selectedMonth = date.getMonth();
  6812. inst.drawYear = inst.selectedYear = date.getFullYear();
  6813. }
  6814. this._notifyChange(inst);
  6815. this._adjustDate(target);
  6816. },
  6817. /* Action for selecting a new month/year. */
  6818. _selectMonthYear: function (id, select, period) {
  6819. var target = $(id)
  6820. , inst = this._getInst(target[0]);
  6821. inst["selected" + (period === "M" ? "Month" : "Year")] = inst["draw" + (period === "M" ? "Month" : "Year")] = parseInt(select.options[select.selectedIndex].value, 10);
  6822. this._notifyChange(inst);
  6823. this._adjustDate(target);
  6824. },
  6825. /* Action for selecting a day. */
  6826. _selectDay: function (id, month, year, td) {
  6827. var inst, target = $(id);
  6828. if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
  6829. return;
  6830. }
  6831. inst = this._getInst(target[0]);
  6832. inst.selectedDay = inst.currentDay = parseInt($("a", td).attr("data-date"));
  6833. inst.selectedMonth = inst.currentMonth = month;
  6834. inst.selectedYear = inst.currentYear = year;
  6835. this._selectDate(id, this._formatDate(inst, inst.currentDay, inst.currentMonth, inst.currentYear));
  6836. },
  6837. /* Erase the input field and hide the date picker. */
  6838. _clearDate: function (id) {
  6839. var target = $(id);
  6840. this._selectDate(target, "");
  6841. },
  6842. /* Update the input field with the selected date. */
  6843. _selectDate: function (id, dateStr) {
  6844. var onSelect, target = $(id), inst = this._getInst(target[0]);
  6845. dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
  6846. if (inst.input) {
  6847. inst.input.val(dateStr);
  6848. }
  6849. this._updateAlternate(inst);
  6850. onSelect = this._get(inst, "onSelect");
  6851. if (onSelect) {
  6852. onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
  6853. // trigger custom callback
  6854. } else if (inst.input) {
  6855. inst.input.trigger("change");
  6856. // fire the change event
  6857. }
  6858. if (inst.inline) {
  6859. this._updateDatepicker(inst);
  6860. } else {
  6861. this._hideDatepicker();
  6862. this._lastInput = inst.input[0];
  6863. if (typeof (inst.input[0]) !== "object") {
  6864. inst.input.trigger("focus");
  6865. // restore focus
  6866. }
  6867. this._lastInput = null;
  6868. }
  6869. },
  6870. /* Update any alternate field to synchronise with the main field. */
  6871. _updateAlternate: function (inst) {
  6872. var altFormat, date, dateStr, altField = this._get(inst, "altField");
  6873. if (altField) {
  6874. // update alternate field too
  6875. altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat");
  6876. date = this._getDate(inst);
  6877. dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
  6878. $(document).find(altField).val(dateStr);
  6879. }
  6880. },
  6881. /* Set as beforeShowDay function to prevent selection of weekends.
  6882. * @param date Date - the date to customise
  6883. * @return [boolean, string] - is this date selectable?, what is its CSS class?
  6884. */
  6885. noWeekends: function (date) {
  6886. var day = date.getDay();
  6887. return [(day > 0 && day < 6), ""];
  6888. },
  6889. /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
  6890. * @param date Date - the date to get the week for
  6891. * @return number - the number of the week within the year that contains this date
  6892. */
  6893. iso8601Week: function (date) {
  6894. var time, checkDate = new Date(date.getTime());
  6895. // Find Thursday of this week starting on Monday
  6896. checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
  6897. time = checkDate.getTime();
  6898. checkDate.setMonth(0);
  6899. // Compare with Jan 1
  6900. checkDate.setDate(1);
  6901. return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
  6902. },
  6903. /* Parse a string value into a date object.
  6904. * See formatDate below for the possible formats.
  6905. *
  6906. * @param format string - the expected format of the date
  6907. * @param value string - the date in the above format
  6908. * @param settings Object - attributes include:
  6909. * shortYearCutoff number - the cutoff year for determining the century (optional)
  6910. * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
  6911. * dayNames string[7] - names of the days from Sunday (optional)
  6912. * monthNamesShort string[12] - abbreviated names of the months (optional)
  6913. * monthNames string[12] - names of the months (optional)
  6914. * @return Date - the extracted date value or null if value is blank
  6915. */
  6916. parseDate: function (format, value, settings) {
  6917. if (format == null || value == null) {
  6918. throw "Invalid arguments";
  6919. }
  6920. value = (typeof value === "object" ? value.toString() : value + "");
  6921. if (value === "") {
  6922. return null;
  6923. }
  6924. var iFormat, dim, extra, iValue = 0,
  6925. shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff,
  6926. shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp : new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)),
  6927. dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
  6928. dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
  6929. monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
  6930. monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, year = -1,
  6931. month = -1, day = -1, doy = -1, literal = false, date,
  6932. // Check whether a format character is doubled
  6933. lookAhead = function (match) {
  6934. var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
  6935. if (matches) {
  6936. iFormat++;
  6937. }
  6938. return matches;
  6939. },
  6940. // Extract a number from the string value
  6941. getNumber = function (match) {
  6942. var isDoubled = lookAhead(match)
  6943. ,
  6944. size = (match === "@" ? 14 : (match === "!" ? 20 : (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2))))
  6945. , minSize = (match === "y" ? size : 1)
  6946. , digits = new RegExp("^\\d{" + minSize + "," + size + "}")
  6947. , num = value.substring(iValue).match(digits);
  6948. if (!num) {
  6949. throw "Missing number at position " + iValue;
  6950. }
  6951. iValue += num[0].length;
  6952. return parseInt(num[0], 10);
  6953. },
  6954. // Extract a name from the string value and convert to an index
  6955. getName = function (match, shortNames, longNames) {
  6956. var index = -1
  6957. , names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
  6958. return [[k, v]];
  6959. }).sort(function (a, b) {
  6960. return -(a[1].length - b[1].length);
  6961. });
  6962. $.each(names, function (i, pair) {
  6963. var name = pair[1];
  6964. if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) {
  6965. index = pair[0];
  6966. iValue += name.length;
  6967. return false;
  6968. }
  6969. });
  6970. if (index !== -1) {
  6971. return index + 1;
  6972. } else {
  6973. throw "Unknown name at position " + iValue;
  6974. }
  6975. },
  6976. // Confirm that a literal character matches the string value
  6977. checkLiteral = function () {
  6978. if (value.charAt(iValue) !== format.charAt(iFormat)) {
  6979. throw "Unexpected literal at position " + iValue;
  6980. }
  6981. iValue++;
  6982. };
  6983. for (iFormat = 0; iFormat < format.length; iFormat++) {
  6984. if (literal) {
  6985. if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
  6986. literal = false;
  6987. } else {
  6988. checkLiteral();
  6989. }
  6990. } else {
  6991. switch (format.charAt(iFormat)) {
  6992. case "d":
  6993. day = getNumber("d");
  6994. break;
  6995. case "D":
  6996. getName("D", dayNamesShort, dayNames);
  6997. break;
  6998. case "o":
  6999. doy = getNumber("o");
  7000. break;
  7001. case "m":
  7002. month = getNumber("m");
  7003. break;
  7004. case "M":
  7005. month = getName("M", monthNamesShort, monthNames);
  7006. break;
  7007. case "y":
  7008. year = getNumber("y");
  7009. break;
  7010. case "@":
  7011. date = new Date(getNumber("@"));
  7012. year = date.getFullYear();
  7013. month = date.getMonth() + 1;
  7014. day = date.getDate();
  7015. break;
  7016. case "!":
  7017. date = new Date((getNumber("!") - this._ticksTo1970) / 10000);
  7018. year = date.getFullYear();
  7019. month = date.getMonth() + 1;
  7020. day = date.getDate();
  7021. break;
  7022. case "'":
  7023. if (lookAhead("'")) {
  7024. checkLiteral();
  7025. } else {
  7026. literal = true;
  7027. }
  7028. break;
  7029. default:
  7030. checkLiteral();
  7031. }
  7032. }
  7033. }
  7034. if (iValue < value.length) {
  7035. extra = value.substr(iValue);
  7036. if (!/^\s+/.test(extra)) {
  7037. throw "Extra/unparsed characters found in date: " + extra;
  7038. }
  7039. }
  7040. if (year === -1) {
  7041. year = new Date().getFullYear();
  7042. } else if (year < 100) {
  7043. year += new Date().getFullYear() - new Date().getFullYear() % 100 + (year <= shortYearCutoff ? 0 : -100);
  7044. }
  7045. if (doy > -1) {
  7046. month = 1;
  7047. day = doy;
  7048. do {
  7049. dim = this._getDaysInMonth(year, month - 1);
  7050. if (day <= dim) {
  7051. break;
  7052. }
  7053. month++;
  7054. day -= dim;
  7055. } while (true);
  7056. }
  7057. date = this._daylightSavingAdjust(new Date(year, month - 1, day));
  7058. if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) {
  7059. throw "Invalid date";
  7060. // E.g. 31/02/00
  7061. }
  7062. return date;
  7063. },
  7064. /* Standard date formats. */
  7065. ATOM: "yy-mm-dd",
  7066. // RFC 3339 (ISO 8601)
  7067. COOKIE: "D, dd M yy",
  7068. ISO_8601: "yy-mm-dd",
  7069. RFC_822: "D, d M y",
  7070. RFC_850: "DD, dd-M-y",
  7071. RFC_1036: "D, d M y",
  7072. RFC_1123: "D, d M yy",
  7073. RFC_2822: "D, d M yy",
  7074. RSS: "D, d M y",
  7075. // RFC 822
  7076. TICKS: "!",
  7077. TIMESTAMP: "@",
  7078. W3C: "yy-mm-dd",
  7079. // ISO 8601
  7080. _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
  7081. /* Format a date object into a string value.
  7082. * The format can be combinations of the following:
  7083. * d - day of month (no leading zero)
  7084. * dd - day of month (two digit)
  7085. * o - day of year (no leading zeros)
  7086. * oo - day of year (three digit)
  7087. * D - day name short
  7088. * DD - day name long
  7089. * m - month of year (no leading zero)
  7090. * mm - month of year (two digit)
  7091. * M - month name short
  7092. * MM - month name long
  7093. * y - year (two digit)
  7094. * yy - year (four digit)
  7095. * @ - Unix timestamp (ms since 01/01/1970)
  7096. * ! - Windows ticks (100ns since 01/01/0001)
  7097. * "..." - literal text
  7098. * '' - single quote
  7099. *
  7100. * @param format string - the desired format of the date
  7101. * @param date Date - the date value to format
  7102. * @param settings Object - attributes include:
  7103. * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
  7104. * dayNames string[7] - names of the days from Sunday (optional)
  7105. * monthNamesShort string[12] - abbreviated names of the months (optional)
  7106. * monthNames string[12] - names of the months (optional)
  7107. * @return string - the date in the above format
  7108. */
  7109. formatDate: function (format, date, settings) {
  7110. if (!date) {
  7111. return "";
  7112. }
  7113. var iFormat, dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
  7114. dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
  7115. monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
  7116. monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,
  7117. // Check whether a format character is doubled
  7118. lookAhead = function (match) {
  7119. var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
  7120. if (matches) {
  7121. iFormat++;
  7122. }
  7123. return matches;
  7124. },
  7125. // Format a number, with leading zero if necessary
  7126. formatNumber = function (match, value, len) {
  7127. var num = "" + value;
  7128. if (lookAhead(match)) {
  7129. while (num.length < len) {
  7130. num = "0" + num;
  7131. }
  7132. }
  7133. return num;
  7134. },
  7135. // Format a name, short or long as requested
  7136. formatName = function (match, value, shortNames, longNames) {
  7137. return (lookAhead(match) ? longNames[value] : shortNames[value]);
  7138. }, output = "", literal = false;
  7139. if (date) {
  7140. for (iFormat = 0; iFormat < format.length; iFormat++) {
  7141. if (literal) {
  7142. if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
  7143. literal = false;
  7144. } else {
  7145. output += format.charAt(iFormat);
  7146. }
  7147. } else {
  7148. switch (format.charAt(iFormat)) {
  7149. case "d":
  7150. output += formatNumber("d", date.getDate(), 2);
  7151. break;
  7152. case "D":
  7153. output += formatName("D", date.getDay(), dayNamesShort, dayNames);
  7154. break;
  7155. case "o":
  7156. output += formatNumber("o", Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
  7157. break;
  7158. case "m":
  7159. output += formatNumber("m", date.getMonth() + 1, 2);
  7160. break;
  7161. case "M":
  7162. output += formatName("M", date.getMonth(), monthNamesShort, monthNames);
  7163. break;
  7164. case "y":
  7165. output += (lookAhead("y") ? date.getFullYear() : (date.getFullYear() % 100 < 10 ? "0" : "") + date.getFullYear() % 100);
  7166. break;
  7167. case "@":
  7168. output += date.getTime();
  7169. break;
  7170. case "!":
  7171. output += date.getTime() * 10000 + this._ticksTo1970;
  7172. break;
  7173. case "'":
  7174. if (lookAhead("'")) {
  7175. output += "'";
  7176. } else {
  7177. literal = true;
  7178. }
  7179. break;
  7180. default:
  7181. output += format.charAt(iFormat);
  7182. }
  7183. }
  7184. }
  7185. }
  7186. return output;
  7187. },
  7188. /* Extract all possible characters from the date format. */
  7189. _possibleChars: function (format) {
  7190. var iFormat, chars = "", literal = false,
  7191. // Check whether a format character is doubled
  7192. lookAhead = function (match) {
  7193. var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
  7194. if (matches) {
  7195. iFormat++;
  7196. }
  7197. return matches;
  7198. };
  7199. for (iFormat = 0; iFormat < format.length; iFormat++) {
  7200. if (literal) {
  7201. if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
  7202. literal = false;
  7203. } else {
  7204. chars += format.charAt(iFormat);
  7205. }
  7206. } else {
  7207. switch (format.charAt(iFormat)) {
  7208. case "d":
  7209. case "m":
  7210. case "y":
  7211. case "@":
  7212. chars += "0123456789";
  7213. break;
  7214. case "D":
  7215. case "M":
  7216. return null;
  7217. // Accept anything
  7218. case "'":
  7219. if (lookAhead("'")) {
  7220. chars += "'";
  7221. } else {
  7222. literal = true;
  7223. }
  7224. break;
  7225. default:
  7226. chars += format.charAt(iFormat);
  7227. }
  7228. }
  7229. }
  7230. return chars;
  7231. },
  7232. /* Get a setting value, defaulting if necessary. */
  7233. _get: function (inst, name) {
  7234. return inst.settings[name] !== undefined ? inst.settings[name] : this._defaults[name];
  7235. },
  7236. /* Parse existing date and initialise date picker. */
  7237. _setDateFromField: function (inst, noDefault) {
  7238. if (inst.input.val() === inst.lastVal) {
  7239. return;
  7240. }
  7241. var dateFormat = this._get(inst, "dateFormat")
  7242. , dates = inst.lastVal = inst.input ? inst.input.val() : null
  7243. , defaultDate = this._getDefaultDate(inst)
  7244. , date = defaultDate
  7245. , settings = this._getFormatConfig(inst);
  7246. try {
  7247. date = this.parseDate(dateFormat, dates, settings) || defaultDate;
  7248. } catch (event) {
  7249. dates = (noDefault ? "" : dates);
  7250. }
  7251. inst.selectedDay = date.getDate();
  7252. inst.drawMonth = inst.selectedMonth = date.getMonth();
  7253. inst.drawYear = inst.selectedYear = date.getFullYear();
  7254. inst.currentDay = (dates ? date.getDate() : 0);
  7255. inst.currentMonth = (dates ? date.getMonth() : 0);
  7256. inst.currentYear = (dates ? date.getFullYear() : 0);
  7257. this._adjustInstDate(inst);
  7258. },
  7259. /* Retrieve the default date shown on opening. */
  7260. _getDefaultDate: function (inst) {
  7261. return this._restrictMinMax(inst, this._determineDate(inst, this._get(inst, "defaultDate"), new Date()));
  7262. },
  7263. /* A date may be specified as an exact value or a relative one. */
  7264. _determineDate: function (inst, date, defaultDate) {
  7265. var offsetNumeric = function (offset) {
  7266. var date = new Date();
  7267. date.setDate(date.getDate() + offset);
  7268. return date;
  7269. }
  7270. , offsetString = function (offset) {
  7271. try {
  7272. return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), offset, $.datepicker._getFormatConfig(inst));
  7273. } catch (e) {
  7274. // Ignore
  7275. }
  7276. var date = (offset.toLowerCase().match(/^c/) ? $.datepicker._getDate(inst) : null) || new Date()
  7277. , year = date.getFullYear()
  7278. , month = date.getMonth()
  7279. , day = date.getDate()
  7280. , pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g
  7281. , matches = pattern.exec(offset);
  7282. while (matches) {
  7283. switch (matches[2] || "d") {
  7284. case "d":
  7285. case "D":
  7286. day += parseInt(matches[1], 10);
  7287. break;
  7288. case "w":
  7289. case "W":
  7290. day += parseInt(matches[1], 10) * 7;
  7291. break;
  7292. case "m":
  7293. case "M":
  7294. month += parseInt(matches[1], 10);
  7295. day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
  7296. break;
  7297. case "y":
  7298. case "Y":
  7299. year += parseInt(matches[1], 10);
  7300. day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
  7301. break;
  7302. }
  7303. matches = pattern.exec(offset);
  7304. }
  7305. return new Date(year, month, day);
  7306. }
  7307. ,
  7308. newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) : (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
  7309. newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate);
  7310. if (newDate) {
  7311. newDate.setHours(0);
  7312. newDate.setMinutes(0);
  7313. newDate.setSeconds(0);
  7314. newDate.setMilliseconds(0);
  7315. }
  7316. return this._daylightSavingAdjust(newDate);
  7317. },
  7318. /* Handle switch to/from daylight saving.
  7319. * Hours may be non-zero on daylight saving cut-over:
  7320. * > 12 when midnight changeover, but then cannot generate
  7321. * midnight datetime, so jump to 1AM, otherwise reset.
  7322. * @param date (Date) the date to check
  7323. * @return (Date) the corrected date
  7324. */
  7325. _daylightSavingAdjust: function (date) {
  7326. if (!date) {
  7327. return null;
  7328. }
  7329. date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
  7330. return date;
  7331. },
  7332. /* Set the date(s) directly. */
  7333. _setDate: function (inst, date, noChange) {
  7334. var clear = !date
  7335. , origMonth = inst.selectedMonth
  7336. , origYear = inst.selectedYear
  7337. , newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
  7338. inst.selectedDay = inst.currentDay = newDate.getDate();
  7339. inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
  7340. inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
  7341. if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) {
  7342. this._notifyChange(inst);
  7343. }
  7344. this._adjustInstDate(inst);
  7345. if (inst.input) {
  7346. inst.input.val(clear ? "" : this._formatDate(inst));
  7347. }
  7348. },
  7349. /* Retrieve the date(s) directly. */
  7350. _getDate: function (inst) {
  7351. var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null : this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
  7352. return startDate;
  7353. },
  7354. /* Attach the onxxx handlers. These are declared statically so
  7355. * they work with static code transformers like Caja.
  7356. */
  7357. _attachHandlers: function (inst) {
  7358. var stepMonths = this._get(inst, "stepMonths")
  7359. , id = "#" + inst.id.replace(/\\\\/g, "\\");
  7360. inst.dpDiv.find("[data-handler]").map(function () {
  7361. var handler = {
  7362. prev: function () {
  7363. $.datepicker._adjustDate(id, -stepMonths, "M");
  7364. },
  7365. next: function () {
  7366. $.datepicker._adjustDate(id, +stepMonths, "M");
  7367. },
  7368. hide: function () {
  7369. $.datepicker._hideDatepicker();
  7370. },
  7371. today: function () {
  7372. $.datepicker._gotoToday(id);
  7373. },
  7374. selectDay: function () {
  7375. $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this);
  7376. return false;
  7377. },
  7378. selectMonth: function () {
  7379. $.datepicker._selectMonthYear(id, this, "M");
  7380. return false;
  7381. },
  7382. selectYear: function () {
  7383. $.datepicker._selectMonthYear(id, this, "Y");
  7384. return false;
  7385. }
  7386. };
  7387. $(this).on(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]);
  7388. });
  7389. },
  7390. /* Generate the HTML for the current state of the date picker. */
  7391. _generateHTML: function (inst) {
  7392. var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, controls, buttonPanel, firstDay,
  7393. showWeek, dayNames, dayNamesMin, monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
  7394. selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, cornerClass, calender, thead,
  7395. day, daysInMonth, leadDays, curRows, numRows, printDate, dRow, tbody, daySettings, otherMonth,
  7396. unselectable, tempDate = new Date(),
  7397. today = this._daylightSavingAdjust(new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time
  7398. isRTL = this._get(inst, "isRTL"), showButtonPanel = this._get(inst, "showButtonPanel"),
  7399. hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"),
  7400. navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"),
  7401. numMonths = this._getNumberOfMonths(inst), showCurrentAtPos = this._get(inst, "showCurrentAtPos"),
  7402. stepMonths = this._get(inst, "stepMonths"), isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1),
  7403. currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : new Date(inst.currentYear, inst.currentMonth, inst.currentDay))),
  7404. minDate = this._getMinMaxDate(inst, "min"), maxDate = this._getMinMaxDate(inst, "max"),
  7405. drawMonth = inst.drawMonth - showCurrentAtPos, drawYear = inst.drawYear;
  7406. if (drawMonth < 0) {
  7407. drawMonth += 12;
  7408. drawYear--;
  7409. }
  7410. if (maxDate) {
  7411. maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
  7412. maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
  7413. while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
  7414. drawMonth--;
  7415. if (drawMonth < 0) {
  7416. drawMonth = 11;
  7417. drawYear--;
  7418. }
  7419. }
  7420. }
  7421. inst.drawMonth = drawMonth;
  7422. inst.drawYear = drawYear;
  7423. prevText = this._get(inst, "prevText");
  7424. prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), this._getFormatConfig(inst)));
  7425. if (this._canAdjustMonth(inst, -1, drawYear, drawMonth)) {
  7426. prev = $("<a>").attr({
  7427. "class": "ui-datepicker-prev ui-corner-all",
  7428. "data-handler": "prev",
  7429. "data-event": "click",
  7430. title: prevText
  7431. }).append($("<span>").addClass("ui-icon ui-icon-circle-triangle-" + (isRTL ? "e" : "w")).text(prevText))[0].outerHTML;
  7432. } else if (hideIfNoPrevNext) {
  7433. prev = "";
  7434. } else {
  7435. prev = $("<a>").attr({
  7436. "class": "ui-datepicker-prev ui-corner-all ui-state-disabled",
  7437. title: prevText
  7438. }).append($("<span>").addClass("ui-icon ui-icon-circle-triangle-" + (isRTL ? "e" : "w")).text(prevText))[0].outerHTML;
  7439. }
  7440. nextText = this._get(inst, "nextText");
  7441. nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), this._getFormatConfig(inst)));
  7442. if (this._canAdjustMonth(inst, +1, drawYear, drawMonth)) {
  7443. next = $("<a>").attr({
  7444. "class": "ui-datepicker-next ui-corner-all",
  7445. "data-handler": "next",
  7446. "data-event": "click",
  7447. title: nextText
  7448. }).append($("<span>").addClass("ui-icon ui-icon-circle-triangle-" + (isRTL ? "w" : "e")).text(nextText))[0].outerHTML;
  7449. } else if (hideIfNoPrevNext) {
  7450. next = "";
  7451. } else {
  7452. next = $("<a>").attr({
  7453. "class": "ui-datepicker-next ui-corner-all ui-state-disabled",
  7454. title: nextText
  7455. }).append($("<span>").attr("class", "ui-icon ui-icon-circle-triangle-" + (isRTL ? "w" : "e")).text(nextText))[0].outerHTML;
  7456. }
  7457. currentText = this._get(inst, "currentText");
  7458. gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today);
  7459. currentText = (!navigationAsDateFormat ? currentText : this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
  7460. controls = "";
  7461. if (!inst.inline) {
  7462. controls = $("<button>").attr({
  7463. type: "button",
  7464. "class": "ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all",
  7465. "data-handler": "hide",
  7466. "data-event": "click"
  7467. }).text(this._get(inst, "closeText"))[0].outerHTML;
  7468. }
  7469. buttonPanel = "";
  7470. if (showButtonPanel) {
  7471. buttonPanel = $("<div class='ui-datepicker-buttonpane ui-widget-content'>").append(isRTL ? controls : "").append(this._isInRange(inst, gotoDate) ? $("<button>").attr({
  7472. type: "button",
  7473. "class": "ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all",
  7474. "data-handler": "today",
  7475. "data-event": "click"
  7476. }).text(currentText) : "").append(isRTL ? "" : controls)[0].outerHTML;
  7477. }
  7478. firstDay = parseInt(this._get(inst, "firstDay"), 10);
  7479. firstDay = (isNaN(firstDay) ? 0 : firstDay);
  7480. showWeek = this._get(inst, "showWeek");
  7481. dayNames = this._get(inst, "dayNames");
  7482. dayNamesMin = this._get(inst, "dayNamesMin");
  7483. monthNames = this._get(inst, "monthNames");
  7484. monthNamesShort = this._get(inst, "monthNamesShort");
  7485. beforeShowDay = this._get(inst, "beforeShowDay");
  7486. showOtherMonths = this._get(inst, "showOtherMonths");
  7487. selectOtherMonths = this._get(inst, "selectOtherMonths");
  7488. defaultDate = this._getDefaultDate(inst);
  7489. html = "";
  7490. for (row = 0; row < numMonths[0]; row++) {
  7491. group = "";
  7492. this.maxRows = 4;
  7493. for (col = 0; col < numMonths[1]; col++) {
  7494. selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
  7495. cornerClass = " ui-corner-all";
  7496. calender = "";
  7497. if (isMultiMonth) {
  7498. calender += "<div class='ui-datepicker-group";
  7499. if (numMonths[1] > 1) {
  7500. switch (col) {
  7501. case 0:
  7502. calender += " ui-datepicker-group-first";
  7503. cornerClass = " ui-corner-" + (isRTL ? "right" : "left");
  7504. break;
  7505. case numMonths[1] - 1:
  7506. calender += " ui-datepicker-group-last";
  7507. cornerClass = " ui-corner-" + (isRTL ? "left" : "right");
  7508. break;
  7509. default:
  7510. calender += " ui-datepicker-group-middle";
  7511. cornerClass = "";
  7512. break;
  7513. }
  7514. }
  7515. calender += "'>";
  7516. }
  7517. calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") + (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") + this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
  7518. "</div><table class='ui-datepicker-calendar'><thead>" + "<tr>";
  7519. thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : "");
  7520. for (dow = 0; dow < 7; dow++) {
  7521. // days of the week
  7522. day = (dow + firstDay) % 7;
  7523. thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" + "<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>";
  7524. }
  7525. calender += thead + "</tr></thead><tbody>";
  7526. daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
  7527. if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) {
  7528. inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
  7529. }
  7530. leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
  7531. curRows = Math.ceil((leadDays + daysInMonth) / 7);
  7532. // calculate the number of rows to generate
  7533. numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows);
  7534. //If multiple months, use the higher number of rows (see #7043)
  7535. this.maxRows = numRows;
  7536. printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
  7537. for (dRow = 0; dRow < numRows; dRow++) {
  7538. // create date picker rows
  7539. calender += "<tr>";
  7540. tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" + this._get(inst, "calculateWeek")(printDate) + "</td>");
  7541. for (dow = 0; dow < 7; dow++) {
  7542. // create date picker days
  7543. daySettings = (beforeShowDay ? beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]);
  7544. otherMonth = (printDate.getMonth() !== drawMonth);
  7545. unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
  7546. tbody += "<td class='" + ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends
  7547. (otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months
  7548. ((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key
  7549. (defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ?
  7550. // or defaultDate is current printedDate and defaultDate is selectedDate
  7551. " " + this._dayOverClass : "") + // highlight selected day
  7552. (unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "") + // highlight unselectable days
  7553. (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates
  7554. (printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day
  7555. (printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different)
  7556. ((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "&#39;") + "'" : "") + // cell title
  7557. (unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions
  7558. (otherMonth && !showOtherMonths ? "&#xa0;" : // display for other months
  7559. (unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + (printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") + (printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day
  7560. (otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months
  7561. "' href='#' aria-current='" + (printDate.getTime() === currentDate.getTime() ? "true" : "false") + // mark date as selected for screen reader
  7562. "' data-date='" + printDate.getDate() + // store date as data
  7563. "'>" + printDate.getDate() + "</a>")) + "</td>";
  7564. // display selectable date
  7565. printDate.setDate(printDate.getDate() + 1);
  7566. printDate = this._daylightSavingAdjust(printDate);
  7567. }
  7568. calender += tbody + "</tr>";
  7569. }
  7570. drawMonth++;
  7571. if (drawMonth > 11) {
  7572. drawMonth = 0;
  7573. drawYear++;
  7574. }
  7575. calender += "</tbody></table>" + (isMultiMonth ? "</div>" + ((numMonths[0] > 0 && col === numMonths[1] - 1) ? "<div class='ui-datepicker-row-break'></div>" : "") : "");
  7576. group += calender;
  7577. }
  7578. html += group;
  7579. }
  7580. html += buttonPanel;
  7581. inst._keyEvent = false;
  7582. return html;
  7583. },
  7584. /* Generate the month and year header. */
  7585. _generateMonthYearHeader: function (inst, drawMonth, drawYear, minDate, maxDate, secondary, monthNames, monthNamesShort) {
  7586. var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
  7587. changeMonth = this._get(inst, "changeMonth"), changeYear = this._get(inst, "changeYear"),
  7588. showMonthAfterYear = this._get(inst, "showMonthAfterYear"),
  7589. selectMonthLabel = this._get(inst, "selectMonthLabel"),
  7590. selectYearLabel = this._get(inst, "selectYearLabel"), html = "<div class='ui-datepicker-title'>",
  7591. monthHtml = "";
  7592. // Month selection
  7593. if (secondary || !changeMonth) {
  7594. monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>";
  7595. } else {
  7596. inMinYear = (minDate && minDate.getFullYear() === drawYear);
  7597. inMaxYear = (maxDate && maxDate.getFullYear() === drawYear);
  7598. monthHtml += "<select class='ui-datepicker-month' aria-label='" + selectMonthLabel + "' data-handler='selectMonth' data-event='change'>";
  7599. for (month = 0; month < 12; month++) {
  7600. if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) {
  7601. monthHtml += "<option value='" + month + "'" + (month === drawMonth ? " selected='selected'" : "") + ">" + monthNamesShort[month] + "</option>";
  7602. }
  7603. }
  7604. monthHtml += "</select>";
  7605. }
  7606. if (!showMonthAfterYear) {
  7607. html += monthHtml + (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "");
  7608. }
  7609. // Year selection
  7610. if (!inst.yearshtml) {
  7611. inst.yearshtml = "";
  7612. if (secondary || !changeYear) {
  7613. html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";
  7614. } else {
  7615. // determine range of years to display
  7616. years = this._get(inst, "yearRange").split(":");
  7617. thisYear = new Date().getFullYear();
  7618. determineYear = function (value) {
  7619. var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) : (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) : parseInt(value, 10)));
  7620. return (isNaN(year) ? thisYear : year);
  7621. }
  7622. ;
  7623. year = determineYear(years[0]);
  7624. endYear = Math.max(year, determineYear(years[1] || ""));
  7625. year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
  7626. endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
  7627. inst.yearshtml += "<select class='ui-datepicker-year' aria-label='" + selectYearLabel + "' data-handler='selectYear' data-event='change'>";
  7628. for (; year <= endYear; year++) {
  7629. inst.yearshtml += "<option value='" + year + "'" + (year === drawYear ? " selected='selected'" : "") + ">" + year + "</option>";
  7630. }
  7631. inst.yearshtml += "</select>";
  7632. html += inst.yearshtml;
  7633. inst.yearshtml = null;
  7634. }
  7635. }
  7636. html += this._get(inst, "yearSuffix");
  7637. if (showMonthAfterYear) {
  7638. html += (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "") + monthHtml;
  7639. }
  7640. html += "</div>";
  7641. // Close datepicker_header
  7642. return html;
  7643. },
  7644. /* Adjust one of the date sub-fields. */
  7645. _adjustInstDate: function (inst, offset, period) {
  7646. var year = inst.selectedYear + (period === "Y" ? offset : 0)
  7647. , month = inst.selectedMonth + (period === "M" ? offset : 0)
  7648. , day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0)
  7649. , date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day)));
  7650. inst.selectedDay = date.getDate();
  7651. inst.drawMonth = inst.selectedMonth = date.getMonth();
  7652. inst.drawYear = inst.selectedYear = date.getFullYear();
  7653. if (period === "M" || period === "Y") {
  7654. this._notifyChange(inst);
  7655. }
  7656. },
  7657. /* Ensure a date is within any min/max bounds. */
  7658. _restrictMinMax: function (inst, date) {
  7659. var minDate = this._getMinMaxDate(inst, "min")
  7660. , maxDate = this._getMinMaxDate(inst, "max")
  7661. , newDate = (minDate && date < minDate ? minDate : date);
  7662. return (maxDate && newDate > maxDate ? maxDate : newDate);
  7663. },
  7664. /* Notify change of month/year. */
  7665. _notifyChange: function (inst) {
  7666. var onChange = this._get(inst, "onChangeMonthYear");
  7667. if (onChange) {
  7668. onChange.apply((inst.input ? inst.input[0] : null), [inst.selectedYear, inst.selectedMonth + 1, inst]);
  7669. }
  7670. },
  7671. /* Determine the number of months to show. */
  7672. _getNumberOfMonths: function (inst) {
  7673. var numMonths = this._get(inst, "numberOfMonths");
  7674. return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths));
  7675. },
  7676. /* Determine the current maximum date - ensure no time components are set. */
  7677. _getMinMaxDate: function (inst, minMax) {
  7678. return this._determineDate(inst, this._get(inst, minMax + "Date"), null);
  7679. },
  7680. /* Find the number of days in a given month. */
  7681. _getDaysInMonth: function (year, month) {
  7682. return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
  7683. },
  7684. /* Find the day of the week of the first of a month. */
  7685. _getFirstDayOfMonth: function (year, month) {
  7686. return new Date(year, month, 1).getDay();
  7687. },
  7688. /* Determines if we should allow a "next/prev" month display change. */
  7689. _canAdjustMonth: function (inst, offset, curYear, curMonth) {
  7690. var numMonths = this._getNumberOfMonths(inst)
  7691. ,
  7692. date = this._daylightSavingAdjust(new Date(curYear, curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
  7693. if (offset < 0) {
  7694. date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
  7695. }
  7696. return this._isInRange(inst, date);
  7697. },
  7698. /* Is the given date in the accepted range? */
  7699. _isInRange: function (inst, date) {
  7700. var yearSplit, currentYear, minDate = this._getMinMaxDate(inst, "min"),
  7701. maxDate = this._getMinMaxDate(inst, "max"), minYear = null, maxYear = null,
  7702. years = this._get(inst, "yearRange");
  7703. if (years) {
  7704. yearSplit = years.split(":");
  7705. currentYear = new Date().getFullYear();
  7706. minYear = parseInt(yearSplit[0], 10);
  7707. maxYear = parseInt(yearSplit[1], 10);
  7708. if (yearSplit[0].match(/[+\-].*/)) {
  7709. minYear += currentYear;
  7710. }
  7711. if (yearSplit[1].match(/[+\-].*/)) {
  7712. maxYear += currentYear;
  7713. }
  7714. }
  7715. return ((!minDate || date.getTime() >= minDate.getTime()) && (!maxDate || date.getTime() <= maxDate.getTime()) && (!minYear || date.getFullYear() >= minYear) && (!maxYear || date.getFullYear() <= maxYear));
  7716. },
  7717. /* Provide the configuration settings for formatting/parsing. */
  7718. _getFormatConfig: function (inst) {
  7719. var shortYearCutoff = this._get(inst, "shortYearCutoff");
  7720. shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff : new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
  7721. return {
  7722. shortYearCutoff: shortYearCutoff,
  7723. dayNamesShort: this._get(inst, "dayNamesShort"),
  7724. dayNames: this._get(inst, "dayNames"),
  7725. monthNamesShort: this._get(inst, "monthNamesShort"),
  7726. monthNames: this._get(inst, "monthNames")
  7727. };
  7728. },
  7729. /* Format the given date for display. */
  7730. _formatDate: function (inst, day, month, year) {
  7731. if (!day) {
  7732. inst.currentDay = inst.selectedDay;
  7733. inst.currentMonth = inst.selectedMonth;
  7734. inst.currentYear = inst.selectedYear;
  7735. }
  7736. var date = (day ? (typeof day === "object" ? day : this._daylightSavingAdjust(new Date(year, month, day))) : this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
  7737. return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst));
  7738. }
  7739. });
  7740. /*
  7741. * Bind hover events for datepicker elements.
  7742. * Done via delegate so the binding only occurs once in the lifetime of the parent div.
  7743. * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
  7744. */
  7745. function datepicker_bindHover(dpDiv) {
  7746. var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
  7747. return dpDiv.on("mouseout", selector, function () {
  7748. $(this).removeClass("ui-state-hover");
  7749. if (this.className.indexOf("ui-datepicker-prev") !== -1) {
  7750. $(this).removeClass("ui-datepicker-prev-hover");
  7751. }
  7752. if (this.className.indexOf("ui-datepicker-next") !== -1) {
  7753. $(this).removeClass("ui-datepicker-next-hover");
  7754. }
  7755. }).on("mouseover", selector, datepicker_handleMouseover);
  7756. }
  7757. function datepicker_handleMouseover() {
  7758. if (!$.datepicker._isDisabledDatepicker(datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) {
  7759. $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
  7760. $(this).addClass("ui-state-hover");
  7761. if (this.className.indexOf("ui-datepicker-prev") !== -1) {
  7762. $(this).addClass("ui-datepicker-prev-hover");
  7763. }
  7764. if (this.className.indexOf("ui-datepicker-next") !== -1) {
  7765. $(this).addClass("ui-datepicker-next-hover");
  7766. }
  7767. }
  7768. }
  7769. /* jQuery extend now ignores nulls! */
  7770. function datepicker_extendRemove(target, props) {
  7771. $.extend(target, props);
  7772. for (var name in props) {
  7773. if (props[name] == null) {
  7774. target[name] = props[name];
  7775. }
  7776. }
  7777. return target;
  7778. }
  7779. /* Invoke the datepicker functionality.
  7780. @param options string - a command, optionally followed by additional parameters or
  7781. Object - settings for attaching new datepicker functionality
  7782. @return jQuery object */
  7783. $.fn.datepicker = function (options) {
  7784. /* Verify an empty collection wasn't passed - Fixes #6976 */
  7785. if (!this.length) {
  7786. return this;
  7787. }
  7788. /* Initialise the date picker. */
  7789. if (!$.datepicker.initialized) {
  7790. $(document).on("mousedown", $.datepicker._checkExternalClick);
  7791. $.datepicker.initialized = true;
  7792. }
  7793. /* Append datepicker main container to body if not exist. */
  7794. if ($("#" + $.datepicker._mainDivId).length === 0) {
  7795. $("body").append($.datepicker.dpDiv);
  7796. }
  7797. var otherArgs = Array.prototype.slice.call(arguments, 1);
  7798. if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) {
  7799. return $.datepicker["_" + options + "Datepicker"].apply($.datepicker, [this[0]].concat(otherArgs));
  7800. }
  7801. if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") {
  7802. return $.datepicker["_" + options + "Datepicker"].apply($.datepicker, [this[0]].concat(otherArgs));
  7803. }
  7804. return this.each(function () {
  7805. if (typeof options === "string") {
  7806. $.datepicker["_" + options + "Datepicker"].apply($.datepicker, [this].concat(otherArgs));
  7807. } else {
  7808. $.datepicker._attachDatepicker(this, options);
  7809. }
  7810. });
  7811. }
  7812. ;
  7813. $.datepicker = new Datepicker();
  7814. // singleton instance
  7815. $.datepicker.initialized = false;
  7816. $.datepicker.uuid = new Date().getTime();
  7817. $.datepicker.version = "1.13.0";
  7818. var widgetsDatepicker = $.datepicker;
  7819. // This file is deprecated
  7820. var ie = $.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());
  7821. /*!
  7822. * jQuery UI Mouse 1.13.0
  7823. * http://jqueryui.com
  7824. *
  7825. * Copyright jQuery Foundation and other contributors
  7826. * Released under the MIT license.
  7827. * http://jquery.org/license
  7828. */
  7829. //>>label: Mouse
  7830. //>>group: Widgets
  7831. //>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
  7832. //>>docs: http://api.jqueryui.com/mouse/
  7833. var mouseHandled = false;
  7834. $(document).on("mouseup", function () {
  7835. mouseHandled = false;
  7836. });
  7837. var widgetsMouse = $.widget("ui.mouse", {
  7838. version: "1.13.0",
  7839. options: {
  7840. cancel: "input, textarea, button, select, option",
  7841. distance: 1,
  7842. delay: 0
  7843. },
  7844. _mouseInit: function () {
  7845. var that = this;
  7846. this.element.on("mousedown." + this.widgetName, function (event) {
  7847. return that._mouseDown(event);
  7848. }).on("click." + this.widgetName, function (event) {
  7849. if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
  7850. $.removeData(event.target, that.widgetName + ".preventClickEvent");
  7851. event.stopImmediatePropagation();
  7852. return false;
  7853. }
  7854. });
  7855. this.started = false;
  7856. },
  7857. // TODO: make sure destroying one instance of mouse doesn't mess with
  7858. // other instances of mouse
  7859. _mouseDestroy: function () {
  7860. this.element.off("." + this.widgetName);
  7861. if (this._mouseMoveDelegate) {
  7862. this.document.off("mousemove." + this.widgetName, this._mouseMoveDelegate).off("mouseup." + this.widgetName, this._mouseUpDelegate);
  7863. }
  7864. },
  7865. _mouseDown: function (event) {
  7866. // don't let more than one widget handle mouseStart
  7867. if (mouseHandled) {
  7868. return;
  7869. }
  7870. this._mouseMoved = false;
  7871. // We may have missed mouseup (out of window)
  7872. if (this._mouseStarted) {
  7873. this._mouseUp(event);
  7874. }
  7875. this._mouseDownEvent = event;
  7876. var that = this
  7877. , btnIsLeft = (event.which === 1)
  7878. ,
  7879. // event.target.nodeName works around a bug in IE 8 with
  7880. // disabled inputs (#7620)
  7881. elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
  7882. if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
  7883. return true;
  7884. }
  7885. this.mouseDelayMet = !this.options.delay;
  7886. if (!this.mouseDelayMet) {
  7887. this._mouseDelayTimer = setTimeout(function () {
  7888. that.mouseDelayMet = true;
  7889. }, this.options.delay);
  7890. }
  7891. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  7892. this._mouseStarted = (this._mouseStart(event) !== false);
  7893. if (!this._mouseStarted) {
  7894. event.preventDefault();
  7895. return true;
  7896. }
  7897. }
  7898. // Click event may never have fired (Gecko & Opera)
  7899. if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
  7900. $.removeData(event.target, this.widgetName + ".preventClickEvent");
  7901. }
  7902. // These delegates are required to keep context
  7903. this._mouseMoveDelegate = function (event) {
  7904. return that._mouseMove(event);
  7905. }
  7906. ;
  7907. this._mouseUpDelegate = function (event) {
  7908. return that._mouseUp(event);
  7909. }
  7910. ;
  7911. this.document.on("mousemove." + this.widgetName, this._mouseMoveDelegate).on("mouseup." + this.widgetName, this._mouseUpDelegate);
  7912. event.preventDefault();
  7913. mouseHandled = true;
  7914. return true;
  7915. },
  7916. _mouseMove: function (event) {
  7917. // Only check for mouseups outside the document if you've moved inside the document
  7918. // at least once. This prevents the firing of mouseup in the case of IE<9, which will
  7919. // fire a mousemove event if content is placed under the cursor. See #7778
  7920. // Support: IE <9
  7921. if (this._mouseMoved) {
  7922. // IE mouseup check - mouseup happened when mouse was out of window
  7923. if ($.ui.ie && (!document.documentMode || document.documentMode < 9) && !event.button) {
  7924. return this._mouseUp(event);
  7925. // Iframe mouseup check - mouseup occurred in another document
  7926. } else if (!event.which) {
  7927. // Support: Safari <=8 - 9
  7928. // Safari sets which to 0 if you press any of the following keys
  7929. // during a drag (#14461)
  7930. if (event.originalEvent.altKey || event.originalEvent.ctrlKey || event.originalEvent.metaKey || event.originalEvent.shiftKey) {
  7931. this.ignoreMissingWhich = true;
  7932. } else if (!this.ignoreMissingWhich) {
  7933. return this._mouseUp(event);
  7934. }
  7935. }
  7936. }
  7937. if (event.which || event.button) {
  7938. this._mouseMoved = true;
  7939. }
  7940. if (this._mouseStarted) {
  7941. this._mouseDrag(event);
  7942. return event.preventDefault();
  7943. }
  7944. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  7945. this._mouseStarted = (this._mouseStart(this._mouseDownEvent, event) !== false);
  7946. if (this._mouseStarted) {
  7947. this._mouseDrag(event);
  7948. } else {
  7949. this._mouseUp(event);
  7950. }
  7951. }
  7952. return !this._mouseStarted;
  7953. },
  7954. _mouseUp: function (event) {
  7955. this.document.off("mousemove." + this.widgetName, this._mouseMoveDelegate).off("mouseup." + this.widgetName, this._mouseUpDelegate);
  7956. if (this._mouseStarted) {
  7957. this._mouseStarted = false;
  7958. if (event.target === this._mouseDownEvent.target) {
  7959. $.data(event.target, this.widgetName + ".preventClickEvent", true);
  7960. }
  7961. this._mouseStop(event);
  7962. }
  7963. if (this._mouseDelayTimer) {
  7964. clearTimeout(this._mouseDelayTimer);
  7965. delete this._mouseDelayTimer;
  7966. }
  7967. this.ignoreMissingWhich = false;
  7968. mouseHandled = false;
  7969. event.preventDefault();
  7970. },
  7971. _mouseDistanceMet: function (event) {
  7972. return (Math.max(Math.abs(this._mouseDownEvent.pageX - event.pageX), Math.abs(this._mouseDownEvent.pageY - event.pageY)) >= this.options.distance);
  7973. },
  7974. _mouseDelayMet: function (/* event */
  7975. ) {
  7976. return this.mouseDelayMet;
  7977. },
  7978. // These are placeholder methods, to be overriden by extending plugin
  7979. _mouseStart: function (/* event */
  7980. ) {
  7981. },
  7982. _mouseDrag: function (/* event */
  7983. ) {
  7984. },
  7985. _mouseStop: function (/* event */
  7986. ) {
  7987. },
  7988. _mouseCapture: function (/* event */
  7989. ) {
  7990. return true;
  7991. }
  7992. });
  7993. // $.ui.plugin is deprecated. Use $.widget() extensions instead.
  7994. var plugin = $.ui.plugin = {
  7995. add: function (module, option, set) {
  7996. var i, proto = $.ui[module].prototype;
  7997. for (i in set) {
  7998. proto.plugins[i] = proto.plugins[i] || [];
  7999. proto.plugins[i].push([option, set[i]]);
  8000. }
  8001. },
  8002. call: function (instance, name, args, allowDisconnected) {
  8003. var i, set = instance.plugins[name];
  8004. if (!set) {
  8005. return;
  8006. }
  8007. if (!allowDisconnected && (!instance.element[0].parentNode || instance.element[0].parentNode.nodeType === 11)) {
  8008. return;
  8009. }
  8010. for (i = 0; i < set.length; i++) {
  8011. if (instance.options[set[i][0]]) {
  8012. set[i][1].apply(instance.element, args);
  8013. }
  8014. }
  8015. }
  8016. };
  8017. var safeBlur = $.ui.safeBlur = function (element) {
  8018. // Support: IE9 - 10 only
  8019. // If the <body> is blurred, IE will switch windows, see #9420
  8020. if (element && element.nodeName.toLowerCase() !== "body") {
  8021. $(element).trigger("blur");
  8022. }
  8023. }
  8024. ;
  8025. /*!
  8026. * jQuery UI Draggable 1.13.0
  8027. * http://jqueryui.com
  8028. *
  8029. * Copyright jQuery Foundation and other contributors
  8030. * Released under the MIT license.
  8031. * http://jquery.org/license
  8032. */
  8033. //>>label: Draggable
  8034. //>>group: Interactions
  8035. //>>description: Enables dragging functionality for any element.
  8036. //>>docs: http://api.jqueryui.com/draggable/
  8037. //>>demos: http://jqueryui.com/draggable/
  8038. //>>css.structure: ../../themes/base/draggable.css
  8039. $.widget("ui.draggable", $.ui.mouse, {
  8040. version: "1.13.0",
  8041. widgetEventPrefix: "drag",
  8042. options: {
  8043. addClasses: true,
  8044. appendTo: "parent",
  8045. axis: false,
  8046. connectToSortable: false,
  8047. containment: false,
  8048. cursor: "auto",
  8049. cursorAt: false,
  8050. grid: false,
  8051. handle: false,
  8052. helper: "original",
  8053. iframeFix: false,
  8054. opacity: false,
  8055. refreshPositions: false,
  8056. revert: false,
  8057. revertDuration: 500,
  8058. scope: "default",
  8059. scroll: true,
  8060. scrollSensitivity: 20,
  8061. scrollSpeed: 20,
  8062. snap: false,
  8063. snapMode: "both",
  8064. snapTolerance: 20,
  8065. stack: false,
  8066. zIndex: false,
  8067. // Callbacks
  8068. drag: null,
  8069. start: null,
  8070. stop: null
  8071. },
  8072. _create: function () {
  8073. if (this.options.helper === "original") {
  8074. this._setPositionRelative();
  8075. }
  8076. if (this.options.addClasses) {
  8077. this._addClass("ui-draggable");
  8078. }
  8079. this._setHandleClassName();
  8080. this._mouseInit();
  8081. },
  8082. _setOption: function (key, value) {
  8083. this._super(key, value);
  8084. if (key === "handle") {
  8085. this._removeHandleClassName();
  8086. this._setHandleClassName();
  8087. }
  8088. },
  8089. _destroy: function () {
  8090. if ((this.helper || this.element).is(".ui-draggable-dragging")) {
  8091. this.destroyOnClear = true;
  8092. return;
  8093. }
  8094. this._removeHandleClassName();
  8095. this._mouseDestroy();
  8096. },
  8097. _mouseCapture: function (event) {
  8098. var o = this.options;
  8099. // Among others, prevent a drag on a resizable-handle
  8100. if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) {
  8101. return false;
  8102. }
  8103. //Quit if we're not on a valid handle
  8104. this.handle = this._getHandle(event);
  8105. if (!this.handle) {
  8106. return false;
  8107. }
  8108. this._blurActiveElement(event);
  8109. this._blockFrames(o.iframeFix === true ? "iframe" : o.iframeFix);
  8110. return true;
  8111. },
  8112. _blockFrames: function (selector) {
  8113. this.iframeBlocks = this.document.find(selector).map(function () {
  8114. var iframe = $(this);
  8115. return $("<div>").css("position", "absolute").appendTo(iframe.parent()).outerWidth(iframe.outerWidth()).outerHeight(iframe.outerHeight()).offset(iframe.offset())[0];
  8116. });
  8117. },
  8118. _unblockFrames: function () {
  8119. if (this.iframeBlocks) {
  8120. this.iframeBlocks.remove();
  8121. delete this.iframeBlocks;
  8122. }
  8123. },
  8124. _blurActiveElement: function (event) {
  8125. var activeElement = $.ui.safeActiveElement(this.document[0])
  8126. , target = $(event.target);
  8127. // Don't blur if the event occurred on an element that is within
  8128. // the currently focused element
  8129. // See #10527, #12472
  8130. if (target.closest(activeElement).length) {
  8131. return;
  8132. }
  8133. // Blur any element that currently has focus, see #4261
  8134. $.ui.safeBlur(activeElement);
  8135. },
  8136. _mouseStart: function (event) {
  8137. var o = this.options;
  8138. //Create and append the visible helper
  8139. this.helper = this._createHelper(event);
  8140. this._addClass(this.helper, "ui-draggable-dragging");
  8141. //Cache the helper size
  8142. this._cacheHelperProportions();
  8143. //If ddmanager is used for droppables, set the global draggable
  8144. if ($.ui.ddmanager) {
  8145. $.ui.ddmanager.current = this;
  8146. }
  8147. /*
  8148. * - Position generation -
  8149. * This block generates everything position related - it's the core of draggables.
  8150. */
  8151. //Cache the margins of the original element
  8152. this._cacheMargins();
  8153. //Store the helper's css position
  8154. this.cssPosition = this.helper.css("position");
  8155. this.scrollParent = this.helper.scrollParent(true);
  8156. this.offsetParent = this.helper.offsetParent();
  8157. this.hasFixedAncestor = this.helper.parents().filter(function () {
  8158. return $(this).css("position") === "fixed";
  8159. }).length > 0;
  8160. //The element's absolute position on the page minus margins
  8161. this.positionAbs = this.element.offset();
  8162. this._refreshOffsets(event);
  8163. //Generate the original position
  8164. this.originalPosition = this.position = this._generatePosition(event, false);
  8165. this.originalPageX = event.pageX;
  8166. this.originalPageY = event.pageY;
  8167. //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
  8168. if (o.cursorAt) {
  8169. this._adjustOffsetFromHelper(o.cursorAt);
  8170. }
  8171. //Set a containment if given in the options
  8172. this._setContainment();
  8173. //Trigger event + callbacks
  8174. if (this._trigger("start", event) === false) {
  8175. this._clear();
  8176. return false;
  8177. }
  8178. //Recache the helper size
  8179. this._cacheHelperProportions();
  8180. //Prepare the droppable offsets
  8181. if ($.ui.ddmanager && !o.dropBehaviour) {
  8182. $.ui.ddmanager.prepareOffsets(this, event);
  8183. }
  8184. // Execute the drag once - this causes the helper not to be visible before getting its
  8185. // correct position
  8186. this._mouseDrag(event, true);
  8187. // If the ddmanager is used for droppables, inform the manager that dragging has started
  8188. // (see #5003)
  8189. if ($.ui.ddmanager) {
  8190. $.ui.ddmanager.dragStart(this, event);
  8191. }
  8192. return true;
  8193. },
  8194. _refreshOffsets: function (event) {
  8195. this.offset = {
  8196. top: this.positionAbs.top - this.margins.top,
  8197. left: this.positionAbs.left - this.margins.left,
  8198. scroll: false,
  8199. parent: this._getParentOffset(),
  8200. relative: this._getRelativeOffset()
  8201. };
  8202. this.offset.click = {
  8203. left: event.pageX - this.offset.left,
  8204. top: event.pageY - this.offset.top
  8205. };
  8206. },
  8207. _mouseDrag: function (event, noPropagation) {
  8208. // reset any necessary cached properties (see #5009)
  8209. if (this.hasFixedAncestor) {
  8210. this.offset.parent = this._getParentOffset();
  8211. }
  8212. //Compute the helpers position
  8213. this.position = this._generatePosition(event, true);
  8214. this.positionAbs = this._convertPositionTo("absolute");
  8215. //Call plugins and callbacks and use the resulting position if something is returned
  8216. if (!noPropagation) {
  8217. var ui = this._uiHash();
  8218. if (this._trigger("drag", event, ui) === false) {
  8219. this._mouseUp(new $.Event("mouseup", event));
  8220. return false;
  8221. }
  8222. this.position = ui.position;
  8223. }
  8224. this.helper[0].style.left = this.position.left + "px";
  8225. this.helper[0].style.top = this.position.top + "px";
  8226. if ($.ui.ddmanager) {
  8227. $.ui.ddmanager.drag(this, event);
  8228. }
  8229. return false;
  8230. },
  8231. _mouseStop: function (event) {
  8232. //If we are using droppables, inform the manager about the drop
  8233. var that = this
  8234. , dropped = false;
  8235. if ($.ui.ddmanager && !this.options.dropBehaviour) {
  8236. dropped = $.ui.ddmanager.drop(this, event);
  8237. }
  8238. //if a drop comes from outside (a sortable)
  8239. if (this.dropped) {
  8240. dropped = this.dropped;
  8241. this.dropped = false;
  8242. }
  8243. if ((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || (typeof this.options.revert === "function" && this.options.revert.call(this.element, dropped))) {
  8244. $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function () {
  8245. if (that._trigger("stop", event) !== false) {
  8246. that._clear();
  8247. }
  8248. });
  8249. } else {
  8250. if (this._trigger("stop", event) !== false) {
  8251. this._clear();
  8252. }
  8253. }
  8254. return false;
  8255. },
  8256. _mouseUp: function (event) {
  8257. this._unblockFrames();
  8258. // If the ddmanager is used for droppables, inform the manager that dragging has stopped
  8259. // (see #5003)
  8260. if ($.ui.ddmanager) {
  8261. $.ui.ddmanager.dragStop(this, event);
  8262. }
  8263. // Only need to focus if the event occurred on the draggable itself, see #10527
  8264. if (this.handleElement.is(event.target)) {
  8265. // The interaction is over; whether or not the click resulted in a drag,
  8266. // focus the element
  8267. this.element.trigger("focus");
  8268. }
  8269. return $.ui.mouse.prototype._mouseUp.call(this, event);
  8270. },
  8271. cancel: function () {
  8272. if (this.helper.is(".ui-draggable-dragging")) {
  8273. this._mouseUp(new $.Event("mouseup", {
  8274. target: this.element[0]
  8275. }));
  8276. } else {
  8277. this._clear();
  8278. }
  8279. return this;
  8280. },
  8281. _getHandle: function (event) {
  8282. return this.options.handle ? !!$(event.target).closest(this.element.find(this.options.handle)).length : true;
  8283. },
  8284. _setHandleClassName: function () {
  8285. this.handleElement = this.options.handle ? this.element.find(this.options.handle) : this.element;
  8286. this._addClass(this.handleElement, "ui-draggable-handle");
  8287. },
  8288. _removeHandleClassName: function () {
  8289. this._removeClass(this.handleElement, "ui-draggable-handle");
  8290. },
  8291. _createHelper: function (event) {
  8292. var o = this.options
  8293. , helperIsFunction = typeof o.helper === "function"
  8294. ,
  8295. helper = helperIsFunction ? $(o.helper.apply(this.element[0], [event])) : (o.helper === "clone" ? this.element.clone().removeAttr("id") : this.element);
  8296. if (!helper.parents("body").length) {
  8297. helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo));
  8298. }
  8299. // Http://bugs.jqueryui.com/ticket/9446
  8300. // a helper function can return the original element
  8301. // which wouldn't have been set to relative in _create
  8302. if (helperIsFunction && helper[0] === this.element[0]) {
  8303. this._setPositionRelative();
  8304. }
  8305. if (helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) {
  8306. helper.css("position", "absolute");
  8307. }
  8308. return helper;
  8309. },
  8310. _setPositionRelative: function () {
  8311. if (!(/^(?:r|a|f)/).test(this.element.css("position"))) {
  8312. this.element[0].style.position = "relative";
  8313. }
  8314. },
  8315. _adjustOffsetFromHelper: function (obj) {
  8316. if (typeof obj === "string") {
  8317. obj = obj.split(" ");
  8318. }
  8319. if (Array.isArray(obj)) {
  8320. obj = {
  8321. left: +obj[0],
  8322. top: +obj[1] || 0
  8323. };
  8324. }
  8325. if ("left" in obj) {
  8326. this.offset.click.left = obj.left + this.margins.left;
  8327. }
  8328. if ("right" in obj) {
  8329. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  8330. }
  8331. if ("top" in obj) {
  8332. this.offset.click.top = obj.top + this.margins.top;
  8333. }
  8334. if ("bottom" in obj) {
  8335. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  8336. }
  8337. },
  8338. _isRootNode: function (element) {
  8339. return (/(html|body)/i).test(element.tagName) || element === this.document[0];
  8340. },
  8341. _getParentOffset: function () {
  8342. //Get the offsetParent and cache its position
  8343. var po = this.offsetParent.offset()
  8344. , document = this.document[0];
  8345. // This is a special case where we need to modify a offset calculated on start, since the
  8346. // following happened:
  8347. // 1. The position of the helper is absolute, so it's position is calculated based on the
  8348. // next positioned parent
  8349. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
  8350. // the document, which means that the scroll is included in the initial calculation of the
  8351. // offset of the parent, and never recalculated upon drag
  8352. if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
  8353. po.left += this.scrollParent.scrollLeft();
  8354. po.top += this.scrollParent.scrollTop();
  8355. }
  8356. if (this._isRootNode(this.offsetParent[0])) {
  8357. po = {
  8358. top: 0,
  8359. left: 0
  8360. };
  8361. }
  8362. return {
  8363. top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
  8364. left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
  8365. };
  8366. },
  8367. _getRelativeOffset: function () {
  8368. if (this.cssPosition !== "relative") {
  8369. return {
  8370. top: 0,
  8371. left: 0
  8372. };
  8373. }
  8374. var p = this.element.position()
  8375. , scrollIsRootNode = this._isRootNode(this.scrollParent[0]);
  8376. return {
  8377. top: p.top - (parseInt(this.helper.css("top"), 10) || 0) + (!scrollIsRootNode ? this.scrollParent.scrollTop() : 0),
  8378. left: p.left - (parseInt(this.helper.css("left"), 10) || 0) + (!scrollIsRootNode ? this.scrollParent.scrollLeft() : 0)
  8379. };
  8380. },
  8381. _cacheMargins: function () {
  8382. this.margins = {
  8383. left: (parseInt(this.element.css("marginLeft"), 10) || 0),
  8384. top: (parseInt(this.element.css("marginTop"), 10) || 0),
  8385. right: (parseInt(this.element.css("marginRight"), 10) || 0),
  8386. bottom: (parseInt(this.element.css("marginBottom"), 10) || 0)
  8387. };
  8388. },
  8389. _cacheHelperProportions: function () {
  8390. this.helperProportions = {
  8391. width: this.helper.outerWidth(),
  8392. height: this.helper.outerHeight()
  8393. };
  8394. },
  8395. _setContainment: function () {
  8396. var isUserScrollable, c, ce, o = this.options, document = this.document[0];
  8397. this.relativeContainer = null;
  8398. if (!o.containment) {
  8399. this.containment = null;
  8400. return;
  8401. }
  8402. if (o.containment === "window") {
  8403. this.containment = [$(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left, $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top, $(window).scrollLeft() + $(window).width() - this.helperProportions.width - this.margins.left, $(window).scrollTop() + ($(window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top];
  8404. return;
  8405. }
  8406. if (o.containment === "document") {
  8407. this.containment = [0, 0, $(document).width() - this.helperProportions.width - this.margins.left, ($(document).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top];
  8408. return;
  8409. }
  8410. if (o.containment.constructor === Array) {
  8411. this.containment = o.containment;
  8412. return;
  8413. }
  8414. if (o.containment === "parent") {
  8415. o.containment = this.helper[0].parentNode;
  8416. }
  8417. c = $(o.containment);
  8418. ce = c[0];
  8419. if (!ce) {
  8420. return;
  8421. }
  8422. isUserScrollable = /(scroll|auto)/.test(c.css("overflow"));
  8423. this.containment = [(parseInt(c.css("borderLeftWidth"), 10) || 0) + (parseInt(c.css("paddingLeft"), 10) || 0), (parseInt(c.css("borderTopWidth"), 10) || 0) + (parseInt(c.css("paddingTop"), 10) || 0), (isUserScrollable ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) - (parseInt(c.css("borderRightWidth"), 10) || 0) - (parseInt(c.css("paddingRight"), 10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right, (isUserScrollable ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) - (parseInt(c.css("borderBottomWidth"), 10) || 0) - (parseInt(c.css("paddingBottom"), 10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom];
  8424. this.relativeContainer = c;
  8425. },
  8426. _convertPositionTo: function (d, pos) {
  8427. if (!pos) {
  8428. pos = this.position;
  8429. }
  8430. var mod = d === "absolute" ? 1 : -1
  8431. , scrollIsRootNode = this._isRootNode(this.scrollParent[0]);
  8432. return {
  8433. top: (
  8434. // The absolute mouse position
  8435. pos.top +
  8436. // Only for relative positioned nodes: Relative offset from element to offset parent
  8437. this.offset.relative.top * mod +
  8438. // The offsetParent's offset without borders (offset + border)
  8439. this.offset.parent.top * mod - ((this.cssPosition === "fixed" ? -this.offset.scroll.top : (scrollIsRootNode ? 0 : this.offset.scroll.top)) * mod)),
  8440. left: (
  8441. // The absolute mouse position
  8442. pos.left +
  8443. // Only for relative positioned nodes: Relative offset from element to offset parent
  8444. this.offset.relative.left * mod +
  8445. // The offsetParent's offset without borders (offset + border)
  8446. this.offset.parent.left * mod - ((this.cssPosition === "fixed" ? -this.offset.scroll.left : (scrollIsRootNode ? 0 : this.offset.scroll.left)) * mod))
  8447. };
  8448. },
  8449. _generatePosition: function (event, constrainPosition) {
  8450. var containment, co, top, left, o = this.options, scrollIsRootNode = this._isRootNode(this.scrollParent[0]),
  8451. pageX = event.pageX, pageY = event.pageY;
  8452. // Cache the scroll
  8453. if (!scrollIsRootNode || !this.offset.scroll) {
  8454. this.offset.scroll = {
  8455. top: this.scrollParent.scrollTop(),
  8456. left: this.scrollParent.scrollLeft()
  8457. };
  8458. }
  8459. /*
  8460. * - Position constraining -
  8461. * Constrain the position to a mix of grid, containment.
  8462. */
  8463. // If we are not dragging yet, we won't check for options
  8464. if (constrainPosition) {
  8465. if (this.containment) {
  8466. if (this.relativeContainer) {
  8467. co = this.relativeContainer.offset();
  8468. containment = [this.containment[0] + co.left, this.containment[1] + co.top, this.containment[2] + co.left, this.containment[3] + co.top];
  8469. } else {
  8470. containment = this.containment;
  8471. }
  8472. if (event.pageX - this.offset.click.left < containment[0]) {
  8473. pageX = containment[0] + this.offset.click.left;
  8474. }
  8475. if (event.pageY - this.offset.click.top < containment[1]) {
  8476. pageY = containment[1] + this.offset.click.top;
  8477. }
  8478. if (event.pageX - this.offset.click.left > containment[2]) {
  8479. pageX = containment[2] + this.offset.click.left;
  8480. }
  8481. if (event.pageY - this.offset.click.top > containment[3]) {
  8482. pageY = containment[3] + this.offset.click.top;
  8483. }
  8484. }
  8485. if (o.grid) {
  8486. //Check for grid elements set to 0 to prevent divide by 0 error causing invalid
  8487. // argument errors in IE (see ticket #6950)
  8488. top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
  8489. pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
  8490. left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
  8491. pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
  8492. }
  8493. if (o.axis === "y") {
  8494. pageX = this.originalPageX;
  8495. }
  8496. if (o.axis === "x") {
  8497. pageY = this.originalPageY;
  8498. }
  8499. }
  8500. return {
  8501. top: (
  8502. // The absolute mouse position
  8503. pageY -
  8504. // Click offset (relative to the element)
  8505. this.offset.click.top -
  8506. // Only for relative positioned nodes: Relative offset from element to offset parent
  8507. this.offset.relative.top -
  8508. // The offsetParent's offset without borders (offset + border)
  8509. this.offset.parent.top + (this.cssPosition === "fixed" ? -this.offset.scroll.top : (scrollIsRootNode ? 0 : this.offset.scroll.top))),
  8510. left: (
  8511. // The absolute mouse position
  8512. pageX -
  8513. // Click offset (relative to the element)
  8514. this.offset.click.left -
  8515. // Only for relative positioned nodes: Relative offset from element to offset parent
  8516. this.offset.relative.left -
  8517. // The offsetParent's offset without borders (offset + border)
  8518. this.offset.parent.left + (this.cssPosition === "fixed" ? -this.offset.scroll.left : (scrollIsRootNode ? 0 : this.offset.scroll.left)))
  8519. };
  8520. },
  8521. _clear: function () {
  8522. this._removeClass(this.helper, "ui-draggable-dragging");
  8523. if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
  8524. this.helper.remove();
  8525. }
  8526. this.helper = null;
  8527. this.cancelHelperRemoval = false;
  8528. if (this.destroyOnClear) {
  8529. this.destroy();
  8530. }
  8531. },
  8532. // From now on bulk stuff - mainly helpers
  8533. _trigger: function (type, event, ui) {
  8534. ui = ui || this._uiHash();
  8535. $.ui.plugin.call(this, type, [event, ui, this], true);
  8536. // Absolute position and offset (see #6884 ) have to be recalculated after plugins
  8537. if (/^(drag|start|stop)/.test(type)) {
  8538. this.positionAbs = this._convertPositionTo("absolute");
  8539. ui.offset = this.positionAbs;
  8540. }
  8541. return $.Widget.prototype._trigger.call(this, type, event, ui);
  8542. },
  8543. plugins: {},
  8544. _uiHash: function () {
  8545. return {
  8546. helper: this.helper,
  8547. position: this.position,
  8548. originalPosition: this.originalPosition,
  8549. offset: this.positionAbs
  8550. };
  8551. }
  8552. });
  8553. $.ui.plugin.add("draggable", "connectToSortable", {
  8554. start: function (event, ui, draggable) {
  8555. var uiSortable = $.extend({}, ui, {
  8556. item: draggable.element
  8557. });
  8558. draggable.sortables = [];
  8559. $(draggable.options.connectToSortable).each(function () {
  8560. var sortable = $(this).sortable("instance");
  8561. if (sortable && !sortable.options.disabled) {
  8562. draggable.sortables.push(sortable);
  8563. // RefreshPositions is called at drag start to refresh the containerCache
  8564. // which is used in drag. This ensures it's initialized and synchronized
  8565. // with any changes that might have happened on the page since initialization.
  8566. sortable.refreshPositions();
  8567. sortable._trigger("activate", event, uiSortable);
  8568. }
  8569. });
  8570. },
  8571. stop: function (event, ui, draggable) {
  8572. var uiSortable = $.extend({}, ui, {
  8573. item: draggable.element
  8574. });
  8575. draggable.cancelHelperRemoval = false;
  8576. $.each(draggable.sortables, function () {
  8577. var sortable = this;
  8578. if (sortable.isOver) {
  8579. sortable.isOver = 0;
  8580. // Allow this sortable to handle removing the helper
  8581. draggable.cancelHelperRemoval = true;
  8582. sortable.cancelHelperRemoval = false;
  8583. // Use _storedCSS To restore properties in the sortable,
  8584. // as this also handles revert (#9675) since the draggable
  8585. // may have modified them in unexpected ways (#8809)
  8586. sortable._storedCSS = {
  8587. position: sortable.placeholder.css("position"),
  8588. top: sortable.placeholder.css("top"),
  8589. left: sortable.placeholder.css("left")
  8590. };
  8591. sortable._mouseStop(event);
  8592. // Once drag has ended, the sortable should return to using
  8593. // its original helper, not the shared helper from draggable
  8594. sortable.options.helper = sortable.options._helper;
  8595. } else {
  8596. // Prevent this Sortable from removing the helper.
  8597. // However, don't set the draggable to remove the helper
  8598. // either as another connected Sortable may yet handle the removal.
  8599. sortable.cancelHelperRemoval = true;
  8600. sortable._trigger("deactivate", event, uiSortable);
  8601. }
  8602. });
  8603. },
  8604. drag: function (event, ui, draggable) {
  8605. $.each(draggable.sortables, function () {
  8606. var innermostIntersecting = false
  8607. , sortable = this;
  8608. // Copy over variables that sortable's _intersectsWith uses
  8609. sortable.positionAbs = draggable.positionAbs;
  8610. sortable.helperProportions = draggable.helperProportions;
  8611. sortable.offset.click = draggable.offset.click;
  8612. if (sortable._intersectsWith(sortable.containerCache)) {
  8613. innermostIntersecting = true;
  8614. $.each(draggable.sortables, function () {
  8615. // Copy over variables that sortable's _intersectsWith uses
  8616. this.positionAbs = draggable.positionAbs;
  8617. this.helperProportions = draggable.helperProportions;
  8618. this.offset.click = draggable.offset.click;
  8619. if (this !== sortable && this._intersectsWith(this.containerCache) && $.contains(sortable.element[0], this.element[0])) {
  8620. innermostIntersecting = false;
  8621. }
  8622. return innermostIntersecting;
  8623. });
  8624. }
  8625. if (innermostIntersecting) {
  8626. // If it intersects, we use a little isOver variable and set it once,
  8627. // so that the move-in stuff gets fired only once.
  8628. if (!sortable.isOver) {
  8629. sortable.isOver = 1;
  8630. // Store draggable's parent in case we need to reappend to it later.
  8631. draggable._parent = ui.helper.parent();
  8632. sortable.currentItem = ui.helper.appendTo(sortable.element).data("ui-sortable-item", true);
  8633. // Store helper option to later restore it
  8634. sortable.options._helper = sortable.options.helper;
  8635. sortable.options.helper = function () {
  8636. return ui.helper[0];
  8637. }
  8638. ;
  8639. // Fire the start events of the sortable with our passed browser event,
  8640. // and our own helper (so it doesn't create a new one)
  8641. event.target = sortable.currentItem[0];
  8642. sortable._mouseCapture(event, true);
  8643. sortable._mouseStart(event, true, true);
  8644. // Because the browser event is way off the new appended portlet,
  8645. // modify necessary variables to reflect the changes
  8646. sortable.offset.click.top = draggable.offset.click.top;
  8647. sortable.offset.click.left = draggable.offset.click.left;
  8648. sortable.offset.parent.left -= draggable.offset.parent.left - sortable.offset.parent.left;
  8649. sortable.offset.parent.top -= draggable.offset.parent.top - sortable.offset.parent.top;
  8650. draggable._trigger("toSortable", event);
  8651. // Inform draggable that the helper is in a valid drop zone,
  8652. // used solely in the revert option to handle "valid/invalid".
  8653. draggable.dropped = sortable.element;
  8654. // Need to refreshPositions of all sortables in the case that
  8655. // adding to one sortable changes the location of the other sortables (#9675)
  8656. $.each(draggable.sortables, function () {
  8657. this.refreshPositions();
  8658. });
  8659. // Hack so receive/update callbacks work (mostly)
  8660. draggable.currentItem = draggable.element;
  8661. sortable.fromOutside = draggable;
  8662. }
  8663. if (sortable.currentItem) {
  8664. sortable._mouseDrag(event);
  8665. // Copy the sortable's position because the draggable's can potentially reflect
  8666. // a relative position, while sortable is always absolute, which the dragged
  8667. // element has now become. (#8809)
  8668. ui.position = sortable.position;
  8669. }
  8670. } else {
  8671. // If it doesn't intersect with the sortable, and it intersected before,
  8672. // we fake the drag stop of the sortable, but make sure it doesn't remove
  8673. // the helper by using cancelHelperRemoval.
  8674. if (sortable.isOver) {
  8675. sortable.isOver = 0;
  8676. sortable.cancelHelperRemoval = true;
  8677. // Calling sortable's mouseStop would trigger a revert,
  8678. // so revert must be temporarily false until after mouseStop is called.
  8679. sortable.options._revert = sortable.options.revert;
  8680. sortable.options.revert = false;
  8681. sortable._trigger("out", event, sortable._uiHash(sortable));
  8682. sortable._mouseStop(event, true);
  8683. // Restore sortable behaviors that were modfied
  8684. // when the draggable entered the sortable area (#9481)
  8685. sortable.options.revert = sortable.options._revert;
  8686. sortable.options.helper = sortable.options._helper;
  8687. if (sortable.placeholder) {
  8688. sortable.placeholder.remove();
  8689. }
  8690. // Restore and recalculate the draggable's offset considering the sortable
  8691. // may have modified them in unexpected ways. (#8809, #10669)
  8692. ui.helper.appendTo(draggable._parent);
  8693. draggable._refreshOffsets(event);
  8694. ui.position = draggable._generatePosition(event, true);
  8695. draggable._trigger("fromSortable", event);
  8696. // Inform draggable that the helper is no longer in a valid drop zone
  8697. draggable.dropped = false;
  8698. // Need to refreshPositions of all sortables just in case removing
  8699. // from one sortable changes the location of other sortables (#9675)
  8700. $.each(draggable.sortables, function () {
  8701. this.refreshPositions();
  8702. });
  8703. }
  8704. }
  8705. });
  8706. }
  8707. });
  8708. $.ui.plugin.add("draggable", "cursor", {
  8709. start: function (event, ui, instance) {
  8710. var t = $("body")
  8711. , o = instance.options;
  8712. if (t.css("cursor")) {
  8713. o._cursor = t.css("cursor");
  8714. }
  8715. t.css("cursor", o.cursor);
  8716. },
  8717. stop: function (event, ui, instance) {
  8718. var o = instance.options;
  8719. if (o._cursor) {
  8720. $("body").css("cursor", o._cursor);
  8721. }
  8722. }
  8723. });
  8724. $.ui.plugin.add("draggable", "opacity", {
  8725. start: function (event, ui, instance) {
  8726. var t = $(ui.helper)
  8727. , o = instance.options;
  8728. if (t.css("opacity")) {
  8729. o._opacity = t.css("opacity");
  8730. }
  8731. t.css("opacity", o.opacity);
  8732. },
  8733. stop: function (event, ui, instance) {
  8734. var o = instance.options;
  8735. if (o._opacity) {
  8736. $(ui.helper).css("opacity", o._opacity);
  8737. }
  8738. }
  8739. });
  8740. $.ui.plugin.add("draggable", "scroll", {
  8741. start: function (event, ui, i) {
  8742. if (!i.scrollParentNotHidden) {
  8743. i.scrollParentNotHidden = i.helper.scrollParent(false);
  8744. }
  8745. if (i.scrollParentNotHidden[0] !== i.document[0] && i.scrollParentNotHidden[0].tagName !== "HTML") {
  8746. i.overflowOffset = i.scrollParentNotHidden.offset();
  8747. }
  8748. },
  8749. drag: function (event, ui, i) {
  8750. var o = i.options
  8751. , scrolled = false
  8752. , scrollParent = i.scrollParentNotHidden[0]
  8753. , document = i.document[0];
  8754. if (scrollParent !== document && scrollParent.tagName !== "HTML") {
  8755. if (!o.axis || o.axis !== "x") {
  8756. if ((i.overflowOffset.top + scrollParent.offsetHeight) - event.pageY < o.scrollSensitivity) {
  8757. scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
  8758. } else if (event.pageY - i.overflowOffset.top < o.scrollSensitivity) {
  8759. scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
  8760. }
  8761. }
  8762. if (!o.axis || o.axis !== "y") {
  8763. if ((i.overflowOffset.left + scrollParent.offsetWidth) - event.pageX < o.scrollSensitivity) {
  8764. scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
  8765. } else if (event.pageX - i.overflowOffset.left < o.scrollSensitivity) {
  8766. scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
  8767. }
  8768. }
  8769. } else {
  8770. if (!o.axis || o.axis !== "x") {
  8771. if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
  8772. scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
  8773. } else if ($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
  8774. scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
  8775. }
  8776. }
  8777. if (!o.axis || o.axis !== "y") {
  8778. if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
  8779. scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
  8780. } else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
  8781. scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
  8782. }
  8783. }
  8784. }
  8785. if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
  8786. $.ui.ddmanager.prepareOffsets(i, event);
  8787. }
  8788. }
  8789. });
  8790. $.ui.plugin.add("draggable", "snap", {
  8791. start: function (event, ui, i) {
  8792. var o = i.options;
  8793. i.snapElements = [];
  8794. $(o.snap.constructor !== String ? (o.snap.items || ":data(ui-draggable)") : o.snap).each(function () {
  8795. var $t = $(this)
  8796. , $o = $t.offset();
  8797. if (this !== i.element[0]) {
  8798. i.snapElements.push({
  8799. item: this,
  8800. width: $t.outerWidth(),
  8801. height: $t.outerHeight(),
  8802. top: $o.top,
  8803. left: $o.left
  8804. });
  8805. }
  8806. });
  8807. },
  8808. drag: function (event, ui, inst) {
  8809. var ts, bs, ls, rs, l, r, t, b, i, first, o = inst.options, d = o.snapTolerance, x1 = ui.offset.left,
  8810. x2 = x1 + inst.helperProportions.width, y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
  8811. for (i = inst.snapElements.length - 1; i >= 0; i--) {
  8812. l = inst.snapElements[i].left - inst.margins.left;
  8813. r = l + inst.snapElements[i].width;
  8814. t = inst.snapElements[i].top - inst.margins.top;
  8815. b = t + inst.snapElements[i].height;
  8816. if (x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains(inst.snapElements[i].item.ownerDocument, inst.snapElements[i].item)) {
  8817. if (inst.snapElements[i].snapping) {
  8818. if (inst.options.snap.release) {
  8819. inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), {
  8820. snapItem: inst.snapElements[i].item
  8821. }));
  8822. }
  8823. }
  8824. inst.snapElements[i].snapping = false;
  8825. continue;
  8826. }
  8827. if (o.snapMode !== "inner") {
  8828. ts = Math.abs(t - y2) <= d;
  8829. bs = Math.abs(b - y1) <= d;
  8830. ls = Math.abs(l - x2) <= d;
  8831. rs = Math.abs(r - x1) <= d;
  8832. if (ts) {
  8833. ui.position.top = inst._convertPositionTo("relative", {
  8834. top: t - inst.helperProportions.height,
  8835. left: 0
  8836. }).top;
  8837. }
  8838. if (bs) {
  8839. ui.position.top = inst._convertPositionTo("relative", {
  8840. top: b,
  8841. left: 0
  8842. }).top;
  8843. }
  8844. if (ls) {
  8845. ui.position.left = inst._convertPositionTo("relative", {
  8846. top: 0,
  8847. left: l - inst.helperProportions.width
  8848. }).left;
  8849. }
  8850. if (rs) {
  8851. ui.position.left = inst._convertPositionTo("relative", {
  8852. top: 0,
  8853. left: r
  8854. }).left;
  8855. }
  8856. }
  8857. first = (ts || bs || ls || rs);
  8858. if (o.snapMode !== "outer") {
  8859. ts = Math.abs(t - y1) <= d;
  8860. bs = Math.abs(b - y2) <= d;
  8861. ls = Math.abs(l - x1) <= d;
  8862. rs = Math.abs(r - x2) <= d;
  8863. if (ts) {
  8864. ui.position.top = inst._convertPositionTo("relative", {
  8865. top: t,
  8866. left: 0
  8867. }).top;
  8868. }
  8869. if (bs) {
  8870. ui.position.top = inst._convertPositionTo("relative", {
  8871. top: b - inst.helperProportions.height,
  8872. left: 0
  8873. }).top;
  8874. }
  8875. if (ls) {
  8876. ui.position.left = inst._convertPositionTo("relative", {
  8877. top: 0,
  8878. left: l
  8879. }).left;
  8880. }
  8881. if (rs) {
  8882. ui.position.left = inst._convertPositionTo("relative", {
  8883. top: 0,
  8884. left: r - inst.helperProportions.width
  8885. }).left;
  8886. }
  8887. }
  8888. if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
  8889. if (inst.options.snap.snap) {
  8890. inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), {
  8891. snapItem: inst.snapElements[i].item
  8892. }));
  8893. }
  8894. }
  8895. inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
  8896. }
  8897. }
  8898. });
  8899. $.ui.plugin.add("draggable", "stack", {
  8900. start: function (event, ui, instance) {
  8901. var min, o = instance.options, group = $.makeArray($(o.stack)).sort(function (a, b) {
  8902. return (parseInt($(a).css("zIndex"), 10) || 0) - (parseInt($(b).css("zIndex"), 10) || 0);
  8903. });
  8904. if (!group.length) {
  8905. return;
  8906. }
  8907. min = parseInt($(group[0]).css("zIndex"), 10) || 0;
  8908. $(group).each(function (i) {
  8909. $(this).css("zIndex", min + i);
  8910. });
  8911. this.css("zIndex", (min + group.length));
  8912. }
  8913. });
  8914. $.ui.plugin.add("draggable", "zIndex", {
  8915. start: function (event, ui, instance) {
  8916. var t = $(ui.helper)
  8917. , o = instance.options;
  8918. if (t.css("zIndex")) {
  8919. o._zIndex = t.css("zIndex");
  8920. }
  8921. t.css("zIndex", o.zIndex);
  8922. },
  8923. stop: function (event, ui, instance) {
  8924. var o = instance.options;
  8925. if (o._zIndex) {
  8926. $(ui.helper).css("zIndex", o._zIndex);
  8927. }
  8928. }
  8929. });
  8930. var widgetsDraggable = $.ui.draggable;
  8931. /*!
  8932. * jQuery UI Resizable 1.13.0
  8933. * http://jqueryui.com
  8934. *
  8935. * Copyright jQuery Foundation and other contributors
  8936. * Released under the MIT license.
  8937. * http://jquery.org/license
  8938. */
  8939. //>>label: Resizable
  8940. //>>group: Interactions
  8941. //>>description: Enables resize functionality for any element.
  8942. //>>docs: http://api.jqueryui.com/resizable/
  8943. //>>demos: http://jqueryui.com/resizable/
  8944. //>>css.structure: ../../themes/base/core.css
  8945. //>>css.structure: ../../themes/base/resizable.css
  8946. //>>css.theme: ../../themes/base/theme.css
  8947. $.widget("ui.resizable", $.ui.mouse, {
  8948. version: "1.13.0",
  8949. widgetEventPrefix: "resize",
  8950. options: {
  8951. alsoResize: false,
  8952. animate: false,
  8953. animateDuration: "slow",
  8954. animateEasing: "swing",
  8955. aspectRatio: false,
  8956. autoHide: false,
  8957. classes: {
  8958. "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se"
  8959. },
  8960. containment: false,
  8961. ghost: false,
  8962. grid: false,
  8963. handles: "e,s,se",
  8964. helper: false,
  8965. maxHeight: null,
  8966. maxWidth: null,
  8967. minHeight: 10,
  8968. minWidth: 10,
  8969. // See #7960
  8970. zIndex: 90,
  8971. // Callbacks
  8972. resize: null,
  8973. start: null,
  8974. stop: null
  8975. },
  8976. _num: function (value) {
  8977. return parseFloat(value) || 0;
  8978. },
  8979. _isNumber: function (value) {
  8980. return !isNaN(parseFloat(value));
  8981. },
  8982. _hasScroll: function (el, a) {
  8983. if ($(el).css("overflow") === "hidden") {
  8984. return false;
  8985. }
  8986. var scroll = (a && a === "left") ? "scrollLeft" : "scrollTop"
  8987. , has = false;
  8988. if (el[scroll] > 0) {
  8989. return true;
  8990. }
  8991. // TODO: determine which cases actually cause this to happen
  8992. // if the element doesn't have the scroll set, see if it's possible to
  8993. // set the scroll
  8994. try {
  8995. el[scroll] = 1;
  8996. has = (el[scroll] > 0);
  8997. el[scroll] = 0;
  8998. } catch (e) {
  8999. // `el` might be a string, then setting `scroll` will throw
  9000. // an error in strict mode; ignore it.
  9001. }
  9002. return has;
  9003. },
  9004. _create: function () {
  9005. var margins, o = this.options, that = this;
  9006. this._addClass("ui-resizable");
  9007. $.extend(this, {
  9008. _aspectRatio: !!(o.aspectRatio),
  9009. aspectRatio: o.aspectRatio,
  9010. originalElement: this.element,
  9011. _proportionallyResizeElements: [],
  9012. _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
  9013. });
  9014. // Wrap the element if it cannot hold child nodes
  9015. if (this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)) {
  9016. this.element.wrap($("<div class='ui-wrapper'></div>").css({
  9017. overflow: "hidden",
  9018. position: this.element.css("position"),
  9019. width: this.element.outerWidth(),
  9020. height: this.element.outerHeight(),
  9021. top: this.element.css("top"),
  9022. left: this.element.css("left")
  9023. }));
  9024. this.element = this.element.parent().data("ui-resizable", this.element.resizable("instance"));
  9025. this.elementIsWrapper = true;
  9026. margins = {
  9027. marginTop: this.originalElement.css("marginTop"),
  9028. marginRight: this.originalElement.css("marginRight"),
  9029. marginBottom: this.originalElement.css("marginBottom"),
  9030. marginLeft: this.originalElement.css("marginLeft")
  9031. };
  9032. this.element.css(margins);
  9033. this.originalElement.css("margin", 0);
  9034. // support: Safari
  9035. // Prevent Safari textarea resize
  9036. this.originalResizeStyle = this.originalElement.css("resize");
  9037. this.originalElement.css("resize", "none");
  9038. this._proportionallyResizeElements.push(this.originalElement.css({
  9039. position: "static",
  9040. zoom: 1,
  9041. display: "block"
  9042. }));
  9043. // Support: IE9
  9044. // avoid IE jump (hard set the margin)
  9045. this.originalElement.css(margins);
  9046. this._proportionallyResize();
  9047. }
  9048. this._setupHandles();
  9049. if (o.autoHide) {
  9050. $(this.element).on("mouseenter", function () {
  9051. if (o.disabled) {
  9052. return;
  9053. }
  9054. that._removeClass("ui-resizable-autohide");
  9055. that._handles.show();
  9056. }).on("mouseleave", function () {
  9057. if (o.disabled) {
  9058. return;
  9059. }
  9060. if (!that.resizing) {
  9061. that._addClass("ui-resizable-autohide");
  9062. that._handles.hide();
  9063. }
  9064. });
  9065. }
  9066. this._mouseInit();
  9067. },
  9068. _destroy: function () {
  9069. this._mouseDestroy();
  9070. this._addedHandles.remove();
  9071. var wrapper, _destroy = function (exp) {
  9072. $(exp).removeData("resizable").removeData("ui-resizable").off(".resizable");
  9073. };
  9074. // TODO: Unwrap at same DOM position
  9075. if (this.elementIsWrapper) {
  9076. _destroy(this.element);
  9077. wrapper = this.element;
  9078. this.originalElement.css({
  9079. position: wrapper.css("position"),
  9080. width: wrapper.outerWidth(),
  9081. height: wrapper.outerHeight(),
  9082. top: wrapper.css("top"),
  9083. left: wrapper.css("left")
  9084. }).insertAfter(wrapper);
  9085. wrapper.remove();
  9086. }
  9087. this.originalElement.css("resize", this.originalResizeStyle);
  9088. _destroy(this.originalElement);
  9089. return this;
  9090. },
  9091. _setOption: function (key, value) {
  9092. this._super(key, value);
  9093. switch (key) {
  9094. case "handles":
  9095. this._removeHandles();
  9096. this._setupHandles();
  9097. break;
  9098. case "aspectRatio":
  9099. this._aspectRatio = !!value;
  9100. break;
  9101. default:
  9102. break;
  9103. }
  9104. },
  9105. _setupHandles: function () {
  9106. var o = this.options, handle, i, n, hname, axis, that = this;
  9107. this.handles = o.handles || (!$(".ui-resizable-handle", this.element).length ? "e,s,se" : {
  9108. n: ".ui-resizable-n",
  9109. e: ".ui-resizable-e",
  9110. s: ".ui-resizable-s",
  9111. w: ".ui-resizable-w",
  9112. se: ".ui-resizable-se",
  9113. sw: ".ui-resizable-sw",
  9114. ne: ".ui-resizable-ne",
  9115. nw: ".ui-resizable-nw"
  9116. });
  9117. this._handles = $();
  9118. this._addedHandles = $();
  9119. if (this.handles.constructor === String) {
  9120. if (this.handles === "all") {
  9121. this.handles = "n,e,s,w,se,sw,ne,nw";
  9122. }
  9123. n = this.handles.split(",");
  9124. this.handles = {};
  9125. for (i = 0; i < n.length; i++) {
  9126. handle = String.prototype.trim.call(n[i]);
  9127. hname = "ui-resizable-" + handle;
  9128. axis = $("<div>");
  9129. this._addClass(axis, "ui-resizable-handle " + hname);
  9130. axis.css({
  9131. zIndex: o.zIndex
  9132. });
  9133. this.handles[handle] = ".ui-resizable-" + handle;
  9134. if (!this.element.children(this.handles[handle]).length) {
  9135. this.element.append(axis);
  9136. this._addedHandles = this._addedHandles.add(axis);
  9137. }
  9138. }
  9139. }
  9140. this._renderAxis = function (target) {
  9141. var i, axis, padPos, padWrapper;
  9142. target = target || this.element;
  9143. for (i in this.handles) {
  9144. if (this.handles[i].constructor === String) {
  9145. this.handles[i] = this.element.children(this.handles[i]).first().show();
  9146. } else if (this.handles[i].jquery || this.handles[i].nodeType) {
  9147. this.handles[i] = $(this.handles[i]);
  9148. this._on(this.handles[i], {
  9149. "mousedown": that._mouseDown
  9150. });
  9151. }
  9152. if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)) {
  9153. axis = $(this.handles[i], this.element);
  9154. padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
  9155. padPos = ["padding", /ne|nw|n/.test(i) ? "Top" : /se|sw|s/.test(i) ? "Bottom" : /^e$/.test(i) ? "Right" : "Left"].join("");
  9156. target.css(padPos, padWrapper);
  9157. this._proportionallyResize();
  9158. }
  9159. this._handles = this._handles.add(this.handles[i]);
  9160. }
  9161. }
  9162. ;
  9163. // TODO: make renderAxis a prototype function
  9164. this._renderAxis(this.element);
  9165. this._handles = this._handles.add(this.element.find(".ui-resizable-handle"));
  9166. this._handles.disableSelection();
  9167. this._handles.on("mouseover", function () {
  9168. if (!that.resizing) {
  9169. if (this.className) {
  9170. axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
  9171. }
  9172. that.axis = axis && axis[1] ? axis[1] : "se";
  9173. }
  9174. });
  9175. if (o.autoHide) {
  9176. this._handles.hide();
  9177. this._addClass("ui-resizable-autohide");
  9178. }
  9179. },
  9180. _removeHandles: function () {
  9181. this._addedHandles.remove();
  9182. },
  9183. _mouseCapture: function (event) {
  9184. var i, handle, capture = false;
  9185. for (i in this.handles) {
  9186. handle = $(this.handles[i])[0];
  9187. if (handle === event.target || $.contains(handle, event.target)) {
  9188. capture = true;
  9189. }
  9190. }
  9191. return !this.options.disabled && capture;
  9192. },
  9193. _mouseStart: function (event) {
  9194. var curleft, curtop, cursor, o = this.options, el = this.element;
  9195. this.resizing = true;
  9196. this._renderProxy();
  9197. curleft = this._num(this.helper.css("left"));
  9198. curtop = this._num(this.helper.css("top"));
  9199. if (o.containment) {
  9200. curleft += $(o.containment).scrollLeft() || 0;
  9201. curtop += $(o.containment).scrollTop() || 0;
  9202. }
  9203. this.offset = this.helper.offset();
  9204. this.position = {
  9205. left: curleft,
  9206. top: curtop
  9207. };
  9208. this.size = this._helper ? {
  9209. width: this.helper.width(),
  9210. height: this.helper.height()
  9211. } : {
  9212. width: el.width(),
  9213. height: el.height()
  9214. };
  9215. this.originalSize = this._helper ? {
  9216. width: el.outerWidth(),
  9217. height: el.outerHeight()
  9218. } : {
  9219. width: el.width(),
  9220. height: el.height()
  9221. };
  9222. this.sizeDiff = {
  9223. width: el.outerWidth() - el.width(),
  9224. height: el.outerHeight() - el.height()
  9225. };
  9226. this.originalPosition = {
  9227. left: curleft,
  9228. top: curtop
  9229. };
  9230. this.originalMousePosition = {
  9231. left: event.pageX,
  9232. top: event.pageY
  9233. };
  9234. this.aspectRatio = (typeof o.aspectRatio === "number") ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
  9235. cursor = $(".ui-resizable-" + this.axis).css("cursor");
  9236. $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor);
  9237. this._addClass("ui-resizable-resizing");
  9238. this._propagate("start", event);
  9239. return true;
  9240. },
  9241. _mouseDrag: function (event) {
  9242. var data, props, smp = this.originalMousePosition, a = this.axis, dx = (event.pageX - smp.left) || 0,
  9243. dy = (event.pageY - smp.top) || 0, trigger = this._change[a];
  9244. this._updatePrevProperties();
  9245. if (!trigger) {
  9246. return false;
  9247. }
  9248. data = trigger.apply(this, [event, dx, dy]);
  9249. this._updateVirtualBoundaries(event.shiftKey);
  9250. if (this._aspectRatio || event.shiftKey) {
  9251. data = this._updateRatio(data, event);
  9252. }
  9253. data = this._respectSize(data, event);
  9254. this._updateCache(data);
  9255. this._propagate("resize", event);
  9256. props = this._applyChanges();
  9257. if (!this._helper && this._proportionallyResizeElements.length) {
  9258. this._proportionallyResize();
  9259. }
  9260. if (!$.isEmptyObject(props)) {
  9261. this._updatePrevProperties();
  9262. this._trigger("resize", event, this.ui());
  9263. this._applyChanges();
  9264. }
  9265. return false;
  9266. },
  9267. _mouseStop: function (event) {
  9268. this.resizing = false;
  9269. var pr, ista, soffseth, soffsetw, s, left, top, o = this.options, that = this;
  9270. if (this._helper) {
  9271. pr = this._proportionallyResizeElements;
  9272. ista = pr.length && (/textarea/i).test(pr[0].nodeName);
  9273. soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height;
  9274. soffsetw = ista ? 0 : that.sizeDiff.width;
  9275. s = {
  9276. width: (that.helper.width() - soffsetw),
  9277. height: (that.helper.height() - soffseth)
  9278. };
  9279. left = (parseFloat(that.element.css("left")) + (that.position.left - that.originalPosition.left)) || null;
  9280. top = (parseFloat(that.element.css("top")) + (that.position.top - that.originalPosition.top)) || null;
  9281. if (!o.animate) {
  9282. this.element.css($.extend(s, {
  9283. top: top,
  9284. left: left
  9285. }));
  9286. }
  9287. that.helper.height(that.size.height);
  9288. that.helper.width(that.size.width);
  9289. if (this._helper && !o.animate) {
  9290. this._proportionallyResize();
  9291. }
  9292. }
  9293. $("body").css("cursor", "auto");
  9294. this._removeClass("ui-resizable-resizing");
  9295. this._propagate("stop", event);
  9296. if (this._helper) {
  9297. this.helper.remove();
  9298. }
  9299. return false;
  9300. },
  9301. _updatePrevProperties: function () {
  9302. this.prevPosition = {
  9303. top: this.position.top,
  9304. left: this.position.left
  9305. };
  9306. this.prevSize = {
  9307. width: this.size.width,
  9308. height: this.size.height
  9309. };
  9310. },
  9311. _applyChanges: function () {
  9312. var props = {};
  9313. if (this.position.top !== this.prevPosition.top) {
  9314. props.top = this.position.top + "px";
  9315. }
  9316. if (this.position.left !== this.prevPosition.left) {
  9317. props.left = this.position.left + "px";
  9318. }
  9319. if (this.size.width !== this.prevSize.width) {
  9320. props.width = this.size.width + "px";
  9321. }
  9322. if (this.size.height !== this.prevSize.height) {
  9323. props.height = this.size.height + "px";
  9324. }
  9325. this.helper.css(props);
  9326. return props;
  9327. },
  9328. _updateVirtualBoundaries: function (forceAspectRatio) {
  9329. var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, o = this.options;
  9330. b = {
  9331. minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0,
  9332. maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity,
  9333. minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0,
  9334. maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity
  9335. };
  9336. if (this._aspectRatio || forceAspectRatio) {
  9337. pMinWidth = b.minHeight * this.aspectRatio;
  9338. pMinHeight = b.minWidth / this.aspectRatio;
  9339. pMaxWidth = b.maxHeight * this.aspectRatio;
  9340. pMaxHeight = b.maxWidth / this.aspectRatio;
  9341. if (pMinWidth > b.minWidth) {
  9342. b.minWidth = pMinWidth;
  9343. }
  9344. if (pMinHeight > b.minHeight) {
  9345. b.minHeight = pMinHeight;
  9346. }
  9347. if (pMaxWidth < b.maxWidth) {
  9348. b.maxWidth = pMaxWidth;
  9349. }
  9350. if (pMaxHeight < b.maxHeight) {
  9351. b.maxHeight = pMaxHeight;
  9352. }
  9353. }
  9354. this._vBoundaries = b;
  9355. },
  9356. _updateCache: function (data) {
  9357. this.offset = this.helper.offset();
  9358. if (this._isNumber(data.left)) {
  9359. this.position.left = data.left;
  9360. }
  9361. if (this._isNumber(data.top)) {
  9362. this.position.top = data.top;
  9363. }
  9364. if (this._isNumber(data.height)) {
  9365. this.size.height = data.height;
  9366. }
  9367. if (this._isNumber(data.width)) {
  9368. this.size.width = data.width;
  9369. }
  9370. },
  9371. _updateRatio: function (data) {
  9372. var cpos = this.position
  9373. , csize = this.size
  9374. , a = this.axis;
  9375. if (this._isNumber(data.height)) {
  9376. data.width = (data.height * this.aspectRatio);
  9377. } else if (this._isNumber(data.width)) {
  9378. data.height = (data.width / this.aspectRatio);
  9379. }
  9380. if (a === "sw") {
  9381. data.left = cpos.left + (csize.width - data.width);
  9382. data.top = null;
  9383. }
  9384. if (a === "nw") {
  9385. data.top = cpos.top + (csize.height - data.height);
  9386. data.left = cpos.left + (csize.width - data.width);
  9387. }
  9388. return data;
  9389. },
  9390. _respectSize: function (data) {
  9391. var o = this._vBoundaries
  9392. , a = this.axis
  9393. , ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width)
  9394. , ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height)
  9395. , isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width)
  9396. , isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height)
  9397. , dw = this.originalPosition.left + this.originalSize.width
  9398. , dh = this.originalPosition.top + this.originalSize.height
  9399. , cw = /sw|nw|w/.test(a)
  9400. , ch = /nw|ne|n/.test(a);
  9401. if (isminw) {
  9402. data.width = o.minWidth;
  9403. }
  9404. if (isminh) {
  9405. data.height = o.minHeight;
  9406. }
  9407. if (ismaxw) {
  9408. data.width = o.maxWidth;
  9409. }
  9410. if (ismaxh) {
  9411. data.height = o.maxHeight;
  9412. }
  9413. if (isminw && cw) {
  9414. data.left = dw - o.minWidth;
  9415. }
  9416. if (ismaxw && cw) {
  9417. data.left = dw - o.maxWidth;
  9418. }
  9419. if (isminh && ch) {
  9420. data.top = dh - o.minHeight;
  9421. }
  9422. if (ismaxh && ch) {
  9423. data.top = dh - o.maxHeight;
  9424. }
  9425. // Fixing jump error on top/left - bug #2330
  9426. if (!data.width && !data.height && !data.left && data.top) {
  9427. data.top = null;
  9428. } else if (!data.width && !data.height && !data.top && data.left) {
  9429. data.left = null;
  9430. }
  9431. return data;
  9432. },
  9433. _getPaddingPlusBorderDimensions: function (element) {
  9434. var i = 0
  9435. , widths = []
  9436. ,
  9437. borders = [element.css("borderTopWidth"), element.css("borderRightWidth"), element.css("borderBottomWidth"), element.css("borderLeftWidth")]
  9438. ,
  9439. paddings = [element.css("paddingTop"), element.css("paddingRight"), element.css("paddingBottom"), element.css("paddingLeft")];
  9440. for (; i < 4; i++) {
  9441. widths[i] = (parseFloat(borders[i]) || 0);
  9442. widths[i] += (parseFloat(paddings[i]) || 0);
  9443. }
  9444. return {
  9445. height: widths[0] + widths[2],
  9446. width: widths[1] + widths[3]
  9447. };
  9448. },
  9449. _proportionallyResize: function () {
  9450. if (!this._proportionallyResizeElements.length) {
  9451. return;
  9452. }
  9453. var prel, i = 0, element = this.helper || this.element;
  9454. for (; i < this._proportionallyResizeElements.length; i++) {
  9455. prel = this._proportionallyResizeElements[i];
  9456. // TODO: Seems like a bug to cache this.outerDimensions
  9457. // considering that we are in a loop.
  9458. if (!this.outerDimensions) {
  9459. this.outerDimensions = this._getPaddingPlusBorderDimensions(prel);
  9460. }
  9461. prel.css({
  9462. height: (element.height() - this.outerDimensions.height) || 0,
  9463. width: (element.width() - this.outerDimensions.width) || 0
  9464. });
  9465. }
  9466. },
  9467. _renderProxy: function () {
  9468. var el = this.element
  9469. , o = this.options;
  9470. this.elementOffset = el.offset();
  9471. if (this._helper) {
  9472. this.helper = this.helper || $("<div></div>").css({
  9473. overflow: "hidden"
  9474. });
  9475. this._addClass(this.helper, this._helper);
  9476. this.helper.css({
  9477. width: this.element.outerWidth(),
  9478. height: this.element.outerHeight(),
  9479. position: "absolute",
  9480. left: this.elementOffset.left + "px",
  9481. top: this.elementOffset.top + "px",
  9482. zIndex: ++o.zIndex //TODO: Don't modify option
  9483. });
  9484. this.helper.appendTo("body").disableSelection();
  9485. } else {
  9486. this.helper = this.element;
  9487. }
  9488. },
  9489. _change: {
  9490. e: function (event, dx) {
  9491. return {
  9492. width: this.originalSize.width + dx
  9493. };
  9494. },
  9495. w: function (event, dx) {
  9496. var cs = this.originalSize
  9497. , sp = this.originalPosition;
  9498. return {
  9499. left: sp.left + dx,
  9500. width: cs.width - dx
  9501. };
  9502. },
  9503. n: function (event, dx, dy) {
  9504. var cs = this.originalSize
  9505. , sp = this.originalPosition;
  9506. return {
  9507. top: sp.top + dy,
  9508. height: cs.height - dy
  9509. };
  9510. },
  9511. s: function (event, dx, dy) {
  9512. return {
  9513. height: this.originalSize.height + dy
  9514. };
  9515. },
  9516. se: function (event, dx, dy) {
  9517. return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
  9518. },
  9519. sw: function (event, dx, dy) {
  9520. return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
  9521. },
  9522. ne: function (event, dx, dy) {
  9523. return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
  9524. },
  9525. nw: function (event, dx, dy) {
  9526. return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
  9527. }
  9528. },
  9529. _propagate: function (n, event) {
  9530. $.ui.plugin.call(this, n, [event, this.ui()]);
  9531. if (n !== "resize") {
  9532. this._trigger(n, event, this.ui());
  9533. }
  9534. },
  9535. plugins: {},
  9536. ui: function () {
  9537. return {
  9538. originalElement: this.originalElement,
  9539. element: this.element,
  9540. helper: this.helper,
  9541. position: this.position,
  9542. size: this.size,
  9543. originalSize: this.originalSize,
  9544. originalPosition: this.originalPosition
  9545. };
  9546. }
  9547. });
  9548. /*
  9549. * Resizable Extensions
  9550. */
  9551. $.ui.plugin.add("resizable", "animate", {
  9552. stop: function (event) {
  9553. var that = $(this).resizable("instance")
  9554. , o = that.options
  9555. , pr = that._proportionallyResizeElements
  9556. , ista = pr.length && (/textarea/i).test(pr[0].nodeName)
  9557. , soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height
  9558. , soffsetw = ista ? 0 : that.sizeDiff.width
  9559. , style = {
  9560. width: (that.size.width - soffsetw),
  9561. height: (that.size.height - soffseth)
  9562. }
  9563. ,
  9564. left = (parseFloat(that.element.css("left")) + (that.position.left - that.originalPosition.left)) || null
  9565. , top = (parseFloat(that.element.css("top")) + (that.position.top - that.originalPosition.top)) || null;
  9566. that.element.animate($.extend(style, top && left ? {
  9567. top: top,
  9568. left: left
  9569. } : {}), {
  9570. duration: o.animateDuration,
  9571. easing: o.animateEasing,
  9572. step: function () {
  9573. var data = {
  9574. width: parseFloat(that.element.css("width")),
  9575. height: parseFloat(that.element.css("height")),
  9576. top: parseFloat(that.element.css("top")),
  9577. left: parseFloat(that.element.css("left"))
  9578. };
  9579. if (pr && pr.length) {
  9580. $(pr[0]).css({
  9581. width: data.width,
  9582. height: data.height
  9583. });
  9584. }
  9585. // Propagating resize, and updating values for each animation step
  9586. that._updateCache(data);
  9587. that._propagate("resize", event);
  9588. }
  9589. });
  9590. }
  9591. });
  9592. $.ui.plugin.add("resizable", "containment", {
  9593. start: function () {
  9594. var element, p, co, ch, cw, width, height, that = $(this).resizable("instance"), o = that.options,
  9595. el = that.element, oc = o.containment,
  9596. ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
  9597. if (!ce) {
  9598. return;
  9599. }
  9600. that.containerElement = $(ce);
  9601. if (/document/.test(oc) || oc === document) {
  9602. that.containerOffset = {
  9603. left: 0,
  9604. top: 0
  9605. };
  9606. that.containerPosition = {
  9607. left: 0,
  9608. top: 0
  9609. };
  9610. that.parentData = {
  9611. element: $(document),
  9612. left: 0,
  9613. top: 0,
  9614. width: $(document).width(),
  9615. height: $(document).height() || document.body.parentNode.scrollHeight
  9616. };
  9617. } else {
  9618. element = $(ce);
  9619. p = [];
  9620. $(["Top", "Right", "Left", "Bottom"]).each(function (i, name) {
  9621. p[i] = that._num(element.css("padding" + name));
  9622. });
  9623. that.containerOffset = element.offset();
  9624. that.containerPosition = element.position();
  9625. that.containerSize = {
  9626. height: (element.innerHeight() - p[3]),
  9627. width: (element.innerWidth() - p[1])
  9628. };
  9629. co = that.containerOffset;
  9630. ch = that.containerSize.height;
  9631. cw = that.containerSize.width;
  9632. width = (that._hasScroll(ce, "left") ? ce.scrollWidth : cw);
  9633. height = (that._hasScroll(ce) ? ce.scrollHeight : ch);
  9634. that.parentData = {
  9635. element: ce,
  9636. left: co.left,
  9637. top: co.top,
  9638. width: width,
  9639. height: height
  9640. };
  9641. }
  9642. },
  9643. resize: function (event) {
  9644. var woset, hoset, isParent, isOffsetRelative, that = $(this).resizable("instance"), o = that.options,
  9645. co = that.containerOffset, cp = that.position, pRatio = that._aspectRatio || event.shiftKey, cop = {
  9646. top: 0,
  9647. left: 0
  9648. }, ce = that.containerElement, continueResize = true;
  9649. if (ce[0] !== document && (/static/).test(ce.css("position"))) {
  9650. cop = co;
  9651. }
  9652. if (cp.left < (that._helper ? co.left : 0)) {
  9653. that.size.width = that.size.width + (that._helper ? (that.position.left - co.left) : (that.position.left - cop.left));
  9654. if (pRatio) {
  9655. that.size.height = that.size.width / that.aspectRatio;
  9656. continueResize = false;
  9657. }
  9658. that.position.left = o.helper ? co.left : 0;
  9659. }
  9660. if (cp.top < (that._helper ? co.top : 0)) {
  9661. that.size.height = that.size.height + (that._helper ? (that.position.top - co.top) : that.position.top);
  9662. if (pRatio) {
  9663. that.size.width = that.size.height * that.aspectRatio;
  9664. continueResize = false;
  9665. }
  9666. that.position.top = that._helper ? co.top : 0;
  9667. }
  9668. isParent = that.containerElement.get(0) === that.element.parent().get(0);
  9669. isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position"));
  9670. if (isParent && isOffsetRelative) {
  9671. that.offset.left = that.parentData.left + that.position.left;
  9672. that.offset.top = that.parentData.top + that.position.top;
  9673. } else {
  9674. that.offset.left = that.element.offset().left;
  9675. that.offset.top = that.element.offset().top;
  9676. }
  9677. woset = Math.abs(that.sizeDiff.width + (that._helper ? that.offset.left - cop.left : (that.offset.left - co.left)));
  9678. hoset = Math.abs(that.sizeDiff.height + (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)));
  9679. if (woset + that.size.width >= that.parentData.width) {
  9680. that.size.width = that.parentData.width - woset;
  9681. if (pRatio) {
  9682. that.size.height = that.size.width / that.aspectRatio;
  9683. continueResize = false;
  9684. }
  9685. }
  9686. if (hoset + that.size.height >= that.parentData.height) {
  9687. that.size.height = that.parentData.height - hoset;
  9688. if (pRatio) {
  9689. that.size.width = that.size.height * that.aspectRatio;
  9690. continueResize = false;
  9691. }
  9692. }
  9693. if (!continueResize) {
  9694. that.position.left = that.prevPosition.left;
  9695. that.position.top = that.prevPosition.top;
  9696. that.size.width = that.prevSize.width;
  9697. that.size.height = that.prevSize.height;
  9698. }
  9699. },
  9700. stop: function () {
  9701. var that = $(this).resizable("instance")
  9702. , o = that.options
  9703. , co = that.containerOffset
  9704. , cop = that.containerPosition
  9705. , ce = that.containerElement
  9706. , helper = $(that.helper)
  9707. , ho = helper.offset()
  9708. , w = helper.outerWidth() - that.sizeDiff.width
  9709. , h = helper.outerHeight() - that.sizeDiff.height;
  9710. if (that._helper && !o.animate && (/relative/).test(ce.css("position"))) {
  9711. $(this).css({
  9712. left: ho.left - cop.left - co.left,
  9713. width: w,
  9714. height: h
  9715. });
  9716. }
  9717. if (that._helper && !o.animate && (/static/).test(ce.css("position"))) {
  9718. $(this).css({
  9719. left: ho.left - cop.left - co.left,
  9720. width: w,
  9721. height: h
  9722. });
  9723. }
  9724. }
  9725. });
  9726. $.ui.plugin.add("resizable", "alsoResize", {
  9727. start: function () {
  9728. var that = $(this).resizable("instance")
  9729. , o = that.options;
  9730. $(o.alsoResize).each(function () {
  9731. var el = $(this);
  9732. el.data("ui-resizable-alsoresize", {
  9733. width: parseFloat(el.width()),
  9734. height: parseFloat(el.height()),
  9735. left: parseFloat(el.css("left")),
  9736. top: parseFloat(el.css("top"))
  9737. });
  9738. });
  9739. },
  9740. resize: function (event, ui) {
  9741. var that = $(this).resizable("instance")
  9742. , o = that.options
  9743. , os = that.originalSize
  9744. , op = that.originalPosition
  9745. , delta = {
  9746. height: (that.size.height - os.height) || 0,
  9747. width: (that.size.width - os.width) || 0,
  9748. top: (that.position.top - op.top) || 0,
  9749. left: (that.position.left - op.left) || 0
  9750. };
  9751. $(o.alsoResize).each(function () {
  9752. var el = $(this)
  9753. , start = $(this).data("ui-resizable-alsoresize")
  9754. , style = {}
  9755. ,
  9756. css = el.parents(ui.originalElement[0]).length ? ["width", "height"] : ["width", "height", "top", "left"];
  9757. $.each(css, function (i, prop) {
  9758. var sum = (start[prop] || 0) + (delta[prop] || 0);
  9759. if (sum && sum >= 0) {
  9760. style[prop] = sum || null;
  9761. }
  9762. });
  9763. el.css(style);
  9764. });
  9765. },
  9766. stop: function () {
  9767. $(this).removeData("ui-resizable-alsoresize");
  9768. }
  9769. });
  9770. $.ui.plugin.add("resizable", "ghost", {
  9771. start: function () {
  9772. var that = $(this).resizable("instance")
  9773. , cs = that.size;
  9774. that.ghost = that.originalElement.clone();
  9775. that.ghost.css({
  9776. opacity: 0.25,
  9777. display: "block",
  9778. position: "relative",
  9779. height: cs.height,
  9780. width: cs.width,
  9781. margin: 0,
  9782. left: 0,
  9783. top: 0
  9784. });
  9785. that._addClass(that.ghost, "ui-resizable-ghost");
  9786. // DEPRECATED
  9787. // TODO: remove after 1.12
  9788. if ($.uiBackCompat !== false && typeof that.options.ghost === "string") {
  9789. // Ghost option
  9790. that.ghost.addClass(this.options.ghost);
  9791. }
  9792. that.ghost.appendTo(that.helper);
  9793. },
  9794. resize: function () {
  9795. var that = $(this).resizable("instance");
  9796. if (that.ghost) {
  9797. that.ghost.css({
  9798. position: "relative",
  9799. height: that.size.height,
  9800. width: that.size.width
  9801. });
  9802. }
  9803. },
  9804. stop: function () {
  9805. var that = $(this).resizable("instance");
  9806. if (that.ghost && that.helper) {
  9807. that.helper.get(0).removeChild(that.ghost.get(0));
  9808. }
  9809. }
  9810. });
  9811. $.ui.plugin.add("resizable", "grid", {
  9812. resize: function () {
  9813. var outerDimensions, that = $(this).resizable("instance"), o = that.options, cs = that.size,
  9814. os = that.originalSize, op = that.originalPosition, a = that.axis,
  9815. grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid, gridX = (grid[0] || 1),
  9816. gridY = (grid[1] || 1), ox = Math.round((cs.width - os.width) / gridX) * gridX,
  9817. oy = Math.round((cs.height - os.height) / gridY) * gridY, newWidth = os.width + ox,
  9818. newHeight = os.height + oy, isMaxWidth = o.maxWidth && (o.maxWidth < newWidth),
  9819. isMaxHeight = o.maxHeight && (o.maxHeight < newHeight),
  9820. isMinWidth = o.minWidth && (o.minWidth > newWidth),
  9821. isMinHeight = o.minHeight && (o.minHeight > newHeight);
  9822. o.grid = grid;
  9823. if (isMinWidth) {
  9824. newWidth += gridX;
  9825. }
  9826. if (isMinHeight) {
  9827. newHeight += gridY;
  9828. }
  9829. if (isMaxWidth) {
  9830. newWidth -= gridX;
  9831. }
  9832. if (isMaxHeight) {
  9833. newHeight -= gridY;
  9834. }
  9835. if (/^(se|s|e)$/.test(a)) {
  9836. that.size.width = newWidth;
  9837. that.size.height = newHeight;
  9838. } else if (/^(ne)$/.test(a)) {
  9839. that.size.width = newWidth;
  9840. that.size.height = newHeight;
  9841. that.position.top = op.top - oy;
  9842. } else if (/^(sw)$/.test(a)) {
  9843. that.size.width = newWidth;
  9844. that.size.height = newHeight;
  9845. that.position.left = op.left - ox;
  9846. } else {
  9847. if (newHeight - gridY <= 0 || newWidth - gridX <= 0) {
  9848. outerDimensions = that._getPaddingPlusBorderDimensions(this);
  9849. }
  9850. if (newHeight - gridY > 0) {
  9851. that.size.height = newHeight;
  9852. that.position.top = op.top - oy;
  9853. } else {
  9854. newHeight = gridY - outerDimensions.height;
  9855. that.size.height = newHeight;
  9856. that.position.top = op.top + os.height - newHeight;
  9857. }
  9858. if (newWidth - gridX > 0) {
  9859. that.size.width = newWidth;
  9860. that.position.left = op.left - ox;
  9861. } else {
  9862. newWidth = gridX - outerDimensions.width;
  9863. that.size.width = newWidth;
  9864. that.position.left = op.left + os.width - newWidth;
  9865. }
  9866. }
  9867. }
  9868. });
  9869. var widgetsResizable = $.ui.resizable;
  9870. /*!
  9871. * jQuery UI Dialog 1.13.0
  9872. * http://jqueryui.com
  9873. *
  9874. * Copyright jQuery Foundation and other contributors
  9875. * Released under the MIT license.
  9876. * http://jquery.org/license
  9877. */
  9878. //>>label: Dialog
  9879. //>>group: Widgets
  9880. //>>description: Displays customizable dialog windows.
  9881. //>>docs: http://api.jqueryui.com/dialog/
  9882. //>>demos: http://jqueryui.com/dialog/
  9883. //>>css.structure: ../../themes/base/core.css
  9884. //>>css.structure: ../../themes/base/dialog.css
  9885. //>>css.theme: ../../themes/base/theme.css
  9886. $.widget("ui.dialog", {
  9887. version: "1.13.0",
  9888. options: {
  9889. appendTo: "body",
  9890. autoOpen: true,
  9891. buttons: [],
  9892. classes: {
  9893. "ui-dialog": "ui-corner-all",
  9894. "ui-dialog-titlebar": "ui-corner-all"
  9895. },
  9896. closeOnEscape: true,
  9897. closeText: "Close",
  9898. draggable: true,
  9899. hide: null,
  9900. height: "auto",
  9901. maxHeight: null,
  9902. maxWidth: null,
  9903. minHeight: 150,
  9904. minWidth: 150,
  9905. modal: false,
  9906. position: {
  9907. my: "center",
  9908. at: "center",
  9909. of: window,
  9910. collision: "fit",
  9911. // Ensure the titlebar is always visible
  9912. using: function (pos) {
  9913. var topOffset = $(this).css(pos).offset().top;
  9914. if (topOffset < 0) {
  9915. $(this).css("top", pos.top - topOffset);
  9916. }
  9917. }
  9918. },
  9919. resizable: true,
  9920. show: null,
  9921. title: null,
  9922. width: 300,
  9923. // Callbacks
  9924. beforeClose: null,
  9925. close: null,
  9926. drag: null,
  9927. dragStart: null,
  9928. dragStop: null,
  9929. focus: null,
  9930. open: null,
  9931. resize: null,
  9932. resizeStart: null,
  9933. resizeStop: null
  9934. },
  9935. sizeRelatedOptions: {
  9936. buttons: true,
  9937. height: true,
  9938. maxHeight: true,
  9939. maxWidth: true,
  9940. minHeight: true,
  9941. minWidth: true,
  9942. width: true
  9943. },
  9944. resizableRelatedOptions: {
  9945. maxHeight: true,
  9946. maxWidth: true,
  9947. minHeight: true,
  9948. minWidth: true
  9949. },
  9950. _create: function () {
  9951. this.originalCss = {
  9952. display: this.element[0].style.display,
  9953. width: this.element[0].style.width,
  9954. minHeight: this.element[0].style.minHeight,
  9955. maxHeight: this.element[0].style.maxHeight,
  9956. height: this.element[0].style.height
  9957. };
  9958. this.originalPosition = {
  9959. parent: this.element.parent(),
  9960. index: this.element.parent().children().index(this.element)
  9961. };
  9962. this.originalTitle = this.element.attr("title");
  9963. if (this.options.title == null && this.originalTitle != null) {
  9964. this.options.title = this.originalTitle;
  9965. }
  9966. // Dialogs can't be disabled
  9967. if (this.options.disabled) {
  9968. this.options.disabled = false;
  9969. }
  9970. this._createWrapper();
  9971. this.element.show().removeAttr("title").appendTo(this.uiDialog);
  9972. this._addClass("ui-dialog-content", "ui-widget-content");
  9973. this._createTitlebar();
  9974. this._createButtonPane();
  9975. if (this.options.draggable && $.fn.draggable) {
  9976. this._makeDraggable();
  9977. }
  9978. if (this.options.resizable && $.fn.resizable) {
  9979. this._makeResizable();
  9980. }
  9981. this._isOpen = false;
  9982. this._trackFocus();
  9983. },
  9984. _init: function () {
  9985. if (this.options.autoOpen) {
  9986. this.open();
  9987. }
  9988. },
  9989. _appendTo: function () {
  9990. var element = this.options.appendTo;
  9991. if (element && (element.jquery || element.nodeType)) {
  9992. return $(element);
  9993. }
  9994. return this.document.find(element || "body").eq(0);
  9995. },
  9996. _destroy: function () {
  9997. var next, originalPosition = this.originalPosition;
  9998. this._untrackInstance();
  9999. this._destroyOverlay();
  10000. this.element.removeUniqueId().css(this.originalCss)
  10001. // Without detaching first, the following becomes really slow
  10002. .detach();
  10003. this.uiDialog.remove();
  10004. if (this.originalTitle) {
  10005. this.element.attr("title", this.originalTitle);
  10006. }
  10007. next = originalPosition.parent.children().eq(originalPosition.index);
  10008. // Don't try to place the dialog next to itself (#8613)
  10009. if (next.length && next[0] !== this.element[0]) {
  10010. next.before(this.element);
  10011. } else {
  10012. originalPosition.parent.append(this.element);
  10013. }
  10014. },
  10015. widget: function () {
  10016. return this.uiDialog;
  10017. },
  10018. disable: $.noop,
  10019. enable: $.noop,
  10020. close: function (event) {
  10021. var that = this;
  10022. if (!this._isOpen || this._trigger("beforeClose", event) === false) {
  10023. return;
  10024. }
  10025. this._isOpen = false;
  10026. this._focusedElement = null;
  10027. this._destroyOverlay();
  10028. this._untrackInstance();
  10029. if (!this.opener.filter(":focusable").trigger("focus").length) {
  10030. // Hiding a focused element doesn't trigger blur in WebKit
  10031. // so in case we have nothing to focus on, explicitly blur the active element
  10032. // https://bugs.webkit.org/show_bug.cgi?id=47182
  10033. $.ui.safeBlur($.ui.safeActiveElement(this.document[0]));
  10034. }
  10035. this._hide(this.uiDialog, this.options.hide, function () {
  10036. that._trigger("close", event);
  10037. });
  10038. },
  10039. isOpen: function () {
  10040. return this._isOpen;
  10041. },
  10042. moveToTop: function () {
  10043. this._moveToTop();
  10044. },
  10045. _moveToTop: function (event, silent) {
  10046. var moved = false
  10047. , zIndices = this.uiDialog.siblings(".ui-front:visible").map(function () {
  10048. return +$(this).css("z-index");
  10049. }).get()
  10050. , zIndexMax = Math.max.apply(null, zIndices);
  10051. if (zIndexMax >= +this.uiDialog.css("z-index")) {
  10052. this.uiDialog.css("z-index", zIndexMax + 1);
  10053. moved = true;
  10054. }
  10055. if (moved && !silent) {
  10056. this._trigger("focus", event);
  10057. }
  10058. return moved;
  10059. },
  10060. open: function () {
  10061. var that = this;
  10062. if (this._isOpen) {
  10063. if (this._moveToTop()) {
  10064. this._focusTabbable();
  10065. }
  10066. return;
  10067. }
  10068. this._isOpen = true;
  10069. this.opener = $($.ui.safeActiveElement(this.document[0]));
  10070. this._size();
  10071. this._position();
  10072. this._createOverlay();
  10073. this._moveToTop(null, true);
  10074. // Ensure the overlay is moved to the top with the dialog, but only when
  10075. // opening. The overlay shouldn't move after the dialog is open so that
  10076. // modeless dialogs opened after the modal dialog stack properly.
  10077. if (this.overlay) {
  10078. this.overlay.css("z-index", this.uiDialog.css("z-index") - 1);
  10079. }
  10080. this._show(this.uiDialog, this.options.show, function () {
  10081. that._focusTabbable();
  10082. that._trigger("focus");
  10083. });
  10084. // Track the dialog immediately upon opening in case a focus event
  10085. // somehow occurs outside of the dialog before an element inside the
  10086. // dialog is focused (#10152)
  10087. this._makeFocusTarget();
  10088. this._trigger("open");
  10089. },
  10090. _focusTabbable: function () {
  10091. // Set focus to the first match:
  10092. // 1. An element that was focused previously
  10093. // 2. First element inside the dialog matching [autofocus]
  10094. // 3. Tabbable element inside the content element
  10095. // 4. Tabbable element inside the buttonpane
  10096. // 5. The close button
  10097. // 6. The dialog itself
  10098. var hasFocus = this._focusedElement;
  10099. if (!hasFocus) {
  10100. hasFocus = this.element.find("[autofocus]");
  10101. }
  10102. if (!hasFocus.length) {
  10103. hasFocus = this.element.find(":tabbable");
  10104. }
  10105. if (!hasFocus.length) {
  10106. hasFocus = this.uiDialogButtonPane.find(":tabbable");
  10107. }
  10108. if (!hasFocus.length) {
  10109. hasFocus = this.uiDialogTitlebarClose.filter(":tabbable");
  10110. }
  10111. if (!hasFocus.length) {
  10112. hasFocus = this.uiDialog;
  10113. }
  10114. hasFocus.eq(0).trigger("focus");
  10115. },
  10116. _restoreTabbableFocus: function () {
  10117. var activeElement = $.ui.safeActiveElement(this.document[0])
  10118. , isActive = this.uiDialog[0] === activeElement || $.contains(this.uiDialog[0], activeElement);
  10119. if (!isActive) {
  10120. this._focusTabbable();
  10121. }
  10122. },
  10123. _keepFocus: function (event) {
  10124. event.preventDefault();
  10125. this._restoreTabbableFocus();
  10126. // support: IE
  10127. // IE <= 8 doesn't prevent moving focus even with event.preventDefault()
  10128. // so we check again later
  10129. this._delay(this._restoreTabbableFocus);
  10130. },
  10131. _createWrapper: function () {
  10132. this.uiDialog = $("<div>").hide().attr({
  10133. // Setting tabIndex makes the div focusable
  10134. tabIndex: -1,
  10135. role: "dialog"
  10136. }).appendTo(this._appendTo());
  10137. this._addClass(this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front");
  10138. this._on(this.uiDialog, {
  10139. keydown: function (event) {
  10140. if (this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && event.keyCode === $.ui.keyCode.ESCAPE) {
  10141. event.preventDefault();
  10142. this.close(event);
  10143. return;
  10144. }
  10145. // Prevent tabbing out of dialogs
  10146. if (event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented()) {
  10147. return;
  10148. }
  10149. var tabbables = this.uiDialog.find(":tabbable")
  10150. , first = tabbables.first()
  10151. , last = tabbables.last();
  10152. if ((event.target === last[0] || event.target === this.uiDialog[0]) && !event.shiftKey) {
  10153. this._delay(function () {
  10154. first.trigger("focus");
  10155. });
  10156. event.preventDefault();
  10157. } else if ((event.target === first[0] || event.target === this.uiDialog[0]) && event.shiftKey) {
  10158. this._delay(function () {
  10159. last.trigger("focus");
  10160. });
  10161. event.preventDefault();
  10162. }
  10163. },
  10164. mousedown: function (event) {
  10165. if (this._moveToTop(event)) {
  10166. this._focusTabbable();
  10167. }
  10168. }
  10169. });
  10170. // We assume that any existing aria-describedby attribute means
  10171. // that the dialog content is marked up properly
  10172. // otherwise we brute force the content as the description
  10173. if (!this.element.find("[aria-describedby]").length) {
  10174. this.uiDialog.attr({
  10175. "aria-describedby": this.element.uniqueId().attr("id")
  10176. });
  10177. }
  10178. },
  10179. _createTitlebar: function () {
  10180. var uiDialogTitle;
  10181. this.uiDialogTitlebar = $("<div>");
  10182. this._addClass(this.uiDialogTitlebar, "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix");
  10183. this._on(this.uiDialogTitlebar, {
  10184. mousedown: function (event) {
  10185. // Don't prevent click on close button (#8838)
  10186. // Focusing a dialog that is partially scrolled out of view
  10187. // causes the browser to scroll it into view, preventing the click event
  10188. if (!$(event.target).closest(".ui-dialog-titlebar-close")) {
  10189. // Dialog isn't getting focus when dragging (#8063)
  10190. this.uiDialog.trigger("focus");
  10191. }
  10192. }
  10193. });
  10194. // Support: IE
  10195. // Use type="button" to prevent enter keypresses in textboxes from closing the
  10196. // dialog in IE (#9312)
  10197. this.uiDialogTitlebarClose = $("<button type='button'></button>").button({
  10198. label: $("<a>").text(this.options.closeText).html(),
  10199. icon: "ui-icon-closethick",
  10200. showLabel: false
  10201. }).appendTo(this.uiDialogTitlebar);
  10202. this._addClass(this.uiDialogTitlebarClose, "ui-dialog-titlebar-close");
  10203. this._on(this.uiDialogTitlebarClose, {
  10204. click: function (event) {
  10205. event.preventDefault();
  10206. this.close(event);
  10207. }
  10208. });
  10209. uiDialogTitle = $("<span>").uniqueId().prependTo(this.uiDialogTitlebar);
  10210. this._addClass(uiDialogTitle, "ui-dialog-title");
  10211. this._title(uiDialogTitle);
  10212. this.uiDialogTitlebar.prependTo(this.uiDialog);
  10213. this.uiDialog.attr({
  10214. "aria-labelledby": uiDialogTitle.attr("id")
  10215. });
  10216. },
  10217. _title: function (title) {
  10218. if (this.options.title) {
  10219. title.text(this.options.title);
  10220. } else {
  10221. title.html("&#160;");
  10222. }
  10223. },
  10224. _createButtonPane: function () {
  10225. this.uiDialogButtonPane = $("<div>");
  10226. this._addClass(this.uiDialogButtonPane, "ui-dialog-buttonpane", "ui-widget-content ui-helper-clearfix");
  10227. this.uiButtonSet = $("<div>").appendTo(this.uiDialogButtonPane);
  10228. this._addClass(this.uiButtonSet, "ui-dialog-buttonset");
  10229. this._createButtons();
  10230. },
  10231. _createButtons: function () {
  10232. var that = this
  10233. , buttons = this.options.buttons;
  10234. // If we already have a button pane, remove it
  10235. this.uiDialogButtonPane.remove();
  10236. this.uiButtonSet.empty();
  10237. if ($.isEmptyObject(buttons) || (Array.isArray(buttons) && !buttons.length)) {
  10238. this._removeClass(this.uiDialog, "ui-dialog-buttons");
  10239. return;
  10240. }
  10241. $.each(buttons, function (name, props) {
  10242. var click, buttonOptions;
  10243. props = typeof props === "function" ? {
  10244. click: props,
  10245. text: name
  10246. } : props;
  10247. // Default to a non-submitting button
  10248. props = $.extend({
  10249. type: "button"
  10250. }, props);
  10251. // Change the context for the click callback to be the main element
  10252. click = props.click;
  10253. buttonOptions = {
  10254. icon: props.icon,
  10255. iconPosition: props.iconPosition,
  10256. showLabel: props.showLabel,
  10257. // Deprecated options
  10258. icons: props.icons,
  10259. text: props.text
  10260. };
  10261. delete props.click;
  10262. delete props.icon;
  10263. delete props.iconPosition;
  10264. delete props.showLabel;
  10265. // Deprecated options
  10266. delete props.icons;
  10267. if (typeof props.text === "boolean") {
  10268. delete props.text;
  10269. }
  10270. $("<button></button>", props).button(buttonOptions).appendTo(that.uiButtonSet).on("click", function () {
  10271. click.apply(that.element[0], arguments);
  10272. });
  10273. });
  10274. this._addClass(this.uiDialog, "ui-dialog-buttons");
  10275. this.uiDialogButtonPane.appendTo(this.uiDialog);
  10276. },
  10277. _makeDraggable: function () {
  10278. var that = this
  10279. , options = this.options;
  10280. function filteredUi(ui) {
  10281. return {
  10282. position: ui.position,
  10283. offset: ui.offset
  10284. };
  10285. }
  10286. this.uiDialog.draggable({
  10287. cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
  10288. handle: ".ui-dialog-titlebar",
  10289. containment: "document",
  10290. start: function (event, ui) {
  10291. that._addClass($(this), "ui-dialog-dragging");
  10292. that._blockFrames();
  10293. that._trigger("dragStart", event, filteredUi(ui));
  10294. },
  10295. drag: function (event, ui) {
  10296. that._trigger("drag", event, filteredUi(ui));
  10297. },
  10298. stop: function (event, ui) {
  10299. var left = ui.offset.left - that.document.scrollLeft()
  10300. , top = ui.offset.top - that.document.scrollTop();
  10301. options.position = {
  10302. my: "left top",
  10303. at: "left" + (left >= 0 ? "+" : "") + left + " " + "top" + (top >= 0 ? "+" : "") + top,
  10304. of: that.window
  10305. };
  10306. that._removeClass($(this), "ui-dialog-dragging");
  10307. that._unblockFrames();
  10308. that._trigger("dragStop", event, filteredUi(ui));
  10309. }
  10310. });
  10311. },
  10312. _makeResizable: function () {
  10313. var that = this
  10314. , options = this.options
  10315. , handles = options.resizable
  10316. ,
  10317. // .ui-resizable has position: relative defined in the stylesheet
  10318. // but dialogs have to use absolute or fixed positioning
  10319. position = this.uiDialog.css("position")
  10320. , resizeHandles = typeof handles === "string" ? handles : "n,e,s,w,se,sw,ne,nw";
  10321. function filteredUi(ui) {
  10322. return {
  10323. originalPosition: ui.originalPosition,
  10324. originalSize: ui.originalSize,
  10325. position: ui.position,
  10326. size: ui.size
  10327. };
  10328. }
  10329. this.uiDialog.resizable({
  10330. cancel: ".ui-dialog-content",
  10331. containment: "document",
  10332. alsoResize: this.element,
  10333. maxWidth: options.maxWidth,
  10334. maxHeight: options.maxHeight,
  10335. minWidth: options.minWidth,
  10336. minHeight: this._minHeight(),
  10337. handles: resizeHandles,
  10338. start: function (event, ui) {
  10339. that._addClass($(this), "ui-dialog-resizing");
  10340. that._blockFrames();
  10341. that._trigger("resizeStart", event, filteredUi(ui));
  10342. },
  10343. resize: function (event, ui) {
  10344. that._trigger("resize", event, filteredUi(ui));
  10345. },
  10346. stop: function (event, ui) {
  10347. var offset = that.uiDialog.offset()
  10348. , left = offset.left - that.document.scrollLeft()
  10349. , top = offset.top - that.document.scrollTop();
  10350. options.height = that.uiDialog.height();
  10351. options.width = that.uiDialog.width();
  10352. options.position = {
  10353. my: "left top",
  10354. at: "left" + (left >= 0 ? "+" : "") + left + " " + "top" + (top >= 0 ? "+" : "") + top,
  10355. of: that.window
  10356. };
  10357. that._removeClass($(this), "ui-dialog-resizing");
  10358. that._unblockFrames();
  10359. that._trigger("resizeStop", event, filteredUi(ui));
  10360. }
  10361. }).css("position", position);
  10362. },
  10363. _trackFocus: function () {
  10364. this._on(this.widget(), {
  10365. focusin: function (event) {
  10366. this._makeFocusTarget();
  10367. this._focusedElement = $(event.target);
  10368. }
  10369. });
  10370. },
  10371. _makeFocusTarget: function () {
  10372. this._untrackInstance();
  10373. this._trackingInstances().unshift(this);
  10374. },
  10375. _untrackInstance: function () {
  10376. var instances = this._trackingInstances()
  10377. , exists = $.inArray(this, instances);
  10378. if (exists !== -1) {
  10379. instances.splice(exists, 1);
  10380. }
  10381. },
  10382. _trackingInstances: function () {
  10383. var instances = this.document.data("ui-dialog-instances");
  10384. if (!instances) {
  10385. instances = [];
  10386. this.document.data("ui-dialog-instances", instances);
  10387. }
  10388. return instances;
  10389. },
  10390. _minHeight: function () {
  10391. var options = this.options;
  10392. return options.height === "auto" ? options.minHeight : Math.min(options.minHeight, options.height);
  10393. },
  10394. _position: function () {
  10395. // Need to show the dialog to get the actual offset in the position plugin
  10396. var isVisible = this.uiDialog.is(":visible");
  10397. if (!isVisible) {
  10398. this.uiDialog.show();
  10399. }
  10400. this.uiDialog.position(this.options.position);
  10401. if (!isVisible) {
  10402. this.uiDialog.hide();
  10403. }
  10404. },
  10405. _setOptions: function (options) {
  10406. var that = this
  10407. , resize = false
  10408. , resizableOptions = {};
  10409. $.each(options, function (key, value) {
  10410. that._setOption(key, value);
  10411. if (key in that.sizeRelatedOptions) {
  10412. resize = true;
  10413. }
  10414. if (key in that.resizableRelatedOptions) {
  10415. resizableOptions[key] = value;
  10416. }
  10417. });
  10418. if (resize) {
  10419. this._size();
  10420. this._position();
  10421. }
  10422. if (this.uiDialog.is(":data(ui-resizable)")) {
  10423. this.uiDialog.resizable("option", resizableOptions);
  10424. }
  10425. },
  10426. _setOption: function (key, value) {
  10427. var isDraggable, isResizable, uiDialog = this.uiDialog;
  10428. if (key === "disabled") {
  10429. return;
  10430. }
  10431. this._super(key, value);
  10432. if (key === "appendTo") {
  10433. this.uiDialog.appendTo(this._appendTo());
  10434. }
  10435. if (key === "buttons") {
  10436. this._createButtons();
  10437. }
  10438. if (key === "closeText") {
  10439. this.uiDialogTitlebarClose.button({
  10440. // Ensure that we always pass a string
  10441. label: $("<a>").text("" + this.options.closeText).html()
  10442. });
  10443. }
  10444. if (key === "draggable") {
  10445. isDraggable = uiDialog.is(":data(ui-draggable)");
  10446. if (isDraggable && !value) {
  10447. uiDialog.draggable("destroy");
  10448. }
  10449. if (!isDraggable && value) {
  10450. this._makeDraggable();
  10451. }
  10452. }
  10453. if (key === "position") {
  10454. this._position();
  10455. }
  10456. if (key === "resizable") {
  10457. // currently resizable, becoming non-resizable
  10458. isResizable = uiDialog.is(":data(ui-resizable)");
  10459. if (isResizable && !value) {
  10460. uiDialog.resizable("destroy");
  10461. }
  10462. // Currently resizable, changing handles
  10463. if (isResizable && typeof value === "string") {
  10464. uiDialog.resizable("option", "handles", value);
  10465. }
  10466. // Currently non-resizable, becoming resizable
  10467. if (!isResizable && value !== false) {
  10468. this._makeResizable();
  10469. }
  10470. }
  10471. if (key === "title") {
  10472. this._title(this.uiDialogTitlebar.find(".ui-dialog-title"));
  10473. }
  10474. },
  10475. _size: function () {
  10476. // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
  10477. // divs will both have width and height set, so we need to reset them
  10478. var nonContentHeight, minContentHeight, maxContentHeight, options = this.options;
  10479. // Reset content sizing
  10480. this.element.show().css({
  10481. width: "auto",
  10482. minHeight: 0,
  10483. maxHeight: "none",
  10484. height: 0
  10485. });
  10486. if (options.minWidth > options.width) {
  10487. options.width = options.minWidth;
  10488. }
  10489. // Reset wrapper sizing
  10490. // determine the height of all the non-content elements
  10491. nonContentHeight = this.uiDialog.css({
  10492. height: "auto",
  10493. width: options.width
  10494. }).outerHeight();
  10495. minContentHeight = Math.max(0, options.minHeight - nonContentHeight);
  10496. maxContentHeight = typeof options.maxHeight === "number" ? Math.max(0, options.maxHeight - nonContentHeight) : "none";
  10497. if (options.height === "auto") {
  10498. this.element.css({
  10499. minHeight: minContentHeight,
  10500. maxHeight: maxContentHeight,
  10501. height: "auto"
  10502. });
  10503. } else {
  10504. this.element.height(Math.max(0, options.height - nonContentHeight));
  10505. }
  10506. if (this.uiDialog.is(":data(ui-resizable)")) {
  10507. this.uiDialog.resizable("option", "minHeight", this._minHeight());
  10508. }
  10509. },
  10510. _blockFrames: function () {
  10511. this.iframeBlocks = this.document.find("iframe").map(function () {
  10512. var iframe = $(this);
  10513. return $("<div>").css({
  10514. position: "absolute",
  10515. width: iframe.outerWidth(),
  10516. height: iframe.outerHeight()
  10517. }).appendTo(iframe.parent()).offset(iframe.offset())[0];
  10518. });
  10519. },
  10520. _unblockFrames: function () {
  10521. if (this.iframeBlocks) {
  10522. this.iframeBlocks.remove();
  10523. delete this.iframeBlocks;
  10524. }
  10525. },
  10526. _allowInteraction: function (event) {
  10527. if ($(event.target).closest(".ui-dialog").length) {
  10528. return true;
  10529. }
  10530. // TODO: Remove hack when datepicker implements
  10531. // the .ui-front logic (#8989)
  10532. return !!$(event.target).closest(".ui-datepicker").length;
  10533. },
  10534. _createOverlay: function () {
  10535. if (!this.options.modal) {
  10536. return;
  10537. }
  10538. var jqMinor = $.fn.jquery.substring(0, 4);
  10539. // We use a delay in case the overlay is created from an
  10540. // event that we're going to be cancelling (#2804)
  10541. var isOpening = true;
  10542. this._delay(function () {
  10543. isOpening = false;
  10544. });
  10545. if (!this.document.data("ui-dialog-overlays")) {
  10546. // Prevent use of anchors and inputs
  10547. // This doesn't use `_on()` because it is a shared event handler
  10548. // across all open modal dialogs.
  10549. this.document.on("focusin.ui-dialog", function (event) {
  10550. if (isOpening) {
  10551. return;
  10552. }
  10553. var instance = this._trackingInstances()[0];
  10554. if (!instance._allowInteraction(event)) {
  10555. event.preventDefault();
  10556. instance._focusTabbable();
  10557. // Support: jQuery >=3.4 <3.6 only
  10558. // Focus re-triggering in jQuery 3.4/3.5 makes the original element
  10559. // have its focus event propagated last, breaking the re-targeting.
  10560. // Trigger focus in a delay in addition if needed to avoid the issue
  10561. // See https://github.com/jquery/jquery/issues/4382
  10562. if (jqMinor === "3.4." || jqMinor === "3.5.") {
  10563. instance._delay(instance._restoreTabbableFocus);
  10564. }
  10565. }
  10566. }
  10567. .bind(this));
  10568. }
  10569. this.overlay = $("<div>").appendTo(this._appendTo());
  10570. this._addClass(this.overlay, null, "ui-widget-overlay ui-front");
  10571. this._on(this.overlay, {
  10572. mousedown: "_keepFocus"
  10573. });
  10574. this.document.data("ui-dialog-overlays", (this.document.data("ui-dialog-overlays") || 0) + 1);
  10575. },
  10576. _destroyOverlay: function () {
  10577. if (!this.options.modal) {
  10578. return;
  10579. }
  10580. if (this.overlay) {
  10581. var overlays = this.document.data("ui-dialog-overlays") - 1;
  10582. if (!overlays) {
  10583. this.document.off("focusin.ui-dialog");
  10584. this.document.removeData("ui-dialog-overlays");
  10585. } else {
  10586. this.document.data("ui-dialog-overlays", overlays);
  10587. }
  10588. this.overlay.remove();
  10589. this.overlay = null;
  10590. }
  10591. }
  10592. });
  10593. // DEPRECATED
  10594. // TODO: switch return back to widget declaration at top of file when this is removed
  10595. if ($.uiBackCompat !== false) {
  10596. // Backcompat for dialogClass option
  10597. $.widget("ui.dialog", $.ui.dialog, {
  10598. options: {
  10599. dialogClass: ""
  10600. },
  10601. _createWrapper: function () {
  10602. this._super();
  10603. this.uiDialog.addClass(this.options.dialogClass);
  10604. },
  10605. _setOption: function (key, value) {
  10606. if (key === "dialogClass") {
  10607. this.uiDialog.removeClass(this.options.dialogClass).addClass(value);
  10608. }
  10609. this._superApply(arguments);
  10610. }
  10611. });
  10612. }
  10613. var widgetsDialog = $.ui.dialog;
  10614. /*!
  10615. * jQuery UI Droppable 1.13.0
  10616. * http://jqueryui.com
  10617. *
  10618. * Copyright jQuery Foundation and other contributors
  10619. * Released under the MIT license.
  10620. * http://jquery.org/license
  10621. */
  10622. //>>label: Droppable
  10623. //>>group: Interactions
  10624. //>>description: Enables drop targets for draggable elements.
  10625. //>>docs: http://api.jqueryui.com/droppable/
  10626. //>>demos: http://jqueryui.com/droppable/
  10627. $.widget("ui.droppable", {
  10628. version: "1.13.0",
  10629. widgetEventPrefix: "drop",
  10630. options: {
  10631. accept: "*",
  10632. addClasses: true,
  10633. greedy: false,
  10634. scope: "default",
  10635. tolerance: "intersect",
  10636. // Callbacks
  10637. activate: null,
  10638. deactivate: null,
  10639. drop: null,
  10640. out: null,
  10641. over: null
  10642. },
  10643. _create: function () {
  10644. var proportions, o = this.options, accept = o.accept;
  10645. this.isover = false;
  10646. this.isout = true;
  10647. this.accept = typeof accept === "function" ? accept : function (d) {
  10648. return d.is(accept);
  10649. }
  10650. ;
  10651. this.proportions = function (/* valueToWrite */
  10652. ) {
  10653. if (arguments.length) {
  10654. // Store the droppable's proportions
  10655. proportions = arguments[0];
  10656. } else {
  10657. // Retrieve or derive the droppable's proportions
  10658. return proportions ? proportions : proportions = {
  10659. width: this.element[0].offsetWidth,
  10660. height: this.element[0].offsetHeight
  10661. };
  10662. }
  10663. }
  10664. ;
  10665. this._addToManager(o.scope);
  10666. if (o.addClasses) {
  10667. this._addClass("ui-droppable");
  10668. }
  10669. },
  10670. _addToManager: function (scope) {
  10671. // Add the reference and positions to the manager
  10672. $.ui.ddmanager.droppables[scope] = $.ui.ddmanager.droppables[scope] || [];
  10673. $.ui.ddmanager.droppables[scope].push(this);
  10674. },
  10675. _splice: function (drop) {
  10676. var i = 0;
  10677. for (; i < drop.length; i++) {
  10678. if (drop[i] === this) {
  10679. drop.splice(i, 1);
  10680. }
  10681. }
  10682. },
  10683. _destroy: function () {
  10684. var drop = $.ui.ddmanager.droppables[this.options.scope];
  10685. this._splice(drop);
  10686. },
  10687. _setOption: function (key, value) {
  10688. if (key === "accept") {
  10689. this.accept = typeof value === "function" ? value : function (d) {
  10690. return d.is(value);
  10691. }
  10692. ;
  10693. } else if (key === "scope") {
  10694. var drop = $.ui.ddmanager.droppables[this.options.scope];
  10695. this._splice(drop);
  10696. this._addToManager(value);
  10697. }
  10698. this._super(key, value);
  10699. },
  10700. _activate: function (event) {
  10701. var draggable = $.ui.ddmanager.current;
  10702. this._addActiveClass();
  10703. if (draggable) {
  10704. this._trigger("activate", event, this.ui(draggable));
  10705. }
  10706. },
  10707. _deactivate: function (event) {
  10708. var draggable = $.ui.ddmanager.current;
  10709. this._removeActiveClass();
  10710. if (draggable) {
  10711. this._trigger("deactivate", event, this.ui(draggable));
  10712. }
  10713. },
  10714. _over: function (event) {
  10715. var draggable = $.ui.ddmanager.current;
  10716. // Bail if draggable and droppable are same element
  10717. if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) {
  10718. return;
  10719. }
  10720. if (this.accept.call(this.element[0], (draggable.currentItem || draggable.element))) {
  10721. this._addHoverClass();
  10722. this._trigger("over", event, this.ui(draggable));
  10723. }
  10724. },
  10725. _out: function (event) {
  10726. var draggable = $.ui.ddmanager.current;
  10727. // Bail if draggable and droppable are same element
  10728. if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) {
  10729. return;
  10730. }
  10731. if (this.accept.call(this.element[0], (draggable.currentItem || draggable.element))) {
  10732. this._removeHoverClass();
  10733. this._trigger("out", event, this.ui(draggable));
  10734. }
  10735. },
  10736. _drop: function (event, custom) {
  10737. var draggable = custom || $.ui.ddmanager.current
  10738. , childrenIntersection = false;
  10739. // Bail if draggable and droppable are same element
  10740. if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) {
  10741. return false;
  10742. }
  10743. this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function () {
  10744. var inst = $(this).droppable("instance");
  10745. if (inst.options.greedy && !inst.options.disabled && inst.options.scope === draggable.options.scope && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) && $.ui.intersect(draggable, $.extend(inst, {
  10746. offset: inst.element.offset()
  10747. }), inst.options.tolerance, event)) {
  10748. childrenIntersection = true;
  10749. return false;
  10750. }
  10751. });
  10752. if (childrenIntersection) {
  10753. return false;
  10754. }
  10755. if (this.accept.call(this.element[0], (draggable.currentItem || draggable.element))) {
  10756. this._removeActiveClass();
  10757. this._removeHoverClass();
  10758. this._trigger("drop", event, this.ui(draggable));
  10759. return this.element;
  10760. }
  10761. return false;
  10762. },
  10763. ui: function (c) {
  10764. return {
  10765. draggable: (c.currentItem || c.element),
  10766. helper: c.helper,
  10767. position: c.position,
  10768. offset: c.positionAbs
  10769. };
  10770. },
  10771. // Extension points just to make backcompat sane and avoid duplicating logic
  10772. // TODO: Remove in 1.14 along with call to it below
  10773. _addHoverClass: function () {
  10774. this._addClass("ui-droppable-hover");
  10775. },
  10776. _removeHoverClass: function () {
  10777. this._removeClass("ui-droppable-hover");
  10778. },
  10779. _addActiveClass: function () {
  10780. this._addClass("ui-droppable-active");
  10781. },
  10782. _removeActiveClass: function () {
  10783. this._removeClass("ui-droppable-active");
  10784. }
  10785. });
  10786. $.ui.intersect = (function () {
  10787. function isOverAxis(x, reference, size) {
  10788. return (x >= reference) && (x < (reference + size));
  10789. }
  10790. return function (draggable, droppable, toleranceMode, event) {
  10791. if (!droppable.offset) {
  10792. return false;
  10793. }
  10794. var x1 = (draggable.positionAbs || draggable.position.absolute).left + draggable.margins.left
  10795. , y1 = (draggable.positionAbs || draggable.position.absolute).top + draggable.margins.top
  10796. , x2 = x1 + draggable.helperProportions.width
  10797. , y2 = y1 + draggable.helperProportions.height
  10798. , l = droppable.offset.left
  10799. , t = droppable.offset.top
  10800. , r = l + droppable.proportions().width
  10801. , b = t + droppable.proportions().height;
  10802. switch (toleranceMode) {
  10803. case "fit":
  10804. return (l <= x1 && x2 <= r && t <= y1 && y2 <= b);
  10805. case "intersect":
  10806. return (l < x1 + (draggable.helperProportions.width / 2) && // Right Half
  10807. x2 - (draggable.helperProportions.width / 2) < r && // Left Half
  10808. t < y1 + (draggable.helperProportions.height / 2) && // Bottom Half
  10809. y2 - (draggable.helperProportions.height / 2) < b);
  10810. // Top Half
  10811. case "pointer":
  10812. return isOverAxis(event.pageY, t, droppable.proportions().height) && isOverAxis(event.pageX, l, droppable.proportions().width);
  10813. case "touch":
  10814. return ((y1 >= t && y1 <= b) || // Top edge touching
  10815. (y2 >= t && y2 <= b) || // Bottom edge touching
  10816. (y1 < t && y2 > b)// Surrounded vertically
  10817. ) && ((x1 >= l && x1 <= r) || // Left edge touching
  10818. (x2 >= l && x2 <= r) || // Right edge touching
  10819. (x1 < l && x2 > r)// Surrounded horizontally
  10820. );
  10821. default:
  10822. return false;
  10823. }
  10824. }
  10825. ;
  10826. }
  10827. )();
  10828. /*
  10829. This manager tracks offsets of draggables and droppables
  10830. */
  10831. $.ui.ddmanager = {
  10832. current: null,
  10833. droppables: {
  10834. "default": []
  10835. },
  10836. prepareOffsets: function (t, event) {
  10837. var i, j, m = $.ui.ddmanager.droppables[t.options.scope] || [], type = event ? event.type : null, // workaround for #2317
  10838. list = (t.currentItem || t.element).find(":data(ui-droppable)").addBack();
  10839. droppablesLoop: for (i = 0; i < m.length; i++) {
  10840. // No disabled and non-accepted
  10841. if (m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0], (t.currentItem || t.element)))) {
  10842. continue;
  10843. }
  10844. // Filter out elements in the current dragged item
  10845. for (j = 0; j < list.length; j++) {
  10846. if (list[j] === m[i].element[0]) {
  10847. m[i].proportions().height = 0;
  10848. continue droppablesLoop;
  10849. }
  10850. }
  10851. m[i].visible = m[i].element.css("display") !== "none";
  10852. if (!m[i].visible) {
  10853. continue;
  10854. }
  10855. // Activate the droppable if used directly from draggables
  10856. if (type === "mousedown") {
  10857. m[i]._activate.call(m[i], event);
  10858. }
  10859. m[i].offset = m[i].element.offset();
  10860. m[i].proportions({
  10861. width: m[i].element[0].offsetWidth,
  10862. height: m[i].element[0].offsetHeight
  10863. });
  10864. }
  10865. },
  10866. drop: function (draggable, event) {
  10867. var dropped = false;
  10868. // Create a copy of the droppables in case the list changes during the drop (#9116)
  10869. $.each(($.ui.ddmanager.droppables[draggable.options.scope] || []).slice(), function () {
  10870. if (!this.options) {
  10871. return;
  10872. }
  10873. if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance, event)) {
  10874. dropped = this._drop.call(this, event) || dropped;
  10875. }
  10876. if (!this.options.disabled && this.visible && this.accept.call(this.element[0], (draggable.currentItem || draggable.element))) {
  10877. this.isout = true;
  10878. this.isover = false;
  10879. this._deactivate.call(this, event);
  10880. }
  10881. });
  10882. return dropped;
  10883. },
  10884. dragStart: function (draggable, event) {
  10885. // Listen for scrolling so that if the dragging causes scrolling the position of the
  10886. // droppables can be recalculated (see #5003)
  10887. draggable.element.parentsUntil("body").on("scroll.droppable", function () {
  10888. if (!draggable.options.refreshPositions) {
  10889. $.ui.ddmanager.prepareOffsets(draggable, event);
  10890. }
  10891. });
  10892. },
  10893. drag: function (draggable, event) {
  10894. // If you have a highly dynamic page, you might try this option. It renders positions
  10895. // every time you move the mouse.
  10896. if (draggable.options.refreshPositions) {
  10897. $.ui.ddmanager.prepareOffsets(draggable, event);
  10898. }
  10899. // Run through all droppables and check their positions based on specific tolerance options
  10900. $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function () {
  10901. if (this.options.disabled || this.greedyChild || !this.visible) {
  10902. return;
  10903. }
  10904. var parentInstance, scope, parent,
  10905. intersects = $.ui.intersect(draggable, this, this.options.tolerance, event),
  10906. c = !intersects && this.isover ? "isout" : (intersects && !this.isover ? "isover" : null);
  10907. if (!c) {
  10908. return;
  10909. }
  10910. if (this.options.greedy) {
  10911. // find droppable parents with same scope
  10912. scope = this.options.scope;
  10913. parent = this.element.parents(":data(ui-droppable)").filter(function () {
  10914. return $(this).droppable("instance").options.scope === scope;
  10915. });
  10916. if (parent.length) {
  10917. parentInstance = $(parent[0]).droppable("instance");
  10918. parentInstance.greedyChild = (c === "isover");
  10919. }
  10920. }
  10921. // We just moved into a greedy child
  10922. if (parentInstance && c === "isover") {
  10923. parentInstance.isover = false;
  10924. parentInstance.isout = true;
  10925. parentInstance._out.call(parentInstance, event);
  10926. }
  10927. this[c] = true;
  10928. this[c === "isout" ? "isover" : "isout"] = false;
  10929. this[c === "isover" ? "_over" : "_out"].call(this, event);
  10930. // We just moved out of a greedy child
  10931. if (parentInstance && c === "isout") {
  10932. parentInstance.isout = false;
  10933. parentInstance.isover = true;
  10934. parentInstance._over.call(parentInstance, event);
  10935. }
  10936. });
  10937. },
  10938. dragStop: function (draggable, event) {
  10939. draggable.element.parentsUntil("body").off("scroll.droppable");
  10940. // Call prepareOffsets one final time since IE does not fire return scroll events when
  10941. // overflow was caused by drag (see #5003)
  10942. if (!draggable.options.refreshPositions) {
  10943. $.ui.ddmanager.prepareOffsets(draggable, event);
  10944. }
  10945. }
  10946. };
  10947. // DEPRECATED
  10948. // TODO: switch return back to widget declaration at top of file when this is removed
  10949. if ($.uiBackCompat !== false) {
  10950. // Backcompat for activeClass and hoverClass options
  10951. $.widget("ui.droppable", $.ui.droppable, {
  10952. options: {
  10953. hoverClass: false,
  10954. activeClass: false
  10955. },
  10956. _addActiveClass: function () {
  10957. this._super();
  10958. if (this.options.activeClass) {
  10959. this.element.addClass(this.options.activeClass);
  10960. }
  10961. },
  10962. _removeActiveClass: function () {
  10963. this._super();
  10964. if (this.options.activeClass) {
  10965. this.element.removeClass(this.options.activeClass);
  10966. }
  10967. },
  10968. _addHoverClass: function () {
  10969. this._super();
  10970. if (this.options.hoverClass) {
  10971. this.element.addClass(this.options.hoverClass);
  10972. }
  10973. },
  10974. _removeHoverClass: function () {
  10975. this._super();
  10976. if (this.options.hoverClass) {
  10977. this.element.removeClass(this.options.hoverClass);
  10978. }
  10979. }
  10980. });
  10981. }
  10982. var widgetsDroppable = $.ui.droppable;
  10983. /*!
  10984. * jQuery UI Progressbar 1.13.0
  10985. * http://jqueryui.com
  10986. *
  10987. * Copyright jQuery Foundation and other contributors
  10988. * Released under the MIT license.
  10989. * http://jquery.org/license
  10990. */
  10991. //>>label: Progressbar
  10992. //>>group: Widgets
  10993. /* eslint-disable max-len */
  10994. //>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators.
  10995. /* eslint-enable max-len */
  10996. //>>docs: http://api.jqueryui.com/progressbar/
  10997. //>>demos: http://jqueryui.com/progressbar/
  10998. //>>css.structure: ../../themes/base/core.css
  10999. //>>css.structure: ../../themes/base/progressbar.css
  11000. //>>css.theme: ../../themes/base/theme.css
  11001. var widgetsProgressbar = $.widget("ui.progressbar", {
  11002. version: "1.13.0",
  11003. options: {
  11004. classes: {
  11005. "ui-progressbar": "ui-corner-all",
  11006. "ui-progressbar-value": "ui-corner-left",
  11007. "ui-progressbar-complete": "ui-corner-right"
  11008. },
  11009. max: 100,
  11010. value: 0,
  11011. change: null,
  11012. complete: null
  11013. },
  11014. min: 0,
  11015. _create: function () {
  11016. // Constrain initial value
  11017. this.oldValue = this.options.value = this._constrainedValue();
  11018. this.element.attr({
  11019. // Only set static values; aria-valuenow and aria-valuemax are
  11020. // set inside _refreshValue()
  11021. role: "progressbar",
  11022. "aria-valuemin": this.min
  11023. });
  11024. this._addClass("ui-progressbar", "ui-widget ui-widget-content");
  11025. this.valueDiv = $("<div>").appendTo(this.element);
  11026. this._addClass(this.valueDiv, "ui-progressbar-value", "ui-widget-header");
  11027. this._refreshValue();
  11028. },
  11029. _destroy: function () {
  11030. this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow");
  11031. this.valueDiv.remove();
  11032. },
  11033. value: function (newValue) {
  11034. if (newValue === undefined) {
  11035. return this.options.value;
  11036. }
  11037. this.options.value = this._constrainedValue(newValue);
  11038. this._refreshValue();
  11039. },
  11040. _constrainedValue: function (newValue) {
  11041. if (newValue === undefined) {
  11042. newValue = this.options.value;
  11043. }
  11044. this.indeterminate = newValue === false;
  11045. // Sanitize value
  11046. if (typeof newValue !== "number") {
  11047. newValue = 0;
  11048. }
  11049. return this.indeterminate ? false : Math.min(this.options.max, Math.max(this.min, newValue));
  11050. },
  11051. _setOptions: function (options) {
  11052. // Ensure "value" option is set after other values (like max)
  11053. var value = options.value;
  11054. delete options.value;
  11055. this._super(options);
  11056. this.options.value = this._constrainedValue(value);
  11057. this._refreshValue();
  11058. },
  11059. _setOption: function (key, value) {
  11060. if (key === "max") {
  11061. // Don't allow a max less than min
  11062. value = Math.max(this.min, value);
  11063. }
  11064. this._super(key, value);
  11065. },
  11066. _setOptionDisabled: function (value) {
  11067. this._super(value);
  11068. this.element.attr("aria-disabled", value);
  11069. this._toggleClass(null, "ui-state-disabled", !!value);
  11070. },
  11071. _percentage: function () {
  11072. return this.indeterminate ? 100 : 100 * (this.options.value - this.min) / (this.options.max - this.min);
  11073. },
  11074. _refreshValue: function () {
  11075. var value = this.options.value
  11076. , percentage = this._percentage();
  11077. this.valueDiv.toggle(this.indeterminate || value > this.min).width(percentage.toFixed(0) + "%");
  11078. this._toggleClass(this.valueDiv, "ui-progressbar-complete", null, value === this.options.max)._toggleClass("ui-progressbar-indeterminate", null, this.indeterminate);
  11079. if (this.indeterminate) {
  11080. this.element.removeAttr("aria-valuenow");
  11081. if (!this.overlayDiv) {
  11082. this.overlayDiv = $("<div>").appendTo(this.valueDiv);
  11083. this._addClass(this.overlayDiv, "ui-progressbar-overlay");
  11084. }
  11085. } else {
  11086. this.element.attr({
  11087. "aria-valuemax": this.options.max,
  11088. "aria-valuenow": value
  11089. });
  11090. if (this.overlayDiv) {
  11091. this.overlayDiv.remove();
  11092. this.overlayDiv = null;
  11093. }
  11094. }
  11095. if (this.oldValue !== value) {
  11096. this.oldValue = value;
  11097. this._trigger("change");
  11098. }
  11099. if (value === this.options.max) {
  11100. this._trigger("complete");
  11101. }
  11102. }
  11103. });
  11104. /*!
  11105. * jQuery UI Selectable 1.13.0
  11106. * http://jqueryui.com
  11107. *
  11108. * Copyright jQuery Foundation and other contributors
  11109. * Released under the MIT license.
  11110. * http://jquery.org/license
  11111. */
  11112. //>>label: Selectable
  11113. //>>group: Interactions
  11114. //>>description: Allows groups of elements to be selected with the mouse.
  11115. //>>docs: http://api.jqueryui.com/selectable/
  11116. //>>demos: http://jqueryui.com/selectable/
  11117. //>>css.structure: ../../themes/base/selectable.css
  11118. var widgetsSelectable = $.widget("ui.selectable", $.ui.mouse, {
  11119. version: "1.13.0",
  11120. options: {
  11121. appendTo: "body",
  11122. autoRefresh: true,
  11123. distance: 0,
  11124. filter: "*",
  11125. tolerance: "touch",
  11126. // Callbacks
  11127. selected: null,
  11128. selecting: null,
  11129. start: null,
  11130. stop: null,
  11131. unselected: null,
  11132. unselecting: null
  11133. },
  11134. _create: function () {
  11135. var that = this;
  11136. this._addClass("ui-selectable");
  11137. this.dragged = false;
  11138. // Cache selectee children based on filter
  11139. this.refresh = function () {
  11140. that.elementPos = $(that.element[0]).offset();
  11141. that.selectees = $(that.options.filter, that.element[0]);
  11142. that._addClass(that.selectees, "ui-selectee");
  11143. that.selectees.each(function () {
  11144. var $this = $(this)
  11145. , selecteeOffset = $this.offset()
  11146. , pos = {
  11147. left: selecteeOffset.left - that.elementPos.left,
  11148. top: selecteeOffset.top - that.elementPos.top
  11149. };
  11150. $.data(this, "selectable-item", {
  11151. element: this,
  11152. $element: $this,
  11153. left: pos.left,
  11154. top: pos.top,
  11155. right: pos.left + $this.outerWidth(),
  11156. bottom: pos.top + $this.outerHeight(),
  11157. startselected: false,
  11158. selected: $this.hasClass("ui-selected"),
  11159. selecting: $this.hasClass("ui-selecting"),
  11160. unselecting: $this.hasClass("ui-unselecting")
  11161. });
  11162. });
  11163. }
  11164. ;
  11165. this.refresh();
  11166. this._mouseInit();
  11167. this.helper = $("<div>");
  11168. this._addClass(this.helper, "ui-selectable-helper");
  11169. },
  11170. _destroy: function () {
  11171. this.selectees.removeData("selectable-item");
  11172. this._mouseDestroy();
  11173. },
  11174. _mouseStart: function (event) {
  11175. var that = this
  11176. , options = this.options;
  11177. this.opos = [event.pageX, event.pageY];
  11178. this.elementPos = $(this.element[0]).offset();
  11179. if (this.options.disabled) {
  11180. return;
  11181. }
  11182. this.selectees = $(options.filter, this.element[0]);
  11183. this._trigger("start", event);
  11184. $(options.appendTo).append(this.helper);
  11185. // position helper (lasso)
  11186. this.helper.css({
  11187. "left": event.pageX,
  11188. "top": event.pageY,
  11189. "width": 0,
  11190. "height": 0
  11191. });
  11192. if (options.autoRefresh) {
  11193. this.refresh();
  11194. }
  11195. this.selectees.filter(".ui-selected").each(function () {
  11196. var selectee = $.data(this, "selectable-item");
  11197. selectee.startselected = true;
  11198. if (!event.metaKey && !event.ctrlKey) {
  11199. that._removeClass(selectee.$element, "ui-selected");
  11200. selectee.selected = false;
  11201. that._addClass(selectee.$element, "ui-unselecting");
  11202. selectee.unselecting = true;
  11203. // selectable UNSELECTING callback
  11204. that._trigger("unselecting", event, {
  11205. unselecting: selectee.element
  11206. });
  11207. }
  11208. });
  11209. $(event.target).parents().addBack().each(function () {
  11210. var doSelect, selectee = $.data(this, "selectable-item");
  11211. if (selectee) {
  11212. doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass("ui-selected");
  11213. that._removeClass(selectee.$element, doSelect ? "ui-unselecting" : "ui-selected")._addClass(selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting");
  11214. selectee.unselecting = !doSelect;
  11215. selectee.selecting = doSelect;
  11216. selectee.selected = doSelect;
  11217. // selectable (UN)SELECTING callback
  11218. if (doSelect) {
  11219. that._trigger("selecting", event, {
  11220. selecting: selectee.element
  11221. });
  11222. } else {
  11223. that._trigger("unselecting", event, {
  11224. unselecting: selectee.element
  11225. });
  11226. }
  11227. return false;
  11228. }
  11229. });
  11230. },
  11231. _mouseDrag: function (event) {
  11232. this.dragged = true;
  11233. if (this.options.disabled) {
  11234. return;
  11235. }
  11236. var tmp, that = this, options = this.options, x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX,
  11237. y2 = event.pageY;
  11238. if (x1 > x2) {
  11239. tmp = x2;
  11240. x2 = x1;
  11241. x1 = tmp;
  11242. }
  11243. if (y1 > y2) {
  11244. tmp = y2;
  11245. y2 = y1;
  11246. y1 = tmp;
  11247. }
  11248. this.helper.css({
  11249. left: x1,
  11250. top: y1,
  11251. width: x2 - x1,
  11252. height: y2 - y1
  11253. });
  11254. this.selectees.each(function () {
  11255. var selectee = $.data(this, "selectable-item")
  11256. , hit = false
  11257. , offset = {};
  11258. //prevent helper from being selected if appendTo: selectable
  11259. if (!selectee || selectee.element === that.element[0]) {
  11260. return;
  11261. }
  11262. offset.left = selectee.left + that.elementPos.left;
  11263. offset.right = selectee.right + that.elementPos.left;
  11264. offset.top = selectee.top + that.elementPos.top;
  11265. offset.bottom = selectee.bottom + that.elementPos.top;
  11266. if (options.tolerance === "touch") {
  11267. hit = (!(offset.left > x2 || offset.right < x1 || offset.top > y2 || offset.bottom < y1));
  11268. } else if (options.tolerance === "fit") {
  11269. hit = (offset.left > x1 && offset.right < x2 && offset.top > y1 && offset.bottom < y2);
  11270. }
  11271. if (hit) {
  11272. // SELECT
  11273. if (selectee.selected) {
  11274. that._removeClass(selectee.$element, "ui-selected");
  11275. selectee.selected = false;
  11276. }
  11277. if (selectee.unselecting) {
  11278. that._removeClass(selectee.$element, "ui-unselecting");
  11279. selectee.unselecting = false;
  11280. }
  11281. if (!selectee.selecting) {
  11282. that._addClass(selectee.$element, "ui-selecting");
  11283. selectee.selecting = true;
  11284. // selectable SELECTING callback
  11285. that._trigger("selecting", event, {
  11286. selecting: selectee.element
  11287. });
  11288. }
  11289. } else {
  11290. // UNSELECT
  11291. if (selectee.selecting) {
  11292. if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
  11293. that._removeClass(selectee.$element, "ui-selecting");
  11294. selectee.selecting = false;
  11295. that._addClass(selectee.$element, "ui-selected");
  11296. selectee.selected = true;
  11297. } else {
  11298. that._removeClass(selectee.$element, "ui-selecting");
  11299. selectee.selecting = false;
  11300. if (selectee.startselected) {
  11301. that._addClass(selectee.$element, "ui-unselecting");
  11302. selectee.unselecting = true;
  11303. }
  11304. // selectable UNSELECTING callback
  11305. that._trigger("unselecting", event, {
  11306. unselecting: selectee.element
  11307. });
  11308. }
  11309. }
  11310. if (selectee.selected) {
  11311. if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
  11312. that._removeClass(selectee.$element, "ui-selected");
  11313. selectee.selected = false;
  11314. that._addClass(selectee.$element, "ui-unselecting");
  11315. selectee.unselecting = true;
  11316. // selectable UNSELECTING callback
  11317. that._trigger("unselecting", event, {
  11318. unselecting: selectee.element
  11319. });
  11320. }
  11321. }
  11322. }
  11323. });
  11324. return false;
  11325. },
  11326. _mouseStop: function (event) {
  11327. var that = this;
  11328. this.dragged = false;
  11329. $(".ui-unselecting", this.element[0]).each(function () {
  11330. var selectee = $.data(this, "selectable-item");
  11331. that._removeClass(selectee.$element, "ui-unselecting");
  11332. selectee.unselecting = false;
  11333. selectee.startselected = false;
  11334. that._trigger("unselected", event, {
  11335. unselected: selectee.element
  11336. });
  11337. });
  11338. $(".ui-selecting", this.element[0]).each(function () {
  11339. var selectee = $.data(this, "selectable-item");
  11340. that._removeClass(selectee.$element, "ui-selecting")._addClass(selectee.$element, "ui-selected");
  11341. selectee.selecting = false;
  11342. selectee.selected = true;
  11343. selectee.startselected = true;
  11344. that._trigger("selected", event, {
  11345. selected: selectee.element
  11346. });
  11347. });
  11348. this._trigger("stop", event);
  11349. this.helper.remove();
  11350. return false;
  11351. }
  11352. });
  11353. /*!
  11354. * jQuery UI Selectmenu 1.13.0
  11355. * http://jqueryui.com
  11356. *
  11357. * Copyright jQuery Foundation and other contributors
  11358. * Released under the MIT license.
  11359. * http://jquery.org/license
  11360. */
  11361. //>>label: Selectmenu
  11362. //>>group: Widgets
  11363. /* eslint-disable max-len */
  11364. //>>description: Duplicates and extends the functionality of a native HTML select element, allowing it to be customizable in behavior and appearance far beyond the limitations of a native select.
  11365. /* eslint-enable max-len */
  11366. //>>docs: http://api.jqueryui.com/selectmenu/
  11367. //>>demos: http://jqueryui.com/selectmenu/
  11368. //>>css.structure: ../../themes/base/core.css
  11369. //>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css
  11370. //>>css.theme: ../../themes/base/theme.css
  11371. var widgetsSelectmenu = $.widget("ui.selectmenu", [$.ui.formResetMixin, {
  11372. version: "1.13.0",
  11373. defaultElement: "<select>",
  11374. options: {
  11375. appendTo: null,
  11376. classes: {
  11377. "ui-selectmenu-button-open": "ui-corner-top",
  11378. "ui-selectmenu-button-closed": "ui-corner-all"
  11379. },
  11380. disabled: null,
  11381. icons: {
  11382. button: "ui-icon-triangle-1-s"
  11383. },
  11384. position: {
  11385. my: "left top",
  11386. at: "left bottom",
  11387. collision: "none"
  11388. },
  11389. width: false,
  11390. // Callbacks
  11391. change: null,
  11392. close: null,
  11393. focus: null,
  11394. open: null,
  11395. select: null
  11396. },
  11397. _create: function () {
  11398. var selectmenuId = this.element.uniqueId().attr("id");
  11399. this.ids = {
  11400. element: selectmenuId,
  11401. button: selectmenuId + "-button",
  11402. menu: selectmenuId + "-menu"
  11403. };
  11404. this._drawButton();
  11405. this._drawMenu();
  11406. this._bindFormResetHandler();
  11407. this._rendered = false;
  11408. this.menuItems = $();
  11409. },
  11410. _drawButton: function () {
  11411. var icon, that = this,
  11412. item = this._parseOption(this.element.find("option:selected"), this.element[0].selectedIndex);
  11413. // Associate existing label with the new button
  11414. this.labels = this.element.labels().attr("for", this.ids.button);
  11415. this._on(this.labels, {
  11416. click: function (event) {
  11417. this.button.trigger("focus");
  11418. event.preventDefault();
  11419. }
  11420. });
  11421. // Hide original select element
  11422. this.element.hide();
  11423. // Create button
  11424. this.button = $("<span>", {
  11425. tabindex: this.options.disabled ? -1 : 0,
  11426. id: this.ids.button,
  11427. role: "combobox",
  11428. "aria-expanded": "false",
  11429. "aria-autocomplete": "list",
  11430. "aria-owns": this.ids.menu,
  11431. "aria-haspopup": "true",
  11432. title: this.element.attr("title")
  11433. }).insertAfter(this.element);
  11434. this._addClass(this.button, "ui-selectmenu-button ui-selectmenu-button-closed", "ui-button ui-widget");
  11435. icon = $("<span>").appendTo(this.button);
  11436. this._addClass(icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button);
  11437. this.buttonItem = this._renderButtonItem(item).appendTo(this.button);
  11438. if (this.options.width !== false) {
  11439. this._resizeButton();
  11440. }
  11441. this._on(this.button, this._buttonEvents);
  11442. this.button.one("focusin", function () {
  11443. // Delay rendering the menu items until the button receives focus.
  11444. // The menu may have already been rendered via a programmatic open.
  11445. if (!that._rendered) {
  11446. that._refreshMenu();
  11447. }
  11448. });
  11449. },
  11450. _drawMenu: function () {
  11451. var that = this;
  11452. // Create menu
  11453. this.menu = $("<ul>", {
  11454. "aria-hidden": "true",
  11455. "aria-labelledby": this.ids.button,
  11456. id: this.ids.menu
  11457. });
  11458. // Wrap menu
  11459. this.menuWrap = $("<div>").append(this.menu);
  11460. this._addClass(this.menuWrap, "ui-selectmenu-menu", "ui-front");
  11461. this.menuWrap.appendTo(this._appendTo());
  11462. // Initialize menu widget
  11463. this.menuInstance = this.menu.menu({
  11464. classes: {
  11465. "ui-menu": "ui-corner-bottom"
  11466. },
  11467. role: "listbox",
  11468. select: function (event, ui) {
  11469. event.preventDefault();
  11470. // Support: IE8
  11471. // If the item was selected via a click, the text selection
  11472. // will be destroyed in IE
  11473. that._setSelection();
  11474. that._select(ui.item.data("ui-selectmenu-item"), event);
  11475. },
  11476. focus: function (event, ui) {
  11477. var item = ui.item.data("ui-selectmenu-item");
  11478. // Prevent inital focus from firing and check if its a newly focused item
  11479. if (that.focusIndex != null && item.index !== that.focusIndex) {
  11480. that._trigger("focus", event, {
  11481. item: item
  11482. });
  11483. if (!that.isOpen) {
  11484. that._select(item, event);
  11485. }
  11486. }
  11487. that.focusIndex = item.index;
  11488. that.button.attr("aria-activedescendant", that.menuItems.eq(item.index).attr("id"));
  11489. }
  11490. }).menu("instance");
  11491. // Don't close the menu on mouseleave
  11492. this.menuInstance._off(this.menu, "mouseleave");
  11493. // Cancel the menu's collapseAll on document click
  11494. this.menuInstance._closeOnDocumentClick = function () {
  11495. return false;
  11496. }
  11497. ;
  11498. // Selects often contain empty items, but never contain dividers
  11499. this.menuInstance._isDivider = function () {
  11500. return false;
  11501. }
  11502. ;
  11503. },
  11504. refresh: function () {
  11505. this._refreshMenu();
  11506. this.buttonItem.replaceWith(this.buttonItem = this._renderButtonItem(
  11507. // Fall back to an empty object in case there are no options
  11508. this._getSelectedItem().data("ui-selectmenu-item") || {}));
  11509. if (this.options.width === null) {
  11510. this._resizeButton();
  11511. }
  11512. },
  11513. _refreshMenu: function () {
  11514. var item, options = this.element.find("option");
  11515. this.menu.empty();
  11516. this._parseOptions(options);
  11517. this._renderMenu(this.menu, this.items);
  11518. this.menuInstance.refresh();
  11519. this.menuItems = this.menu.find("li").not(".ui-selectmenu-optgroup").find(".ui-menu-item-wrapper");
  11520. this._rendered = true;
  11521. if (!options.length) {
  11522. return;
  11523. }
  11524. item = this._getSelectedItem();
  11525. // Update the menu to have the correct item focused
  11526. this.menuInstance.focus(null, item);
  11527. this._setAria(item.data("ui-selectmenu-item"));
  11528. // Set disabled state
  11529. this._setOption("disabled", this.element.prop("disabled"));
  11530. },
  11531. open: function (event) {
  11532. if (this.options.disabled) {
  11533. return;
  11534. }
  11535. // If this is the first time the menu is being opened, render the items
  11536. if (!this._rendered) {
  11537. this._refreshMenu();
  11538. } else {
  11539. // Menu clears focus on close, reset focus to selected item
  11540. this._removeClass(this.menu.find(".ui-state-active"), null, "ui-state-active");
  11541. this.menuInstance.focus(null, this._getSelectedItem());
  11542. }
  11543. // If there are no options, don't open the menu
  11544. if (!this.menuItems.length) {
  11545. return;
  11546. }
  11547. this.isOpen = true;
  11548. this._toggleAttr();
  11549. this._resizeMenu();
  11550. this._position();
  11551. this._on(this.document, this._documentClick);
  11552. this._trigger("open", event);
  11553. },
  11554. _position: function () {
  11555. this.menuWrap.position($.extend({
  11556. of: this.button
  11557. }, this.options.position));
  11558. },
  11559. close: function (event) {
  11560. if (!this.isOpen) {
  11561. return;
  11562. }
  11563. this.isOpen = false;
  11564. this._toggleAttr();
  11565. this.range = null;
  11566. this._off(this.document);
  11567. this._trigger("close", event);
  11568. },
  11569. widget: function () {
  11570. return this.button;
  11571. },
  11572. menuWidget: function () {
  11573. return this.menu;
  11574. },
  11575. _renderButtonItem: function (item) {
  11576. var buttonItem = $("<span>");
  11577. this._setText(buttonItem, item.label);
  11578. this._addClass(buttonItem, "ui-selectmenu-text");
  11579. return buttonItem;
  11580. },
  11581. _renderMenu: function (ul, items) {
  11582. var that = this
  11583. , currentOptgroup = "";
  11584. $.each(items, function (index, item) {
  11585. var li;
  11586. if (item.optgroup !== currentOptgroup) {
  11587. li = $("<li>", {
  11588. text: item.optgroup
  11589. });
  11590. that._addClass(li, "ui-selectmenu-optgroup", "ui-menu-divider" + (item.element.parent("optgroup").prop("disabled") ? " ui-state-disabled" : ""));
  11591. li.appendTo(ul);
  11592. currentOptgroup = item.optgroup;
  11593. }
  11594. that._renderItemData(ul, item);
  11595. });
  11596. },
  11597. _renderItemData: function (ul, item) {
  11598. return this._renderItem(ul, item).data("ui-selectmenu-item", item);
  11599. },
  11600. _renderItem: function (ul, item) {
  11601. var li = $("<li>")
  11602. , wrapper = $("<div>", {
  11603. title: item.element.attr("title")
  11604. });
  11605. if (item.disabled) {
  11606. this._addClass(li, null, "ui-state-disabled");
  11607. }
  11608. this._setText(wrapper, item.label);
  11609. return li.append(wrapper).appendTo(ul);
  11610. },
  11611. _setText: function (element, value) {
  11612. if (value) {
  11613. element.text(value);
  11614. } else {
  11615. element.html("&#160;");
  11616. }
  11617. },
  11618. _move: function (direction, event) {
  11619. var item, next, filter = ".ui-menu-item";
  11620. if (this.isOpen) {
  11621. item = this.menuItems.eq(this.focusIndex).parent("li");
  11622. } else {
  11623. item = this.menuItems.eq(this.element[0].selectedIndex).parent("li");
  11624. filter += ":not(.ui-state-disabled)";
  11625. }
  11626. if (direction === "first" || direction === "last") {
  11627. next = item[direction === "first" ? "prevAll" : "nextAll"](filter).eq(-1);
  11628. } else {
  11629. next = item[direction + "All"](filter).eq(0);
  11630. }
  11631. if (next.length) {
  11632. this.menuInstance.focus(event, next);
  11633. }
  11634. },
  11635. _getSelectedItem: function () {
  11636. return this.menuItems.eq(this.element[0].selectedIndex).parent("li");
  11637. },
  11638. _toggle: function (event) {
  11639. this[this.isOpen ? "close" : "open"](event);
  11640. },
  11641. _setSelection: function () {
  11642. var selection;
  11643. if (!this.range) {
  11644. return;
  11645. }
  11646. if (window.getSelection) {
  11647. selection = window.getSelection();
  11648. selection.removeAllRanges();
  11649. selection.addRange(this.range);
  11650. // Support: IE8
  11651. } else {
  11652. this.range.select();
  11653. }
  11654. // Support: IE
  11655. // Setting the text selection kills the button focus in IE, but
  11656. // restoring the focus doesn't kill the selection.
  11657. this.button.focus();
  11658. },
  11659. _documentClick: {
  11660. mousedown: function (event) {
  11661. if (!this.isOpen) {
  11662. return;
  11663. }
  11664. if (!$(event.target).closest(".ui-selectmenu-menu, #" + $.escapeSelector(this.ids.button)).length) {
  11665. this.close(event);
  11666. }
  11667. }
  11668. },
  11669. _buttonEvents: {
  11670. // Prevent text selection from being reset when interacting with the selectmenu (#10144)
  11671. mousedown: function () {
  11672. var selection;
  11673. if (window.getSelection) {
  11674. selection = window.getSelection();
  11675. if (selection.rangeCount) {
  11676. this.range = selection.getRangeAt(0);
  11677. }
  11678. // Support: IE8
  11679. } else {
  11680. this.range = document.selection.createRange();
  11681. }
  11682. },
  11683. click: function (event) {
  11684. this._setSelection();
  11685. this._toggle(event);
  11686. },
  11687. keydown: function (event) {
  11688. var preventDefault = true;
  11689. switch (event.keyCode) {
  11690. case $.ui.keyCode.TAB:
  11691. case $.ui.keyCode.ESCAPE:
  11692. this.close(event);
  11693. preventDefault = false;
  11694. break;
  11695. case $.ui.keyCode.ENTER:
  11696. if (this.isOpen) {
  11697. this._selectFocusedItem(event);
  11698. }
  11699. break;
  11700. case $.ui.keyCode.UP:
  11701. if (event.altKey) {
  11702. this._toggle(event);
  11703. } else {
  11704. this._move("prev", event);
  11705. }
  11706. break;
  11707. case $.ui.keyCode.DOWN:
  11708. if (event.altKey) {
  11709. this._toggle(event);
  11710. } else {
  11711. this._move("next", event);
  11712. }
  11713. break;
  11714. case $.ui.keyCode.SPACE:
  11715. if (this.isOpen) {
  11716. this._selectFocusedItem(event);
  11717. } else {
  11718. this._toggle(event);
  11719. }
  11720. break;
  11721. case $.ui.keyCode.LEFT:
  11722. this._move("prev", event);
  11723. break;
  11724. case $.ui.keyCode.RIGHT:
  11725. this._move("next", event);
  11726. break;
  11727. case $.ui.keyCode.HOME:
  11728. case $.ui.keyCode.PAGE_UP:
  11729. this._move("first", event);
  11730. break;
  11731. case $.ui.keyCode.END:
  11732. case $.ui.keyCode.PAGE_DOWN:
  11733. this._move("last", event);
  11734. break;
  11735. default:
  11736. this.menu.trigger(event);
  11737. preventDefault = false;
  11738. }
  11739. if (preventDefault) {
  11740. event.preventDefault();
  11741. }
  11742. }
  11743. },
  11744. _selectFocusedItem: function (event) {
  11745. var item = this.menuItems.eq(this.focusIndex).parent("li");
  11746. if (!item.hasClass("ui-state-disabled")) {
  11747. this._select(item.data("ui-selectmenu-item"), event);
  11748. }
  11749. },
  11750. _select: function (item, event) {
  11751. var oldIndex = this.element[0].selectedIndex;
  11752. // Change native select element
  11753. this.element[0].selectedIndex = item.index;
  11754. this.buttonItem.replaceWith(this.buttonItem = this._renderButtonItem(item));
  11755. this._setAria(item);
  11756. this._trigger("select", event, {
  11757. item: item
  11758. });
  11759. if (item.index !== oldIndex) {
  11760. this._trigger("change", event, {
  11761. item: item
  11762. });
  11763. }
  11764. this.close(event);
  11765. },
  11766. _setAria: function (item) {
  11767. var id = this.menuItems.eq(item.index).attr("id");
  11768. this.button.attr({
  11769. "aria-labelledby": id,
  11770. "aria-activedescendant": id
  11771. });
  11772. this.menu.attr("aria-activedescendant", id);
  11773. },
  11774. _setOption: function (key, value) {
  11775. if (key === "icons") {
  11776. var icon = this.button.find("span.ui-icon");
  11777. this._removeClass(icon, null, this.options.icons.button)._addClass(icon, null, value.button);
  11778. }
  11779. this._super(key, value);
  11780. if (key === "appendTo") {
  11781. this.menuWrap.appendTo(this._appendTo());
  11782. }
  11783. if (key === "width") {
  11784. this._resizeButton();
  11785. }
  11786. },
  11787. _setOptionDisabled: function (value) {
  11788. this._super(value);
  11789. this.menuInstance.option("disabled", value);
  11790. this.button.attr("aria-disabled", value);
  11791. this._toggleClass(this.button, null, "ui-state-disabled", value);
  11792. this.element.prop("disabled", value);
  11793. if (value) {
  11794. this.button.attr("tabindex", -1);
  11795. this.close();
  11796. } else {
  11797. this.button.attr("tabindex", 0);
  11798. }
  11799. },
  11800. _appendTo: function () {
  11801. var element = this.options.appendTo;
  11802. if (element) {
  11803. element = element.jquery || element.nodeType ? $(element) : this.document.find(element).eq(0);
  11804. }
  11805. if (!element || !element[0]) {
  11806. element = this.element.closest(".ui-front, dialog");
  11807. }
  11808. if (!element.length) {
  11809. element = this.document[0].body;
  11810. }
  11811. return element;
  11812. },
  11813. _toggleAttr: function () {
  11814. this.button.attr("aria-expanded", this.isOpen);
  11815. // We can't use two _toggleClass() calls here, because we need to make sure
  11816. // we always remove classes first and add them second, otherwise if both classes have the
  11817. // same theme class, it will be removed after we add it.
  11818. this._removeClass(this.button, "ui-selectmenu-button-" + (this.isOpen ? "closed" : "open"))._addClass(this.button, "ui-selectmenu-button-" + (this.isOpen ? "open" : "closed"))._toggleClass(this.menuWrap, "ui-selectmenu-open", null, this.isOpen);
  11819. this.menu.attr("aria-hidden", !this.isOpen);
  11820. },
  11821. _resizeButton: function () {
  11822. var width = this.options.width;
  11823. // For `width: false`, just remove inline style and stop
  11824. if (width === false) {
  11825. this.button.css("width", "");
  11826. return;
  11827. }
  11828. // For `width: null`, match the width of the original element
  11829. if (width === null) {
  11830. width = this.element.show().outerWidth();
  11831. this.element.hide();
  11832. }
  11833. this.button.outerWidth(width);
  11834. },
  11835. _resizeMenu: function () {
  11836. this.menu.outerWidth(Math.max(this.button.outerWidth(),
  11837. // Support: IE10
  11838. // IE10 wraps long text (possibly a rounding bug)
  11839. // so we add 1px to avoid the wrapping
  11840. this.menu.width("").outerWidth() + 1));
  11841. },
  11842. _getCreateOptions: function () {
  11843. var options = this._super();
  11844. options.disabled = this.element.prop("disabled");
  11845. return options;
  11846. },
  11847. _parseOptions: function (options) {
  11848. var that = this
  11849. , data = [];
  11850. options.each(function (index, item) {
  11851. if (item.hidden) {
  11852. return;
  11853. }
  11854. data.push(that._parseOption($(item), index));
  11855. });
  11856. this.items = data;
  11857. },
  11858. _parseOption: function (option, index) {
  11859. var optgroup = option.parent("optgroup");
  11860. return {
  11861. element: option,
  11862. index: index,
  11863. value: option.val(),
  11864. label: option.text(),
  11865. optgroup: optgroup.attr("label") || "",
  11866. disabled: optgroup.prop("disabled") || option.prop("disabled")
  11867. };
  11868. },
  11869. _destroy: function () {
  11870. this._unbindFormResetHandler();
  11871. this.menuWrap.remove();
  11872. this.button.remove();
  11873. this.element.show();
  11874. this.element.removeUniqueId();
  11875. this.labels.attr("for", this.ids.element);
  11876. }
  11877. }]);
  11878. /*!
  11879. * jQuery UI Slider 1.13.0
  11880. * http://jqueryui.com
  11881. *
  11882. * Copyright jQuery Foundation and other contributors
  11883. * Released under the MIT license.
  11884. * http://jquery.org/license
  11885. */
  11886. //>>label: Slider
  11887. //>>group: Widgets
  11888. //>>description: Displays a flexible slider with ranges and accessibility via keyboard.
  11889. //>>docs: http://api.jqueryui.com/slider/
  11890. //>>demos: http://jqueryui.com/slider/
  11891. //>>css.structure: ../../themes/base/core.css
  11892. //>>css.structure: ../../themes/base/slider.css
  11893. //>>css.theme: ../../themes/base/theme.css
  11894. var widgetsSlider = $.widget("ui.slider", $.ui.mouse, {
  11895. version: "1.13.0",
  11896. widgetEventPrefix: "slide",
  11897. options: {
  11898. animate: false,
  11899. classes: {
  11900. "ui-slider": "ui-corner-all",
  11901. "ui-slider-handle": "ui-corner-all",
  11902. // Note: ui-widget-header isn't the most fittingly semantic framework class for this
  11903. // element, but worked best visually with a variety of themes
  11904. "ui-slider-range": "ui-corner-all ui-widget-header"
  11905. },
  11906. distance: 0,
  11907. max: 100,
  11908. min: 0,
  11909. orientation: "horizontal",
  11910. range: false,
  11911. step: 1,
  11912. value: 0,
  11913. values: null,
  11914. // Callbacks
  11915. change: null,
  11916. slide: null,
  11917. start: null,
  11918. stop: null
  11919. },
  11920. // Number of pages in a slider
  11921. // (how many times can you page up/down to go through the whole range)
  11922. numPages: 5,
  11923. _create: function () {
  11924. this._keySliding = false;
  11925. this._mouseSliding = false;
  11926. this._animateOff = true;
  11927. this._handleIndex = null;
  11928. this._detectOrientation();
  11929. this._mouseInit();
  11930. this._calculateNewMax();
  11931. this._addClass("ui-slider ui-slider-" + this.orientation, "ui-widget ui-widget-content");
  11932. this._refresh();
  11933. this._animateOff = false;
  11934. },
  11935. _refresh: function () {
  11936. this._createRange();
  11937. this._createHandles();
  11938. this._setupEvents();
  11939. this._refreshValue();
  11940. },
  11941. _createHandles: function () {
  11942. var i, handleCount, options = this.options, existingHandles = this.element.find(".ui-slider-handle"),
  11943. handle = "<span tabindex='0'></span>", handles = [];
  11944. handleCount = (options.values && options.values.length) || 1;
  11945. if (existingHandles.length > handleCount) {
  11946. existingHandles.slice(handleCount).remove();
  11947. existingHandles = existingHandles.slice(0, handleCount);
  11948. }
  11949. for (i = existingHandles.length; i < handleCount; i++) {
  11950. handles.push(handle);
  11951. }
  11952. this.handles = existingHandles.add($(handles.join("")).appendTo(this.element));
  11953. this._addClass(this.handles, "ui-slider-handle", "ui-state-default");
  11954. this.handle = this.handles.eq(0);
  11955. this.handles.each(function (i) {
  11956. $(this).data("ui-slider-handle-index", i).attr("tabIndex", 0);
  11957. });
  11958. },
  11959. _createRange: function () {
  11960. var options = this.options;
  11961. if (options.range) {
  11962. if (options.range === true) {
  11963. if (!options.values) {
  11964. options.values = [this._valueMin(), this._valueMin()];
  11965. } else if (options.values.length && options.values.length !== 2) {
  11966. options.values = [options.values[0], options.values[0]];
  11967. } else if (Array.isArray(options.values)) {
  11968. options.values = options.values.slice(0);
  11969. }
  11970. }
  11971. if (!this.range || !this.range.length) {
  11972. this.range = $("<div>").appendTo(this.element);
  11973. this._addClass(this.range, "ui-slider-range");
  11974. } else {
  11975. this._removeClass(this.range, "ui-slider-range-min ui-slider-range-max");
  11976. // Handle range switching from true to min/max
  11977. this.range.css({
  11978. "left": "",
  11979. "bottom": ""
  11980. });
  11981. }
  11982. if (options.range === "min" || options.range === "max") {
  11983. this._addClass(this.range, "ui-slider-range-" + options.range);
  11984. }
  11985. } else {
  11986. if (this.range) {
  11987. this.range.remove();
  11988. }
  11989. this.range = null;
  11990. }
  11991. },
  11992. _setupEvents: function () {
  11993. this._off(this.handles);
  11994. this._on(this.handles, this._handleEvents);
  11995. this._hoverable(this.handles);
  11996. this._focusable(this.handles);
  11997. },
  11998. _destroy: function () {
  11999. this.handles.remove();
  12000. if (this.range) {
  12001. this.range.remove();
  12002. }
  12003. this._mouseDestroy();
  12004. },
  12005. _mouseCapture: function (event) {
  12006. var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle, that = this,
  12007. o = this.options;
  12008. if (o.disabled) {
  12009. return false;
  12010. }
  12011. this.elementSize = {
  12012. width: this.element.outerWidth(),
  12013. height: this.element.outerHeight()
  12014. };
  12015. this.elementOffset = this.element.offset();
  12016. position = {
  12017. x: event.pageX,
  12018. y: event.pageY
  12019. };
  12020. normValue = this._normValueFromMouse(position);
  12021. distance = this._valueMax() - this._valueMin() + 1;
  12022. this.handles.each(function (i) {
  12023. var thisDistance = Math.abs(normValue - that.values(i));
  12024. if ((distance > thisDistance) || (distance === thisDistance && (i === that._lastChangedValue || that.values(i) === o.min))) {
  12025. distance = thisDistance;
  12026. closestHandle = $(this);
  12027. index = i;
  12028. }
  12029. });
  12030. allowed = this._start(event, index);
  12031. if (allowed === false) {
  12032. return false;
  12033. }
  12034. this._mouseSliding = true;
  12035. this._handleIndex = index;
  12036. this._addClass(closestHandle, null, "ui-state-active");
  12037. closestHandle.trigger("focus");
  12038. offset = closestHandle.offset();
  12039. mouseOverHandle = !$(event.target).parents().addBack().is(".ui-slider-handle");
  12040. this._clickOffset = mouseOverHandle ? {
  12041. left: 0,
  12042. top: 0
  12043. } : {
  12044. left: event.pageX - offset.left - (closestHandle.width() / 2),
  12045. top: event.pageY - offset.top - (closestHandle.height() / 2) - (parseInt(closestHandle.css("borderTopWidth"), 10) || 0) - (parseInt(closestHandle.css("borderBottomWidth"), 10) || 0) + (parseInt(closestHandle.css("marginTop"), 10) || 0)
  12046. };
  12047. if (!this.handles.hasClass("ui-state-hover")) {
  12048. this._slide(event, index, normValue);
  12049. }
  12050. this._animateOff = true;
  12051. return true;
  12052. },
  12053. _mouseStart: function () {
  12054. return true;
  12055. },
  12056. _mouseDrag: function (event) {
  12057. var position = {
  12058. x: event.pageX,
  12059. y: event.pageY
  12060. }
  12061. , normValue = this._normValueFromMouse(position);
  12062. this._slide(event, this._handleIndex, normValue);
  12063. return false;
  12064. },
  12065. _mouseStop: function (event) {
  12066. this._removeClass(this.handles, null, "ui-state-active");
  12067. this._mouseSliding = false;
  12068. this._stop(event, this._handleIndex);
  12069. this._change(event, this._handleIndex);
  12070. this._handleIndex = null;
  12071. this._clickOffset = null;
  12072. this._animateOff = false;
  12073. return false;
  12074. },
  12075. _detectOrientation: function () {
  12076. this.orientation = (this.options.orientation === "vertical") ? "vertical" : "horizontal";
  12077. },
  12078. _normValueFromMouse: function (position) {
  12079. var pixelTotal, pixelMouse, percentMouse, valueTotal, valueMouse;
  12080. if (this.orientation === "horizontal") {
  12081. pixelTotal = this.elementSize.width;
  12082. pixelMouse = position.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0);
  12083. } else {
  12084. pixelTotal = this.elementSize.height;
  12085. pixelMouse = position.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0);
  12086. }
  12087. percentMouse = (pixelMouse / pixelTotal);
  12088. if (percentMouse > 1) {
  12089. percentMouse = 1;
  12090. }
  12091. if (percentMouse < 0) {
  12092. percentMouse = 0;
  12093. }
  12094. if (this.orientation === "vertical") {
  12095. percentMouse = 1 - percentMouse;
  12096. }
  12097. valueTotal = this._valueMax() - this._valueMin();
  12098. valueMouse = this._valueMin() + percentMouse * valueTotal;
  12099. return this._trimAlignValue(valueMouse);
  12100. },
  12101. _uiHash: function (index, value, values) {
  12102. var uiHash = {
  12103. handle: this.handles[index],
  12104. handleIndex: index,
  12105. value: value !== undefined ? value : this.value()
  12106. };
  12107. if (this._hasMultipleValues()) {
  12108. uiHash.value = value !== undefined ? value : this.values(index);
  12109. uiHash.values = values || this.values();
  12110. }
  12111. return uiHash;
  12112. },
  12113. _hasMultipleValues: function () {
  12114. return this.options.values && this.options.values.length;
  12115. },
  12116. _start: function (event, index) {
  12117. return this._trigger("start", event, this._uiHash(index));
  12118. },
  12119. _slide: function (event, index, newVal) {
  12120. var allowed, otherVal, currentValue = this.value(), newValues = this.values();
  12121. if (this._hasMultipleValues()) {
  12122. otherVal = this.values(index ? 0 : 1);
  12123. currentValue = this.values(index);
  12124. if (this.options.values.length === 2 && this.options.range === true) {
  12125. newVal = index === 0 ? Math.min(otherVal, newVal) : Math.max(otherVal, newVal);
  12126. }
  12127. newValues[index] = newVal;
  12128. }
  12129. if (newVal === currentValue) {
  12130. return;
  12131. }
  12132. allowed = this._trigger("slide", event, this._uiHash(index, newVal, newValues));
  12133. // A slide can be canceled by returning false from the slide callback
  12134. if (allowed === false) {
  12135. return;
  12136. }
  12137. if (this._hasMultipleValues()) {
  12138. this.values(index, newVal);
  12139. } else {
  12140. this.value(newVal);
  12141. }
  12142. },
  12143. _stop: function (event, index) {
  12144. this._trigger("stop", event, this._uiHash(index));
  12145. },
  12146. _change: function (event, index) {
  12147. if (!this._keySliding && !this._mouseSliding) {
  12148. //store the last changed value index for reference when handles overlap
  12149. this._lastChangedValue = index;
  12150. this._trigger("change", event, this._uiHash(index));
  12151. }
  12152. },
  12153. value: function (newValue) {
  12154. if (arguments.length) {
  12155. this.options.value = this._trimAlignValue(newValue);
  12156. this._refreshValue();
  12157. this._change(null, 0);
  12158. return;
  12159. }
  12160. return this._value();
  12161. },
  12162. values: function (index, newValue) {
  12163. var vals, newValues, i;
  12164. if (arguments.length > 1) {
  12165. this.options.values[index] = this._trimAlignValue(newValue);
  12166. this._refreshValue();
  12167. this._change(null, index);
  12168. return;
  12169. }
  12170. if (arguments.length) {
  12171. if (Array.isArray(arguments[0])) {
  12172. vals = this.options.values;
  12173. newValues = arguments[0];
  12174. for (i = 0; i < vals.length; i += 1) {
  12175. vals[i] = this._trimAlignValue(newValues[i]);
  12176. this._change(null, i);
  12177. }
  12178. this._refreshValue();
  12179. } else {
  12180. if (this._hasMultipleValues()) {
  12181. return this._values(index);
  12182. } else {
  12183. return this.value();
  12184. }
  12185. }
  12186. } else {
  12187. return this._values();
  12188. }
  12189. },
  12190. _setOption: function (key, value) {
  12191. var i, valsLength = 0;
  12192. if (key === "range" && this.options.range === true) {
  12193. if (value === "min") {
  12194. this.options.value = this._values(0);
  12195. this.options.values = null;
  12196. } else if (value === "max") {
  12197. this.options.value = this._values(this.options.values.length - 1);
  12198. this.options.values = null;
  12199. }
  12200. }
  12201. if (Array.isArray(this.options.values)) {
  12202. valsLength = this.options.values.length;
  12203. }
  12204. this._super(key, value);
  12205. switch (key) {
  12206. case "orientation":
  12207. this._detectOrientation();
  12208. this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-" + this.orientation);
  12209. this._refreshValue();
  12210. if (this.options.range) {
  12211. this._refreshRange(value);
  12212. }
  12213. // Reset positioning from previous orientation
  12214. this.handles.css(value === "horizontal" ? "bottom" : "left", "");
  12215. break;
  12216. case "value":
  12217. this._animateOff = true;
  12218. this._refreshValue();
  12219. this._change(null, 0);
  12220. this._animateOff = false;
  12221. break;
  12222. case "values":
  12223. this._animateOff = true;
  12224. this._refreshValue();
  12225. // Start from the last handle to prevent unreachable handles (#9046)
  12226. for (i = valsLength - 1; i >= 0; i--) {
  12227. this._change(null, i);
  12228. }
  12229. this._animateOff = false;
  12230. break;
  12231. case "step":
  12232. case "min":
  12233. case "max":
  12234. this._animateOff = true;
  12235. this._calculateNewMax();
  12236. this._refreshValue();
  12237. this._animateOff = false;
  12238. break;
  12239. case "range":
  12240. this._animateOff = true;
  12241. this._refresh();
  12242. this._animateOff = false;
  12243. break;
  12244. }
  12245. },
  12246. _setOptionDisabled: function (value) {
  12247. this._super(value);
  12248. this._toggleClass(null, "ui-state-disabled", !!value);
  12249. },
  12250. //internal value getter
  12251. // _value() returns value trimmed by min and max, aligned by step
  12252. _value: function () {
  12253. var val = this.options.value;
  12254. val = this._trimAlignValue(val);
  12255. return val;
  12256. },
  12257. //internal values getter
  12258. // _values() returns array of values trimmed by min and max, aligned by step
  12259. // _values( index ) returns single value trimmed by min and max, aligned by step
  12260. _values: function (index) {
  12261. var val, vals, i;
  12262. if (arguments.length) {
  12263. val = this.options.values[index];
  12264. val = this._trimAlignValue(val);
  12265. return val;
  12266. } else if (this._hasMultipleValues()) {
  12267. // .slice() creates a copy of the array
  12268. // this copy gets trimmed by min and max and then returned
  12269. vals = this.options.values.slice();
  12270. for (i = 0; i < vals.length; i += 1) {
  12271. vals[i] = this._trimAlignValue(vals[i]);
  12272. }
  12273. return vals;
  12274. } else {
  12275. return [];
  12276. }
  12277. },
  12278. // Returns the step-aligned value that val is closest to, between (inclusive) min and max
  12279. _trimAlignValue: function (val) {
  12280. if (val <= this._valueMin()) {
  12281. return this._valueMin();
  12282. }
  12283. if (val >= this._valueMax()) {
  12284. return this._valueMax();
  12285. }
  12286. var step = (this.options.step > 0) ? this.options.step : 1
  12287. , valModStep = (val - this._valueMin()) % step
  12288. , alignValue = val - valModStep;
  12289. if (Math.abs(valModStep) * 2 >= step) {
  12290. alignValue += (valModStep > 0) ? step : (-step);
  12291. }
  12292. // Since JavaScript has problems with large floats, round
  12293. // the final value to 5 digits after the decimal point (see #4124)
  12294. return parseFloat(alignValue.toFixed(5));
  12295. },
  12296. _calculateNewMax: function () {
  12297. var max = this.options.max
  12298. , min = this._valueMin()
  12299. , step = this.options.step
  12300. , aboveMin = Math.round((max - min) / step) * step;
  12301. max = aboveMin + min;
  12302. if (max > this.options.max) {
  12303. //If max is not divisible by step, rounding off may increase its value
  12304. max -= step;
  12305. }
  12306. this.max = parseFloat(max.toFixed(this._precision()));
  12307. },
  12308. _precision: function () {
  12309. var precision = this._precisionOf(this.options.step);
  12310. if (this.options.min !== null) {
  12311. precision = Math.max(precision, this._precisionOf(this.options.min));
  12312. }
  12313. return precision;
  12314. },
  12315. _precisionOf: function (num) {
  12316. var str = num.toString()
  12317. , decimal = str.indexOf(".");
  12318. return decimal === -1 ? 0 : str.length - decimal - 1;
  12319. },
  12320. _valueMin: function () {
  12321. return this.options.min;
  12322. },
  12323. _valueMax: function () {
  12324. return this.max;
  12325. },
  12326. _refreshRange: function (orientation) {
  12327. if (orientation === "vertical") {
  12328. this.range.css({
  12329. "width": "",
  12330. "left": ""
  12331. });
  12332. }
  12333. if (orientation === "horizontal") {
  12334. this.range.css({
  12335. "height": "",
  12336. "bottom": ""
  12337. });
  12338. }
  12339. },
  12340. _refreshValue: function () {
  12341. var lastValPercent, valPercent, value, valueMin, valueMax, oRange = this.options.range, o = this.options,
  12342. that = this, animate = (!this._animateOff) ? o.animate : false, _set = {};
  12343. if (this._hasMultipleValues()) {
  12344. this.handles.each(function (i) {
  12345. valPercent = (that.values(i) - that._valueMin()) / (that._valueMax() - that._valueMin()) * 100;
  12346. _set[that.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%";
  12347. $(this).stop(1, 1)[animate ? "animate" : "css"](_set, o.animate);
  12348. if (that.options.range === true) {
  12349. if (that.orientation === "horizontal") {
  12350. if (i === 0) {
  12351. that.range.stop(1, 1)[animate ? "animate" : "css"]({
  12352. left: valPercent + "%"
  12353. }, o.animate);
  12354. }
  12355. if (i === 1) {
  12356. that.range[animate ? "animate" : "css"]({
  12357. width: (valPercent - lastValPercent) + "%"
  12358. }, {
  12359. queue: false,
  12360. duration: o.animate
  12361. });
  12362. }
  12363. } else {
  12364. if (i === 0) {
  12365. that.range.stop(1, 1)[animate ? "animate" : "css"]({
  12366. bottom: (valPercent) + "%"
  12367. }, o.animate);
  12368. }
  12369. if (i === 1) {
  12370. that.range[animate ? "animate" : "css"]({
  12371. height: (valPercent - lastValPercent) + "%"
  12372. }, {
  12373. queue: false,
  12374. duration: o.animate
  12375. });
  12376. }
  12377. }
  12378. }
  12379. lastValPercent = valPercent;
  12380. });
  12381. } else {
  12382. value = this.value();
  12383. valueMin = this._valueMin();
  12384. valueMax = this._valueMax();
  12385. valPercent = (valueMax !== valueMin) ? (value - valueMin) / (valueMax - valueMin) * 100 : 0;
  12386. _set[this.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%";
  12387. this.handle.stop(1, 1)[animate ? "animate" : "css"](_set, o.animate);
  12388. if (oRange === "min" && this.orientation === "horizontal") {
  12389. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  12390. width: valPercent + "%"
  12391. }, o.animate);
  12392. }
  12393. if (oRange === "max" && this.orientation === "horizontal") {
  12394. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  12395. width: (100 - valPercent) + "%"
  12396. }, o.animate);
  12397. }
  12398. if (oRange === "min" && this.orientation === "vertical") {
  12399. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  12400. height: valPercent + "%"
  12401. }, o.animate);
  12402. }
  12403. if (oRange === "max" && this.orientation === "vertical") {
  12404. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  12405. height: (100 - valPercent) + "%"
  12406. }, o.animate);
  12407. }
  12408. }
  12409. },
  12410. _handleEvents: {
  12411. keydown: function (event) {
  12412. var allowed, curVal, newVal, step, index = $(event.target).data("ui-slider-handle-index");
  12413. switch (event.keyCode) {
  12414. case $.ui.keyCode.HOME:
  12415. case $.ui.keyCode.END:
  12416. case $.ui.keyCode.PAGE_UP:
  12417. case $.ui.keyCode.PAGE_DOWN:
  12418. case $.ui.keyCode.UP:
  12419. case $.ui.keyCode.RIGHT:
  12420. case $.ui.keyCode.DOWN:
  12421. case $.ui.keyCode.LEFT:
  12422. event.preventDefault();
  12423. if (!this._keySliding) {
  12424. this._keySliding = true;
  12425. this._addClass($(event.target), null, "ui-state-active");
  12426. allowed = this._start(event, index);
  12427. if (allowed === false) {
  12428. return;
  12429. }
  12430. }
  12431. break;
  12432. }
  12433. step = this.options.step;
  12434. if (this._hasMultipleValues()) {
  12435. curVal = newVal = this.values(index);
  12436. } else {
  12437. curVal = newVal = this.value();
  12438. }
  12439. switch (event.keyCode) {
  12440. case $.ui.keyCode.HOME:
  12441. newVal = this._valueMin();
  12442. break;
  12443. case $.ui.keyCode.END:
  12444. newVal = this._valueMax();
  12445. break;
  12446. case $.ui.keyCode.PAGE_UP:
  12447. newVal = this._trimAlignValue(curVal + ((this._valueMax() - this._valueMin()) / this.numPages));
  12448. break;
  12449. case $.ui.keyCode.PAGE_DOWN:
  12450. newVal = this._trimAlignValue(curVal - ((this._valueMax() - this._valueMin()) / this.numPages));
  12451. break;
  12452. case $.ui.keyCode.UP:
  12453. case $.ui.keyCode.RIGHT:
  12454. if (curVal === this._valueMax()) {
  12455. return;
  12456. }
  12457. newVal = this._trimAlignValue(curVal + step);
  12458. break;
  12459. case $.ui.keyCode.DOWN:
  12460. case $.ui.keyCode.LEFT:
  12461. if (curVal === this._valueMin()) {
  12462. return;
  12463. }
  12464. newVal = this._trimAlignValue(curVal - step);
  12465. break;
  12466. }
  12467. this._slide(event, index, newVal);
  12468. },
  12469. keyup: function (event) {
  12470. var index = $(event.target).data("ui-slider-handle-index");
  12471. if (this._keySliding) {
  12472. this._keySliding = false;
  12473. this._stop(event, index);
  12474. this._change(event, index);
  12475. this._removeClass($(event.target), null, "ui-state-active");
  12476. }
  12477. }
  12478. }
  12479. });
  12480. /*!
  12481. * jQuery UI Sortable 1.13.0
  12482. * http://jqueryui.com
  12483. *
  12484. * Copyright jQuery Foundation and other contributors
  12485. * Released under the MIT license.
  12486. * http://jquery.org/license
  12487. */
  12488. //>>label: Sortable
  12489. //>>group: Interactions
  12490. //>>description: Enables items in a list to be sorted using the mouse.
  12491. //>>docs: http://api.jqueryui.com/sortable/
  12492. //>>demos: http://jqueryui.com/sortable/
  12493. //>>css.structure: ../../themes/base/sortable.css
  12494. var widgetsSortable = $.widget("ui.sortable", $.ui.mouse, {
  12495. version: "1.13.0",
  12496. widgetEventPrefix: "sort",
  12497. ready: false,
  12498. options: {
  12499. appendTo: "parent",
  12500. axis: false,
  12501. connectWith: false,
  12502. containment: false,
  12503. cursor: "auto",
  12504. cursorAt: false,
  12505. dropOnEmpty: true,
  12506. forcePlaceholderSize: false,
  12507. forceHelperSize: false,
  12508. grid: false,
  12509. handle: false,
  12510. helper: "original",
  12511. items: "> *",
  12512. opacity: false,
  12513. placeholder: false,
  12514. revert: false,
  12515. scroll: true,
  12516. scrollSensitivity: 20,
  12517. scrollSpeed: 20,
  12518. scope: "default",
  12519. tolerance: "intersect",
  12520. zIndex: 1000,
  12521. // Callbacks
  12522. activate: null,
  12523. beforeStop: null,
  12524. change: null,
  12525. deactivate: null,
  12526. out: null,
  12527. over: null,
  12528. receive: null,
  12529. remove: null,
  12530. sort: null,
  12531. start: null,
  12532. stop: null,
  12533. update: null
  12534. },
  12535. _isOverAxis: function (x, reference, size) {
  12536. return (x >= reference) && (x < (reference + size));
  12537. },
  12538. _isFloating: function (item) {
  12539. return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display"));
  12540. },
  12541. _create: function () {
  12542. this.containerCache = {};
  12543. this._addClass("ui-sortable");
  12544. //Get the items
  12545. this.refresh();
  12546. //Let's determine the parent's offset
  12547. this.offset = this.element.offset();
  12548. //Initialize mouse events for interaction
  12549. this._mouseInit();
  12550. this._setHandleClassName();
  12551. //We're ready to go
  12552. this.ready = true;
  12553. },
  12554. _setOption: function (key, value) {
  12555. this._super(key, value);
  12556. if (key === "handle") {
  12557. this._setHandleClassName();
  12558. }
  12559. },
  12560. _setHandleClassName: function () {
  12561. var that = this;
  12562. this._removeClass(this.element.find(".ui-sortable-handle"), "ui-sortable-handle");
  12563. $.each(this.items, function () {
  12564. that._addClass(this.instance.options.handle ? this.item.find(this.instance.options.handle) : this.item, "ui-sortable-handle");
  12565. });
  12566. },
  12567. _destroy: function () {
  12568. this._mouseDestroy();
  12569. for (var i = this.items.length - 1; i >= 0; i--) {
  12570. this.items[i].item.removeData(this.widgetName + "-item");
  12571. }
  12572. return this;
  12573. },
  12574. _mouseCapture: function (event, overrideHandle) {
  12575. var currentItem = null
  12576. , validHandle = false
  12577. , that = this;
  12578. if (this.reverting) {
  12579. return false;
  12580. }
  12581. if (this.options.disabled || this.options.type === "static") {
  12582. return false;
  12583. }
  12584. //We have to refresh the items data once first
  12585. this._refreshItems(event);
  12586. //Find out if the clicked node (or one of its parents) is a actual item in this.items
  12587. $(event.target).parents().each(function () {
  12588. if ($.data(this, that.widgetName + "-item") === that) {
  12589. currentItem = $(this);
  12590. return false;
  12591. }
  12592. });
  12593. if ($.data(event.target, that.widgetName + "-item") === that) {
  12594. currentItem = $(event.target);
  12595. }
  12596. if (!currentItem) {
  12597. return false;
  12598. }
  12599. if (this.options.handle && !overrideHandle) {
  12600. $(this.options.handle, currentItem).find("*").addBack().each(function () {
  12601. if (this === event.target) {
  12602. validHandle = true;
  12603. }
  12604. });
  12605. if (!validHandle) {
  12606. return false;
  12607. }
  12608. }
  12609. this.currentItem = currentItem;
  12610. this._removeCurrentsFromItems();
  12611. return true;
  12612. },
  12613. _mouseStart: function (event, overrideHandle, noActivation) {
  12614. var i, body, o = this.options;
  12615. this.currentContainer = this;
  12616. //We only need to call refreshPositions, because the refreshItems call has been moved to
  12617. // mouseCapture
  12618. this.refreshPositions();
  12619. //Prepare the dragged items parent
  12620. this.appendTo = $(o.appendTo !== "parent" ? o.appendTo : this.currentItem.parent());
  12621. //Create and append the visible helper
  12622. this.helper = this._createHelper(event);
  12623. //Cache the helper size
  12624. this._cacheHelperProportions();
  12625. /*
  12626. * - Position generation -
  12627. * This block generates everything position related - it's the core of draggables.
  12628. */
  12629. //Cache the margins of the original element
  12630. this._cacheMargins();
  12631. //The element's absolute position on the page minus margins
  12632. this.offset = this.currentItem.offset();
  12633. this.offset = {
  12634. top: this.offset.top - this.margins.top,
  12635. left: this.offset.left - this.margins.left
  12636. };
  12637. $.extend(this.offset, {
  12638. click: {
  12639. //Where the click happened, relative to the element
  12640. left: event.pageX - this.offset.left,
  12641. top: event.pageY - this.offset.top
  12642. },
  12643. // This is a relative to absolute position minus the actual position calculation -
  12644. // only used for relative positioned helper
  12645. relative: this._getRelativeOffset()
  12646. });
  12647. // After we get the helper offset, but before we get the parent offset we can
  12648. // change the helper's position to absolute
  12649. // TODO: Still need to figure out a way to make relative sorting possible
  12650. this.helper.css("position", "absolute");
  12651. this.cssPosition = this.helper.css("position");
  12652. //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
  12653. if (o.cursorAt) {
  12654. this._adjustOffsetFromHelper(o.cursorAt);
  12655. }
  12656. //Cache the former DOM position
  12657. this.domPosition = {
  12658. prev: this.currentItem.prev()[0],
  12659. parent: this.currentItem.parent()[0]
  12660. };
  12661. // If the helper is not the original, hide the original so it's not playing any role during
  12662. // the drag, won't cause anything bad this way
  12663. if (this.helper[0] !== this.currentItem[0]) {
  12664. this.currentItem.hide();
  12665. }
  12666. //Create the placeholder
  12667. this._createPlaceholder();
  12668. //Get the next scrolling parent
  12669. this.scrollParent = this.placeholder.scrollParent();
  12670. $.extend(this.offset, {
  12671. parent: this._getParentOffset()
  12672. });
  12673. //Set a containment if given in the options
  12674. if (o.containment) {
  12675. this._setContainment();
  12676. }
  12677. if (o.cursor && o.cursor !== "auto") {
  12678. // cursor option
  12679. body = this.document.find("body");
  12680. // Support: IE
  12681. this.storedCursor = body.css("cursor");
  12682. body.css("cursor", o.cursor);
  12683. this.storedStylesheet = $("<style>*{ cursor: " + o.cursor + " !important; }</style>").appendTo(body);
  12684. }
  12685. // We need to make sure to grab the zIndex before setting the
  12686. // opacity, because setting the opacity to anything lower than 1
  12687. // causes the zIndex to change from "auto" to 0.
  12688. if (o.zIndex) {
  12689. // zIndex option
  12690. if (this.helper.css("zIndex")) {
  12691. this._storedZIndex = this.helper.css("zIndex");
  12692. }
  12693. this.helper.css("zIndex", o.zIndex);
  12694. }
  12695. if (o.opacity) {
  12696. // opacity option
  12697. if (this.helper.css("opacity")) {
  12698. this._storedOpacity = this.helper.css("opacity");
  12699. }
  12700. this.helper.css("opacity", o.opacity);
  12701. }
  12702. //Prepare scrolling
  12703. if (this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
  12704. this.overflowOffset = this.scrollParent.offset();
  12705. }
  12706. //Call callbacks
  12707. this._trigger("start", event, this._uiHash());
  12708. //Recache the helper size
  12709. if (!this._preserveHelperProportions) {
  12710. this._cacheHelperProportions();
  12711. }
  12712. //Post "activate" events to possible containers
  12713. if (!noActivation) {
  12714. for (i = this.containers.length - 1; i >= 0; i--) {
  12715. this.containers[i]._trigger("activate", event, this._uiHash(this));
  12716. }
  12717. }
  12718. //Prepare possible droppables
  12719. if ($.ui.ddmanager) {
  12720. $.ui.ddmanager.current = this;
  12721. }
  12722. if ($.ui.ddmanager && !o.dropBehaviour) {
  12723. $.ui.ddmanager.prepareOffsets(this, event);
  12724. }
  12725. this.dragging = true;
  12726. this._addClass(this.helper, "ui-sortable-helper");
  12727. //Move the helper, if needed
  12728. if (!this.helper.parent().is(this.appendTo)) {
  12729. this.helper.detach().appendTo(this.appendTo);
  12730. //Update position
  12731. this.offset.parent = this._getParentOffset();
  12732. }
  12733. //Generate the original position
  12734. this.position = this.originalPosition = this._generatePosition(event);
  12735. this.originalPageX = event.pageX;
  12736. this.originalPageY = event.pageY;
  12737. this.lastPositionAbs = this.positionAbs = this._convertPositionTo("absolute");
  12738. this._mouseDrag(event);
  12739. return true;
  12740. },
  12741. _scroll: function (event) {
  12742. var o = this.options
  12743. , scrolled = false;
  12744. if (this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
  12745. if ((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
  12746. this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
  12747. } else if (event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
  12748. this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
  12749. }
  12750. if ((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
  12751. this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
  12752. } else if (event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
  12753. this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
  12754. }
  12755. } else {
  12756. if (event.pageY - this.document.scrollTop() < o.scrollSensitivity) {
  12757. scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed);
  12758. } else if (this.window.height() - (event.pageY - this.document.scrollTop()) < o.scrollSensitivity) {
  12759. scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed);
  12760. }
  12761. if (event.pageX - this.document.scrollLeft() < o.scrollSensitivity) {
  12762. scrolled = this.document.scrollLeft(this.document.scrollLeft() - o.scrollSpeed);
  12763. } else if (this.window.width() - (event.pageX - this.document.scrollLeft()) < o.scrollSensitivity) {
  12764. scrolled = this.document.scrollLeft(this.document.scrollLeft() + o.scrollSpeed);
  12765. }
  12766. }
  12767. return scrolled;
  12768. },
  12769. _mouseDrag: function (event) {
  12770. var i, item, itemElement, intersection, o = this.options;
  12771. //Compute the helpers position
  12772. this.position = this._generatePosition(event);
  12773. this.positionAbs = this._convertPositionTo("absolute");
  12774. //Set the helper position
  12775. if (!this.options.axis || this.options.axis !== "y") {
  12776. this.helper[0].style.left = this.position.left + "px";
  12777. }
  12778. if (!this.options.axis || this.options.axis !== "x") {
  12779. this.helper[0].style.top = this.position.top + "px";
  12780. }
  12781. //Post events to containers
  12782. this._contactContainers(event);
  12783. if (this.innermostContainer !== null) {
  12784. //Do scrolling
  12785. if (o.scroll) {
  12786. if (this._scroll(event) !== false) {
  12787. //Update item positions used in position checks
  12788. this._refreshItemPositions(true);
  12789. if ($.ui.ddmanager && !o.dropBehaviour) {
  12790. $.ui.ddmanager.prepareOffsets(this, event);
  12791. }
  12792. }
  12793. }
  12794. this.dragDirection = {
  12795. vertical: this._getDragVerticalDirection(),
  12796. horizontal: this._getDragHorizontalDirection()
  12797. };
  12798. //Rearrange
  12799. for (i = this.items.length - 1; i >= 0; i--) {
  12800. //Cache variables and intersection, continue if no intersection
  12801. item = this.items[i];
  12802. itemElement = item.item[0];
  12803. intersection = this._intersectsWithPointer(item);
  12804. if (!intersection) {
  12805. continue;
  12806. }
  12807. // Only put the placeholder inside the current Container, skip all
  12808. // items from other containers. This works because when moving
  12809. // an item from one container to another the
  12810. // currentContainer is switched before the placeholder is moved.
  12811. //
  12812. // Without this, moving items in "sub-sortables" can cause
  12813. // the placeholder to jitter between the outer and inner container.
  12814. if (item.instance !== this.currentContainer) {
  12815. continue;
  12816. }
  12817. // Cannot intersect with itself
  12818. // no useless actions that have been done before
  12819. // no action if the item moved is the parent of the item checked
  12820. if (itemElement !== this.currentItem[0] && this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement && !$.contains(this.placeholder[0], itemElement) && (this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true)) {
  12821. this.direction = intersection === 1 ? "down" : "up";
  12822. if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) {
  12823. this._rearrange(event, item);
  12824. } else {
  12825. break;
  12826. }
  12827. this._trigger("change", event, this._uiHash());
  12828. break;
  12829. }
  12830. }
  12831. }
  12832. //Interconnect with droppables
  12833. if ($.ui.ddmanager) {
  12834. $.ui.ddmanager.drag(this, event);
  12835. }
  12836. //Call callbacks
  12837. this._trigger("sort", event, this._uiHash());
  12838. this.lastPositionAbs = this.positionAbs;
  12839. return false;
  12840. },
  12841. _mouseStop: function (event, noPropagation) {
  12842. if (!event) {
  12843. return;
  12844. }
  12845. //If we are using droppables, inform the manager about the drop
  12846. if ($.ui.ddmanager && !this.options.dropBehaviour) {
  12847. $.ui.ddmanager.drop(this, event);
  12848. }
  12849. if (this.options.revert) {
  12850. var that = this
  12851. , cur = this.placeholder.offset()
  12852. , axis = this.options.axis
  12853. , animation = {};
  12854. if (!axis || axis === "x") {
  12855. animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollLeft);
  12856. }
  12857. if (!axis || axis === "y") {
  12858. animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollTop);
  12859. }
  12860. this.reverting = true;
  12861. $(this.helper).animate(animation, parseInt(this.options.revert, 10) || 500, function () {
  12862. that._clear(event);
  12863. });
  12864. } else {
  12865. this._clear(event, noPropagation);
  12866. }
  12867. return false;
  12868. },
  12869. cancel: function () {
  12870. if (this.dragging) {
  12871. this._mouseUp(new $.Event("mouseup", {
  12872. target: null
  12873. }));
  12874. if (this.options.helper === "original") {
  12875. this.currentItem.css(this._storedCSS);
  12876. this._removeClass(this.currentItem, "ui-sortable-helper");
  12877. } else {
  12878. this.currentItem.show();
  12879. }
  12880. //Post deactivating events to containers
  12881. for (var i = this.containers.length - 1; i >= 0; i--) {
  12882. this.containers[i]._trigger("deactivate", null, this._uiHash(this));
  12883. if (this.containers[i].containerCache.over) {
  12884. this.containers[i]._trigger("out", null, this._uiHash(this));
  12885. this.containers[i].containerCache.over = 0;
  12886. }
  12887. }
  12888. }
  12889. if (this.placeholder) {
  12890. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
  12891. // it unbinds ALL events from the original node!
  12892. if (this.placeholder[0].parentNode) {
  12893. this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  12894. }
  12895. if (this.options.helper !== "original" && this.helper && this.helper[0].parentNode) {
  12896. this.helper.remove();
  12897. }
  12898. $.extend(this, {
  12899. helper: null,
  12900. dragging: false,
  12901. reverting: false,
  12902. _noFinalSort: null
  12903. });
  12904. if (this.domPosition.prev) {
  12905. $(this.domPosition.prev).after(this.currentItem);
  12906. } else {
  12907. $(this.domPosition.parent).prepend(this.currentItem);
  12908. }
  12909. }
  12910. return this;
  12911. },
  12912. serialize: function (o) {
  12913. var items = this._getItemsAsjQuery(o && o.connected)
  12914. , str = [];
  12915. o = o || {};
  12916. $(items).each(function () {
  12917. var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/));
  12918. if (res) {
  12919. str.push((o.key || res[1] + "[]") + "=" + (o.key && o.expression ? res[1] : res[2]));
  12920. }
  12921. });
  12922. if (!str.length && o.key) {
  12923. str.push(o.key + "=");
  12924. }
  12925. return str.join("&");
  12926. },
  12927. toArray: function (o) {
  12928. var items = this._getItemsAsjQuery(o && o.connected)
  12929. , ret = [];
  12930. o = o || {};
  12931. items.each(function () {
  12932. ret.push($(o.item || this).attr(o.attribute || "id") || "");
  12933. });
  12934. return ret;
  12935. },
  12936. /* Be careful with the following core functions */
  12937. _intersectsWith: function (item) {
  12938. var x1 = this.positionAbs.left
  12939. , x2 = x1 + this.helperProportions.width
  12940. , y1 = this.positionAbs.top
  12941. , y2 = y1 + this.helperProportions.height
  12942. , l = item.left
  12943. , r = l + item.width
  12944. , t = item.top
  12945. , b = t + item.height
  12946. , dyClick = this.offset.click.top
  12947. , dxClick = this.offset.click.left
  12948. , isOverElementHeight = (this.options.axis === "x") || ((y1 + dyClick) > t && (y1 + dyClick) < b)
  12949. , isOverElementWidth = (this.options.axis === "y") || ((x1 + dxClick) > l && (x1 + dxClick) < r)
  12950. , isOverElement = isOverElementHeight && isOverElementWidth;
  12951. if (this.options.tolerance === "pointer" || this.options.forcePointerForContainers || (this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"])) {
  12952. return isOverElement;
  12953. } else {
  12954. return (l < x1 + (this.helperProportions.width / 2) && // Right Half
  12955. x2 - (this.helperProportions.width / 2) < r && // Left Half
  12956. t < y1 + (this.helperProportions.height / 2) && // Bottom Half
  12957. y2 - (this.helperProportions.height / 2) < b);
  12958. // Top Half
  12959. }
  12960. },
  12961. _intersectsWithPointer: function (item) {
  12962. var verticalDirection, horizontalDirection,
  12963. isOverElementHeight = (this.options.axis === "x") || this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
  12964. isOverElementWidth = (this.options.axis === "y") || this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
  12965. isOverElement = isOverElementHeight && isOverElementWidth;
  12966. if (!isOverElement) {
  12967. return false;
  12968. }
  12969. verticalDirection = this.dragDirection.vertical;
  12970. horizontalDirection = this.dragDirection.horizontal;
  12971. return this.floating ? ((horizontalDirection === "right" || verticalDirection === "down") ? 2 : 1) : (verticalDirection && (verticalDirection === "down" ? 2 : 1));
  12972. },
  12973. _intersectsWithSides: function (item) {
  12974. var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height / 2), item.height)
  12975. ,
  12976. isOverRightHalf = this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width / 2), item.width)
  12977. , verticalDirection = this.dragDirection.vertical
  12978. , horizontalDirection = this.dragDirection.horizontal;
  12979. if (this.floating && horizontalDirection) {
  12980. return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf));
  12981. } else {
  12982. return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf));
  12983. }
  12984. },
  12985. _getDragVerticalDirection: function () {
  12986. var delta = this.positionAbs.top - this.lastPositionAbs.top;
  12987. return delta !== 0 && (delta > 0 ? "down" : "up");
  12988. },
  12989. _getDragHorizontalDirection: function () {
  12990. var delta = this.positionAbs.left - this.lastPositionAbs.left;
  12991. return delta !== 0 && (delta > 0 ? "right" : "left");
  12992. },
  12993. refresh: function (event) {
  12994. this._refreshItems(event);
  12995. this._setHandleClassName();
  12996. this.refreshPositions();
  12997. return this;
  12998. },
  12999. _connectWith: function () {
  13000. var options = this.options;
  13001. return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith;
  13002. },
  13003. _getItemsAsjQuery: function (connected) {
  13004. var i, j, cur, inst, items = [], queries = [], connectWith = this._connectWith();
  13005. if (connectWith && connected) {
  13006. for (i = connectWith.length - 1; i >= 0; i--) {
  13007. cur = $(connectWith[i], this.document[0]);
  13008. for (j = cur.length - 1; j >= 0; j--) {
  13009. inst = $.data(cur[j], this.widgetFullName);
  13010. if (inst && inst !== this && !inst.options.disabled) {
  13011. queries.push([typeof inst.options.items === "function" ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]);
  13012. }
  13013. }
  13014. }
  13015. }
  13016. queries.push([typeof this.options.items === "function" ? this.options.items.call(this.element, null, {
  13017. options: this.options,
  13018. item: this.currentItem
  13019. }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);
  13020. function addItems() {
  13021. items.push(this);
  13022. }
  13023. for (i = queries.length - 1; i >= 0; i--) {
  13024. queries[i][0].each(addItems);
  13025. }
  13026. return $(items);
  13027. },
  13028. _removeCurrentsFromItems: function () {
  13029. var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
  13030. this.items = $.grep(this.items, function (item) {
  13031. for (var j = 0; j < list.length; j++) {
  13032. if (list[j] === item.item[0]) {
  13033. return false;
  13034. }
  13035. }
  13036. return true;
  13037. });
  13038. },
  13039. _refreshItems: function (event) {
  13040. this.items = [];
  13041. this.containers = [this];
  13042. var i, j, cur, inst, targetData, _queries, item, queriesLength, items = this.items,
  13043. queries = [[typeof this.options.items === "function" ? this.options.items.call(this.element[0], event, {
  13044. item: this.currentItem
  13045. }) : $(this.options.items, this.element), this]], connectWith = this._connectWith();
  13046. //Shouldn't be run the first time through due to massive slow-down
  13047. if (connectWith && this.ready) {
  13048. for (i = connectWith.length - 1; i >= 0; i--) {
  13049. cur = $(connectWith[i], this.document[0]);
  13050. for (j = cur.length - 1; j >= 0; j--) {
  13051. inst = $.data(cur[j], this.widgetFullName);
  13052. if (inst && inst !== this && !inst.options.disabled) {
  13053. queries.push([typeof inst.options.items === "function" ? inst.options.items.call(inst.element[0], event, {
  13054. item: this.currentItem
  13055. }) : $(inst.options.items, inst.element), inst]);
  13056. this.containers.push(inst);
  13057. }
  13058. }
  13059. }
  13060. }
  13061. for (i = queries.length - 1; i >= 0; i--) {
  13062. targetData = queries[i][1];
  13063. _queries = queries[i][0];
  13064. for (j = 0,
  13065. queriesLength = _queries.length; j < queriesLength; j++) {
  13066. item = $(_queries[j]);
  13067. // Data for target checking (mouse manager)
  13068. item.data(this.widgetName + "-item", targetData);
  13069. items.push({
  13070. item: item,
  13071. instance: targetData,
  13072. width: 0,
  13073. height: 0,
  13074. left: 0,
  13075. top: 0
  13076. });
  13077. }
  13078. }
  13079. },
  13080. _refreshItemPositions: function (fast) {
  13081. var i, item, t, p;
  13082. for (i = this.items.length - 1; i >= 0; i--) {
  13083. item = this.items[i];
  13084. //We ignore calculating positions of all connected containers when we're not over them
  13085. if (this.currentContainer && item.instance !== this.currentContainer && item.item[0] !== this.currentItem[0]) {
  13086. continue;
  13087. }
  13088. t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
  13089. if (!fast) {
  13090. item.width = t.outerWidth();
  13091. item.height = t.outerHeight();
  13092. }
  13093. p = t.offset();
  13094. item.left = p.left;
  13095. item.top = p.top;
  13096. }
  13097. },
  13098. refreshPositions: function (fast) {
  13099. // Determine whether items are being displayed horizontally
  13100. this.floating = this.items.length ? this.options.axis === "x" || this._isFloating(this.items[0].item) : false;
  13101. if (this.innermostContainer !== null) {
  13102. this._refreshItemPositions(fast);
  13103. }
  13104. var i, p;
  13105. if (this.options.custom && this.options.custom.refreshContainers) {
  13106. this.options.custom.refreshContainers.call(this);
  13107. } else {
  13108. for (i = this.containers.length - 1; i >= 0; i--) {
  13109. p = this.containers[i].element.offset();
  13110. this.containers[i].containerCache.left = p.left;
  13111. this.containers[i].containerCache.top = p.top;
  13112. this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
  13113. this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
  13114. }
  13115. }
  13116. return this;
  13117. },
  13118. _createPlaceholder: function (that) {
  13119. that = that || this;
  13120. var className, nodeName, o = that.options;
  13121. if (!o.placeholder || o.placeholder.constructor === String) {
  13122. className = o.placeholder;
  13123. nodeName = that.currentItem[0].nodeName.toLowerCase();
  13124. o.placeholder = {
  13125. element: function () {
  13126. var element = $("<" + nodeName + ">", that.document[0]);
  13127. that._addClass(element, "ui-sortable-placeholder", className || that.currentItem[0].className)._removeClass(element, "ui-sortable-helper");
  13128. if (nodeName === "tbody") {
  13129. that._createTrPlaceholder(that.currentItem.find("tr").eq(0), $("<tr>", that.document[0]).appendTo(element));
  13130. } else if (nodeName === "tr") {
  13131. that._createTrPlaceholder(that.currentItem, element);
  13132. } else if (nodeName === "img") {
  13133. element.attr("src", that.currentItem.attr("src"));
  13134. }
  13135. if (!className) {
  13136. element.css("visibility", "hidden");
  13137. }
  13138. return element;
  13139. },
  13140. update: function (container, p) {
  13141. // 1. If a className is set as 'placeholder option, we don't force sizes -
  13142. // the class is responsible for that
  13143. // 2. The option 'forcePlaceholderSize can be enabled to force it even if a
  13144. // class name is specified
  13145. if (className && !o.forcePlaceholderSize) {
  13146. return;
  13147. }
  13148. // If the element doesn't have a actual height or width by itself (without
  13149. // styles coming from a stylesheet), it receives the inline height and width
  13150. // from the dragged item. Or, if it's a tbody or tr, it's going to have a height
  13151. // anyway since we're populating them with <td>s above, but they're unlikely to
  13152. // be the correct height on their own if the row heights are dynamic, so we'll
  13153. // always assign the height of the dragged item given forcePlaceholderSize
  13154. // is true.
  13155. if (!p.height() || (o.forcePlaceholderSize && (nodeName === "tbody" || nodeName === "tr"))) {
  13156. p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop") || 0, 10) - parseInt(that.currentItem.css("paddingBottom") || 0, 10));
  13157. }
  13158. if (!p.width()) {
  13159. p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft") || 0, 10) - parseInt(that.currentItem.css("paddingRight") || 0, 10));
  13160. }
  13161. }
  13162. };
  13163. }
  13164. //Create the placeholder
  13165. that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
  13166. //Append it after the actual current item
  13167. that.currentItem.after(that.placeholder);
  13168. //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
  13169. o.placeholder.update(that, that.placeholder);
  13170. },
  13171. _createTrPlaceholder: function (sourceTr, targetTr) {
  13172. var that = this;
  13173. sourceTr.children().each(function () {
  13174. $("<td>&#160;</td>", that.document[0]).attr("colspan", $(this).attr("colspan") || 1).appendTo(targetTr);
  13175. });
  13176. },
  13177. _contactContainers: function (event) {
  13178. var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis,
  13179. innermostContainer = null, innermostIndex = null;
  13180. // Get innermost container that intersects with item
  13181. for (i = this.containers.length - 1; i >= 0; i--) {
  13182. // Never consider a container that's located within the item itself
  13183. if ($.contains(this.currentItem[0], this.containers[i].element[0])) {
  13184. continue;
  13185. }
  13186. if (this._intersectsWith(this.containers[i].containerCache)) {
  13187. // If we've already found a container and it's more "inner" than this, then continue
  13188. if (innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) {
  13189. continue;
  13190. }
  13191. innermostContainer = this.containers[i];
  13192. innermostIndex = i;
  13193. } else {
  13194. // container doesn't intersect. trigger "out" event if necessary
  13195. if (this.containers[i].containerCache.over) {
  13196. this.containers[i]._trigger("out", event, this._uiHash(this));
  13197. this.containers[i].containerCache.over = 0;
  13198. }
  13199. }
  13200. }
  13201. this.innermostContainer = innermostContainer;
  13202. // If no intersecting containers found, return
  13203. if (!innermostContainer) {
  13204. return;
  13205. }
  13206. // Move the item into the container if it's not there already
  13207. if (this.containers.length === 1) {
  13208. if (!this.containers[innermostIndex].containerCache.over) {
  13209. this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
  13210. this.containers[innermostIndex].containerCache.over = 1;
  13211. }
  13212. } else {
  13213. // When entering a new container, we will find the item with the least distance and
  13214. // append our item near it
  13215. dist = 10000;
  13216. itemWithLeastDistance = null;
  13217. floating = innermostContainer.floating || this._isFloating(this.currentItem);
  13218. posProperty = floating ? "left" : "top";
  13219. sizeProperty = floating ? "width" : "height";
  13220. axis = floating ? "pageX" : "pageY";
  13221. for (j = this.items.length - 1; j >= 0; j--) {
  13222. if (!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) {
  13223. continue;
  13224. }
  13225. if (this.items[j].item[0] === this.currentItem[0]) {
  13226. continue;
  13227. }
  13228. cur = this.items[j].item.offset()[posProperty];
  13229. nearBottom = false;
  13230. if (event[axis] - cur > this.items[j][sizeProperty] / 2) {
  13231. nearBottom = true;
  13232. }
  13233. if (Math.abs(event[axis] - cur) < dist) {
  13234. dist = Math.abs(event[axis] - cur);
  13235. itemWithLeastDistance = this.items[j];
  13236. this.direction = nearBottom ? "up" : "down";
  13237. }
  13238. }
  13239. //Check if dropOnEmpty is enabled
  13240. if (!itemWithLeastDistance && !this.options.dropOnEmpty) {
  13241. return;
  13242. }
  13243. if (this.currentContainer === this.containers[innermostIndex]) {
  13244. if (!this.currentContainer.containerCache.over) {
  13245. this.containers[innermostIndex]._trigger("over", event, this._uiHash());
  13246. this.currentContainer.containerCache.over = 1;
  13247. }
  13248. return;
  13249. }
  13250. if (itemWithLeastDistance) {
  13251. this._rearrange(event, itemWithLeastDistance, null, true);
  13252. } else {
  13253. this._rearrange(event, null, this.containers[innermostIndex].element, true);
  13254. }
  13255. this._trigger("change", event, this._uiHash());
  13256. this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
  13257. this.currentContainer = this.containers[innermostIndex];
  13258. //Update the placeholder
  13259. this.options.placeholder.update(this.currentContainer, this.placeholder);
  13260. //Update scrollParent
  13261. this.scrollParent = this.placeholder.scrollParent();
  13262. //Update overflowOffset
  13263. if (this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== "HTML") {
  13264. this.overflowOffset = this.scrollParent.offset();
  13265. }
  13266. this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
  13267. this.containers[innermostIndex].containerCache.over = 1;
  13268. }
  13269. },
  13270. _createHelper: function (event) {
  13271. var o = this.options
  13272. ,
  13273. helper = typeof o.helper === "function" ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem);
  13274. //Add the helper to the DOM if that didn't happen already
  13275. if (!helper.parents("body").length) {
  13276. this.appendTo[0].appendChild(helper[0]);
  13277. }
  13278. if (helper[0] === this.currentItem[0]) {
  13279. this._storedCSS = {
  13280. width: this.currentItem[0].style.width,
  13281. height: this.currentItem[0].style.height,
  13282. position: this.currentItem.css("position"),
  13283. top: this.currentItem.css("top"),
  13284. left: this.currentItem.css("left")
  13285. };
  13286. }
  13287. if (!helper[0].style.width || o.forceHelperSize) {
  13288. helper.width(this.currentItem.width());
  13289. }
  13290. if (!helper[0].style.height || o.forceHelperSize) {
  13291. helper.height(this.currentItem.height());
  13292. }
  13293. return helper;
  13294. },
  13295. _adjustOffsetFromHelper: function (obj) {
  13296. if (typeof obj === "string") {
  13297. obj = obj.split(" ");
  13298. }
  13299. if (Array.isArray(obj)) {
  13300. obj = {
  13301. left: +obj[0],
  13302. top: +obj[1] || 0
  13303. };
  13304. }
  13305. if ("left" in obj) {
  13306. this.offset.click.left = obj.left + this.margins.left;
  13307. }
  13308. if ("right" in obj) {
  13309. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  13310. }
  13311. if ("top" in obj) {
  13312. this.offset.click.top = obj.top + this.margins.top;
  13313. }
  13314. if ("bottom" in obj) {
  13315. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  13316. }
  13317. },
  13318. _getParentOffset: function () {
  13319. //Get the offsetParent and cache its position
  13320. this.offsetParent = this.helper.offsetParent();
  13321. var po = this.offsetParent.offset();
  13322. // This is a special case where we need to modify a offset calculated on start, since the
  13323. // following happened:
  13324. // 1. The position of the helper is absolute, so it's position is calculated based on the
  13325. // next positioned parent
  13326. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
  13327. // the document, which means that the scroll is included in the initial calculation of the
  13328. // offset of the parent, and never recalculated upon drag
  13329. if (this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) {
  13330. po.left += this.scrollParent.scrollLeft();
  13331. po.top += this.scrollParent.scrollTop();
  13332. }
  13333. // This needs to be actually done for all browsers, since pageX/pageY includes this
  13334. // information with an ugly IE fix
  13335. if (this.offsetParent[0] === this.document[0].body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
  13336. po = {
  13337. top: 0,
  13338. left: 0
  13339. };
  13340. }
  13341. return {
  13342. top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
  13343. left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
  13344. };
  13345. },
  13346. _getRelativeOffset: function () {
  13347. if (this.cssPosition === "relative") {
  13348. var p = this.currentItem.position();
  13349. return {
  13350. top: p.top - (parseInt(this.helper.css("top"), 10) || 0) + this.scrollParent.scrollTop(),
  13351. left: p.left - (parseInt(this.helper.css("left"), 10) || 0) + this.scrollParent.scrollLeft()
  13352. };
  13353. } else {
  13354. return {
  13355. top: 0,
  13356. left: 0
  13357. };
  13358. }
  13359. },
  13360. _cacheMargins: function () {
  13361. this.margins = {
  13362. left: (parseInt(this.currentItem.css("marginLeft"), 10) || 0),
  13363. top: (parseInt(this.currentItem.css("marginTop"), 10) || 0)
  13364. };
  13365. },
  13366. _cacheHelperProportions: function () {
  13367. this.helperProportions = {
  13368. width: this.helper.outerWidth(),
  13369. height: this.helper.outerHeight()
  13370. };
  13371. },
  13372. _setContainment: function () {
  13373. var ce, co, over, o = this.options;
  13374. if (o.containment === "parent") {
  13375. o.containment = this.helper[0].parentNode;
  13376. }
  13377. if (o.containment === "document" || o.containment === "window") {
  13378. this.containment = [0 - this.offset.relative.left - this.offset.parent.left, 0 - this.offset.relative.top - this.offset.parent.top, o.containment === "document" ? this.document.width() : this.window.width() - this.helperProportions.width - this.margins.left, (o.containment === "document" ? (this.document.height() || document.body.parentNode.scrollHeight) : this.window.height() || this.document[0].body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top];
  13379. }
  13380. if (!(/^(document|window|parent)$/).test(o.containment)) {
  13381. ce = $(o.containment)[0];
  13382. co = $(o.containment).offset();
  13383. over = ($(ce).css("overflow") !== "hidden");
  13384. this.containment = [co.left + (parseInt($(ce).css("borderLeftWidth"), 10) || 0) + (parseInt($(ce).css("paddingLeft"), 10) || 0) - this.margins.left, co.top + (parseInt($(ce).css("borderTopWidth"), 10) || 0) + (parseInt($(ce).css("paddingTop"), 10) || 0) - this.margins.top, co.left + (over ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"), 10) || 0) - (parseInt($(ce).css("paddingRight"), 10) || 0) - this.helperProportions.width - this.margins.left, co.top + (over ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"), 10) || 0) - (parseInt($(ce).css("paddingBottom"), 10) || 0) - this.helperProportions.height - this.margins.top];
  13385. }
  13386. },
  13387. _convertPositionTo: function (d, pos) {
  13388. if (!pos) {
  13389. pos = this.position;
  13390. }
  13391. var mod = d === "absolute" ? 1 : -1
  13392. ,
  13393. scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent
  13394. , scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
  13395. return {
  13396. top: (
  13397. // The absolute mouse position
  13398. pos.top +
  13399. // Only for relative positioned nodes: Relative offset from element to offset parent
  13400. this.offset.relative.top * mod +
  13401. // The offsetParent's offset without borders (offset + border)
  13402. this.offset.parent.top * mod - ((this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : (scrollIsRootNode ? 0 : scroll.scrollTop())) * mod)),
  13403. left: (
  13404. // The absolute mouse position
  13405. pos.left +
  13406. // Only for relative positioned nodes: Relative offset from element to offset parent
  13407. this.offset.relative.left * mod +
  13408. // The offsetParent's offset without borders (offset + border)
  13409. this.offset.parent.left * mod - ((this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft()) * mod))
  13410. };
  13411. },
  13412. _generatePosition: function (event) {
  13413. var top, left, o = this.options, pageX = event.pageX, pageY = event.pageY,
  13414. scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
  13415. scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
  13416. // This is another very weird special case that only happens for relative elements:
  13417. // 1. If the css position is relative
  13418. // 2. and the scroll parent is the document or similar to the offset parent
  13419. // we have to refresh the relative offset during the scroll so there are no jumps
  13420. if (this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && this.scrollParent[0] !== this.offsetParent[0])) {
  13421. this.offset.relative = this._getRelativeOffset();
  13422. }
  13423. /*
  13424. * - Position constraining -
  13425. * Constrain the position to a mix of grid, containment.
  13426. */
  13427. if (this.originalPosition) {
  13428. //If we are not dragging yet, we won't check for options
  13429. if (this.containment) {
  13430. if (event.pageX - this.offset.click.left < this.containment[0]) {
  13431. pageX = this.containment[0] + this.offset.click.left;
  13432. }
  13433. if (event.pageY - this.offset.click.top < this.containment[1]) {
  13434. pageY = this.containment[1] + this.offset.click.top;
  13435. }
  13436. if (event.pageX - this.offset.click.left > this.containment[2]) {
  13437. pageX = this.containment[2] + this.offset.click.left;
  13438. }
  13439. if (event.pageY - this.offset.click.top > this.containment[3]) {
  13440. pageY = this.containment[3] + this.offset.click.top;
  13441. }
  13442. }
  13443. if (o.grid) {
  13444. top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
  13445. pageY = this.containment ? ((top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
  13446. left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
  13447. pageX = this.containment ? ((left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
  13448. }
  13449. }
  13450. return {
  13451. top: (
  13452. // The absolute mouse position
  13453. pageY -
  13454. // Click offset (relative to the element)
  13455. this.offset.click.top -
  13456. // Only for relative positioned nodes: Relative offset from element to offset parent
  13457. this.offset.relative.top -
  13458. // The offsetParent's offset without borders (offset + border)
  13459. this.offset.parent.top + ((this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : (scrollIsRootNode ? 0 : scroll.scrollTop())))),
  13460. left: (
  13461. // The absolute mouse position
  13462. pageX -
  13463. // Click offset (relative to the element)
  13464. this.offset.click.left -
  13465. // Only for relative positioned nodes: Relative offset from element to offset parent
  13466. this.offset.relative.left -
  13467. // The offsetParent's offset without borders (offset + border)
  13468. this.offset.parent.left + ((this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft())))
  13469. };
  13470. },
  13471. _rearrange: function (event, i, a, hardRefresh) {
  13472. if (a) {
  13473. a[0].appendChild(this.placeholder[0]);
  13474. } else {
  13475. i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling));
  13476. }
  13477. //Various things done here to improve the performance:
  13478. // 1. we create a setTimeout, that calls refreshPositions
  13479. // 2. on the instance, we have a counter variable, that get's higher after every append
  13480. // 3. on the local scope, we copy the counter variable, and check in the timeout,
  13481. // if it's still the same
  13482. // 4. this lets only the last addition to the timeout stack through
  13483. this.counter = this.counter ? ++this.counter : 1;
  13484. var counter = this.counter;
  13485. this._delay(function () {
  13486. if (counter === this.counter) {
  13487. //Precompute after each DOM insertion, NOT on mousemove
  13488. this.refreshPositions(!hardRefresh);
  13489. }
  13490. });
  13491. },
  13492. _clear: function (event, noPropagation) {
  13493. this.reverting = false;
  13494. // We delay all events that have to be triggered to after the point where the placeholder
  13495. // has been removed and everything else normalized again
  13496. var i, delayedTriggers = [];
  13497. // We first have to update the dom position of the actual currentItem
  13498. // Note: don't do it if the current item is already removed (by a user), or it gets
  13499. // reappended (see #4088)
  13500. if (!this._noFinalSort && this.currentItem.parent().length) {
  13501. this.placeholder.before(this.currentItem);
  13502. }
  13503. this._noFinalSort = null;
  13504. if (this.helper[0] === this.currentItem[0]) {
  13505. for (i in this._storedCSS) {
  13506. if (this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") {
  13507. this._storedCSS[i] = "";
  13508. }
  13509. }
  13510. this.currentItem.css(this._storedCSS);
  13511. this._removeClass(this.currentItem, "ui-sortable-helper");
  13512. } else {
  13513. this.currentItem.show();
  13514. }
  13515. if (this.fromOutside && !noPropagation) {
  13516. delayedTriggers.push(function (event) {
  13517. this._trigger("receive", event, this._uiHash(this.fromOutside));
  13518. });
  13519. }
  13520. if ((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) {
  13521. // Trigger update callback if the DOM position has changed
  13522. delayedTriggers.push(function (event) {
  13523. this._trigger("update", event, this._uiHash());
  13524. });
  13525. }
  13526. // Check if the items Container has Changed and trigger appropriate
  13527. // events.
  13528. if (this !== this.currentContainer) {
  13529. if (!noPropagation) {
  13530. delayedTriggers.push(function (event) {
  13531. this._trigger("remove", event, this._uiHash());
  13532. });
  13533. delayedTriggers.push((function (c) {
  13534. return function (event) {
  13535. c._trigger("receive", event, this._uiHash(this));
  13536. }
  13537. ;
  13538. }
  13539. ).call(this, this.currentContainer));
  13540. delayedTriggers.push((function (c) {
  13541. return function (event) {
  13542. c._trigger("update", event, this._uiHash(this));
  13543. }
  13544. ;
  13545. }
  13546. ).call(this, this.currentContainer));
  13547. }
  13548. }
  13549. //Post events to containers
  13550. function delayEvent(type, instance, container) {
  13551. return function (event) {
  13552. container._trigger(type, event, instance._uiHash(instance));
  13553. }
  13554. ;
  13555. }
  13556. for (i = this.containers.length - 1; i >= 0; i--) {
  13557. if (!noPropagation) {
  13558. delayedTriggers.push(delayEvent("deactivate", this, this.containers[i]));
  13559. }
  13560. if (this.containers[i].containerCache.over) {
  13561. delayedTriggers.push(delayEvent("out", this, this.containers[i]));
  13562. this.containers[i].containerCache.over = 0;
  13563. }
  13564. }
  13565. //Do what was originally in plugins
  13566. if (this.storedCursor) {
  13567. this.document.find("body").css("cursor", this.storedCursor);
  13568. this.storedStylesheet.remove();
  13569. }
  13570. if (this._storedOpacity) {
  13571. this.helper.css("opacity", this._storedOpacity);
  13572. }
  13573. if (this._storedZIndex) {
  13574. this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex);
  13575. }
  13576. this.dragging = false;
  13577. if (!noPropagation) {
  13578. this._trigger("beforeStop", event, this._uiHash());
  13579. }
  13580. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
  13581. // it unbinds ALL events from the original node!
  13582. this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  13583. if (!this.cancelHelperRemoval) {
  13584. if (this.helper[0] !== this.currentItem[0]) {
  13585. this.helper.remove();
  13586. }
  13587. this.helper = null;
  13588. }
  13589. if (!noPropagation) {
  13590. for (i = 0; i < delayedTriggers.length; i++) {
  13591. // Trigger all delayed events
  13592. delayedTriggers[i].call(this, event);
  13593. }
  13594. this._trigger("stop", event, this._uiHash());
  13595. }
  13596. this.fromOutside = false;
  13597. return !this.cancelHelperRemoval;
  13598. },
  13599. _trigger: function () {
  13600. if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
  13601. this.cancel();
  13602. }
  13603. },
  13604. _uiHash: function (_inst) {
  13605. var inst = _inst || this;
  13606. return {
  13607. helper: inst.helper,
  13608. placeholder: inst.placeholder || $([]),
  13609. position: inst.position,
  13610. originalPosition: inst.originalPosition,
  13611. offset: inst.positionAbs,
  13612. item: inst.currentItem,
  13613. sender: _inst ? _inst.element : null
  13614. };
  13615. }
  13616. });
  13617. /*!
  13618. * jQuery UI Spinner 1.13.0
  13619. * http://jqueryui.com
  13620. *
  13621. * Copyright jQuery Foundation and other contributors
  13622. * Released under the MIT license.
  13623. * http://jquery.org/license
  13624. */
  13625. //>>label: Spinner
  13626. //>>group: Widgets
  13627. //>>description: Displays buttons to easily input numbers via the keyboard or mouse.
  13628. //>>docs: http://api.jqueryui.com/spinner/
  13629. //>>demos: http://jqueryui.com/spinner/
  13630. //>>css.structure: ../../themes/base/core.css
  13631. //>>css.structure: ../../themes/base/spinner.css
  13632. //>>css.theme: ../../themes/base/theme.css
  13633. function spinnerModifier(fn) {
  13634. return function () {
  13635. var previous = this.element.val();
  13636. fn.apply(this, arguments);
  13637. this._refresh();
  13638. if (previous !== this.element.val()) {
  13639. this._trigger("change");
  13640. }
  13641. }
  13642. ;
  13643. }
  13644. $.widget("ui.spinner", {
  13645. version: "1.13.0",
  13646. defaultElement: "<input>",
  13647. widgetEventPrefix: "spin",
  13648. options: {
  13649. classes: {
  13650. "ui-spinner": "ui-corner-all",
  13651. "ui-spinner-down": "ui-corner-br",
  13652. "ui-spinner-up": "ui-corner-tr"
  13653. },
  13654. culture: null,
  13655. icons: {
  13656. down: "ui-icon-triangle-1-s",
  13657. up: "ui-icon-triangle-1-n"
  13658. },
  13659. incremental: true,
  13660. max: null,
  13661. min: null,
  13662. numberFormat: null,
  13663. page: 10,
  13664. step: 1,
  13665. change: null,
  13666. spin: null,
  13667. start: null,
  13668. stop: null
  13669. },
  13670. _create: function () {
  13671. // handle string values that need to be parsed
  13672. this._setOption("max", this.options.max);
  13673. this._setOption("min", this.options.min);
  13674. this._setOption("step", this.options.step);
  13675. // Only format if there is a value, prevents the field from being marked
  13676. // as invalid in Firefox, see #9573.
  13677. if (this.value() !== "") {
  13678. // Format the value, but don't constrain.
  13679. this._value(this.element.val(), true);
  13680. }
  13681. this._draw();
  13682. this._on(this._events);
  13683. this._refresh();
  13684. // Turning off autocomplete prevents the browser from remembering the
  13685. // value when navigating through history, so we re-enable autocomplete
  13686. // if the page is unloaded before the widget is destroyed. #7790
  13687. this._on(this.window, {
  13688. beforeunload: function () {
  13689. this.element.removeAttr("autocomplete");
  13690. }
  13691. });
  13692. },
  13693. _getCreateOptions: function () {
  13694. var options = this._super();
  13695. var element = this.element;
  13696. $.each(["min", "max", "step"], function (i, option) {
  13697. var value = element.attr(option);
  13698. if (value != null && value.length) {
  13699. options[option] = value;
  13700. }
  13701. });
  13702. return options;
  13703. },
  13704. _events: {
  13705. keydown: function (event) {
  13706. if (this._start(event) && this._keydown(event)) {
  13707. event.preventDefault();
  13708. }
  13709. },
  13710. keyup: "_stop",
  13711. focus: function () {
  13712. this.previous = this.element.val();
  13713. },
  13714. blur: function (event) {
  13715. if (this.cancelBlur) {
  13716. delete this.cancelBlur;
  13717. return;
  13718. }
  13719. this._stop();
  13720. this._refresh();
  13721. if (this.previous !== this.element.val()) {
  13722. this._trigger("change", event);
  13723. }
  13724. },
  13725. mousewheel: function (event, delta) {
  13726. var activeElement = $.ui.safeActiveElement(this.document[0]);
  13727. var isActive = this.element[0] === activeElement;
  13728. if (!isActive || !delta) {
  13729. return;
  13730. }
  13731. if (!this.spinning && !this._start(event)) {
  13732. return false;
  13733. }
  13734. this._spin((delta > 0 ? 1 : -1) * this.options.step, event);
  13735. clearTimeout(this.mousewheelTimer);
  13736. this.mousewheelTimer = this._delay(function () {
  13737. if (this.spinning) {
  13738. this._stop(event);
  13739. }
  13740. }, 100);
  13741. event.preventDefault();
  13742. },
  13743. "mousedown .ui-spinner-button": function (event) {
  13744. var previous;
  13745. // We never want the buttons to have focus; whenever the user is
  13746. // interacting with the spinner, the focus should be on the input.
  13747. // If the input is focused then this.previous is properly set from
  13748. // when the input first received focus. If the input is not focused
  13749. // then we need to set this.previous based on the value before spinning.
  13750. previous = this.element[0] === $.ui.safeActiveElement(this.document[0]) ? this.previous : this.element.val();
  13751. function checkFocus() {
  13752. var isActive = this.element[0] === $.ui.safeActiveElement(this.document[0]);
  13753. if (!isActive) {
  13754. this.element.trigger("focus");
  13755. this.previous = previous;
  13756. // support: IE
  13757. // IE sets focus asynchronously, so we need to check if focus
  13758. // moved off of the input because the user clicked on the button.
  13759. this._delay(function () {
  13760. this.previous = previous;
  13761. });
  13762. }
  13763. }
  13764. // Ensure focus is on (or stays on) the text field
  13765. event.preventDefault();
  13766. checkFocus.call(this);
  13767. // Support: IE
  13768. // IE doesn't prevent moving focus even with event.preventDefault()
  13769. // so we set a flag to know when we should ignore the blur event
  13770. // and check (again) if focus moved off of the input.
  13771. this.cancelBlur = true;
  13772. this._delay(function () {
  13773. delete this.cancelBlur;
  13774. checkFocus.call(this);
  13775. });
  13776. if (this._start(event) === false) {
  13777. return;
  13778. }
  13779. this._repeat(null, $(event.currentTarget).hasClass("ui-spinner-up") ? 1 : -1, event);
  13780. },
  13781. "mouseup .ui-spinner-button": "_stop",
  13782. "mouseenter .ui-spinner-button": function (event) {
  13783. // button will add ui-state-active if mouse was down while mouseleave and kept down
  13784. if (!$(event.currentTarget).hasClass("ui-state-active")) {
  13785. return;
  13786. }
  13787. if (this._start(event) === false) {
  13788. return false;
  13789. }
  13790. this._repeat(null, $(event.currentTarget).hasClass("ui-spinner-up") ? 1 : -1, event);
  13791. },
  13792. // TODO: do we really want to consider this a stop?
  13793. // shouldn't we just stop the repeater and wait until mouseup before
  13794. // we trigger the stop event?
  13795. "mouseleave .ui-spinner-button": "_stop"
  13796. },
  13797. // Support mobile enhanced option and make backcompat more sane
  13798. _enhance: function () {
  13799. this.uiSpinner = this.element.attr("autocomplete", "off").wrap("<span>").parent()
  13800. // Add buttons
  13801. .append("<a></a><a></a>");
  13802. },
  13803. _draw: function () {
  13804. this._enhance();
  13805. this._addClass(this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content");
  13806. this._addClass("ui-spinner-input");
  13807. this.element.attr("role", "spinbutton");
  13808. // Button bindings
  13809. this.buttons = this.uiSpinner.children("a").attr("tabIndex", -1).attr("aria-hidden", true).button({
  13810. classes: {
  13811. "ui-button": ""
  13812. }
  13813. });
  13814. // TODO: Right now button does not support classes this is already updated in button PR
  13815. this._removeClass(this.buttons, "ui-corner-all");
  13816. this._addClass(this.buttons.first(), "ui-spinner-button ui-spinner-up");
  13817. this._addClass(this.buttons.last(), "ui-spinner-button ui-spinner-down");
  13818. this.buttons.first().button({
  13819. "icon": this.options.icons.up,
  13820. "showLabel": false
  13821. });
  13822. this.buttons.last().button({
  13823. "icon": this.options.icons.down,
  13824. "showLabel": false
  13825. });
  13826. // IE 6 doesn't understand height: 50% for the buttons
  13827. // unless the wrapper has an explicit height
  13828. if (this.buttons.height() > Math.ceil(this.uiSpinner.height() * 0.5) && this.uiSpinner.height() > 0) {
  13829. this.uiSpinner.height(this.uiSpinner.height());
  13830. }
  13831. },
  13832. _keydown: function (event) {
  13833. var options = this.options
  13834. , keyCode = $.ui.keyCode;
  13835. switch (event.keyCode) {
  13836. case keyCode.UP:
  13837. this._repeat(null, 1, event);
  13838. return true;
  13839. case keyCode.DOWN:
  13840. this._repeat(null, -1, event);
  13841. return true;
  13842. case keyCode.PAGE_UP:
  13843. this._repeat(null, options.page, event);
  13844. return true;
  13845. case keyCode.PAGE_DOWN:
  13846. this._repeat(null, -options.page, event);
  13847. return true;
  13848. }
  13849. return false;
  13850. },
  13851. _start: function (event) {
  13852. if (!this.spinning && this._trigger("start", event) === false) {
  13853. return false;
  13854. }
  13855. if (!this.counter) {
  13856. this.counter = 1;
  13857. }
  13858. this.spinning = true;
  13859. return true;
  13860. },
  13861. _repeat: function (i, steps, event) {
  13862. i = i || 500;
  13863. clearTimeout(this.timer);
  13864. this.timer = this._delay(function () {
  13865. this._repeat(40, steps, event);
  13866. }, i);
  13867. this._spin(steps * this.options.step, event);
  13868. },
  13869. _spin: function (step, event) {
  13870. var value = this.value() || 0;
  13871. if (!this.counter) {
  13872. this.counter = 1;
  13873. }
  13874. value = this._adjustValue(value + step * this._increment(this.counter));
  13875. if (!this.spinning || this._trigger("spin", event, {
  13876. value: value
  13877. }) !== false) {
  13878. this._value(value);
  13879. this.counter++;
  13880. }
  13881. },
  13882. _increment: function (i) {
  13883. var incremental = this.options.incremental;
  13884. if (incremental) {
  13885. return typeof incremental === "function" ? incremental(i) : Math.floor(i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1);
  13886. }
  13887. return 1;
  13888. },
  13889. _precision: function () {
  13890. var precision = this._precisionOf(this.options.step);
  13891. if (this.options.min !== null) {
  13892. precision = Math.max(precision, this._precisionOf(this.options.min));
  13893. }
  13894. return precision;
  13895. },
  13896. _precisionOf: function (num) {
  13897. var str = num.toString()
  13898. , decimal = str.indexOf(".");
  13899. return decimal === -1 ? 0 : str.length - decimal - 1;
  13900. },
  13901. _adjustValue: function (value) {
  13902. var base, aboveMin, options = this.options;
  13903. // Make sure we're at a valid step
  13904. // - find out where we are relative to the base (min or 0)
  13905. base = options.min !== null ? options.min : 0;
  13906. aboveMin = value - base;
  13907. // - round to the nearest step
  13908. aboveMin = Math.round(aboveMin / options.step) * options.step;
  13909. // - rounding is based on 0, so adjust back to our base
  13910. value = base + aboveMin;
  13911. // Fix precision from bad JS floating point math
  13912. value = parseFloat(value.toFixed(this._precision()));
  13913. // Clamp the value
  13914. if (options.max !== null && value > options.max) {
  13915. return options.max;
  13916. }
  13917. if (options.min !== null && value < options.min) {
  13918. return options.min;
  13919. }
  13920. return value;
  13921. },
  13922. _stop: function (event) {
  13923. if (!this.spinning) {
  13924. return;
  13925. }
  13926. clearTimeout(this.timer);
  13927. clearTimeout(this.mousewheelTimer);
  13928. this.counter = 0;
  13929. this.spinning = false;
  13930. this._trigger("stop", event);
  13931. },
  13932. _setOption: function (key, value) {
  13933. var prevValue, first, last;
  13934. if (key === "culture" || key === "numberFormat") {
  13935. prevValue = this._parse(this.element.val());
  13936. this.options[key] = value;
  13937. this.element.val(this._format(prevValue));
  13938. return;
  13939. }
  13940. if (key === "max" || key === "min" || key === "step") {
  13941. if (typeof value === "string") {
  13942. value = this._parse(value);
  13943. }
  13944. }
  13945. if (key === "icons") {
  13946. first = this.buttons.first().find(".ui-icon");
  13947. this._removeClass(first, null, this.options.icons.up);
  13948. this._addClass(first, null, value.up);
  13949. last = this.buttons.last().find(".ui-icon");
  13950. this._removeClass(last, null, this.options.icons.down);
  13951. this._addClass(last, null, value.down);
  13952. }
  13953. this._super(key, value);
  13954. },
  13955. _setOptionDisabled: function (value) {
  13956. this._super(value);
  13957. this._toggleClass(this.uiSpinner, null, "ui-state-disabled", !!value);
  13958. this.element.prop("disabled", !!value);
  13959. this.buttons.button(value ? "disable" : "enable");
  13960. },
  13961. _setOptions: spinnerModifier(function (options) {
  13962. this._super(options);
  13963. }),
  13964. _parse: function (val) {
  13965. if (typeof val === "string" && val !== "") {
  13966. val = window.Globalize && this.options.numberFormat ? Globalize.parseFloat(val, 10, this.options.culture) : +val;
  13967. }
  13968. return val === "" || isNaN(val) ? null : val;
  13969. },
  13970. _format: function (value) {
  13971. if (value === "") {
  13972. return "";
  13973. }
  13974. return window.Globalize && this.options.numberFormat ? Globalize.format(value, this.options.numberFormat, this.options.culture) : value;
  13975. },
  13976. _refresh: function () {
  13977. this.element.attr({
  13978. "aria-valuemin": this.options.min,
  13979. "aria-valuemax": this.options.max,
  13980. // TODO: what should we do with values that can't be parsed?
  13981. "aria-valuenow": this._parse(this.element.val())
  13982. });
  13983. },
  13984. isValid: function () {
  13985. var value = this.value();
  13986. // Null is invalid
  13987. if (value === null) {
  13988. return false;
  13989. }
  13990. // If value gets adjusted, it's invalid
  13991. return value === this._adjustValue(value);
  13992. },
  13993. // Update the value without triggering change
  13994. _value: function (value, allowAny) {
  13995. var parsed;
  13996. if (value !== "") {
  13997. parsed = this._parse(value);
  13998. if (parsed !== null) {
  13999. if (!allowAny) {
  14000. parsed = this._adjustValue(parsed);
  14001. }
  14002. value = this._format(parsed);
  14003. }
  14004. }
  14005. this.element.val(value);
  14006. this._refresh();
  14007. },
  14008. _destroy: function () {
  14009. this.element.prop("disabled", false).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow");
  14010. this.uiSpinner.replaceWith(this.element);
  14011. },
  14012. stepUp: spinnerModifier(function (steps) {
  14013. this._stepUp(steps);
  14014. }),
  14015. _stepUp: function (steps) {
  14016. if (this._start()) {
  14017. this._spin((steps || 1) * this.options.step);
  14018. this._stop();
  14019. }
  14020. },
  14021. stepDown: spinnerModifier(function (steps) {
  14022. this._stepDown(steps);
  14023. }),
  14024. _stepDown: function (steps) {
  14025. if (this._start()) {
  14026. this._spin((steps || 1) * -this.options.step);
  14027. this._stop();
  14028. }
  14029. },
  14030. pageUp: spinnerModifier(function (pages) {
  14031. this._stepUp((pages || 1) * this.options.page);
  14032. }),
  14033. pageDown: spinnerModifier(function (pages) {
  14034. this._stepDown((pages || 1) * this.options.page);
  14035. }),
  14036. value: function (newVal) {
  14037. if (!arguments.length) {
  14038. return this._parse(this.element.val());
  14039. }
  14040. spinnerModifier(this._value).call(this, newVal);
  14041. },
  14042. widget: function () {
  14043. return this.uiSpinner;
  14044. }
  14045. });
  14046. // DEPRECATED
  14047. // TODO: switch return back to widget declaration at top of file when this is removed
  14048. if ($.uiBackCompat !== false) {
  14049. // Backcompat for spinner html extension points
  14050. $.widget("ui.spinner", $.ui.spinner, {
  14051. _enhance: function () {
  14052. this.uiSpinner = this.element.attr("autocomplete", "off").wrap(this._uiSpinnerHtml()).parent()
  14053. // Add buttons
  14054. .append(this._buttonHtml());
  14055. },
  14056. _uiSpinnerHtml: function () {
  14057. return "<span>";
  14058. },
  14059. _buttonHtml: function () {
  14060. return "<a></a><a></a>";
  14061. }
  14062. });
  14063. }
  14064. var widgetsSpinner = $.ui.spinner;
  14065. /*!
  14066. * jQuery UI Tabs 1.13.0
  14067. * http://jqueryui.com
  14068. *
  14069. * Copyright jQuery Foundation and other contributors
  14070. * Released under the MIT license.
  14071. * http://jquery.org/license
  14072. */
  14073. //>>label: Tabs
  14074. //>>group: Widgets
  14075. //>>description: Transforms a set of container elements into a tab structure.
  14076. //>>docs: http://api.jqueryui.com/tabs/
  14077. //>>demos: http://jqueryui.com/tabs/
  14078. //>>css.structure: ../../themes/base/core.css
  14079. //>>css.structure: ../../themes/base/tabs.css
  14080. //>>css.theme: ../../themes/base/theme.css
  14081. $.widget("ui.tabs", {
  14082. version: "1.13.0",
  14083. delay: 300,
  14084. options: {
  14085. active: null,
  14086. classes: {
  14087. "ui-tabs": "ui-corner-all",
  14088. "ui-tabs-nav": "ui-corner-all",
  14089. "ui-tabs-panel": "ui-corner-bottom",
  14090. "ui-tabs-tab": "ui-corner-top"
  14091. },
  14092. collapsible: false,
  14093. event: "click",
  14094. heightStyle: "content",
  14095. hide: null,
  14096. show: null,
  14097. // Callbacks
  14098. activate: null,
  14099. beforeActivate: null,
  14100. beforeLoad: null,
  14101. load: null
  14102. },
  14103. _isLocal: (function () {
  14104. var rhash = /#.*$/;
  14105. return function (anchor) {
  14106. var anchorUrl, locationUrl;
  14107. anchorUrl = anchor.href.replace(rhash, "");
  14108. locationUrl = location.href.replace(rhash, "");
  14109. // Decoding may throw an error if the URL isn't UTF-8 (#9518)
  14110. try {
  14111. anchorUrl = decodeURIComponent(anchorUrl);
  14112. } catch (error) {
  14113. }
  14114. try {
  14115. locationUrl = decodeURIComponent(locationUrl);
  14116. } catch (error) {
  14117. }
  14118. return anchor.hash.length > 1 && anchorUrl === locationUrl;
  14119. }
  14120. ;
  14121. }
  14122. )(),
  14123. _create: function () {
  14124. var that = this
  14125. , options = this.options;
  14126. this.running = false;
  14127. this._addClass("ui-tabs", "ui-widget ui-widget-content");
  14128. this._toggleClass("ui-tabs-collapsible", null, options.collapsible);
  14129. this._processTabs();
  14130. options.active = this._initialActive();
  14131. // Take disabling tabs via class attribute from HTML
  14132. // into account and update option properly.
  14133. if (Array.isArray(options.disabled)) {
  14134. options.disabled = $.uniqueSort(options.disabled.concat($.map(this.tabs.filter(".ui-state-disabled"), function (li) {
  14135. return that.tabs.index(li);
  14136. }))).sort();
  14137. }
  14138. // Check for length avoids error when initializing empty list
  14139. if (this.options.active !== false && this.anchors.length) {
  14140. this.active = this._findActive(options.active);
  14141. } else {
  14142. this.active = $();
  14143. }
  14144. this._refresh();
  14145. if (this.active.length) {
  14146. this.load(options.active);
  14147. }
  14148. },
  14149. _initialActive: function () {
  14150. var active = this.options.active
  14151. , collapsible = this.options.collapsible
  14152. , locationHash = location.hash.substring(1);
  14153. if (active === null) {
  14154. // check the fragment identifier in the URL
  14155. if (locationHash) {
  14156. this.tabs.each(function (i, tab) {
  14157. if ($(tab).attr("aria-controls") === locationHash) {
  14158. active = i;
  14159. return false;
  14160. }
  14161. });
  14162. }
  14163. // Check for a tab marked active via a class
  14164. if (active === null) {
  14165. active = this.tabs.index(this.tabs.filter(".ui-tabs-active"));
  14166. }
  14167. // No active tab, set to false
  14168. if (active === null || active === -1) {
  14169. active = this.tabs.length ? 0 : false;
  14170. }
  14171. }
  14172. // Handle numbers: negative, out of range
  14173. if (active !== false) {
  14174. active = this.tabs.index(this.tabs.eq(active));
  14175. if (active === -1) {
  14176. active = collapsible ? false : 0;
  14177. }
  14178. }
  14179. // Don't allow collapsible: false and active: false
  14180. if (!collapsible && active === false && this.anchors.length) {
  14181. active = 0;
  14182. }
  14183. return active;
  14184. },
  14185. _getCreateEventData: function () {
  14186. return {
  14187. tab: this.active,
  14188. panel: !this.active.length ? $() : this._getPanelForTab(this.active)
  14189. };
  14190. },
  14191. _tabKeydown: function (event) {
  14192. var focusedTab = $($.ui.safeActiveElement(this.document[0])).closest("li")
  14193. , selectedIndex = this.tabs.index(focusedTab)
  14194. , goingForward = true;
  14195. if (this._handlePageNav(event)) {
  14196. return;
  14197. }
  14198. switch (event.keyCode) {
  14199. case $.ui.keyCode.RIGHT:
  14200. case $.ui.keyCode.DOWN:
  14201. selectedIndex++;
  14202. break;
  14203. case $.ui.keyCode.UP:
  14204. case $.ui.keyCode.LEFT:
  14205. goingForward = false;
  14206. selectedIndex--;
  14207. break;
  14208. case $.ui.keyCode.END:
  14209. selectedIndex = this.anchors.length - 1;
  14210. break;
  14211. case $.ui.keyCode.HOME:
  14212. selectedIndex = 0;
  14213. break;
  14214. case $.ui.keyCode.SPACE:
  14215. // Activate only, no collapsing
  14216. event.preventDefault();
  14217. clearTimeout(this.activating);
  14218. this._activate(selectedIndex);
  14219. return;
  14220. case $.ui.keyCode.ENTER:
  14221. // Toggle (cancel delayed activation, allow collapsing)
  14222. event.preventDefault();
  14223. clearTimeout(this.activating);
  14224. // Determine if we should collapse or activate
  14225. this._activate(selectedIndex === this.options.active ? false : selectedIndex);
  14226. return;
  14227. default:
  14228. return;
  14229. }
  14230. // Focus the appropriate tab, based on which key was pressed
  14231. event.preventDefault();
  14232. clearTimeout(this.activating);
  14233. selectedIndex = this._focusNextTab(selectedIndex, goingForward);
  14234. // Navigating with control/command key will prevent automatic activation
  14235. if (!event.ctrlKey && !event.metaKey) {
  14236. // Update aria-selected immediately so that AT think the tab is already selected.
  14237. // Otherwise AT may confuse the user by stating that they need to activate the tab,
  14238. // but the tab will already be activated by the time the announcement finishes.
  14239. focusedTab.attr("aria-selected", "false");
  14240. this.tabs.eq(selectedIndex).attr("aria-selected", "true");
  14241. this.activating = this._delay(function () {
  14242. this.option("active", selectedIndex);
  14243. }, this.delay);
  14244. }
  14245. },
  14246. _panelKeydown: function (event) {
  14247. if (this._handlePageNav(event)) {
  14248. return;
  14249. }
  14250. // Ctrl+up moves focus to the current tab
  14251. if (event.ctrlKey && event.keyCode === $.ui.keyCode.UP) {
  14252. event.preventDefault();
  14253. this.active.trigger("focus");
  14254. }
  14255. },
  14256. // Alt+page up/down moves focus to the previous/next tab (and activates)
  14257. _handlePageNav: function (event) {
  14258. if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP) {
  14259. this._activate(this._focusNextTab(this.options.active - 1, false));
  14260. return true;
  14261. }
  14262. if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN) {
  14263. this._activate(this._focusNextTab(this.options.active + 1, true));
  14264. return true;
  14265. }
  14266. },
  14267. _findNextTab: function (index, goingForward) {
  14268. var lastTabIndex = this.tabs.length - 1;
  14269. function constrain() {
  14270. if (index > lastTabIndex) {
  14271. index = 0;
  14272. }
  14273. if (index < 0) {
  14274. index = lastTabIndex;
  14275. }
  14276. return index;
  14277. }
  14278. while ($.inArray(constrain(), this.options.disabled) !== -1) {
  14279. index = goingForward ? index + 1 : index - 1;
  14280. }
  14281. return index;
  14282. },
  14283. _focusNextTab: function (index, goingForward) {
  14284. index = this._findNextTab(index, goingForward);
  14285. this.tabs.eq(index).trigger("focus");
  14286. return index;
  14287. },
  14288. _setOption: function (key, value) {
  14289. if (key === "active") {
  14290. // _activate() will handle invalid values and update this.options
  14291. this._activate(value);
  14292. return;
  14293. }
  14294. this._super(key, value);
  14295. if (key === "collapsible") {
  14296. this._toggleClass("ui-tabs-collapsible", null, value);
  14297. // Setting collapsible: false while collapsed; open first panel
  14298. if (!value && this.options.active === false) {
  14299. this._activate(0);
  14300. }
  14301. }
  14302. if (key === "event") {
  14303. this._setupEvents(value);
  14304. }
  14305. if (key === "heightStyle") {
  14306. this._setupHeightStyle(value);
  14307. }
  14308. },
  14309. _sanitizeSelector: function (hash) {
  14310. return hash ? hash.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&") : "";
  14311. },
  14312. refresh: function () {
  14313. var options = this.options
  14314. , lis = this.tablist.children(":has(a[href])");
  14315. // Get disabled tabs from class attribute from HTML
  14316. // this will get converted to a boolean if needed in _refresh()
  14317. options.disabled = $.map(lis.filter(".ui-state-disabled"), function (tab) {
  14318. return lis.index(tab);
  14319. });
  14320. this._processTabs();
  14321. // Was collapsed or no tabs
  14322. if (options.active === false || !this.anchors.length) {
  14323. options.active = false;
  14324. this.active = $();
  14325. // was active, but active tab is gone
  14326. } else if (this.active.length && !$.contains(this.tablist[0], this.active[0])) {
  14327. // all remaining tabs are disabled
  14328. if (this.tabs.length === options.disabled.length) {
  14329. options.active = false;
  14330. this.active = $();
  14331. // activate previous tab
  14332. } else {
  14333. this._activate(this._findNextTab(Math.max(0, options.active - 1), false));
  14334. }
  14335. // was active, active tab still exists
  14336. } else {
  14337. // make sure active index is correct
  14338. options.active = this.tabs.index(this.active);
  14339. }
  14340. this._refresh();
  14341. },
  14342. _refresh: function () {
  14343. this._setOptionDisabled(this.options.disabled);
  14344. this._setupEvents(this.options.event);
  14345. this._setupHeightStyle(this.options.heightStyle);
  14346. this.tabs.not(this.active).attr({
  14347. "aria-selected": "false",
  14348. "aria-expanded": "false",
  14349. tabIndex: -1
  14350. });
  14351. this.panels.not(this._getPanelForTab(this.active)).hide().attr({
  14352. "aria-hidden": "true"
  14353. });
  14354. // Make sure one tab is in the tab order
  14355. if (!this.active.length) {
  14356. this.tabs.eq(0).attr("tabIndex", 0);
  14357. } else {
  14358. this.active.attr({
  14359. "aria-selected": "true",
  14360. "aria-expanded": "true",
  14361. tabIndex: 0
  14362. });
  14363. this._addClass(this.active, "ui-tabs-active", "ui-state-active");
  14364. this._getPanelForTab(this.active).show().attr({
  14365. "aria-hidden": "false"
  14366. });
  14367. }
  14368. },
  14369. _processTabs: function () {
  14370. var that = this
  14371. , prevTabs = this.tabs
  14372. , prevAnchors = this.anchors
  14373. , prevPanels = this.panels;
  14374. this.tablist = this._getList().attr("role", "tablist");
  14375. this._addClass(this.tablist, "ui-tabs-nav", "ui-helper-reset ui-helper-clearfix ui-widget-header");
  14376. // Prevent users from focusing disabled tabs via click
  14377. this.tablist.on("mousedown" + this.eventNamespace, "> li", function (event) {
  14378. if ($(this).is(".ui-state-disabled")) {
  14379. event.preventDefault();
  14380. }
  14381. })
  14382. // Support: IE <9
  14383. // Preventing the default action in mousedown doesn't prevent IE
  14384. // from focusing the element, so if the anchor gets focused, blur.
  14385. // We don't have to worry about focusing the previously focused
  14386. // element since clicking on a non-focusable element should focus
  14387. // the body anyway.
  14388. .on("focus" + this.eventNamespace, ".ui-tabs-anchor", function () {
  14389. if ($(this).closest("li").is(".ui-state-disabled")) {
  14390. this.blur();
  14391. }
  14392. });
  14393. this.tabs = this.tablist.find("> li:has(a[href])").attr({
  14394. role: "tab",
  14395. tabIndex: -1
  14396. });
  14397. this._addClass(this.tabs, "ui-tabs-tab", "ui-state-default");
  14398. this.anchors = this.tabs.map(function () {
  14399. return $("a", this)[0];
  14400. }).attr({
  14401. tabIndex: -1
  14402. });
  14403. this._addClass(this.anchors, "ui-tabs-anchor");
  14404. this.panels = $();
  14405. this.anchors.each(function (i, anchor) {
  14406. var selector, panel, panelId, anchorId = $(anchor).uniqueId().attr("id"), tab = $(anchor).closest("li"),
  14407. originalAriaControls = tab.attr("aria-controls");
  14408. // Inline tab
  14409. if (that._isLocal(anchor)) {
  14410. selector = anchor.hash;
  14411. panelId = selector.substring(1);
  14412. panel = that.element.find(that._sanitizeSelector(selector));
  14413. // remote tab
  14414. } else {
  14415. // If the tab doesn't already have aria-controls,
  14416. // generate an id by using a throw-away element
  14417. panelId = tab.attr("aria-controls") || $({}).uniqueId()[0].id;
  14418. selector = "#" + panelId;
  14419. panel = that.element.find(selector);
  14420. if (!panel.length) {
  14421. panel = that._createPanel(panelId);
  14422. panel.insertAfter(that.panels[i - 1] || that.tablist);
  14423. }
  14424. panel.attr("aria-live", "polite");
  14425. }
  14426. if (panel.length) {
  14427. that.panels = that.panels.add(panel);
  14428. }
  14429. if (originalAriaControls) {
  14430. tab.data("ui-tabs-aria-controls", originalAriaControls);
  14431. }
  14432. tab.attr({
  14433. "aria-controls": panelId,
  14434. "aria-labelledby": anchorId
  14435. });
  14436. panel.attr("aria-labelledby", anchorId);
  14437. });
  14438. this.panels.attr("role", "tabpanel");
  14439. this._addClass(this.panels, "ui-tabs-panel", "ui-widget-content");
  14440. // Avoid memory leaks (#10056)
  14441. if (prevTabs) {
  14442. this._off(prevTabs.not(this.tabs));
  14443. this._off(prevAnchors.not(this.anchors));
  14444. this._off(prevPanels.not(this.panels));
  14445. }
  14446. },
  14447. // Allow overriding how to find the list for rare usage scenarios (#7715)
  14448. _getList: function () {
  14449. return this.tablist || this.element.find("ol, ul").eq(0);
  14450. },
  14451. _createPanel: function (id) {
  14452. return $("<div>").attr("id", id).data("ui-tabs-destroy", true);
  14453. },
  14454. _setOptionDisabled: function (disabled) {
  14455. var currentItem, li, i;
  14456. if (Array.isArray(disabled)) {
  14457. if (!disabled.length) {
  14458. disabled = false;
  14459. } else if (disabled.length === this.anchors.length) {
  14460. disabled = true;
  14461. }
  14462. }
  14463. // Disable tabs
  14464. for (i = 0; (li = this.tabs[i]); i++) {
  14465. currentItem = $(li);
  14466. if (disabled === true || $.inArray(i, disabled) !== -1) {
  14467. currentItem.attr("aria-disabled", "true");
  14468. this._addClass(currentItem, null, "ui-state-disabled");
  14469. } else {
  14470. currentItem.removeAttr("aria-disabled");
  14471. this._removeClass(currentItem, null, "ui-state-disabled");
  14472. }
  14473. }
  14474. this.options.disabled = disabled;
  14475. this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, disabled === true);
  14476. },
  14477. _setupEvents: function (event) {
  14478. var events = {};
  14479. if (event) {
  14480. $.each(event.split(" "), function (index, eventName) {
  14481. events[eventName] = "_eventHandler";
  14482. });
  14483. }
  14484. this._off(this.anchors.add(this.tabs).add(this.panels));
  14485. // Always prevent the default action, even when disabled
  14486. this._on(true, this.anchors, {
  14487. click: function (event) {
  14488. event.preventDefault();
  14489. }
  14490. });
  14491. this._on(this.anchors, events);
  14492. this._on(this.tabs, {
  14493. keydown: "_tabKeydown"
  14494. });
  14495. this._on(this.panels, {
  14496. keydown: "_panelKeydown"
  14497. });
  14498. this._focusable(this.tabs);
  14499. this._hoverable(this.tabs);
  14500. },
  14501. _setupHeightStyle: function (heightStyle) {
  14502. var maxHeight, parent = this.element.parent();
  14503. if (heightStyle === "fill") {
  14504. maxHeight = parent.height();
  14505. maxHeight -= this.element.outerHeight() - this.element.height();
  14506. this.element.siblings(":visible").each(function () {
  14507. var elem = $(this)
  14508. , position = elem.css("position");
  14509. if (position === "absolute" || position === "fixed") {
  14510. return;
  14511. }
  14512. maxHeight -= elem.outerHeight(true);
  14513. });
  14514. this.element.children().not(this.panels).each(function () {
  14515. maxHeight -= $(this).outerHeight(true);
  14516. });
  14517. this.panels.each(function () {
  14518. $(this).height(Math.max(0, maxHeight - $(this).innerHeight() + $(this).height()));
  14519. }).css("overflow", "auto");
  14520. } else if (heightStyle === "auto") {
  14521. maxHeight = 0;
  14522. this.panels.each(function () {
  14523. maxHeight = Math.max(maxHeight, $(this).height("").height());
  14524. }).height(maxHeight);
  14525. }
  14526. },
  14527. _eventHandler: function (event) {
  14528. var options = this.options
  14529. , active = this.active
  14530. , anchor = $(event.currentTarget)
  14531. , tab = anchor.closest("li")
  14532. , clickedIsActive = tab[0] === active[0]
  14533. , collapsing = clickedIsActive && options.collapsible
  14534. , toShow = collapsing ? $() : this._getPanelForTab(tab)
  14535. , toHide = !active.length ? $() : this._getPanelForTab(active)
  14536. , eventData = {
  14537. oldTab: active,
  14538. oldPanel: toHide,
  14539. newTab: collapsing ? $() : tab,
  14540. newPanel: toShow
  14541. };
  14542. event.preventDefault();
  14543. if (tab.hasClass("ui-state-disabled") ||
  14544. // tab is already loading
  14545. tab.hasClass("ui-tabs-loading") ||
  14546. // can't switch durning an animation
  14547. this.running ||
  14548. // click on active header, but not collapsible
  14549. (clickedIsActive && !options.collapsible) ||
  14550. // allow canceling activation
  14551. (this._trigger("beforeActivate", event, eventData) === false)) {
  14552. return;
  14553. }
  14554. options.active = collapsing ? false : this.tabs.index(tab);
  14555. this.active = clickedIsActive ? $() : tab;
  14556. if (this.xhr) {
  14557. this.xhr.abort();
  14558. }
  14559. if (!toHide.length && !toShow.length) {
  14560. $.error("jQuery UI Tabs: Mismatching fragment identifier.");
  14561. }
  14562. if (toShow.length) {
  14563. this.load(this.tabs.index(tab), event);
  14564. }
  14565. this._toggle(event, eventData);
  14566. },
  14567. // Handles show/hide for selecting tabs
  14568. _toggle: function (event, eventData) {
  14569. var that = this
  14570. , toShow = eventData.newPanel
  14571. , toHide = eventData.oldPanel;
  14572. this.running = true;
  14573. function complete() {
  14574. that.running = false;
  14575. that._trigger("activate", event, eventData);
  14576. }
  14577. function show() {
  14578. that._addClass(eventData.newTab.closest("li"), "ui-tabs-active", "ui-state-active");
  14579. if (toShow.length && that.options.show) {
  14580. that._show(toShow, that.options.show, complete);
  14581. } else {
  14582. toShow.show();
  14583. complete();
  14584. }
  14585. }
  14586. // Start out by hiding, then showing, then completing
  14587. if (toHide.length && this.options.hide) {
  14588. this._hide(toHide, this.options.hide, function () {
  14589. that._removeClass(eventData.oldTab.closest("li"), "ui-tabs-active", "ui-state-active");
  14590. show();
  14591. });
  14592. } else {
  14593. this._removeClass(eventData.oldTab.closest("li"), "ui-tabs-active", "ui-state-active");
  14594. toHide.hide();
  14595. show();
  14596. }
  14597. toHide.attr("aria-hidden", "true");
  14598. eventData.oldTab.attr({
  14599. "aria-selected": "false",
  14600. "aria-expanded": "false"
  14601. });
  14602. // If we're switching tabs, remove the old tab from the tab order.
  14603. // If we're opening from collapsed state, remove the previous tab from the tab order.
  14604. // If we're collapsing, then keep the collapsing tab in the tab order.
  14605. if (toShow.length && toHide.length) {
  14606. eventData.oldTab.attr("tabIndex", -1);
  14607. } else if (toShow.length) {
  14608. this.tabs.filter(function () {
  14609. return $(this).attr("tabIndex") === 0;
  14610. }).attr("tabIndex", -1);
  14611. }
  14612. toShow.attr("aria-hidden", "false");
  14613. eventData.newTab.attr({
  14614. "aria-selected": "true",
  14615. "aria-expanded": "true",
  14616. tabIndex: 0
  14617. });
  14618. },
  14619. _activate: function (index) {
  14620. var anchor, active = this._findActive(index);
  14621. // Trying to activate the already active panel
  14622. if (active[0] === this.active[0]) {
  14623. return;
  14624. }
  14625. // Trying to collapse, simulate a click on the current active header
  14626. if (!active.length) {
  14627. active = this.active;
  14628. }
  14629. anchor = active.find(".ui-tabs-anchor")[0];
  14630. this._eventHandler({
  14631. target: anchor,
  14632. currentTarget: anchor,
  14633. preventDefault: $.noop
  14634. });
  14635. },
  14636. _findActive: function (index) {
  14637. return index === false ? $() : this.tabs.eq(index);
  14638. },
  14639. _getIndex: function (index) {
  14640. // meta-function to give users option to provide a href string instead of a numerical index.
  14641. if (typeof index === "string") {
  14642. index = this.anchors.index(this.anchors.filter("[href$='" + $.escapeSelector(index) + "']"));
  14643. }
  14644. return index;
  14645. },
  14646. _destroy: function () {
  14647. if (this.xhr) {
  14648. this.xhr.abort();
  14649. }
  14650. this.tablist.removeAttr("role").off(this.eventNamespace);
  14651. this.anchors.removeAttr("role tabIndex").removeUniqueId();
  14652. this.tabs.add(this.panels).each(function () {
  14653. if ($.data(this, "ui-tabs-destroy")) {
  14654. $(this).remove();
  14655. } else {
  14656. $(this).removeAttr("role tabIndex " + "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded");
  14657. }
  14658. });
  14659. this.tabs.each(function () {
  14660. var li = $(this)
  14661. , prev = li.data("ui-tabs-aria-controls");
  14662. if (prev) {
  14663. li.attr("aria-controls", prev).removeData("ui-tabs-aria-controls");
  14664. } else {
  14665. li.removeAttr("aria-controls");
  14666. }
  14667. });
  14668. this.panels.show();
  14669. if (this.options.heightStyle !== "content") {
  14670. this.panels.css("height", "");
  14671. }
  14672. },
  14673. enable: function (index) {
  14674. var disabled = this.options.disabled;
  14675. if (disabled === false) {
  14676. return;
  14677. }
  14678. if (index === undefined) {
  14679. disabled = false;
  14680. } else {
  14681. index = this._getIndex(index);
  14682. if (Array.isArray(disabled)) {
  14683. disabled = $.map(disabled, function (num) {
  14684. return num !== index ? num : null;
  14685. });
  14686. } else {
  14687. disabled = $.map(this.tabs, function (li, num) {
  14688. return num !== index ? num : null;
  14689. });
  14690. }
  14691. }
  14692. this._setOptionDisabled(disabled);
  14693. },
  14694. disable: function (index) {
  14695. var disabled = this.options.disabled;
  14696. if (disabled === true) {
  14697. return;
  14698. }
  14699. if (index === undefined) {
  14700. disabled = true;
  14701. } else {
  14702. index = this._getIndex(index);
  14703. if ($.inArray(index, disabled) !== -1) {
  14704. return;
  14705. }
  14706. if (Array.isArray(disabled)) {
  14707. disabled = $.merge([index], disabled).sort();
  14708. } else {
  14709. disabled = [index];
  14710. }
  14711. }
  14712. this._setOptionDisabled(disabled);
  14713. },
  14714. load: function (index, event) {
  14715. index = this._getIndex(index);
  14716. var that = this
  14717. , tab = this.tabs.eq(index)
  14718. , anchor = tab.find(".ui-tabs-anchor")
  14719. , panel = this._getPanelForTab(tab)
  14720. , eventData = {
  14721. tab: tab,
  14722. panel: panel
  14723. }
  14724. , complete = function (jqXHR, status) {
  14725. if (status === "abort") {
  14726. that.panels.stop(false, true);
  14727. }
  14728. that._removeClass(tab, "ui-tabs-loading");
  14729. panel.removeAttr("aria-busy");
  14730. if (jqXHR === that.xhr) {
  14731. delete that.xhr;
  14732. }
  14733. };
  14734. // Not remote
  14735. if (this._isLocal(anchor[0])) {
  14736. return;
  14737. }
  14738. this.xhr = $.ajax(this._ajaxSettings(anchor, event, eventData));
  14739. // Support: jQuery <1.8
  14740. // jQuery <1.8 returns false if the request is canceled in beforeSend,
  14741. // but as of 1.8, $.ajax() always returns a jqXHR object.
  14742. if (this.xhr && this.xhr.statusText !== "canceled") {
  14743. this._addClass(tab, "ui-tabs-loading");
  14744. panel.attr("aria-busy", "true");
  14745. this.xhr.done(function (response, status, jqXHR) {
  14746. // support: jQuery <1.8
  14747. // http://bugs.jquery.com/ticket/11778
  14748. setTimeout(function () {
  14749. panel.html(response);
  14750. that._trigger("load", event, eventData);
  14751. complete(jqXHR, status);
  14752. }, 1);
  14753. }).fail(function (jqXHR, status) {
  14754. // support: jQuery <1.8
  14755. // http://bugs.jquery.com/ticket/11778
  14756. setTimeout(function () {
  14757. complete(jqXHR, status);
  14758. }, 1);
  14759. });
  14760. }
  14761. },
  14762. _ajaxSettings: function (anchor, event, eventData) {
  14763. var that = this;
  14764. return {
  14765. // Support: IE <11 only
  14766. // Strip any hash that exists to prevent errors with the Ajax request
  14767. url: anchor.attr("href").replace(/#.*$/, ""),
  14768. beforeSend: function (jqXHR, settings) {
  14769. return that._trigger("beforeLoad", event, $.extend({
  14770. jqXHR: jqXHR,
  14771. ajaxSettings: settings
  14772. }, eventData));
  14773. }
  14774. };
  14775. },
  14776. _getPanelForTab: function (tab) {
  14777. var id = $(tab).attr("aria-controls");
  14778. return this.element.find(this._sanitizeSelector("#" + id));
  14779. }
  14780. });
  14781. // DEPRECATED
  14782. // TODO: Switch return back to widget declaration at top of file when this is removed
  14783. if ($.uiBackCompat !== false) {
  14784. // Backcompat for ui-tab class (now ui-tabs-tab)
  14785. $.widget("ui.tabs", $.ui.tabs, {
  14786. _processTabs: function () {
  14787. this._superApply(arguments);
  14788. this._addClass(this.tabs, "ui-tab");
  14789. }
  14790. });
  14791. }
  14792. var widgetsTabs = $.ui.tabs;
  14793. /*!
  14794. * jQuery UI Tooltip 1.13.0
  14795. * http://jqueryui.com
  14796. *
  14797. * Copyright jQuery Foundation and other contributors
  14798. * Released under the MIT license.
  14799. * http://jquery.org/license
  14800. */
  14801. //>>label: Tooltip
  14802. //>>group: Widgets
  14803. //>>description: Shows additional information for any element on hover or focus.
  14804. //>>docs: http://api.jqueryui.com/tooltip/
  14805. //>>demos: http://jqueryui.com/tooltip/
  14806. //>>css.structure: ../../themes/base/core.css
  14807. //>>css.structure: ../../themes/base/tooltip.css
  14808. //>>css.theme: ../../themes/base/theme.css
  14809. $.widget("ui.tooltip", {
  14810. version: "1.13.0",
  14811. options: {
  14812. classes: {
  14813. "ui-tooltip": "ui-corner-all ui-widget-shadow"
  14814. },
  14815. content: function () {
  14816. var title = $(this).attr("title");
  14817. // Escape title, since we're going from an attribute to raw HTML
  14818. return $("<a>").text(title).html();
  14819. },
  14820. hide: true,
  14821. // Disabled elements have inconsistent behavior across browsers (#8661)
  14822. items: "[title]:not([disabled])",
  14823. position: {
  14824. my: "left top+15",
  14825. at: "left bottom",
  14826. collision: "flipfit flip"
  14827. },
  14828. show: true,
  14829. track: false,
  14830. // Callbacks
  14831. close: null,
  14832. open: null
  14833. },
  14834. _addDescribedBy: function (elem, id) {
  14835. var describedby = (elem.attr("aria-describedby") || "").split(/\s+/);
  14836. describedby.push(id);
  14837. elem.data("ui-tooltip-id", id).attr("aria-describedby", String.prototype.trim.call(describedby.join(" ")));
  14838. },
  14839. _removeDescribedBy: function (elem) {
  14840. var id = elem.data("ui-tooltip-id")
  14841. , describedby = (elem.attr("aria-describedby") || "").split(/\s+/)
  14842. , index = $.inArray(id, describedby);
  14843. if (index !== -1) {
  14844. describedby.splice(index, 1);
  14845. }
  14846. elem.removeData("ui-tooltip-id");
  14847. describedby = String.prototype.trim.call(describedby.join(" "));
  14848. if (describedby) {
  14849. elem.attr("aria-describedby", describedby);
  14850. } else {
  14851. elem.removeAttr("aria-describedby");
  14852. }
  14853. },
  14854. _create: function () {
  14855. this._on({
  14856. mouseover: "open",
  14857. focusin: "open"
  14858. });
  14859. // IDs of generated tooltips, needed for destroy
  14860. this.tooltips = {};
  14861. // IDs of parent tooltips where we removed the title attribute
  14862. this.parents = {};
  14863. // Append the aria-live region so tooltips announce correctly
  14864. this.liveRegion = $("<div>").attr({
  14865. role: "log",
  14866. "aria-live": "assertive",
  14867. "aria-relevant": "additions"
  14868. }).appendTo(this.document[0].body);
  14869. this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible");
  14870. this.disabledTitles = $([]);
  14871. },
  14872. _setOption: function (key, value) {
  14873. var that = this;
  14874. this._super(key, value);
  14875. if (key === "content") {
  14876. $.each(this.tooltips, function (id, tooltipData) {
  14877. that._updateContent(tooltipData.element);
  14878. });
  14879. }
  14880. },
  14881. _setOptionDisabled: function (value) {
  14882. this[value ? "_disable" : "_enable"]();
  14883. },
  14884. _disable: function () {
  14885. var that = this;
  14886. // Close open tooltips
  14887. $.each(this.tooltips, function (id, tooltipData) {
  14888. var event = $.Event("blur");
  14889. event.target = event.currentTarget = tooltipData.element[0];
  14890. that.close(event, true);
  14891. });
  14892. // Remove title attributes to prevent native tooltips
  14893. this.disabledTitles = this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function () {
  14894. var element = $(this);
  14895. if (element.is("[title]")) {
  14896. return element.data("ui-tooltip-title", element.attr("title")).removeAttr("title");
  14897. }
  14898. }));
  14899. },
  14900. _enable: function () {
  14901. // restore title attributes
  14902. this.disabledTitles.each(function () {
  14903. var element = $(this);
  14904. if (element.data("ui-tooltip-title")) {
  14905. element.attr("title", element.data("ui-tooltip-title"));
  14906. }
  14907. });
  14908. this.disabledTitles = $([]);
  14909. },
  14910. open: function (event) {
  14911. var that = this
  14912. , target = $(event ? event.target : this.element)
  14913. // we need closest here due to mouseover bubbling,
  14914. // but always pointing at the same event target
  14915. .closest(this.options.items);
  14916. // No element to show a tooltip for or the tooltip is already open
  14917. if (!target.length || target.data("ui-tooltip-id")) {
  14918. return;
  14919. }
  14920. if (target.attr("title")) {
  14921. target.data("ui-tooltip-title", target.attr("title"));
  14922. }
  14923. target.data("ui-tooltip-open", true);
  14924. // Kill parent tooltips, custom or native, for hover
  14925. if (event && event.type === "mouseover") {
  14926. target.parents().each(function () {
  14927. var parent = $(this), blurEvent;
  14928. if (parent.data("ui-tooltip-open")) {
  14929. blurEvent = $.Event("blur");
  14930. blurEvent.target = blurEvent.currentTarget = this;
  14931. that.close(blurEvent, true);
  14932. }
  14933. if (parent.attr("title")) {
  14934. parent.uniqueId();
  14935. that.parents[this.id] = {
  14936. element: this,
  14937. title: parent.attr("title")
  14938. };
  14939. parent.attr("title", "");
  14940. }
  14941. });
  14942. }
  14943. this._registerCloseHandlers(event, target);
  14944. this._updateContent(target, event);
  14945. },
  14946. _updateContent: function (target, event) {
  14947. var content, contentOption = this.options.content, that = this, eventType = event ? event.type : null;
  14948. if (typeof contentOption === "string" || contentOption.nodeType || contentOption.jquery) {
  14949. return this._open(event, target, contentOption);
  14950. }
  14951. content = contentOption.call(target[0], function (response) {
  14952. // IE may instantly serve a cached response for ajax requests
  14953. // delay this call to _open so the other call to _open runs first
  14954. that._delay(function () {
  14955. // Ignore async response if tooltip was closed already
  14956. if (!target.data("ui-tooltip-open")) {
  14957. return;
  14958. }
  14959. // JQuery creates a special event for focusin when it doesn't
  14960. // exist natively. To improve performance, the native event
  14961. // object is reused and the type is changed. Therefore, we can't
  14962. // rely on the type being correct after the event finished
  14963. // bubbling, so we set it back to the previous value. (#8740)
  14964. if (event) {
  14965. event.type = eventType;
  14966. }
  14967. this._open(event, target, response);
  14968. });
  14969. });
  14970. if (content) {
  14971. this._open(event, target, content);
  14972. }
  14973. },
  14974. _open: function (event, target, content) {
  14975. var tooltipData, tooltip, delayedShow, a11yContent, positionOption = $.extend({}, this.options.position);
  14976. if (!content) {
  14977. return;
  14978. }
  14979. // Content can be updated multiple times. If the tooltip already
  14980. // exists, then just update the content and bail.
  14981. tooltipData = this._find(target);
  14982. if (tooltipData) {
  14983. tooltipData.tooltip.find(".ui-tooltip-content").html(content);
  14984. return;
  14985. }
  14986. // If we have a title, clear it to prevent the native tooltip
  14987. // we have to check first to avoid defining a title if none exists
  14988. // (we don't want to cause an element to start matching [title])
  14989. //
  14990. // We use removeAttr only for key events, to allow IE to export the correct
  14991. // accessible attributes. For mouse events, set to empty string to avoid
  14992. // native tooltip showing up (happens only when removing inside mouseover).
  14993. if (target.is("[title]")) {
  14994. if (event && event.type === "mouseover") {
  14995. target.attr("title", "");
  14996. } else {
  14997. target.removeAttr("title");
  14998. }
  14999. }
  15000. tooltipData = this._tooltip(target);
  15001. tooltip = tooltipData.tooltip;
  15002. this._addDescribedBy(target, tooltip.attr("id"));
  15003. tooltip.find(".ui-tooltip-content").html(content);
  15004. // Support: Voiceover on OS X, JAWS on IE <= 9
  15005. // JAWS announces deletions even when aria-relevant="additions"
  15006. // Voiceover will sometimes re-read the entire log region's contents from the beginning
  15007. this.liveRegion.children().hide();
  15008. a11yContent = $("<div>").html(tooltip.find(".ui-tooltip-content").html());
  15009. a11yContent.removeAttr("name").find("[name]").removeAttr("name");
  15010. a11yContent.removeAttr("id").find("[id]").removeAttr("id");
  15011. a11yContent.appendTo(this.liveRegion);
  15012. function position(event) {
  15013. positionOption.of = event;
  15014. if (tooltip.is(":hidden")) {
  15015. return;
  15016. }
  15017. tooltip.position(positionOption);
  15018. }
  15019. if (this.options.track && event && /^mouse/.test(event.type)) {
  15020. this._on(this.document, {
  15021. mousemove: position
  15022. });
  15023. // trigger once to override element-relative positioning
  15024. position(event);
  15025. } else {
  15026. tooltip.position($.extend({
  15027. of: target
  15028. }, this.options.position));
  15029. }
  15030. tooltip.hide();
  15031. this._show(tooltip, this.options.show);
  15032. // Handle tracking tooltips that are shown with a delay (#8644). As soon
  15033. // as the tooltip is visible, position the tooltip using the most recent
  15034. // event.
  15035. // Adds the check to add the timers only when both delay and track options are set (#14682)
  15036. if (this.options.track && this.options.show && this.options.show.delay) {
  15037. delayedShow = this.delayedShow = setInterval(function () {
  15038. if (tooltip.is(":visible")) {
  15039. position(positionOption.of);
  15040. clearInterval(delayedShow);
  15041. }
  15042. }, 13);
  15043. }
  15044. this._trigger("open", event, {
  15045. tooltip: tooltip
  15046. });
  15047. },
  15048. _registerCloseHandlers: function (event, target) {
  15049. var events = {
  15050. keyup: function (event) {
  15051. if (event.keyCode === $.ui.keyCode.ESCAPE) {
  15052. var fakeEvent = $.Event(event);
  15053. fakeEvent.currentTarget = target[0];
  15054. this.close(fakeEvent, true);
  15055. }
  15056. }
  15057. };
  15058. // Only bind remove handler for delegated targets. Non-delegated
  15059. // tooltips will handle this in destroy.
  15060. if (target[0] !== this.element[0]) {
  15061. events.remove = function () {
  15062. this._removeTooltip(this._find(target).tooltip);
  15063. }
  15064. ;
  15065. }
  15066. if (!event || event.type === "mouseover") {
  15067. events.mouseleave = "close";
  15068. }
  15069. if (!event || event.type === "focusin") {
  15070. events.focusout = "close";
  15071. }
  15072. this._on(true, target, events);
  15073. },
  15074. close: function (event) {
  15075. var tooltip, that = this, target = $(event ? event.currentTarget : this.element),
  15076. tooltipData = this._find(target);
  15077. // The tooltip may already be closed
  15078. if (!tooltipData) {
  15079. // We set ui-tooltip-open immediately upon open (in open()), but only set the
  15080. // additional data once there's actually content to show (in _open()). So even if the
  15081. // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in
  15082. // the period between open() and _open().
  15083. target.removeData("ui-tooltip-open");
  15084. return;
  15085. }
  15086. tooltip = tooltipData.tooltip;
  15087. // Disabling closes the tooltip, so we need to track when we're closing
  15088. // to avoid an infinite loop in case the tooltip becomes disabled on close
  15089. if (tooltipData.closing) {
  15090. return;
  15091. }
  15092. // Clear the interval for delayed tracking tooltips
  15093. clearInterval(this.delayedShow);
  15094. // Only set title if we had one before (see comment in _open())
  15095. // If the title attribute has changed since open(), don't restore
  15096. if (target.data("ui-tooltip-title") && !target.attr("title")) {
  15097. target.attr("title", target.data("ui-tooltip-title"));
  15098. }
  15099. this._removeDescribedBy(target);
  15100. tooltipData.hiding = true;
  15101. tooltip.stop(true);
  15102. this._hide(tooltip, this.options.hide, function () {
  15103. that._removeTooltip($(this));
  15104. });
  15105. target.removeData("ui-tooltip-open");
  15106. this._off(target, "mouseleave focusout keyup");
  15107. // Remove 'remove' binding only on delegated targets
  15108. if (target[0] !== this.element[0]) {
  15109. this._off(target, "remove");
  15110. }
  15111. this._off(this.document, "mousemove");
  15112. if (event && event.type === "mouseleave") {
  15113. $.each(this.parents, function (id, parent) {
  15114. $(parent.element).attr("title", parent.title);
  15115. delete that.parents[id];
  15116. });
  15117. }
  15118. tooltipData.closing = true;
  15119. this._trigger("close", event, {
  15120. tooltip: tooltip
  15121. });
  15122. if (!tooltipData.hiding) {
  15123. tooltipData.closing = false;
  15124. }
  15125. },
  15126. _tooltip: function (element) {
  15127. var tooltip = $("<div>").attr("role", "tooltip")
  15128. , content = $("<div>").appendTo(tooltip)
  15129. , id = tooltip.uniqueId().attr("id");
  15130. this._addClass(content, "ui-tooltip-content");
  15131. this._addClass(tooltip, "ui-tooltip", "ui-widget ui-widget-content");
  15132. tooltip.appendTo(this._appendTo(element));
  15133. return this.tooltips[id] = {
  15134. element: element,
  15135. tooltip: tooltip
  15136. };
  15137. },
  15138. _find: function (target) {
  15139. var id = target.data("ui-tooltip-id");
  15140. return id ? this.tooltips[id] : null;
  15141. },
  15142. _removeTooltip: function (tooltip) {
  15143. // Clear the interval for delayed tracking tooltips
  15144. clearInterval(this.delayedShow);
  15145. tooltip.remove();
  15146. delete this.tooltips[tooltip.attr("id")];
  15147. },
  15148. _appendTo: function (target) {
  15149. var element = target.closest(".ui-front, dialog");
  15150. if (!element.length) {
  15151. element = this.document[0].body;
  15152. }
  15153. return element;
  15154. },
  15155. _destroy: function () {
  15156. var that = this;
  15157. // Close open tooltips
  15158. $.each(this.tooltips, function (id, tooltipData) {
  15159. // Delegate to close method to handle common cleanup
  15160. var event = $.Event("blur")
  15161. , element = tooltipData.element;
  15162. event.target = event.currentTarget = element[0];
  15163. that.close(event, true);
  15164. // Remove immediately; destroying an open tooltip doesn't use the
  15165. // hide animation
  15166. $("#" + id).remove();
  15167. // Restore the title
  15168. if (element.data("ui-tooltip-title")) {
  15169. // If the title attribute has changed since open(), don't restore
  15170. if (!element.attr("title")) {
  15171. element.attr("title", element.data("ui-tooltip-title"));
  15172. }
  15173. element.removeData("ui-tooltip-title");
  15174. }
  15175. });
  15176. this.liveRegion.remove();
  15177. }
  15178. });
  15179. // DEPRECATED
  15180. // TODO: Switch return back to widget declaration at top of file when this is removed
  15181. if ($.uiBackCompat !== false) {
  15182. // Backcompat for tooltipClass option
  15183. $.widget("ui.tooltip", $.ui.tooltip, {
  15184. options: {
  15185. tooltipClass: null
  15186. },
  15187. _tooltip: function () {
  15188. var tooltipData = this._superApply(arguments);
  15189. if (this.options.tooltipClass) {
  15190. tooltipData.tooltip.addClass(this.options.tooltipClass);
  15191. }
  15192. return tooltipData;
  15193. }
  15194. });
  15195. }
  15196. var widgetsTooltip = $.ui.tooltip;
  15197. });