jquery-ui.js 517 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062
  1. /*! jQuery UI - v1.13.2 - 2023-07-02
  2. * http://jqueryui.com
  3. * Includes: widget.js, position.js, data.js, disable-selection.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/draggable.js, widgets/droppable.js, widgets/resizable.js, widgets/selectable.js, widgets/sortable.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/selectmenu.js, widgets/slider.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.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
  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. } )( function( $ ) {
  15. "use strict";
  16. $.ui = $.ui || {};
  17. var version = $.ui.version = "1.13.2";
  18. /*!
  19. * jQuery UI Widget 1.13.2
  20. * http://jqueryui.com
  21. *
  22. * Copyright jQuery Foundation and other contributors
  23. * Released under the MIT license.
  24. * http://jquery.org/license
  25. */
  26. //>>label: Widget
  27. //>>group: Core
  28. //>>description: Provides a factory for creating stateful widgets with a common API.
  29. //>>docs: http://api.jqueryui.com/jQuery.widget/
  30. //>>demos: http://jqueryui.com/widget/
  31. var widgetUuid = 0;
  32. var widgetHasOwnProperty = Array.prototype.hasOwnProperty;
  33. var widgetSlice = Array.prototype.slice;
  34. $.cleanData = ( function( orig ) {
  35. return function( elems ) {
  36. var events, elem, i;
  37. for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
  38. // Only trigger remove when necessary to save time
  39. events = $._data( elem, "events" );
  40. if ( events && events.remove ) {
  41. $( elem ).triggerHandler( "remove" );
  42. }
  43. }
  44. orig( elems );
  45. };
  46. } )( $.cleanData );
  47. $.widget = function( name, base, prototype ) {
  48. var existingConstructor, constructor, basePrototype;
  49. // ProxiedPrototype allows the provided prototype to remain unmodified
  50. // so that it can be used as a mixin for multiple widgets (#8876)
  51. var proxiedPrototype = {};
  52. var namespace = name.split( "." )[ 0 ];
  53. name = name.split( "." )[ 1 ];
  54. var fullName = namespace + "-" + name;
  55. if ( !prototype ) {
  56. prototype = base;
  57. base = $.Widget;
  58. }
  59. if ( Array.isArray( prototype ) ) {
  60. prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
  61. }
  62. // Create selector for plugin
  63. $.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) {
  64. return !!$.data( elem, fullName );
  65. };
  66. $[ namespace ] = $[ namespace ] || {};
  67. existingConstructor = $[ namespace ][ name ];
  68. constructor = $[ namespace ][ name ] = function( options, element ) {
  69. // Allow instantiation without "new" keyword
  70. if ( !this || !this._createWidget ) {
  71. return new constructor( options, element );
  72. }
  73. // Allow instantiation without initializing for simple inheritance
  74. // must use "new" keyword (the code above always passes args)
  75. if ( arguments.length ) {
  76. this._createWidget( options, element );
  77. }
  78. };
  79. // Extend with the existing constructor to carry over any static properties
  80. $.extend( constructor, existingConstructor, {
  81. version: prototype.version,
  82. // Copy the object used to create the prototype in case we need to
  83. // redefine the widget later
  84. _proto: $.extend( {}, prototype ),
  85. // Track widgets that inherit from this widget in case this widget is
  86. // redefined after a widget inherits from it
  87. _childConstructors: []
  88. } );
  89. basePrototype = new base();
  90. // We need to make the options hash a property directly on the new instance
  91. // otherwise we'll modify the options hash on the prototype that we're
  92. // inheriting from
  93. basePrototype.options = $.widget.extend( {}, basePrototype.options );
  94. $.each( prototype, function( prop, value ) {
  95. if ( typeof value !== "function" ) {
  96. proxiedPrototype[ prop ] = value;
  97. return;
  98. }
  99. proxiedPrototype[ prop ] = ( function() {
  100. function _super() {
  101. return base.prototype[ prop ].apply( this, arguments );
  102. }
  103. function _superApply( args ) {
  104. return base.prototype[ prop ].apply( this, args );
  105. }
  106. return function() {
  107. var __super = this._super;
  108. var __superApply = this._superApply;
  109. var returnValue;
  110. this._super = _super;
  111. this._superApply = _superApply;
  112. returnValue = value.apply( this, arguments );
  113. this._super = __super;
  114. this._superApply = __superApply;
  115. return returnValue;
  116. };
  117. } )();
  118. } );
  119. constructor.prototype = $.widget.extend( basePrototype, {
  120. // TODO: remove support for widgetEventPrefix
  121. // always use the name + a colon as the prefix, e.g., draggable:start
  122. // don't prefix for widgets that aren't DOM-based
  123. widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name
  124. }, proxiedPrototype, {
  125. constructor: constructor,
  126. namespace: namespace,
  127. widgetName: name,
  128. widgetFullName: fullName
  129. } );
  130. // If this widget is being redefined then we need to find all widgets that
  131. // are inheriting from it and redefine all of them so that they inherit from
  132. // the new version of this widget. We're essentially trying to replace one
  133. // level in the prototype chain.
  134. if ( existingConstructor ) {
  135. $.each( existingConstructor._childConstructors, function( i, child ) {
  136. var childPrototype = child.prototype;
  137. // Redefine the child widget using the same prototype that was
  138. // originally used, but inherit from the new version of the base
  139. $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,
  140. child._proto );
  141. } );
  142. // Remove the list of existing child constructors from the old constructor
  143. // so the old child constructors can be garbage collected
  144. delete existingConstructor._childConstructors;
  145. } else {
  146. base._childConstructors.push( constructor );
  147. }
  148. $.widget.bridge( name, constructor );
  149. return constructor;
  150. };
  151. $.widget.extend = function( target ) {
  152. var input = widgetSlice.call( arguments, 1 );
  153. var inputIndex = 0;
  154. var inputLength = input.length;
  155. var key;
  156. var value;
  157. for ( ; inputIndex < inputLength; inputIndex++ ) {
  158. for ( key in input[ inputIndex ] ) {
  159. value = input[ inputIndex ][ key ];
  160. if ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) {
  161. // Clone objects
  162. if ( $.isPlainObject( value ) ) {
  163. target[ key ] = $.isPlainObject( target[ key ] ) ?
  164. $.widget.extend( {}, target[ key ], value ) :
  165. // Don't extend strings, arrays, etc. with objects
  166. $.widget.extend( {}, value );
  167. // Copy everything else by reference
  168. } else {
  169. target[ key ] = value;
  170. }
  171. }
  172. }
  173. }
  174. return target;
  175. };
  176. $.widget.bridge = function( name, object ) {
  177. var fullName = object.prototype.widgetFullName || name;
  178. $.fn[ name ] = function( options ) {
  179. var isMethodCall = typeof options === "string";
  180. var args = widgetSlice.call( arguments, 1 );
  181. var returnValue = this;
  182. if ( isMethodCall ) {
  183. // If this is an empty collection, we need to have the instance method
  184. // return undefined instead of the jQuery instance
  185. if ( !this.length && options === "instance" ) {
  186. returnValue = undefined;
  187. } else {
  188. this.each( function() {
  189. var methodValue;
  190. var instance = $.data( this, fullName );
  191. if ( options === "instance" ) {
  192. returnValue = instance;
  193. return false;
  194. }
  195. if ( !instance ) {
  196. return $.error( "cannot call methods on " + name +
  197. " prior to initialization; " +
  198. "attempted to call method '" + options + "'" );
  199. }
  200. if ( typeof instance[ options ] !== "function" ||
  201. options.charAt( 0 ) === "_" ) {
  202. return $.error( "no such method '" + options + "' for " + name +
  203. " widget instance" );
  204. }
  205. methodValue = instance[ options ].apply( instance, args );
  206. if ( methodValue !== instance && methodValue !== undefined ) {
  207. returnValue = methodValue && methodValue.jquery ?
  208. returnValue.pushStack( methodValue.get() ) :
  209. methodValue;
  210. return false;
  211. }
  212. } );
  213. }
  214. } else {
  215. // Allow multiple hashes to be passed on init
  216. if ( args.length ) {
  217. options = $.widget.extend.apply( null, [ options ].concat( args ) );
  218. }
  219. this.each( function() {
  220. var instance = $.data( this, fullName );
  221. if ( instance ) {
  222. instance.option( options || {} );
  223. if ( instance._init ) {
  224. instance._init();
  225. }
  226. } else {
  227. $.data( this, fullName, new object( options, this ) );
  228. }
  229. } );
  230. }
  231. return returnValue;
  232. };
  233. };
  234. $.Widget = function( /* options, element */ ) {};
  235. $.Widget._childConstructors = [];
  236. $.Widget.prototype = {
  237. widgetName: "widget",
  238. widgetEventPrefix: "",
  239. defaultElement: "<div>",
  240. options: {
  241. classes: {},
  242. disabled: false,
  243. // Callbacks
  244. create: null
  245. },
  246. _createWidget: function( options, element ) {
  247. element = $( element || this.defaultElement || this )[ 0 ];
  248. this.element = $( element );
  249. this.uuid = widgetUuid++;
  250. this.eventNamespace = "." + this.widgetName + this.uuid;
  251. this.bindings = $();
  252. this.hoverable = $();
  253. this.focusable = $();
  254. this.classesElementLookup = {};
  255. if ( element !== this ) {
  256. $.data( element, this.widgetFullName, this );
  257. this._on( true, this.element, {
  258. remove: function( event ) {
  259. if ( event.target === element ) {
  260. this.destroy();
  261. }
  262. }
  263. } );
  264. this.document = $( element.style ?
  265. // Element within the document
  266. element.ownerDocument :
  267. // Element is window or document
  268. element.document || element );
  269. this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );
  270. }
  271. this.options = $.widget.extend( {},
  272. this.options,
  273. this._getCreateOptions(),
  274. options );
  275. this._create();
  276. if ( this.options.disabled ) {
  277. this._setOptionDisabled( this.options.disabled );
  278. }
  279. this._trigger( "create", null, this._getCreateEventData() );
  280. this._init();
  281. },
  282. _getCreateOptions: function() {
  283. return {};
  284. },
  285. _getCreateEventData: $.noop,
  286. _create: $.noop,
  287. _init: $.noop,
  288. destroy: function() {
  289. var that = this;
  290. this._destroy();
  291. $.each( this.classesElementLookup, function( key, value ) {
  292. that._removeClass( value, key );
  293. } );
  294. // We can probably remove the unbind calls in 2.0
  295. // all event bindings should go through this._on()
  296. this.element
  297. .off( this.eventNamespace )
  298. .removeData( this.widgetFullName );
  299. this.widget()
  300. .off( this.eventNamespace )
  301. .removeAttr( "aria-disabled" );
  302. // Clean up events and states
  303. this.bindings.off( this.eventNamespace );
  304. },
  305. _destroy: $.noop,
  306. widget: function() {
  307. return this.element;
  308. },
  309. option: function( key, value ) {
  310. var options = key;
  311. var parts;
  312. var curOption;
  313. var i;
  314. if ( arguments.length === 0 ) {
  315. // Don't return a reference to the internal hash
  316. return $.widget.extend( {}, this.options );
  317. }
  318. if ( typeof key === "string" ) {
  319. // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
  320. options = {};
  321. parts = key.split( "." );
  322. key = parts.shift();
  323. if ( parts.length ) {
  324. curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
  325. for ( i = 0; i < parts.length - 1; i++ ) {
  326. curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
  327. curOption = curOption[ parts[ i ] ];
  328. }
  329. key = parts.pop();
  330. if ( arguments.length === 1 ) {
  331. return curOption[ key ] === undefined ? null : curOption[ key ];
  332. }
  333. curOption[ key ] = value;
  334. } else {
  335. if ( arguments.length === 1 ) {
  336. return this.options[ key ] === undefined ? null : this.options[ key ];
  337. }
  338. options[ key ] = value;
  339. }
  340. }
  341. this._setOptions( options );
  342. return this;
  343. },
  344. _setOptions: function( options ) {
  345. var key;
  346. for ( key in options ) {
  347. this._setOption( key, options[ key ] );
  348. }
  349. return this;
  350. },
  351. _setOption: function( key, value ) {
  352. if ( key === "classes" ) {
  353. this._setOptionClasses( value );
  354. }
  355. this.options[ key ] = value;
  356. if ( key === "disabled" ) {
  357. this._setOptionDisabled( value );
  358. }
  359. return this;
  360. },
  361. _setOptionClasses: function( value ) {
  362. var classKey, elements, currentElements;
  363. for ( classKey in value ) {
  364. currentElements = this.classesElementLookup[ classKey ];
  365. if ( value[ classKey ] === this.options.classes[ classKey ] ||
  366. !currentElements ||
  367. !currentElements.length ) {
  368. continue;
  369. }
  370. // We are doing this to create a new jQuery object because the _removeClass() call
  371. // on the next line is going to destroy the reference to the current elements being
  372. // tracked. We need to save a copy of this collection so that we can add the new classes
  373. // below.
  374. elements = $( currentElements.get() );
  375. this._removeClass( currentElements, classKey );
  376. // We don't use _addClass() here, because that uses this.options.classes
  377. // for generating the string of classes. We want to use the value passed in from
  378. // _setOption(), this is the new value of the classes option which was passed to
  379. // _setOption(). We pass this value directly to _classes().
  380. elements.addClass( this._classes( {
  381. element: elements,
  382. keys: classKey,
  383. classes: value,
  384. add: true
  385. } ) );
  386. }
  387. },
  388. _setOptionDisabled: function( value ) {
  389. this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );
  390. // If the widget is becoming disabled, then nothing is interactive
  391. if ( value ) {
  392. this._removeClass( this.hoverable, null, "ui-state-hover" );
  393. this._removeClass( this.focusable, null, "ui-state-focus" );
  394. }
  395. },
  396. enable: function() {
  397. return this._setOptions( { disabled: false } );
  398. },
  399. disable: function() {
  400. return this._setOptions( { disabled: true } );
  401. },
  402. _classes: function( options ) {
  403. var full = [];
  404. var that = this;
  405. options = $.extend( {
  406. element: this.element,
  407. classes: this.options.classes || {}
  408. }, options );
  409. function bindRemoveEvent() {
  410. var nodesToBind = [];
  411. options.element.each( function( _, element ) {
  412. var isTracked = $.map( that.classesElementLookup, function( elements ) {
  413. return elements;
  414. } )
  415. .some( function( elements ) {
  416. return elements.is( element );
  417. } );
  418. if ( !isTracked ) {
  419. nodesToBind.push( element );
  420. }
  421. } );
  422. that._on( $( nodesToBind ), {
  423. remove: "_untrackClassesElement"
  424. } );
  425. }
  426. function processClassString( classes, checkOption ) {
  427. var current, i;
  428. for ( i = 0; i < classes.length; i++ ) {
  429. current = that.classesElementLookup[ classes[ i ] ] || $();
  430. if ( options.add ) {
  431. bindRemoveEvent();
  432. current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) );
  433. } else {
  434. current = $( current.not( options.element ).get() );
  435. }
  436. that.classesElementLookup[ classes[ i ] ] = current;
  437. full.push( classes[ i ] );
  438. if ( checkOption && options.classes[ classes[ i ] ] ) {
  439. full.push( options.classes[ classes[ i ] ] );
  440. }
  441. }
  442. }
  443. if ( options.keys ) {
  444. processClassString( options.keys.match( /\S+/g ) || [], true );
  445. }
  446. if ( options.extra ) {
  447. processClassString( options.extra.match( /\S+/g ) || [] );
  448. }
  449. return full.join( " " );
  450. },
  451. _untrackClassesElement: function( event ) {
  452. var that = this;
  453. $.each( that.classesElementLookup, function( key, value ) {
  454. if ( $.inArray( event.target, value ) !== -1 ) {
  455. that.classesElementLookup[ key ] = $( value.not( event.target ).get() );
  456. }
  457. } );
  458. this._off( $( event.target ) );
  459. },
  460. _removeClass: function( element, keys, extra ) {
  461. return this._toggleClass( element, keys, extra, false );
  462. },
  463. _addClass: function( element, keys, extra ) {
  464. return this._toggleClass( element, keys, extra, true );
  465. },
  466. _toggleClass: function( element, keys, extra, add ) {
  467. add = ( typeof add === "boolean" ) ? add : extra;
  468. var shift = ( typeof element === "string" || element === null ),
  469. options = {
  470. extra: shift ? keys : extra,
  471. keys: shift ? element : keys,
  472. element: shift ? this.element : element,
  473. add: add
  474. };
  475. options.element.toggleClass( this._classes( options ), add );
  476. return this;
  477. },
  478. _on: function( suppressDisabledCheck, element, handlers ) {
  479. var delegateElement;
  480. var instance = this;
  481. // No suppressDisabledCheck flag, shuffle arguments
  482. if ( typeof suppressDisabledCheck !== "boolean" ) {
  483. handlers = element;
  484. element = suppressDisabledCheck;
  485. suppressDisabledCheck = false;
  486. }
  487. // No element argument, shuffle and use this.element
  488. if ( !handlers ) {
  489. handlers = element;
  490. element = this.element;
  491. delegateElement = this.widget();
  492. } else {
  493. element = delegateElement = $( element );
  494. this.bindings = this.bindings.add( element );
  495. }
  496. $.each( handlers, function( event, handler ) {
  497. function handlerProxy() {
  498. // Allow widgets to customize the disabled handling
  499. // - disabled as an array instead of boolean
  500. // - disabled class as method for disabling individual parts
  501. if ( !suppressDisabledCheck &&
  502. ( instance.options.disabled === true ||
  503. $( this ).hasClass( "ui-state-disabled" ) ) ) {
  504. return;
  505. }
  506. return ( typeof handler === "string" ? instance[ handler ] : handler )
  507. .apply( instance, arguments );
  508. }
  509. // Copy the guid so direct unbinding works
  510. if ( typeof handler !== "string" ) {
  511. handlerProxy.guid = handler.guid =
  512. handler.guid || handlerProxy.guid || $.guid++;
  513. }
  514. var match = event.match( /^([\w:-]*)\s*(.*)$/ );
  515. var eventName = match[ 1 ] + instance.eventNamespace;
  516. var selector = match[ 2 ];
  517. if ( selector ) {
  518. delegateElement.on( eventName, selector, handlerProxy );
  519. } else {
  520. element.on( eventName, handlerProxy );
  521. }
  522. } );
  523. },
  524. _off: function( element, eventName ) {
  525. eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
  526. this.eventNamespace;
  527. element.off( eventName );
  528. // Clear the stack to avoid memory leaks (#10056)
  529. this.bindings = $( this.bindings.not( element ).get() );
  530. this.focusable = $( this.focusable.not( element ).get() );
  531. this.hoverable = $( this.hoverable.not( element ).get() );
  532. },
  533. _delay: function( handler, delay ) {
  534. function handlerProxy() {
  535. return ( typeof handler === "string" ? instance[ handler ] : handler )
  536. .apply( instance, arguments );
  537. }
  538. var instance = this;
  539. return setTimeout( handlerProxy, delay || 0 );
  540. },
  541. _hoverable: function( element ) {
  542. this.hoverable = this.hoverable.add( element );
  543. this._on( element, {
  544. mouseenter: function( event ) {
  545. this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
  546. },
  547. mouseleave: function( event ) {
  548. this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
  549. }
  550. } );
  551. },
  552. _focusable: function( element ) {
  553. this.focusable = this.focusable.add( element );
  554. this._on( element, {
  555. focusin: function( event ) {
  556. this._addClass( $( event.currentTarget ), null, "ui-state-focus" );
  557. },
  558. focusout: function( event ) {
  559. this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
  560. }
  561. } );
  562. },
  563. _trigger: function( type, event, data ) {
  564. var prop, orig;
  565. var callback = this.options[ type ];
  566. data = data || {};
  567. event = $.Event( event );
  568. event.type = ( type === this.widgetEventPrefix ?
  569. type :
  570. this.widgetEventPrefix + type ).toLowerCase();
  571. // The original event may come from any element
  572. // so we need to reset the target on the new event
  573. event.target = this.element[ 0 ];
  574. // Copy original event properties over to the new event
  575. orig = event.originalEvent;
  576. if ( orig ) {
  577. for ( prop in orig ) {
  578. if ( !( prop in event ) ) {
  579. event[ prop ] = orig[ prop ];
  580. }
  581. }
  582. }
  583. this.element.trigger( event, data );
  584. return !( typeof callback === "function" &&
  585. callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
  586. event.isDefaultPrevented() );
  587. }
  588. };
  589. $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
  590. $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
  591. if ( typeof options === "string" ) {
  592. options = { effect: options };
  593. }
  594. var hasOptions;
  595. var effectName = !options ?
  596. method :
  597. options === true || typeof options === "number" ?
  598. defaultEffect :
  599. options.effect || defaultEffect;
  600. options = options || {};
  601. if ( typeof options === "number" ) {
  602. options = { duration: options };
  603. } else if ( options === true ) {
  604. options = {};
  605. }
  606. hasOptions = !$.isEmptyObject( options );
  607. options.complete = callback;
  608. if ( options.delay ) {
  609. element.delay( options.delay );
  610. }
  611. if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
  612. element[ method ]( options );
  613. } else if ( effectName !== method && element[ effectName ] ) {
  614. element[ effectName ]( options.duration, options.easing, callback );
  615. } else {
  616. element.queue( function( next ) {
  617. $( this )[ method ]();
  618. if ( callback ) {
  619. callback.call( element[ 0 ] );
  620. }
  621. next();
  622. } );
  623. }
  624. };
  625. } );
  626. var widget = $.widget;
  627. /*!
  628. * jQuery UI Position 1.13.2
  629. * http://jqueryui.com
  630. *
  631. * Copyright jQuery Foundation and other contributors
  632. * Released under the MIT license.
  633. * http://jquery.org/license
  634. *
  635. * http://api.jqueryui.com/position/
  636. */
  637. //>>label: Position
  638. //>>group: Core
  639. //>>description: Positions elements relative to other elements.
  640. //>>docs: http://api.jqueryui.com/position/
  641. //>>demos: http://jqueryui.com/position/
  642. ( function() {
  643. var cachedScrollbarWidth,
  644. max = Math.max,
  645. abs = Math.abs,
  646. rhorizontal = /left|center|right/,
  647. rvertical = /top|center|bottom/,
  648. roffset = /[\+\-]\d+(\.[\d]+)?%?/,
  649. rposition = /^\w+/,
  650. rpercent = /%$/,
  651. _position = $.fn.position;
  652. function getOffsets( offsets, width, height ) {
  653. return [
  654. parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
  655. parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
  656. ];
  657. }
  658. function parseCss( element, property ) {
  659. return parseInt( $.css( element, property ), 10 ) || 0;
  660. }
  661. function isWindow( obj ) {
  662. return obj != null && obj === obj.window;
  663. }
  664. function getDimensions( elem ) {
  665. var raw = elem[ 0 ];
  666. if ( raw.nodeType === 9 ) {
  667. return {
  668. width: elem.width(),
  669. height: elem.height(),
  670. offset: { top: 0, left: 0 }
  671. };
  672. }
  673. if ( isWindow( raw ) ) {
  674. return {
  675. width: elem.width(),
  676. height: elem.height(),
  677. offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
  678. };
  679. }
  680. if ( raw.preventDefault ) {
  681. return {
  682. width: 0,
  683. height: 0,
  684. offset: { top: raw.pageY, left: raw.pageX }
  685. };
  686. }
  687. return {
  688. width: elem.outerWidth(),
  689. height: elem.outerHeight(),
  690. offset: elem.offset()
  691. };
  692. }
  693. $.position = {
  694. scrollbarWidth: function() {
  695. if ( cachedScrollbarWidth !== undefined ) {
  696. return cachedScrollbarWidth;
  697. }
  698. var w1, w2,
  699. div = $( "<div style=" +
  700. "'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" +
  701. "<div style='height:300px;width:auto;'></div></div>" ),
  702. innerDiv = div.children()[ 0 ];
  703. $( "body" ).append( div );
  704. w1 = innerDiv.offsetWidth;
  705. div.css( "overflow", "scroll" );
  706. w2 = innerDiv.offsetWidth;
  707. if ( w1 === w2 ) {
  708. w2 = div[ 0 ].clientWidth;
  709. }
  710. div.remove();
  711. return ( cachedScrollbarWidth = w1 - w2 );
  712. },
  713. getScrollInfo: function( within ) {
  714. var overflowX = within.isWindow || within.isDocument ? "" :
  715. within.element.css( "overflow-x" ),
  716. overflowY = within.isWindow || within.isDocument ? "" :
  717. within.element.css( "overflow-y" ),
  718. hasOverflowX = overflowX === "scroll" ||
  719. ( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ),
  720. hasOverflowY = overflowY === "scroll" ||
  721. ( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight );
  722. return {
  723. width: hasOverflowY ? $.position.scrollbarWidth() : 0,
  724. height: hasOverflowX ? $.position.scrollbarWidth() : 0
  725. };
  726. },
  727. getWithinInfo: function( element ) {
  728. var withinElement = $( element || window ),
  729. isElemWindow = isWindow( withinElement[ 0 ] ),
  730. isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9,
  731. hasOffset = !isElemWindow && !isDocument;
  732. return {
  733. element: withinElement,
  734. isWindow: isElemWindow,
  735. isDocument: isDocument,
  736. offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 },
  737. scrollLeft: withinElement.scrollLeft(),
  738. scrollTop: withinElement.scrollTop(),
  739. width: withinElement.outerWidth(),
  740. height: withinElement.outerHeight()
  741. };
  742. }
  743. };
  744. $.fn.position = function( options ) {
  745. if ( !options || !options.of ) {
  746. return _position.apply( this, arguments );
  747. }
  748. // Make a copy, we don't want to modify arguments
  749. options = $.extend( {}, options );
  750. var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
  751. // Make sure string options are treated as CSS selectors
  752. target = typeof options.of === "string" ?
  753. $( document ).find( options.of ) :
  754. $( options.of ),
  755. within = $.position.getWithinInfo( options.within ),
  756. scrollInfo = $.position.getScrollInfo( within ),
  757. collision = ( options.collision || "flip" ).split( " " ),
  758. offsets = {};
  759. dimensions = getDimensions( target );
  760. if ( target[ 0 ].preventDefault ) {
  761. // Force left top to allow flipping
  762. options.at = "left top";
  763. }
  764. targetWidth = dimensions.width;
  765. targetHeight = dimensions.height;
  766. targetOffset = dimensions.offset;
  767. // Clone to reuse original targetOffset later
  768. basePosition = $.extend( {}, targetOffset );
  769. // Force my and at to have valid horizontal and vertical positions
  770. // if a value is missing or invalid, it will be converted to center
  771. $.each( [ "my", "at" ], function() {
  772. var pos = ( options[ this ] || "" ).split( " " ),
  773. horizontalOffset,
  774. verticalOffset;
  775. if ( pos.length === 1 ) {
  776. pos = rhorizontal.test( pos[ 0 ] ) ?
  777. pos.concat( [ "center" ] ) :
  778. rvertical.test( pos[ 0 ] ) ?
  779. [ "center" ].concat( pos ) :
  780. [ "center", "center" ];
  781. }
  782. pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
  783. pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
  784. // Calculate offsets
  785. horizontalOffset = roffset.exec( pos[ 0 ] );
  786. verticalOffset = roffset.exec( pos[ 1 ] );
  787. offsets[ this ] = [
  788. horizontalOffset ? horizontalOffset[ 0 ] : 0,
  789. verticalOffset ? verticalOffset[ 0 ] : 0
  790. ];
  791. // Reduce to just the positions without the offsets
  792. options[ this ] = [
  793. rposition.exec( pos[ 0 ] )[ 0 ],
  794. rposition.exec( pos[ 1 ] )[ 0 ]
  795. ];
  796. } );
  797. // Normalize collision option
  798. if ( collision.length === 1 ) {
  799. collision[ 1 ] = collision[ 0 ];
  800. }
  801. if ( options.at[ 0 ] === "right" ) {
  802. basePosition.left += targetWidth;
  803. } else if ( options.at[ 0 ] === "center" ) {
  804. basePosition.left += targetWidth / 2;
  805. }
  806. if ( options.at[ 1 ] === "bottom" ) {
  807. basePosition.top += targetHeight;
  808. } else if ( options.at[ 1 ] === "center" ) {
  809. basePosition.top += targetHeight / 2;
  810. }
  811. atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
  812. basePosition.left += atOffset[ 0 ];
  813. basePosition.top += atOffset[ 1 ];
  814. return this.each( function() {
  815. var collisionPosition, using,
  816. elem = $( this ),
  817. elemWidth = elem.outerWidth(),
  818. elemHeight = elem.outerHeight(),
  819. marginLeft = parseCss( this, "marginLeft" ),
  820. marginTop = parseCss( this, "marginTop" ),
  821. collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) +
  822. scrollInfo.width,
  823. collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) +
  824. scrollInfo.height,
  825. position = $.extend( {}, basePosition ),
  826. myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
  827. if ( options.my[ 0 ] === "right" ) {
  828. position.left -= elemWidth;
  829. } else if ( options.my[ 0 ] === "center" ) {
  830. position.left -= elemWidth / 2;
  831. }
  832. if ( options.my[ 1 ] === "bottom" ) {
  833. position.top -= elemHeight;
  834. } else if ( options.my[ 1 ] === "center" ) {
  835. position.top -= elemHeight / 2;
  836. }
  837. position.left += myOffset[ 0 ];
  838. position.top += myOffset[ 1 ];
  839. collisionPosition = {
  840. marginLeft: marginLeft,
  841. marginTop: marginTop
  842. };
  843. $.each( [ "left", "top" ], function( i, dir ) {
  844. if ( $.ui.position[ collision[ i ] ] ) {
  845. $.ui.position[ collision[ i ] ][ dir ]( position, {
  846. targetWidth: targetWidth,
  847. targetHeight: targetHeight,
  848. elemWidth: elemWidth,
  849. elemHeight: elemHeight,
  850. collisionPosition: collisionPosition,
  851. collisionWidth: collisionWidth,
  852. collisionHeight: collisionHeight,
  853. offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
  854. my: options.my,
  855. at: options.at,
  856. within: within,
  857. elem: elem
  858. } );
  859. }
  860. } );
  861. if ( options.using ) {
  862. // Adds feedback as second argument to using callback, if present
  863. using = function( props ) {
  864. var left = targetOffset.left - position.left,
  865. right = left + targetWidth - elemWidth,
  866. top = targetOffset.top - position.top,
  867. bottom = top + targetHeight - elemHeight,
  868. feedback = {
  869. target: {
  870. element: target,
  871. left: targetOffset.left,
  872. top: targetOffset.top,
  873. width: targetWidth,
  874. height: targetHeight
  875. },
  876. element: {
  877. element: elem,
  878. left: position.left,
  879. top: position.top,
  880. width: elemWidth,
  881. height: elemHeight
  882. },
  883. horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
  884. vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
  885. };
  886. if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
  887. feedback.horizontal = "center";
  888. }
  889. if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
  890. feedback.vertical = "middle";
  891. }
  892. if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
  893. feedback.important = "horizontal";
  894. } else {
  895. feedback.important = "vertical";
  896. }
  897. options.using.call( this, props, feedback );
  898. };
  899. }
  900. elem.offset( $.extend( position, { using: using } ) );
  901. } );
  902. };
  903. $.ui.position = {
  904. fit: {
  905. left: function( position, data ) {
  906. var within = data.within,
  907. withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
  908. outerWidth = within.width,
  909. collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  910. overLeft = withinOffset - collisionPosLeft,
  911. overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
  912. newOverRight;
  913. // Element is wider than within
  914. if ( data.collisionWidth > outerWidth ) {
  915. // Element is initially over the left side of within
  916. if ( overLeft > 0 && overRight <= 0 ) {
  917. newOverRight = position.left + overLeft + data.collisionWidth - outerWidth -
  918. withinOffset;
  919. position.left += overLeft - newOverRight;
  920. // Element is initially over right side of within
  921. } else if ( overRight > 0 && overLeft <= 0 ) {
  922. position.left = withinOffset;
  923. // Element is initially over both left and right sides of within
  924. } else {
  925. if ( overLeft > overRight ) {
  926. position.left = withinOffset + outerWidth - data.collisionWidth;
  927. } else {
  928. position.left = withinOffset;
  929. }
  930. }
  931. // Too far left -> align with left edge
  932. } else if ( overLeft > 0 ) {
  933. position.left += overLeft;
  934. // Too far right -> align with right edge
  935. } else if ( overRight > 0 ) {
  936. position.left -= overRight;
  937. // Adjust based on position and margin
  938. } else {
  939. position.left = max( position.left - collisionPosLeft, position.left );
  940. }
  941. },
  942. top: function( position, data ) {
  943. var within = data.within,
  944. withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
  945. outerHeight = data.within.height,
  946. collisionPosTop = position.top - data.collisionPosition.marginTop,
  947. overTop = withinOffset - collisionPosTop,
  948. overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
  949. newOverBottom;
  950. // Element is taller than within
  951. if ( data.collisionHeight > outerHeight ) {
  952. // Element is initially over the top of within
  953. if ( overTop > 0 && overBottom <= 0 ) {
  954. newOverBottom = position.top + overTop + data.collisionHeight - outerHeight -
  955. withinOffset;
  956. position.top += overTop - newOverBottom;
  957. // Element is initially over bottom of within
  958. } else if ( overBottom > 0 && overTop <= 0 ) {
  959. position.top = withinOffset;
  960. // Element is initially over both top and bottom of within
  961. } else {
  962. if ( overTop > overBottom ) {
  963. position.top = withinOffset + outerHeight - data.collisionHeight;
  964. } else {
  965. position.top = withinOffset;
  966. }
  967. }
  968. // Too far up -> align with top
  969. } else if ( overTop > 0 ) {
  970. position.top += overTop;
  971. // Too far down -> align with bottom edge
  972. } else if ( overBottom > 0 ) {
  973. position.top -= overBottom;
  974. // Adjust based on position and margin
  975. } else {
  976. position.top = max( position.top - collisionPosTop, position.top );
  977. }
  978. }
  979. },
  980. flip: {
  981. left: function( position, data ) {
  982. var within = data.within,
  983. withinOffset = within.offset.left + within.scrollLeft,
  984. outerWidth = within.width,
  985. offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
  986. collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  987. overLeft = collisionPosLeft - offsetLeft,
  988. overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
  989. myOffset = data.my[ 0 ] === "left" ?
  990. -data.elemWidth :
  991. data.my[ 0 ] === "right" ?
  992. data.elemWidth :
  993. 0,
  994. atOffset = data.at[ 0 ] === "left" ?
  995. data.targetWidth :
  996. data.at[ 0 ] === "right" ?
  997. -data.targetWidth :
  998. 0,
  999. offset = -2 * data.offset[ 0 ],
  1000. newOverRight,
  1001. newOverLeft;
  1002. if ( overLeft < 0 ) {
  1003. newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth -
  1004. outerWidth - withinOffset;
  1005. if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
  1006. position.left += myOffset + atOffset + offset;
  1007. }
  1008. } else if ( overRight > 0 ) {
  1009. newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset +
  1010. atOffset + offset - offsetLeft;
  1011. if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
  1012. position.left += myOffset + atOffset + offset;
  1013. }
  1014. }
  1015. },
  1016. top: function( position, data ) {
  1017. var within = data.within,
  1018. withinOffset = within.offset.top + within.scrollTop,
  1019. outerHeight = within.height,
  1020. offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
  1021. collisionPosTop = position.top - data.collisionPosition.marginTop,
  1022. overTop = collisionPosTop - offsetTop,
  1023. overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
  1024. top = data.my[ 1 ] === "top",
  1025. myOffset = top ?
  1026. -data.elemHeight :
  1027. data.my[ 1 ] === "bottom" ?
  1028. data.elemHeight :
  1029. 0,
  1030. atOffset = data.at[ 1 ] === "top" ?
  1031. data.targetHeight :
  1032. data.at[ 1 ] === "bottom" ?
  1033. -data.targetHeight :
  1034. 0,
  1035. offset = -2 * data.offset[ 1 ],
  1036. newOverTop,
  1037. newOverBottom;
  1038. if ( overTop < 0 ) {
  1039. newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight -
  1040. outerHeight - withinOffset;
  1041. if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
  1042. position.top += myOffset + atOffset + offset;
  1043. }
  1044. } else if ( overBottom > 0 ) {
  1045. newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset +
  1046. offset - offsetTop;
  1047. if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
  1048. position.top += myOffset + atOffset + offset;
  1049. }
  1050. }
  1051. }
  1052. },
  1053. flipfit: {
  1054. left: function() {
  1055. $.ui.position.flip.left.apply( this, arguments );
  1056. $.ui.position.fit.left.apply( this, arguments );
  1057. },
  1058. top: function() {
  1059. $.ui.position.flip.top.apply( this, arguments );
  1060. $.ui.position.fit.top.apply( this, arguments );
  1061. }
  1062. }
  1063. };
  1064. } )();
  1065. var position = $.ui.position;
  1066. /*!
  1067. * jQuery UI :data 1.13.2
  1068. * http://jqueryui.com
  1069. *
  1070. * Copyright jQuery Foundation and other contributors
  1071. * Released under the MIT license.
  1072. * http://jquery.org/license
  1073. */
  1074. //>>label: :data Selector
  1075. //>>group: Core
  1076. //>>description: Selects elements which have data stored under the specified key.
  1077. //>>docs: http://api.jqueryui.com/data-selector/
  1078. var data = $.extend( $.expr.pseudos, {
  1079. data: $.expr.createPseudo ?
  1080. $.expr.createPseudo( function( dataName ) {
  1081. return function( elem ) {
  1082. return !!$.data( elem, dataName );
  1083. };
  1084. } ) :
  1085. // Support: jQuery <1.8
  1086. function( elem, i, match ) {
  1087. return !!$.data( elem, match[ 3 ] );
  1088. }
  1089. } );
  1090. /*!
  1091. * jQuery UI Disable Selection 1.13.2
  1092. * http://jqueryui.com
  1093. *
  1094. * Copyright jQuery Foundation and other contributors
  1095. * Released under the MIT license.
  1096. * http://jquery.org/license
  1097. */
  1098. //>>label: disableSelection
  1099. //>>group: Core
  1100. //>>description: Disable selection of text content within the set of matched elements.
  1101. //>>docs: http://api.jqueryui.com/disableSelection/
  1102. // This file is deprecated
  1103. var disableSelection = $.fn.extend( {
  1104. disableSelection: ( function() {
  1105. var eventType = "onselectstart" in document.createElement( "div" ) ?
  1106. "selectstart" :
  1107. "mousedown";
  1108. return function() {
  1109. return this.on( eventType + ".ui-disableSelection", function( event ) {
  1110. event.preventDefault();
  1111. } );
  1112. };
  1113. } )(),
  1114. enableSelection: function() {
  1115. return this.off( ".ui-disableSelection" );
  1116. }
  1117. } );
  1118. /*!
  1119. * jQuery UI Focusable 1.13.2
  1120. * http://jqueryui.com
  1121. *
  1122. * Copyright jQuery Foundation and other contributors
  1123. * Released under the MIT license.
  1124. * http://jquery.org/license
  1125. */
  1126. //>>label: :focusable Selector
  1127. //>>group: Core
  1128. //>>description: Selects elements which can be focused.
  1129. //>>docs: http://api.jqueryui.com/focusable-selector/
  1130. // Selectors
  1131. $.ui.focusable = function( element, hasTabindex ) {
  1132. var map, mapName, img, focusableIfVisible, fieldset,
  1133. nodeName = element.nodeName.toLowerCase();
  1134. if ( "area" === nodeName ) {
  1135. map = element.parentNode;
  1136. mapName = map.name;
  1137. if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
  1138. return false;
  1139. }
  1140. img = $( "img[usemap='#" + mapName + "']" );
  1141. return img.length > 0 && img.is( ":visible" );
  1142. }
  1143. if ( /^(input|select|textarea|button|object)$/.test( nodeName ) ) {
  1144. focusableIfVisible = !element.disabled;
  1145. if ( focusableIfVisible ) {
  1146. // Form controls within a disabled fieldset are disabled.
  1147. // However, controls within the fieldset's legend do not get disabled.
  1148. // Since controls generally aren't placed inside legends, we skip
  1149. // this portion of the check.
  1150. fieldset = $( element ).closest( "fieldset" )[ 0 ];
  1151. if ( fieldset ) {
  1152. focusableIfVisible = !fieldset.disabled;
  1153. }
  1154. }
  1155. } else if ( "a" === nodeName ) {
  1156. focusableIfVisible = element.href || hasTabindex;
  1157. } else {
  1158. focusableIfVisible = hasTabindex;
  1159. }
  1160. return focusableIfVisible && $( element ).is( ":visible" ) && visible( $( element ) );
  1161. };
  1162. // Support: IE 8 only
  1163. // IE 8 doesn't resolve inherit to visible/hidden for computed values
  1164. function visible( element ) {
  1165. var visibility = element.css( "visibility" );
  1166. while ( visibility === "inherit" ) {
  1167. element = element.parent();
  1168. visibility = element.css( "visibility" );
  1169. }
  1170. return visibility === "visible";
  1171. }
  1172. $.extend( $.expr.pseudos, {
  1173. focusable: function( element ) {
  1174. return $.ui.focusable( element, $.attr( element, "tabindex" ) != null );
  1175. }
  1176. } );
  1177. var focusable = $.ui.focusable;
  1178. // Support: IE8 Only
  1179. // IE8 does not support the form attribute and when it is supplied. It overwrites the form prop
  1180. // with a string, so we need to find the proper form.
  1181. var form = $.fn._form = function() {
  1182. return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form );
  1183. };
  1184. /*!
  1185. * jQuery UI Form Reset Mixin 1.13.2
  1186. * http://jqueryui.com
  1187. *
  1188. * Copyright jQuery Foundation and other contributors
  1189. * Released under the MIT license.
  1190. * http://jquery.org/license
  1191. */
  1192. //>>label: Form Reset Mixin
  1193. //>>group: Core
  1194. //>>description: Refresh input widgets when their form is reset
  1195. //>>docs: http://api.jqueryui.com/form-reset-mixin/
  1196. var formResetMixin = $.ui.formResetMixin = {
  1197. _formResetHandler: function() {
  1198. var form = $( this );
  1199. // Wait for the form reset to actually happen before refreshing
  1200. setTimeout( function() {
  1201. var instances = form.data( "ui-form-reset-instances" );
  1202. $.each( instances, function() {
  1203. this.refresh();
  1204. } );
  1205. } );
  1206. },
  1207. _bindFormResetHandler: function() {
  1208. this.form = this.element._form();
  1209. if ( !this.form.length ) {
  1210. return;
  1211. }
  1212. var instances = this.form.data( "ui-form-reset-instances" ) || [];
  1213. if ( !instances.length ) {
  1214. // We don't use _on() here because we use a single event handler per form
  1215. this.form.on( "reset.ui-form-reset", this._formResetHandler );
  1216. }
  1217. instances.push( this );
  1218. this.form.data( "ui-form-reset-instances", instances );
  1219. },
  1220. _unbindFormResetHandler: function() {
  1221. if ( !this.form.length ) {
  1222. return;
  1223. }
  1224. var instances = this.form.data( "ui-form-reset-instances" );
  1225. instances.splice( $.inArray( this, instances ), 1 );
  1226. if ( instances.length ) {
  1227. this.form.data( "ui-form-reset-instances", instances );
  1228. } else {
  1229. this.form
  1230. .removeData( "ui-form-reset-instances" )
  1231. .off( "reset.ui-form-reset" );
  1232. }
  1233. }
  1234. };
  1235. /*!
  1236. * jQuery UI Support for jQuery core 1.8.x and newer 1.13.2
  1237. * http://jqueryui.com
  1238. *
  1239. * Copyright jQuery Foundation and other contributors
  1240. * Released under the MIT license.
  1241. * http://jquery.org/license
  1242. *
  1243. */
  1244. //>>label: jQuery 1.8+ Support
  1245. //>>group: Core
  1246. //>>description: Support version 1.8.x and newer of jQuery core
  1247. // Support: jQuery 1.9.x or older
  1248. // $.expr[ ":" ] is deprecated.
  1249. if ( !$.expr.pseudos ) {
  1250. $.expr.pseudos = $.expr[ ":" ];
  1251. }
  1252. // Support: jQuery 1.11.x or older
  1253. // $.unique has been renamed to $.uniqueSort
  1254. if ( !$.uniqueSort ) {
  1255. $.uniqueSort = $.unique;
  1256. }
  1257. // Support: jQuery 2.2.x or older.
  1258. // This method has been defined in jQuery 3.0.0.
  1259. // Code from https://github.com/jquery/jquery/blob/e539bac79e666bba95bba86d690b4e609dca2286/src/selector/escapeSelector.js
  1260. if ( !$.escapeSelector ) {
  1261. // CSS string/identifier serialization
  1262. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  1263. var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
  1264. var fcssescape = function( ch, asCodePoint ) {
  1265. if ( asCodePoint ) {
  1266. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  1267. if ( ch === "\0" ) {
  1268. return "\uFFFD";
  1269. }
  1270. // Control characters and (dependent upon position) numbers get escaped as code points
  1271. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  1272. }
  1273. // Other potentially-special ASCII characters get backslash-escaped
  1274. return "\\" + ch;
  1275. };
  1276. $.escapeSelector = function( sel ) {
  1277. return ( sel + "" ).replace( rcssescape, fcssescape );
  1278. };
  1279. }
  1280. // Support: jQuery 3.4.x or older
  1281. // These methods have been defined in jQuery 3.5.0.
  1282. if ( !$.fn.even || !$.fn.odd ) {
  1283. $.fn.extend( {
  1284. even: function() {
  1285. return this.filter( function( i ) {
  1286. return i % 2 === 0;
  1287. } );
  1288. },
  1289. odd: function() {
  1290. return this.filter( function( i ) {
  1291. return i % 2 === 1;
  1292. } );
  1293. }
  1294. } );
  1295. }
  1296. ;
  1297. /*!
  1298. * jQuery UI Keycode 1.13.2
  1299. * http://jqueryui.com
  1300. *
  1301. * Copyright jQuery Foundation and other contributors
  1302. * Released under the MIT license.
  1303. * http://jquery.org/license
  1304. */
  1305. //>>label: Keycode
  1306. //>>group: Core
  1307. //>>description: Provide keycodes as keynames
  1308. //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
  1309. var keycode = $.ui.keyCode = {
  1310. BACKSPACE: 8,
  1311. COMMA: 188,
  1312. DELETE: 46,
  1313. DOWN: 40,
  1314. END: 35,
  1315. ENTER: 13,
  1316. ESCAPE: 27,
  1317. HOME: 36,
  1318. LEFT: 37,
  1319. PAGE_DOWN: 34,
  1320. PAGE_UP: 33,
  1321. PERIOD: 190,
  1322. RIGHT: 39,
  1323. SPACE: 32,
  1324. TAB: 9,
  1325. UP: 38
  1326. };
  1327. /*!
  1328. * jQuery UI Labels 1.13.2
  1329. * http://jqueryui.com
  1330. *
  1331. * Copyright jQuery Foundation and other contributors
  1332. * Released under the MIT license.
  1333. * http://jquery.org/license
  1334. */
  1335. //>>label: labels
  1336. //>>group: Core
  1337. //>>description: Find all the labels associated with a given input
  1338. //>>docs: http://api.jqueryui.com/labels/
  1339. var labels = $.fn.labels = function() {
  1340. var ancestor, selector, id, labels, ancestors;
  1341. if ( !this.length ) {
  1342. return this.pushStack( [] );
  1343. }
  1344. // Check control.labels first
  1345. if ( this[ 0 ].labels && this[ 0 ].labels.length ) {
  1346. return this.pushStack( this[ 0 ].labels );
  1347. }
  1348. // Support: IE <= 11, FF <= 37, Android <= 2.3 only
  1349. // Above browsers do not support control.labels. Everything below is to support them
  1350. // as well as document fragments. control.labels does not work on document fragments
  1351. labels = this.eq( 0 ).parents( "label" );
  1352. // Look for the label based on the id
  1353. id = this.attr( "id" );
  1354. if ( id ) {
  1355. // We don't search against the document in case the element
  1356. // is disconnected from the DOM
  1357. ancestor = this.eq( 0 ).parents().last();
  1358. // Get a full set of top level ancestors
  1359. ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() );
  1360. // Create a selector for the label based on the id
  1361. selector = "label[for='" + $.escapeSelector( id ) + "']";
  1362. labels = labels.add( ancestors.find( selector ).addBack( selector ) );
  1363. }
  1364. // Return whatever we have found for labels
  1365. return this.pushStack( labels );
  1366. };
  1367. /*!
  1368. * jQuery UI Scroll Parent 1.13.2
  1369. * http://jqueryui.com
  1370. *
  1371. * Copyright jQuery Foundation and other contributors
  1372. * Released under the MIT license.
  1373. * http://jquery.org/license
  1374. */
  1375. //>>label: scrollParent
  1376. //>>group: Core
  1377. //>>description: Get the closest ancestor element that is scrollable.
  1378. //>>docs: http://api.jqueryui.com/scrollParent/
  1379. var scrollParent = $.fn.scrollParent = function( includeHidden ) {
  1380. var position = this.css( "position" ),
  1381. excludeStaticParent = position === "absolute",
  1382. overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
  1383. scrollParent = this.parents().filter( function() {
  1384. var parent = $( this );
  1385. if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
  1386. return false;
  1387. }
  1388. return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) +
  1389. parent.css( "overflow-x" ) );
  1390. } ).eq( 0 );
  1391. return position === "fixed" || !scrollParent.length ?
  1392. $( this[ 0 ].ownerDocument || document ) :
  1393. scrollParent;
  1394. };
  1395. /*!
  1396. * jQuery UI Tabbable 1.13.2
  1397. * http://jqueryui.com
  1398. *
  1399. * Copyright jQuery Foundation and other contributors
  1400. * Released under the MIT license.
  1401. * http://jquery.org/license
  1402. */
  1403. //>>label: :tabbable Selector
  1404. //>>group: Core
  1405. //>>description: Selects elements which can be tabbed to.
  1406. //>>docs: http://api.jqueryui.com/tabbable-selector/
  1407. var tabbable = $.extend( $.expr.pseudos, {
  1408. tabbable: function( element ) {
  1409. var tabIndex = $.attr( element, "tabindex" ),
  1410. hasTabindex = tabIndex != null;
  1411. return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex );
  1412. }
  1413. } );
  1414. /*!
  1415. * jQuery UI Unique ID 1.13.2
  1416. * http://jqueryui.com
  1417. *
  1418. * Copyright jQuery Foundation and other contributors
  1419. * Released under the MIT license.
  1420. * http://jquery.org/license
  1421. */
  1422. //>>label: uniqueId
  1423. //>>group: Core
  1424. //>>description: Functions to generate and remove uniqueId's
  1425. //>>docs: http://api.jqueryui.com/uniqueId/
  1426. var uniqueId = $.fn.extend( {
  1427. uniqueId: ( function() {
  1428. var uuid = 0;
  1429. return function() {
  1430. return this.each( function() {
  1431. if ( !this.id ) {
  1432. this.id = "ui-id-" + ( ++uuid );
  1433. }
  1434. } );
  1435. };
  1436. } )(),
  1437. removeUniqueId: function() {
  1438. return this.each( function() {
  1439. if ( /^ui-id-\d+$/.test( this.id ) ) {
  1440. $( this ).removeAttr( "id" );
  1441. }
  1442. } );
  1443. }
  1444. } );
  1445. // This file is deprecated
  1446. var ie = $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
  1447. /*!
  1448. * jQuery UI Mouse 1.13.2
  1449. * http://jqueryui.com
  1450. *
  1451. * Copyright jQuery Foundation and other contributors
  1452. * Released under the MIT license.
  1453. * http://jquery.org/license
  1454. */
  1455. //>>label: Mouse
  1456. //>>group: Widgets
  1457. //>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
  1458. //>>docs: http://api.jqueryui.com/mouse/
  1459. var mouseHandled = false;
  1460. $( document ).on( "mouseup", function() {
  1461. mouseHandled = false;
  1462. } );
  1463. var widgetsMouse = $.widget( "ui.mouse", {
  1464. version: "1.13.2",
  1465. options: {
  1466. cancel: "input, textarea, button, select, option",
  1467. distance: 1,
  1468. delay: 0
  1469. },
  1470. _mouseInit: function() {
  1471. var that = this;
  1472. this.element
  1473. .on( "mousedown." + this.widgetName, function( event ) {
  1474. return that._mouseDown( event );
  1475. } )
  1476. .on( "click." + this.widgetName, function( event ) {
  1477. if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) {
  1478. $.removeData( event.target, that.widgetName + ".preventClickEvent" );
  1479. event.stopImmediatePropagation();
  1480. return false;
  1481. }
  1482. } );
  1483. this.started = false;
  1484. },
  1485. // TODO: make sure destroying one instance of mouse doesn't mess with
  1486. // other instances of mouse
  1487. _mouseDestroy: function() {
  1488. this.element.off( "." + this.widgetName );
  1489. if ( this._mouseMoveDelegate ) {
  1490. this.document
  1491. .off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  1492. .off( "mouseup." + this.widgetName, this._mouseUpDelegate );
  1493. }
  1494. },
  1495. _mouseDown: function( event ) {
  1496. // don't let more than one widget handle mouseStart
  1497. if ( mouseHandled ) {
  1498. return;
  1499. }
  1500. this._mouseMoved = false;
  1501. // We may have missed mouseup (out of window)
  1502. if ( this._mouseStarted ) {
  1503. this._mouseUp( event );
  1504. }
  1505. this._mouseDownEvent = event;
  1506. var that = this,
  1507. btnIsLeft = ( event.which === 1 ),
  1508. // event.target.nodeName works around a bug in IE 8 with
  1509. // disabled inputs (#7620)
  1510. elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ?
  1511. $( event.target ).closest( this.options.cancel ).length : false );
  1512. if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) {
  1513. return true;
  1514. }
  1515. this.mouseDelayMet = !this.options.delay;
  1516. if ( !this.mouseDelayMet ) {
  1517. this._mouseDelayTimer = setTimeout( function() {
  1518. that.mouseDelayMet = true;
  1519. }, this.options.delay );
  1520. }
  1521. if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
  1522. this._mouseStarted = ( this._mouseStart( event ) !== false );
  1523. if ( !this._mouseStarted ) {
  1524. event.preventDefault();
  1525. return true;
  1526. }
  1527. }
  1528. // Click event may never have fired (Gecko & Opera)
  1529. if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) {
  1530. $.removeData( event.target, this.widgetName + ".preventClickEvent" );
  1531. }
  1532. // These delegates are required to keep context
  1533. this._mouseMoveDelegate = function( event ) {
  1534. return that._mouseMove( event );
  1535. };
  1536. this._mouseUpDelegate = function( event ) {
  1537. return that._mouseUp( event );
  1538. };
  1539. this.document
  1540. .on( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  1541. .on( "mouseup." + this.widgetName, this._mouseUpDelegate );
  1542. event.preventDefault();
  1543. mouseHandled = true;
  1544. return true;
  1545. },
  1546. _mouseMove: function( event ) {
  1547. // Only check for mouseups outside the document if you've moved inside the document
  1548. // at least once. This prevents the firing of mouseup in the case of IE<9, which will
  1549. // fire a mousemove event if content is placed under the cursor. See #7778
  1550. // Support: IE <9
  1551. if ( this._mouseMoved ) {
  1552. // IE mouseup check - mouseup happened when mouse was out of window
  1553. if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) &&
  1554. !event.button ) {
  1555. return this._mouseUp( event );
  1556. // Iframe mouseup check - mouseup occurred in another document
  1557. } else if ( !event.which ) {
  1558. // Support: Safari <=8 - 9
  1559. // Safari sets which to 0 if you press any of the following keys
  1560. // during a drag (#14461)
  1561. if ( event.originalEvent.altKey || event.originalEvent.ctrlKey ||
  1562. event.originalEvent.metaKey || event.originalEvent.shiftKey ) {
  1563. this.ignoreMissingWhich = true;
  1564. } else if ( !this.ignoreMissingWhich ) {
  1565. return this._mouseUp( event );
  1566. }
  1567. }
  1568. }
  1569. if ( event.which || event.button ) {
  1570. this._mouseMoved = true;
  1571. }
  1572. if ( this._mouseStarted ) {
  1573. this._mouseDrag( event );
  1574. return event.preventDefault();
  1575. }
  1576. if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
  1577. this._mouseStarted =
  1578. ( this._mouseStart( this._mouseDownEvent, event ) !== false );
  1579. if ( this._mouseStarted ) {
  1580. this._mouseDrag( event );
  1581. } else {
  1582. this._mouseUp( event );
  1583. }
  1584. }
  1585. return !this._mouseStarted;
  1586. },
  1587. _mouseUp: function( event ) {
  1588. this.document
  1589. .off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  1590. .off( "mouseup." + this.widgetName, this._mouseUpDelegate );
  1591. if ( this._mouseStarted ) {
  1592. this._mouseStarted = false;
  1593. if ( event.target === this._mouseDownEvent.target ) {
  1594. $.data( event.target, this.widgetName + ".preventClickEvent", true );
  1595. }
  1596. this._mouseStop( event );
  1597. }
  1598. if ( this._mouseDelayTimer ) {
  1599. clearTimeout( this._mouseDelayTimer );
  1600. delete this._mouseDelayTimer;
  1601. }
  1602. this.ignoreMissingWhich = false;
  1603. mouseHandled = false;
  1604. event.preventDefault();
  1605. },
  1606. _mouseDistanceMet: function( event ) {
  1607. return ( Math.max(
  1608. Math.abs( this._mouseDownEvent.pageX - event.pageX ),
  1609. Math.abs( this._mouseDownEvent.pageY - event.pageY )
  1610. ) >= this.options.distance
  1611. );
  1612. },
  1613. _mouseDelayMet: function( /* event */ ) {
  1614. return this.mouseDelayMet;
  1615. },
  1616. // These are placeholder methods, to be overriden by extending plugin
  1617. _mouseStart: function( /* event */ ) {},
  1618. _mouseDrag: function( /* event */ ) {},
  1619. _mouseStop: function( /* event */ ) {},
  1620. _mouseCapture: function( /* event */ ) {
  1621. return true;
  1622. }
  1623. } );
  1624. // $.ui.plugin is deprecated. Use $.widget() extensions instead.
  1625. var plugin = $.ui.plugin = {
  1626. add: function( module, option, set ) {
  1627. var i,
  1628. proto = $.ui[ module ].prototype;
  1629. for ( i in set ) {
  1630. proto.plugins[ i ] = proto.plugins[ i ] || [];
  1631. proto.plugins[ i ].push( [ option, set[ i ] ] );
  1632. }
  1633. },
  1634. call: function( instance, name, args, allowDisconnected ) {
  1635. var i,
  1636. set = instance.plugins[ name ];
  1637. if ( !set ) {
  1638. return;
  1639. }
  1640. if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode ||
  1641. instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
  1642. return;
  1643. }
  1644. for ( i = 0; i < set.length; i++ ) {
  1645. if ( instance.options[ set[ i ][ 0 ] ] ) {
  1646. set[ i ][ 1 ].apply( instance.element, args );
  1647. }
  1648. }
  1649. }
  1650. };
  1651. var safeActiveElement = $.ui.safeActiveElement = function( document ) {
  1652. var activeElement;
  1653. // Support: IE 9 only
  1654. // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
  1655. try {
  1656. activeElement = document.activeElement;
  1657. } catch ( error ) {
  1658. activeElement = document.body;
  1659. }
  1660. // Support: IE 9 - 11 only
  1661. // IE may return null instead of an element
  1662. // Interestingly, this only seems to occur when NOT in an iframe
  1663. if ( !activeElement ) {
  1664. activeElement = document.body;
  1665. }
  1666. // Support: IE 11 only
  1667. // IE11 returns a seemingly empty object in some cases when accessing
  1668. // document.activeElement from an <iframe>
  1669. if ( !activeElement.nodeName ) {
  1670. activeElement = document.body;
  1671. }
  1672. return activeElement;
  1673. };
  1674. var safeBlur = $.ui.safeBlur = function( element ) {
  1675. // Support: IE9 - 10 only
  1676. // If the <body> is blurred, IE will switch windows, see #9420
  1677. if ( element && element.nodeName.toLowerCase() !== "body" ) {
  1678. $( element ).trigger( "blur" );
  1679. }
  1680. };
  1681. /*!
  1682. * jQuery UI Draggable 1.13.2
  1683. * http://jqueryui.com
  1684. *
  1685. * Copyright jQuery Foundation and other contributors
  1686. * Released under the MIT license.
  1687. * http://jquery.org/license
  1688. */
  1689. //>>label: Draggable
  1690. //>>group: Interactions
  1691. //>>description: Enables dragging functionality for any element.
  1692. //>>docs: http://api.jqueryui.com/draggable/
  1693. //>>demos: http://jqueryui.com/draggable/
  1694. //>>css.structure: ../../themes/base/draggable.css
  1695. $.widget( "ui.draggable", $.ui.mouse, {
  1696. version: "1.13.2",
  1697. widgetEventPrefix: "drag",
  1698. options: {
  1699. addClasses: true,
  1700. appendTo: "parent",
  1701. axis: false,
  1702. connectToSortable: false,
  1703. containment: false,
  1704. cursor: "auto",
  1705. cursorAt: false,
  1706. grid: false,
  1707. handle: false,
  1708. helper: "original",
  1709. iframeFix: false,
  1710. opacity: false,
  1711. refreshPositions: false,
  1712. revert: false,
  1713. revertDuration: 500,
  1714. scope: "default",
  1715. scroll: true,
  1716. scrollSensitivity: 20,
  1717. scrollSpeed: 20,
  1718. snap: false,
  1719. snapMode: "both",
  1720. snapTolerance: 20,
  1721. stack: false,
  1722. zIndex: false,
  1723. // Callbacks
  1724. drag: null,
  1725. start: null,
  1726. stop: null
  1727. },
  1728. _create: function() {
  1729. if ( this.options.helper === "original" ) {
  1730. this._setPositionRelative();
  1731. }
  1732. if ( this.options.addClasses ) {
  1733. this._addClass( "ui-draggable" );
  1734. }
  1735. this._setHandleClassName();
  1736. this._mouseInit();
  1737. },
  1738. _setOption: function( key, value ) {
  1739. this._super( key, value );
  1740. if ( key === "handle" ) {
  1741. this._removeHandleClassName();
  1742. this._setHandleClassName();
  1743. }
  1744. },
  1745. _destroy: function() {
  1746. if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {
  1747. this.destroyOnClear = true;
  1748. return;
  1749. }
  1750. this._removeHandleClassName();
  1751. this._mouseDestroy();
  1752. },
  1753. _mouseCapture: function( event ) {
  1754. var o = this.options;
  1755. // Among others, prevent a drag on a resizable-handle
  1756. if ( this.helper || o.disabled ||
  1757. $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) {
  1758. return false;
  1759. }
  1760. //Quit if we're not on a valid handle
  1761. this.handle = this._getHandle( event );
  1762. if ( !this.handle ) {
  1763. return false;
  1764. }
  1765. this._blurActiveElement( event );
  1766. this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );
  1767. return true;
  1768. },
  1769. _blockFrames: function( selector ) {
  1770. this.iframeBlocks = this.document.find( selector ).map( function() {
  1771. var iframe = $( this );
  1772. return $( "<div>" )
  1773. .css( "position", "absolute" )
  1774. .appendTo( iframe.parent() )
  1775. .outerWidth( iframe.outerWidth() )
  1776. .outerHeight( iframe.outerHeight() )
  1777. .offset( iframe.offset() )[ 0 ];
  1778. } );
  1779. },
  1780. _unblockFrames: function() {
  1781. if ( this.iframeBlocks ) {
  1782. this.iframeBlocks.remove();
  1783. delete this.iframeBlocks;
  1784. }
  1785. },
  1786. _blurActiveElement: function( event ) {
  1787. var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
  1788. target = $( event.target );
  1789. // Don't blur if the event occurred on an element that is within
  1790. // the currently focused element
  1791. // See #10527, #12472
  1792. if ( target.closest( activeElement ).length ) {
  1793. return;
  1794. }
  1795. // Blur any element that currently has focus, see #4261
  1796. $.ui.safeBlur( activeElement );
  1797. },
  1798. _mouseStart: function( event ) {
  1799. var o = this.options;
  1800. //Create and append the visible helper
  1801. this.helper = this._createHelper( event );
  1802. this._addClass( this.helper, "ui-draggable-dragging" );
  1803. //Cache the helper size
  1804. this._cacheHelperProportions();
  1805. //If ddmanager is used for droppables, set the global draggable
  1806. if ( $.ui.ddmanager ) {
  1807. $.ui.ddmanager.current = this;
  1808. }
  1809. /*
  1810. * - Position generation -
  1811. * This block generates everything position related - it's the core of draggables.
  1812. */
  1813. //Cache the margins of the original element
  1814. this._cacheMargins();
  1815. //Store the helper's css position
  1816. this.cssPosition = this.helper.css( "position" );
  1817. this.scrollParent = this.helper.scrollParent( true );
  1818. this.offsetParent = this.helper.offsetParent();
  1819. this.hasFixedAncestor = this.helper.parents().filter( function() {
  1820. return $( this ).css( "position" ) === "fixed";
  1821. } ).length > 0;
  1822. //The element's absolute position on the page minus margins
  1823. this.positionAbs = this.element.offset();
  1824. this._refreshOffsets( event );
  1825. //Generate the original position
  1826. this.originalPosition = this.position = this._generatePosition( event, false );
  1827. this.originalPageX = event.pageX;
  1828. this.originalPageY = event.pageY;
  1829. //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
  1830. if ( o.cursorAt ) {
  1831. this._adjustOffsetFromHelper( o.cursorAt );
  1832. }
  1833. //Set a containment if given in the options
  1834. this._setContainment();
  1835. //Trigger event + callbacks
  1836. if ( this._trigger( "start", event ) === false ) {
  1837. this._clear();
  1838. return false;
  1839. }
  1840. //Recache the helper size
  1841. this._cacheHelperProportions();
  1842. //Prepare the droppable offsets
  1843. if ( $.ui.ddmanager && !o.dropBehaviour ) {
  1844. $.ui.ddmanager.prepareOffsets( this, event );
  1845. }
  1846. // Execute the drag once - this causes the helper not to be visible before getting its
  1847. // correct position
  1848. this._mouseDrag( event, true );
  1849. // If the ddmanager is used for droppables, inform the manager that dragging has started
  1850. // (see #5003)
  1851. if ( $.ui.ddmanager ) {
  1852. $.ui.ddmanager.dragStart( this, event );
  1853. }
  1854. return true;
  1855. },
  1856. _refreshOffsets: function( event ) {
  1857. this.offset = {
  1858. top: this.positionAbs.top - this.margins.top,
  1859. left: this.positionAbs.left - this.margins.left,
  1860. scroll: false,
  1861. parent: this._getParentOffset(),
  1862. relative: this._getRelativeOffset()
  1863. };
  1864. this.offset.click = {
  1865. left: event.pageX - this.offset.left,
  1866. top: event.pageY - this.offset.top
  1867. };
  1868. },
  1869. _mouseDrag: function( event, noPropagation ) {
  1870. // reset any necessary cached properties (see #5009)
  1871. if ( this.hasFixedAncestor ) {
  1872. this.offset.parent = this._getParentOffset();
  1873. }
  1874. //Compute the helpers position
  1875. this.position = this._generatePosition( event, true );
  1876. this.positionAbs = this._convertPositionTo( "absolute" );
  1877. //Call plugins and callbacks and use the resulting position if something is returned
  1878. if ( !noPropagation ) {
  1879. var ui = this._uiHash();
  1880. if ( this._trigger( "drag", event, ui ) === false ) {
  1881. this._mouseUp( new $.Event( "mouseup", event ) );
  1882. return false;
  1883. }
  1884. this.position = ui.position;
  1885. }
  1886. this.helper[ 0 ].style.left = this.position.left + "px";
  1887. this.helper[ 0 ].style.top = this.position.top + "px";
  1888. if ( $.ui.ddmanager ) {
  1889. $.ui.ddmanager.drag( this, event );
  1890. }
  1891. return false;
  1892. },
  1893. _mouseStop: function( event ) {
  1894. //If we are using droppables, inform the manager about the drop
  1895. var that = this,
  1896. dropped = false;
  1897. if ( $.ui.ddmanager && !this.options.dropBehaviour ) {
  1898. dropped = $.ui.ddmanager.drop( this, event );
  1899. }
  1900. //if a drop comes from outside (a sortable)
  1901. if ( this.dropped ) {
  1902. dropped = this.dropped;
  1903. this.dropped = false;
  1904. }
  1905. if ( ( this.options.revert === "invalid" && !dropped ) ||
  1906. ( this.options.revert === "valid" && dropped ) ||
  1907. this.options.revert === true || ( typeof this.options.revert === "function" &&
  1908. this.options.revert.call( this.element, dropped ) )
  1909. ) {
  1910. $( this.helper ).animate(
  1911. this.originalPosition,
  1912. parseInt( this.options.revertDuration, 10 ),
  1913. function() {
  1914. if ( that._trigger( "stop", event ) !== false ) {
  1915. that._clear();
  1916. }
  1917. }
  1918. );
  1919. } else {
  1920. if ( this._trigger( "stop", event ) !== false ) {
  1921. this._clear();
  1922. }
  1923. }
  1924. return false;
  1925. },
  1926. _mouseUp: function( event ) {
  1927. this._unblockFrames();
  1928. // If the ddmanager is used for droppables, inform the manager that dragging has stopped
  1929. // (see #5003)
  1930. if ( $.ui.ddmanager ) {
  1931. $.ui.ddmanager.dragStop( this, event );
  1932. }
  1933. // Only need to focus if the event occurred on the draggable itself, see #10527
  1934. if ( this.handleElement.is( event.target ) ) {
  1935. // The interaction is over; whether or not the click resulted in a drag,
  1936. // focus the element
  1937. this.element.trigger( "focus" );
  1938. }
  1939. return $.ui.mouse.prototype._mouseUp.call( this, event );
  1940. },
  1941. cancel: function() {
  1942. if ( this.helper.is( ".ui-draggable-dragging" ) ) {
  1943. this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) );
  1944. } else {
  1945. this._clear();
  1946. }
  1947. return this;
  1948. },
  1949. _getHandle: function( event ) {
  1950. return this.options.handle ?
  1951. !!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
  1952. true;
  1953. },
  1954. _setHandleClassName: function() {
  1955. this.handleElement = this.options.handle ?
  1956. this.element.find( this.options.handle ) : this.element;
  1957. this._addClass( this.handleElement, "ui-draggable-handle" );
  1958. },
  1959. _removeHandleClassName: function() {
  1960. this._removeClass( this.handleElement, "ui-draggable-handle" );
  1961. },
  1962. _createHelper: function( event ) {
  1963. var o = this.options,
  1964. helperIsFunction = typeof o.helper === "function",
  1965. helper = helperIsFunction ?
  1966. $( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
  1967. ( o.helper === "clone" ?
  1968. this.element.clone().removeAttr( "id" ) :
  1969. this.element );
  1970. if ( !helper.parents( "body" ).length ) {
  1971. helper.appendTo( ( o.appendTo === "parent" ?
  1972. this.element[ 0 ].parentNode :
  1973. o.appendTo ) );
  1974. }
  1975. // Http://bugs.jqueryui.com/ticket/9446
  1976. // a helper function can return the original element
  1977. // which wouldn't have been set to relative in _create
  1978. if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {
  1979. this._setPositionRelative();
  1980. }
  1981. if ( helper[ 0 ] !== this.element[ 0 ] &&
  1982. !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) {
  1983. helper.css( "position", "absolute" );
  1984. }
  1985. return helper;
  1986. },
  1987. _setPositionRelative: function() {
  1988. if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {
  1989. this.element[ 0 ].style.position = "relative";
  1990. }
  1991. },
  1992. _adjustOffsetFromHelper: function( obj ) {
  1993. if ( typeof obj === "string" ) {
  1994. obj = obj.split( " " );
  1995. }
  1996. if ( Array.isArray( obj ) ) {
  1997. obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
  1998. }
  1999. if ( "left" in obj ) {
  2000. this.offset.click.left = obj.left + this.margins.left;
  2001. }
  2002. if ( "right" in obj ) {
  2003. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  2004. }
  2005. if ( "top" in obj ) {
  2006. this.offset.click.top = obj.top + this.margins.top;
  2007. }
  2008. if ( "bottom" in obj ) {
  2009. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  2010. }
  2011. },
  2012. _isRootNode: function( element ) {
  2013. return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];
  2014. },
  2015. _getParentOffset: function() {
  2016. //Get the offsetParent and cache its position
  2017. var po = this.offsetParent.offset(),
  2018. document = this.document[ 0 ];
  2019. // This is a special case where we need to modify a offset calculated on start, since the
  2020. // following happened:
  2021. // 1. The position of the helper is absolute, so it's position is calculated based on the
  2022. // next positioned parent
  2023. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
  2024. // the document, which means that the scroll is included in the initial calculation of the
  2025. // offset of the parent, and never recalculated upon drag
  2026. if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document &&
  2027. $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
  2028. po.left += this.scrollParent.scrollLeft();
  2029. po.top += this.scrollParent.scrollTop();
  2030. }
  2031. if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {
  2032. po = { top: 0, left: 0 };
  2033. }
  2034. return {
  2035. top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),
  2036. left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )
  2037. };
  2038. },
  2039. _getRelativeOffset: function() {
  2040. if ( this.cssPosition !== "relative" ) {
  2041. return { top: 0, left: 0 };
  2042. }
  2043. var p = this.element.position(),
  2044. scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
  2045. return {
  2046. top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +
  2047. ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),
  2048. left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +
  2049. ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 )
  2050. };
  2051. },
  2052. _cacheMargins: function() {
  2053. this.margins = {
  2054. left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ),
  2055. top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ),
  2056. right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ),
  2057. bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 )
  2058. };
  2059. },
  2060. _cacheHelperProportions: function() {
  2061. this.helperProportions = {
  2062. width: this.helper.outerWidth(),
  2063. height: this.helper.outerHeight()
  2064. };
  2065. },
  2066. _setContainment: function() {
  2067. var isUserScrollable, c, ce,
  2068. o = this.options,
  2069. document = this.document[ 0 ];
  2070. this.relativeContainer = null;
  2071. if ( !o.containment ) {
  2072. this.containment = null;
  2073. return;
  2074. }
  2075. if ( o.containment === "window" ) {
  2076. this.containment = [
  2077. $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
  2078. $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
  2079. $( window ).scrollLeft() + $( window ).width() -
  2080. this.helperProportions.width - this.margins.left,
  2081. $( window ).scrollTop() +
  2082. ( $( window ).height() || document.body.parentNode.scrollHeight ) -
  2083. this.helperProportions.height - this.margins.top
  2084. ];
  2085. return;
  2086. }
  2087. if ( o.containment === "document" ) {
  2088. this.containment = [
  2089. 0,
  2090. 0,
  2091. $( document ).width() - this.helperProportions.width - this.margins.left,
  2092. ( $( document ).height() || document.body.parentNode.scrollHeight ) -
  2093. this.helperProportions.height - this.margins.top
  2094. ];
  2095. return;
  2096. }
  2097. if ( o.containment.constructor === Array ) {
  2098. this.containment = o.containment;
  2099. return;
  2100. }
  2101. if ( o.containment === "parent" ) {
  2102. o.containment = this.helper[ 0 ].parentNode;
  2103. }
  2104. c = $( o.containment );
  2105. ce = c[ 0 ];
  2106. if ( !ce ) {
  2107. return;
  2108. }
  2109. isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );
  2110. this.containment = [
  2111. ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) +
  2112. ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
  2113. ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) +
  2114. ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
  2115. ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
  2116. ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -
  2117. ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -
  2118. this.helperProportions.width -
  2119. this.margins.left -
  2120. this.margins.right,
  2121. ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
  2122. ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -
  2123. ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -
  2124. this.helperProportions.height -
  2125. this.margins.top -
  2126. this.margins.bottom
  2127. ];
  2128. this.relativeContainer = c;
  2129. },
  2130. _convertPositionTo: function( d, pos ) {
  2131. if ( !pos ) {
  2132. pos = this.position;
  2133. }
  2134. var mod = d === "absolute" ? 1 : -1,
  2135. scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
  2136. return {
  2137. top: (
  2138. // The absolute mouse position
  2139. pos.top +
  2140. // Only for relative positioned nodes: Relative offset from element to offset parent
  2141. this.offset.relative.top * mod +
  2142. // The offsetParent's offset without borders (offset + border)
  2143. this.offset.parent.top * mod -
  2144. ( ( this.cssPosition === "fixed" ?
  2145. -this.offset.scroll.top :
  2146. ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod )
  2147. ),
  2148. left: (
  2149. // The absolute mouse position
  2150. pos.left +
  2151. // Only for relative positioned nodes: Relative offset from element to offset parent
  2152. this.offset.relative.left * mod +
  2153. // The offsetParent's offset without borders (offset + border)
  2154. this.offset.parent.left * mod -
  2155. ( ( this.cssPosition === "fixed" ?
  2156. -this.offset.scroll.left :
  2157. ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod )
  2158. )
  2159. };
  2160. },
  2161. _generatePosition: function( event, constrainPosition ) {
  2162. var containment, co, top, left,
  2163. o = this.options,
  2164. scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),
  2165. pageX = event.pageX,
  2166. pageY = event.pageY;
  2167. // Cache the scroll
  2168. if ( !scrollIsRootNode || !this.offset.scroll ) {
  2169. this.offset.scroll = {
  2170. top: this.scrollParent.scrollTop(),
  2171. left: this.scrollParent.scrollLeft()
  2172. };
  2173. }
  2174. /*
  2175. * - Position constraining -
  2176. * Constrain the position to a mix of grid, containment.
  2177. */
  2178. // If we are not dragging yet, we won't check for options
  2179. if ( constrainPosition ) {
  2180. if ( this.containment ) {
  2181. if ( this.relativeContainer ) {
  2182. co = this.relativeContainer.offset();
  2183. containment = [
  2184. this.containment[ 0 ] + co.left,
  2185. this.containment[ 1 ] + co.top,
  2186. this.containment[ 2 ] + co.left,
  2187. this.containment[ 3 ] + co.top
  2188. ];
  2189. } else {
  2190. containment = this.containment;
  2191. }
  2192. if ( event.pageX - this.offset.click.left < containment[ 0 ] ) {
  2193. pageX = containment[ 0 ] + this.offset.click.left;
  2194. }
  2195. if ( event.pageY - this.offset.click.top < containment[ 1 ] ) {
  2196. pageY = containment[ 1 ] + this.offset.click.top;
  2197. }
  2198. if ( event.pageX - this.offset.click.left > containment[ 2 ] ) {
  2199. pageX = containment[ 2 ] + this.offset.click.left;
  2200. }
  2201. if ( event.pageY - this.offset.click.top > containment[ 3 ] ) {
  2202. pageY = containment[ 3 ] + this.offset.click.top;
  2203. }
  2204. }
  2205. if ( o.grid ) {
  2206. //Check for grid elements set to 0 to prevent divide by 0 error causing invalid
  2207. // argument errors in IE (see ticket #6950)
  2208. top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY -
  2209. this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY;
  2210. pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] ||
  2211. top - this.offset.click.top > containment[ 3 ] ) ?
  2212. top :
  2213. ( ( top - this.offset.click.top >= containment[ 1 ] ) ?
  2214. top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top;
  2215. left = o.grid[ 0 ] ? this.originalPageX +
  2216. Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] :
  2217. this.originalPageX;
  2218. pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] ||
  2219. left - this.offset.click.left > containment[ 2 ] ) ?
  2220. left :
  2221. ( ( left - this.offset.click.left >= containment[ 0 ] ) ?
  2222. left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left;
  2223. }
  2224. if ( o.axis === "y" ) {
  2225. pageX = this.originalPageX;
  2226. }
  2227. if ( o.axis === "x" ) {
  2228. pageY = this.originalPageY;
  2229. }
  2230. }
  2231. return {
  2232. top: (
  2233. // The absolute mouse position
  2234. pageY -
  2235. // Click offset (relative to the element)
  2236. this.offset.click.top -
  2237. // Only for relative positioned nodes: Relative offset from element to offset parent
  2238. this.offset.relative.top -
  2239. // The offsetParent's offset without borders (offset + border)
  2240. this.offset.parent.top +
  2241. ( this.cssPosition === "fixed" ?
  2242. -this.offset.scroll.top :
  2243. ( scrollIsRootNode ? 0 : this.offset.scroll.top ) )
  2244. ),
  2245. left: (
  2246. // The absolute mouse position
  2247. pageX -
  2248. // Click offset (relative to the element)
  2249. this.offset.click.left -
  2250. // Only for relative positioned nodes: Relative offset from element to offset parent
  2251. this.offset.relative.left -
  2252. // The offsetParent's offset without borders (offset + border)
  2253. this.offset.parent.left +
  2254. ( this.cssPosition === "fixed" ?
  2255. -this.offset.scroll.left :
  2256. ( scrollIsRootNode ? 0 : this.offset.scroll.left ) )
  2257. )
  2258. };
  2259. },
  2260. _clear: function() {
  2261. this._removeClass( this.helper, "ui-draggable-dragging" );
  2262. if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) {
  2263. this.helper.remove();
  2264. }
  2265. this.helper = null;
  2266. this.cancelHelperRemoval = false;
  2267. if ( this.destroyOnClear ) {
  2268. this.destroy();
  2269. }
  2270. },
  2271. // From now on bulk stuff - mainly helpers
  2272. _trigger: function( type, event, ui ) {
  2273. ui = ui || this._uiHash();
  2274. $.ui.plugin.call( this, type, [ event, ui, this ], true );
  2275. // Absolute position and offset (see #6884 ) have to be recalculated after plugins
  2276. if ( /^(drag|start|stop)/.test( type ) ) {
  2277. this.positionAbs = this._convertPositionTo( "absolute" );
  2278. ui.offset = this.positionAbs;
  2279. }
  2280. return $.Widget.prototype._trigger.call( this, type, event, ui );
  2281. },
  2282. plugins: {},
  2283. _uiHash: function() {
  2284. return {
  2285. helper: this.helper,
  2286. position: this.position,
  2287. originalPosition: this.originalPosition,
  2288. offset: this.positionAbs
  2289. };
  2290. }
  2291. } );
  2292. $.ui.plugin.add( "draggable", "connectToSortable", {
  2293. start: function( event, ui, draggable ) {
  2294. var uiSortable = $.extend( {}, ui, {
  2295. item: draggable.element
  2296. } );
  2297. draggable.sortables = [];
  2298. $( draggable.options.connectToSortable ).each( function() {
  2299. var sortable = $( this ).sortable( "instance" );
  2300. if ( sortable && !sortable.options.disabled ) {
  2301. draggable.sortables.push( sortable );
  2302. // RefreshPositions is called at drag start to refresh the containerCache
  2303. // which is used in drag. This ensures it's initialized and synchronized
  2304. // with any changes that might have happened on the page since initialization.
  2305. sortable.refreshPositions();
  2306. sortable._trigger( "activate", event, uiSortable );
  2307. }
  2308. } );
  2309. },
  2310. stop: function( event, ui, draggable ) {
  2311. var uiSortable = $.extend( {}, ui, {
  2312. item: draggable.element
  2313. } );
  2314. draggable.cancelHelperRemoval = false;
  2315. $.each( draggable.sortables, function() {
  2316. var sortable = this;
  2317. if ( sortable.isOver ) {
  2318. sortable.isOver = 0;
  2319. // Allow this sortable to handle removing the helper
  2320. draggable.cancelHelperRemoval = true;
  2321. sortable.cancelHelperRemoval = false;
  2322. // Use _storedCSS To restore properties in the sortable,
  2323. // as this also handles revert (#9675) since the draggable
  2324. // may have modified them in unexpected ways (#8809)
  2325. sortable._storedCSS = {
  2326. position: sortable.placeholder.css( "position" ),
  2327. top: sortable.placeholder.css( "top" ),
  2328. left: sortable.placeholder.css( "left" )
  2329. };
  2330. sortable._mouseStop( event );
  2331. // Once drag has ended, the sortable should return to using
  2332. // its original helper, not the shared helper from draggable
  2333. sortable.options.helper = sortable.options._helper;
  2334. } else {
  2335. // Prevent this Sortable from removing the helper.
  2336. // However, don't set the draggable to remove the helper
  2337. // either as another connected Sortable may yet handle the removal.
  2338. sortable.cancelHelperRemoval = true;
  2339. sortable._trigger( "deactivate", event, uiSortable );
  2340. }
  2341. } );
  2342. },
  2343. drag: function( event, ui, draggable ) {
  2344. $.each( draggable.sortables, function() {
  2345. var innermostIntersecting = false,
  2346. sortable = this;
  2347. // Copy over variables that sortable's _intersectsWith uses
  2348. sortable.positionAbs = draggable.positionAbs;
  2349. sortable.helperProportions = draggable.helperProportions;
  2350. sortable.offset.click = draggable.offset.click;
  2351. if ( sortable._intersectsWith( sortable.containerCache ) ) {
  2352. innermostIntersecting = true;
  2353. $.each( draggable.sortables, function() {
  2354. // Copy over variables that sortable's _intersectsWith uses
  2355. this.positionAbs = draggable.positionAbs;
  2356. this.helperProportions = draggable.helperProportions;
  2357. this.offset.click = draggable.offset.click;
  2358. if ( this !== sortable &&
  2359. this._intersectsWith( this.containerCache ) &&
  2360. $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {
  2361. innermostIntersecting = false;
  2362. }
  2363. return innermostIntersecting;
  2364. } );
  2365. }
  2366. if ( innermostIntersecting ) {
  2367. // If it intersects, we use a little isOver variable and set it once,
  2368. // so that the move-in stuff gets fired only once.
  2369. if ( !sortable.isOver ) {
  2370. sortable.isOver = 1;
  2371. // Store draggable's parent in case we need to reappend to it later.
  2372. draggable._parent = ui.helper.parent();
  2373. sortable.currentItem = ui.helper
  2374. .appendTo( sortable.element )
  2375. .data( "ui-sortable-item", true );
  2376. // Store helper option to later restore it
  2377. sortable.options._helper = sortable.options.helper;
  2378. sortable.options.helper = function() {
  2379. return ui.helper[ 0 ];
  2380. };
  2381. // Fire the start events of the sortable with our passed browser event,
  2382. // and our own helper (so it doesn't create a new one)
  2383. event.target = sortable.currentItem[ 0 ];
  2384. sortable._mouseCapture( event, true );
  2385. sortable._mouseStart( event, true, true );
  2386. // Because the browser event is way off the new appended portlet,
  2387. // modify necessary variables to reflect the changes
  2388. sortable.offset.click.top = draggable.offset.click.top;
  2389. sortable.offset.click.left = draggable.offset.click.left;
  2390. sortable.offset.parent.left -= draggable.offset.parent.left -
  2391. sortable.offset.parent.left;
  2392. sortable.offset.parent.top -= draggable.offset.parent.top -
  2393. sortable.offset.parent.top;
  2394. draggable._trigger( "toSortable", event );
  2395. // Inform draggable that the helper is in a valid drop zone,
  2396. // used solely in the revert option to handle "valid/invalid".
  2397. draggable.dropped = sortable.element;
  2398. // Need to refreshPositions of all sortables in the case that
  2399. // adding to one sortable changes the location of the other sortables (#9675)
  2400. $.each( draggable.sortables, function() {
  2401. this.refreshPositions();
  2402. } );
  2403. // Hack so receive/update callbacks work (mostly)
  2404. draggable.currentItem = draggable.element;
  2405. sortable.fromOutside = draggable;
  2406. }
  2407. if ( sortable.currentItem ) {
  2408. sortable._mouseDrag( event );
  2409. // Copy the sortable's position because the draggable's can potentially reflect
  2410. // a relative position, while sortable is always absolute, which the dragged
  2411. // element has now become. (#8809)
  2412. ui.position = sortable.position;
  2413. }
  2414. } else {
  2415. // If it doesn't intersect with the sortable, and it intersected before,
  2416. // we fake the drag stop of the sortable, but make sure it doesn't remove
  2417. // the helper by using cancelHelperRemoval.
  2418. if ( sortable.isOver ) {
  2419. sortable.isOver = 0;
  2420. sortable.cancelHelperRemoval = true;
  2421. // Calling sortable's mouseStop would trigger a revert,
  2422. // so revert must be temporarily false until after mouseStop is called.
  2423. sortable.options._revert = sortable.options.revert;
  2424. sortable.options.revert = false;
  2425. sortable._trigger( "out", event, sortable._uiHash( sortable ) );
  2426. sortable._mouseStop( event, true );
  2427. // Restore sortable behaviors that were modfied
  2428. // when the draggable entered the sortable area (#9481)
  2429. sortable.options.revert = sortable.options._revert;
  2430. sortable.options.helper = sortable.options._helper;
  2431. if ( sortable.placeholder ) {
  2432. sortable.placeholder.remove();
  2433. }
  2434. // Restore and recalculate the draggable's offset considering the sortable
  2435. // may have modified them in unexpected ways. (#8809, #10669)
  2436. ui.helper.appendTo( draggable._parent );
  2437. draggable._refreshOffsets( event );
  2438. ui.position = draggable._generatePosition( event, true );
  2439. draggable._trigger( "fromSortable", event );
  2440. // Inform draggable that the helper is no longer in a valid drop zone
  2441. draggable.dropped = false;
  2442. // Need to refreshPositions of all sortables just in case removing
  2443. // from one sortable changes the location of other sortables (#9675)
  2444. $.each( draggable.sortables, function() {
  2445. this.refreshPositions();
  2446. } );
  2447. }
  2448. }
  2449. } );
  2450. }
  2451. } );
  2452. $.ui.plugin.add( "draggable", "cursor", {
  2453. start: function( event, ui, instance ) {
  2454. var t = $( "body" ),
  2455. o = instance.options;
  2456. if ( t.css( "cursor" ) ) {
  2457. o._cursor = t.css( "cursor" );
  2458. }
  2459. t.css( "cursor", o.cursor );
  2460. },
  2461. stop: function( event, ui, instance ) {
  2462. var o = instance.options;
  2463. if ( o._cursor ) {
  2464. $( "body" ).css( "cursor", o._cursor );
  2465. }
  2466. }
  2467. } );
  2468. $.ui.plugin.add( "draggable", "opacity", {
  2469. start: function( event, ui, instance ) {
  2470. var t = $( ui.helper ),
  2471. o = instance.options;
  2472. if ( t.css( "opacity" ) ) {
  2473. o._opacity = t.css( "opacity" );
  2474. }
  2475. t.css( "opacity", o.opacity );
  2476. },
  2477. stop: function( event, ui, instance ) {
  2478. var o = instance.options;
  2479. if ( o._opacity ) {
  2480. $( ui.helper ).css( "opacity", o._opacity );
  2481. }
  2482. }
  2483. } );
  2484. $.ui.plugin.add( "draggable", "scroll", {
  2485. start: function( event, ui, i ) {
  2486. if ( !i.scrollParentNotHidden ) {
  2487. i.scrollParentNotHidden = i.helper.scrollParent( false );
  2488. }
  2489. if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] &&
  2490. i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {
  2491. i.overflowOffset = i.scrollParentNotHidden.offset();
  2492. }
  2493. },
  2494. drag: function( event, ui, i ) {
  2495. var o = i.options,
  2496. scrolled = false,
  2497. scrollParent = i.scrollParentNotHidden[ 0 ],
  2498. document = i.document[ 0 ];
  2499. if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {
  2500. if ( !o.axis || o.axis !== "x" ) {
  2501. if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY <
  2502. o.scrollSensitivity ) {
  2503. scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
  2504. } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {
  2505. scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
  2506. }
  2507. }
  2508. if ( !o.axis || o.axis !== "y" ) {
  2509. if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX <
  2510. o.scrollSensitivity ) {
  2511. scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
  2512. } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {
  2513. scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
  2514. }
  2515. }
  2516. } else {
  2517. if ( !o.axis || o.axis !== "x" ) {
  2518. if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) {
  2519. scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed );
  2520. } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) <
  2521. o.scrollSensitivity ) {
  2522. scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed );
  2523. }
  2524. }
  2525. if ( !o.axis || o.axis !== "y" ) {
  2526. if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) {
  2527. scrolled = $( document ).scrollLeft(
  2528. $( document ).scrollLeft() - o.scrollSpeed
  2529. );
  2530. } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) <
  2531. o.scrollSensitivity ) {
  2532. scrolled = $( document ).scrollLeft(
  2533. $( document ).scrollLeft() + o.scrollSpeed
  2534. );
  2535. }
  2536. }
  2537. }
  2538. if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) {
  2539. $.ui.ddmanager.prepareOffsets( i, event );
  2540. }
  2541. }
  2542. } );
  2543. $.ui.plugin.add( "draggable", "snap", {
  2544. start: function( event, ui, i ) {
  2545. var o = i.options;
  2546. i.snapElements = [];
  2547. $( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap )
  2548. .each( function() {
  2549. var $t = $( this ),
  2550. $o = $t.offset();
  2551. if ( this !== i.element[ 0 ] ) {
  2552. i.snapElements.push( {
  2553. item: this,
  2554. width: $t.outerWidth(), height: $t.outerHeight(),
  2555. top: $o.top, left: $o.left
  2556. } );
  2557. }
  2558. } );
  2559. },
  2560. drag: function( event, ui, inst ) {
  2561. var ts, bs, ls, rs, l, r, t, b, i, first,
  2562. o = inst.options,
  2563. d = o.snapTolerance,
  2564. x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
  2565. y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
  2566. for ( i = inst.snapElements.length - 1; i >= 0; i-- ) {
  2567. l = inst.snapElements[ i ].left - inst.margins.left;
  2568. r = l + inst.snapElements[ i ].width;
  2569. t = inst.snapElements[ i ].top - inst.margins.top;
  2570. b = t + inst.snapElements[ i ].height;
  2571. if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d ||
  2572. !$.contains( inst.snapElements[ i ].item.ownerDocument,
  2573. inst.snapElements[ i ].item ) ) {
  2574. if ( inst.snapElements[ i ].snapping ) {
  2575. if ( inst.options.snap.release ) {
  2576. inst.options.snap.release.call(
  2577. inst.element,
  2578. event,
  2579. $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } )
  2580. );
  2581. }
  2582. }
  2583. inst.snapElements[ i ].snapping = false;
  2584. continue;
  2585. }
  2586. if ( o.snapMode !== "inner" ) {
  2587. ts = Math.abs( t - y2 ) <= d;
  2588. bs = Math.abs( b - y1 ) <= d;
  2589. ls = Math.abs( l - x2 ) <= d;
  2590. rs = Math.abs( r - x1 ) <= d;
  2591. if ( ts ) {
  2592. ui.position.top = inst._convertPositionTo( "relative", {
  2593. top: t - inst.helperProportions.height,
  2594. left: 0
  2595. } ).top;
  2596. }
  2597. if ( bs ) {
  2598. ui.position.top = inst._convertPositionTo( "relative", {
  2599. top: b,
  2600. left: 0
  2601. } ).top;
  2602. }
  2603. if ( ls ) {
  2604. ui.position.left = inst._convertPositionTo( "relative", {
  2605. top: 0,
  2606. left: l - inst.helperProportions.width
  2607. } ).left;
  2608. }
  2609. if ( rs ) {
  2610. ui.position.left = inst._convertPositionTo( "relative", {
  2611. top: 0,
  2612. left: r
  2613. } ).left;
  2614. }
  2615. }
  2616. first = ( ts || bs || ls || rs );
  2617. if ( o.snapMode !== "outer" ) {
  2618. ts = Math.abs( t - y1 ) <= d;
  2619. bs = Math.abs( b - y2 ) <= d;
  2620. ls = Math.abs( l - x1 ) <= d;
  2621. rs = Math.abs( r - x2 ) <= d;
  2622. if ( ts ) {
  2623. ui.position.top = inst._convertPositionTo( "relative", {
  2624. top: t,
  2625. left: 0
  2626. } ).top;
  2627. }
  2628. if ( bs ) {
  2629. ui.position.top = inst._convertPositionTo( "relative", {
  2630. top: b - inst.helperProportions.height,
  2631. left: 0
  2632. } ).top;
  2633. }
  2634. if ( ls ) {
  2635. ui.position.left = inst._convertPositionTo( "relative", {
  2636. top: 0,
  2637. left: l
  2638. } ).left;
  2639. }
  2640. if ( rs ) {
  2641. ui.position.left = inst._convertPositionTo( "relative", {
  2642. top: 0,
  2643. left: r - inst.helperProportions.width
  2644. } ).left;
  2645. }
  2646. }
  2647. if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) {
  2648. if ( inst.options.snap.snap ) {
  2649. inst.options.snap.snap.call(
  2650. inst.element,
  2651. event,
  2652. $.extend( inst._uiHash(), {
  2653. snapItem: inst.snapElements[ i ].item
  2654. } ) );
  2655. }
  2656. }
  2657. inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first );
  2658. }
  2659. }
  2660. } );
  2661. $.ui.plugin.add( "draggable", "stack", {
  2662. start: function( event, ui, instance ) {
  2663. var min,
  2664. o = instance.options,
  2665. group = $.makeArray( $( o.stack ) ).sort( function( a, b ) {
  2666. return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) -
  2667. ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 );
  2668. } );
  2669. if ( !group.length ) {
  2670. return;
  2671. }
  2672. min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0;
  2673. $( group ).each( function( i ) {
  2674. $( this ).css( "zIndex", min + i );
  2675. } );
  2676. this.css( "zIndex", ( min + group.length ) );
  2677. }
  2678. } );
  2679. $.ui.plugin.add( "draggable", "zIndex", {
  2680. start: function( event, ui, instance ) {
  2681. var t = $( ui.helper ),
  2682. o = instance.options;
  2683. if ( t.css( "zIndex" ) ) {
  2684. o._zIndex = t.css( "zIndex" );
  2685. }
  2686. t.css( "zIndex", o.zIndex );
  2687. },
  2688. stop: function( event, ui, instance ) {
  2689. var o = instance.options;
  2690. if ( o._zIndex ) {
  2691. $( ui.helper ).css( "zIndex", o._zIndex );
  2692. }
  2693. }
  2694. } );
  2695. var widgetsDraggable = $.ui.draggable;
  2696. /*!
  2697. * jQuery UI Droppable 1.13.2
  2698. * http://jqueryui.com
  2699. *
  2700. * Copyright jQuery Foundation and other contributors
  2701. * Released under the MIT license.
  2702. * http://jquery.org/license
  2703. */
  2704. //>>label: Droppable
  2705. //>>group: Interactions
  2706. //>>description: Enables drop targets for draggable elements.
  2707. //>>docs: http://api.jqueryui.com/droppable/
  2708. //>>demos: http://jqueryui.com/droppable/
  2709. $.widget( "ui.droppable", {
  2710. version: "1.13.2",
  2711. widgetEventPrefix: "drop",
  2712. options: {
  2713. accept: "*",
  2714. addClasses: true,
  2715. greedy: false,
  2716. scope: "default",
  2717. tolerance: "intersect",
  2718. // Callbacks
  2719. activate: null,
  2720. deactivate: null,
  2721. drop: null,
  2722. out: null,
  2723. over: null
  2724. },
  2725. _create: function() {
  2726. var proportions,
  2727. o = this.options,
  2728. accept = o.accept;
  2729. this.isover = false;
  2730. this.isout = true;
  2731. this.accept = typeof accept === "function" ? accept : function( d ) {
  2732. return d.is( accept );
  2733. };
  2734. this.proportions = function( /* valueToWrite */ ) {
  2735. if ( arguments.length ) {
  2736. // Store the droppable's proportions
  2737. proportions = arguments[ 0 ];
  2738. } else {
  2739. // Retrieve or derive the droppable's proportions
  2740. return proportions ?
  2741. proportions :
  2742. proportions = {
  2743. width: this.element[ 0 ].offsetWidth,
  2744. height: this.element[ 0 ].offsetHeight
  2745. };
  2746. }
  2747. };
  2748. this._addToManager( o.scope );
  2749. if ( o.addClasses ) {
  2750. this._addClass( "ui-droppable" );
  2751. }
  2752. },
  2753. _addToManager: function( scope ) {
  2754. // Add the reference and positions to the manager
  2755. $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || [];
  2756. $.ui.ddmanager.droppables[ scope ].push( this );
  2757. },
  2758. _splice: function( drop ) {
  2759. var i = 0;
  2760. for ( ; i < drop.length; i++ ) {
  2761. if ( drop[ i ] === this ) {
  2762. drop.splice( i, 1 );
  2763. }
  2764. }
  2765. },
  2766. _destroy: function() {
  2767. var drop = $.ui.ddmanager.droppables[ this.options.scope ];
  2768. this._splice( drop );
  2769. },
  2770. _setOption: function( key, value ) {
  2771. if ( key === "accept" ) {
  2772. this.accept = typeof value === "function" ? value : function( d ) {
  2773. return d.is( value );
  2774. };
  2775. } else if ( key === "scope" ) {
  2776. var drop = $.ui.ddmanager.droppables[ this.options.scope ];
  2777. this._splice( drop );
  2778. this._addToManager( value );
  2779. }
  2780. this._super( key, value );
  2781. },
  2782. _activate: function( event ) {
  2783. var draggable = $.ui.ddmanager.current;
  2784. this._addActiveClass();
  2785. if ( draggable ) {
  2786. this._trigger( "activate", event, this.ui( draggable ) );
  2787. }
  2788. },
  2789. _deactivate: function( event ) {
  2790. var draggable = $.ui.ddmanager.current;
  2791. this._removeActiveClass();
  2792. if ( draggable ) {
  2793. this._trigger( "deactivate", event, this.ui( draggable ) );
  2794. }
  2795. },
  2796. _over: function( event ) {
  2797. var draggable = $.ui.ddmanager.current;
  2798. // Bail if draggable and droppable are same element
  2799. if ( !draggable || ( draggable.currentItem ||
  2800. draggable.element )[ 0 ] === this.element[ 0 ] ) {
  2801. return;
  2802. }
  2803. if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
  2804. draggable.element ) ) ) {
  2805. this._addHoverClass();
  2806. this._trigger( "over", event, this.ui( draggable ) );
  2807. }
  2808. },
  2809. _out: function( event ) {
  2810. var draggable = $.ui.ddmanager.current;
  2811. // Bail if draggable and droppable are same element
  2812. if ( !draggable || ( draggable.currentItem ||
  2813. draggable.element )[ 0 ] === this.element[ 0 ] ) {
  2814. return;
  2815. }
  2816. if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
  2817. draggable.element ) ) ) {
  2818. this._removeHoverClass();
  2819. this._trigger( "out", event, this.ui( draggable ) );
  2820. }
  2821. },
  2822. _drop: function( event, custom ) {
  2823. var draggable = custom || $.ui.ddmanager.current,
  2824. childrenIntersection = false;
  2825. // Bail if draggable and droppable are same element
  2826. if ( !draggable || ( draggable.currentItem ||
  2827. draggable.element )[ 0 ] === this.element[ 0 ] ) {
  2828. return false;
  2829. }
  2830. this.element
  2831. .find( ":data(ui-droppable)" )
  2832. .not( ".ui-draggable-dragging" )
  2833. .each( function() {
  2834. var inst = $( this ).droppable( "instance" );
  2835. if (
  2836. inst.options.greedy &&
  2837. !inst.options.disabled &&
  2838. inst.options.scope === draggable.options.scope &&
  2839. inst.accept.call(
  2840. inst.element[ 0 ], ( draggable.currentItem || draggable.element )
  2841. ) &&
  2842. $.ui.intersect(
  2843. draggable,
  2844. $.extend( inst, { offset: inst.element.offset() } ),
  2845. inst.options.tolerance, event
  2846. )
  2847. ) {
  2848. childrenIntersection = true;
  2849. return false;
  2850. }
  2851. } );
  2852. if ( childrenIntersection ) {
  2853. return false;
  2854. }
  2855. if ( this.accept.call( this.element[ 0 ],
  2856. ( draggable.currentItem || draggable.element ) ) ) {
  2857. this._removeActiveClass();
  2858. this._removeHoverClass();
  2859. this._trigger( "drop", event, this.ui( draggable ) );
  2860. return this.element;
  2861. }
  2862. return false;
  2863. },
  2864. ui: function( c ) {
  2865. return {
  2866. draggable: ( c.currentItem || c.element ),
  2867. helper: c.helper,
  2868. position: c.position,
  2869. offset: c.positionAbs
  2870. };
  2871. },
  2872. // Extension points just to make backcompat sane and avoid duplicating logic
  2873. // TODO: Remove in 1.14 along with call to it below
  2874. _addHoverClass: function() {
  2875. this._addClass( "ui-droppable-hover" );
  2876. },
  2877. _removeHoverClass: function() {
  2878. this._removeClass( "ui-droppable-hover" );
  2879. },
  2880. _addActiveClass: function() {
  2881. this._addClass( "ui-droppable-active" );
  2882. },
  2883. _removeActiveClass: function() {
  2884. this._removeClass( "ui-droppable-active" );
  2885. }
  2886. } );
  2887. $.ui.intersect = ( function() {
  2888. function isOverAxis( x, reference, size ) {
  2889. return ( x >= reference ) && ( x < ( reference + size ) );
  2890. }
  2891. return function( draggable, droppable, toleranceMode, event ) {
  2892. if ( !droppable.offset ) {
  2893. return false;
  2894. }
  2895. var x1 = ( draggable.positionAbs ||
  2896. draggable.position.absolute ).left + draggable.margins.left,
  2897. y1 = ( draggable.positionAbs ||
  2898. draggable.position.absolute ).top + draggable.margins.top,
  2899. x2 = x1 + draggable.helperProportions.width,
  2900. y2 = y1 + draggable.helperProportions.height,
  2901. l = droppable.offset.left,
  2902. t = droppable.offset.top,
  2903. r = l + droppable.proportions().width,
  2904. b = t + droppable.proportions().height;
  2905. switch ( toleranceMode ) {
  2906. case "fit":
  2907. return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
  2908. case "intersect":
  2909. return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half
  2910. x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half
  2911. t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
  2912. y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
  2913. case "pointer":
  2914. return isOverAxis( event.pageY, t, droppable.proportions().height ) &&
  2915. isOverAxis( event.pageX, l, droppable.proportions().width );
  2916. case "touch":
  2917. return (
  2918. ( y1 >= t && y1 <= b ) || // Top edge touching
  2919. ( y2 >= t && y2 <= b ) || // Bottom edge touching
  2920. ( y1 < t && y2 > b ) // Surrounded vertically
  2921. ) && (
  2922. ( x1 >= l && x1 <= r ) || // Left edge touching
  2923. ( x2 >= l && x2 <= r ) || // Right edge touching
  2924. ( x1 < l && x2 > r ) // Surrounded horizontally
  2925. );
  2926. default:
  2927. return false;
  2928. }
  2929. };
  2930. } )();
  2931. /*
  2932. This manager tracks offsets of draggables and droppables
  2933. */
  2934. $.ui.ddmanager = {
  2935. current: null,
  2936. droppables: { "default": [] },
  2937. prepareOffsets: function( t, event ) {
  2938. var i, j,
  2939. m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
  2940. type = event ? event.type : null, // workaround for #2317
  2941. list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack();
  2942. droppablesLoop: for ( i = 0; i < m.length; i++ ) {
  2943. // No disabled and non-accepted
  2944. if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ],
  2945. ( t.currentItem || t.element ) ) ) ) {
  2946. continue;
  2947. }
  2948. // Filter out elements in the current dragged item
  2949. for ( j = 0; j < list.length; j++ ) {
  2950. if ( list[ j ] === m[ i ].element[ 0 ] ) {
  2951. m[ i ].proportions().height = 0;
  2952. continue droppablesLoop;
  2953. }
  2954. }
  2955. m[ i ].visible = m[ i ].element.css( "display" ) !== "none";
  2956. if ( !m[ i ].visible ) {
  2957. continue;
  2958. }
  2959. // Activate the droppable if used directly from draggables
  2960. if ( type === "mousedown" ) {
  2961. m[ i ]._activate.call( m[ i ], event );
  2962. }
  2963. m[ i ].offset = m[ i ].element.offset();
  2964. m[ i ].proportions( {
  2965. width: m[ i ].element[ 0 ].offsetWidth,
  2966. height: m[ i ].element[ 0 ].offsetHeight
  2967. } );
  2968. }
  2969. },
  2970. drop: function( draggable, event ) {
  2971. var dropped = false;
  2972. // Create a copy of the droppables in case the list changes during the drop (#9116)
  2973. $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() {
  2974. if ( !this.options ) {
  2975. return;
  2976. }
  2977. if ( !this.options.disabled && this.visible &&
  2978. $.ui.intersect( draggable, this, this.options.tolerance, event ) ) {
  2979. dropped = this._drop.call( this, event ) || dropped;
  2980. }
  2981. if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ],
  2982. ( draggable.currentItem || draggable.element ) ) ) {
  2983. this.isout = true;
  2984. this.isover = false;
  2985. this._deactivate.call( this, event );
  2986. }
  2987. } );
  2988. return dropped;
  2989. },
  2990. dragStart: function( draggable, event ) {
  2991. // Listen for scrolling so that if the dragging causes scrolling the position of the
  2992. // droppables can be recalculated (see #5003)
  2993. draggable.element.parentsUntil( "body" ).on( "scroll.droppable", function() {
  2994. if ( !draggable.options.refreshPositions ) {
  2995. $.ui.ddmanager.prepareOffsets( draggable, event );
  2996. }
  2997. } );
  2998. },
  2999. drag: function( draggable, event ) {
  3000. // If you have a highly dynamic page, you might try this option. It renders positions
  3001. // every time you move the mouse.
  3002. if ( draggable.options.refreshPositions ) {
  3003. $.ui.ddmanager.prepareOffsets( draggable, event );
  3004. }
  3005. // Run through all droppables and check their positions based on specific tolerance options
  3006. $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() {
  3007. if ( this.options.disabled || this.greedyChild || !this.visible ) {
  3008. return;
  3009. }
  3010. var parentInstance, scope, parent,
  3011. intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ),
  3012. c = !intersects && this.isover ?
  3013. "isout" :
  3014. ( intersects && !this.isover ? "isover" : null );
  3015. if ( !c ) {
  3016. return;
  3017. }
  3018. if ( this.options.greedy ) {
  3019. // find droppable parents with same scope
  3020. scope = this.options.scope;
  3021. parent = this.element.parents( ":data(ui-droppable)" ).filter( function() {
  3022. return $( this ).droppable( "instance" ).options.scope === scope;
  3023. } );
  3024. if ( parent.length ) {
  3025. parentInstance = $( parent[ 0 ] ).droppable( "instance" );
  3026. parentInstance.greedyChild = ( c === "isover" );
  3027. }
  3028. }
  3029. // We just moved into a greedy child
  3030. if ( parentInstance && c === "isover" ) {
  3031. parentInstance.isover = false;
  3032. parentInstance.isout = true;
  3033. parentInstance._out.call( parentInstance, event );
  3034. }
  3035. this[ c ] = true;
  3036. this[ c === "isout" ? "isover" : "isout" ] = false;
  3037. this[ c === "isover" ? "_over" : "_out" ].call( this, event );
  3038. // We just moved out of a greedy child
  3039. if ( parentInstance && c === "isout" ) {
  3040. parentInstance.isout = false;
  3041. parentInstance.isover = true;
  3042. parentInstance._over.call( parentInstance, event );
  3043. }
  3044. } );
  3045. },
  3046. dragStop: function( draggable, event ) {
  3047. draggable.element.parentsUntil( "body" ).off( "scroll.droppable" );
  3048. // Call prepareOffsets one final time since IE does not fire return scroll events when
  3049. // overflow was caused by drag (see #5003)
  3050. if ( !draggable.options.refreshPositions ) {
  3051. $.ui.ddmanager.prepareOffsets( draggable, event );
  3052. }
  3053. }
  3054. };
  3055. // DEPRECATED
  3056. // TODO: switch return back to widget declaration at top of file when this is removed
  3057. if ( $.uiBackCompat !== false ) {
  3058. // Backcompat for activeClass and hoverClass options
  3059. $.widget( "ui.droppable", $.ui.droppable, {
  3060. options: {
  3061. hoverClass: false,
  3062. activeClass: false
  3063. },
  3064. _addActiveClass: function() {
  3065. this._super();
  3066. if ( this.options.activeClass ) {
  3067. this.element.addClass( this.options.activeClass );
  3068. }
  3069. },
  3070. _removeActiveClass: function() {
  3071. this._super();
  3072. if ( this.options.activeClass ) {
  3073. this.element.removeClass( this.options.activeClass );
  3074. }
  3075. },
  3076. _addHoverClass: function() {
  3077. this._super();
  3078. if ( this.options.hoverClass ) {
  3079. this.element.addClass( this.options.hoverClass );
  3080. }
  3081. },
  3082. _removeHoverClass: function() {
  3083. this._super();
  3084. if ( this.options.hoverClass ) {
  3085. this.element.removeClass( this.options.hoverClass );
  3086. }
  3087. }
  3088. } );
  3089. }
  3090. var widgetsDroppable = $.ui.droppable;
  3091. /*!
  3092. * jQuery UI Resizable 1.13.2
  3093. * http://jqueryui.com
  3094. *
  3095. * Copyright jQuery Foundation and other contributors
  3096. * Released under the MIT license.
  3097. * http://jquery.org/license
  3098. */
  3099. //>>label: Resizable
  3100. //>>group: Interactions
  3101. //>>description: Enables resize functionality for any element.
  3102. //>>docs: http://api.jqueryui.com/resizable/
  3103. //>>demos: http://jqueryui.com/resizable/
  3104. //>>css.structure: ../../themes/base/core.css
  3105. //>>css.structure: ../../themes/base/resizable.css
  3106. //>>css.theme: ../../themes/base/theme.css
  3107. $.widget( "ui.resizable", $.ui.mouse, {
  3108. version: "1.13.2",
  3109. widgetEventPrefix: "resize",
  3110. options: {
  3111. alsoResize: false,
  3112. animate: false,
  3113. animateDuration: "slow",
  3114. animateEasing: "swing",
  3115. aspectRatio: false,
  3116. autoHide: false,
  3117. classes: {
  3118. "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se"
  3119. },
  3120. containment: false,
  3121. ghost: false,
  3122. grid: false,
  3123. handles: "e,s,se",
  3124. helper: false,
  3125. maxHeight: null,
  3126. maxWidth: null,
  3127. minHeight: 10,
  3128. minWidth: 10,
  3129. // See #7960
  3130. zIndex: 90,
  3131. // Callbacks
  3132. resize: null,
  3133. start: null,
  3134. stop: null
  3135. },
  3136. _num: function( value ) {
  3137. return parseFloat( value ) || 0;
  3138. },
  3139. _isNumber: function( value ) {
  3140. return !isNaN( parseFloat( value ) );
  3141. },
  3142. _hasScroll: function( el, a ) {
  3143. if ( $( el ).css( "overflow" ) === "hidden" ) {
  3144. return false;
  3145. }
  3146. var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
  3147. has = false;
  3148. if ( el[ scroll ] > 0 ) {
  3149. return true;
  3150. }
  3151. // TODO: determine which cases actually cause this to happen
  3152. // if the element doesn't have the scroll set, see if it's possible to
  3153. // set the scroll
  3154. try {
  3155. el[ scroll ] = 1;
  3156. has = ( el[ scroll ] > 0 );
  3157. el[ scroll ] = 0;
  3158. } catch ( e ) {
  3159. // `el` might be a string, then setting `scroll` will throw
  3160. // an error in strict mode; ignore it.
  3161. }
  3162. return has;
  3163. },
  3164. _create: function() {
  3165. var margins,
  3166. o = this.options,
  3167. that = this;
  3168. this._addClass( "ui-resizable" );
  3169. $.extend( this, {
  3170. _aspectRatio: !!( o.aspectRatio ),
  3171. aspectRatio: o.aspectRatio,
  3172. originalElement: this.element,
  3173. _proportionallyResizeElements: [],
  3174. _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
  3175. } );
  3176. // Wrap the element if it cannot hold child nodes
  3177. if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) {
  3178. this.element.wrap(
  3179. $( "<div class='ui-wrapper'></div>" ).css( {
  3180. overflow: "hidden",
  3181. position: this.element.css( "position" ),
  3182. width: this.element.outerWidth(),
  3183. height: this.element.outerHeight(),
  3184. top: this.element.css( "top" ),
  3185. left: this.element.css( "left" )
  3186. } )
  3187. );
  3188. this.element = this.element.parent().data(
  3189. "ui-resizable", this.element.resizable( "instance" )
  3190. );
  3191. this.elementIsWrapper = true;
  3192. margins = {
  3193. marginTop: this.originalElement.css( "marginTop" ),
  3194. marginRight: this.originalElement.css( "marginRight" ),
  3195. marginBottom: this.originalElement.css( "marginBottom" ),
  3196. marginLeft: this.originalElement.css( "marginLeft" )
  3197. };
  3198. this.element.css( margins );
  3199. this.originalElement.css( "margin", 0 );
  3200. // support: Safari
  3201. // Prevent Safari textarea resize
  3202. this.originalResizeStyle = this.originalElement.css( "resize" );
  3203. this.originalElement.css( "resize", "none" );
  3204. this._proportionallyResizeElements.push( this.originalElement.css( {
  3205. position: "static",
  3206. zoom: 1,
  3207. display: "block"
  3208. } ) );
  3209. // Support: IE9
  3210. // avoid IE jump (hard set the margin)
  3211. this.originalElement.css( margins );
  3212. this._proportionallyResize();
  3213. }
  3214. this._setupHandles();
  3215. if ( o.autoHide ) {
  3216. $( this.element )
  3217. .on( "mouseenter", function() {
  3218. if ( o.disabled ) {
  3219. return;
  3220. }
  3221. that._removeClass( "ui-resizable-autohide" );
  3222. that._handles.show();
  3223. } )
  3224. .on( "mouseleave", function() {
  3225. if ( o.disabled ) {
  3226. return;
  3227. }
  3228. if ( !that.resizing ) {
  3229. that._addClass( "ui-resizable-autohide" );
  3230. that._handles.hide();
  3231. }
  3232. } );
  3233. }
  3234. this._mouseInit();
  3235. },
  3236. _destroy: function() {
  3237. this._mouseDestroy();
  3238. this._addedHandles.remove();
  3239. var wrapper,
  3240. _destroy = function( exp ) {
  3241. $( exp )
  3242. .removeData( "resizable" )
  3243. .removeData( "ui-resizable" )
  3244. .off( ".resizable" );
  3245. };
  3246. // TODO: Unwrap at same DOM position
  3247. if ( this.elementIsWrapper ) {
  3248. _destroy( this.element );
  3249. wrapper = this.element;
  3250. this.originalElement.css( {
  3251. position: wrapper.css( "position" ),
  3252. width: wrapper.outerWidth(),
  3253. height: wrapper.outerHeight(),
  3254. top: wrapper.css( "top" ),
  3255. left: wrapper.css( "left" )
  3256. } ).insertAfter( wrapper );
  3257. wrapper.remove();
  3258. }
  3259. this.originalElement.css( "resize", this.originalResizeStyle );
  3260. _destroy( this.originalElement );
  3261. return this;
  3262. },
  3263. _setOption: function( key, value ) {
  3264. this._super( key, value );
  3265. switch ( key ) {
  3266. case "handles":
  3267. this._removeHandles();
  3268. this._setupHandles();
  3269. break;
  3270. case "aspectRatio":
  3271. this._aspectRatio = !!value;
  3272. break;
  3273. default:
  3274. break;
  3275. }
  3276. },
  3277. _setupHandles: function() {
  3278. var o = this.options, handle, i, n, hname, axis, that = this;
  3279. this.handles = o.handles ||
  3280. ( !$( ".ui-resizable-handle", this.element ).length ?
  3281. "e,s,se" : {
  3282. n: ".ui-resizable-n",
  3283. e: ".ui-resizable-e",
  3284. s: ".ui-resizable-s",
  3285. w: ".ui-resizable-w",
  3286. se: ".ui-resizable-se",
  3287. sw: ".ui-resizable-sw",
  3288. ne: ".ui-resizable-ne",
  3289. nw: ".ui-resizable-nw"
  3290. } );
  3291. this._handles = $();
  3292. this._addedHandles = $();
  3293. if ( this.handles.constructor === String ) {
  3294. if ( this.handles === "all" ) {
  3295. this.handles = "n,e,s,w,se,sw,ne,nw";
  3296. }
  3297. n = this.handles.split( "," );
  3298. this.handles = {};
  3299. for ( i = 0; i < n.length; i++ ) {
  3300. handle = String.prototype.trim.call( n[ i ] );
  3301. hname = "ui-resizable-" + handle;
  3302. axis = $( "<div>" );
  3303. this._addClass( axis, "ui-resizable-handle " + hname );
  3304. axis.css( { zIndex: o.zIndex } );
  3305. this.handles[ handle ] = ".ui-resizable-" + handle;
  3306. if ( !this.element.children( this.handles[ handle ] ).length ) {
  3307. this.element.append( axis );
  3308. this._addedHandles = this._addedHandles.add( axis );
  3309. }
  3310. }
  3311. }
  3312. this._renderAxis = function( target ) {
  3313. var i, axis, padPos, padWrapper;
  3314. target = target || this.element;
  3315. for ( i in this.handles ) {
  3316. if ( this.handles[ i ].constructor === String ) {
  3317. this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show();
  3318. } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) {
  3319. this.handles[ i ] = $( this.handles[ i ] );
  3320. this._on( this.handles[ i ], { "mousedown": that._mouseDown } );
  3321. }
  3322. if ( this.elementIsWrapper &&
  3323. this.originalElement[ 0 ]
  3324. .nodeName
  3325. .match( /^(textarea|input|select|button)$/i ) ) {
  3326. axis = $( this.handles[ i ], this.element );
  3327. padWrapper = /sw|ne|nw|se|n|s/.test( i ) ?
  3328. axis.outerHeight() :
  3329. axis.outerWidth();
  3330. padPos = [ "padding",
  3331. /ne|nw|n/.test( i ) ? "Top" :
  3332. /se|sw|s/.test( i ) ? "Bottom" :
  3333. /^e$/.test( i ) ? "Right" : "Left" ].join( "" );
  3334. target.css( padPos, padWrapper );
  3335. this._proportionallyResize();
  3336. }
  3337. this._handles = this._handles.add( this.handles[ i ] );
  3338. }
  3339. };
  3340. // TODO: make renderAxis a prototype function
  3341. this._renderAxis( this.element );
  3342. this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) );
  3343. this._handles.disableSelection();
  3344. this._handles.on( "mouseover", function() {
  3345. if ( !that.resizing ) {
  3346. if ( this.className ) {
  3347. axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i );
  3348. }
  3349. that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se";
  3350. }
  3351. } );
  3352. if ( o.autoHide ) {
  3353. this._handles.hide();
  3354. this._addClass( "ui-resizable-autohide" );
  3355. }
  3356. },
  3357. _removeHandles: function() {
  3358. this._addedHandles.remove();
  3359. },
  3360. _mouseCapture: function( event ) {
  3361. var i, handle,
  3362. capture = false;
  3363. for ( i in this.handles ) {
  3364. handle = $( this.handles[ i ] )[ 0 ];
  3365. if ( handle === event.target || $.contains( handle, event.target ) ) {
  3366. capture = true;
  3367. }
  3368. }
  3369. return !this.options.disabled && capture;
  3370. },
  3371. _mouseStart: function( event ) {
  3372. var curleft, curtop, cursor,
  3373. o = this.options,
  3374. el = this.element;
  3375. this.resizing = true;
  3376. this._renderProxy();
  3377. curleft = this._num( this.helper.css( "left" ) );
  3378. curtop = this._num( this.helper.css( "top" ) );
  3379. if ( o.containment ) {
  3380. curleft += $( o.containment ).scrollLeft() || 0;
  3381. curtop += $( o.containment ).scrollTop() || 0;
  3382. }
  3383. this.offset = this.helper.offset();
  3384. this.position = { left: curleft, top: curtop };
  3385. this.size = this._helper ? {
  3386. width: this.helper.width(),
  3387. height: this.helper.height()
  3388. } : {
  3389. width: el.width(),
  3390. height: el.height()
  3391. };
  3392. this.originalSize = this._helper ? {
  3393. width: el.outerWidth(),
  3394. height: el.outerHeight()
  3395. } : {
  3396. width: el.width(),
  3397. height: el.height()
  3398. };
  3399. this.sizeDiff = {
  3400. width: el.outerWidth() - el.width(),
  3401. height: el.outerHeight() - el.height()
  3402. };
  3403. this.originalPosition = { left: curleft, top: curtop };
  3404. this.originalMousePosition = { left: event.pageX, top: event.pageY };
  3405. this.aspectRatio = ( typeof o.aspectRatio === "number" ) ?
  3406. o.aspectRatio :
  3407. ( ( this.originalSize.width / this.originalSize.height ) || 1 );
  3408. cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" );
  3409. $( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor );
  3410. this._addClass( "ui-resizable-resizing" );
  3411. this._propagate( "start", event );
  3412. return true;
  3413. },
  3414. _mouseDrag: function( event ) {
  3415. var data, props,
  3416. smp = this.originalMousePosition,
  3417. a = this.axis,
  3418. dx = ( event.pageX - smp.left ) || 0,
  3419. dy = ( event.pageY - smp.top ) || 0,
  3420. trigger = this._change[ a ];
  3421. this._updatePrevProperties();
  3422. if ( !trigger ) {
  3423. return false;
  3424. }
  3425. data = trigger.apply( this, [ event, dx, dy ] );
  3426. this._updateVirtualBoundaries( event.shiftKey );
  3427. if ( this._aspectRatio || event.shiftKey ) {
  3428. data = this._updateRatio( data, event );
  3429. }
  3430. data = this._respectSize( data, event );
  3431. this._updateCache( data );
  3432. this._propagate( "resize", event );
  3433. props = this._applyChanges();
  3434. if ( !this._helper && this._proportionallyResizeElements.length ) {
  3435. this._proportionallyResize();
  3436. }
  3437. if ( !$.isEmptyObject( props ) ) {
  3438. this._updatePrevProperties();
  3439. this._trigger( "resize", event, this.ui() );
  3440. this._applyChanges();
  3441. }
  3442. return false;
  3443. },
  3444. _mouseStop: function( event ) {
  3445. this.resizing = false;
  3446. var pr, ista, soffseth, soffsetw, s, left, top,
  3447. o = this.options, that = this;
  3448. if ( this._helper ) {
  3449. pr = this._proportionallyResizeElements;
  3450. ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName );
  3451. soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height;
  3452. soffsetw = ista ? 0 : that.sizeDiff.width;
  3453. s = {
  3454. width: ( that.helper.width() - soffsetw ),
  3455. height: ( that.helper.height() - soffseth )
  3456. };
  3457. left = ( parseFloat( that.element.css( "left" ) ) +
  3458. ( that.position.left - that.originalPosition.left ) ) || null;
  3459. top = ( parseFloat( that.element.css( "top" ) ) +
  3460. ( that.position.top - that.originalPosition.top ) ) || null;
  3461. if ( !o.animate ) {
  3462. this.element.css( $.extend( s, { top: top, left: left } ) );
  3463. }
  3464. that.helper.height( that.size.height );
  3465. that.helper.width( that.size.width );
  3466. if ( this._helper && !o.animate ) {
  3467. this._proportionallyResize();
  3468. }
  3469. }
  3470. $( "body" ).css( "cursor", "auto" );
  3471. this._removeClass( "ui-resizable-resizing" );
  3472. this._propagate( "stop", event );
  3473. if ( this._helper ) {
  3474. this.helper.remove();
  3475. }
  3476. return false;
  3477. },
  3478. _updatePrevProperties: function() {
  3479. this.prevPosition = {
  3480. top: this.position.top,
  3481. left: this.position.left
  3482. };
  3483. this.prevSize = {
  3484. width: this.size.width,
  3485. height: this.size.height
  3486. };
  3487. },
  3488. _applyChanges: function() {
  3489. var props = {};
  3490. if ( this.position.top !== this.prevPosition.top ) {
  3491. props.top = this.position.top + "px";
  3492. }
  3493. if ( this.position.left !== this.prevPosition.left ) {
  3494. props.left = this.position.left + "px";
  3495. }
  3496. if ( this.size.width !== this.prevSize.width ) {
  3497. props.width = this.size.width + "px";
  3498. }
  3499. if ( this.size.height !== this.prevSize.height ) {
  3500. props.height = this.size.height + "px";
  3501. }
  3502. this.helper.css( props );
  3503. return props;
  3504. },
  3505. _updateVirtualBoundaries: function( forceAspectRatio ) {
  3506. var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
  3507. o = this.options;
  3508. b = {
  3509. minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0,
  3510. maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity,
  3511. minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0,
  3512. maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity
  3513. };
  3514. if ( this._aspectRatio || forceAspectRatio ) {
  3515. pMinWidth = b.minHeight * this.aspectRatio;
  3516. pMinHeight = b.minWidth / this.aspectRatio;
  3517. pMaxWidth = b.maxHeight * this.aspectRatio;
  3518. pMaxHeight = b.maxWidth / this.aspectRatio;
  3519. if ( pMinWidth > b.minWidth ) {
  3520. b.minWidth = pMinWidth;
  3521. }
  3522. if ( pMinHeight > b.minHeight ) {
  3523. b.minHeight = pMinHeight;
  3524. }
  3525. if ( pMaxWidth < b.maxWidth ) {
  3526. b.maxWidth = pMaxWidth;
  3527. }
  3528. if ( pMaxHeight < b.maxHeight ) {
  3529. b.maxHeight = pMaxHeight;
  3530. }
  3531. }
  3532. this._vBoundaries = b;
  3533. },
  3534. _updateCache: function( data ) {
  3535. this.offset = this.helper.offset();
  3536. if ( this._isNumber( data.left ) ) {
  3537. this.position.left = data.left;
  3538. }
  3539. if ( this._isNumber( data.top ) ) {
  3540. this.position.top = data.top;
  3541. }
  3542. if ( this._isNumber( data.height ) ) {
  3543. this.size.height = data.height;
  3544. }
  3545. if ( this._isNumber( data.width ) ) {
  3546. this.size.width = data.width;
  3547. }
  3548. },
  3549. _updateRatio: function( data ) {
  3550. var cpos = this.position,
  3551. csize = this.size,
  3552. a = this.axis;
  3553. if ( this._isNumber( data.height ) ) {
  3554. data.width = ( data.height * this.aspectRatio );
  3555. } else if ( this._isNumber( data.width ) ) {
  3556. data.height = ( data.width / this.aspectRatio );
  3557. }
  3558. if ( a === "sw" ) {
  3559. data.left = cpos.left + ( csize.width - data.width );
  3560. data.top = null;
  3561. }
  3562. if ( a === "nw" ) {
  3563. data.top = cpos.top + ( csize.height - data.height );
  3564. data.left = cpos.left + ( csize.width - data.width );
  3565. }
  3566. return data;
  3567. },
  3568. _respectSize: function( data ) {
  3569. var o = this._vBoundaries,
  3570. a = this.axis,
  3571. ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ),
  3572. ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ),
  3573. isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ),
  3574. isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ),
  3575. dw = this.originalPosition.left + this.originalSize.width,
  3576. dh = this.originalPosition.top + this.originalSize.height,
  3577. cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a );
  3578. if ( isminw ) {
  3579. data.width = o.minWidth;
  3580. }
  3581. if ( isminh ) {
  3582. data.height = o.minHeight;
  3583. }
  3584. if ( ismaxw ) {
  3585. data.width = o.maxWidth;
  3586. }
  3587. if ( ismaxh ) {
  3588. data.height = o.maxHeight;
  3589. }
  3590. if ( isminw && cw ) {
  3591. data.left = dw - o.minWidth;
  3592. }
  3593. if ( ismaxw && cw ) {
  3594. data.left = dw - o.maxWidth;
  3595. }
  3596. if ( isminh && ch ) {
  3597. data.top = dh - o.minHeight;
  3598. }
  3599. if ( ismaxh && ch ) {
  3600. data.top = dh - o.maxHeight;
  3601. }
  3602. // Fixing jump error on top/left - bug #2330
  3603. if ( !data.width && !data.height && !data.left && data.top ) {
  3604. data.top = null;
  3605. } else if ( !data.width && !data.height && !data.top && data.left ) {
  3606. data.left = null;
  3607. }
  3608. return data;
  3609. },
  3610. _getPaddingPlusBorderDimensions: function( element ) {
  3611. var i = 0,
  3612. widths = [],
  3613. borders = [
  3614. element.css( "borderTopWidth" ),
  3615. element.css( "borderRightWidth" ),
  3616. element.css( "borderBottomWidth" ),
  3617. element.css( "borderLeftWidth" )
  3618. ],
  3619. paddings = [
  3620. element.css( "paddingTop" ),
  3621. element.css( "paddingRight" ),
  3622. element.css( "paddingBottom" ),
  3623. element.css( "paddingLeft" )
  3624. ];
  3625. for ( ; i < 4; i++ ) {
  3626. widths[ i ] = ( parseFloat( borders[ i ] ) || 0 );
  3627. widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 );
  3628. }
  3629. return {
  3630. height: widths[ 0 ] + widths[ 2 ],
  3631. width: widths[ 1 ] + widths[ 3 ]
  3632. };
  3633. },
  3634. _proportionallyResize: function() {
  3635. if ( !this._proportionallyResizeElements.length ) {
  3636. return;
  3637. }
  3638. var prel,
  3639. i = 0,
  3640. element = this.helper || this.element;
  3641. for ( ; i < this._proportionallyResizeElements.length; i++ ) {
  3642. prel = this._proportionallyResizeElements[ i ];
  3643. // TODO: Seems like a bug to cache this.outerDimensions
  3644. // considering that we are in a loop.
  3645. if ( !this.outerDimensions ) {
  3646. this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
  3647. }
  3648. prel.css( {
  3649. height: ( element.height() - this.outerDimensions.height ) || 0,
  3650. width: ( element.width() - this.outerDimensions.width ) || 0
  3651. } );
  3652. }
  3653. },
  3654. _renderProxy: function() {
  3655. var el = this.element, o = this.options;
  3656. this.elementOffset = el.offset();
  3657. if ( this._helper ) {
  3658. this.helper = this.helper || $( "<div></div>" ).css( { overflow: "hidden" } );
  3659. this._addClass( this.helper, this._helper );
  3660. this.helper.css( {
  3661. width: this.element.outerWidth(),
  3662. height: this.element.outerHeight(),
  3663. position: "absolute",
  3664. left: this.elementOffset.left + "px",
  3665. top: this.elementOffset.top + "px",
  3666. zIndex: ++o.zIndex //TODO: Don't modify option
  3667. } );
  3668. this.helper
  3669. .appendTo( "body" )
  3670. .disableSelection();
  3671. } else {
  3672. this.helper = this.element;
  3673. }
  3674. },
  3675. _change: {
  3676. e: function( event, dx ) {
  3677. return { width: this.originalSize.width + dx };
  3678. },
  3679. w: function( event, dx ) {
  3680. var cs = this.originalSize, sp = this.originalPosition;
  3681. return { left: sp.left + dx, width: cs.width - dx };
  3682. },
  3683. n: function( event, dx, dy ) {
  3684. var cs = this.originalSize, sp = this.originalPosition;
  3685. return { top: sp.top + dy, height: cs.height - dy };
  3686. },
  3687. s: function( event, dx, dy ) {
  3688. return { height: this.originalSize.height + dy };
  3689. },
  3690. se: function( event, dx, dy ) {
  3691. return $.extend( this._change.s.apply( this, arguments ),
  3692. this._change.e.apply( this, [ event, dx, dy ] ) );
  3693. },
  3694. sw: function( event, dx, dy ) {
  3695. return $.extend( this._change.s.apply( this, arguments ),
  3696. this._change.w.apply( this, [ event, dx, dy ] ) );
  3697. },
  3698. ne: function( event, dx, dy ) {
  3699. return $.extend( this._change.n.apply( this, arguments ),
  3700. this._change.e.apply( this, [ event, dx, dy ] ) );
  3701. },
  3702. nw: function( event, dx, dy ) {
  3703. return $.extend( this._change.n.apply( this, arguments ),
  3704. this._change.w.apply( this, [ event, dx, dy ] ) );
  3705. }
  3706. },
  3707. _propagate: function( n, event ) {
  3708. $.ui.plugin.call( this, n, [ event, this.ui() ] );
  3709. if ( n !== "resize" ) {
  3710. this._trigger( n, event, this.ui() );
  3711. }
  3712. },
  3713. plugins: {},
  3714. ui: function() {
  3715. return {
  3716. originalElement: this.originalElement,
  3717. element: this.element,
  3718. helper: this.helper,
  3719. position: this.position,
  3720. size: this.size,
  3721. originalSize: this.originalSize,
  3722. originalPosition: this.originalPosition
  3723. };
  3724. }
  3725. } );
  3726. /*
  3727. * Resizable Extensions
  3728. */
  3729. $.ui.plugin.add( "resizable", "animate", {
  3730. stop: function( event ) {
  3731. var that = $( this ).resizable( "instance" ),
  3732. o = that.options,
  3733. pr = that._proportionallyResizeElements,
  3734. ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ),
  3735. soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height,
  3736. soffsetw = ista ? 0 : that.sizeDiff.width,
  3737. style = {
  3738. width: ( that.size.width - soffsetw ),
  3739. height: ( that.size.height - soffseth )
  3740. },
  3741. left = ( parseFloat( that.element.css( "left" ) ) +
  3742. ( that.position.left - that.originalPosition.left ) ) || null,
  3743. top = ( parseFloat( that.element.css( "top" ) ) +
  3744. ( that.position.top - that.originalPosition.top ) ) || null;
  3745. that.element.animate(
  3746. $.extend( style, top && left ? { top: top, left: left } : {} ), {
  3747. duration: o.animateDuration,
  3748. easing: o.animateEasing,
  3749. step: function() {
  3750. var data = {
  3751. width: parseFloat( that.element.css( "width" ) ),
  3752. height: parseFloat( that.element.css( "height" ) ),
  3753. top: parseFloat( that.element.css( "top" ) ),
  3754. left: parseFloat( that.element.css( "left" ) )
  3755. };
  3756. if ( pr && pr.length ) {
  3757. $( pr[ 0 ] ).css( { width: data.width, height: data.height } );
  3758. }
  3759. // Propagating resize, and updating values for each animation step
  3760. that._updateCache( data );
  3761. that._propagate( "resize", event );
  3762. }
  3763. }
  3764. );
  3765. }
  3766. } );
  3767. $.ui.plugin.add( "resizable", "containment", {
  3768. start: function() {
  3769. var element, p, co, ch, cw, width, height,
  3770. that = $( this ).resizable( "instance" ),
  3771. o = that.options,
  3772. el = that.element,
  3773. oc = o.containment,
  3774. ce = ( oc instanceof $ ) ?
  3775. oc.get( 0 ) :
  3776. ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc;
  3777. if ( !ce ) {
  3778. return;
  3779. }
  3780. that.containerElement = $( ce );
  3781. if ( /document/.test( oc ) || oc === document ) {
  3782. that.containerOffset = {
  3783. left: 0,
  3784. top: 0
  3785. };
  3786. that.containerPosition = {
  3787. left: 0,
  3788. top: 0
  3789. };
  3790. that.parentData = {
  3791. element: $( document ),
  3792. left: 0,
  3793. top: 0,
  3794. width: $( document ).width(),
  3795. height: $( document ).height() || document.body.parentNode.scrollHeight
  3796. };
  3797. } else {
  3798. element = $( ce );
  3799. p = [];
  3800. $( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) {
  3801. p[ i ] = that._num( element.css( "padding" + name ) );
  3802. } );
  3803. that.containerOffset = element.offset();
  3804. that.containerPosition = element.position();
  3805. that.containerSize = {
  3806. height: ( element.innerHeight() - p[ 3 ] ),
  3807. width: ( element.innerWidth() - p[ 1 ] )
  3808. };
  3809. co = that.containerOffset;
  3810. ch = that.containerSize.height;
  3811. cw = that.containerSize.width;
  3812. width = ( that._hasScroll( ce, "left" ) ? ce.scrollWidth : cw );
  3813. height = ( that._hasScroll( ce ) ? ce.scrollHeight : ch );
  3814. that.parentData = {
  3815. element: ce,
  3816. left: co.left,
  3817. top: co.top,
  3818. width: width,
  3819. height: height
  3820. };
  3821. }
  3822. },
  3823. resize: function( event ) {
  3824. var woset, hoset, isParent, isOffsetRelative,
  3825. that = $( this ).resizable( "instance" ),
  3826. o = that.options,
  3827. co = that.containerOffset,
  3828. cp = that.position,
  3829. pRatio = that._aspectRatio || event.shiftKey,
  3830. cop = {
  3831. top: 0,
  3832. left: 0
  3833. },
  3834. ce = that.containerElement,
  3835. continueResize = true;
  3836. if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {
  3837. cop = co;
  3838. }
  3839. if ( cp.left < ( that._helper ? co.left : 0 ) ) {
  3840. that.size.width = that.size.width +
  3841. ( that._helper ?
  3842. ( that.position.left - co.left ) :
  3843. ( that.position.left - cop.left ) );
  3844. if ( pRatio ) {
  3845. that.size.height = that.size.width / that.aspectRatio;
  3846. continueResize = false;
  3847. }
  3848. that.position.left = o.helper ? co.left : 0;
  3849. }
  3850. if ( cp.top < ( that._helper ? co.top : 0 ) ) {
  3851. that.size.height = that.size.height +
  3852. ( that._helper ?
  3853. ( that.position.top - co.top ) :
  3854. that.position.top );
  3855. if ( pRatio ) {
  3856. that.size.width = that.size.height * that.aspectRatio;
  3857. continueResize = false;
  3858. }
  3859. that.position.top = that._helper ? co.top : 0;
  3860. }
  3861. isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
  3862. isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );
  3863. if ( isParent && isOffsetRelative ) {
  3864. that.offset.left = that.parentData.left + that.position.left;
  3865. that.offset.top = that.parentData.top + that.position.top;
  3866. } else {
  3867. that.offset.left = that.element.offset().left;
  3868. that.offset.top = that.element.offset().top;
  3869. }
  3870. woset = Math.abs( that.sizeDiff.width +
  3871. ( that._helper ?
  3872. that.offset.left - cop.left :
  3873. ( that.offset.left - co.left ) ) );
  3874. hoset = Math.abs( that.sizeDiff.height +
  3875. ( that._helper ?
  3876. that.offset.top - cop.top :
  3877. ( that.offset.top - co.top ) ) );
  3878. if ( woset + that.size.width >= that.parentData.width ) {
  3879. that.size.width = that.parentData.width - woset;
  3880. if ( pRatio ) {
  3881. that.size.height = that.size.width / that.aspectRatio;
  3882. continueResize = false;
  3883. }
  3884. }
  3885. if ( hoset + that.size.height >= that.parentData.height ) {
  3886. that.size.height = that.parentData.height - hoset;
  3887. if ( pRatio ) {
  3888. that.size.width = that.size.height * that.aspectRatio;
  3889. continueResize = false;
  3890. }
  3891. }
  3892. if ( !continueResize ) {
  3893. that.position.left = that.prevPosition.left;
  3894. that.position.top = that.prevPosition.top;
  3895. that.size.width = that.prevSize.width;
  3896. that.size.height = that.prevSize.height;
  3897. }
  3898. },
  3899. stop: function() {
  3900. var that = $( this ).resizable( "instance" ),
  3901. o = that.options,
  3902. co = that.containerOffset,
  3903. cop = that.containerPosition,
  3904. ce = that.containerElement,
  3905. helper = $( that.helper ),
  3906. ho = helper.offset(),
  3907. w = helper.outerWidth() - that.sizeDiff.width,
  3908. h = helper.outerHeight() - that.sizeDiff.height;
  3909. if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {
  3910. $( this ).css( {
  3911. left: ho.left - cop.left - co.left,
  3912. width: w,
  3913. height: h
  3914. } );
  3915. }
  3916. if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {
  3917. $( this ).css( {
  3918. left: ho.left - cop.left - co.left,
  3919. width: w,
  3920. height: h
  3921. } );
  3922. }
  3923. }
  3924. } );
  3925. $.ui.plugin.add( "resizable", "alsoResize", {
  3926. start: function() {
  3927. var that = $( this ).resizable( "instance" ),
  3928. o = that.options;
  3929. $( o.alsoResize ).each( function() {
  3930. var el = $( this );
  3931. el.data( "ui-resizable-alsoresize", {
  3932. width: parseFloat( el.width() ), height: parseFloat( el.height() ),
  3933. left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) )
  3934. } );
  3935. } );
  3936. },
  3937. resize: function( event, ui ) {
  3938. var that = $( this ).resizable( "instance" ),
  3939. o = that.options,
  3940. os = that.originalSize,
  3941. op = that.originalPosition,
  3942. delta = {
  3943. height: ( that.size.height - os.height ) || 0,
  3944. width: ( that.size.width - os.width ) || 0,
  3945. top: ( that.position.top - op.top ) || 0,
  3946. left: ( that.position.left - op.left ) || 0
  3947. };
  3948. $( o.alsoResize ).each( function() {
  3949. var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {},
  3950. css = el.parents( ui.originalElement[ 0 ] ).length ?
  3951. [ "width", "height" ] :
  3952. [ "width", "height", "top", "left" ];
  3953. $.each( css, function( i, prop ) {
  3954. var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 );
  3955. if ( sum && sum >= 0 ) {
  3956. style[ prop ] = sum || null;
  3957. }
  3958. } );
  3959. el.css( style );
  3960. } );
  3961. },
  3962. stop: function() {
  3963. $( this ).removeData( "ui-resizable-alsoresize" );
  3964. }
  3965. } );
  3966. $.ui.plugin.add( "resizable", "ghost", {
  3967. start: function() {
  3968. var that = $( this ).resizable( "instance" ), cs = that.size;
  3969. that.ghost = that.originalElement.clone();
  3970. that.ghost.css( {
  3971. opacity: 0.25,
  3972. display: "block",
  3973. position: "relative",
  3974. height: cs.height,
  3975. width: cs.width,
  3976. margin: 0,
  3977. left: 0,
  3978. top: 0
  3979. } );
  3980. that._addClass( that.ghost, "ui-resizable-ghost" );
  3981. // DEPRECATED
  3982. // TODO: remove after 1.12
  3983. if ( $.uiBackCompat !== false && typeof that.options.ghost === "string" ) {
  3984. // Ghost option
  3985. that.ghost.addClass( this.options.ghost );
  3986. }
  3987. that.ghost.appendTo( that.helper );
  3988. },
  3989. resize: function() {
  3990. var that = $( this ).resizable( "instance" );
  3991. if ( that.ghost ) {
  3992. that.ghost.css( {
  3993. position: "relative",
  3994. height: that.size.height,
  3995. width: that.size.width
  3996. } );
  3997. }
  3998. },
  3999. stop: function() {
  4000. var that = $( this ).resizable( "instance" );
  4001. if ( that.ghost && that.helper ) {
  4002. that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) );
  4003. }
  4004. }
  4005. } );
  4006. $.ui.plugin.add( "resizable", "grid", {
  4007. resize: function() {
  4008. var outerDimensions,
  4009. that = $( this ).resizable( "instance" ),
  4010. o = that.options,
  4011. cs = that.size,
  4012. os = that.originalSize,
  4013. op = that.originalPosition,
  4014. a = that.axis,
  4015. grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
  4016. gridX = ( grid[ 0 ] || 1 ),
  4017. gridY = ( grid[ 1 ] || 1 ),
  4018. ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX,
  4019. oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY,
  4020. newWidth = os.width + ox,
  4021. newHeight = os.height + oy,
  4022. isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ),
  4023. isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ),
  4024. isMinWidth = o.minWidth && ( o.minWidth > newWidth ),
  4025. isMinHeight = o.minHeight && ( o.minHeight > newHeight );
  4026. o.grid = grid;
  4027. if ( isMinWidth ) {
  4028. newWidth += gridX;
  4029. }
  4030. if ( isMinHeight ) {
  4031. newHeight += gridY;
  4032. }
  4033. if ( isMaxWidth ) {
  4034. newWidth -= gridX;
  4035. }
  4036. if ( isMaxHeight ) {
  4037. newHeight -= gridY;
  4038. }
  4039. if ( /^(se|s|e)$/.test( a ) ) {
  4040. that.size.width = newWidth;
  4041. that.size.height = newHeight;
  4042. } else if ( /^(ne)$/.test( a ) ) {
  4043. that.size.width = newWidth;
  4044. that.size.height = newHeight;
  4045. that.position.top = op.top - oy;
  4046. } else if ( /^(sw)$/.test( a ) ) {
  4047. that.size.width = newWidth;
  4048. that.size.height = newHeight;
  4049. that.position.left = op.left - ox;
  4050. } else {
  4051. if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) {
  4052. outerDimensions = that._getPaddingPlusBorderDimensions( this );
  4053. }
  4054. if ( newHeight - gridY > 0 ) {
  4055. that.size.height = newHeight;
  4056. that.position.top = op.top - oy;
  4057. } else {
  4058. newHeight = gridY - outerDimensions.height;
  4059. that.size.height = newHeight;
  4060. that.position.top = op.top + os.height - newHeight;
  4061. }
  4062. if ( newWidth - gridX > 0 ) {
  4063. that.size.width = newWidth;
  4064. that.position.left = op.left - ox;
  4065. } else {
  4066. newWidth = gridX - outerDimensions.width;
  4067. that.size.width = newWidth;
  4068. that.position.left = op.left + os.width - newWidth;
  4069. }
  4070. }
  4071. }
  4072. } );
  4073. var widgetsResizable = $.ui.resizable;
  4074. /*!
  4075. * jQuery UI Selectable 1.13.2
  4076. * http://jqueryui.com
  4077. *
  4078. * Copyright jQuery Foundation and other contributors
  4079. * Released under the MIT license.
  4080. * http://jquery.org/license
  4081. */
  4082. //>>label: Selectable
  4083. //>>group: Interactions
  4084. //>>description: Allows groups of elements to be selected with the mouse.
  4085. //>>docs: http://api.jqueryui.com/selectable/
  4086. //>>demos: http://jqueryui.com/selectable/
  4087. //>>css.structure: ../../themes/base/selectable.css
  4088. var widgetsSelectable = $.widget( "ui.selectable", $.ui.mouse, {
  4089. version: "1.13.2",
  4090. options: {
  4091. appendTo: "body",
  4092. autoRefresh: true,
  4093. distance: 0,
  4094. filter: "*",
  4095. tolerance: "touch",
  4096. // Callbacks
  4097. selected: null,
  4098. selecting: null,
  4099. start: null,
  4100. stop: null,
  4101. unselected: null,
  4102. unselecting: null
  4103. },
  4104. _create: function() {
  4105. var that = this;
  4106. this._addClass( "ui-selectable" );
  4107. this.dragged = false;
  4108. // Cache selectee children based on filter
  4109. this.refresh = function() {
  4110. that.elementPos = $( that.element[ 0 ] ).offset();
  4111. that.selectees = $( that.options.filter, that.element[ 0 ] );
  4112. that._addClass( that.selectees, "ui-selectee" );
  4113. that.selectees.each( function() {
  4114. var $this = $( this ),
  4115. selecteeOffset = $this.offset(),
  4116. pos = {
  4117. left: selecteeOffset.left - that.elementPos.left,
  4118. top: selecteeOffset.top - that.elementPos.top
  4119. };
  4120. $.data( this, "selectable-item", {
  4121. element: this,
  4122. $element: $this,
  4123. left: pos.left,
  4124. top: pos.top,
  4125. right: pos.left + $this.outerWidth(),
  4126. bottom: pos.top + $this.outerHeight(),
  4127. startselected: false,
  4128. selected: $this.hasClass( "ui-selected" ),
  4129. selecting: $this.hasClass( "ui-selecting" ),
  4130. unselecting: $this.hasClass( "ui-unselecting" )
  4131. } );
  4132. } );
  4133. };
  4134. this.refresh();
  4135. this._mouseInit();
  4136. this.helper = $( "<div>" );
  4137. this._addClass( this.helper, "ui-selectable-helper" );
  4138. },
  4139. _destroy: function() {
  4140. this.selectees.removeData( "selectable-item" );
  4141. this._mouseDestroy();
  4142. },
  4143. _mouseStart: function( event ) {
  4144. var that = this,
  4145. options = this.options;
  4146. this.opos = [ event.pageX, event.pageY ];
  4147. this.elementPos = $( this.element[ 0 ] ).offset();
  4148. if ( this.options.disabled ) {
  4149. return;
  4150. }
  4151. this.selectees = $( options.filter, this.element[ 0 ] );
  4152. this._trigger( "start", event );
  4153. $( options.appendTo ).append( this.helper );
  4154. // position helper (lasso)
  4155. this.helper.css( {
  4156. "left": event.pageX,
  4157. "top": event.pageY,
  4158. "width": 0,
  4159. "height": 0
  4160. } );
  4161. if ( options.autoRefresh ) {
  4162. this.refresh();
  4163. }
  4164. this.selectees.filter( ".ui-selected" ).each( function() {
  4165. var selectee = $.data( this, "selectable-item" );
  4166. selectee.startselected = true;
  4167. if ( !event.metaKey && !event.ctrlKey ) {
  4168. that._removeClass( selectee.$element, "ui-selected" );
  4169. selectee.selected = false;
  4170. that._addClass( selectee.$element, "ui-unselecting" );
  4171. selectee.unselecting = true;
  4172. // selectable UNSELECTING callback
  4173. that._trigger( "unselecting", event, {
  4174. unselecting: selectee.element
  4175. } );
  4176. }
  4177. } );
  4178. $( event.target ).parents().addBack().each( function() {
  4179. var doSelect,
  4180. selectee = $.data( this, "selectable-item" );
  4181. if ( selectee ) {
  4182. doSelect = ( !event.metaKey && !event.ctrlKey ) ||
  4183. !selectee.$element.hasClass( "ui-selected" );
  4184. that._removeClass( selectee.$element, doSelect ? "ui-unselecting" : "ui-selected" )
  4185. ._addClass( selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting" );
  4186. selectee.unselecting = !doSelect;
  4187. selectee.selecting = doSelect;
  4188. selectee.selected = doSelect;
  4189. // selectable (UN)SELECTING callback
  4190. if ( doSelect ) {
  4191. that._trigger( "selecting", event, {
  4192. selecting: selectee.element
  4193. } );
  4194. } else {
  4195. that._trigger( "unselecting", event, {
  4196. unselecting: selectee.element
  4197. } );
  4198. }
  4199. return false;
  4200. }
  4201. } );
  4202. },
  4203. _mouseDrag: function( event ) {
  4204. this.dragged = true;
  4205. if ( this.options.disabled ) {
  4206. return;
  4207. }
  4208. var tmp,
  4209. that = this,
  4210. options = this.options,
  4211. x1 = this.opos[ 0 ],
  4212. y1 = this.opos[ 1 ],
  4213. x2 = event.pageX,
  4214. y2 = event.pageY;
  4215. if ( x1 > x2 ) {
  4216. tmp = x2; x2 = x1; x1 = tmp;
  4217. }
  4218. if ( y1 > y2 ) {
  4219. tmp = y2; y2 = y1; y1 = tmp;
  4220. }
  4221. this.helper.css( { left: x1, top: y1, width: x2 - x1, height: y2 - y1 } );
  4222. this.selectees.each( function() {
  4223. var selectee = $.data( this, "selectable-item" ),
  4224. hit = false,
  4225. offset = {};
  4226. //prevent helper from being selected if appendTo: selectable
  4227. if ( !selectee || selectee.element === that.element[ 0 ] ) {
  4228. return;
  4229. }
  4230. offset.left = selectee.left + that.elementPos.left;
  4231. offset.right = selectee.right + that.elementPos.left;
  4232. offset.top = selectee.top + that.elementPos.top;
  4233. offset.bottom = selectee.bottom + that.elementPos.top;
  4234. if ( options.tolerance === "touch" ) {
  4235. hit = ( !( offset.left > x2 || offset.right < x1 || offset.top > y2 ||
  4236. offset.bottom < y1 ) );
  4237. } else if ( options.tolerance === "fit" ) {
  4238. hit = ( offset.left > x1 && offset.right < x2 && offset.top > y1 &&
  4239. offset.bottom < y2 );
  4240. }
  4241. if ( hit ) {
  4242. // SELECT
  4243. if ( selectee.selected ) {
  4244. that._removeClass( selectee.$element, "ui-selected" );
  4245. selectee.selected = false;
  4246. }
  4247. if ( selectee.unselecting ) {
  4248. that._removeClass( selectee.$element, "ui-unselecting" );
  4249. selectee.unselecting = false;
  4250. }
  4251. if ( !selectee.selecting ) {
  4252. that._addClass( selectee.$element, "ui-selecting" );
  4253. selectee.selecting = true;
  4254. // selectable SELECTING callback
  4255. that._trigger( "selecting", event, {
  4256. selecting: selectee.element
  4257. } );
  4258. }
  4259. } else {
  4260. // UNSELECT
  4261. if ( selectee.selecting ) {
  4262. if ( ( event.metaKey || event.ctrlKey ) && selectee.startselected ) {
  4263. that._removeClass( selectee.$element, "ui-selecting" );
  4264. selectee.selecting = false;
  4265. that._addClass( selectee.$element, "ui-selected" );
  4266. selectee.selected = true;
  4267. } else {
  4268. that._removeClass( selectee.$element, "ui-selecting" );
  4269. selectee.selecting = false;
  4270. if ( selectee.startselected ) {
  4271. that._addClass( selectee.$element, "ui-unselecting" );
  4272. selectee.unselecting = true;
  4273. }
  4274. // selectable UNSELECTING callback
  4275. that._trigger( "unselecting", event, {
  4276. unselecting: selectee.element
  4277. } );
  4278. }
  4279. }
  4280. if ( selectee.selected ) {
  4281. if ( !event.metaKey && !event.ctrlKey && !selectee.startselected ) {
  4282. that._removeClass( selectee.$element, "ui-selected" );
  4283. selectee.selected = false;
  4284. that._addClass( selectee.$element, "ui-unselecting" );
  4285. selectee.unselecting = true;
  4286. // selectable UNSELECTING callback
  4287. that._trigger( "unselecting", event, {
  4288. unselecting: selectee.element
  4289. } );
  4290. }
  4291. }
  4292. }
  4293. } );
  4294. return false;
  4295. },
  4296. _mouseStop: function( event ) {
  4297. var that = this;
  4298. this.dragged = false;
  4299. $( ".ui-unselecting", this.element[ 0 ] ).each( function() {
  4300. var selectee = $.data( this, "selectable-item" );
  4301. that._removeClass( selectee.$element, "ui-unselecting" );
  4302. selectee.unselecting = false;
  4303. selectee.startselected = false;
  4304. that._trigger( "unselected", event, {
  4305. unselected: selectee.element
  4306. } );
  4307. } );
  4308. $( ".ui-selecting", this.element[ 0 ] ).each( function() {
  4309. var selectee = $.data( this, "selectable-item" );
  4310. that._removeClass( selectee.$element, "ui-selecting" )
  4311. ._addClass( selectee.$element, "ui-selected" );
  4312. selectee.selecting = false;
  4313. selectee.selected = true;
  4314. selectee.startselected = true;
  4315. that._trigger( "selected", event, {
  4316. selected: selectee.element
  4317. } );
  4318. } );
  4319. this._trigger( "stop", event );
  4320. this.helper.remove();
  4321. return false;
  4322. }
  4323. } );
  4324. /*!
  4325. * jQuery UI Sortable 1.13.2
  4326. * http://jqueryui.com
  4327. *
  4328. * Copyright jQuery Foundation and other contributors
  4329. * Released under the MIT license.
  4330. * http://jquery.org/license
  4331. */
  4332. //>>label: Sortable
  4333. //>>group: Interactions
  4334. //>>description: Enables items in a list to be sorted using the mouse.
  4335. //>>docs: http://api.jqueryui.com/sortable/
  4336. //>>demos: http://jqueryui.com/sortable/
  4337. //>>css.structure: ../../themes/base/sortable.css
  4338. var widgetsSortable = $.widget( "ui.sortable", $.ui.mouse, {
  4339. version: "1.13.2",
  4340. widgetEventPrefix: "sort",
  4341. ready: false,
  4342. options: {
  4343. appendTo: "parent",
  4344. axis: false,
  4345. connectWith: false,
  4346. containment: false,
  4347. cursor: "auto",
  4348. cursorAt: false,
  4349. dropOnEmpty: true,
  4350. forcePlaceholderSize: false,
  4351. forceHelperSize: false,
  4352. grid: false,
  4353. handle: false,
  4354. helper: "original",
  4355. items: "> *",
  4356. opacity: false,
  4357. placeholder: false,
  4358. revert: false,
  4359. scroll: true,
  4360. scrollSensitivity: 20,
  4361. scrollSpeed: 20,
  4362. scope: "default",
  4363. tolerance: "intersect",
  4364. zIndex: 1000,
  4365. // Callbacks
  4366. activate: null,
  4367. beforeStop: null,
  4368. change: null,
  4369. deactivate: null,
  4370. out: null,
  4371. over: null,
  4372. receive: null,
  4373. remove: null,
  4374. sort: null,
  4375. start: null,
  4376. stop: null,
  4377. update: null
  4378. },
  4379. _isOverAxis: function( x, reference, size ) {
  4380. return ( x >= reference ) && ( x < ( reference + size ) );
  4381. },
  4382. _isFloating: function( item ) {
  4383. return ( /left|right/ ).test( item.css( "float" ) ) ||
  4384. ( /inline|table-cell/ ).test( item.css( "display" ) );
  4385. },
  4386. _create: function() {
  4387. this.containerCache = {};
  4388. this._addClass( "ui-sortable" );
  4389. //Get the items
  4390. this.refresh();
  4391. //Let's determine the parent's offset
  4392. this.offset = this.element.offset();
  4393. //Initialize mouse events for interaction
  4394. this._mouseInit();
  4395. this._setHandleClassName();
  4396. //We're ready to go
  4397. this.ready = true;
  4398. },
  4399. _setOption: function( key, value ) {
  4400. this._super( key, value );
  4401. if ( key === "handle" ) {
  4402. this._setHandleClassName();
  4403. }
  4404. },
  4405. _setHandleClassName: function() {
  4406. var that = this;
  4407. this._removeClass( this.element.find( ".ui-sortable-handle" ), "ui-sortable-handle" );
  4408. $.each( this.items, function() {
  4409. that._addClass(
  4410. this.instance.options.handle ?
  4411. this.item.find( this.instance.options.handle ) :
  4412. this.item,
  4413. "ui-sortable-handle"
  4414. );
  4415. } );
  4416. },
  4417. _destroy: function() {
  4418. this._mouseDestroy();
  4419. for ( var i = this.items.length - 1; i >= 0; i-- ) {
  4420. this.items[ i ].item.removeData( this.widgetName + "-item" );
  4421. }
  4422. return this;
  4423. },
  4424. _mouseCapture: function( event, overrideHandle ) {
  4425. var currentItem = null,
  4426. validHandle = false,
  4427. that = this;
  4428. if ( this.reverting ) {
  4429. return false;
  4430. }
  4431. if ( this.options.disabled || this.options.type === "static" ) {
  4432. return false;
  4433. }
  4434. //We have to refresh the items data once first
  4435. this._refreshItems( event );
  4436. //Find out if the clicked node (or one of its parents) is a actual item in this.items
  4437. $( event.target ).parents().each( function() {
  4438. if ( $.data( this, that.widgetName + "-item" ) === that ) {
  4439. currentItem = $( this );
  4440. return false;
  4441. }
  4442. } );
  4443. if ( $.data( event.target, that.widgetName + "-item" ) === that ) {
  4444. currentItem = $( event.target );
  4445. }
  4446. if ( !currentItem ) {
  4447. return false;
  4448. }
  4449. if ( this.options.handle && !overrideHandle ) {
  4450. $( this.options.handle, currentItem ).find( "*" ).addBack().each( function() {
  4451. if ( this === event.target ) {
  4452. validHandle = true;
  4453. }
  4454. } );
  4455. if ( !validHandle ) {
  4456. return false;
  4457. }
  4458. }
  4459. this.currentItem = currentItem;
  4460. this._removeCurrentsFromItems();
  4461. return true;
  4462. },
  4463. _mouseStart: function( event, overrideHandle, noActivation ) {
  4464. var i, body,
  4465. o = this.options;
  4466. this.currentContainer = this;
  4467. //We only need to call refreshPositions, because the refreshItems call has been moved to
  4468. // mouseCapture
  4469. this.refreshPositions();
  4470. //Prepare the dragged items parent
  4471. this.appendTo = $( o.appendTo !== "parent" ?
  4472. o.appendTo :
  4473. this.currentItem.parent() );
  4474. //Create and append the visible helper
  4475. this.helper = this._createHelper( event );
  4476. //Cache the helper size
  4477. this._cacheHelperProportions();
  4478. /*
  4479. * - Position generation -
  4480. * This block generates everything position related - it's the core of draggables.
  4481. */
  4482. //Cache the margins of the original element
  4483. this._cacheMargins();
  4484. //The element's absolute position on the page minus margins
  4485. this.offset = this.currentItem.offset();
  4486. this.offset = {
  4487. top: this.offset.top - this.margins.top,
  4488. left: this.offset.left - this.margins.left
  4489. };
  4490. $.extend( this.offset, {
  4491. click: { //Where the click happened, relative to the element
  4492. left: event.pageX - this.offset.left,
  4493. top: event.pageY - this.offset.top
  4494. },
  4495. // This is a relative to absolute position minus the actual position calculation -
  4496. // only used for relative positioned helper
  4497. relative: this._getRelativeOffset()
  4498. } );
  4499. // After we get the helper offset, but before we get the parent offset we can
  4500. // change the helper's position to absolute
  4501. // TODO: Still need to figure out a way to make relative sorting possible
  4502. this.helper.css( "position", "absolute" );
  4503. this.cssPosition = this.helper.css( "position" );
  4504. //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
  4505. if ( o.cursorAt ) {
  4506. this._adjustOffsetFromHelper( o.cursorAt );
  4507. }
  4508. //Cache the former DOM position
  4509. this.domPosition = {
  4510. prev: this.currentItem.prev()[ 0 ],
  4511. parent: this.currentItem.parent()[ 0 ]
  4512. };
  4513. // If the helper is not the original, hide the original so it's not playing any role during
  4514. // the drag, won't cause anything bad this way
  4515. if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
  4516. this.currentItem.hide();
  4517. }
  4518. //Create the placeholder
  4519. this._createPlaceholder();
  4520. //Get the next scrolling parent
  4521. this.scrollParent = this.placeholder.scrollParent();
  4522. $.extend( this.offset, {
  4523. parent: this._getParentOffset()
  4524. } );
  4525. //Set a containment if given in the options
  4526. if ( o.containment ) {
  4527. this._setContainment();
  4528. }
  4529. if ( o.cursor && o.cursor !== "auto" ) { // cursor option
  4530. body = this.document.find( "body" );
  4531. // Support: IE
  4532. this.storedCursor = body.css( "cursor" );
  4533. body.css( "cursor", o.cursor );
  4534. this.storedStylesheet =
  4535. $( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body );
  4536. }
  4537. // We need to make sure to grab the zIndex before setting the
  4538. // opacity, because setting the opacity to anything lower than 1
  4539. // causes the zIndex to change from "auto" to 0.
  4540. if ( o.zIndex ) { // zIndex option
  4541. if ( this.helper.css( "zIndex" ) ) {
  4542. this._storedZIndex = this.helper.css( "zIndex" );
  4543. }
  4544. this.helper.css( "zIndex", o.zIndex );
  4545. }
  4546. if ( o.opacity ) { // opacity option
  4547. if ( this.helper.css( "opacity" ) ) {
  4548. this._storedOpacity = this.helper.css( "opacity" );
  4549. }
  4550. this.helper.css( "opacity", o.opacity );
  4551. }
  4552. //Prepare scrolling
  4553. if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  4554. this.scrollParent[ 0 ].tagName !== "HTML" ) {
  4555. this.overflowOffset = this.scrollParent.offset();
  4556. }
  4557. //Call callbacks
  4558. this._trigger( "start", event, this._uiHash() );
  4559. //Recache the helper size
  4560. if ( !this._preserveHelperProportions ) {
  4561. this._cacheHelperProportions();
  4562. }
  4563. //Post "activate" events to possible containers
  4564. if ( !noActivation ) {
  4565. for ( i = this.containers.length - 1; i >= 0; i-- ) {
  4566. this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
  4567. }
  4568. }
  4569. //Prepare possible droppables
  4570. if ( $.ui.ddmanager ) {
  4571. $.ui.ddmanager.current = this;
  4572. }
  4573. if ( $.ui.ddmanager && !o.dropBehaviour ) {
  4574. $.ui.ddmanager.prepareOffsets( this, event );
  4575. }
  4576. this.dragging = true;
  4577. this._addClass( this.helper, "ui-sortable-helper" );
  4578. //Move the helper, if needed
  4579. if ( !this.helper.parent().is( this.appendTo ) ) {
  4580. this.helper.detach().appendTo( this.appendTo );
  4581. //Update position
  4582. this.offset.parent = this._getParentOffset();
  4583. }
  4584. //Generate the original position
  4585. this.position = this.originalPosition = this._generatePosition( event );
  4586. this.originalPageX = event.pageX;
  4587. this.originalPageY = event.pageY;
  4588. this.lastPositionAbs = this.positionAbs = this._convertPositionTo( "absolute" );
  4589. this._mouseDrag( event );
  4590. return true;
  4591. },
  4592. _scroll: function( event ) {
  4593. var o = this.options,
  4594. scrolled = false;
  4595. if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  4596. this.scrollParent[ 0 ].tagName !== "HTML" ) {
  4597. if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) -
  4598. event.pageY < o.scrollSensitivity ) {
  4599. this.scrollParent[ 0 ].scrollTop =
  4600. scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed;
  4601. } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) {
  4602. this.scrollParent[ 0 ].scrollTop =
  4603. scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed;
  4604. }
  4605. if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) -
  4606. event.pageX < o.scrollSensitivity ) {
  4607. this.scrollParent[ 0 ].scrollLeft = scrolled =
  4608. this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed;
  4609. } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) {
  4610. this.scrollParent[ 0 ].scrollLeft = scrolled =
  4611. this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed;
  4612. }
  4613. } else {
  4614. if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) {
  4615. scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed );
  4616. } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) <
  4617. o.scrollSensitivity ) {
  4618. scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed );
  4619. }
  4620. if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) {
  4621. scrolled = this.document.scrollLeft(
  4622. this.document.scrollLeft() - o.scrollSpeed
  4623. );
  4624. } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) <
  4625. o.scrollSensitivity ) {
  4626. scrolled = this.document.scrollLeft(
  4627. this.document.scrollLeft() + o.scrollSpeed
  4628. );
  4629. }
  4630. }
  4631. return scrolled;
  4632. },
  4633. _mouseDrag: function( event ) {
  4634. var i, item, itemElement, intersection,
  4635. o = this.options;
  4636. //Compute the helpers position
  4637. this.position = this._generatePosition( event );
  4638. this.positionAbs = this._convertPositionTo( "absolute" );
  4639. //Set the helper position
  4640. if ( !this.options.axis || this.options.axis !== "y" ) {
  4641. this.helper[ 0 ].style.left = this.position.left + "px";
  4642. }
  4643. if ( !this.options.axis || this.options.axis !== "x" ) {
  4644. this.helper[ 0 ].style.top = this.position.top + "px";
  4645. }
  4646. //Do scrolling
  4647. if ( o.scroll ) {
  4648. if ( this._scroll( event ) !== false ) {
  4649. //Update item positions used in position checks
  4650. this._refreshItemPositions( true );
  4651. if ( $.ui.ddmanager && !o.dropBehaviour ) {
  4652. $.ui.ddmanager.prepareOffsets( this, event );
  4653. }
  4654. }
  4655. }
  4656. this.dragDirection = {
  4657. vertical: this._getDragVerticalDirection(),
  4658. horizontal: this._getDragHorizontalDirection()
  4659. };
  4660. //Rearrange
  4661. for ( i = this.items.length - 1; i >= 0; i-- ) {
  4662. //Cache variables and intersection, continue if no intersection
  4663. item = this.items[ i ];
  4664. itemElement = item.item[ 0 ];
  4665. intersection = this._intersectsWithPointer( item );
  4666. if ( !intersection ) {
  4667. continue;
  4668. }
  4669. // Only put the placeholder inside the current Container, skip all
  4670. // items from other containers. This works because when moving
  4671. // an item from one container to another the
  4672. // currentContainer is switched before the placeholder is moved.
  4673. //
  4674. // Without this, moving items in "sub-sortables" can cause
  4675. // the placeholder to jitter between the outer and inner container.
  4676. if ( item.instance !== this.currentContainer ) {
  4677. continue;
  4678. }
  4679. // Cannot intersect with itself
  4680. // no useless actions that have been done before
  4681. // no action if the item moved is the parent of the item checked
  4682. if ( itemElement !== this.currentItem[ 0 ] &&
  4683. this.placeholder[ intersection === 1 ?
  4684. "next" : "prev" ]()[ 0 ] !== itemElement &&
  4685. !$.contains( this.placeholder[ 0 ], itemElement ) &&
  4686. ( this.options.type === "semi-dynamic" ?
  4687. !$.contains( this.element[ 0 ], itemElement ) :
  4688. true
  4689. )
  4690. ) {
  4691. this.direction = intersection === 1 ? "down" : "up";
  4692. if ( this.options.tolerance === "pointer" ||
  4693. this._intersectsWithSides( item ) ) {
  4694. this._rearrange( event, item );
  4695. } else {
  4696. break;
  4697. }
  4698. this._trigger( "change", event, this._uiHash() );
  4699. break;
  4700. }
  4701. }
  4702. //Post events to containers
  4703. this._contactContainers( event );
  4704. //Interconnect with droppables
  4705. if ( $.ui.ddmanager ) {
  4706. $.ui.ddmanager.drag( this, event );
  4707. }
  4708. //Call callbacks
  4709. this._trigger( "sort", event, this._uiHash() );
  4710. this.lastPositionAbs = this.positionAbs;
  4711. return false;
  4712. },
  4713. _mouseStop: function( event, noPropagation ) {
  4714. if ( !event ) {
  4715. return;
  4716. }
  4717. //If we are using droppables, inform the manager about the drop
  4718. if ( $.ui.ddmanager && !this.options.dropBehaviour ) {
  4719. $.ui.ddmanager.drop( this, event );
  4720. }
  4721. if ( this.options.revert ) {
  4722. var that = this,
  4723. cur = this.placeholder.offset(),
  4724. axis = this.options.axis,
  4725. animation = {};
  4726. if ( !axis || axis === "x" ) {
  4727. animation.left = cur.left - this.offset.parent.left - this.margins.left +
  4728. ( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
  4729. 0 :
  4730. this.offsetParent[ 0 ].scrollLeft
  4731. );
  4732. }
  4733. if ( !axis || axis === "y" ) {
  4734. animation.top = cur.top - this.offset.parent.top - this.margins.top +
  4735. ( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
  4736. 0 :
  4737. this.offsetParent[ 0 ].scrollTop
  4738. );
  4739. }
  4740. this.reverting = true;
  4741. $( this.helper ).animate(
  4742. animation,
  4743. parseInt( this.options.revert, 10 ) || 500,
  4744. function() {
  4745. that._clear( event );
  4746. }
  4747. );
  4748. } else {
  4749. this._clear( event, noPropagation );
  4750. }
  4751. return false;
  4752. },
  4753. cancel: function() {
  4754. if ( this.dragging ) {
  4755. this._mouseUp( new $.Event( "mouseup", { target: null } ) );
  4756. if ( this.options.helper === "original" ) {
  4757. this.currentItem.css( this._storedCSS );
  4758. this._removeClass( this.currentItem, "ui-sortable-helper" );
  4759. } else {
  4760. this.currentItem.show();
  4761. }
  4762. //Post deactivating events to containers
  4763. for ( var i = this.containers.length - 1; i >= 0; i-- ) {
  4764. this.containers[ i ]._trigger( "deactivate", null, this._uiHash( this ) );
  4765. if ( this.containers[ i ].containerCache.over ) {
  4766. this.containers[ i ]._trigger( "out", null, this._uiHash( this ) );
  4767. this.containers[ i ].containerCache.over = 0;
  4768. }
  4769. }
  4770. }
  4771. if ( this.placeholder ) {
  4772. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
  4773. // it unbinds ALL events from the original node!
  4774. if ( this.placeholder[ 0 ].parentNode ) {
  4775. this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );
  4776. }
  4777. if ( this.options.helper !== "original" && this.helper &&
  4778. this.helper[ 0 ].parentNode ) {
  4779. this.helper.remove();
  4780. }
  4781. $.extend( this, {
  4782. helper: null,
  4783. dragging: false,
  4784. reverting: false,
  4785. _noFinalSort: null
  4786. } );
  4787. if ( this.domPosition.prev ) {
  4788. $( this.domPosition.prev ).after( this.currentItem );
  4789. } else {
  4790. $( this.domPosition.parent ).prepend( this.currentItem );
  4791. }
  4792. }
  4793. return this;
  4794. },
  4795. serialize: function( o ) {
  4796. var items = this._getItemsAsjQuery( o && o.connected ),
  4797. str = [];
  4798. o = o || {};
  4799. $( items ).each( function() {
  4800. var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" )
  4801. .match( o.expression || ( /(.+)[\-=_](.+)/ ) );
  4802. if ( res ) {
  4803. str.push(
  4804. ( o.key || res[ 1 ] + "[]" ) +
  4805. "=" + ( o.key && o.expression ? res[ 1 ] : res[ 2 ] ) );
  4806. }
  4807. } );
  4808. if ( !str.length && o.key ) {
  4809. str.push( o.key + "=" );
  4810. }
  4811. return str.join( "&" );
  4812. },
  4813. toArray: function( o ) {
  4814. var items = this._getItemsAsjQuery( o && o.connected ),
  4815. ret = [];
  4816. o = o || {};
  4817. items.each( function() {
  4818. ret.push( $( o.item || this ).attr( o.attribute || "id" ) || "" );
  4819. } );
  4820. return ret;
  4821. },
  4822. /* Be careful with the following core functions */
  4823. _intersectsWith: function( item ) {
  4824. var x1 = this.positionAbs.left,
  4825. x2 = x1 + this.helperProportions.width,
  4826. y1 = this.positionAbs.top,
  4827. y2 = y1 + this.helperProportions.height,
  4828. l = item.left,
  4829. r = l + item.width,
  4830. t = item.top,
  4831. b = t + item.height,
  4832. dyClick = this.offset.click.top,
  4833. dxClick = this.offset.click.left,
  4834. isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t &&
  4835. ( y1 + dyClick ) < b ),
  4836. isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l &&
  4837. ( x1 + dxClick ) < r ),
  4838. isOverElement = isOverElementHeight && isOverElementWidth;
  4839. if ( this.options.tolerance === "pointer" ||
  4840. this.options.forcePointerForContainers ||
  4841. ( this.options.tolerance !== "pointer" &&
  4842. this.helperProportions[ this.floating ? "width" : "height" ] >
  4843. item[ this.floating ? "width" : "height" ] )
  4844. ) {
  4845. return isOverElement;
  4846. } else {
  4847. return ( l < x1 + ( this.helperProportions.width / 2 ) && // Right Half
  4848. x2 - ( this.helperProportions.width / 2 ) < r && // Left Half
  4849. t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half
  4850. y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half
  4851. }
  4852. },
  4853. _intersectsWithPointer: function( item ) {
  4854. var verticalDirection, horizontalDirection,
  4855. isOverElementHeight = ( this.options.axis === "x" ) ||
  4856. this._isOverAxis(
  4857. this.positionAbs.top + this.offset.click.top, item.top, item.height ),
  4858. isOverElementWidth = ( this.options.axis === "y" ) ||
  4859. this._isOverAxis(
  4860. this.positionAbs.left + this.offset.click.left, item.left, item.width ),
  4861. isOverElement = isOverElementHeight && isOverElementWidth;
  4862. if ( !isOverElement ) {
  4863. return false;
  4864. }
  4865. verticalDirection = this.dragDirection.vertical;
  4866. horizontalDirection = this.dragDirection.horizontal;
  4867. return this.floating ?
  4868. ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) :
  4869. ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) );
  4870. },
  4871. _intersectsWithSides: function( item ) {
  4872. var isOverBottomHalf = this._isOverAxis( this.positionAbs.top +
  4873. this.offset.click.top, item.top + ( item.height / 2 ), item.height ),
  4874. isOverRightHalf = this._isOverAxis( this.positionAbs.left +
  4875. this.offset.click.left, item.left + ( item.width / 2 ), item.width ),
  4876. verticalDirection = this.dragDirection.vertical,
  4877. horizontalDirection = this.dragDirection.horizontal;
  4878. if ( this.floating && horizontalDirection ) {
  4879. return ( ( horizontalDirection === "right" && isOverRightHalf ) ||
  4880. ( horizontalDirection === "left" && !isOverRightHalf ) );
  4881. } else {
  4882. return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) ||
  4883. ( verticalDirection === "up" && !isOverBottomHalf ) );
  4884. }
  4885. },
  4886. _getDragVerticalDirection: function() {
  4887. var delta = this.positionAbs.top - this.lastPositionAbs.top;
  4888. return delta !== 0 && ( delta > 0 ? "down" : "up" );
  4889. },
  4890. _getDragHorizontalDirection: function() {
  4891. var delta = this.positionAbs.left - this.lastPositionAbs.left;
  4892. return delta !== 0 && ( delta > 0 ? "right" : "left" );
  4893. },
  4894. refresh: function( event ) {
  4895. this._refreshItems( event );
  4896. this._setHandleClassName();
  4897. this.refreshPositions();
  4898. return this;
  4899. },
  4900. _connectWith: function() {
  4901. var options = this.options;
  4902. return options.connectWith.constructor === String ?
  4903. [ options.connectWith ] :
  4904. options.connectWith;
  4905. },
  4906. _getItemsAsjQuery: function( connected ) {
  4907. var i, j, cur, inst,
  4908. items = [],
  4909. queries = [],
  4910. connectWith = this._connectWith();
  4911. if ( connectWith && connected ) {
  4912. for ( i = connectWith.length - 1; i >= 0; i-- ) {
  4913. cur = $( connectWith[ i ], this.document[ 0 ] );
  4914. for ( j = cur.length - 1; j >= 0; j-- ) {
  4915. inst = $.data( cur[ j ], this.widgetFullName );
  4916. if ( inst && inst !== this && !inst.options.disabled ) {
  4917. queries.push( [ typeof inst.options.items === "function" ?
  4918. inst.options.items.call( inst.element ) :
  4919. $( inst.options.items, inst.element )
  4920. .not( ".ui-sortable-helper" )
  4921. .not( ".ui-sortable-placeholder" ), inst ] );
  4922. }
  4923. }
  4924. }
  4925. }
  4926. queries.push( [ typeof this.options.items === "function" ?
  4927. this.options.items
  4928. .call( this.element, null, { options: this.options, item: this.currentItem } ) :
  4929. $( this.options.items, this.element )
  4930. .not( ".ui-sortable-helper" )
  4931. .not( ".ui-sortable-placeholder" ), this ] );
  4932. function addItems() {
  4933. items.push( this );
  4934. }
  4935. for ( i = queries.length - 1; i >= 0; i-- ) {
  4936. queries[ i ][ 0 ].each( addItems );
  4937. }
  4938. return $( items );
  4939. },
  4940. _removeCurrentsFromItems: function() {
  4941. var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" );
  4942. this.items = $.grep( this.items, function( item ) {
  4943. for ( var j = 0; j < list.length; j++ ) {
  4944. if ( list[ j ] === item.item[ 0 ] ) {
  4945. return false;
  4946. }
  4947. }
  4948. return true;
  4949. } );
  4950. },
  4951. _refreshItems: function( event ) {
  4952. this.items = [];
  4953. this.containers = [ this ];
  4954. var i, j, cur, inst, targetData, _queries, item, queriesLength,
  4955. items = this.items,
  4956. queries = [ [ typeof this.options.items === "function" ?
  4957. this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) :
  4958. $( this.options.items, this.element ), this ] ],
  4959. connectWith = this._connectWith();
  4960. //Shouldn't be run the first time through due to massive slow-down
  4961. if ( connectWith && this.ready ) {
  4962. for ( i = connectWith.length - 1; i >= 0; i-- ) {
  4963. cur = $( connectWith[ i ], this.document[ 0 ] );
  4964. for ( j = cur.length - 1; j >= 0; j-- ) {
  4965. inst = $.data( cur[ j ], this.widgetFullName );
  4966. if ( inst && inst !== this && !inst.options.disabled ) {
  4967. queries.push( [ typeof inst.options.items === "function" ?
  4968. inst.options.items
  4969. .call( inst.element[ 0 ], event, { item: this.currentItem } ) :
  4970. $( inst.options.items, inst.element ), inst ] );
  4971. this.containers.push( inst );
  4972. }
  4973. }
  4974. }
  4975. }
  4976. for ( i = queries.length - 1; i >= 0; i-- ) {
  4977. targetData = queries[ i ][ 1 ];
  4978. _queries = queries[ i ][ 0 ];
  4979. for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) {
  4980. item = $( _queries[ j ] );
  4981. // Data for target checking (mouse manager)
  4982. item.data( this.widgetName + "-item", targetData );
  4983. items.push( {
  4984. item: item,
  4985. instance: targetData,
  4986. width: 0, height: 0,
  4987. left: 0, top: 0
  4988. } );
  4989. }
  4990. }
  4991. },
  4992. _refreshItemPositions: function( fast ) {
  4993. var i, item, t, p;
  4994. for ( i = this.items.length - 1; i >= 0; i-- ) {
  4995. item = this.items[ i ];
  4996. //We ignore calculating positions of all connected containers when we're not over them
  4997. if ( this.currentContainer && item.instance !== this.currentContainer &&
  4998. item.item[ 0 ] !== this.currentItem[ 0 ] ) {
  4999. continue;
  5000. }
  5001. t = this.options.toleranceElement ?
  5002. $( this.options.toleranceElement, item.item ) :
  5003. item.item;
  5004. if ( !fast ) {
  5005. item.width = t.outerWidth();
  5006. item.height = t.outerHeight();
  5007. }
  5008. p = t.offset();
  5009. item.left = p.left;
  5010. item.top = p.top;
  5011. }
  5012. },
  5013. refreshPositions: function( fast ) {
  5014. // Determine whether items are being displayed horizontally
  5015. this.floating = this.items.length ?
  5016. this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
  5017. false;
  5018. // This has to be redone because due to the item being moved out/into the offsetParent,
  5019. // the offsetParent's position will change
  5020. if ( this.offsetParent && this.helper ) {
  5021. this.offset.parent = this._getParentOffset();
  5022. }
  5023. this._refreshItemPositions( fast );
  5024. var i, p;
  5025. if ( this.options.custom && this.options.custom.refreshContainers ) {
  5026. this.options.custom.refreshContainers.call( this );
  5027. } else {
  5028. for ( i = this.containers.length - 1; i >= 0; i-- ) {
  5029. p = this.containers[ i ].element.offset();
  5030. this.containers[ i ].containerCache.left = p.left;
  5031. this.containers[ i ].containerCache.top = p.top;
  5032. this.containers[ i ].containerCache.width =
  5033. this.containers[ i ].element.outerWidth();
  5034. this.containers[ i ].containerCache.height =
  5035. this.containers[ i ].element.outerHeight();
  5036. }
  5037. }
  5038. return this;
  5039. },
  5040. _createPlaceholder: function( that ) {
  5041. that = that || this;
  5042. var className, nodeName,
  5043. o = that.options;
  5044. if ( !o.placeholder || o.placeholder.constructor === String ) {
  5045. className = o.placeholder;
  5046. nodeName = that.currentItem[ 0 ].nodeName.toLowerCase();
  5047. o.placeholder = {
  5048. element: function() {
  5049. var element = $( "<" + nodeName + ">", that.document[ 0 ] );
  5050. that._addClass( element, "ui-sortable-placeholder",
  5051. className || that.currentItem[ 0 ].className )
  5052. ._removeClass( element, "ui-sortable-helper" );
  5053. if ( nodeName === "tbody" ) {
  5054. that._createTrPlaceholder(
  5055. that.currentItem.find( "tr" ).eq( 0 ),
  5056. $( "<tr>", that.document[ 0 ] ).appendTo( element )
  5057. );
  5058. } else if ( nodeName === "tr" ) {
  5059. that._createTrPlaceholder( that.currentItem, element );
  5060. } else if ( nodeName === "img" ) {
  5061. element.attr( "src", that.currentItem.attr( "src" ) );
  5062. }
  5063. if ( !className ) {
  5064. element.css( "visibility", "hidden" );
  5065. }
  5066. return element;
  5067. },
  5068. update: function( container, p ) {
  5069. // 1. If a className is set as 'placeholder option, we don't force sizes -
  5070. // the class is responsible for that
  5071. // 2. The option 'forcePlaceholderSize can be enabled to force it even if a
  5072. // class name is specified
  5073. if ( className && !o.forcePlaceholderSize ) {
  5074. return;
  5075. }
  5076. // If the element doesn't have a actual height or width by itself (without
  5077. // styles coming from a stylesheet), it receives the inline height and width
  5078. // from the dragged item. Or, if it's a tbody or tr, it's going to have a height
  5079. // anyway since we're populating them with <td>s above, but they're unlikely to
  5080. // be the correct height on their own if the row heights are dynamic, so we'll
  5081. // always assign the height of the dragged item given forcePlaceholderSize
  5082. // is true.
  5083. if ( !p.height() || ( o.forcePlaceholderSize &&
  5084. ( nodeName === "tbody" || nodeName === "tr" ) ) ) {
  5085. p.height(
  5086. that.currentItem.innerHeight() -
  5087. parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) -
  5088. parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) );
  5089. }
  5090. if ( !p.width() ) {
  5091. p.width(
  5092. that.currentItem.innerWidth() -
  5093. parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) -
  5094. parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) );
  5095. }
  5096. }
  5097. };
  5098. }
  5099. //Create the placeholder
  5100. that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) );
  5101. //Append it after the actual current item
  5102. that.currentItem.after( that.placeholder );
  5103. //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
  5104. o.placeholder.update( that, that.placeholder );
  5105. },
  5106. _createTrPlaceholder: function( sourceTr, targetTr ) {
  5107. var that = this;
  5108. sourceTr.children().each( function() {
  5109. $( "<td>&#160;</td>", that.document[ 0 ] )
  5110. .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
  5111. .appendTo( targetTr );
  5112. } );
  5113. },
  5114. _contactContainers: function( event ) {
  5115. var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom,
  5116. floating, axis,
  5117. innermostContainer = null,
  5118. innermostIndex = null;
  5119. // Get innermost container that intersects with item
  5120. for ( i = this.containers.length - 1; i >= 0; i-- ) {
  5121. // Never consider a container that's located within the item itself
  5122. if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) {
  5123. continue;
  5124. }
  5125. if ( this._intersectsWith( this.containers[ i ].containerCache ) ) {
  5126. // If we've already found a container and it's more "inner" than this, then continue
  5127. if ( innermostContainer &&
  5128. $.contains(
  5129. this.containers[ i ].element[ 0 ],
  5130. innermostContainer.element[ 0 ] ) ) {
  5131. continue;
  5132. }
  5133. innermostContainer = this.containers[ i ];
  5134. innermostIndex = i;
  5135. } else {
  5136. // container doesn't intersect. trigger "out" event if necessary
  5137. if ( this.containers[ i ].containerCache.over ) {
  5138. this.containers[ i ]._trigger( "out", event, this._uiHash( this ) );
  5139. this.containers[ i ].containerCache.over = 0;
  5140. }
  5141. }
  5142. }
  5143. // If no intersecting containers found, return
  5144. if ( !innermostContainer ) {
  5145. return;
  5146. }
  5147. // Move the item into the container if it's not there already
  5148. if ( this.containers.length === 1 ) {
  5149. if ( !this.containers[ innermostIndex ].containerCache.over ) {
  5150. this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
  5151. this.containers[ innermostIndex ].containerCache.over = 1;
  5152. }
  5153. } else {
  5154. // When entering a new container, we will find the item with the least distance and
  5155. // append our item near it
  5156. dist = 10000;
  5157. itemWithLeastDistance = null;
  5158. floating = innermostContainer.floating || this._isFloating( this.currentItem );
  5159. posProperty = floating ? "left" : "top";
  5160. sizeProperty = floating ? "width" : "height";
  5161. axis = floating ? "pageX" : "pageY";
  5162. for ( j = this.items.length - 1; j >= 0; j-- ) {
  5163. if ( !$.contains(
  5164. this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] )
  5165. ) {
  5166. continue;
  5167. }
  5168. if ( this.items[ j ].item[ 0 ] === this.currentItem[ 0 ] ) {
  5169. continue;
  5170. }
  5171. cur = this.items[ j ].item.offset()[ posProperty ];
  5172. nearBottom = false;
  5173. if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
  5174. nearBottom = true;
  5175. }
  5176. if ( Math.abs( event[ axis ] - cur ) < dist ) {
  5177. dist = Math.abs( event[ axis ] - cur );
  5178. itemWithLeastDistance = this.items[ j ];
  5179. this.direction = nearBottom ? "up" : "down";
  5180. }
  5181. }
  5182. //Check if dropOnEmpty is enabled
  5183. if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) {
  5184. return;
  5185. }
  5186. if ( this.currentContainer === this.containers[ innermostIndex ] ) {
  5187. if ( !this.currentContainer.containerCache.over ) {
  5188. this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
  5189. this.currentContainer.containerCache.over = 1;
  5190. }
  5191. return;
  5192. }
  5193. if ( itemWithLeastDistance ) {
  5194. this._rearrange( event, itemWithLeastDistance, null, true );
  5195. } else {
  5196. this._rearrange( event, null, this.containers[ innermostIndex ].element, true );
  5197. }
  5198. this._trigger( "change", event, this._uiHash() );
  5199. this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) );
  5200. this.currentContainer = this.containers[ innermostIndex ];
  5201. //Update the placeholder
  5202. this.options.placeholder.update( this.currentContainer, this.placeholder );
  5203. //Update scrollParent
  5204. this.scrollParent = this.placeholder.scrollParent();
  5205. //Update overflowOffset
  5206. if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  5207. this.scrollParent[ 0 ].tagName !== "HTML" ) {
  5208. this.overflowOffset = this.scrollParent.offset();
  5209. }
  5210. this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
  5211. this.containers[ innermostIndex ].containerCache.over = 1;
  5212. }
  5213. },
  5214. _createHelper: function( event ) {
  5215. var o = this.options,
  5216. helper = typeof o.helper === "function" ?
  5217. $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) :
  5218. ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem );
  5219. //Add the helper to the DOM if that didn't happen already
  5220. if ( !helper.parents( "body" ).length ) {
  5221. this.appendTo[ 0 ].appendChild( helper[ 0 ] );
  5222. }
  5223. if ( helper[ 0 ] === this.currentItem[ 0 ] ) {
  5224. this._storedCSS = {
  5225. width: this.currentItem[ 0 ].style.width,
  5226. height: this.currentItem[ 0 ].style.height,
  5227. position: this.currentItem.css( "position" ),
  5228. top: this.currentItem.css( "top" ),
  5229. left: this.currentItem.css( "left" )
  5230. };
  5231. }
  5232. if ( !helper[ 0 ].style.width || o.forceHelperSize ) {
  5233. helper.width( this.currentItem.width() );
  5234. }
  5235. if ( !helper[ 0 ].style.height || o.forceHelperSize ) {
  5236. helper.height( this.currentItem.height() );
  5237. }
  5238. return helper;
  5239. },
  5240. _adjustOffsetFromHelper: function( obj ) {
  5241. if ( typeof obj === "string" ) {
  5242. obj = obj.split( " " );
  5243. }
  5244. if ( Array.isArray( obj ) ) {
  5245. obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
  5246. }
  5247. if ( "left" in obj ) {
  5248. this.offset.click.left = obj.left + this.margins.left;
  5249. }
  5250. if ( "right" in obj ) {
  5251. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  5252. }
  5253. if ( "top" in obj ) {
  5254. this.offset.click.top = obj.top + this.margins.top;
  5255. }
  5256. if ( "bottom" in obj ) {
  5257. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  5258. }
  5259. },
  5260. _getParentOffset: function() {
  5261. //Get the offsetParent and cache its position
  5262. this.offsetParent = this.helper.offsetParent();
  5263. var po = this.offsetParent.offset();
  5264. // This is a special case where we need to modify a offset calculated on start, since the
  5265. // following happened:
  5266. // 1. The position of the helper is absolute, so it's position is calculated based on the
  5267. // next positioned parent
  5268. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
  5269. // the document, which means that the scroll is included in the initial calculation of the
  5270. // offset of the parent, and never recalculated upon drag
  5271. if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  5272. $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
  5273. po.left += this.scrollParent.scrollLeft();
  5274. po.top += this.scrollParent.scrollTop();
  5275. }
  5276. // This needs to be actually done for all browsers, since pageX/pageY includes this
  5277. // information with an ugly IE fix
  5278. if ( this.offsetParent[ 0 ] === this.document[ 0 ].body ||
  5279. ( this.offsetParent[ 0 ].tagName &&
  5280. this.offsetParent[ 0 ].tagName.toLowerCase() === "html" && $.ui.ie ) ) {
  5281. po = { top: 0, left: 0 };
  5282. }
  5283. return {
  5284. top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),
  5285. left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )
  5286. };
  5287. },
  5288. _getRelativeOffset: function() {
  5289. if ( this.cssPosition === "relative" ) {
  5290. var p = this.currentItem.position();
  5291. return {
  5292. top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +
  5293. this.scrollParent.scrollTop(),
  5294. left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +
  5295. this.scrollParent.scrollLeft()
  5296. };
  5297. } else {
  5298. return { top: 0, left: 0 };
  5299. }
  5300. },
  5301. _cacheMargins: function() {
  5302. this.margins = {
  5303. left: ( parseInt( this.currentItem.css( "marginLeft" ), 10 ) || 0 ),
  5304. top: ( parseInt( this.currentItem.css( "marginTop" ), 10 ) || 0 )
  5305. };
  5306. },
  5307. _cacheHelperProportions: function() {
  5308. this.helperProportions = {
  5309. width: this.helper.outerWidth(),
  5310. height: this.helper.outerHeight()
  5311. };
  5312. },
  5313. _setContainment: function() {
  5314. var ce, co, over,
  5315. o = this.options;
  5316. if ( o.containment === "parent" ) {
  5317. o.containment = this.helper[ 0 ].parentNode;
  5318. }
  5319. if ( o.containment === "document" || o.containment === "window" ) {
  5320. this.containment = [
  5321. 0 - this.offset.relative.left - this.offset.parent.left,
  5322. 0 - this.offset.relative.top - this.offset.parent.top,
  5323. o.containment === "document" ?
  5324. this.document.width() :
  5325. this.window.width() - this.helperProportions.width - this.margins.left,
  5326. ( o.containment === "document" ?
  5327. ( this.document.height() || document.body.parentNode.scrollHeight ) :
  5328. this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight
  5329. ) - this.helperProportions.height - this.margins.top
  5330. ];
  5331. }
  5332. if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) {
  5333. ce = $( o.containment )[ 0 ];
  5334. co = $( o.containment ).offset();
  5335. over = ( $( ce ).css( "overflow" ) !== "hidden" );
  5336. this.containment = [
  5337. co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) +
  5338. ( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left,
  5339. co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) +
  5340. ( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top,
  5341. co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
  5342. ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) -
  5343. ( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) -
  5344. this.helperProportions.width - this.margins.left,
  5345. co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
  5346. ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) -
  5347. ( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) -
  5348. this.helperProportions.height - this.margins.top
  5349. ];
  5350. }
  5351. },
  5352. _convertPositionTo: function( d, pos ) {
  5353. if ( !pos ) {
  5354. pos = this.position;
  5355. }
  5356. var mod = d === "absolute" ? 1 : -1,
  5357. scroll = this.cssPosition === "absolute" &&
  5358. !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  5359. $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
  5360. this.offsetParent :
  5361. this.scrollParent,
  5362. scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
  5363. return {
  5364. top: (
  5365. // The absolute mouse position
  5366. pos.top +
  5367. // Only for relative positioned nodes: Relative offset from element to offset parent
  5368. this.offset.relative.top * mod +
  5369. // The offsetParent's offset without borders (offset + border)
  5370. this.offset.parent.top * mod -
  5371. ( ( this.cssPosition === "fixed" ?
  5372. -this.scrollParent.scrollTop() :
  5373. ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod )
  5374. ),
  5375. left: (
  5376. // The absolute mouse position
  5377. pos.left +
  5378. // Only for relative positioned nodes: Relative offset from element to offset parent
  5379. this.offset.relative.left * mod +
  5380. // The offsetParent's offset without borders (offset + border)
  5381. this.offset.parent.left * mod -
  5382. ( ( this.cssPosition === "fixed" ?
  5383. -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
  5384. scroll.scrollLeft() ) * mod )
  5385. )
  5386. };
  5387. },
  5388. _generatePosition: function( event ) {
  5389. var top, left,
  5390. o = this.options,
  5391. pageX = event.pageX,
  5392. pageY = event.pageY,
  5393. scroll = this.cssPosition === "absolute" &&
  5394. !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  5395. $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
  5396. this.offsetParent :
  5397. this.scrollParent,
  5398. scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
  5399. // This is another very weird special case that only happens for relative elements:
  5400. // 1. If the css position is relative
  5401. // 2. and the scroll parent is the document or similar to the offset parent
  5402. // we have to refresh the relative offset during the scroll so there are no jumps
  5403. if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  5404. this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) {
  5405. this.offset.relative = this._getRelativeOffset();
  5406. }
  5407. /*
  5408. * - Position constraining -
  5409. * Constrain the position to a mix of grid, containment.
  5410. */
  5411. if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options
  5412. if ( this.containment ) {
  5413. if ( event.pageX - this.offset.click.left < this.containment[ 0 ] ) {
  5414. pageX = this.containment[ 0 ] + this.offset.click.left;
  5415. }
  5416. if ( event.pageY - this.offset.click.top < this.containment[ 1 ] ) {
  5417. pageY = this.containment[ 1 ] + this.offset.click.top;
  5418. }
  5419. if ( event.pageX - this.offset.click.left > this.containment[ 2 ] ) {
  5420. pageX = this.containment[ 2 ] + this.offset.click.left;
  5421. }
  5422. if ( event.pageY - this.offset.click.top > this.containment[ 3 ] ) {
  5423. pageY = this.containment[ 3 ] + this.offset.click.top;
  5424. }
  5425. }
  5426. if ( o.grid ) {
  5427. top = this.originalPageY + Math.round( ( pageY - this.originalPageY ) /
  5428. o.grid[ 1 ] ) * o.grid[ 1 ];
  5429. pageY = this.containment ?
  5430. ( ( top - this.offset.click.top >= this.containment[ 1 ] &&
  5431. top - this.offset.click.top <= this.containment[ 3 ] ) ?
  5432. top :
  5433. ( ( top - this.offset.click.top >= this.containment[ 1 ] ) ?
  5434. top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) :
  5435. top;
  5436. left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) /
  5437. o.grid[ 0 ] ) * o.grid[ 0 ];
  5438. pageX = this.containment ?
  5439. ( ( left - this.offset.click.left >= this.containment[ 0 ] &&
  5440. left - this.offset.click.left <= this.containment[ 2 ] ) ?
  5441. left :
  5442. ( ( left - this.offset.click.left >= this.containment[ 0 ] ) ?
  5443. left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) :
  5444. left;
  5445. }
  5446. }
  5447. return {
  5448. top: (
  5449. // The absolute mouse position
  5450. pageY -
  5451. // Click offset (relative to the element)
  5452. this.offset.click.top -
  5453. // Only for relative positioned nodes: Relative offset from element to offset parent
  5454. this.offset.relative.top -
  5455. // The offsetParent's offset without borders (offset + border)
  5456. this.offset.parent.top +
  5457. ( ( this.cssPosition === "fixed" ?
  5458. -this.scrollParent.scrollTop() :
  5459. ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) )
  5460. ),
  5461. left: (
  5462. // The absolute mouse position
  5463. pageX -
  5464. // Click offset (relative to the element)
  5465. this.offset.click.left -
  5466. // Only for relative positioned nodes: Relative offset from element to offset parent
  5467. this.offset.relative.left -
  5468. // The offsetParent's offset without borders (offset + border)
  5469. this.offset.parent.left +
  5470. ( ( this.cssPosition === "fixed" ?
  5471. -this.scrollParent.scrollLeft() :
  5472. scrollIsRootNode ? 0 : scroll.scrollLeft() ) )
  5473. )
  5474. };
  5475. },
  5476. _rearrange: function( event, i, a, hardRefresh ) {
  5477. if ( a ) {
  5478. a[ 0 ].appendChild( this.placeholder[ 0 ] );
  5479. } else {
  5480. i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ],
  5481. ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) );
  5482. }
  5483. //Various things done here to improve the performance:
  5484. // 1. we create a setTimeout, that calls refreshPositions
  5485. // 2. on the instance, we have a counter variable, that get's higher after every append
  5486. // 3. on the local scope, we copy the counter variable, and check in the timeout,
  5487. // if it's still the same
  5488. // 4. this lets only the last addition to the timeout stack through
  5489. this.counter = this.counter ? ++this.counter : 1;
  5490. var counter = this.counter;
  5491. this._delay( function() {
  5492. if ( counter === this.counter ) {
  5493. //Precompute after each DOM insertion, NOT on mousemove
  5494. this.refreshPositions( !hardRefresh );
  5495. }
  5496. } );
  5497. },
  5498. _clear: function( event, noPropagation ) {
  5499. this.reverting = false;
  5500. // We delay all events that have to be triggered to after the point where the placeholder
  5501. // has been removed and everything else normalized again
  5502. var i,
  5503. delayedTriggers = [];
  5504. // We first have to update the dom position of the actual currentItem
  5505. // Note: don't do it if the current item is already removed (by a user), or it gets
  5506. // reappended (see #4088)
  5507. if ( !this._noFinalSort && this.currentItem.parent().length ) {
  5508. this.placeholder.before( this.currentItem );
  5509. }
  5510. this._noFinalSort = null;
  5511. if ( this.helper[ 0 ] === this.currentItem[ 0 ] ) {
  5512. for ( i in this._storedCSS ) {
  5513. if ( this._storedCSS[ i ] === "auto" || this._storedCSS[ i ] === "static" ) {
  5514. this._storedCSS[ i ] = "";
  5515. }
  5516. }
  5517. this.currentItem.css( this._storedCSS );
  5518. this._removeClass( this.currentItem, "ui-sortable-helper" );
  5519. } else {
  5520. this.currentItem.show();
  5521. }
  5522. if ( this.fromOutside && !noPropagation ) {
  5523. delayedTriggers.push( function( event ) {
  5524. this._trigger( "receive", event, this._uiHash( this.fromOutside ) );
  5525. } );
  5526. }
  5527. if ( ( this.fromOutside ||
  5528. this.domPosition.prev !==
  5529. this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] ||
  5530. this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) {
  5531. // Trigger update callback if the DOM position has changed
  5532. delayedTriggers.push( function( event ) {
  5533. this._trigger( "update", event, this._uiHash() );
  5534. } );
  5535. }
  5536. // Check if the items Container has Changed and trigger appropriate
  5537. // events.
  5538. if ( this !== this.currentContainer ) {
  5539. if ( !noPropagation ) {
  5540. delayedTriggers.push( function( event ) {
  5541. this._trigger( "remove", event, this._uiHash() );
  5542. } );
  5543. delayedTriggers.push( ( function( c ) {
  5544. return function( event ) {
  5545. c._trigger( "receive", event, this._uiHash( this ) );
  5546. };
  5547. } ).call( this, this.currentContainer ) );
  5548. delayedTriggers.push( ( function( c ) {
  5549. return function( event ) {
  5550. c._trigger( "update", event, this._uiHash( this ) );
  5551. };
  5552. } ).call( this, this.currentContainer ) );
  5553. }
  5554. }
  5555. //Post events to containers
  5556. function delayEvent( type, instance, container ) {
  5557. return function( event ) {
  5558. container._trigger( type, event, instance._uiHash( instance ) );
  5559. };
  5560. }
  5561. for ( i = this.containers.length - 1; i >= 0; i-- ) {
  5562. if ( !noPropagation ) {
  5563. delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
  5564. }
  5565. if ( this.containers[ i ].containerCache.over ) {
  5566. delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
  5567. this.containers[ i ].containerCache.over = 0;
  5568. }
  5569. }
  5570. //Do what was originally in plugins
  5571. if ( this.storedCursor ) {
  5572. this.document.find( "body" ).css( "cursor", this.storedCursor );
  5573. this.storedStylesheet.remove();
  5574. }
  5575. if ( this._storedOpacity ) {
  5576. this.helper.css( "opacity", this._storedOpacity );
  5577. }
  5578. if ( this._storedZIndex ) {
  5579. this.helper.css( "zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex );
  5580. }
  5581. this.dragging = false;
  5582. if ( !noPropagation ) {
  5583. this._trigger( "beforeStop", event, this._uiHash() );
  5584. }
  5585. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
  5586. // it unbinds ALL events from the original node!
  5587. this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );
  5588. if ( !this.cancelHelperRemoval ) {
  5589. if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
  5590. this.helper.remove();
  5591. }
  5592. this.helper = null;
  5593. }
  5594. if ( !noPropagation ) {
  5595. for ( i = 0; i < delayedTriggers.length; i++ ) {
  5596. // Trigger all delayed events
  5597. delayedTriggers[ i ].call( this, event );
  5598. }
  5599. this._trigger( "stop", event, this._uiHash() );
  5600. }
  5601. this.fromOutside = false;
  5602. return !this.cancelHelperRemoval;
  5603. },
  5604. _trigger: function() {
  5605. if ( $.Widget.prototype._trigger.apply( this, arguments ) === false ) {
  5606. this.cancel();
  5607. }
  5608. },
  5609. _uiHash: function( _inst ) {
  5610. var inst = _inst || this;
  5611. return {
  5612. helper: inst.helper,
  5613. placeholder: inst.placeholder || $( [] ),
  5614. position: inst.position,
  5615. originalPosition: inst.originalPosition,
  5616. offset: inst.positionAbs,
  5617. item: inst.currentItem,
  5618. sender: _inst ? _inst.element : null
  5619. };
  5620. }
  5621. } );
  5622. /*!
  5623. * jQuery UI Accordion 1.13.2
  5624. * http://jqueryui.com
  5625. *
  5626. * Copyright jQuery Foundation and other contributors
  5627. * Released under the MIT license.
  5628. * http://jquery.org/license
  5629. */
  5630. //>>label: Accordion
  5631. //>>group: Widgets
  5632. /* eslint-disable max-len */
  5633. //>>description: Displays collapsible content panels for presenting information in a limited amount of space.
  5634. /* eslint-enable max-len */
  5635. //>>docs: http://api.jqueryui.com/accordion/
  5636. //>>demos: http://jqueryui.com/accordion/
  5637. //>>css.structure: ../../themes/base/core.css
  5638. //>>css.structure: ../../themes/base/accordion.css
  5639. //>>css.theme: ../../themes/base/theme.css
  5640. var widgetsAccordion = $.widget( "ui.accordion", {
  5641. version: "1.13.2",
  5642. options: {
  5643. active: 0,
  5644. animate: {},
  5645. classes: {
  5646. "ui-accordion-header": "ui-corner-top",
  5647. "ui-accordion-header-collapsed": "ui-corner-all",
  5648. "ui-accordion-content": "ui-corner-bottom"
  5649. },
  5650. collapsible: false,
  5651. event: "click",
  5652. header: function( elem ) {
  5653. return elem.find( "> li > :first-child" ).add( elem.find( "> :not(li)" ).even() );
  5654. },
  5655. heightStyle: "auto",
  5656. icons: {
  5657. activeHeader: "ui-icon-triangle-1-s",
  5658. header: "ui-icon-triangle-1-e"
  5659. },
  5660. // Callbacks
  5661. activate: null,
  5662. beforeActivate: null
  5663. },
  5664. hideProps: {
  5665. borderTopWidth: "hide",
  5666. borderBottomWidth: "hide",
  5667. paddingTop: "hide",
  5668. paddingBottom: "hide",
  5669. height: "hide"
  5670. },
  5671. showProps: {
  5672. borderTopWidth: "show",
  5673. borderBottomWidth: "show",
  5674. paddingTop: "show",
  5675. paddingBottom: "show",
  5676. height: "show"
  5677. },
  5678. _create: function() {
  5679. var options = this.options;
  5680. this.prevShow = this.prevHide = $();
  5681. this._addClass( "ui-accordion", "ui-widget ui-helper-reset" );
  5682. this.element.attr( "role", "tablist" );
  5683. // Don't allow collapsible: false and active: false / null
  5684. if ( !options.collapsible && ( options.active === false || options.active == null ) ) {
  5685. options.active = 0;
  5686. }
  5687. this._processPanels();
  5688. // handle negative values
  5689. if ( options.active < 0 ) {
  5690. options.active += this.headers.length;
  5691. }
  5692. this._refresh();
  5693. },
  5694. _getCreateEventData: function() {
  5695. return {
  5696. header: this.active,
  5697. panel: !this.active.length ? $() : this.active.next()
  5698. };
  5699. },
  5700. _createIcons: function() {
  5701. var icon, children,
  5702. icons = this.options.icons;
  5703. if ( icons ) {
  5704. icon = $( "<span>" );
  5705. this._addClass( icon, "ui-accordion-header-icon", "ui-icon " + icons.header );
  5706. icon.prependTo( this.headers );
  5707. children = this.active.children( ".ui-accordion-header-icon" );
  5708. this._removeClass( children, icons.header )
  5709. ._addClass( children, null, icons.activeHeader )
  5710. ._addClass( this.headers, "ui-accordion-icons" );
  5711. }
  5712. },
  5713. _destroyIcons: function() {
  5714. this._removeClass( this.headers, "ui-accordion-icons" );
  5715. this.headers.children( ".ui-accordion-header-icon" ).remove();
  5716. },
  5717. _destroy: function() {
  5718. var contents;
  5719. // Clean up main element
  5720. this.element.removeAttr( "role" );
  5721. // Clean up headers
  5722. this.headers
  5723. .removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" )
  5724. .removeUniqueId();
  5725. this._destroyIcons();
  5726. // Clean up content panels
  5727. contents = this.headers.next()
  5728. .css( "display", "" )
  5729. .removeAttr( "role aria-hidden aria-labelledby" )
  5730. .removeUniqueId();
  5731. if ( this.options.heightStyle !== "content" ) {
  5732. contents.css( "height", "" );
  5733. }
  5734. },
  5735. _setOption: function( key, value ) {
  5736. if ( key === "active" ) {
  5737. // _activate() will handle invalid values and update this.options
  5738. this._activate( value );
  5739. return;
  5740. }
  5741. if ( key === "event" ) {
  5742. if ( this.options.event ) {
  5743. this._off( this.headers, this.options.event );
  5744. }
  5745. this._setupEvents( value );
  5746. }
  5747. this._super( key, value );
  5748. // Setting collapsible: false while collapsed; open first panel
  5749. if ( key === "collapsible" && !value && this.options.active === false ) {
  5750. this._activate( 0 );
  5751. }
  5752. if ( key === "icons" ) {
  5753. this._destroyIcons();
  5754. if ( value ) {
  5755. this._createIcons();
  5756. }
  5757. }
  5758. },
  5759. _setOptionDisabled: function( value ) {
  5760. this._super( value );
  5761. this.element.attr( "aria-disabled", value );
  5762. // Support: IE8 Only
  5763. // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE
  5764. // so we need to add the disabled class to the headers and panels
  5765. this._toggleClass( null, "ui-state-disabled", !!value );
  5766. this._toggleClass( this.headers.add( this.headers.next() ), null, "ui-state-disabled",
  5767. !!value );
  5768. },
  5769. _keydown: function( event ) {
  5770. if ( event.altKey || event.ctrlKey ) {
  5771. return;
  5772. }
  5773. var keyCode = $.ui.keyCode,
  5774. length = this.headers.length,
  5775. currentIndex = this.headers.index( event.target ),
  5776. toFocus = false;
  5777. switch ( event.keyCode ) {
  5778. case keyCode.RIGHT:
  5779. case keyCode.DOWN:
  5780. toFocus = this.headers[ ( currentIndex + 1 ) % length ];
  5781. break;
  5782. case keyCode.LEFT:
  5783. case keyCode.UP:
  5784. toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
  5785. break;
  5786. case keyCode.SPACE:
  5787. case keyCode.ENTER:
  5788. this._eventHandler( event );
  5789. break;
  5790. case keyCode.HOME:
  5791. toFocus = this.headers[ 0 ];
  5792. break;
  5793. case keyCode.END:
  5794. toFocus = this.headers[ length - 1 ];
  5795. break;
  5796. }
  5797. if ( toFocus ) {
  5798. $( event.target ).attr( "tabIndex", -1 );
  5799. $( toFocus ).attr( "tabIndex", 0 );
  5800. $( toFocus ).trigger( "focus" );
  5801. event.preventDefault();
  5802. }
  5803. },
  5804. _panelKeyDown: function( event ) {
  5805. if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
  5806. $( event.currentTarget ).prev().trigger( "focus" );
  5807. }
  5808. },
  5809. refresh: function() {
  5810. var options = this.options;
  5811. this._processPanels();
  5812. // Was collapsed or no panel
  5813. if ( ( options.active === false && options.collapsible === true ) ||
  5814. !this.headers.length ) {
  5815. options.active = false;
  5816. this.active = $();
  5817. // active false only when collapsible is true
  5818. } else if ( options.active === false ) {
  5819. this._activate( 0 );
  5820. // was active, but active panel is gone
  5821. } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
  5822. // all remaining panel are disabled
  5823. if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) {
  5824. options.active = false;
  5825. this.active = $();
  5826. // activate previous panel
  5827. } else {
  5828. this._activate( Math.max( 0, options.active - 1 ) );
  5829. }
  5830. // was active, active panel still exists
  5831. } else {
  5832. // make sure active index is correct
  5833. options.active = this.headers.index( this.active );
  5834. }
  5835. this._destroyIcons();
  5836. this._refresh();
  5837. },
  5838. _processPanels: function() {
  5839. var prevHeaders = this.headers,
  5840. prevPanels = this.panels;
  5841. if ( typeof this.options.header === "function" ) {
  5842. this.headers = this.options.header( this.element );
  5843. } else {
  5844. this.headers = this.element.find( this.options.header );
  5845. }
  5846. this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed",
  5847. "ui-state-default" );
  5848. this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide();
  5849. this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" );
  5850. // Avoid memory leaks (#10056)
  5851. if ( prevPanels ) {
  5852. this._off( prevHeaders.not( this.headers ) );
  5853. this._off( prevPanels.not( this.panels ) );
  5854. }
  5855. },
  5856. _refresh: function() {
  5857. var maxHeight,
  5858. options = this.options,
  5859. heightStyle = options.heightStyle,
  5860. parent = this.element.parent();
  5861. this.active = this._findActive( options.active );
  5862. this._addClass( this.active, "ui-accordion-header-active", "ui-state-active" )
  5863. ._removeClass( this.active, "ui-accordion-header-collapsed" );
  5864. this._addClass( this.active.next(), "ui-accordion-content-active" );
  5865. this.active.next().show();
  5866. this.headers
  5867. .attr( "role", "tab" )
  5868. .each( function() {
  5869. var header = $( this ),
  5870. headerId = header.uniqueId().attr( "id" ),
  5871. panel = header.next(),
  5872. panelId = panel.uniqueId().attr( "id" );
  5873. header.attr( "aria-controls", panelId );
  5874. panel.attr( "aria-labelledby", headerId );
  5875. } )
  5876. .next()
  5877. .attr( "role", "tabpanel" );
  5878. this.headers
  5879. .not( this.active )
  5880. .attr( {
  5881. "aria-selected": "false",
  5882. "aria-expanded": "false",
  5883. tabIndex: -1
  5884. } )
  5885. .next()
  5886. .attr( {
  5887. "aria-hidden": "true"
  5888. } )
  5889. .hide();
  5890. // Make sure at least one header is in the tab order
  5891. if ( !this.active.length ) {
  5892. this.headers.eq( 0 ).attr( "tabIndex", 0 );
  5893. } else {
  5894. this.active.attr( {
  5895. "aria-selected": "true",
  5896. "aria-expanded": "true",
  5897. tabIndex: 0
  5898. } )
  5899. .next()
  5900. .attr( {
  5901. "aria-hidden": "false"
  5902. } );
  5903. }
  5904. this._createIcons();
  5905. this._setupEvents( options.event );
  5906. if ( heightStyle === "fill" ) {
  5907. maxHeight = parent.height();
  5908. this.element.siblings( ":visible" ).each( function() {
  5909. var elem = $( this ),
  5910. position = elem.css( "position" );
  5911. if ( position === "absolute" || position === "fixed" ) {
  5912. return;
  5913. }
  5914. maxHeight -= elem.outerHeight( true );
  5915. } );
  5916. this.headers.each( function() {
  5917. maxHeight -= $( this ).outerHeight( true );
  5918. } );
  5919. this.headers.next()
  5920. .each( function() {
  5921. $( this ).height( Math.max( 0, maxHeight -
  5922. $( this ).innerHeight() + $( this ).height() ) );
  5923. } )
  5924. .css( "overflow", "auto" );
  5925. } else if ( heightStyle === "auto" ) {
  5926. maxHeight = 0;
  5927. this.headers.next()
  5928. .each( function() {
  5929. var isVisible = $( this ).is( ":visible" );
  5930. if ( !isVisible ) {
  5931. $( this ).show();
  5932. }
  5933. maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
  5934. if ( !isVisible ) {
  5935. $( this ).hide();
  5936. }
  5937. } )
  5938. .height( maxHeight );
  5939. }
  5940. },
  5941. _activate: function( index ) {
  5942. var active = this._findActive( index )[ 0 ];
  5943. // Trying to activate the already active panel
  5944. if ( active === this.active[ 0 ] ) {
  5945. return;
  5946. }
  5947. // Trying to collapse, simulate a click on the currently active header
  5948. active = active || this.active[ 0 ];
  5949. this._eventHandler( {
  5950. target: active,
  5951. currentTarget: active,
  5952. preventDefault: $.noop
  5953. } );
  5954. },
  5955. _findActive: function( selector ) {
  5956. return typeof selector === "number" ? this.headers.eq( selector ) : $();
  5957. },
  5958. _setupEvents: function( event ) {
  5959. var events = {
  5960. keydown: "_keydown"
  5961. };
  5962. if ( event ) {
  5963. $.each( event.split( " " ), function( index, eventName ) {
  5964. events[ eventName ] = "_eventHandler";
  5965. } );
  5966. }
  5967. this._off( this.headers.add( this.headers.next() ) );
  5968. this._on( this.headers, events );
  5969. this._on( this.headers.next(), { keydown: "_panelKeyDown" } );
  5970. this._hoverable( this.headers );
  5971. this._focusable( this.headers );
  5972. },
  5973. _eventHandler: function( event ) {
  5974. var activeChildren, clickedChildren,
  5975. options = this.options,
  5976. active = this.active,
  5977. clicked = $( event.currentTarget ),
  5978. clickedIsActive = clicked[ 0 ] === active[ 0 ],
  5979. collapsing = clickedIsActive && options.collapsible,
  5980. toShow = collapsing ? $() : clicked.next(),
  5981. toHide = active.next(),
  5982. eventData = {
  5983. oldHeader: active,
  5984. oldPanel: toHide,
  5985. newHeader: collapsing ? $() : clicked,
  5986. newPanel: toShow
  5987. };
  5988. event.preventDefault();
  5989. if (
  5990. // click on active header, but not collapsible
  5991. ( clickedIsActive && !options.collapsible ) ||
  5992. // allow canceling activation
  5993. ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
  5994. return;
  5995. }
  5996. options.active = collapsing ? false : this.headers.index( clicked );
  5997. // When the call to ._toggle() comes after the class changes
  5998. // it causes a very odd bug in IE 8 (see #6720)
  5999. this.active = clickedIsActive ? $() : clicked;
  6000. this._toggle( eventData );
  6001. // Switch classes
  6002. // corner classes on the previously active header stay after the animation
  6003. this._removeClass( active, "ui-accordion-header-active", "ui-state-active" );
  6004. if ( options.icons ) {
  6005. activeChildren = active.children( ".ui-accordion-header-icon" );
  6006. this._removeClass( activeChildren, null, options.icons.activeHeader )
  6007. ._addClass( activeChildren, null, options.icons.header );
  6008. }
  6009. if ( !clickedIsActive ) {
  6010. this._removeClass( clicked, "ui-accordion-header-collapsed" )
  6011. ._addClass( clicked, "ui-accordion-header-active", "ui-state-active" );
  6012. if ( options.icons ) {
  6013. clickedChildren = clicked.children( ".ui-accordion-header-icon" );
  6014. this._removeClass( clickedChildren, null, options.icons.header )
  6015. ._addClass( clickedChildren, null, options.icons.activeHeader );
  6016. }
  6017. this._addClass( clicked.next(), "ui-accordion-content-active" );
  6018. }
  6019. },
  6020. _toggle: function( data ) {
  6021. var toShow = data.newPanel,
  6022. toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
  6023. // Handle activating a panel during the animation for another activation
  6024. this.prevShow.add( this.prevHide ).stop( true, true );
  6025. this.prevShow = toShow;
  6026. this.prevHide = toHide;
  6027. if ( this.options.animate ) {
  6028. this._animate( toShow, toHide, data );
  6029. } else {
  6030. toHide.hide();
  6031. toShow.show();
  6032. this._toggleComplete( data );
  6033. }
  6034. toHide.attr( {
  6035. "aria-hidden": "true"
  6036. } );
  6037. toHide.prev().attr( {
  6038. "aria-selected": "false",
  6039. "aria-expanded": "false"
  6040. } );
  6041. // if we're switching panels, remove the old header from the tab order
  6042. // if we're opening from collapsed state, remove the previous header from the tab order
  6043. // if we're collapsing, then keep the collapsing header in the tab order
  6044. if ( toShow.length && toHide.length ) {
  6045. toHide.prev().attr( {
  6046. "tabIndex": -1,
  6047. "aria-expanded": "false"
  6048. } );
  6049. } else if ( toShow.length ) {
  6050. this.headers.filter( function() {
  6051. return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;
  6052. } )
  6053. .attr( "tabIndex", -1 );
  6054. }
  6055. toShow
  6056. .attr( "aria-hidden", "false" )
  6057. .prev()
  6058. .attr( {
  6059. "aria-selected": "true",
  6060. "aria-expanded": "true",
  6061. tabIndex: 0
  6062. } );
  6063. },
  6064. _animate: function( toShow, toHide, data ) {
  6065. var total, easing, duration,
  6066. that = this,
  6067. adjust = 0,
  6068. boxSizing = toShow.css( "box-sizing" ),
  6069. down = toShow.length &&
  6070. ( !toHide.length || ( toShow.index() < toHide.index() ) ),
  6071. animate = this.options.animate || {},
  6072. options = down && animate.down || animate,
  6073. complete = function() {
  6074. that._toggleComplete( data );
  6075. };
  6076. if ( typeof options === "number" ) {
  6077. duration = options;
  6078. }
  6079. if ( typeof options === "string" ) {
  6080. easing = options;
  6081. }
  6082. // fall back from options to animation in case of partial down settings
  6083. easing = easing || options.easing || animate.easing;
  6084. duration = duration || options.duration || animate.duration;
  6085. if ( !toHide.length ) {
  6086. return toShow.animate( this.showProps, duration, easing, complete );
  6087. }
  6088. if ( !toShow.length ) {
  6089. return toHide.animate( this.hideProps, duration, easing, complete );
  6090. }
  6091. total = toShow.show().outerHeight();
  6092. toHide.animate( this.hideProps, {
  6093. duration: duration,
  6094. easing: easing,
  6095. step: function( now, fx ) {
  6096. fx.now = Math.round( now );
  6097. }
  6098. } );
  6099. toShow
  6100. .hide()
  6101. .animate( this.showProps, {
  6102. duration: duration,
  6103. easing: easing,
  6104. complete: complete,
  6105. step: function( now, fx ) {
  6106. fx.now = Math.round( now );
  6107. if ( fx.prop !== "height" ) {
  6108. if ( boxSizing === "content-box" ) {
  6109. adjust += fx.now;
  6110. }
  6111. } else if ( that.options.heightStyle !== "content" ) {
  6112. fx.now = Math.round( total - toHide.outerHeight() - adjust );
  6113. adjust = 0;
  6114. }
  6115. }
  6116. } );
  6117. },
  6118. _toggleComplete: function( data ) {
  6119. var toHide = data.oldPanel,
  6120. prev = toHide.prev();
  6121. this._removeClass( toHide, "ui-accordion-content-active" );
  6122. this._removeClass( prev, "ui-accordion-header-active" )
  6123. ._addClass( prev, "ui-accordion-header-collapsed" );
  6124. // Work around for rendering bug in IE (#5421)
  6125. if ( toHide.length ) {
  6126. toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className;
  6127. }
  6128. this._trigger( "activate", null, data );
  6129. }
  6130. } );
  6131. /*!
  6132. * jQuery UI Menu 1.13.2
  6133. * http://jqueryui.com
  6134. *
  6135. * Copyright jQuery Foundation and other contributors
  6136. * Released under the MIT license.
  6137. * http://jquery.org/license
  6138. */
  6139. //>>label: Menu
  6140. //>>group: Widgets
  6141. //>>description: Creates nestable menus.
  6142. //>>docs: http://api.jqueryui.com/menu/
  6143. //>>demos: http://jqueryui.com/menu/
  6144. //>>css.structure: ../../themes/base/core.css
  6145. //>>css.structure: ../../themes/base/menu.css
  6146. //>>css.theme: ../../themes/base/theme.css
  6147. var widgetsMenu = $.widget( "ui.menu", {
  6148. version: "1.13.2",
  6149. defaultElement: "<ul>",
  6150. delay: 300,
  6151. options: {
  6152. icons: {
  6153. submenu: "ui-icon-caret-1-e"
  6154. },
  6155. items: "> *",
  6156. menus: "ul",
  6157. position: {
  6158. my: "left top",
  6159. at: "right top"
  6160. },
  6161. role: "menu",
  6162. // Callbacks
  6163. blur: null,
  6164. focus: null,
  6165. select: null
  6166. },
  6167. _create: function() {
  6168. this.activeMenu = this.element;
  6169. // Flag used to prevent firing of the click handler
  6170. // as the event bubbles up through nested menus
  6171. this.mouseHandled = false;
  6172. this.lastMousePosition = { x: null, y: null };
  6173. this.element
  6174. .uniqueId()
  6175. .attr( {
  6176. role: this.options.role,
  6177. tabIndex: 0
  6178. } );
  6179. this._addClass( "ui-menu", "ui-widget ui-widget-content" );
  6180. this._on( {
  6181. // Prevent focus from sticking to links inside menu after clicking
  6182. // them (focus should always stay on UL during navigation).
  6183. "mousedown .ui-menu-item": function( event ) {
  6184. event.preventDefault();
  6185. this._activateItem( event );
  6186. },
  6187. "click .ui-menu-item": function( event ) {
  6188. var target = $( event.target );
  6189. var active = $( $.ui.safeActiveElement( this.document[ 0 ] ) );
  6190. if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
  6191. this.select( event );
  6192. // Only set the mouseHandled flag if the event will bubble, see #9469.
  6193. if ( !event.isPropagationStopped() ) {
  6194. this.mouseHandled = true;
  6195. }
  6196. // Open submenu on click
  6197. if ( target.has( ".ui-menu" ).length ) {
  6198. this.expand( event );
  6199. } else if ( !this.element.is( ":focus" ) &&
  6200. active.closest( ".ui-menu" ).length ) {
  6201. // Redirect focus to the menu
  6202. this.element.trigger( "focus", [ true ] );
  6203. // If the active item is on the top level, let it stay active.
  6204. // Otherwise, blur the active item since it is no longer visible.
  6205. if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
  6206. clearTimeout( this.timer );
  6207. }
  6208. }
  6209. }
  6210. },
  6211. "mouseenter .ui-menu-item": "_activateItem",
  6212. "mousemove .ui-menu-item": "_activateItem",
  6213. mouseleave: "collapseAll",
  6214. "mouseleave .ui-menu": "collapseAll",
  6215. focus: function( event, keepActiveItem ) {
  6216. // If there's already an active item, keep it active
  6217. // If not, activate the first item
  6218. var item = this.active || this._menuItems().first();
  6219. if ( !keepActiveItem ) {
  6220. this.focus( event, item );
  6221. }
  6222. },
  6223. blur: function( event ) {
  6224. this._delay( function() {
  6225. var notContained = !$.contains(
  6226. this.element[ 0 ],
  6227. $.ui.safeActiveElement( this.document[ 0 ] )
  6228. );
  6229. if ( notContained ) {
  6230. this.collapseAll( event );
  6231. }
  6232. } );
  6233. },
  6234. keydown: "_keydown"
  6235. } );
  6236. this.refresh();
  6237. // Clicks outside of a menu collapse any open menus
  6238. this._on( this.document, {
  6239. click: function( event ) {
  6240. if ( this._closeOnDocumentClick( event ) ) {
  6241. this.collapseAll( event, true );
  6242. }
  6243. // Reset the mouseHandled flag
  6244. this.mouseHandled = false;
  6245. }
  6246. } );
  6247. },
  6248. _activateItem: function( event ) {
  6249. // Ignore mouse events while typeahead is active, see #10458.
  6250. // Prevents focusing the wrong item when typeahead causes a scroll while the mouse
  6251. // is over an item in the menu
  6252. if ( this.previousFilter ) {
  6253. return;
  6254. }
  6255. // If the mouse didn't actually move, but the page was scrolled, ignore the event (#9356)
  6256. if ( event.clientX === this.lastMousePosition.x &&
  6257. event.clientY === this.lastMousePosition.y ) {
  6258. return;
  6259. }
  6260. this.lastMousePosition = {
  6261. x: event.clientX,
  6262. y: event.clientY
  6263. };
  6264. var actualTarget = $( event.target ).closest( ".ui-menu-item" ),
  6265. target = $( event.currentTarget );
  6266. // Ignore bubbled events on parent items, see #11641
  6267. if ( actualTarget[ 0 ] !== target[ 0 ] ) {
  6268. return;
  6269. }
  6270. // If the item is already active, there's nothing to do
  6271. if ( target.is( ".ui-state-active" ) ) {
  6272. return;
  6273. }
  6274. // Remove ui-state-active class from siblings of the newly focused menu item
  6275. // to avoid a jump caused by adjacent elements both having a class with a border
  6276. this._removeClass( target.siblings().children( ".ui-state-active" ),
  6277. null, "ui-state-active" );
  6278. this.focus( event, target );
  6279. },
  6280. _destroy: function() {
  6281. var items = this.element.find( ".ui-menu-item" )
  6282. .removeAttr( "role aria-disabled" ),
  6283. submenus = items.children( ".ui-menu-item-wrapper" )
  6284. .removeUniqueId()
  6285. .removeAttr( "tabIndex role aria-haspopup" );
  6286. // Destroy (sub)menus
  6287. this.element
  6288. .removeAttr( "aria-activedescendant" )
  6289. .find( ".ui-menu" ).addBack()
  6290. .removeAttr( "role aria-labelledby aria-expanded aria-hidden aria-disabled " +
  6291. "tabIndex" )
  6292. .removeUniqueId()
  6293. .show();
  6294. submenus.children().each( function() {
  6295. var elem = $( this );
  6296. if ( elem.data( "ui-menu-submenu-caret" ) ) {
  6297. elem.remove();
  6298. }
  6299. } );
  6300. },
  6301. _keydown: function( event ) {
  6302. var match, prev, character, skip,
  6303. preventDefault = true;
  6304. switch ( event.keyCode ) {
  6305. case $.ui.keyCode.PAGE_UP:
  6306. this.previousPage( event );
  6307. break;
  6308. case $.ui.keyCode.PAGE_DOWN:
  6309. this.nextPage( event );
  6310. break;
  6311. case $.ui.keyCode.HOME:
  6312. this._move( "first", "first", event );
  6313. break;
  6314. case $.ui.keyCode.END:
  6315. this._move( "last", "last", event );
  6316. break;
  6317. case $.ui.keyCode.UP:
  6318. this.previous( event );
  6319. break;
  6320. case $.ui.keyCode.DOWN:
  6321. this.next( event );
  6322. break;
  6323. case $.ui.keyCode.LEFT:
  6324. this.collapse( event );
  6325. break;
  6326. case $.ui.keyCode.RIGHT:
  6327. if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
  6328. this.expand( event );
  6329. }
  6330. break;
  6331. case $.ui.keyCode.ENTER:
  6332. case $.ui.keyCode.SPACE:
  6333. this._activate( event );
  6334. break;
  6335. case $.ui.keyCode.ESCAPE:
  6336. this.collapse( event );
  6337. break;
  6338. default:
  6339. preventDefault = false;
  6340. prev = this.previousFilter || "";
  6341. skip = false;
  6342. // Support number pad values
  6343. character = event.keyCode >= 96 && event.keyCode <= 105 ?
  6344. ( event.keyCode - 96 ).toString() : String.fromCharCode( event.keyCode );
  6345. clearTimeout( this.filterTimer );
  6346. if ( character === prev ) {
  6347. skip = true;
  6348. } else {
  6349. character = prev + character;
  6350. }
  6351. match = this._filterMenuItems( character );
  6352. match = skip && match.index( this.active.next() ) !== -1 ?
  6353. this.active.nextAll( ".ui-menu-item" ) :
  6354. match;
  6355. // If no matches on the current filter, reset to the last character pressed
  6356. // to move down the menu to the first item that starts with that character
  6357. if ( !match.length ) {
  6358. character = String.fromCharCode( event.keyCode );
  6359. match = this._filterMenuItems( character );
  6360. }
  6361. if ( match.length ) {
  6362. this.focus( event, match );
  6363. this.previousFilter = character;
  6364. this.filterTimer = this._delay( function() {
  6365. delete this.previousFilter;
  6366. }, 1000 );
  6367. } else {
  6368. delete this.previousFilter;
  6369. }
  6370. }
  6371. if ( preventDefault ) {
  6372. event.preventDefault();
  6373. }
  6374. },
  6375. _activate: function( event ) {
  6376. if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
  6377. if ( this.active.children( "[aria-haspopup='true']" ).length ) {
  6378. this.expand( event );
  6379. } else {
  6380. this.select( event );
  6381. }
  6382. }
  6383. },
  6384. refresh: function() {
  6385. var menus, items, newSubmenus, newItems, newWrappers,
  6386. that = this,
  6387. icon = this.options.icons.submenu,
  6388. submenus = this.element.find( this.options.menus );
  6389. this._toggleClass( "ui-menu-icons", null, !!this.element.find( ".ui-icon" ).length );
  6390. // Initialize nested menus
  6391. newSubmenus = submenus.filter( ":not(.ui-menu)" )
  6392. .hide()
  6393. .attr( {
  6394. role: this.options.role,
  6395. "aria-hidden": "true",
  6396. "aria-expanded": "false"
  6397. } )
  6398. .each( function() {
  6399. var menu = $( this ),
  6400. item = menu.prev(),
  6401. submenuCaret = $( "<span>" ).data( "ui-menu-submenu-caret", true );
  6402. that._addClass( submenuCaret, "ui-menu-icon", "ui-icon " + icon );
  6403. item
  6404. .attr( "aria-haspopup", "true" )
  6405. .prepend( submenuCaret );
  6406. menu.attr( "aria-labelledby", item.attr( "id" ) );
  6407. } );
  6408. this._addClass( newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front" );
  6409. menus = submenus.add( this.element );
  6410. items = menus.find( this.options.items );
  6411. // Initialize menu-items containing spaces and/or dashes only as dividers
  6412. items.not( ".ui-menu-item" ).each( function() {
  6413. var item = $( this );
  6414. if ( that._isDivider( item ) ) {
  6415. that._addClass( item, "ui-menu-divider", "ui-widget-content" );
  6416. }
  6417. } );
  6418. // Don't refresh list items that are already adapted
  6419. newItems = items.not( ".ui-menu-item, .ui-menu-divider" );
  6420. newWrappers = newItems.children()
  6421. .not( ".ui-menu" )
  6422. .uniqueId()
  6423. .attr( {
  6424. tabIndex: -1,
  6425. role: this._itemRole()
  6426. } );
  6427. this._addClass( newItems, "ui-menu-item" )
  6428. ._addClass( newWrappers, "ui-menu-item-wrapper" );
  6429. // Add aria-disabled attribute to any disabled menu item
  6430. items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
  6431. // If the active item has been removed, blur the menu
  6432. if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
  6433. this.blur();
  6434. }
  6435. },
  6436. _itemRole: function() {
  6437. return {
  6438. menu: "menuitem",
  6439. listbox: "option"
  6440. }[ this.options.role ];
  6441. },
  6442. _setOption: function( key, value ) {
  6443. if ( key === "icons" ) {
  6444. var icons = this.element.find( ".ui-menu-icon" );
  6445. this._removeClass( icons, null, this.options.icons.submenu )
  6446. ._addClass( icons, null, value.submenu );
  6447. }
  6448. this._super( key, value );
  6449. },
  6450. _setOptionDisabled: function( value ) {
  6451. this._super( value );
  6452. this.element.attr( "aria-disabled", String( value ) );
  6453. this._toggleClass( null, "ui-state-disabled", !!value );
  6454. },
  6455. focus: function( event, item ) {
  6456. var nested, focused, activeParent;
  6457. this.blur( event, event && event.type === "focus" );
  6458. this._scrollIntoView( item );
  6459. this.active = item.first();
  6460. focused = this.active.children( ".ui-menu-item-wrapper" );
  6461. this._addClass( focused, null, "ui-state-active" );
  6462. // Only update aria-activedescendant if there's a role
  6463. // otherwise we assume focus is managed elsewhere
  6464. if ( this.options.role ) {
  6465. this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
  6466. }
  6467. // Highlight active parent menu item, if any
  6468. activeParent = this.active
  6469. .parent()
  6470. .closest( ".ui-menu-item" )
  6471. .children( ".ui-menu-item-wrapper" );
  6472. this._addClass( activeParent, null, "ui-state-active" );
  6473. if ( event && event.type === "keydown" ) {
  6474. this._close();
  6475. } else {
  6476. this.timer = this._delay( function() {
  6477. this._close();
  6478. }, this.delay );
  6479. }
  6480. nested = item.children( ".ui-menu" );
  6481. if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {
  6482. this._startOpening( nested );
  6483. }
  6484. this.activeMenu = item.parent();
  6485. this._trigger( "focus", event, { item: item } );
  6486. },
  6487. _scrollIntoView: function( item ) {
  6488. var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
  6489. if ( this._hasScroll() ) {
  6490. borderTop = parseFloat( $.css( this.activeMenu[ 0 ], "borderTopWidth" ) ) || 0;
  6491. paddingTop = parseFloat( $.css( this.activeMenu[ 0 ], "paddingTop" ) ) || 0;
  6492. offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
  6493. scroll = this.activeMenu.scrollTop();
  6494. elementHeight = this.activeMenu.height();
  6495. itemHeight = item.outerHeight();
  6496. if ( offset < 0 ) {
  6497. this.activeMenu.scrollTop( scroll + offset );
  6498. } else if ( offset + itemHeight > elementHeight ) {
  6499. this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
  6500. }
  6501. }
  6502. },
  6503. blur: function( event, fromFocus ) {
  6504. if ( !fromFocus ) {
  6505. clearTimeout( this.timer );
  6506. }
  6507. if ( !this.active ) {
  6508. return;
  6509. }
  6510. this._removeClass( this.active.children( ".ui-menu-item-wrapper" ),
  6511. null, "ui-state-active" );
  6512. this._trigger( "blur", event, { item: this.active } );
  6513. this.active = null;
  6514. },
  6515. _startOpening: function( submenu ) {
  6516. clearTimeout( this.timer );
  6517. // Don't open if already open fixes a Firefox bug that caused a .5 pixel
  6518. // shift in the submenu position when mousing over the caret icon
  6519. if ( submenu.attr( "aria-hidden" ) !== "true" ) {
  6520. return;
  6521. }
  6522. this.timer = this._delay( function() {
  6523. this._close();
  6524. this._open( submenu );
  6525. }, this.delay );
  6526. },
  6527. _open: function( submenu ) {
  6528. var position = $.extend( {
  6529. of: this.active
  6530. }, this.options.position );
  6531. clearTimeout( this.timer );
  6532. this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
  6533. .hide()
  6534. .attr( "aria-hidden", "true" );
  6535. submenu
  6536. .show()
  6537. .removeAttr( "aria-hidden" )
  6538. .attr( "aria-expanded", "true" )
  6539. .position( position );
  6540. },
  6541. collapseAll: function( event, all ) {
  6542. clearTimeout( this.timer );
  6543. this.timer = this._delay( function() {
  6544. // If we were passed an event, look for the submenu that contains the event
  6545. var currentMenu = all ? this.element :
  6546. $( event && event.target ).closest( this.element.find( ".ui-menu" ) );
  6547. // If we found no valid submenu ancestor, use the main menu to close all
  6548. // sub menus anyway
  6549. if ( !currentMenu.length ) {
  6550. currentMenu = this.element;
  6551. }
  6552. this._close( currentMenu );
  6553. this.blur( event );
  6554. // Work around active item staying active after menu is blurred
  6555. this._removeClass( currentMenu.find( ".ui-state-active" ), null, "ui-state-active" );
  6556. this.activeMenu = currentMenu;
  6557. }, all ? 0 : this.delay );
  6558. },
  6559. // With no arguments, closes the currently active menu - if nothing is active
  6560. // it closes all menus. If passed an argument, it will search for menus BELOW
  6561. _close: function( startMenu ) {
  6562. if ( !startMenu ) {
  6563. startMenu = this.active ? this.active.parent() : this.element;
  6564. }
  6565. startMenu.find( ".ui-menu" )
  6566. .hide()
  6567. .attr( "aria-hidden", "true" )
  6568. .attr( "aria-expanded", "false" );
  6569. },
  6570. _closeOnDocumentClick: function( event ) {
  6571. return !$( event.target ).closest( ".ui-menu" ).length;
  6572. },
  6573. _isDivider: function( item ) {
  6574. // Match hyphen, em dash, en dash
  6575. return !/[^\-\u2014\u2013\s]/.test( item.text() );
  6576. },
  6577. collapse: function( event ) {
  6578. var newItem = this.active &&
  6579. this.active.parent().closest( ".ui-menu-item", this.element );
  6580. if ( newItem && newItem.length ) {
  6581. this._close();
  6582. this.focus( event, newItem );
  6583. }
  6584. },
  6585. expand: function( event ) {
  6586. var newItem = this.active && this._menuItems( this.active.children( ".ui-menu" ) ).first();
  6587. if ( newItem && newItem.length ) {
  6588. this._open( newItem.parent() );
  6589. // Delay so Firefox will not hide activedescendant change in expanding submenu from AT
  6590. this._delay( function() {
  6591. this.focus( event, newItem );
  6592. } );
  6593. }
  6594. },
  6595. next: function( event ) {
  6596. this._move( "next", "first", event );
  6597. },
  6598. previous: function( event ) {
  6599. this._move( "prev", "last", event );
  6600. },
  6601. isFirstItem: function() {
  6602. return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
  6603. },
  6604. isLastItem: function() {
  6605. return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
  6606. },
  6607. _menuItems: function( menu ) {
  6608. return ( menu || this.element )
  6609. .find( this.options.items )
  6610. .filter( ".ui-menu-item" );
  6611. },
  6612. _move: function( direction, filter, event ) {
  6613. var next;
  6614. if ( this.active ) {
  6615. if ( direction === "first" || direction === "last" ) {
  6616. next = this.active
  6617. [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
  6618. .last();
  6619. } else {
  6620. next = this.active
  6621. [ direction + "All" ]( ".ui-menu-item" )
  6622. .first();
  6623. }
  6624. }
  6625. if ( !next || !next.length || !this.active ) {
  6626. next = this._menuItems( this.activeMenu )[ filter ]();
  6627. }
  6628. this.focus( event, next );
  6629. },
  6630. nextPage: function( event ) {
  6631. var item, base, height;
  6632. if ( !this.active ) {
  6633. this.next( event );
  6634. return;
  6635. }
  6636. if ( this.isLastItem() ) {
  6637. return;
  6638. }
  6639. if ( this._hasScroll() ) {
  6640. base = this.active.offset().top;
  6641. height = this.element.innerHeight();
  6642. // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back.
  6643. if ( $.fn.jquery.indexOf( "3.2." ) === 0 ) {
  6644. height += this.element[ 0 ].offsetHeight - this.element.outerHeight();
  6645. }
  6646. this.active.nextAll( ".ui-menu-item" ).each( function() {
  6647. item = $( this );
  6648. return item.offset().top - base - height < 0;
  6649. } );
  6650. this.focus( event, item );
  6651. } else {
  6652. this.focus( event, this._menuItems( this.activeMenu )
  6653. [ !this.active ? "first" : "last" ]() );
  6654. }
  6655. },
  6656. previousPage: function( event ) {
  6657. var item, base, height;
  6658. if ( !this.active ) {
  6659. this.next( event );
  6660. return;
  6661. }
  6662. if ( this.isFirstItem() ) {
  6663. return;
  6664. }
  6665. if ( this._hasScroll() ) {
  6666. base = this.active.offset().top;
  6667. height = this.element.innerHeight();
  6668. // jQuery 3.2 doesn't include scrollbars in innerHeight, add it back.
  6669. if ( $.fn.jquery.indexOf( "3.2." ) === 0 ) {
  6670. height += this.element[ 0 ].offsetHeight - this.element.outerHeight();
  6671. }
  6672. this.active.prevAll( ".ui-menu-item" ).each( function() {
  6673. item = $( this );
  6674. return item.offset().top - base + height > 0;
  6675. } );
  6676. this.focus( event, item );
  6677. } else {
  6678. this.focus( event, this._menuItems( this.activeMenu ).first() );
  6679. }
  6680. },
  6681. _hasScroll: function() {
  6682. return this.element.outerHeight() < this.element.prop( "scrollHeight" );
  6683. },
  6684. select: function( event ) {
  6685. // TODO: It should never be possible to not have an active item at this
  6686. // point, but the tests don't trigger mouseenter before click.
  6687. this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
  6688. var ui = { item: this.active };
  6689. if ( !this.active.has( ".ui-menu" ).length ) {
  6690. this.collapseAll( event, true );
  6691. }
  6692. this._trigger( "select", event, ui );
  6693. },
  6694. _filterMenuItems: function( character ) {
  6695. var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ),
  6696. regex = new RegExp( "^" + escapedCharacter, "i" );
  6697. return this.activeMenu
  6698. .find( this.options.items )
  6699. // Only match on items, not dividers or other content (#10571)
  6700. .filter( ".ui-menu-item" )
  6701. .filter( function() {
  6702. return regex.test(
  6703. String.prototype.trim.call(
  6704. $( this ).children( ".ui-menu-item-wrapper" ).text() ) );
  6705. } );
  6706. }
  6707. } );
  6708. /*!
  6709. * jQuery UI Autocomplete 1.13.2
  6710. * http://jqueryui.com
  6711. *
  6712. * Copyright jQuery Foundation and other contributors
  6713. * Released under the MIT license.
  6714. * http://jquery.org/license
  6715. */
  6716. //>>label: Autocomplete
  6717. //>>group: Widgets
  6718. //>>description: Lists suggested words as the user is typing.
  6719. //>>docs: http://api.jqueryui.com/autocomplete/
  6720. //>>demos: http://jqueryui.com/autocomplete/
  6721. //>>css.structure: ../../themes/base/core.css
  6722. //>>css.structure: ../../themes/base/autocomplete.css
  6723. //>>css.theme: ../../themes/base/theme.css
  6724. $.widget( "ui.autocomplete", {
  6725. version: "1.13.2",
  6726. defaultElement: "<input>",
  6727. options: {
  6728. appendTo: null,
  6729. autoFocus: false,
  6730. delay: 300,
  6731. minLength: 1,
  6732. position: {
  6733. my: "left top",
  6734. at: "left bottom",
  6735. collision: "none"
  6736. },
  6737. source: null,
  6738. // Callbacks
  6739. change: null,
  6740. close: null,
  6741. focus: null,
  6742. open: null,
  6743. response: null,
  6744. search: null,
  6745. select: null
  6746. },
  6747. requestIndex: 0,
  6748. pending: 0,
  6749. liveRegionTimer: null,
  6750. _create: function() {
  6751. // Some browsers only repeat keydown events, not keypress events,
  6752. // so we use the suppressKeyPress flag to determine if we've already
  6753. // handled the keydown event. #7269
  6754. // Unfortunately the code for & in keypress is the same as the up arrow,
  6755. // so we use the suppressKeyPressRepeat flag to avoid handling keypress
  6756. // events when we know the keydown event was used to modify the
  6757. // search term. #7799
  6758. var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
  6759. nodeName = this.element[ 0 ].nodeName.toLowerCase(),
  6760. isTextarea = nodeName === "textarea",
  6761. isInput = nodeName === "input";
  6762. // Textareas are always multi-line
  6763. // Inputs are always single-line, even if inside a contentEditable element
  6764. // IE also treats inputs as contentEditable
  6765. // All other element types are determined by whether or not they're contentEditable
  6766. this.isMultiLine = isTextarea || !isInput && this._isContentEditable( this.element );
  6767. this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];
  6768. this.isNewMenu = true;
  6769. this._addClass( "ui-autocomplete-input" );
  6770. this.element.attr( "autocomplete", "off" );
  6771. this._on( this.element, {
  6772. keydown: function( event ) {
  6773. if ( this.element.prop( "readOnly" ) ) {
  6774. suppressKeyPress = true;
  6775. suppressInput = true;
  6776. suppressKeyPressRepeat = true;
  6777. return;
  6778. }
  6779. suppressKeyPress = false;
  6780. suppressInput = false;
  6781. suppressKeyPressRepeat = false;
  6782. var keyCode = $.ui.keyCode;
  6783. switch ( event.keyCode ) {
  6784. case keyCode.PAGE_UP:
  6785. suppressKeyPress = true;
  6786. this._move( "previousPage", event );
  6787. break;
  6788. case keyCode.PAGE_DOWN:
  6789. suppressKeyPress = true;
  6790. this._move( "nextPage", event );
  6791. break;
  6792. case keyCode.UP:
  6793. suppressKeyPress = true;
  6794. this._keyEvent( "previous", event );
  6795. break;
  6796. case keyCode.DOWN:
  6797. suppressKeyPress = true;
  6798. this._keyEvent( "next", event );
  6799. break;
  6800. case keyCode.ENTER:
  6801. // when menu is open and has focus
  6802. if ( this.menu.active ) {
  6803. // #6055 - Opera still allows the keypress to occur
  6804. // which causes forms to submit
  6805. suppressKeyPress = true;
  6806. event.preventDefault();
  6807. this.menu.select( event );
  6808. }
  6809. break;
  6810. case keyCode.TAB:
  6811. if ( this.menu.active ) {
  6812. this.menu.select( event );
  6813. }
  6814. break;
  6815. case keyCode.ESCAPE:
  6816. if ( this.menu.element.is( ":visible" ) ) {
  6817. if ( !this.isMultiLine ) {
  6818. this._value( this.term );
  6819. }
  6820. this.close( event );
  6821. // Different browsers have different default behavior for escape
  6822. // Single press can mean undo or clear
  6823. // Double press in IE means clear the whole form
  6824. event.preventDefault();
  6825. }
  6826. break;
  6827. default:
  6828. suppressKeyPressRepeat = true;
  6829. // search timeout should be triggered before the input value is changed
  6830. this._searchTimeout( event );
  6831. break;
  6832. }
  6833. },
  6834. keypress: function( event ) {
  6835. if ( suppressKeyPress ) {
  6836. suppressKeyPress = false;
  6837. if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
  6838. event.preventDefault();
  6839. }
  6840. return;
  6841. }
  6842. if ( suppressKeyPressRepeat ) {
  6843. return;
  6844. }
  6845. // Replicate some key handlers to allow them to repeat in Firefox and Opera
  6846. var keyCode = $.ui.keyCode;
  6847. switch ( event.keyCode ) {
  6848. case keyCode.PAGE_UP:
  6849. this._move( "previousPage", event );
  6850. break;
  6851. case keyCode.PAGE_DOWN:
  6852. this._move( "nextPage", event );
  6853. break;
  6854. case keyCode.UP:
  6855. this._keyEvent( "previous", event );
  6856. break;
  6857. case keyCode.DOWN:
  6858. this._keyEvent( "next", event );
  6859. break;
  6860. }
  6861. },
  6862. input: function( event ) {
  6863. if ( suppressInput ) {
  6864. suppressInput = false;
  6865. event.preventDefault();
  6866. return;
  6867. }
  6868. this._searchTimeout( event );
  6869. },
  6870. focus: function() {
  6871. this.selectedItem = null;
  6872. this.previous = this._value();
  6873. },
  6874. blur: function( event ) {
  6875. clearTimeout( this.searching );
  6876. this.close( event );
  6877. this._change( event );
  6878. }
  6879. } );
  6880. this._initSource();
  6881. this.menu = $( "<ul>" )
  6882. .appendTo( this._appendTo() )
  6883. .menu( {
  6884. // disable ARIA support, the live region takes care of that
  6885. role: null
  6886. } )
  6887. .hide()
  6888. // Support: IE 11 only, Edge <= 14
  6889. // For other browsers, we preventDefault() on the mousedown event
  6890. // to keep the dropdown from taking focus from the input. This doesn't
  6891. // work for IE/Edge, causing problems with selection and scrolling (#9638)
  6892. // Happily, IE and Edge support an "unselectable" attribute that
  6893. // prevents an element from receiving focus, exactly what we want here.
  6894. .attr( {
  6895. "unselectable": "on"
  6896. } )
  6897. .menu( "instance" );
  6898. this._addClass( this.menu.element, "ui-autocomplete", "ui-front" );
  6899. this._on( this.menu.element, {
  6900. mousedown: function( event ) {
  6901. // Prevent moving focus out of the text field
  6902. event.preventDefault();
  6903. },
  6904. menufocus: function( event, ui ) {
  6905. var label, item;
  6906. // support: Firefox
  6907. // Prevent accidental activation of menu items in Firefox (#7024 #9118)
  6908. if ( this.isNewMenu ) {
  6909. this.isNewMenu = false;
  6910. if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
  6911. this.menu.blur();
  6912. this.document.one( "mousemove", function() {
  6913. $( event.target ).trigger( event.originalEvent );
  6914. } );
  6915. return;
  6916. }
  6917. }
  6918. item = ui.item.data( "ui-autocomplete-item" );
  6919. if ( false !== this._trigger( "focus", event, { item: item } ) ) {
  6920. // use value to match what will end up in the input, if it was a key event
  6921. if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
  6922. this._value( item.value );
  6923. }
  6924. }
  6925. // Announce the value in the liveRegion
  6926. label = ui.item.attr( "aria-label" ) || item.value;
  6927. if ( label && String.prototype.trim.call( label ).length ) {
  6928. clearTimeout( this.liveRegionTimer );
  6929. this.liveRegionTimer = this._delay( function() {
  6930. this.liveRegion.html( $( "<div>" ).text( label ) );
  6931. }, 100 );
  6932. }
  6933. },
  6934. menuselect: function( event, ui ) {
  6935. var item = ui.item.data( "ui-autocomplete-item" ),
  6936. previous = this.previous;
  6937. // Only trigger when focus was lost (click on menu)
  6938. if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) {
  6939. this.element.trigger( "focus" );
  6940. this.previous = previous;
  6941. // #6109 - IE triggers two focus events and the second
  6942. // is asynchronous, so we need to reset the previous
  6943. // term synchronously and asynchronously :-(
  6944. this._delay( function() {
  6945. this.previous = previous;
  6946. this.selectedItem = item;
  6947. } );
  6948. }
  6949. if ( false !== this._trigger( "select", event, { item: item } ) ) {
  6950. this._value( item.value );
  6951. }
  6952. // reset the term after the select event
  6953. // this allows custom select handling to work properly
  6954. this.term = this._value();
  6955. this.close( event );
  6956. this.selectedItem = item;
  6957. }
  6958. } );
  6959. this.liveRegion = $( "<div>", {
  6960. role: "status",
  6961. "aria-live": "assertive",
  6962. "aria-relevant": "additions"
  6963. } )
  6964. .appendTo( this.document[ 0 ].body );
  6965. this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" );
  6966. // Turning off autocomplete prevents the browser from remembering the
  6967. // value when navigating through history, so we re-enable autocomplete
  6968. // if the page is unloaded before the widget is destroyed. #7790
  6969. this._on( this.window, {
  6970. beforeunload: function() {
  6971. this.element.removeAttr( "autocomplete" );
  6972. }
  6973. } );
  6974. },
  6975. _destroy: function() {
  6976. clearTimeout( this.searching );
  6977. this.element.removeAttr( "autocomplete" );
  6978. this.menu.element.remove();
  6979. this.liveRegion.remove();
  6980. },
  6981. _setOption: function( key, value ) {
  6982. this._super( key, value );
  6983. if ( key === "source" ) {
  6984. this._initSource();
  6985. }
  6986. if ( key === "appendTo" ) {
  6987. this.menu.element.appendTo( this._appendTo() );
  6988. }
  6989. if ( key === "disabled" && value && this.xhr ) {
  6990. this.xhr.abort();
  6991. }
  6992. },
  6993. _isEventTargetInWidget: function( event ) {
  6994. var menuElement = this.menu.element[ 0 ];
  6995. return event.target === this.element[ 0 ] ||
  6996. event.target === menuElement ||
  6997. $.contains( menuElement, event.target );
  6998. },
  6999. _closeOnClickOutside: function( event ) {
  7000. if ( !this._isEventTargetInWidget( event ) ) {
  7001. this.close();
  7002. }
  7003. },
  7004. _appendTo: function() {
  7005. var element = this.options.appendTo;
  7006. if ( element ) {
  7007. element = element.jquery || element.nodeType ?
  7008. $( element ) :
  7009. this.document.find( element ).eq( 0 );
  7010. }
  7011. if ( !element || !element[ 0 ] ) {
  7012. element = this.element.closest( ".ui-front, dialog" );
  7013. }
  7014. if ( !element.length ) {
  7015. element = this.document[ 0 ].body;
  7016. }
  7017. return element;
  7018. },
  7019. _initSource: function() {
  7020. var array, url,
  7021. that = this;
  7022. if ( Array.isArray( this.options.source ) ) {
  7023. array = this.options.source;
  7024. this.source = function( request, response ) {
  7025. response( $.ui.autocomplete.filter( array, request.term ) );
  7026. };
  7027. } else if ( typeof this.options.source === "string" ) {
  7028. url = this.options.source;
  7029. this.source = function( request, response ) {
  7030. if ( that.xhr ) {
  7031. that.xhr.abort();
  7032. }
  7033. that.xhr = $.ajax( {
  7034. url: url,
  7035. data: request,
  7036. dataType: "json",
  7037. success: function( data ) {
  7038. response( data );
  7039. },
  7040. error: function() {
  7041. response( [] );
  7042. }
  7043. } );
  7044. };
  7045. } else {
  7046. this.source = this.options.source;
  7047. }
  7048. },
  7049. _searchTimeout: function( event ) {
  7050. clearTimeout( this.searching );
  7051. this.searching = this._delay( function() {
  7052. // Search if the value has changed, or if the user retypes the same value (see #7434)
  7053. var equalValues = this.term === this._value(),
  7054. menuVisible = this.menu.element.is( ":visible" ),
  7055. modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
  7056. if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) {
  7057. this.selectedItem = null;
  7058. this.search( null, event );
  7059. }
  7060. }, this.options.delay );
  7061. },
  7062. search: function( value, event ) {
  7063. value = value != null ? value : this._value();
  7064. // Always save the actual value, not the one passed as an argument
  7065. this.term = this._value();
  7066. if ( value.length < this.options.minLength ) {
  7067. return this.close( event );
  7068. }
  7069. if ( this._trigger( "search", event ) === false ) {
  7070. return;
  7071. }
  7072. return this._search( value );
  7073. },
  7074. _search: function( value ) {
  7075. this.pending++;
  7076. this._addClass( "ui-autocomplete-loading" );
  7077. this.cancelSearch = false;
  7078. this.source( { term: value }, this._response() );
  7079. },
  7080. _response: function() {
  7081. var index = ++this.requestIndex;
  7082. return function( content ) {
  7083. if ( index === this.requestIndex ) {
  7084. this.__response( content );
  7085. }
  7086. this.pending--;
  7087. if ( !this.pending ) {
  7088. this._removeClass( "ui-autocomplete-loading" );
  7089. }
  7090. }.bind( this );
  7091. },
  7092. __response: function( content ) {
  7093. if ( content ) {
  7094. content = this._normalize( content );
  7095. }
  7096. this._trigger( "response", null, { content: content } );
  7097. if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
  7098. this._suggest( content );
  7099. this._trigger( "open" );
  7100. } else {
  7101. // use ._close() instead of .close() so we don't cancel future searches
  7102. this._close();
  7103. }
  7104. },
  7105. close: function( event ) {
  7106. this.cancelSearch = true;
  7107. this._close( event );
  7108. },
  7109. _close: function( event ) {
  7110. // Remove the handler that closes the menu on outside clicks
  7111. this._off( this.document, "mousedown" );
  7112. if ( this.menu.element.is( ":visible" ) ) {
  7113. this.menu.element.hide();
  7114. this.menu.blur();
  7115. this.isNewMenu = true;
  7116. this._trigger( "close", event );
  7117. }
  7118. },
  7119. _change: function( event ) {
  7120. if ( this.previous !== this._value() ) {
  7121. this._trigger( "change", event, { item: this.selectedItem } );
  7122. }
  7123. },
  7124. _normalize: function( items ) {
  7125. // assume all items have the right format when the first item is complete
  7126. if ( items.length && items[ 0 ].label && items[ 0 ].value ) {
  7127. return items;
  7128. }
  7129. return $.map( items, function( item ) {
  7130. if ( typeof item === "string" ) {
  7131. return {
  7132. label: item,
  7133. value: item
  7134. };
  7135. }
  7136. return $.extend( {}, item, {
  7137. label: item.label || item.value,
  7138. value: item.value || item.label
  7139. } );
  7140. } );
  7141. },
  7142. _suggest: function( items ) {
  7143. var ul = this.menu.element.empty();
  7144. this._renderMenu( ul, items );
  7145. this.isNewMenu = true;
  7146. this.menu.refresh();
  7147. // Size and position menu
  7148. ul.show();
  7149. this._resizeMenu();
  7150. ul.position( $.extend( {
  7151. of: this.element
  7152. }, this.options.position ) );
  7153. if ( this.options.autoFocus ) {
  7154. this.menu.next();
  7155. }
  7156. // Listen for interactions outside of the widget (#6642)
  7157. this._on( this.document, {
  7158. mousedown: "_closeOnClickOutside"
  7159. } );
  7160. },
  7161. _resizeMenu: function() {
  7162. var ul = this.menu.element;
  7163. ul.outerWidth( Math.max(
  7164. // Firefox wraps long text (possibly a rounding bug)
  7165. // so we add 1px to avoid the wrapping (#7513)
  7166. ul.width( "" ).outerWidth() + 1,
  7167. this.element.outerWidth()
  7168. ) );
  7169. },
  7170. _renderMenu: function( ul, items ) {
  7171. var that = this;
  7172. $.each( items, function( index, item ) {
  7173. that._renderItemData( ul, item );
  7174. } );
  7175. },
  7176. _renderItemData: function( ul, item ) {
  7177. return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
  7178. },
  7179. _renderItem: function( ul, item ) {
  7180. return $( "<li>" )
  7181. .append( $( "<div>" ).text( item.label ) )
  7182. .appendTo( ul );
  7183. },
  7184. _move: function( direction, event ) {
  7185. if ( !this.menu.element.is( ":visible" ) ) {
  7186. this.search( null, event );
  7187. return;
  7188. }
  7189. if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
  7190. this.menu.isLastItem() && /^next/.test( direction ) ) {
  7191. if ( !this.isMultiLine ) {
  7192. this._value( this.term );
  7193. }
  7194. this.menu.blur();
  7195. return;
  7196. }
  7197. this.menu[ direction ]( event );
  7198. },
  7199. widget: function() {
  7200. return this.menu.element;
  7201. },
  7202. _value: function() {
  7203. return this.valueMethod.apply( this.element, arguments );
  7204. },
  7205. _keyEvent: function( keyEvent, event ) {
  7206. if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
  7207. this._move( keyEvent, event );
  7208. // Prevents moving cursor to beginning/end of the text field in some browsers
  7209. event.preventDefault();
  7210. }
  7211. },
  7212. // Support: Chrome <=50
  7213. // We should be able to just use this.element.prop( "isContentEditable" )
  7214. // but hidden elements always report false in Chrome.
  7215. // https://code.google.com/p/chromium/issues/detail?id=313082
  7216. _isContentEditable: function( element ) {
  7217. if ( !element.length ) {
  7218. return false;
  7219. }
  7220. var editable = element.prop( "contentEditable" );
  7221. if ( editable === "inherit" ) {
  7222. return this._isContentEditable( element.parent() );
  7223. }
  7224. return editable === "true";
  7225. }
  7226. } );
  7227. $.extend( $.ui.autocomplete, {
  7228. escapeRegex: function( value ) {
  7229. return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
  7230. },
  7231. filter: function( array, term ) {
  7232. var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" );
  7233. return $.grep( array, function( value ) {
  7234. return matcher.test( value.label || value.value || value );
  7235. } );
  7236. }
  7237. } );
  7238. // Live region extension, adding a `messages` option
  7239. // NOTE: This is an experimental API. We are still investigating
  7240. // a full solution for string manipulation and internationalization.
  7241. $.widget( "ui.autocomplete", $.ui.autocomplete, {
  7242. options: {
  7243. messages: {
  7244. noResults: "No search results.",
  7245. results: function( amount ) {
  7246. return amount + ( amount > 1 ? " results are" : " result is" ) +
  7247. " available, use up and down arrow keys to navigate.";
  7248. }
  7249. }
  7250. },
  7251. __response: function( content ) {
  7252. var message;
  7253. this._superApply( arguments );
  7254. if ( this.options.disabled || this.cancelSearch ) {
  7255. return;
  7256. }
  7257. if ( content && content.length ) {
  7258. message = this.options.messages.results( content.length );
  7259. } else {
  7260. message = this.options.messages.noResults;
  7261. }
  7262. clearTimeout( this.liveRegionTimer );
  7263. this.liveRegionTimer = this._delay( function() {
  7264. this.liveRegion.html( $( "<div>" ).text( message ) );
  7265. }, 100 );
  7266. }
  7267. } );
  7268. var widgetsAutocomplete = $.ui.autocomplete;
  7269. /*!
  7270. * jQuery UI Controlgroup 1.13.2
  7271. * http://jqueryui.com
  7272. *
  7273. * Copyright jQuery Foundation and other contributors
  7274. * Released under the MIT license.
  7275. * http://jquery.org/license
  7276. */
  7277. //>>label: Controlgroup
  7278. //>>group: Widgets
  7279. //>>description: Visually groups form control widgets
  7280. //>>docs: http://api.jqueryui.com/controlgroup/
  7281. //>>demos: http://jqueryui.com/controlgroup/
  7282. //>>css.structure: ../../themes/base/core.css
  7283. //>>css.structure: ../../themes/base/controlgroup.css
  7284. //>>css.theme: ../../themes/base/theme.css
  7285. var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g;
  7286. var widgetsControlgroup = $.widget( "ui.controlgroup", {
  7287. version: "1.13.2",
  7288. defaultElement: "<div>",
  7289. options: {
  7290. direction: "horizontal",
  7291. disabled: null,
  7292. onlyVisible: true,
  7293. items: {
  7294. "button": "input[type=button], input[type=submit], input[type=reset], button, a",
  7295. "controlgroupLabel": ".ui-controlgroup-label",
  7296. "checkboxradio": "input[type='checkbox'], input[type='radio']",
  7297. "selectmenu": "select",
  7298. "spinner": ".ui-spinner-input"
  7299. }
  7300. },
  7301. _create: function() {
  7302. this._enhance();
  7303. },
  7304. // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation
  7305. _enhance: function() {
  7306. this.element.attr( "role", "toolbar" );
  7307. this.refresh();
  7308. },
  7309. _destroy: function() {
  7310. this._callChildMethod( "destroy" );
  7311. this.childWidgets.removeData( "ui-controlgroup-data" );
  7312. this.element.removeAttr( "role" );
  7313. if ( this.options.items.controlgroupLabel ) {
  7314. this.element
  7315. .find( this.options.items.controlgroupLabel )
  7316. .find( ".ui-controlgroup-label-contents" )
  7317. .contents().unwrap();
  7318. }
  7319. },
  7320. _initWidgets: function() {
  7321. var that = this,
  7322. childWidgets = [];
  7323. // First we iterate over each of the items options
  7324. $.each( this.options.items, function( widget, selector ) {
  7325. var labels;
  7326. var options = {};
  7327. // Make sure the widget has a selector set
  7328. if ( !selector ) {
  7329. return;
  7330. }
  7331. if ( widget === "controlgroupLabel" ) {
  7332. labels = that.element.find( selector );
  7333. labels.each( function() {
  7334. var element = $( this );
  7335. if ( element.children( ".ui-controlgroup-label-contents" ).length ) {
  7336. return;
  7337. }
  7338. element.contents()
  7339. .wrapAll( "<span class='ui-controlgroup-label-contents'></span>" );
  7340. } );
  7341. that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" );
  7342. childWidgets = childWidgets.concat( labels.get() );
  7343. return;
  7344. }
  7345. // Make sure the widget actually exists
  7346. if ( !$.fn[ widget ] ) {
  7347. return;
  7348. }
  7349. // We assume everything is in the middle to start because we can't determine
  7350. // first / last elements until all enhancments are done.
  7351. if ( that[ "_" + widget + "Options" ] ) {
  7352. options = that[ "_" + widget + "Options" ]( "middle" );
  7353. } else {
  7354. options = { classes: {} };
  7355. }
  7356. // Find instances of this widget inside controlgroup and init them
  7357. that.element
  7358. .find( selector )
  7359. .each( function() {
  7360. var element = $( this );
  7361. var instance = element[ widget ]( "instance" );
  7362. // We need to clone the default options for this type of widget to avoid
  7363. // polluting the variable options which has a wider scope than a single widget.
  7364. var instanceOptions = $.widget.extend( {}, options );
  7365. // If the button is the child of a spinner ignore it
  7366. // TODO: Find a more generic solution
  7367. if ( widget === "button" && element.parent( ".ui-spinner" ).length ) {
  7368. return;
  7369. }
  7370. // Create the widget if it doesn't exist
  7371. if ( !instance ) {
  7372. instance = element[ widget ]()[ widget ]( "instance" );
  7373. }
  7374. if ( instance ) {
  7375. instanceOptions.classes =
  7376. that._resolveClassesValues( instanceOptions.classes, instance );
  7377. }
  7378. element[ widget ]( instanceOptions );
  7379. // Store an instance of the controlgroup to be able to reference
  7380. // from the outermost element for changing options and refresh
  7381. var widgetElement = element[ widget ]( "widget" );
  7382. $.data( widgetElement[ 0 ], "ui-controlgroup-data",
  7383. instance ? instance : element[ widget ]( "instance" ) );
  7384. childWidgets.push( widgetElement[ 0 ] );
  7385. } );
  7386. } );
  7387. this.childWidgets = $( $.uniqueSort( childWidgets ) );
  7388. this._addClass( this.childWidgets, "ui-controlgroup-item" );
  7389. },
  7390. _callChildMethod: function( method ) {
  7391. this.childWidgets.each( function() {
  7392. var element = $( this ),
  7393. data = element.data( "ui-controlgroup-data" );
  7394. if ( data && data[ method ] ) {
  7395. data[ method ]();
  7396. }
  7397. } );
  7398. },
  7399. _updateCornerClass: function( element, position ) {
  7400. var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all";
  7401. var add = this._buildSimpleOptions( position, "label" ).classes.label;
  7402. this._removeClass( element, null, remove );
  7403. this._addClass( element, null, add );
  7404. },
  7405. _buildSimpleOptions: function( position, key ) {
  7406. var direction = this.options.direction === "vertical";
  7407. var result = {
  7408. classes: {}
  7409. };
  7410. result.classes[ key ] = {
  7411. "middle": "",
  7412. "first": "ui-corner-" + ( direction ? "top" : "left" ),
  7413. "last": "ui-corner-" + ( direction ? "bottom" : "right" ),
  7414. "only": "ui-corner-all"
  7415. }[ position ];
  7416. return result;
  7417. },
  7418. _spinnerOptions: function( position ) {
  7419. var options = this._buildSimpleOptions( position, "ui-spinner" );
  7420. options.classes[ "ui-spinner-up" ] = "";
  7421. options.classes[ "ui-spinner-down" ] = "";
  7422. return options;
  7423. },
  7424. _buttonOptions: function( position ) {
  7425. return this._buildSimpleOptions( position, "ui-button" );
  7426. },
  7427. _checkboxradioOptions: function( position ) {
  7428. return this._buildSimpleOptions( position, "ui-checkboxradio-label" );
  7429. },
  7430. _selectmenuOptions: function( position ) {
  7431. var direction = this.options.direction === "vertical";
  7432. return {
  7433. width: direction ? "auto" : false,
  7434. classes: {
  7435. middle: {
  7436. "ui-selectmenu-button-open": "",
  7437. "ui-selectmenu-button-closed": ""
  7438. },
  7439. first: {
  7440. "ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ),
  7441. "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" )
  7442. },
  7443. last: {
  7444. "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr",
  7445. "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" )
  7446. },
  7447. only: {
  7448. "ui-selectmenu-button-open": "ui-corner-top",
  7449. "ui-selectmenu-button-closed": "ui-corner-all"
  7450. }
  7451. }[ position ]
  7452. };
  7453. },
  7454. _resolveClassesValues: function( classes, instance ) {
  7455. var result = {};
  7456. $.each( classes, function( key ) {
  7457. var current = instance.options.classes[ key ] || "";
  7458. current = String.prototype.trim.call( current.replace( controlgroupCornerRegex, "" ) );
  7459. result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " );
  7460. } );
  7461. return result;
  7462. },
  7463. _setOption: function( key, value ) {
  7464. if ( key === "direction" ) {
  7465. this._removeClass( "ui-controlgroup-" + this.options.direction );
  7466. }
  7467. this._super( key, value );
  7468. if ( key === "disabled" ) {
  7469. this._callChildMethod( value ? "disable" : "enable" );
  7470. return;
  7471. }
  7472. this.refresh();
  7473. },
  7474. refresh: function() {
  7475. var children,
  7476. that = this;
  7477. this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction );
  7478. if ( this.options.direction === "horizontal" ) {
  7479. this._addClass( null, "ui-helper-clearfix" );
  7480. }
  7481. this._initWidgets();
  7482. children = this.childWidgets;
  7483. // We filter here because we need to track all childWidgets not just the visible ones
  7484. if ( this.options.onlyVisible ) {
  7485. children = children.filter( ":visible" );
  7486. }
  7487. if ( children.length ) {
  7488. // We do this last because we need to make sure all enhancment is done
  7489. // before determining first and last
  7490. $.each( [ "first", "last" ], function( index, value ) {
  7491. var instance = children[ value ]().data( "ui-controlgroup-data" );
  7492. if ( instance && that[ "_" + instance.widgetName + "Options" ] ) {
  7493. var options = that[ "_" + instance.widgetName + "Options" ](
  7494. children.length === 1 ? "only" : value
  7495. );
  7496. options.classes = that._resolveClassesValues( options.classes, instance );
  7497. instance.element[ instance.widgetName ]( options );
  7498. } else {
  7499. that._updateCornerClass( children[ value ](), value );
  7500. }
  7501. } );
  7502. // Finally call the refresh method on each of the child widgets.
  7503. this._callChildMethod( "refresh" );
  7504. }
  7505. }
  7506. } );
  7507. /*!
  7508. * jQuery UI Checkboxradio 1.13.2
  7509. * http://jqueryui.com
  7510. *
  7511. * Copyright jQuery Foundation and other contributors
  7512. * Released under the MIT license.
  7513. * http://jquery.org/license
  7514. */
  7515. //>>label: Checkboxradio
  7516. //>>group: Widgets
  7517. //>>description: Enhances a form with multiple themeable checkboxes or radio buttons.
  7518. //>>docs: http://api.jqueryui.com/checkboxradio/
  7519. //>>demos: http://jqueryui.com/checkboxradio/
  7520. //>>css.structure: ../../themes/base/core.css
  7521. //>>css.structure: ../../themes/base/button.css
  7522. //>>css.structure: ../../themes/base/checkboxradio.css
  7523. //>>css.theme: ../../themes/base/theme.css
  7524. $.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
  7525. version: "1.13.2",
  7526. options: {
  7527. disabled: null,
  7528. label: null,
  7529. icon: true,
  7530. classes: {
  7531. "ui-checkboxradio-label": "ui-corner-all",
  7532. "ui-checkboxradio-icon": "ui-corner-all"
  7533. }
  7534. },
  7535. _getCreateOptions: function() {
  7536. var disabled, labels, labelContents;
  7537. var options = this._super() || {};
  7538. // We read the type here, because it makes more sense to throw a element type error first,
  7539. // rather then the error for lack of a label. Often if its the wrong type, it
  7540. // won't have a label (e.g. calling on a div, btn, etc)
  7541. this._readType();
  7542. labels = this.element.labels();
  7543. // If there are multiple labels, use the last one
  7544. this.label = $( labels[ labels.length - 1 ] );
  7545. if ( !this.label.length ) {
  7546. $.error( "No label found for checkboxradio widget" );
  7547. }
  7548. this.originalLabel = "";
  7549. // We need to get the label text but this may also need to make sure it does not contain the
  7550. // input itself.
  7551. // The label contents could be text, html, or a mix. We wrap all elements
  7552. // and read the wrapper's `innerHTML` to get a string representation of
  7553. // the label, without the input as part of it.
  7554. labelContents = this.label.contents().not( this.element[ 0 ] );
  7555. if ( labelContents.length ) {
  7556. this.originalLabel += labelContents
  7557. .clone()
  7558. .wrapAll( "<div></div>" )
  7559. .parent()
  7560. .html();
  7561. }
  7562. // Set the label option if we found label text
  7563. if ( this.originalLabel ) {
  7564. options.label = this.originalLabel;
  7565. }
  7566. disabled = this.element[ 0 ].disabled;
  7567. if ( disabled != null ) {
  7568. options.disabled = disabled;
  7569. }
  7570. return options;
  7571. },
  7572. _create: function() {
  7573. var checked = this.element[ 0 ].checked;
  7574. this._bindFormResetHandler();
  7575. if ( this.options.disabled == null ) {
  7576. this.options.disabled = this.element[ 0 ].disabled;
  7577. }
  7578. this._setOption( "disabled", this.options.disabled );
  7579. this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" );
  7580. this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" );
  7581. if ( this.type === "radio" ) {
  7582. this._addClass( this.label, "ui-checkboxradio-radio-label" );
  7583. }
  7584. if ( this.options.label && this.options.label !== this.originalLabel ) {
  7585. this._updateLabel();
  7586. } else if ( this.originalLabel ) {
  7587. this.options.label = this.originalLabel;
  7588. }
  7589. this._enhance();
  7590. if ( checked ) {
  7591. this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" );
  7592. }
  7593. this._on( {
  7594. change: "_toggleClasses",
  7595. focus: function() {
  7596. this._addClass( this.label, null, "ui-state-focus ui-visual-focus" );
  7597. },
  7598. blur: function() {
  7599. this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" );
  7600. }
  7601. } );
  7602. },
  7603. _readType: function() {
  7604. var nodeName = this.element[ 0 ].nodeName.toLowerCase();
  7605. this.type = this.element[ 0 ].type;
  7606. if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) {
  7607. $.error( "Can't create checkboxradio on element.nodeName=" + nodeName +
  7608. " and element.type=" + this.type );
  7609. }
  7610. },
  7611. // Support jQuery Mobile enhanced option
  7612. _enhance: function() {
  7613. this._updateIcon( this.element[ 0 ].checked );
  7614. },
  7615. widget: function() {
  7616. return this.label;
  7617. },
  7618. _getRadioGroup: function() {
  7619. var group;
  7620. var name = this.element[ 0 ].name;
  7621. var nameSelector = "input[name='" + $.escapeSelector( name ) + "']";
  7622. if ( !name ) {
  7623. return $( [] );
  7624. }
  7625. if ( this.form.length ) {
  7626. group = $( this.form[ 0 ].elements ).filter( nameSelector );
  7627. } else {
  7628. // Not inside a form, check all inputs that also are not inside a form
  7629. group = $( nameSelector ).filter( function() {
  7630. return $( this )._form().length === 0;
  7631. } );
  7632. }
  7633. return group.not( this.element );
  7634. },
  7635. _toggleClasses: function() {
  7636. var checked = this.element[ 0 ].checked;
  7637. this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
  7638. if ( this.options.icon && this.type === "checkbox" ) {
  7639. this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked )
  7640. ._toggleClass( this.icon, null, "ui-icon-blank", !checked );
  7641. }
  7642. if ( this.type === "radio" ) {
  7643. this._getRadioGroup()
  7644. .each( function() {
  7645. var instance = $( this ).checkboxradio( "instance" );
  7646. if ( instance ) {
  7647. instance._removeClass( instance.label,
  7648. "ui-checkboxradio-checked", "ui-state-active" );
  7649. }
  7650. } );
  7651. }
  7652. },
  7653. _destroy: function() {
  7654. this._unbindFormResetHandler();
  7655. if ( this.icon ) {
  7656. this.icon.remove();
  7657. this.iconSpace.remove();
  7658. }
  7659. },
  7660. _setOption: function( key, value ) {
  7661. // We don't allow the value to be set to nothing
  7662. if ( key === "label" && !value ) {
  7663. return;
  7664. }
  7665. this._super( key, value );
  7666. if ( key === "disabled" ) {
  7667. this._toggleClass( this.label, null, "ui-state-disabled", value );
  7668. this.element[ 0 ].disabled = value;
  7669. // Don't refresh when setting disabled
  7670. return;
  7671. }
  7672. this.refresh();
  7673. },
  7674. _updateIcon: function( checked ) {
  7675. var toAdd = "ui-icon ui-icon-background ";
  7676. if ( this.options.icon ) {
  7677. if ( !this.icon ) {
  7678. this.icon = $( "<span>" );
  7679. this.iconSpace = $( "<span> </span>" );
  7680. this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" );
  7681. }
  7682. if ( this.type === "checkbox" ) {
  7683. toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank";
  7684. this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" );
  7685. } else {
  7686. toAdd += "ui-icon-blank";
  7687. }
  7688. this._addClass( this.icon, "ui-checkboxradio-icon", toAdd );
  7689. if ( !checked ) {
  7690. this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" );
  7691. }
  7692. this.icon.prependTo( this.label ).after( this.iconSpace );
  7693. } else if ( this.icon !== undefined ) {
  7694. this.icon.remove();
  7695. this.iconSpace.remove();
  7696. delete this.icon;
  7697. }
  7698. },
  7699. _updateLabel: function() {
  7700. // Remove the contents of the label ( minus the icon, icon space, and input )
  7701. var contents = this.label.contents().not( this.element[ 0 ] );
  7702. if ( this.icon ) {
  7703. contents = contents.not( this.icon[ 0 ] );
  7704. }
  7705. if ( this.iconSpace ) {
  7706. contents = contents.not( this.iconSpace[ 0 ] );
  7707. }
  7708. contents.remove();
  7709. this.label.append( this.options.label );
  7710. },
  7711. refresh: function() {
  7712. var checked = this.element[ 0 ].checked,
  7713. isDisabled = this.element[ 0 ].disabled;
  7714. this._updateIcon( checked );
  7715. this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
  7716. if ( this.options.label !== null ) {
  7717. this._updateLabel();
  7718. }
  7719. if ( isDisabled !== this.options.disabled ) {
  7720. this._setOptions( { "disabled": isDisabled } );
  7721. }
  7722. }
  7723. } ] );
  7724. var widgetsCheckboxradio = $.ui.checkboxradio;
  7725. /*!
  7726. * jQuery UI Button 1.13.2
  7727. * http://jqueryui.com
  7728. *
  7729. * Copyright jQuery Foundation and other contributors
  7730. * Released under the MIT license.
  7731. * http://jquery.org/license
  7732. */
  7733. //>>label: Button
  7734. //>>group: Widgets
  7735. //>>description: Enhances a form with themeable buttons.
  7736. //>>docs: http://api.jqueryui.com/button/
  7737. //>>demos: http://jqueryui.com/button/
  7738. //>>css.structure: ../../themes/base/core.css
  7739. //>>css.structure: ../../themes/base/button.css
  7740. //>>css.theme: ../../themes/base/theme.css
  7741. $.widget( "ui.button", {
  7742. version: "1.13.2",
  7743. defaultElement: "<button>",
  7744. options: {
  7745. classes: {
  7746. "ui-button": "ui-corner-all"
  7747. },
  7748. disabled: null,
  7749. icon: null,
  7750. iconPosition: "beginning",
  7751. label: null,
  7752. showLabel: true
  7753. },
  7754. _getCreateOptions: function() {
  7755. var disabled,
  7756. // This is to support cases like in jQuery Mobile where the base widget does have
  7757. // an implementation of _getCreateOptions
  7758. options = this._super() || {};
  7759. this.isInput = this.element.is( "input" );
  7760. disabled = this.element[ 0 ].disabled;
  7761. if ( disabled != null ) {
  7762. options.disabled = disabled;
  7763. }
  7764. this.originalLabel = this.isInput ? this.element.val() : this.element.html();
  7765. if ( this.originalLabel ) {
  7766. options.label = this.originalLabel;
  7767. }
  7768. return options;
  7769. },
  7770. _create: function() {
  7771. if ( !this.option.showLabel & !this.options.icon ) {
  7772. this.options.showLabel = true;
  7773. }
  7774. // We have to check the option again here even though we did in _getCreateOptions,
  7775. // because null may have been passed on init which would override what was set in
  7776. // _getCreateOptions
  7777. if ( this.options.disabled == null ) {
  7778. this.options.disabled = this.element[ 0 ].disabled || false;
  7779. }
  7780. this.hasTitle = !!this.element.attr( "title" );
  7781. // Check to see if the label needs to be set or if its already correct
  7782. if ( this.options.label && this.options.label !== this.originalLabel ) {
  7783. if ( this.isInput ) {
  7784. this.element.val( this.options.label );
  7785. } else {
  7786. this.element.html( this.options.label );
  7787. }
  7788. }
  7789. this._addClass( "ui-button", "ui-widget" );
  7790. this._setOption( "disabled", this.options.disabled );
  7791. this._enhance();
  7792. if ( this.element.is( "a" ) ) {
  7793. this._on( {
  7794. "keyup": function( event ) {
  7795. if ( event.keyCode === $.ui.keyCode.SPACE ) {
  7796. event.preventDefault();
  7797. // Support: PhantomJS <= 1.9, IE 8 Only
  7798. // If a native click is available use it so we actually cause navigation
  7799. // otherwise just trigger a click event
  7800. if ( this.element[ 0 ].click ) {
  7801. this.element[ 0 ].click();
  7802. } else {
  7803. this.element.trigger( "click" );
  7804. }
  7805. }
  7806. }
  7807. } );
  7808. }
  7809. },
  7810. _enhance: function() {
  7811. if ( !this.element.is( "button" ) ) {
  7812. this.element.attr( "role", "button" );
  7813. }
  7814. if ( this.options.icon ) {
  7815. this._updateIcon( "icon", this.options.icon );
  7816. this._updateTooltip();
  7817. }
  7818. },
  7819. _updateTooltip: function() {
  7820. this.title = this.element.attr( "title" );
  7821. if ( !this.options.showLabel && !this.title ) {
  7822. this.element.attr( "title", this.options.label );
  7823. }
  7824. },
  7825. _updateIcon: function( option, value ) {
  7826. var icon = option !== "iconPosition",
  7827. position = icon ? this.options.iconPosition : value,
  7828. displayBlock = position === "top" || position === "bottom";
  7829. // Create icon
  7830. if ( !this.icon ) {
  7831. this.icon = $( "<span>" );
  7832. this._addClass( this.icon, "ui-button-icon", "ui-icon" );
  7833. if ( !this.options.showLabel ) {
  7834. this._addClass( "ui-button-icon-only" );
  7835. }
  7836. } else if ( icon ) {
  7837. // If we are updating the icon remove the old icon class
  7838. this._removeClass( this.icon, null, this.options.icon );
  7839. }
  7840. // If we are updating the icon add the new icon class
  7841. if ( icon ) {
  7842. this._addClass( this.icon, null, value );
  7843. }
  7844. this._attachIcon( position );
  7845. // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove
  7846. // the iconSpace if there is one.
  7847. if ( displayBlock ) {
  7848. this._addClass( this.icon, null, "ui-widget-icon-block" );
  7849. if ( this.iconSpace ) {
  7850. this.iconSpace.remove();
  7851. }
  7852. } else {
  7853. // Position is beginning or end so remove the ui-widget-icon-block class and add the
  7854. // space if it does not exist
  7855. if ( !this.iconSpace ) {
  7856. this.iconSpace = $( "<span> </span>" );
  7857. this._addClass( this.iconSpace, "ui-button-icon-space" );
  7858. }
  7859. this._removeClass( this.icon, null, "ui-wiget-icon-block" );
  7860. this._attachIconSpace( position );
  7861. }
  7862. },
  7863. _destroy: function() {
  7864. this.element.removeAttr( "role" );
  7865. if ( this.icon ) {
  7866. this.icon.remove();
  7867. }
  7868. if ( this.iconSpace ) {
  7869. this.iconSpace.remove();
  7870. }
  7871. if ( !this.hasTitle ) {
  7872. this.element.removeAttr( "title" );
  7873. }
  7874. },
  7875. _attachIconSpace: function( iconPosition ) {
  7876. this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace );
  7877. },
  7878. _attachIcon: function( iconPosition ) {
  7879. this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon );
  7880. },
  7881. _setOptions: function( options ) {
  7882. var newShowLabel = options.showLabel === undefined ?
  7883. this.options.showLabel :
  7884. options.showLabel,
  7885. newIcon = options.icon === undefined ? this.options.icon : options.icon;
  7886. if ( !newShowLabel && !newIcon ) {
  7887. options.showLabel = true;
  7888. }
  7889. this._super( options );
  7890. },
  7891. _setOption: function( key, value ) {
  7892. if ( key === "icon" ) {
  7893. if ( value ) {
  7894. this._updateIcon( key, value );
  7895. } else if ( this.icon ) {
  7896. this.icon.remove();
  7897. if ( this.iconSpace ) {
  7898. this.iconSpace.remove();
  7899. }
  7900. }
  7901. }
  7902. if ( key === "iconPosition" ) {
  7903. this._updateIcon( key, value );
  7904. }
  7905. // Make sure we can't end up with a button that has neither text nor icon
  7906. if ( key === "showLabel" ) {
  7907. this._toggleClass( "ui-button-icon-only", null, !value );
  7908. this._updateTooltip();
  7909. }
  7910. if ( key === "label" ) {
  7911. if ( this.isInput ) {
  7912. this.element.val( value );
  7913. } else {
  7914. // If there is an icon, append it, else nothing then append the value
  7915. // this avoids removal of the icon when setting label text
  7916. this.element.html( value );
  7917. if ( this.icon ) {
  7918. this._attachIcon( this.options.iconPosition );
  7919. this._attachIconSpace( this.options.iconPosition );
  7920. }
  7921. }
  7922. }
  7923. this._super( key, value );
  7924. if ( key === "disabled" ) {
  7925. this._toggleClass( null, "ui-state-disabled", value );
  7926. this.element[ 0 ].disabled = value;
  7927. if ( value ) {
  7928. this.element.trigger( "blur" );
  7929. }
  7930. }
  7931. },
  7932. refresh: function() {
  7933. // Make sure to only check disabled if its an element that supports this otherwise
  7934. // check for the disabled class to determine state
  7935. var isDisabled = this.element.is( "input, button" ) ?
  7936. this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" );
  7937. if ( isDisabled !== this.options.disabled ) {
  7938. this._setOptions( { disabled: isDisabled } );
  7939. }
  7940. this._updateTooltip();
  7941. }
  7942. } );
  7943. // DEPRECATED
  7944. if ( $.uiBackCompat !== false ) {
  7945. // Text and Icons options
  7946. $.widget( "ui.button", $.ui.button, {
  7947. options: {
  7948. text: true,
  7949. icons: {
  7950. primary: null,
  7951. secondary: null
  7952. }
  7953. },
  7954. _create: function() {
  7955. if ( this.options.showLabel && !this.options.text ) {
  7956. this.options.showLabel = this.options.text;
  7957. }
  7958. if ( !this.options.showLabel && this.options.text ) {
  7959. this.options.text = this.options.showLabel;
  7960. }
  7961. if ( !this.options.icon && ( this.options.icons.primary ||
  7962. this.options.icons.secondary ) ) {
  7963. if ( this.options.icons.primary ) {
  7964. this.options.icon = this.options.icons.primary;
  7965. } else {
  7966. this.options.icon = this.options.icons.secondary;
  7967. this.options.iconPosition = "end";
  7968. }
  7969. } else if ( this.options.icon ) {
  7970. this.options.icons.primary = this.options.icon;
  7971. }
  7972. this._super();
  7973. },
  7974. _setOption: function( key, value ) {
  7975. if ( key === "text" ) {
  7976. this._super( "showLabel", value );
  7977. return;
  7978. }
  7979. if ( key === "showLabel" ) {
  7980. this.options.text = value;
  7981. }
  7982. if ( key === "icon" ) {
  7983. this.options.icons.primary = value;
  7984. }
  7985. if ( key === "icons" ) {
  7986. if ( value.primary ) {
  7987. this._super( "icon", value.primary );
  7988. this._super( "iconPosition", "beginning" );
  7989. } else if ( value.secondary ) {
  7990. this._super( "icon", value.secondary );
  7991. this._super( "iconPosition", "end" );
  7992. }
  7993. }
  7994. this._superApply( arguments );
  7995. }
  7996. } );
  7997. $.fn.button = ( function( orig ) {
  7998. return function( options ) {
  7999. var isMethodCall = typeof options === "string";
  8000. var args = Array.prototype.slice.call( arguments, 1 );
  8001. var returnValue = this;
  8002. if ( isMethodCall ) {
  8003. // If this is an empty collection, we need to have the instance method
  8004. // return undefined instead of the jQuery instance
  8005. if ( !this.length && options === "instance" ) {
  8006. returnValue = undefined;
  8007. } else {
  8008. this.each( function() {
  8009. var methodValue;
  8010. var type = $( this ).attr( "type" );
  8011. var name = type !== "checkbox" && type !== "radio" ?
  8012. "button" :
  8013. "checkboxradio";
  8014. var instance = $.data( this, "ui-" + name );
  8015. if ( options === "instance" ) {
  8016. returnValue = instance;
  8017. return false;
  8018. }
  8019. if ( !instance ) {
  8020. return $.error( "cannot call methods on button" +
  8021. " prior to initialization; " +
  8022. "attempted to call method '" + options + "'" );
  8023. }
  8024. if ( typeof instance[ options ] !== "function" ||
  8025. options.charAt( 0 ) === "_" ) {
  8026. return $.error( "no such method '" + options + "' for button" +
  8027. " widget instance" );
  8028. }
  8029. methodValue = instance[ options ].apply( instance, args );
  8030. if ( methodValue !== instance && methodValue !== undefined ) {
  8031. returnValue = methodValue && methodValue.jquery ?
  8032. returnValue.pushStack( methodValue.get() ) :
  8033. methodValue;
  8034. return false;
  8035. }
  8036. } );
  8037. }
  8038. } else {
  8039. // Allow multiple hashes to be passed on init
  8040. if ( args.length ) {
  8041. options = $.widget.extend.apply( null, [ options ].concat( args ) );
  8042. }
  8043. this.each( function() {
  8044. var type = $( this ).attr( "type" );
  8045. var name = type !== "checkbox" && type !== "radio" ? "button" : "checkboxradio";
  8046. var instance = $.data( this, "ui-" + name );
  8047. if ( instance ) {
  8048. instance.option( options || {} );
  8049. if ( instance._init ) {
  8050. instance._init();
  8051. }
  8052. } else {
  8053. if ( name === "button" ) {
  8054. orig.call( $( this ), options );
  8055. return;
  8056. }
  8057. $( this ).checkboxradio( $.extend( { icon: false }, options ) );
  8058. }
  8059. } );
  8060. }
  8061. return returnValue;
  8062. };
  8063. } )( $.fn.button );
  8064. $.fn.buttonset = function() {
  8065. if ( !$.ui.controlgroup ) {
  8066. $.error( "Controlgroup widget missing" );
  8067. }
  8068. if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) {
  8069. return this.controlgroup.apply( this,
  8070. [ arguments[ 0 ], "items.button", arguments[ 2 ] ] );
  8071. }
  8072. if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) {
  8073. return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] );
  8074. }
  8075. if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) {
  8076. arguments[ 0 ].items = {
  8077. button: arguments[ 0 ].items
  8078. };
  8079. }
  8080. return this.controlgroup.apply( this, arguments );
  8081. };
  8082. }
  8083. var widgetsButton = $.ui.button;
  8084. /* eslint-disable max-len, camelcase */
  8085. /*!
  8086. * jQuery UI Datepicker 1.13.2
  8087. * http://jqueryui.com
  8088. *
  8089. * Copyright jQuery Foundation and other contributors
  8090. * Released under the MIT license.
  8091. * http://jquery.org/license
  8092. */
  8093. //>>label: Datepicker
  8094. //>>group: Widgets
  8095. //>>description: Displays a calendar from an input or inline for selecting dates.
  8096. //>>docs: http://api.jqueryui.com/datepicker/
  8097. //>>demos: http://jqueryui.com/datepicker/
  8098. //>>css.structure: ../../themes/base/core.css
  8099. //>>css.structure: ../../themes/base/datepicker.css
  8100. //>>css.theme: ../../themes/base/theme.css
  8101. $.extend( $.ui, { datepicker: { version: "1.13.2" } } );
  8102. var datepicker_instActive;
  8103. function datepicker_getZindex( elem ) {
  8104. var position, value;
  8105. while ( elem.length && elem[ 0 ] !== document ) {
  8106. // Ignore z-index if position is set to a value where z-index is ignored by the browser
  8107. // This makes behavior of this function consistent across browsers
  8108. // WebKit always returns auto if the element is positioned
  8109. position = elem.css( "position" );
  8110. if ( position === "absolute" || position === "relative" || position === "fixed" ) {
  8111. // IE returns 0 when zIndex is not specified
  8112. // other browsers return a string
  8113. // we ignore the case of nested elements with an explicit value of 0
  8114. // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
  8115. value = parseInt( elem.css( "zIndex" ), 10 );
  8116. if ( !isNaN( value ) && value !== 0 ) {
  8117. return value;
  8118. }
  8119. }
  8120. elem = elem.parent();
  8121. }
  8122. return 0;
  8123. }
  8124. /* Date picker manager.
  8125. Use the singleton instance of this class, $.datepicker, to interact with the date picker.
  8126. Settings for (groups of) date pickers are maintained in an instance object,
  8127. allowing multiple different settings on the same page. */
  8128. function Datepicker() {
  8129. this._curInst = null; // The current instance in use
  8130. this._keyEvent = false; // If the last event was a key event
  8131. this._disabledInputs = []; // List of date picker inputs that have been disabled
  8132. this._datepickerShowing = false; // True if the popup picker is showing , false if not
  8133. this._inDialog = false; // True if showing within a "dialog", false if not
  8134. this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division
  8135. this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class
  8136. this._appendClass = "ui-datepicker-append"; // The name of the append marker class
  8137. this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class
  8138. this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class
  8139. this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class
  8140. this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class
  8141. this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class
  8142. this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class
  8143. this.regional = []; // Available regional settings, indexed by language code
  8144. this.regional[ "" ] = { // Default regional settings
  8145. closeText: "Done", // Display text for close link
  8146. prevText: "Prev", // Display text for previous month link
  8147. nextText: "Next", // Display text for next month link
  8148. currentText: "Today", // Display text for current month link
  8149. monthNames: [ "January", "February", "March", "April", "May", "June",
  8150. "July", "August", "September", "October", "November", "December" ], // Names of months for drop-down and formatting
  8151. monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting
  8152. dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting
  8153. dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting
  8154. dayNamesMin: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ], // Column headings for days starting at Sunday
  8155. weekHeader: "Wk", // Column header for week of the year
  8156. dateFormat: "mm/dd/yy", // See format options on parseDate
  8157. firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
  8158. isRTL: false, // True if right-to-left language, false if left-to-right
  8159. showMonthAfterYear: false, // True if the year select precedes month, false for month then year
  8160. yearSuffix: "", // Additional text to append to the year in the month headers,
  8161. selectMonthLabel: "Select month", // Invisible label for month selector
  8162. selectYearLabel: "Select year" // Invisible label for year selector
  8163. };
  8164. this._defaults = { // Global defaults for all the date picker instances
  8165. showOn: "focus", // "focus" for popup on focus,
  8166. // "button" for trigger button, or "both" for either
  8167. showAnim: "fadeIn", // Name of jQuery animation for popup
  8168. showOptions: {}, // Options for enhanced animations
  8169. defaultDate: null, // Used when field is blank: actual date,
  8170. // +/-number for offset from today, null for today
  8171. appendText: "", // Display text following the input box, e.g. showing the format
  8172. buttonText: "...", // Text for trigger button
  8173. buttonImage: "", // URL for trigger button image
  8174. buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
  8175. hideIfNoPrevNext: false, // True to hide next/previous month links
  8176. // if not applicable, false to just disable them
  8177. navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
  8178. gotoCurrent: false, // True if today link goes back to current selection instead
  8179. changeMonth: false, // True if month can be selected directly, false if only prev/next
  8180. changeYear: false, // True if year can be selected directly, false if only prev/next
  8181. yearRange: "c-10:c+10", // Range of years to display in drop-down,
  8182. // either relative to today's year (-nn:+nn), relative to currently displayed year
  8183. // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
  8184. showOtherMonths: false, // True to show dates in other months, false to leave blank
  8185. selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
  8186. showWeek: false, // True to show week of the year, false to not show it
  8187. calculateWeek: this.iso8601Week, // How to calculate the week of the year,
  8188. // takes a Date and returns the number of the week for it
  8189. shortYearCutoff: "+10", // Short year values < this are in the current century,
  8190. // > this are in the previous century,
  8191. // string value starting with "+" for current year + value
  8192. minDate: null, // The earliest selectable date, or null for no limit
  8193. maxDate: null, // The latest selectable date, or null for no limit
  8194. duration: "fast", // Duration of display/closure
  8195. beforeShowDay: null, // Function that takes a date and returns an array with
  8196. // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
  8197. // [2] = cell title (optional), e.g. $.datepicker.noWeekends
  8198. beforeShow: null, // Function that takes an input field and
  8199. // returns a set of custom settings for the date picker
  8200. onSelect: null, // Define a callback function when a date is selected
  8201. onChangeMonthYear: null, // Define a callback function when the month or year is changed
  8202. onClose: null, // Define a callback function when the datepicker is closed
  8203. onUpdateDatepicker: null, // Define a callback function when the datepicker is updated
  8204. numberOfMonths: 1, // Number of months to show at a time
  8205. showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
  8206. stepMonths: 1, // Number of months to step back/forward
  8207. stepBigMonths: 12, // Number of months to step back/forward for the big links
  8208. altField: "", // Selector for an alternate field to store selected dates into
  8209. altFormat: "", // The date format to use for the alternate field
  8210. constrainInput: true, // The input is constrained by the current date format
  8211. showButtonPanel: false, // True to show button panel, false to not show it
  8212. autoSize: false, // True to size the input for the date format, false to leave as is
  8213. disabled: false // The initial disabled state
  8214. };
  8215. $.extend( this._defaults, this.regional[ "" ] );
  8216. this.regional.en = $.extend( true, {}, this.regional[ "" ] );
  8217. this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en );
  8218. this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) );
  8219. }
  8220. $.extend( Datepicker.prototype, {
  8221. /* Class name added to elements to indicate already configured with a date picker. */
  8222. markerClassName: "hasDatepicker",
  8223. //Keep track of the maximum number of rows displayed (see #7043)
  8224. maxRows: 4,
  8225. // TODO rename to "widget" when switching to widget factory
  8226. _widgetDatepicker: function() {
  8227. return this.dpDiv;
  8228. },
  8229. /* Override the default settings for all instances of the date picker.
  8230. * @param settings object - the new settings to use as defaults (anonymous object)
  8231. * @return the manager object
  8232. */
  8233. setDefaults: function( settings ) {
  8234. datepicker_extendRemove( this._defaults, settings || {} );
  8235. return this;
  8236. },
  8237. /* Attach the date picker to a jQuery selection.
  8238. * @param target element - the target input field or division or span
  8239. * @param settings object - the new settings to use for this date picker instance (anonymous)
  8240. */
  8241. _attachDatepicker: function( target, settings ) {
  8242. var nodeName, inline, inst;
  8243. nodeName = target.nodeName.toLowerCase();
  8244. inline = ( nodeName === "div" || nodeName === "span" );
  8245. if ( !target.id ) {
  8246. this.uuid += 1;
  8247. target.id = "dp" + this.uuid;
  8248. }
  8249. inst = this._newInst( $( target ), inline );
  8250. inst.settings = $.extend( {}, settings || {} );
  8251. if ( nodeName === "input" ) {
  8252. this._connectDatepicker( target, inst );
  8253. } else if ( inline ) {
  8254. this._inlineDatepicker( target, inst );
  8255. }
  8256. },
  8257. /* Create a new instance object. */
  8258. _newInst: function( target, inline ) {
  8259. var id = target[ 0 ].id.replace( /([^A-Za-z0-9_\-])/g, "\\\\$1" ); // escape jQuery meta chars
  8260. return { id: id, input: target, // associated target
  8261. selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
  8262. drawMonth: 0, drawYear: 0, // month being drawn
  8263. inline: inline, // is datepicker inline or not
  8264. dpDiv: ( !inline ? this.dpDiv : // presentation div
  8265. datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) };
  8266. },
  8267. /* Attach the date picker to an input field. */
  8268. _connectDatepicker: function( target, inst ) {
  8269. var input = $( target );
  8270. inst.append = $( [] );
  8271. inst.trigger = $( [] );
  8272. if ( input.hasClass( this.markerClassName ) ) {
  8273. return;
  8274. }
  8275. this._attachments( input, inst );
  8276. input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ).
  8277. on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp );
  8278. this._autoSize( inst );
  8279. $.data( target, "datepicker", inst );
  8280. //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
  8281. if ( inst.settings.disabled ) {
  8282. this._disableDatepicker( target );
  8283. }
  8284. },
  8285. /* Make attachments based on settings. */
  8286. _attachments: function( input, inst ) {
  8287. var showOn, buttonText, buttonImage,
  8288. appendText = this._get( inst, "appendText" ),
  8289. isRTL = this._get( inst, "isRTL" );
  8290. if ( inst.append ) {
  8291. inst.append.remove();
  8292. }
  8293. if ( appendText ) {
  8294. inst.append = $( "<span>" )
  8295. .addClass( this._appendClass )
  8296. .text( appendText );
  8297. input[ isRTL ? "before" : "after" ]( inst.append );
  8298. }
  8299. input.off( "focus", this._showDatepicker );
  8300. if ( inst.trigger ) {
  8301. inst.trigger.remove();
  8302. }
  8303. showOn = this._get( inst, "showOn" );
  8304. if ( showOn === "focus" || showOn === "both" ) { // pop-up date picker when in the marked field
  8305. input.on( "focus", this._showDatepicker );
  8306. }
  8307. if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked
  8308. buttonText = this._get( inst, "buttonText" );
  8309. buttonImage = this._get( inst, "buttonImage" );
  8310. if ( this._get( inst, "buttonImageOnly" ) ) {
  8311. inst.trigger = $( "<img>" )
  8312. .addClass( this._triggerClass )
  8313. .attr( {
  8314. src: buttonImage,
  8315. alt: buttonText,
  8316. title: buttonText
  8317. } );
  8318. } else {
  8319. inst.trigger = $( "<button type='button'>" )
  8320. .addClass( this._triggerClass );
  8321. if ( buttonImage ) {
  8322. inst.trigger.html(
  8323. $( "<img>" )
  8324. .attr( {
  8325. src: buttonImage,
  8326. alt: buttonText,
  8327. title: buttonText
  8328. } )
  8329. );
  8330. } else {
  8331. inst.trigger.text( buttonText );
  8332. }
  8333. }
  8334. input[ isRTL ? "before" : "after" ]( inst.trigger );
  8335. inst.trigger.on( "click", function() {
  8336. if ( $.datepicker._datepickerShowing && $.datepicker._lastInput === input[ 0 ] ) {
  8337. $.datepicker._hideDatepicker();
  8338. } else if ( $.datepicker._datepickerShowing && $.datepicker._lastInput !== input[ 0 ] ) {
  8339. $.datepicker._hideDatepicker();
  8340. $.datepicker._showDatepicker( input[ 0 ] );
  8341. } else {
  8342. $.datepicker._showDatepicker( input[ 0 ] );
  8343. }
  8344. return false;
  8345. } );
  8346. }
  8347. },
  8348. /* Apply the maximum length for the date format. */
  8349. _autoSize: function( inst ) {
  8350. if ( this._get( inst, "autoSize" ) && !inst.inline ) {
  8351. var findMax, max, maxI, i,
  8352. date = new Date( 2009, 12 - 1, 20 ), // Ensure double digits
  8353. dateFormat = this._get( inst, "dateFormat" );
  8354. if ( dateFormat.match( /[DM]/ ) ) {
  8355. findMax = function( names ) {
  8356. max = 0;
  8357. maxI = 0;
  8358. for ( i = 0; i < names.length; i++ ) {
  8359. if ( names[ i ].length > max ) {
  8360. max = names[ i ].length;
  8361. maxI = i;
  8362. }
  8363. }
  8364. return maxI;
  8365. };
  8366. date.setMonth( findMax( this._get( inst, ( dateFormat.match( /MM/ ) ?
  8367. "monthNames" : "monthNamesShort" ) ) ) );
  8368. date.setDate( findMax( this._get( inst, ( dateFormat.match( /DD/ ) ?
  8369. "dayNames" : "dayNamesShort" ) ) ) + 20 - date.getDay() );
  8370. }
  8371. inst.input.attr( "size", this._formatDate( inst, date ).length );
  8372. }
  8373. },
  8374. /* Attach an inline date picker to a div. */
  8375. _inlineDatepicker: function( target, inst ) {
  8376. var divSpan = $( target );
  8377. if ( divSpan.hasClass( this.markerClassName ) ) {
  8378. return;
  8379. }
  8380. divSpan.addClass( this.markerClassName ).append( inst.dpDiv );
  8381. $.data( target, "datepicker", inst );
  8382. this._setDate( inst, this._getDefaultDate( inst ), true );
  8383. this._updateDatepicker( inst );
  8384. this._updateAlternate( inst );
  8385. //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
  8386. if ( inst.settings.disabled ) {
  8387. this._disableDatepicker( target );
  8388. }
  8389. // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
  8390. // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
  8391. inst.dpDiv.css( "display", "block" );
  8392. },
  8393. /* Pop-up the date picker in a "dialog" box.
  8394. * @param input element - ignored
  8395. * @param date string or Date - the initial date to display
  8396. * @param onSelect function - the function to call when a date is selected
  8397. * @param settings object - update the dialog date picker instance's settings (anonymous object)
  8398. * @param pos int[2] - coordinates for the dialog's position within the screen or
  8399. * event - with x/y coordinates or
  8400. * leave empty for default (screen centre)
  8401. * @return the manager object
  8402. */
  8403. _dialogDatepicker: function( input, date, onSelect, settings, pos ) {
  8404. var id, browserWidth, browserHeight, scrollX, scrollY,
  8405. inst = this._dialogInst; // internal instance
  8406. if ( !inst ) {
  8407. this.uuid += 1;
  8408. id = "dp" + this.uuid;
  8409. this._dialogInput = $( "<input type='text' id='" + id +
  8410. "' style='position: absolute; top: -100px; width: 0px;'/>" );
  8411. this._dialogInput.on( "keydown", this._doKeyDown );
  8412. $( "body" ).append( this._dialogInput );
  8413. inst = this._dialogInst = this._newInst( this._dialogInput, false );
  8414. inst.settings = {};
  8415. $.data( this._dialogInput[ 0 ], "datepicker", inst );
  8416. }
  8417. datepicker_extendRemove( inst.settings, settings || {} );
  8418. date = ( date && date.constructor === Date ? this._formatDate( inst, date ) : date );
  8419. this._dialogInput.val( date );
  8420. this._pos = ( pos ? ( pos.length ? pos : [ pos.pageX, pos.pageY ] ) : null );
  8421. if ( !this._pos ) {
  8422. browserWidth = document.documentElement.clientWidth;
  8423. browserHeight = document.documentElement.clientHeight;
  8424. scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
  8425. scrollY = document.documentElement.scrollTop || document.body.scrollTop;
  8426. this._pos = // should use actual width/height below
  8427. [ ( browserWidth / 2 ) - 100 + scrollX, ( browserHeight / 2 ) - 150 + scrollY ];
  8428. }
  8429. // Move input on screen for focus, but hidden behind dialog
  8430. this._dialogInput.css( "left", ( this._pos[ 0 ] + 20 ) + "px" ).css( "top", this._pos[ 1 ] + "px" );
  8431. inst.settings.onSelect = onSelect;
  8432. this._inDialog = true;
  8433. this.dpDiv.addClass( this._dialogClass );
  8434. this._showDatepicker( this._dialogInput[ 0 ] );
  8435. if ( $.blockUI ) {
  8436. $.blockUI( this.dpDiv );
  8437. }
  8438. $.data( this._dialogInput[ 0 ], "datepicker", inst );
  8439. return this;
  8440. },
  8441. /* Detach a datepicker from its control.
  8442. * @param target element - the target input field or division or span
  8443. */
  8444. _destroyDatepicker: function( target ) {
  8445. var nodeName,
  8446. $target = $( target ),
  8447. inst = $.data( target, "datepicker" );
  8448. if ( !$target.hasClass( this.markerClassName ) ) {
  8449. return;
  8450. }
  8451. nodeName = target.nodeName.toLowerCase();
  8452. $.removeData( target, "datepicker" );
  8453. if ( nodeName === "input" ) {
  8454. inst.append.remove();
  8455. inst.trigger.remove();
  8456. $target.removeClass( this.markerClassName ).
  8457. off( "focus", this._showDatepicker ).
  8458. off( "keydown", this._doKeyDown ).
  8459. off( "keypress", this._doKeyPress ).
  8460. off( "keyup", this._doKeyUp );
  8461. } else if ( nodeName === "div" || nodeName === "span" ) {
  8462. $target.removeClass( this.markerClassName ).empty();
  8463. }
  8464. if ( datepicker_instActive === inst ) {
  8465. datepicker_instActive = null;
  8466. this._curInst = null;
  8467. }
  8468. },
  8469. /* Enable the date picker to a jQuery selection.
  8470. * @param target element - the target input field or division or span
  8471. */
  8472. _enableDatepicker: function( target ) {
  8473. var nodeName, inline,
  8474. $target = $( target ),
  8475. inst = $.data( target, "datepicker" );
  8476. if ( !$target.hasClass( this.markerClassName ) ) {
  8477. return;
  8478. }
  8479. nodeName = target.nodeName.toLowerCase();
  8480. if ( nodeName === "input" ) {
  8481. target.disabled = false;
  8482. inst.trigger.filter( "button" ).
  8483. each( function() {
  8484. this.disabled = false;
  8485. } ).end().
  8486. filter( "img" ).css( { opacity: "1.0", cursor: "" } );
  8487. } else if ( nodeName === "div" || nodeName === "span" ) {
  8488. inline = $target.children( "." + this._inlineClass );
  8489. inline.children().removeClass( "ui-state-disabled" );
  8490. inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ).
  8491. prop( "disabled", false );
  8492. }
  8493. this._disabledInputs = $.map( this._disabledInputs,
  8494. // Delete entry
  8495. function( value ) {
  8496. return ( value === target ? null : value );
  8497. } );
  8498. },
  8499. /* Disable the date picker to a jQuery selection.
  8500. * @param target element - the target input field or division or span
  8501. */
  8502. _disableDatepicker: function( target ) {
  8503. var nodeName, inline,
  8504. $target = $( target ),
  8505. inst = $.data( target, "datepicker" );
  8506. if ( !$target.hasClass( this.markerClassName ) ) {
  8507. return;
  8508. }
  8509. nodeName = target.nodeName.toLowerCase();
  8510. if ( nodeName === "input" ) {
  8511. target.disabled = true;
  8512. inst.trigger.filter( "button" ).
  8513. each( function() {
  8514. this.disabled = true;
  8515. } ).end().
  8516. filter( "img" ).css( { opacity: "0.5", cursor: "default" } );
  8517. } else if ( nodeName === "div" || nodeName === "span" ) {
  8518. inline = $target.children( "." + this._inlineClass );
  8519. inline.children().addClass( "ui-state-disabled" );
  8520. inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ).
  8521. prop( "disabled", true );
  8522. }
  8523. this._disabledInputs = $.map( this._disabledInputs,
  8524. // Delete entry
  8525. function( value ) {
  8526. return ( value === target ? null : value );
  8527. } );
  8528. this._disabledInputs[ this._disabledInputs.length ] = target;
  8529. },
  8530. /* Is the first field in a jQuery collection disabled as a datepicker?
  8531. * @param target element - the target input field or division or span
  8532. * @return boolean - true if disabled, false if enabled
  8533. */
  8534. _isDisabledDatepicker: function( target ) {
  8535. if ( !target ) {
  8536. return false;
  8537. }
  8538. for ( var i = 0; i < this._disabledInputs.length; i++ ) {
  8539. if ( this._disabledInputs[ i ] === target ) {
  8540. return true;
  8541. }
  8542. }
  8543. return false;
  8544. },
  8545. /* Retrieve the instance data for the target control.
  8546. * @param target element - the target input field or division or span
  8547. * @return object - the associated instance data
  8548. * @throws error if a jQuery problem getting data
  8549. */
  8550. _getInst: function( target ) {
  8551. try {
  8552. return $.data( target, "datepicker" );
  8553. } catch ( err ) {
  8554. throw "Missing instance data for this datepicker";
  8555. }
  8556. },
  8557. /* Update or retrieve the settings for a date picker attached to an input field or division.
  8558. * @param target element - the target input field or division or span
  8559. * @param name object - the new settings to update or
  8560. * string - the name of the setting to change or retrieve,
  8561. * when retrieving also "all" for all instance settings or
  8562. * "defaults" for all global defaults
  8563. * @param value any - the new value for the setting
  8564. * (omit if above is an object or to retrieve a value)
  8565. */
  8566. _optionDatepicker: function( target, name, value ) {
  8567. var settings, date, minDate, maxDate,
  8568. inst = this._getInst( target );
  8569. if ( arguments.length === 2 && typeof name === "string" ) {
  8570. return ( name === "defaults" ? $.extend( {}, $.datepicker._defaults ) :
  8571. ( inst ? ( name === "all" ? $.extend( {}, inst.settings ) :
  8572. this._get( inst, name ) ) : null ) );
  8573. }
  8574. settings = name || {};
  8575. if ( typeof name === "string" ) {
  8576. settings = {};
  8577. settings[ name ] = value;
  8578. }
  8579. if ( inst ) {
  8580. if ( this._curInst === inst ) {
  8581. this._hideDatepicker();
  8582. }
  8583. date = this._getDateDatepicker( target, true );
  8584. minDate = this._getMinMaxDate( inst, "min" );
  8585. maxDate = this._getMinMaxDate( inst, "max" );
  8586. datepicker_extendRemove( inst.settings, settings );
  8587. // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
  8588. if ( minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined ) {
  8589. inst.settings.minDate = this._formatDate( inst, minDate );
  8590. }
  8591. if ( maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined ) {
  8592. inst.settings.maxDate = this._formatDate( inst, maxDate );
  8593. }
  8594. if ( "disabled" in settings ) {
  8595. if ( settings.disabled ) {
  8596. this._disableDatepicker( target );
  8597. } else {
  8598. this._enableDatepicker( target );
  8599. }
  8600. }
  8601. this._attachments( $( target ), inst );
  8602. this._autoSize( inst );
  8603. this._setDate( inst, date );
  8604. this._updateAlternate( inst );
  8605. this._updateDatepicker( inst );
  8606. }
  8607. },
  8608. // Change method deprecated
  8609. _changeDatepicker: function( target, name, value ) {
  8610. this._optionDatepicker( target, name, value );
  8611. },
  8612. /* Redraw the date picker attached to an input field or division.
  8613. * @param target element - the target input field or division or span
  8614. */
  8615. _refreshDatepicker: function( target ) {
  8616. var inst = this._getInst( target );
  8617. if ( inst ) {
  8618. this._updateDatepicker( inst );
  8619. }
  8620. },
  8621. /* Set the dates for a jQuery selection.
  8622. * @param target element - the target input field or division or span
  8623. * @param date Date - the new date
  8624. */
  8625. _setDateDatepicker: function( target, date ) {
  8626. var inst = this._getInst( target );
  8627. if ( inst ) {
  8628. this._setDate( inst, date );
  8629. this._updateDatepicker( inst );
  8630. this._updateAlternate( inst );
  8631. }
  8632. },
  8633. /* Get the date(s) for the first entry in a jQuery selection.
  8634. * @param target element - the target input field or division or span
  8635. * @param noDefault boolean - true if no default date is to be used
  8636. * @return Date - the current date
  8637. */
  8638. _getDateDatepicker: function( target, noDefault ) {
  8639. var inst = this._getInst( target );
  8640. if ( inst && !inst.inline ) {
  8641. this._setDateFromField( inst, noDefault );
  8642. }
  8643. return ( inst ? this._getDate( inst ) : null );
  8644. },
  8645. /* Handle keystrokes. */
  8646. _doKeyDown: function( event ) {
  8647. var onSelect, dateStr, sel,
  8648. inst = $.datepicker._getInst( event.target ),
  8649. handled = true,
  8650. isRTL = inst.dpDiv.is( ".ui-datepicker-rtl" );
  8651. inst._keyEvent = true;
  8652. if ( $.datepicker._datepickerShowing ) {
  8653. switch ( event.keyCode ) {
  8654. case 9: $.datepicker._hideDatepicker();
  8655. handled = false;
  8656. break; // hide on tab out
  8657. case 13: sel = $( "td." + $.datepicker._dayOverClass + ":not(." +
  8658. $.datepicker._currentClass + ")", inst.dpDiv );
  8659. if ( sel[ 0 ] ) {
  8660. $.datepicker._selectDay( event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ] );
  8661. }
  8662. onSelect = $.datepicker._get( inst, "onSelect" );
  8663. if ( onSelect ) {
  8664. dateStr = $.datepicker._formatDate( inst );
  8665. // Trigger custom callback
  8666. onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] );
  8667. } else {
  8668. $.datepicker._hideDatepicker();
  8669. }
  8670. return false; // don't submit the form
  8671. case 27: $.datepicker._hideDatepicker();
  8672. break; // hide on escape
  8673. case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
  8674. -$.datepicker._get( inst, "stepBigMonths" ) :
  8675. -$.datepicker._get( inst, "stepMonths" ) ), "M" );
  8676. break; // previous month/year on page up/+ ctrl
  8677. case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
  8678. +$.datepicker._get( inst, "stepBigMonths" ) :
  8679. +$.datepicker._get( inst, "stepMonths" ) ), "M" );
  8680. break; // next month/year on page down/+ ctrl
  8681. case 35: if ( event.ctrlKey || event.metaKey ) {
  8682. $.datepicker._clearDate( event.target );
  8683. }
  8684. handled = event.ctrlKey || event.metaKey;
  8685. break; // clear on ctrl or command +end
  8686. case 36: if ( event.ctrlKey || event.metaKey ) {
  8687. $.datepicker._gotoToday( event.target );
  8688. }
  8689. handled = event.ctrlKey || event.metaKey;
  8690. break; // current on ctrl or command +home
  8691. case 37: if ( event.ctrlKey || event.metaKey ) {
  8692. $.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" );
  8693. }
  8694. handled = event.ctrlKey || event.metaKey;
  8695. // -1 day on ctrl or command +left
  8696. if ( event.originalEvent.altKey ) {
  8697. $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
  8698. -$.datepicker._get( inst, "stepBigMonths" ) :
  8699. -$.datepicker._get( inst, "stepMonths" ) ), "M" );
  8700. }
  8701. // next month/year on alt +left on Mac
  8702. break;
  8703. case 38: if ( event.ctrlKey || event.metaKey ) {
  8704. $.datepicker._adjustDate( event.target, -7, "D" );
  8705. }
  8706. handled = event.ctrlKey || event.metaKey;
  8707. break; // -1 week on ctrl or command +up
  8708. case 39: if ( event.ctrlKey || event.metaKey ) {
  8709. $.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" );
  8710. }
  8711. handled = event.ctrlKey || event.metaKey;
  8712. // +1 day on ctrl or command +right
  8713. if ( event.originalEvent.altKey ) {
  8714. $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
  8715. +$.datepicker._get( inst, "stepBigMonths" ) :
  8716. +$.datepicker._get( inst, "stepMonths" ) ), "M" );
  8717. }
  8718. // next month/year on alt +right
  8719. break;
  8720. case 40: if ( event.ctrlKey || event.metaKey ) {
  8721. $.datepicker._adjustDate( event.target, +7, "D" );
  8722. }
  8723. handled = event.ctrlKey || event.metaKey;
  8724. break; // +1 week on ctrl or command +down
  8725. default: handled = false;
  8726. }
  8727. } else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home
  8728. $.datepicker._showDatepicker( this );
  8729. } else {
  8730. handled = false;
  8731. }
  8732. if ( handled ) {
  8733. event.preventDefault();
  8734. event.stopPropagation();
  8735. }
  8736. },
  8737. /* Filter entered characters - based on date format. */
  8738. _doKeyPress: function( event ) {
  8739. var chars, chr,
  8740. inst = $.datepicker._getInst( event.target );
  8741. if ( $.datepicker._get( inst, "constrainInput" ) ) {
  8742. chars = $.datepicker._possibleChars( $.datepicker._get( inst, "dateFormat" ) );
  8743. chr = String.fromCharCode( event.charCode == null ? event.keyCode : event.charCode );
  8744. return event.ctrlKey || event.metaKey || ( chr < " " || !chars || chars.indexOf( chr ) > -1 );
  8745. }
  8746. },
  8747. /* Synchronise manual entry and field/alternate field. */
  8748. _doKeyUp: function( event ) {
  8749. var date,
  8750. inst = $.datepicker._getInst( event.target );
  8751. if ( inst.input.val() !== inst.lastVal ) {
  8752. try {
  8753. date = $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ),
  8754. ( inst.input ? inst.input.val() : null ),
  8755. $.datepicker._getFormatConfig( inst ) );
  8756. if ( date ) { // only if valid
  8757. $.datepicker._setDateFromField( inst );
  8758. $.datepicker._updateAlternate( inst );
  8759. $.datepicker._updateDatepicker( inst );
  8760. }
  8761. } catch ( err ) {
  8762. }
  8763. }
  8764. return true;
  8765. },
  8766. /* Pop-up the date picker for a given input field.
  8767. * If false returned from beforeShow event handler do not show.
  8768. * @param input element - the input field attached to the date picker or
  8769. * event - if triggered by focus
  8770. */
  8771. _showDatepicker: function( input ) {
  8772. input = input.target || input;
  8773. if ( input.nodeName.toLowerCase() !== "input" ) { // find from button/image trigger
  8774. input = $( "input", input.parentNode )[ 0 ];
  8775. }
  8776. if ( $.datepicker._isDisabledDatepicker( input ) || $.datepicker._lastInput === input ) { // already here
  8777. return;
  8778. }
  8779. var inst, beforeShow, beforeShowSettings, isFixed,
  8780. offset, showAnim, duration;
  8781. inst = $.datepicker._getInst( input );
  8782. if ( $.datepicker._curInst && $.datepicker._curInst !== inst ) {
  8783. $.datepicker._curInst.dpDiv.stop( true, true );
  8784. if ( inst && $.datepicker._datepickerShowing ) {
  8785. $.datepicker._hideDatepicker( $.datepicker._curInst.input[ 0 ] );
  8786. }
  8787. }
  8788. beforeShow = $.datepicker._get( inst, "beforeShow" );
  8789. beforeShowSettings = beforeShow ? beforeShow.apply( input, [ input, inst ] ) : {};
  8790. if ( beforeShowSettings === false ) {
  8791. return;
  8792. }
  8793. datepicker_extendRemove( inst.settings, beforeShowSettings );
  8794. inst.lastVal = null;
  8795. $.datepicker._lastInput = input;
  8796. $.datepicker._setDateFromField( inst );
  8797. if ( $.datepicker._inDialog ) { // hide cursor
  8798. input.value = "";
  8799. }
  8800. if ( !$.datepicker._pos ) { // position below input
  8801. $.datepicker._pos = $.datepicker._findPos( input );
  8802. $.datepicker._pos[ 1 ] += input.offsetHeight; // add the height
  8803. }
  8804. isFixed = false;
  8805. $( input ).parents().each( function() {
  8806. isFixed |= $( this ).css( "position" ) === "fixed";
  8807. return !isFixed;
  8808. } );
  8809. offset = { left: $.datepicker._pos[ 0 ], top: $.datepicker._pos[ 1 ] };
  8810. $.datepicker._pos = null;
  8811. //to avoid flashes on Firefox
  8812. inst.dpDiv.empty();
  8813. // determine sizing offscreen
  8814. inst.dpDiv.css( { position: "absolute", display: "block", top: "-1000px" } );
  8815. $.datepicker._updateDatepicker( inst );
  8816. // fix width for dynamic number of date pickers
  8817. // and adjust position before showing
  8818. offset = $.datepicker._checkOffset( inst, offset, isFixed );
  8819. inst.dpDiv.css( { position: ( $.datepicker._inDialog && $.blockUI ?
  8820. "static" : ( isFixed ? "fixed" : "absolute" ) ), display: "none",
  8821. left: offset.left + "px", top: offset.top + "px" } );
  8822. if ( !inst.inline ) {
  8823. showAnim = $.datepicker._get( inst, "showAnim" );
  8824. duration = $.datepicker._get( inst, "duration" );
  8825. inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 );
  8826. $.datepicker._datepickerShowing = true;
  8827. if ( $.effects && $.effects.effect[ showAnim ] ) {
  8828. inst.dpDiv.show( showAnim, $.datepicker._get( inst, "showOptions" ), duration );
  8829. } else {
  8830. inst.dpDiv[ showAnim || "show" ]( showAnim ? duration : null );
  8831. }
  8832. if ( $.datepicker._shouldFocusInput( inst ) ) {
  8833. inst.input.trigger( "focus" );
  8834. }
  8835. $.datepicker._curInst = inst;
  8836. }
  8837. },
  8838. /* Generate the date picker content. */
  8839. _updateDatepicker: function( inst ) {
  8840. this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
  8841. datepicker_instActive = inst; // for delegate hover events
  8842. inst.dpDiv.empty().append( this._generateHTML( inst ) );
  8843. this._attachHandlers( inst );
  8844. var origyearshtml,
  8845. numMonths = this._getNumberOfMonths( inst ),
  8846. cols = numMonths[ 1 ],
  8847. width = 17,
  8848. activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ),
  8849. onUpdateDatepicker = $.datepicker._get( inst, "onUpdateDatepicker" );
  8850. if ( activeCell.length > 0 ) {
  8851. datepicker_handleMouseover.apply( activeCell.get( 0 ) );
  8852. }
  8853. inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" );
  8854. if ( cols > 1 ) {
  8855. inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" );
  8856. }
  8857. inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) +
  8858. "Class" ]( "ui-datepicker-multi" );
  8859. inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) +
  8860. "Class" ]( "ui-datepicker-rtl" );
  8861. if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) {
  8862. inst.input.trigger( "focus" );
  8863. }
  8864. // Deffered render of the years select (to avoid flashes on Firefox)
  8865. if ( inst.yearshtml ) {
  8866. origyearshtml = inst.yearshtml;
  8867. setTimeout( function() {
  8868. //assure that inst.yearshtml didn't change.
  8869. if ( origyearshtml === inst.yearshtml && inst.yearshtml ) {
  8870. inst.dpDiv.find( "select.ui-datepicker-year" ).first().replaceWith( inst.yearshtml );
  8871. }
  8872. origyearshtml = inst.yearshtml = null;
  8873. }, 0 );
  8874. }
  8875. if ( onUpdateDatepicker ) {
  8876. onUpdateDatepicker.apply( ( inst.input ? inst.input[ 0 ] : null ), [ inst ] );
  8877. }
  8878. },
  8879. // #6694 - don't focus the input if it's already focused
  8880. // this breaks the change event in IE
  8881. // Support: IE and jQuery <1.9
  8882. _shouldFocusInput: function( inst ) {
  8883. return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" );
  8884. },
  8885. /* Check positioning to remain on screen. */
  8886. _checkOffset: function( inst, offset, isFixed ) {
  8887. var dpWidth = inst.dpDiv.outerWidth(),
  8888. dpHeight = inst.dpDiv.outerHeight(),
  8889. inputWidth = inst.input ? inst.input.outerWidth() : 0,
  8890. inputHeight = inst.input ? inst.input.outerHeight() : 0,
  8891. viewWidth = document.documentElement.clientWidth + ( isFixed ? 0 : $( document ).scrollLeft() ),
  8892. viewHeight = document.documentElement.clientHeight + ( isFixed ? 0 : $( document ).scrollTop() );
  8893. offset.left -= ( this._get( inst, "isRTL" ) ? ( dpWidth - inputWidth ) : 0 );
  8894. offset.left -= ( isFixed && offset.left === inst.input.offset().left ) ? $( document ).scrollLeft() : 0;
  8895. offset.top -= ( isFixed && offset.top === ( inst.input.offset().top + inputHeight ) ) ? $( document ).scrollTop() : 0;
  8896. // Now check if datepicker is showing outside window viewport - move to a better place if so.
  8897. offset.left -= Math.min( offset.left, ( offset.left + dpWidth > viewWidth && viewWidth > dpWidth ) ?
  8898. Math.abs( offset.left + dpWidth - viewWidth ) : 0 );
  8899. offset.top -= Math.min( offset.top, ( offset.top + dpHeight > viewHeight && viewHeight > dpHeight ) ?
  8900. Math.abs( dpHeight + inputHeight ) : 0 );
  8901. return offset;
  8902. },
  8903. /* Find an object's position on the screen. */
  8904. _findPos: function( obj ) {
  8905. var position,
  8906. inst = this._getInst( obj ),
  8907. isRTL = this._get( inst, "isRTL" );
  8908. while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.pseudos.hidden( obj ) ) ) {
  8909. obj = obj[ isRTL ? "previousSibling" : "nextSibling" ];
  8910. }
  8911. position = $( obj ).offset();
  8912. return [ position.left, position.top ];
  8913. },
  8914. /* Hide the date picker from view.
  8915. * @param input element - the input field attached to the date picker
  8916. */
  8917. _hideDatepicker: function( input ) {
  8918. var showAnim, duration, postProcess, onClose,
  8919. inst = this._curInst;
  8920. if ( !inst || ( input && inst !== $.data( input, "datepicker" ) ) ) {
  8921. return;
  8922. }
  8923. if ( this._datepickerShowing ) {
  8924. showAnim = this._get( inst, "showAnim" );
  8925. duration = this._get( inst, "duration" );
  8926. postProcess = function() {
  8927. $.datepicker._tidyDialog( inst );
  8928. };
  8929. // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
  8930. if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) {
  8931. inst.dpDiv.hide( showAnim, $.datepicker._get( inst, "showOptions" ), duration, postProcess );
  8932. } else {
  8933. inst.dpDiv[ ( showAnim === "slideDown" ? "slideUp" :
  8934. ( showAnim === "fadeIn" ? "fadeOut" : "hide" ) ) ]( ( showAnim ? duration : null ), postProcess );
  8935. }
  8936. if ( !showAnim ) {
  8937. postProcess();
  8938. }
  8939. this._datepickerShowing = false;
  8940. onClose = this._get( inst, "onClose" );
  8941. if ( onClose ) {
  8942. onClose.apply( ( inst.input ? inst.input[ 0 ] : null ), [ ( inst.input ? inst.input.val() : "" ), inst ] );
  8943. }
  8944. this._lastInput = null;
  8945. if ( this._inDialog ) {
  8946. this._dialogInput.css( { position: "absolute", left: "0", top: "-100px" } );
  8947. if ( $.blockUI ) {
  8948. $.unblockUI();
  8949. $( "body" ).append( this.dpDiv );
  8950. }
  8951. }
  8952. this._inDialog = false;
  8953. }
  8954. },
  8955. /* Tidy up after a dialog display. */
  8956. _tidyDialog: function( inst ) {
  8957. inst.dpDiv.removeClass( this._dialogClass ).off( ".ui-datepicker-calendar" );
  8958. },
  8959. /* Close date picker if clicked elsewhere. */
  8960. _checkExternalClick: function( event ) {
  8961. if ( !$.datepicker._curInst ) {
  8962. return;
  8963. }
  8964. var $target = $( event.target ),
  8965. inst = $.datepicker._getInst( $target[ 0 ] );
  8966. if ( ( ( $target[ 0 ].id !== $.datepicker._mainDivId &&
  8967. $target.parents( "#" + $.datepicker._mainDivId ).length === 0 &&
  8968. !$target.hasClass( $.datepicker.markerClassName ) &&
  8969. !$target.closest( "." + $.datepicker._triggerClass ).length &&
  8970. $.datepicker._datepickerShowing && !( $.datepicker._inDialog && $.blockUI ) ) ) ||
  8971. ( $target.hasClass( $.datepicker.markerClassName ) && $.datepicker._curInst !== inst ) ) {
  8972. $.datepicker._hideDatepicker();
  8973. }
  8974. },
  8975. /* Adjust one of the date sub-fields. */
  8976. _adjustDate: function( id, offset, period ) {
  8977. var target = $( id ),
  8978. inst = this._getInst( target[ 0 ] );
  8979. if ( this._isDisabledDatepicker( target[ 0 ] ) ) {
  8980. return;
  8981. }
  8982. this._adjustInstDate( inst, offset, period );
  8983. this._updateDatepicker( inst );
  8984. },
  8985. /* Action for current link. */
  8986. _gotoToday: function( id ) {
  8987. var date,
  8988. target = $( id ),
  8989. inst = this._getInst( target[ 0 ] );
  8990. if ( this._get( inst, "gotoCurrent" ) && inst.currentDay ) {
  8991. inst.selectedDay = inst.currentDay;
  8992. inst.drawMonth = inst.selectedMonth = inst.currentMonth;
  8993. inst.drawYear = inst.selectedYear = inst.currentYear;
  8994. } else {
  8995. date = new Date();
  8996. inst.selectedDay = date.getDate();
  8997. inst.drawMonth = inst.selectedMonth = date.getMonth();
  8998. inst.drawYear = inst.selectedYear = date.getFullYear();
  8999. }
  9000. this._notifyChange( inst );
  9001. this._adjustDate( target );
  9002. },
  9003. /* Action for selecting a new month/year. */
  9004. _selectMonthYear: function( id, select, period ) {
  9005. var target = $( id ),
  9006. inst = this._getInst( target[ 0 ] );
  9007. inst[ "selected" + ( period === "M" ? "Month" : "Year" ) ] =
  9008. inst[ "draw" + ( period === "M" ? "Month" : "Year" ) ] =
  9009. parseInt( select.options[ select.selectedIndex ].value, 10 );
  9010. this._notifyChange( inst );
  9011. this._adjustDate( target );
  9012. },
  9013. /* Action for selecting a day. */
  9014. _selectDay: function( id, month, year, td ) {
  9015. var inst,
  9016. target = $( id );
  9017. if ( $( td ).hasClass( this._unselectableClass ) || this._isDisabledDatepicker( target[ 0 ] ) ) {
  9018. return;
  9019. }
  9020. inst = this._getInst( target[ 0 ] );
  9021. inst.selectedDay = inst.currentDay = parseInt( $( "a", td ).attr( "data-date" ) );
  9022. inst.selectedMonth = inst.currentMonth = month;
  9023. inst.selectedYear = inst.currentYear = year;
  9024. this._selectDate( id, this._formatDate( inst,
  9025. inst.currentDay, inst.currentMonth, inst.currentYear ) );
  9026. },
  9027. /* Erase the input field and hide the date picker. */
  9028. _clearDate: function( id ) {
  9029. var target = $( id );
  9030. this._selectDate( target, "" );
  9031. },
  9032. /* Update the input field with the selected date. */
  9033. _selectDate: function( id, dateStr ) {
  9034. var onSelect,
  9035. target = $( id ),
  9036. inst = this._getInst( target[ 0 ] );
  9037. dateStr = ( dateStr != null ? dateStr : this._formatDate( inst ) );
  9038. if ( inst.input ) {
  9039. inst.input.val( dateStr );
  9040. }
  9041. this._updateAlternate( inst );
  9042. onSelect = this._get( inst, "onSelect" );
  9043. if ( onSelect ) {
  9044. onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); // trigger custom callback
  9045. } else if ( inst.input ) {
  9046. inst.input.trigger( "change" ); // fire the change event
  9047. }
  9048. if ( inst.inline ) {
  9049. this._updateDatepicker( inst );
  9050. } else {
  9051. this._hideDatepicker();
  9052. this._lastInput = inst.input[ 0 ];
  9053. if ( typeof( inst.input[ 0 ] ) !== "object" ) {
  9054. inst.input.trigger( "focus" ); // restore focus
  9055. }
  9056. this._lastInput = null;
  9057. }
  9058. },
  9059. /* Update any alternate field to synchronise with the main field. */
  9060. _updateAlternate: function( inst ) {
  9061. var altFormat, date, dateStr,
  9062. altField = this._get( inst, "altField" );
  9063. if ( altField ) { // update alternate field too
  9064. altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" );
  9065. date = this._getDate( inst );
  9066. dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) );
  9067. $( document ).find( altField ).val( dateStr );
  9068. }
  9069. },
  9070. /* Set as beforeShowDay function to prevent selection of weekends.
  9071. * @param date Date - the date to customise
  9072. * @return [boolean, string] - is this date selectable?, what is its CSS class?
  9073. */
  9074. noWeekends: function( date ) {
  9075. var day = date.getDay();
  9076. return [ ( day > 0 && day < 6 ), "" ];
  9077. },
  9078. /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
  9079. * @param date Date - the date to get the week for
  9080. * @return number - the number of the week within the year that contains this date
  9081. */
  9082. iso8601Week: function( date ) {
  9083. var time,
  9084. checkDate = new Date( date.getTime() );
  9085. // Find Thursday of this week starting on Monday
  9086. checkDate.setDate( checkDate.getDate() + 4 - ( checkDate.getDay() || 7 ) );
  9087. time = checkDate.getTime();
  9088. checkDate.setMonth( 0 ); // Compare with Jan 1
  9089. checkDate.setDate( 1 );
  9090. return Math.floor( Math.round( ( time - checkDate ) / 86400000 ) / 7 ) + 1;
  9091. },
  9092. /* Parse a string value into a date object.
  9093. * See formatDate below for the possible formats.
  9094. *
  9095. * @param format string - the expected format of the date
  9096. * @param value string - the date in the above format
  9097. * @param settings Object - attributes include:
  9098. * shortYearCutoff number - the cutoff year for determining the century (optional)
  9099. * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
  9100. * dayNames string[7] - names of the days from Sunday (optional)
  9101. * monthNamesShort string[12] - abbreviated names of the months (optional)
  9102. * monthNames string[12] - names of the months (optional)
  9103. * @return Date - the extracted date value or null if value is blank
  9104. */
  9105. parseDate: function( format, value, settings ) {
  9106. if ( format == null || value == null ) {
  9107. throw "Invalid arguments";
  9108. }
  9109. value = ( typeof value === "object" ? value.toString() : value + "" );
  9110. if ( value === "" ) {
  9111. return null;
  9112. }
  9113. var iFormat, dim, extra,
  9114. iValue = 0,
  9115. shortYearCutoffTemp = ( settings ? settings.shortYearCutoff : null ) || this._defaults.shortYearCutoff,
  9116. shortYearCutoff = ( typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp :
  9117. new Date().getFullYear() % 100 + parseInt( shortYearCutoffTemp, 10 ) ),
  9118. dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort,
  9119. dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames,
  9120. monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort,
  9121. monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames,
  9122. year = -1,
  9123. month = -1,
  9124. day = -1,
  9125. doy = -1,
  9126. literal = false,
  9127. date,
  9128. // Check whether a format character is doubled
  9129. lookAhead = function( match ) {
  9130. var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
  9131. if ( matches ) {
  9132. iFormat++;
  9133. }
  9134. return matches;
  9135. },
  9136. // Extract a number from the string value
  9137. getNumber = function( match ) {
  9138. var isDoubled = lookAhead( match ),
  9139. size = ( match === "@" ? 14 : ( match === "!" ? 20 :
  9140. ( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ),
  9141. minSize = ( match === "y" ? size : 1 ),
  9142. digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ),
  9143. num = value.substring( iValue ).match( digits );
  9144. if ( !num ) {
  9145. throw "Missing number at position " + iValue;
  9146. }
  9147. iValue += num[ 0 ].length;
  9148. return parseInt( num[ 0 ], 10 );
  9149. },
  9150. // Extract a name from the string value and convert to an index
  9151. getName = function( match, shortNames, longNames ) {
  9152. var index = -1,
  9153. names = $.map( lookAhead( match ) ? longNames : shortNames, function( v, k ) {
  9154. return [ [ k, v ] ];
  9155. } ).sort( function( a, b ) {
  9156. return -( a[ 1 ].length - b[ 1 ].length );
  9157. } );
  9158. $.each( names, function( i, pair ) {
  9159. var name = pair[ 1 ];
  9160. if ( value.substr( iValue, name.length ).toLowerCase() === name.toLowerCase() ) {
  9161. index = pair[ 0 ];
  9162. iValue += name.length;
  9163. return false;
  9164. }
  9165. } );
  9166. if ( index !== -1 ) {
  9167. return index + 1;
  9168. } else {
  9169. throw "Unknown name at position " + iValue;
  9170. }
  9171. },
  9172. // Confirm that a literal character matches the string value
  9173. checkLiteral = function() {
  9174. if ( value.charAt( iValue ) !== format.charAt( iFormat ) ) {
  9175. throw "Unexpected literal at position " + iValue;
  9176. }
  9177. iValue++;
  9178. };
  9179. for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
  9180. if ( literal ) {
  9181. if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
  9182. literal = false;
  9183. } else {
  9184. checkLiteral();
  9185. }
  9186. } else {
  9187. switch ( format.charAt( iFormat ) ) {
  9188. case "d":
  9189. day = getNumber( "d" );
  9190. break;
  9191. case "D":
  9192. getName( "D", dayNamesShort, dayNames );
  9193. break;
  9194. case "o":
  9195. doy = getNumber( "o" );
  9196. break;
  9197. case "m":
  9198. month = getNumber( "m" );
  9199. break;
  9200. case "M":
  9201. month = getName( "M", monthNamesShort, monthNames );
  9202. break;
  9203. case "y":
  9204. year = getNumber( "y" );
  9205. break;
  9206. case "@":
  9207. date = new Date( getNumber( "@" ) );
  9208. year = date.getFullYear();
  9209. month = date.getMonth() + 1;
  9210. day = date.getDate();
  9211. break;
  9212. case "!":
  9213. date = new Date( ( getNumber( "!" ) - this._ticksTo1970 ) / 10000 );
  9214. year = date.getFullYear();
  9215. month = date.getMonth() + 1;
  9216. day = date.getDate();
  9217. break;
  9218. case "'":
  9219. if ( lookAhead( "'" ) ) {
  9220. checkLiteral();
  9221. } else {
  9222. literal = true;
  9223. }
  9224. break;
  9225. default:
  9226. checkLiteral();
  9227. }
  9228. }
  9229. }
  9230. if ( iValue < value.length ) {
  9231. extra = value.substr( iValue );
  9232. if ( !/^\s+/.test( extra ) ) {
  9233. throw "Extra/unparsed characters found in date: " + extra;
  9234. }
  9235. }
  9236. if ( year === -1 ) {
  9237. year = new Date().getFullYear();
  9238. } else if ( year < 100 ) {
  9239. year += new Date().getFullYear() - new Date().getFullYear() % 100 +
  9240. ( year <= shortYearCutoff ? 0 : -100 );
  9241. }
  9242. if ( doy > -1 ) {
  9243. month = 1;
  9244. day = doy;
  9245. do {
  9246. dim = this._getDaysInMonth( year, month - 1 );
  9247. if ( day <= dim ) {
  9248. break;
  9249. }
  9250. month++;
  9251. day -= dim;
  9252. } while ( true );
  9253. }
  9254. date = this._daylightSavingAdjust( new Date( year, month - 1, day ) );
  9255. if ( date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day ) {
  9256. throw "Invalid date"; // E.g. 31/02/00
  9257. }
  9258. return date;
  9259. },
  9260. /* Standard date formats. */
  9261. ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)
  9262. COOKIE: "D, dd M yy",
  9263. ISO_8601: "yy-mm-dd",
  9264. RFC_822: "D, d M y",
  9265. RFC_850: "DD, dd-M-y",
  9266. RFC_1036: "D, d M y",
  9267. RFC_1123: "D, d M yy",
  9268. RFC_2822: "D, d M yy",
  9269. RSS: "D, d M y", // RFC 822
  9270. TICKS: "!",
  9271. TIMESTAMP: "@",
  9272. W3C: "yy-mm-dd", // ISO 8601
  9273. _ticksTo1970: ( ( ( 1970 - 1 ) * 365 + Math.floor( 1970 / 4 ) - Math.floor( 1970 / 100 ) +
  9274. Math.floor( 1970 / 400 ) ) * 24 * 60 * 60 * 10000000 ),
  9275. /* Format a date object into a string value.
  9276. * The format can be combinations of the following:
  9277. * d - day of month (no leading zero)
  9278. * dd - day of month (two digit)
  9279. * o - day of year (no leading zeros)
  9280. * oo - day of year (three digit)
  9281. * D - day name short
  9282. * DD - day name long
  9283. * m - month of year (no leading zero)
  9284. * mm - month of year (two digit)
  9285. * M - month name short
  9286. * MM - month name long
  9287. * y - year (two digit)
  9288. * yy - year (four digit)
  9289. * @ - Unix timestamp (ms since 01/01/1970)
  9290. * ! - Windows ticks (100ns since 01/01/0001)
  9291. * "..." - literal text
  9292. * '' - single quote
  9293. *
  9294. * @param format string - the desired format of the date
  9295. * @param date Date - the date value to format
  9296. * @param settings Object - attributes include:
  9297. * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
  9298. * dayNames string[7] - names of the days from Sunday (optional)
  9299. * monthNamesShort string[12] - abbreviated names of the months (optional)
  9300. * monthNames string[12] - names of the months (optional)
  9301. * @return string - the date in the above format
  9302. */
  9303. formatDate: function( format, date, settings ) {
  9304. if ( !date ) {
  9305. return "";
  9306. }
  9307. var iFormat,
  9308. dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort,
  9309. dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames,
  9310. monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort,
  9311. monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames,
  9312. // Check whether a format character is doubled
  9313. lookAhead = function( match ) {
  9314. var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
  9315. if ( matches ) {
  9316. iFormat++;
  9317. }
  9318. return matches;
  9319. },
  9320. // Format a number, with leading zero if necessary
  9321. formatNumber = function( match, value, len ) {
  9322. var num = "" + value;
  9323. if ( lookAhead( match ) ) {
  9324. while ( num.length < len ) {
  9325. num = "0" + num;
  9326. }
  9327. }
  9328. return num;
  9329. },
  9330. // Format a name, short or long as requested
  9331. formatName = function( match, value, shortNames, longNames ) {
  9332. return ( lookAhead( match ) ? longNames[ value ] : shortNames[ value ] );
  9333. },
  9334. output = "",
  9335. literal = false;
  9336. if ( date ) {
  9337. for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
  9338. if ( literal ) {
  9339. if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
  9340. literal = false;
  9341. } else {
  9342. output += format.charAt( iFormat );
  9343. }
  9344. } else {
  9345. switch ( format.charAt( iFormat ) ) {
  9346. case "d":
  9347. output += formatNumber( "d", date.getDate(), 2 );
  9348. break;
  9349. case "D":
  9350. output += formatName( "D", date.getDay(), dayNamesShort, dayNames );
  9351. break;
  9352. case "o":
  9353. output += formatNumber( "o",
  9354. Math.round( ( new Date( date.getFullYear(), date.getMonth(), date.getDate() ).getTime() - new Date( date.getFullYear(), 0, 0 ).getTime() ) / 86400000 ), 3 );
  9355. break;
  9356. case "m":
  9357. output += formatNumber( "m", date.getMonth() + 1, 2 );
  9358. break;
  9359. case "M":
  9360. output += formatName( "M", date.getMonth(), monthNamesShort, monthNames );
  9361. break;
  9362. case "y":
  9363. output += ( lookAhead( "y" ) ? date.getFullYear() :
  9364. ( date.getFullYear() % 100 < 10 ? "0" : "" ) + date.getFullYear() % 100 );
  9365. break;
  9366. case "@":
  9367. output += date.getTime();
  9368. break;
  9369. case "!":
  9370. output += date.getTime() * 10000 + this._ticksTo1970;
  9371. break;
  9372. case "'":
  9373. if ( lookAhead( "'" ) ) {
  9374. output += "'";
  9375. } else {
  9376. literal = true;
  9377. }
  9378. break;
  9379. default:
  9380. output += format.charAt( iFormat );
  9381. }
  9382. }
  9383. }
  9384. }
  9385. return output;
  9386. },
  9387. /* Extract all possible characters from the date format. */
  9388. _possibleChars: function( format ) {
  9389. var iFormat,
  9390. chars = "",
  9391. literal = false,
  9392. // Check whether a format character is doubled
  9393. lookAhead = function( match ) {
  9394. var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
  9395. if ( matches ) {
  9396. iFormat++;
  9397. }
  9398. return matches;
  9399. };
  9400. for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
  9401. if ( literal ) {
  9402. if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
  9403. literal = false;
  9404. } else {
  9405. chars += format.charAt( iFormat );
  9406. }
  9407. } else {
  9408. switch ( format.charAt( iFormat ) ) {
  9409. case "d": case "m": case "y": case "@":
  9410. chars += "0123456789";
  9411. break;
  9412. case "D": case "M":
  9413. return null; // Accept anything
  9414. case "'":
  9415. if ( lookAhead( "'" ) ) {
  9416. chars += "'";
  9417. } else {
  9418. literal = true;
  9419. }
  9420. break;
  9421. default:
  9422. chars += format.charAt( iFormat );
  9423. }
  9424. }
  9425. }
  9426. return chars;
  9427. },
  9428. /* Get a setting value, defaulting if necessary. */
  9429. _get: function( inst, name ) {
  9430. return inst.settings[ name ] !== undefined ?
  9431. inst.settings[ name ] : this._defaults[ name ];
  9432. },
  9433. /* Parse existing date and initialise date picker. */
  9434. _setDateFromField: function( inst, noDefault ) {
  9435. if ( inst.input.val() === inst.lastVal ) {
  9436. return;
  9437. }
  9438. var dateFormat = this._get( inst, "dateFormat" ),
  9439. dates = inst.lastVal = inst.input ? inst.input.val() : null,
  9440. defaultDate = this._getDefaultDate( inst ),
  9441. date = defaultDate,
  9442. settings = this._getFormatConfig( inst );
  9443. try {
  9444. date = this.parseDate( dateFormat, dates, settings ) || defaultDate;
  9445. } catch ( event ) {
  9446. dates = ( noDefault ? "" : dates );
  9447. }
  9448. inst.selectedDay = date.getDate();
  9449. inst.drawMonth = inst.selectedMonth = date.getMonth();
  9450. inst.drawYear = inst.selectedYear = date.getFullYear();
  9451. inst.currentDay = ( dates ? date.getDate() : 0 );
  9452. inst.currentMonth = ( dates ? date.getMonth() : 0 );
  9453. inst.currentYear = ( dates ? date.getFullYear() : 0 );
  9454. this._adjustInstDate( inst );
  9455. },
  9456. /* Retrieve the default date shown on opening. */
  9457. _getDefaultDate: function( inst ) {
  9458. return this._restrictMinMax( inst,
  9459. this._determineDate( inst, this._get( inst, "defaultDate" ), new Date() ) );
  9460. },
  9461. /* A date may be specified as an exact value or a relative one. */
  9462. _determineDate: function( inst, date, defaultDate ) {
  9463. var offsetNumeric = function( offset ) {
  9464. var date = new Date();
  9465. date.setDate( date.getDate() + offset );
  9466. return date;
  9467. },
  9468. offsetString = function( offset ) {
  9469. try {
  9470. return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ),
  9471. offset, $.datepicker._getFormatConfig( inst ) );
  9472. } catch ( e ) {
  9473. // Ignore
  9474. }
  9475. var date = ( offset.toLowerCase().match( /^c/ ) ?
  9476. $.datepicker._getDate( inst ) : null ) || new Date(),
  9477. year = date.getFullYear(),
  9478. month = date.getMonth(),
  9479. day = date.getDate(),
  9480. pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
  9481. matches = pattern.exec( offset );
  9482. while ( matches ) {
  9483. switch ( matches[ 2 ] || "d" ) {
  9484. case "d" : case "D" :
  9485. day += parseInt( matches[ 1 ], 10 ); break;
  9486. case "w" : case "W" :
  9487. day += parseInt( matches[ 1 ], 10 ) * 7; break;
  9488. case "m" : case "M" :
  9489. month += parseInt( matches[ 1 ], 10 );
  9490. day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) );
  9491. break;
  9492. case "y": case "Y" :
  9493. year += parseInt( matches[ 1 ], 10 );
  9494. day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) );
  9495. break;
  9496. }
  9497. matches = pattern.exec( offset );
  9498. }
  9499. return new Date( year, month, day );
  9500. },
  9501. newDate = ( date == null || date === "" ? defaultDate : ( typeof date === "string" ? offsetString( date ) :
  9502. ( typeof date === "number" ? ( isNaN( date ) ? defaultDate : offsetNumeric( date ) ) : new Date( date.getTime() ) ) ) );
  9503. newDate = ( newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate );
  9504. if ( newDate ) {
  9505. newDate.setHours( 0 );
  9506. newDate.setMinutes( 0 );
  9507. newDate.setSeconds( 0 );
  9508. newDate.setMilliseconds( 0 );
  9509. }
  9510. return this._daylightSavingAdjust( newDate );
  9511. },
  9512. /* Handle switch to/from daylight saving.
  9513. * Hours may be non-zero on daylight saving cut-over:
  9514. * > 12 when midnight changeover, but then cannot generate
  9515. * midnight datetime, so jump to 1AM, otherwise reset.
  9516. * @param date (Date) the date to check
  9517. * @return (Date) the corrected date
  9518. */
  9519. _daylightSavingAdjust: function( date ) {
  9520. if ( !date ) {
  9521. return null;
  9522. }
  9523. date.setHours( date.getHours() > 12 ? date.getHours() + 2 : 0 );
  9524. return date;
  9525. },
  9526. /* Set the date(s) directly. */
  9527. _setDate: function( inst, date, noChange ) {
  9528. var clear = !date,
  9529. origMonth = inst.selectedMonth,
  9530. origYear = inst.selectedYear,
  9531. newDate = this._restrictMinMax( inst, this._determineDate( inst, date, new Date() ) );
  9532. inst.selectedDay = inst.currentDay = newDate.getDate();
  9533. inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
  9534. inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
  9535. if ( ( origMonth !== inst.selectedMonth || origYear !== inst.selectedYear ) && !noChange ) {
  9536. this._notifyChange( inst );
  9537. }
  9538. this._adjustInstDate( inst );
  9539. if ( inst.input ) {
  9540. inst.input.val( clear ? "" : this._formatDate( inst ) );
  9541. }
  9542. },
  9543. /* Retrieve the date(s) directly. */
  9544. _getDate: function( inst ) {
  9545. var startDate = ( !inst.currentYear || ( inst.input && inst.input.val() === "" ) ? null :
  9546. this._daylightSavingAdjust( new Date(
  9547. inst.currentYear, inst.currentMonth, inst.currentDay ) ) );
  9548. return startDate;
  9549. },
  9550. /* Attach the onxxx handlers. These are declared statically so
  9551. * they work with static code transformers like Caja.
  9552. */
  9553. _attachHandlers: function( inst ) {
  9554. var stepMonths = this._get( inst, "stepMonths" ),
  9555. id = "#" + inst.id.replace( /\\\\/g, "\\" );
  9556. inst.dpDiv.find( "[data-handler]" ).map( function() {
  9557. var handler = {
  9558. prev: function() {
  9559. $.datepicker._adjustDate( id, -stepMonths, "M" );
  9560. },
  9561. next: function() {
  9562. $.datepicker._adjustDate( id, +stepMonths, "M" );
  9563. },
  9564. hide: function() {
  9565. $.datepicker._hideDatepicker();
  9566. },
  9567. today: function() {
  9568. $.datepicker._gotoToday( id );
  9569. },
  9570. selectDay: function() {
  9571. $.datepicker._selectDay( id, +this.getAttribute( "data-month" ), +this.getAttribute( "data-year" ), this );
  9572. return false;
  9573. },
  9574. selectMonth: function() {
  9575. $.datepicker._selectMonthYear( id, this, "M" );
  9576. return false;
  9577. },
  9578. selectYear: function() {
  9579. $.datepicker._selectMonthYear( id, this, "Y" );
  9580. return false;
  9581. }
  9582. };
  9583. $( this ).on( this.getAttribute( "data-event" ), handler[ this.getAttribute( "data-handler" ) ] );
  9584. } );
  9585. },
  9586. /* Generate the HTML for the current state of the date picker. */
  9587. _generateHTML: function( inst ) {
  9588. var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
  9589. controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
  9590. monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
  9591. selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
  9592. cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,
  9593. printDate, dRow, tbody, daySettings, otherMonth, unselectable,
  9594. tempDate = new Date(),
  9595. today = this._daylightSavingAdjust(
  9596. new Date( tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate() ) ), // clear time
  9597. isRTL = this._get( inst, "isRTL" ),
  9598. showButtonPanel = this._get( inst, "showButtonPanel" ),
  9599. hideIfNoPrevNext = this._get( inst, "hideIfNoPrevNext" ),
  9600. navigationAsDateFormat = this._get( inst, "navigationAsDateFormat" ),
  9601. numMonths = this._getNumberOfMonths( inst ),
  9602. showCurrentAtPos = this._get( inst, "showCurrentAtPos" ),
  9603. stepMonths = this._get( inst, "stepMonths" ),
  9604. isMultiMonth = ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ),
  9605. currentDate = this._daylightSavingAdjust( ( !inst.currentDay ? new Date( 9999, 9, 9 ) :
  9606. new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ),
  9607. minDate = this._getMinMaxDate( inst, "min" ),
  9608. maxDate = this._getMinMaxDate( inst, "max" ),
  9609. drawMonth = inst.drawMonth - showCurrentAtPos,
  9610. drawYear = inst.drawYear;
  9611. if ( drawMonth < 0 ) {
  9612. drawMonth += 12;
  9613. drawYear--;
  9614. }
  9615. if ( maxDate ) {
  9616. maxDraw = this._daylightSavingAdjust( new Date( maxDate.getFullYear(),
  9617. maxDate.getMonth() - ( numMonths[ 0 ] * numMonths[ 1 ] ) + 1, maxDate.getDate() ) );
  9618. maxDraw = ( minDate && maxDraw < minDate ? minDate : maxDraw );
  9619. while ( this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 ) ) > maxDraw ) {
  9620. drawMonth--;
  9621. if ( drawMonth < 0 ) {
  9622. drawMonth = 11;
  9623. drawYear--;
  9624. }
  9625. }
  9626. }
  9627. inst.drawMonth = drawMonth;
  9628. inst.drawYear = drawYear;
  9629. prevText = this._get( inst, "prevText" );
  9630. prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText,
  9631. this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ),
  9632. this._getFormatConfig( inst ) ) );
  9633. if ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ) {
  9634. prev = $( "<a>" )
  9635. .attr( {
  9636. "class": "ui-datepicker-prev ui-corner-all",
  9637. "data-handler": "prev",
  9638. "data-event": "click",
  9639. title: prevText
  9640. } )
  9641. .append(
  9642. $( "<span>" )
  9643. .addClass( "ui-icon ui-icon-circle-triangle-" +
  9644. ( isRTL ? "e" : "w" ) )
  9645. .text( prevText )
  9646. )[ 0 ].outerHTML;
  9647. } else if ( hideIfNoPrevNext ) {
  9648. prev = "";
  9649. } else {
  9650. prev = $( "<a>" )
  9651. .attr( {
  9652. "class": "ui-datepicker-prev ui-corner-all ui-state-disabled",
  9653. title: prevText
  9654. } )
  9655. .append(
  9656. $( "<span>" )
  9657. .addClass( "ui-icon ui-icon-circle-triangle-" +
  9658. ( isRTL ? "e" : "w" ) )
  9659. .text( prevText )
  9660. )[ 0 ].outerHTML;
  9661. }
  9662. nextText = this._get( inst, "nextText" );
  9663. nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText,
  9664. this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ),
  9665. this._getFormatConfig( inst ) ) );
  9666. if ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ) {
  9667. next = $( "<a>" )
  9668. .attr( {
  9669. "class": "ui-datepicker-next ui-corner-all",
  9670. "data-handler": "next",
  9671. "data-event": "click",
  9672. title: nextText
  9673. } )
  9674. .append(
  9675. $( "<span>" )
  9676. .addClass( "ui-icon ui-icon-circle-triangle-" +
  9677. ( isRTL ? "w" : "e" ) )
  9678. .text( nextText )
  9679. )[ 0 ].outerHTML;
  9680. } else if ( hideIfNoPrevNext ) {
  9681. next = "";
  9682. } else {
  9683. next = $( "<a>" )
  9684. .attr( {
  9685. "class": "ui-datepicker-next ui-corner-all ui-state-disabled",
  9686. title: nextText
  9687. } )
  9688. .append(
  9689. $( "<span>" )
  9690. .attr( "class", "ui-icon ui-icon-circle-triangle-" +
  9691. ( isRTL ? "w" : "e" ) )
  9692. .text( nextText )
  9693. )[ 0 ].outerHTML;
  9694. }
  9695. currentText = this._get( inst, "currentText" );
  9696. gotoDate = ( this._get( inst, "gotoCurrent" ) && inst.currentDay ? currentDate : today );
  9697. currentText = ( !navigationAsDateFormat ? currentText :
  9698. this.formatDate( currentText, gotoDate, this._getFormatConfig( inst ) ) );
  9699. controls = "";
  9700. if ( !inst.inline ) {
  9701. controls = $( "<button>" )
  9702. .attr( {
  9703. type: "button",
  9704. "class": "ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all",
  9705. "data-handler": "hide",
  9706. "data-event": "click"
  9707. } )
  9708. .text( this._get( inst, "closeText" ) )[ 0 ].outerHTML;
  9709. }
  9710. buttonPanel = "";
  9711. if ( showButtonPanel ) {
  9712. buttonPanel = $( "<div class='ui-datepicker-buttonpane ui-widget-content'>" )
  9713. .append( isRTL ? controls : "" )
  9714. .append( this._isInRange( inst, gotoDate ) ?
  9715. $( "<button>" )
  9716. .attr( {
  9717. type: "button",
  9718. "class": "ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all",
  9719. "data-handler": "today",
  9720. "data-event": "click"
  9721. } )
  9722. .text( currentText ) :
  9723. "" )
  9724. .append( isRTL ? "" : controls )[ 0 ].outerHTML;
  9725. }
  9726. firstDay = parseInt( this._get( inst, "firstDay" ), 10 );
  9727. firstDay = ( isNaN( firstDay ) ? 0 : firstDay );
  9728. showWeek = this._get( inst, "showWeek" );
  9729. dayNames = this._get( inst, "dayNames" );
  9730. dayNamesMin = this._get( inst, "dayNamesMin" );
  9731. monthNames = this._get( inst, "monthNames" );
  9732. monthNamesShort = this._get( inst, "monthNamesShort" );
  9733. beforeShowDay = this._get( inst, "beforeShowDay" );
  9734. showOtherMonths = this._get( inst, "showOtherMonths" );
  9735. selectOtherMonths = this._get( inst, "selectOtherMonths" );
  9736. defaultDate = this._getDefaultDate( inst );
  9737. html = "";
  9738. for ( row = 0; row < numMonths[ 0 ]; row++ ) {
  9739. group = "";
  9740. this.maxRows = 4;
  9741. for ( col = 0; col < numMonths[ 1 ]; col++ ) {
  9742. selectedDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, inst.selectedDay ) );
  9743. cornerClass = " ui-corner-all";
  9744. calender = "";
  9745. if ( isMultiMonth ) {
  9746. calender += "<div class='ui-datepicker-group";
  9747. if ( numMonths[ 1 ] > 1 ) {
  9748. switch ( col ) {
  9749. case 0: calender += " ui-datepicker-group-first";
  9750. cornerClass = " ui-corner-" + ( isRTL ? "right" : "left" ); break;
  9751. case numMonths[ 1 ] - 1: calender += " ui-datepicker-group-last";
  9752. cornerClass = " ui-corner-" + ( isRTL ? "left" : "right" ); break;
  9753. default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break;
  9754. }
  9755. }
  9756. calender += "'>";
  9757. }
  9758. calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" +
  9759. ( /all|left/.test( cornerClass ) && row === 0 ? ( isRTL ? next : prev ) : "" ) +
  9760. ( /all|right/.test( cornerClass ) && row === 0 ? ( isRTL ? prev : next ) : "" ) +
  9761. this._generateMonthYearHeader( inst, drawMonth, drawYear, minDate, maxDate,
  9762. row > 0 || col > 0, monthNames, monthNamesShort ) + // draw month headers
  9763. "</div><table class='ui-datepicker-calendar'><thead>" +
  9764. "<tr>";
  9765. thead = ( showWeek ? "<th class='ui-datepicker-week-col'>" + this._get( inst, "weekHeader" ) + "</th>" : "" );
  9766. for ( dow = 0; dow < 7; dow++ ) { // days of the week
  9767. day = ( dow + firstDay ) % 7;
  9768. thead += "<th scope='col'" + ( ( dow + firstDay + 6 ) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "" ) + ">" +
  9769. "<span title='" + dayNames[ day ] + "'>" + dayNamesMin[ day ] + "</span></th>";
  9770. }
  9771. calender += thead + "</tr></thead><tbody>";
  9772. daysInMonth = this._getDaysInMonth( drawYear, drawMonth );
  9773. if ( drawYear === inst.selectedYear && drawMonth === inst.selectedMonth ) {
  9774. inst.selectedDay = Math.min( inst.selectedDay, daysInMonth );
  9775. }
  9776. leadDays = ( this._getFirstDayOfMonth( drawYear, drawMonth ) - firstDay + 7 ) % 7;
  9777. curRows = Math.ceil( ( leadDays + daysInMonth ) / 7 ); // calculate the number of rows to generate
  9778. numRows = ( isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows ); //If multiple months, use the higher number of rows (see #7043)
  9779. this.maxRows = numRows;
  9780. printDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 - leadDays ) );
  9781. for ( dRow = 0; dRow < numRows; dRow++ ) { // create date picker rows
  9782. calender += "<tr>";
  9783. tbody = ( !showWeek ? "" : "<td class='ui-datepicker-week-col'>" +
  9784. this._get( inst, "calculateWeek" )( printDate ) + "</td>" );
  9785. for ( dow = 0; dow < 7; dow++ ) { // create date picker days
  9786. daySettings = ( beforeShowDay ?
  9787. beforeShowDay.apply( ( inst.input ? inst.input[ 0 ] : null ), [ printDate ] ) : [ true, "" ] );
  9788. otherMonth = ( printDate.getMonth() !== drawMonth );
  9789. unselectable = ( otherMonth && !selectOtherMonths ) || !daySettings[ 0 ] ||
  9790. ( minDate && printDate < minDate ) || ( maxDate && printDate > maxDate );
  9791. tbody += "<td class='" +
  9792. ( ( dow + firstDay + 6 ) % 7 >= 5 ? " ui-datepicker-week-end" : "" ) + // highlight weekends
  9793. ( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months
  9794. ( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key
  9795. ( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ?
  9796. // or defaultDate is current printedDate and defaultDate is selectedDate
  9797. " " + this._dayOverClass : "" ) + // highlight selected day
  9798. ( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) + // highlight unselectable days
  9799. ( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates
  9800. ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day
  9801. ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different)
  9802. ( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "&#39;" ) + "'" : "" ) + // cell title
  9803. ( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions
  9804. ( otherMonth && !showOtherMonths ? "&#xa0;" : // display for other months
  9805. ( unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" +
  9806. ( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) +
  9807. ( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day
  9808. ( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months
  9809. "' href='#' aria-current='" + ( printDate.getTime() === currentDate.getTime() ? "true" : "false" ) + // mark date as selected for screen reader
  9810. "' data-date='" + printDate.getDate() + // store date as data
  9811. "'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date
  9812. printDate.setDate( printDate.getDate() + 1 );
  9813. printDate = this._daylightSavingAdjust( printDate );
  9814. }
  9815. calender += tbody + "</tr>";
  9816. }
  9817. drawMonth++;
  9818. if ( drawMonth > 11 ) {
  9819. drawMonth = 0;
  9820. drawYear++;
  9821. }
  9822. calender += "</tbody></table>" + ( isMultiMonth ? "</div>" +
  9823. ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "<div class='ui-datepicker-row-break'></div>" : "" ) : "" );
  9824. group += calender;
  9825. }
  9826. html += group;
  9827. }
  9828. html += buttonPanel;
  9829. inst._keyEvent = false;
  9830. return html;
  9831. },
  9832. /* Generate the month and year header. */
  9833. _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate,
  9834. secondary, monthNames, monthNamesShort ) {
  9835. var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
  9836. changeMonth = this._get( inst, "changeMonth" ),
  9837. changeYear = this._get( inst, "changeYear" ),
  9838. showMonthAfterYear = this._get( inst, "showMonthAfterYear" ),
  9839. selectMonthLabel = this._get( inst, "selectMonthLabel" ),
  9840. selectYearLabel = this._get( inst, "selectYearLabel" ),
  9841. html = "<div class='ui-datepicker-title'>",
  9842. monthHtml = "";
  9843. // Month selection
  9844. if ( secondary || !changeMonth ) {
  9845. monthHtml += "<span class='ui-datepicker-month'>" + monthNames[ drawMonth ] + "</span>";
  9846. } else {
  9847. inMinYear = ( minDate && minDate.getFullYear() === drawYear );
  9848. inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear );
  9849. monthHtml += "<select class='ui-datepicker-month' aria-label='" + selectMonthLabel + "' data-handler='selectMonth' data-event='change'>";
  9850. for ( month = 0; month < 12; month++ ) {
  9851. if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) {
  9852. monthHtml += "<option value='" + month + "'" +
  9853. ( month === drawMonth ? " selected='selected'" : "" ) +
  9854. ">" + monthNamesShort[ month ] + "</option>";
  9855. }
  9856. }
  9857. monthHtml += "</select>";
  9858. }
  9859. if ( !showMonthAfterYear ) {
  9860. html += monthHtml + ( secondary || !( changeMonth && changeYear ) ? "&#xa0;" : "" );
  9861. }
  9862. // Year selection
  9863. if ( !inst.yearshtml ) {
  9864. inst.yearshtml = "";
  9865. if ( secondary || !changeYear ) {
  9866. html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";
  9867. } else {
  9868. // determine range of years to display
  9869. years = this._get( inst, "yearRange" ).split( ":" );
  9870. thisYear = new Date().getFullYear();
  9871. determineYear = function( value ) {
  9872. var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) :
  9873. ( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) :
  9874. parseInt( value, 10 ) ) );
  9875. return ( isNaN( year ) ? thisYear : year );
  9876. };
  9877. year = determineYear( years[ 0 ] );
  9878. endYear = Math.max( year, determineYear( years[ 1 ] || "" ) );
  9879. year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year );
  9880. endYear = ( maxDate ? Math.min( endYear, maxDate.getFullYear() ) : endYear );
  9881. inst.yearshtml += "<select class='ui-datepicker-year' aria-label='" + selectYearLabel + "' data-handler='selectYear' data-event='change'>";
  9882. for ( ; year <= endYear; year++ ) {
  9883. inst.yearshtml += "<option value='" + year + "'" +
  9884. ( year === drawYear ? " selected='selected'" : "" ) +
  9885. ">" + year + "</option>";
  9886. }
  9887. inst.yearshtml += "</select>";
  9888. html += inst.yearshtml;
  9889. inst.yearshtml = null;
  9890. }
  9891. }
  9892. html += this._get( inst, "yearSuffix" );
  9893. if ( showMonthAfterYear ) {
  9894. html += ( secondary || !( changeMonth && changeYear ) ? "&#xa0;" : "" ) + monthHtml;
  9895. }
  9896. html += "</div>"; // Close datepicker_header
  9897. return html;
  9898. },
  9899. /* Adjust one of the date sub-fields. */
  9900. _adjustInstDate: function( inst, offset, period ) {
  9901. var year = inst.selectedYear + ( period === "Y" ? offset : 0 ),
  9902. month = inst.selectedMonth + ( period === "M" ? offset : 0 ),
  9903. day = Math.min( inst.selectedDay, this._getDaysInMonth( year, month ) ) + ( period === "D" ? offset : 0 ),
  9904. date = this._restrictMinMax( inst, this._daylightSavingAdjust( new Date( year, month, day ) ) );
  9905. inst.selectedDay = date.getDate();
  9906. inst.drawMonth = inst.selectedMonth = date.getMonth();
  9907. inst.drawYear = inst.selectedYear = date.getFullYear();
  9908. if ( period === "M" || period === "Y" ) {
  9909. this._notifyChange( inst );
  9910. }
  9911. },
  9912. /* Ensure a date is within any min/max bounds. */
  9913. _restrictMinMax: function( inst, date ) {
  9914. var minDate = this._getMinMaxDate( inst, "min" ),
  9915. maxDate = this._getMinMaxDate( inst, "max" ),
  9916. newDate = ( minDate && date < minDate ? minDate : date );
  9917. return ( maxDate && newDate > maxDate ? maxDate : newDate );
  9918. },
  9919. /* Notify change of month/year. */
  9920. _notifyChange: function( inst ) {
  9921. var onChange = this._get( inst, "onChangeMonthYear" );
  9922. if ( onChange ) {
  9923. onChange.apply( ( inst.input ? inst.input[ 0 ] : null ),
  9924. [ inst.selectedYear, inst.selectedMonth + 1, inst ] );
  9925. }
  9926. },
  9927. /* Determine the number of months to show. */
  9928. _getNumberOfMonths: function( inst ) {
  9929. var numMonths = this._get( inst, "numberOfMonths" );
  9930. return ( numMonths == null ? [ 1, 1 ] : ( typeof numMonths === "number" ? [ 1, numMonths ] : numMonths ) );
  9931. },
  9932. /* Determine the current maximum date - ensure no time components are set. */
  9933. _getMinMaxDate: function( inst, minMax ) {
  9934. return this._determineDate( inst, this._get( inst, minMax + "Date" ), null );
  9935. },
  9936. /* Find the number of days in a given month. */
  9937. _getDaysInMonth: function( year, month ) {
  9938. return 32 - this._daylightSavingAdjust( new Date( year, month, 32 ) ).getDate();
  9939. },
  9940. /* Find the day of the week of the first of a month. */
  9941. _getFirstDayOfMonth: function( year, month ) {
  9942. return new Date( year, month, 1 ).getDay();
  9943. },
  9944. /* Determines if we should allow a "next/prev" month display change. */
  9945. _canAdjustMonth: function( inst, offset, curYear, curMonth ) {
  9946. var numMonths = this._getNumberOfMonths( inst ),
  9947. date = this._daylightSavingAdjust( new Date( curYear,
  9948. curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) );
  9949. if ( offset < 0 ) {
  9950. date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) );
  9951. }
  9952. return this._isInRange( inst, date );
  9953. },
  9954. /* Is the given date in the accepted range? */
  9955. _isInRange: function( inst, date ) {
  9956. var yearSplit, currentYear,
  9957. minDate = this._getMinMaxDate( inst, "min" ),
  9958. maxDate = this._getMinMaxDate( inst, "max" ),
  9959. minYear = null,
  9960. maxYear = null,
  9961. years = this._get( inst, "yearRange" );
  9962. if ( years ) {
  9963. yearSplit = years.split( ":" );
  9964. currentYear = new Date().getFullYear();
  9965. minYear = parseInt( yearSplit[ 0 ], 10 );
  9966. maxYear = parseInt( yearSplit[ 1 ], 10 );
  9967. if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) {
  9968. minYear += currentYear;
  9969. }
  9970. if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) {
  9971. maxYear += currentYear;
  9972. }
  9973. }
  9974. return ( ( !minDate || date.getTime() >= minDate.getTime() ) &&
  9975. ( !maxDate || date.getTime() <= maxDate.getTime() ) &&
  9976. ( !minYear || date.getFullYear() >= minYear ) &&
  9977. ( !maxYear || date.getFullYear() <= maxYear ) );
  9978. },
  9979. /* Provide the configuration settings for formatting/parsing. */
  9980. _getFormatConfig: function( inst ) {
  9981. var shortYearCutoff = this._get( inst, "shortYearCutoff" );
  9982. shortYearCutoff = ( typeof shortYearCutoff !== "string" ? shortYearCutoff :
  9983. new Date().getFullYear() % 100 + parseInt( shortYearCutoff, 10 ) );
  9984. return { shortYearCutoff: shortYearCutoff,
  9985. dayNamesShort: this._get( inst, "dayNamesShort" ), dayNames: this._get( inst, "dayNames" ),
  9986. monthNamesShort: this._get( inst, "monthNamesShort" ), monthNames: this._get( inst, "monthNames" ) };
  9987. },
  9988. /* Format the given date for display. */
  9989. _formatDate: function( inst, day, month, year ) {
  9990. if ( !day ) {
  9991. inst.currentDay = inst.selectedDay;
  9992. inst.currentMonth = inst.selectedMonth;
  9993. inst.currentYear = inst.selectedYear;
  9994. }
  9995. var date = ( day ? ( typeof day === "object" ? day :
  9996. this._daylightSavingAdjust( new Date( year, month, day ) ) ) :
  9997. this._daylightSavingAdjust( new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) );
  9998. return this.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) );
  9999. }
  10000. } );
  10001. /*
  10002. * Bind hover events for datepicker elements.
  10003. * Done via delegate so the binding only occurs once in the lifetime of the parent div.
  10004. * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
  10005. */
  10006. function datepicker_bindHover( dpDiv ) {
  10007. var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
  10008. return dpDiv.on( "mouseout", selector, function() {
  10009. $( this ).removeClass( "ui-state-hover" );
  10010. if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) {
  10011. $( this ).removeClass( "ui-datepicker-prev-hover" );
  10012. }
  10013. if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) {
  10014. $( this ).removeClass( "ui-datepicker-next-hover" );
  10015. }
  10016. } )
  10017. .on( "mouseover", selector, datepicker_handleMouseover );
  10018. }
  10019. function datepicker_handleMouseover() {
  10020. if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) {
  10021. $( this ).parents( ".ui-datepicker-calendar" ).find( "a" ).removeClass( "ui-state-hover" );
  10022. $( this ).addClass( "ui-state-hover" );
  10023. if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) {
  10024. $( this ).addClass( "ui-datepicker-prev-hover" );
  10025. }
  10026. if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) {
  10027. $( this ).addClass( "ui-datepicker-next-hover" );
  10028. }
  10029. }
  10030. }
  10031. /* jQuery extend now ignores nulls! */
  10032. function datepicker_extendRemove( target, props ) {
  10033. $.extend( target, props );
  10034. for ( var name in props ) {
  10035. if ( props[ name ] == null ) {
  10036. target[ name ] = props[ name ];
  10037. }
  10038. }
  10039. return target;
  10040. }
  10041. /* Invoke the datepicker functionality.
  10042. @param options string - a command, optionally followed by additional parameters or
  10043. Object - settings for attaching new datepicker functionality
  10044. @return jQuery object */
  10045. $.fn.datepicker = function( options ) {
  10046. /* Verify an empty collection wasn't passed - Fixes #6976 */
  10047. if ( !this.length ) {
  10048. return this;
  10049. }
  10050. /* Initialise the date picker. */
  10051. if ( !$.datepicker.initialized ) {
  10052. $( document ).on( "mousedown", $.datepicker._checkExternalClick );
  10053. $.datepicker.initialized = true;
  10054. }
  10055. /* Append datepicker main container to body if not exist. */
  10056. if ( $( "#" + $.datepicker._mainDivId ).length === 0 ) {
  10057. $( "body" ).append( $.datepicker.dpDiv );
  10058. }
  10059. var otherArgs = Array.prototype.slice.call( arguments, 1 );
  10060. if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) {
  10061. return $.datepicker[ "_" + options + "Datepicker" ].
  10062. apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) );
  10063. }
  10064. if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) {
  10065. return $.datepicker[ "_" + options + "Datepicker" ].
  10066. apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) );
  10067. }
  10068. return this.each( function() {
  10069. if ( typeof options === "string" ) {
  10070. $.datepicker[ "_" + options + "Datepicker" ]
  10071. .apply( $.datepicker, [ this ].concat( otherArgs ) );
  10072. } else {
  10073. $.datepicker._attachDatepicker( this, options );
  10074. }
  10075. } );
  10076. };
  10077. $.datepicker = new Datepicker(); // singleton instance
  10078. $.datepicker.initialized = false;
  10079. $.datepicker.uuid = new Date().getTime();
  10080. $.datepicker.version = "1.13.2";
  10081. var widgetsDatepicker = $.datepicker;
  10082. /*!
  10083. * jQuery UI Dialog 1.13.2
  10084. * http://jqueryui.com
  10085. *
  10086. * Copyright jQuery Foundation and other contributors
  10087. * Released under the MIT license.
  10088. * http://jquery.org/license
  10089. */
  10090. //>>label: Dialog
  10091. //>>group: Widgets
  10092. //>>description: Displays customizable dialog windows.
  10093. //>>docs: http://api.jqueryui.com/dialog/
  10094. //>>demos: http://jqueryui.com/dialog/
  10095. //>>css.structure: ../../themes/base/core.css
  10096. //>>css.structure: ../../themes/base/dialog.css
  10097. //>>css.theme: ../../themes/base/theme.css
  10098. $.widget( "ui.dialog", {
  10099. version: "1.13.2",
  10100. options: {
  10101. appendTo: "body",
  10102. autoOpen: true,
  10103. buttons: [],
  10104. classes: {
  10105. "ui-dialog": "ui-corner-all",
  10106. "ui-dialog-titlebar": "ui-corner-all"
  10107. },
  10108. closeOnEscape: true,
  10109. closeText: "Close",
  10110. draggable: true,
  10111. hide: null,
  10112. height: "auto",
  10113. maxHeight: null,
  10114. maxWidth: null,
  10115. minHeight: 150,
  10116. minWidth: 150,
  10117. modal: false,
  10118. position: {
  10119. my: "center",
  10120. at: "center",
  10121. of: window,
  10122. collision: "fit",
  10123. // Ensure the titlebar is always visible
  10124. using: function( pos ) {
  10125. var topOffset = $( this ).css( pos ).offset().top;
  10126. if ( topOffset < 0 ) {
  10127. $( this ).css( "top", pos.top - topOffset );
  10128. }
  10129. }
  10130. },
  10131. resizable: true,
  10132. show: null,
  10133. title: null,
  10134. width: 300,
  10135. // Callbacks
  10136. beforeClose: null,
  10137. close: null,
  10138. drag: null,
  10139. dragStart: null,
  10140. dragStop: null,
  10141. focus: null,
  10142. open: null,
  10143. resize: null,
  10144. resizeStart: null,
  10145. resizeStop: null
  10146. },
  10147. sizeRelatedOptions: {
  10148. buttons: true,
  10149. height: true,
  10150. maxHeight: true,
  10151. maxWidth: true,
  10152. minHeight: true,
  10153. minWidth: true,
  10154. width: true
  10155. },
  10156. resizableRelatedOptions: {
  10157. maxHeight: true,
  10158. maxWidth: true,
  10159. minHeight: true,
  10160. minWidth: true
  10161. },
  10162. _create: function() {
  10163. this.originalCss = {
  10164. display: this.element[ 0 ].style.display,
  10165. width: this.element[ 0 ].style.width,
  10166. minHeight: this.element[ 0 ].style.minHeight,
  10167. maxHeight: this.element[ 0 ].style.maxHeight,
  10168. height: this.element[ 0 ].style.height
  10169. };
  10170. this.originalPosition = {
  10171. parent: this.element.parent(),
  10172. index: this.element.parent().children().index( this.element )
  10173. };
  10174. this.originalTitle = this.element.attr( "title" );
  10175. if ( this.options.title == null && this.originalTitle != null ) {
  10176. this.options.title = this.originalTitle;
  10177. }
  10178. // Dialogs can't be disabled
  10179. if ( this.options.disabled ) {
  10180. this.options.disabled = false;
  10181. }
  10182. this._createWrapper();
  10183. this.element
  10184. .show()
  10185. .removeAttr( "title" )
  10186. .appendTo( this.uiDialog );
  10187. this._addClass( "ui-dialog-content", "ui-widget-content" );
  10188. this._createTitlebar();
  10189. this._createButtonPane();
  10190. if ( this.options.draggable && $.fn.draggable ) {
  10191. this._makeDraggable();
  10192. }
  10193. if ( this.options.resizable && $.fn.resizable ) {
  10194. this._makeResizable();
  10195. }
  10196. this._isOpen = false;
  10197. this._trackFocus();
  10198. },
  10199. _init: function() {
  10200. if ( this.options.autoOpen ) {
  10201. this.open();
  10202. }
  10203. },
  10204. _appendTo: function() {
  10205. var element = this.options.appendTo;
  10206. if ( element && ( element.jquery || element.nodeType ) ) {
  10207. return $( element );
  10208. }
  10209. return this.document.find( element || "body" ).eq( 0 );
  10210. },
  10211. _destroy: function() {
  10212. var next,
  10213. originalPosition = this.originalPosition;
  10214. this._untrackInstance();
  10215. this._destroyOverlay();
  10216. this.element
  10217. .removeUniqueId()
  10218. .css( this.originalCss )
  10219. // Without detaching first, the following becomes really slow
  10220. .detach();
  10221. this.uiDialog.remove();
  10222. if ( this.originalTitle ) {
  10223. this.element.attr( "title", this.originalTitle );
  10224. }
  10225. next = originalPosition.parent.children().eq( originalPosition.index );
  10226. // Don't try to place the dialog next to itself (#8613)
  10227. if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
  10228. next.before( this.element );
  10229. } else {
  10230. originalPosition.parent.append( this.element );
  10231. }
  10232. },
  10233. widget: function() {
  10234. return this.uiDialog;
  10235. },
  10236. disable: $.noop,
  10237. enable: $.noop,
  10238. close: function( event ) {
  10239. var that = this;
  10240. if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
  10241. return;
  10242. }
  10243. this._isOpen = false;
  10244. this._focusedElement = null;
  10245. this._destroyOverlay();
  10246. this._untrackInstance();
  10247. if ( !this.opener.filter( ":focusable" ).trigger( "focus" ).length ) {
  10248. // Hiding a focused element doesn't trigger blur in WebKit
  10249. // so in case we have nothing to focus on, explicitly blur the active element
  10250. // https://bugs.webkit.org/show_bug.cgi?id=47182
  10251. $.ui.safeBlur( $.ui.safeActiveElement( this.document[ 0 ] ) );
  10252. }
  10253. this._hide( this.uiDialog, this.options.hide, function() {
  10254. that._trigger( "close", event );
  10255. } );
  10256. },
  10257. isOpen: function() {
  10258. return this._isOpen;
  10259. },
  10260. moveToTop: function() {
  10261. this._moveToTop();
  10262. },
  10263. _moveToTop: function( event, silent ) {
  10264. var moved = false,
  10265. zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map( function() {
  10266. return +$( this ).css( "z-index" );
  10267. } ).get(),
  10268. zIndexMax = Math.max.apply( null, zIndices );
  10269. if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) {
  10270. this.uiDialog.css( "z-index", zIndexMax + 1 );
  10271. moved = true;
  10272. }
  10273. if ( moved && !silent ) {
  10274. this._trigger( "focus", event );
  10275. }
  10276. return moved;
  10277. },
  10278. open: function() {
  10279. var that = this;
  10280. if ( this._isOpen ) {
  10281. if ( this._moveToTop() ) {
  10282. this._focusTabbable();
  10283. }
  10284. return;
  10285. }
  10286. this._isOpen = true;
  10287. this.opener = $( $.ui.safeActiveElement( this.document[ 0 ] ) );
  10288. this._size();
  10289. this._position();
  10290. this._createOverlay();
  10291. this._moveToTop( null, true );
  10292. // Ensure the overlay is moved to the top with the dialog, but only when
  10293. // opening. The overlay shouldn't move after the dialog is open so that
  10294. // modeless dialogs opened after the modal dialog stack properly.
  10295. if ( this.overlay ) {
  10296. this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 );
  10297. }
  10298. this._show( this.uiDialog, this.options.show, function() {
  10299. that._focusTabbable();
  10300. that._trigger( "focus" );
  10301. } );
  10302. // Track the dialog immediately upon opening in case a focus event
  10303. // somehow occurs outside of the dialog before an element inside the
  10304. // dialog is focused (#10152)
  10305. this._makeFocusTarget();
  10306. this._trigger( "open" );
  10307. },
  10308. _focusTabbable: function() {
  10309. // Set focus to the first match:
  10310. // 1. An element that was focused previously
  10311. // 2. First element inside the dialog matching [autofocus]
  10312. // 3. Tabbable element inside the content element
  10313. // 4. Tabbable element inside the buttonpane
  10314. // 5. The close button
  10315. // 6. The dialog itself
  10316. var hasFocus = this._focusedElement;
  10317. if ( !hasFocus ) {
  10318. hasFocus = this.element.find( "[autofocus]" );
  10319. }
  10320. if ( !hasFocus.length ) {
  10321. hasFocus = this.element.find( ":tabbable" );
  10322. }
  10323. if ( !hasFocus.length ) {
  10324. hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
  10325. }
  10326. if ( !hasFocus.length ) {
  10327. hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" );
  10328. }
  10329. if ( !hasFocus.length ) {
  10330. hasFocus = this.uiDialog;
  10331. }
  10332. hasFocus.eq( 0 ).trigger( "focus" );
  10333. },
  10334. _restoreTabbableFocus: function() {
  10335. var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
  10336. isActive = this.uiDialog[ 0 ] === activeElement ||
  10337. $.contains( this.uiDialog[ 0 ], activeElement );
  10338. if ( !isActive ) {
  10339. this._focusTabbable();
  10340. }
  10341. },
  10342. _keepFocus: function( event ) {
  10343. event.preventDefault();
  10344. this._restoreTabbableFocus();
  10345. // support: IE
  10346. // IE <= 8 doesn't prevent moving focus even with event.preventDefault()
  10347. // so we check again later
  10348. this._delay( this._restoreTabbableFocus );
  10349. },
  10350. _createWrapper: function() {
  10351. this.uiDialog = $( "<div>" )
  10352. .hide()
  10353. .attr( {
  10354. // Setting tabIndex makes the div focusable
  10355. tabIndex: -1,
  10356. role: "dialog"
  10357. } )
  10358. .appendTo( this._appendTo() );
  10359. this._addClass( this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front" );
  10360. this._on( this.uiDialog, {
  10361. keydown: function( event ) {
  10362. if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
  10363. event.keyCode === $.ui.keyCode.ESCAPE ) {
  10364. event.preventDefault();
  10365. this.close( event );
  10366. return;
  10367. }
  10368. // Prevent tabbing out of dialogs
  10369. if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) {
  10370. return;
  10371. }
  10372. var tabbables = this.uiDialog.find( ":tabbable" ),
  10373. first = tabbables.first(),
  10374. last = tabbables.last();
  10375. if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) &&
  10376. !event.shiftKey ) {
  10377. this._delay( function() {
  10378. first.trigger( "focus" );
  10379. } );
  10380. event.preventDefault();
  10381. } else if ( ( event.target === first[ 0 ] ||
  10382. event.target === this.uiDialog[ 0 ] ) && event.shiftKey ) {
  10383. this._delay( function() {
  10384. last.trigger( "focus" );
  10385. } );
  10386. event.preventDefault();
  10387. }
  10388. },
  10389. mousedown: function( event ) {
  10390. if ( this._moveToTop( event ) ) {
  10391. this._focusTabbable();
  10392. }
  10393. }
  10394. } );
  10395. // We assume that any existing aria-describedby attribute means
  10396. // that the dialog content is marked up properly
  10397. // otherwise we brute force the content as the description
  10398. if ( !this.element.find( "[aria-describedby]" ).length ) {
  10399. this.uiDialog.attr( {
  10400. "aria-describedby": this.element.uniqueId().attr( "id" )
  10401. } );
  10402. }
  10403. },
  10404. _createTitlebar: function() {
  10405. var uiDialogTitle;
  10406. this.uiDialogTitlebar = $( "<div>" );
  10407. this._addClass( this.uiDialogTitlebar,
  10408. "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix" );
  10409. this._on( this.uiDialogTitlebar, {
  10410. mousedown: function( event ) {
  10411. // Don't prevent click on close button (#8838)
  10412. // Focusing a dialog that is partially scrolled out of view
  10413. // causes the browser to scroll it into view, preventing the click event
  10414. if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) {
  10415. // Dialog isn't getting focus when dragging (#8063)
  10416. this.uiDialog.trigger( "focus" );
  10417. }
  10418. }
  10419. } );
  10420. // Support: IE
  10421. // Use type="button" to prevent enter keypresses in textboxes from closing the
  10422. // dialog in IE (#9312)
  10423. this.uiDialogTitlebarClose = $( "<button type='button'></button>" )
  10424. .button( {
  10425. label: $( "<a>" ).text( this.options.closeText ).html(),
  10426. icon: "ui-icon-closethick",
  10427. showLabel: false
  10428. } )
  10429. .appendTo( this.uiDialogTitlebar );
  10430. this._addClass( this.uiDialogTitlebarClose, "ui-dialog-titlebar-close" );
  10431. this._on( this.uiDialogTitlebarClose, {
  10432. click: function( event ) {
  10433. event.preventDefault();
  10434. this.close( event );
  10435. }
  10436. } );
  10437. uiDialogTitle = $( "<span>" ).uniqueId().prependTo( this.uiDialogTitlebar );
  10438. this._addClass( uiDialogTitle, "ui-dialog-title" );
  10439. this._title( uiDialogTitle );
  10440. this.uiDialogTitlebar.prependTo( this.uiDialog );
  10441. this.uiDialog.attr( {
  10442. "aria-labelledby": uiDialogTitle.attr( "id" )
  10443. } );
  10444. },
  10445. _title: function( title ) {
  10446. if ( this.options.title ) {
  10447. title.text( this.options.title );
  10448. } else {
  10449. title.html( "&#160;" );
  10450. }
  10451. },
  10452. _createButtonPane: function() {
  10453. this.uiDialogButtonPane = $( "<div>" );
  10454. this._addClass( this.uiDialogButtonPane, "ui-dialog-buttonpane",
  10455. "ui-widget-content ui-helper-clearfix" );
  10456. this.uiButtonSet = $( "<div>" )
  10457. .appendTo( this.uiDialogButtonPane );
  10458. this._addClass( this.uiButtonSet, "ui-dialog-buttonset" );
  10459. this._createButtons();
  10460. },
  10461. _createButtons: function() {
  10462. var that = this,
  10463. buttons = this.options.buttons;
  10464. // If we already have a button pane, remove it
  10465. this.uiDialogButtonPane.remove();
  10466. this.uiButtonSet.empty();
  10467. if ( $.isEmptyObject( buttons ) || ( Array.isArray( buttons ) && !buttons.length ) ) {
  10468. this._removeClass( this.uiDialog, "ui-dialog-buttons" );
  10469. return;
  10470. }
  10471. $.each( buttons, function( name, props ) {
  10472. var click, buttonOptions;
  10473. props = typeof props === "function" ?
  10474. { click: props, text: name } :
  10475. props;
  10476. // Default to a non-submitting button
  10477. props = $.extend( { type: "button" }, props );
  10478. // Change the context for the click callback to be the main element
  10479. click = props.click;
  10480. buttonOptions = {
  10481. icon: props.icon,
  10482. iconPosition: props.iconPosition,
  10483. showLabel: props.showLabel,
  10484. // Deprecated options
  10485. icons: props.icons,
  10486. text: props.text
  10487. };
  10488. delete props.click;
  10489. delete props.icon;
  10490. delete props.iconPosition;
  10491. delete props.showLabel;
  10492. // Deprecated options
  10493. delete props.icons;
  10494. if ( typeof props.text === "boolean" ) {
  10495. delete props.text;
  10496. }
  10497. $( "<button></button>", props )
  10498. .button( buttonOptions )
  10499. .appendTo( that.uiButtonSet )
  10500. .on( "click", function() {
  10501. click.apply( that.element[ 0 ], arguments );
  10502. } );
  10503. } );
  10504. this._addClass( this.uiDialog, "ui-dialog-buttons" );
  10505. this.uiDialogButtonPane.appendTo( this.uiDialog );
  10506. },
  10507. _makeDraggable: function() {
  10508. var that = this,
  10509. options = this.options;
  10510. function filteredUi( ui ) {
  10511. return {
  10512. position: ui.position,
  10513. offset: ui.offset
  10514. };
  10515. }
  10516. this.uiDialog.draggable( {
  10517. cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
  10518. handle: ".ui-dialog-titlebar",
  10519. containment: "document",
  10520. start: function( event, ui ) {
  10521. that._addClass( $( this ), "ui-dialog-dragging" );
  10522. that._blockFrames();
  10523. that._trigger( "dragStart", event, filteredUi( ui ) );
  10524. },
  10525. drag: function( event, ui ) {
  10526. that._trigger( "drag", event, filteredUi( ui ) );
  10527. },
  10528. stop: function( event, ui ) {
  10529. var left = ui.offset.left - that.document.scrollLeft(),
  10530. top = ui.offset.top - that.document.scrollTop();
  10531. options.position = {
  10532. my: "left top",
  10533. at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
  10534. "top" + ( top >= 0 ? "+" : "" ) + top,
  10535. of: that.window
  10536. };
  10537. that._removeClass( $( this ), "ui-dialog-dragging" );
  10538. that._unblockFrames();
  10539. that._trigger( "dragStop", event, filteredUi( ui ) );
  10540. }
  10541. } );
  10542. },
  10543. _makeResizable: function() {
  10544. var that = this,
  10545. options = this.options,
  10546. handles = options.resizable,
  10547. // .ui-resizable has position: relative defined in the stylesheet
  10548. // but dialogs have to use absolute or fixed positioning
  10549. position = this.uiDialog.css( "position" ),
  10550. resizeHandles = typeof handles === "string" ?
  10551. handles :
  10552. "n,e,s,w,se,sw,ne,nw";
  10553. function filteredUi( ui ) {
  10554. return {
  10555. originalPosition: ui.originalPosition,
  10556. originalSize: ui.originalSize,
  10557. position: ui.position,
  10558. size: ui.size
  10559. };
  10560. }
  10561. this.uiDialog.resizable( {
  10562. cancel: ".ui-dialog-content",
  10563. containment: "document",
  10564. alsoResize: this.element,
  10565. maxWidth: options.maxWidth,
  10566. maxHeight: options.maxHeight,
  10567. minWidth: options.minWidth,
  10568. minHeight: this._minHeight(),
  10569. handles: resizeHandles,
  10570. start: function( event, ui ) {
  10571. that._addClass( $( this ), "ui-dialog-resizing" );
  10572. that._blockFrames();
  10573. that._trigger( "resizeStart", event, filteredUi( ui ) );
  10574. },
  10575. resize: function( event, ui ) {
  10576. that._trigger( "resize", event, filteredUi( ui ) );
  10577. },
  10578. stop: function( event, ui ) {
  10579. var offset = that.uiDialog.offset(),
  10580. left = offset.left - that.document.scrollLeft(),
  10581. top = offset.top - that.document.scrollTop();
  10582. options.height = that.uiDialog.height();
  10583. options.width = that.uiDialog.width();
  10584. options.position = {
  10585. my: "left top",
  10586. at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
  10587. "top" + ( top >= 0 ? "+" : "" ) + top,
  10588. of: that.window
  10589. };
  10590. that._removeClass( $( this ), "ui-dialog-resizing" );
  10591. that._unblockFrames();
  10592. that._trigger( "resizeStop", event, filteredUi( ui ) );
  10593. }
  10594. } )
  10595. .css( "position", position );
  10596. },
  10597. _trackFocus: function() {
  10598. this._on( this.widget(), {
  10599. focusin: function( event ) {
  10600. this._makeFocusTarget();
  10601. this._focusedElement = $( event.target );
  10602. }
  10603. } );
  10604. },
  10605. _makeFocusTarget: function() {
  10606. this._untrackInstance();
  10607. this._trackingInstances().unshift( this );
  10608. },
  10609. _untrackInstance: function() {
  10610. var instances = this._trackingInstances(),
  10611. exists = $.inArray( this, instances );
  10612. if ( exists !== -1 ) {
  10613. instances.splice( exists, 1 );
  10614. }
  10615. },
  10616. _trackingInstances: function() {
  10617. var instances = this.document.data( "ui-dialog-instances" );
  10618. if ( !instances ) {
  10619. instances = [];
  10620. this.document.data( "ui-dialog-instances", instances );
  10621. }
  10622. return instances;
  10623. },
  10624. _minHeight: function() {
  10625. var options = this.options;
  10626. return options.height === "auto" ?
  10627. options.minHeight :
  10628. Math.min( options.minHeight, options.height );
  10629. },
  10630. _position: function() {
  10631. // Need to show the dialog to get the actual offset in the position plugin
  10632. var isVisible = this.uiDialog.is( ":visible" );
  10633. if ( !isVisible ) {
  10634. this.uiDialog.show();
  10635. }
  10636. this.uiDialog.position( this.options.position );
  10637. if ( !isVisible ) {
  10638. this.uiDialog.hide();
  10639. }
  10640. },
  10641. _setOptions: function( options ) {
  10642. var that = this,
  10643. resize = false,
  10644. resizableOptions = {};
  10645. $.each( options, function( key, value ) {
  10646. that._setOption( key, value );
  10647. if ( key in that.sizeRelatedOptions ) {
  10648. resize = true;
  10649. }
  10650. if ( key in that.resizableRelatedOptions ) {
  10651. resizableOptions[ key ] = value;
  10652. }
  10653. } );
  10654. if ( resize ) {
  10655. this._size();
  10656. this._position();
  10657. }
  10658. if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
  10659. this.uiDialog.resizable( "option", resizableOptions );
  10660. }
  10661. },
  10662. _setOption: function( key, value ) {
  10663. var isDraggable, isResizable,
  10664. uiDialog = this.uiDialog;
  10665. if ( key === "disabled" ) {
  10666. return;
  10667. }
  10668. this._super( key, value );
  10669. if ( key === "appendTo" ) {
  10670. this.uiDialog.appendTo( this._appendTo() );
  10671. }
  10672. if ( key === "buttons" ) {
  10673. this._createButtons();
  10674. }
  10675. if ( key === "closeText" ) {
  10676. this.uiDialogTitlebarClose.button( {
  10677. // Ensure that we always pass a string
  10678. label: $( "<a>" ).text( "" + this.options.closeText ).html()
  10679. } );
  10680. }
  10681. if ( key === "draggable" ) {
  10682. isDraggable = uiDialog.is( ":data(ui-draggable)" );
  10683. if ( isDraggable && !value ) {
  10684. uiDialog.draggable( "destroy" );
  10685. }
  10686. if ( !isDraggable && value ) {
  10687. this._makeDraggable();
  10688. }
  10689. }
  10690. if ( key === "position" ) {
  10691. this._position();
  10692. }
  10693. if ( key === "resizable" ) {
  10694. // currently resizable, becoming non-resizable
  10695. isResizable = uiDialog.is( ":data(ui-resizable)" );
  10696. if ( isResizable && !value ) {
  10697. uiDialog.resizable( "destroy" );
  10698. }
  10699. // Currently resizable, changing handles
  10700. if ( isResizable && typeof value === "string" ) {
  10701. uiDialog.resizable( "option", "handles", value );
  10702. }
  10703. // Currently non-resizable, becoming resizable
  10704. if ( !isResizable && value !== false ) {
  10705. this._makeResizable();
  10706. }
  10707. }
  10708. if ( key === "title" ) {
  10709. this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) );
  10710. }
  10711. },
  10712. _size: function() {
  10713. // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
  10714. // divs will both have width and height set, so we need to reset them
  10715. var nonContentHeight, minContentHeight, maxContentHeight,
  10716. options = this.options;
  10717. // Reset content sizing
  10718. this.element.show().css( {
  10719. width: "auto",
  10720. minHeight: 0,
  10721. maxHeight: "none",
  10722. height: 0
  10723. } );
  10724. if ( options.minWidth > options.width ) {
  10725. options.width = options.minWidth;
  10726. }
  10727. // Reset wrapper sizing
  10728. // determine the height of all the non-content elements
  10729. nonContentHeight = this.uiDialog.css( {
  10730. height: "auto",
  10731. width: options.width
  10732. } )
  10733. .outerHeight();
  10734. minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
  10735. maxContentHeight = typeof options.maxHeight === "number" ?
  10736. Math.max( 0, options.maxHeight - nonContentHeight ) :
  10737. "none";
  10738. if ( options.height === "auto" ) {
  10739. this.element.css( {
  10740. minHeight: minContentHeight,
  10741. maxHeight: maxContentHeight,
  10742. height: "auto"
  10743. } );
  10744. } else {
  10745. this.element.height( Math.max( 0, options.height - nonContentHeight ) );
  10746. }
  10747. if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
  10748. this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
  10749. }
  10750. },
  10751. _blockFrames: function() {
  10752. this.iframeBlocks = this.document.find( "iframe" ).map( function() {
  10753. var iframe = $( this );
  10754. return $( "<div>" )
  10755. .css( {
  10756. position: "absolute",
  10757. width: iframe.outerWidth(),
  10758. height: iframe.outerHeight()
  10759. } )
  10760. .appendTo( iframe.parent() )
  10761. .offset( iframe.offset() )[ 0 ];
  10762. } );
  10763. },
  10764. _unblockFrames: function() {
  10765. if ( this.iframeBlocks ) {
  10766. this.iframeBlocks.remove();
  10767. delete this.iframeBlocks;
  10768. }
  10769. },
  10770. _allowInteraction: function( event ) {
  10771. if ( $( event.target ).closest( ".ui-dialog" ).length ) {
  10772. return true;
  10773. }
  10774. // TODO: Remove hack when datepicker implements
  10775. // the .ui-front logic (#8989)
  10776. return !!$( event.target ).closest( ".ui-datepicker" ).length;
  10777. },
  10778. _createOverlay: function() {
  10779. if ( !this.options.modal ) {
  10780. return;
  10781. }
  10782. var jqMinor = $.fn.jquery.substring( 0, 4 );
  10783. // We use a delay in case the overlay is created from an
  10784. // event that we're going to be cancelling (#2804)
  10785. var isOpening = true;
  10786. this._delay( function() {
  10787. isOpening = false;
  10788. } );
  10789. if ( !this.document.data( "ui-dialog-overlays" ) ) {
  10790. // Prevent use of anchors and inputs
  10791. // This doesn't use `_on()` because it is a shared event handler
  10792. // across all open modal dialogs.
  10793. this.document.on( "focusin.ui-dialog", function( event ) {
  10794. if ( isOpening ) {
  10795. return;
  10796. }
  10797. var instance = this._trackingInstances()[ 0 ];
  10798. if ( !instance._allowInteraction( event ) ) {
  10799. event.preventDefault();
  10800. instance._focusTabbable();
  10801. // Support: jQuery >=3.4 <3.6 only
  10802. // Focus re-triggering in jQuery 3.4/3.5 makes the original element
  10803. // have its focus event propagated last, breaking the re-targeting.
  10804. // Trigger focus in a delay in addition if needed to avoid the issue
  10805. // See https://github.com/jquery/jquery/issues/4382
  10806. if ( jqMinor === "3.4." || jqMinor === "3.5." ) {
  10807. instance._delay( instance._restoreTabbableFocus );
  10808. }
  10809. }
  10810. }.bind( this ) );
  10811. }
  10812. this.overlay = $( "<div>" )
  10813. .appendTo( this._appendTo() );
  10814. this._addClass( this.overlay, null, "ui-widget-overlay ui-front" );
  10815. this._on( this.overlay, {
  10816. mousedown: "_keepFocus"
  10817. } );
  10818. this.document.data( "ui-dialog-overlays",
  10819. ( this.document.data( "ui-dialog-overlays" ) || 0 ) + 1 );
  10820. },
  10821. _destroyOverlay: function() {
  10822. if ( !this.options.modal ) {
  10823. return;
  10824. }
  10825. if ( this.overlay ) {
  10826. var overlays = this.document.data( "ui-dialog-overlays" ) - 1;
  10827. if ( !overlays ) {
  10828. this.document.off( "focusin.ui-dialog" );
  10829. this.document.removeData( "ui-dialog-overlays" );
  10830. } else {
  10831. this.document.data( "ui-dialog-overlays", overlays );
  10832. }
  10833. this.overlay.remove();
  10834. this.overlay = null;
  10835. }
  10836. }
  10837. } );
  10838. // DEPRECATED
  10839. // TODO: switch return back to widget declaration at top of file when this is removed
  10840. if ( $.uiBackCompat !== false ) {
  10841. // Backcompat for dialogClass option
  10842. $.widget( "ui.dialog", $.ui.dialog, {
  10843. options: {
  10844. dialogClass: ""
  10845. },
  10846. _createWrapper: function() {
  10847. this._super();
  10848. this.uiDialog.addClass( this.options.dialogClass );
  10849. },
  10850. _setOption: function( key, value ) {
  10851. if ( key === "dialogClass" ) {
  10852. this.uiDialog
  10853. .removeClass( this.options.dialogClass )
  10854. .addClass( value );
  10855. }
  10856. this._superApply( arguments );
  10857. }
  10858. } );
  10859. }
  10860. var widgetsDialog = $.ui.dialog;
  10861. /*!
  10862. * jQuery UI Progressbar 1.13.2
  10863. * http://jqueryui.com
  10864. *
  10865. * Copyright jQuery Foundation and other contributors
  10866. * Released under the MIT license.
  10867. * http://jquery.org/license
  10868. */
  10869. //>>label: Progressbar
  10870. //>>group: Widgets
  10871. /* eslint-disable max-len */
  10872. //>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators.
  10873. /* eslint-enable max-len */
  10874. //>>docs: http://api.jqueryui.com/progressbar/
  10875. //>>demos: http://jqueryui.com/progressbar/
  10876. //>>css.structure: ../../themes/base/core.css
  10877. //>>css.structure: ../../themes/base/progressbar.css
  10878. //>>css.theme: ../../themes/base/theme.css
  10879. var widgetsProgressbar = $.widget( "ui.progressbar", {
  10880. version: "1.13.2",
  10881. options: {
  10882. classes: {
  10883. "ui-progressbar": "ui-corner-all",
  10884. "ui-progressbar-value": "ui-corner-left",
  10885. "ui-progressbar-complete": "ui-corner-right"
  10886. },
  10887. max: 100,
  10888. value: 0,
  10889. change: null,
  10890. complete: null
  10891. },
  10892. min: 0,
  10893. _create: function() {
  10894. // Constrain initial value
  10895. this.oldValue = this.options.value = this._constrainedValue();
  10896. this.element.attr( {
  10897. // Only set static values; aria-valuenow and aria-valuemax are
  10898. // set inside _refreshValue()
  10899. role: "progressbar",
  10900. "aria-valuemin": this.min
  10901. } );
  10902. this._addClass( "ui-progressbar", "ui-widget ui-widget-content" );
  10903. this.valueDiv = $( "<div>" ).appendTo( this.element );
  10904. this._addClass( this.valueDiv, "ui-progressbar-value", "ui-widget-header" );
  10905. this._refreshValue();
  10906. },
  10907. _destroy: function() {
  10908. this.element.removeAttr( "role aria-valuemin aria-valuemax aria-valuenow" );
  10909. this.valueDiv.remove();
  10910. },
  10911. value: function( newValue ) {
  10912. if ( newValue === undefined ) {
  10913. return this.options.value;
  10914. }
  10915. this.options.value = this._constrainedValue( newValue );
  10916. this._refreshValue();
  10917. },
  10918. _constrainedValue: function( newValue ) {
  10919. if ( newValue === undefined ) {
  10920. newValue = this.options.value;
  10921. }
  10922. this.indeterminate = newValue === false;
  10923. // Sanitize value
  10924. if ( typeof newValue !== "number" ) {
  10925. newValue = 0;
  10926. }
  10927. return this.indeterminate ? false :
  10928. Math.min( this.options.max, Math.max( this.min, newValue ) );
  10929. },
  10930. _setOptions: function( options ) {
  10931. // Ensure "value" option is set after other values (like max)
  10932. var value = options.value;
  10933. delete options.value;
  10934. this._super( options );
  10935. this.options.value = this._constrainedValue( value );
  10936. this._refreshValue();
  10937. },
  10938. _setOption: function( key, value ) {
  10939. if ( key === "max" ) {
  10940. // Don't allow a max less than min
  10941. value = Math.max( this.min, value );
  10942. }
  10943. this._super( key, value );
  10944. },
  10945. _setOptionDisabled: function( value ) {
  10946. this._super( value );
  10947. this.element.attr( "aria-disabled", value );
  10948. this._toggleClass( null, "ui-state-disabled", !!value );
  10949. },
  10950. _percentage: function() {
  10951. return this.indeterminate ?
  10952. 100 :
  10953. 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
  10954. },
  10955. _refreshValue: function() {
  10956. var value = this.options.value,
  10957. percentage = this._percentage();
  10958. this.valueDiv
  10959. .toggle( this.indeterminate || value > this.min )
  10960. .width( percentage.toFixed( 0 ) + "%" );
  10961. this
  10962. ._toggleClass( this.valueDiv, "ui-progressbar-complete", null,
  10963. value === this.options.max )
  10964. ._toggleClass( "ui-progressbar-indeterminate", null, this.indeterminate );
  10965. if ( this.indeterminate ) {
  10966. this.element.removeAttr( "aria-valuenow" );
  10967. if ( !this.overlayDiv ) {
  10968. this.overlayDiv = $( "<div>" ).appendTo( this.valueDiv );
  10969. this._addClass( this.overlayDiv, "ui-progressbar-overlay" );
  10970. }
  10971. } else {
  10972. this.element.attr( {
  10973. "aria-valuemax": this.options.max,
  10974. "aria-valuenow": value
  10975. } );
  10976. if ( this.overlayDiv ) {
  10977. this.overlayDiv.remove();
  10978. this.overlayDiv = null;
  10979. }
  10980. }
  10981. if ( this.oldValue !== value ) {
  10982. this.oldValue = value;
  10983. this._trigger( "change" );
  10984. }
  10985. if ( value === this.options.max ) {
  10986. this._trigger( "complete" );
  10987. }
  10988. }
  10989. } );
  10990. /*!
  10991. * jQuery UI Selectmenu 1.13.2
  10992. * http://jqueryui.com
  10993. *
  10994. * Copyright jQuery Foundation and other contributors
  10995. * Released under the MIT license.
  10996. * http://jquery.org/license
  10997. */
  10998. //>>label: Selectmenu
  10999. //>>group: Widgets
  11000. /* eslint-disable max-len */
  11001. //>>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.
  11002. /* eslint-enable max-len */
  11003. //>>docs: http://api.jqueryui.com/selectmenu/
  11004. //>>demos: http://jqueryui.com/selectmenu/
  11005. //>>css.structure: ../../themes/base/core.css
  11006. //>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css
  11007. //>>css.theme: ../../themes/base/theme.css
  11008. var widgetsSelectmenu = $.widget( "ui.selectmenu", [ $.ui.formResetMixin, {
  11009. version: "1.13.2",
  11010. defaultElement: "<select>",
  11011. options: {
  11012. appendTo: null,
  11013. classes: {
  11014. "ui-selectmenu-button-open": "ui-corner-top",
  11015. "ui-selectmenu-button-closed": "ui-corner-all"
  11016. },
  11017. disabled: null,
  11018. icons: {
  11019. button: "ui-icon-triangle-1-s"
  11020. },
  11021. position: {
  11022. my: "left top",
  11023. at: "left bottom",
  11024. collision: "none"
  11025. },
  11026. width: false,
  11027. // Callbacks
  11028. change: null,
  11029. close: null,
  11030. focus: null,
  11031. open: null,
  11032. select: null
  11033. },
  11034. _create: function() {
  11035. var selectmenuId = this.element.uniqueId().attr( "id" );
  11036. this.ids = {
  11037. element: selectmenuId,
  11038. button: selectmenuId + "-button",
  11039. menu: selectmenuId + "-menu"
  11040. };
  11041. this._drawButton();
  11042. this._drawMenu();
  11043. this._bindFormResetHandler();
  11044. this._rendered = false;
  11045. this.menuItems = $();
  11046. },
  11047. _drawButton: function() {
  11048. var icon,
  11049. that = this,
  11050. item = this._parseOption(
  11051. this.element.find( "option:selected" ),
  11052. this.element[ 0 ].selectedIndex
  11053. );
  11054. // Associate existing label with the new button
  11055. this.labels = this.element.labels().attr( "for", this.ids.button );
  11056. this._on( this.labels, {
  11057. click: function( event ) {
  11058. this.button.trigger( "focus" );
  11059. event.preventDefault();
  11060. }
  11061. } );
  11062. // Hide original select element
  11063. this.element.hide();
  11064. // Create button
  11065. this.button = $( "<span>", {
  11066. tabindex: this.options.disabled ? -1 : 0,
  11067. id: this.ids.button,
  11068. role: "combobox",
  11069. "aria-expanded": "false",
  11070. "aria-autocomplete": "list",
  11071. "aria-owns": this.ids.menu,
  11072. "aria-haspopup": "true",
  11073. title: this.element.attr( "title" )
  11074. } )
  11075. .insertAfter( this.element );
  11076. this._addClass( this.button, "ui-selectmenu-button ui-selectmenu-button-closed",
  11077. "ui-button ui-widget" );
  11078. icon = $( "<span>" ).appendTo( this.button );
  11079. this._addClass( icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button );
  11080. this.buttonItem = this._renderButtonItem( item )
  11081. .appendTo( this.button );
  11082. if ( this.options.width !== false ) {
  11083. this._resizeButton();
  11084. }
  11085. this._on( this.button, this._buttonEvents );
  11086. this.button.one( "focusin", function() {
  11087. // Delay rendering the menu items until the button receives focus.
  11088. // The menu may have already been rendered via a programmatic open.
  11089. if ( !that._rendered ) {
  11090. that._refreshMenu();
  11091. }
  11092. } );
  11093. },
  11094. _drawMenu: function() {
  11095. var that = this;
  11096. // Create menu
  11097. this.menu = $( "<ul>", {
  11098. "aria-hidden": "true",
  11099. "aria-labelledby": this.ids.button,
  11100. id: this.ids.menu
  11101. } );
  11102. // Wrap menu
  11103. this.menuWrap = $( "<div>" ).append( this.menu );
  11104. this._addClass( this.menuWrap, "ui-selectmenu-menu", "ui-front" );
  11105. this.menuWrap.appendTo( this._appendTo() );
  11106. // Initialize menu widget
  11107. this.menuInstance = this.menu
  11108. .menu( {
  11109. classes: {
  11110. "ui-menu": "ui-corner-bottom"
  11111. },
  11112. role: "listbox",
  11113. select: function( event, ui ) {
  11114. event.preventDefault();
  11115. // Support: IE8
  11116. // If the item was selected via a click, the text selection
  11117. // will be destroyed in IE
  11118. that._setSelection();
  11119. that._select( ui.item.data( "ui-selectmenu-item" ), event );
  11120. },
  11121. focus: function( event, ui ) {
  11122. var item = ui.item.data( "ui-selectmenu-item" );
  11123. // Prevent inital focus from firing and check if its a newly focused item
  11124. if ( that.focusIndex != null && item.index !== that.focusIndex ) {
  11125. that._trigger( "focus", event, { item: item } );
  11126. if ( !that.isOpen ) {
  11127. that._select( item, event );
  11128. }
  11129. }
  11130. that.focusIndex = item.index;
  11131. that.button.attr( "aria-activedescendant",
  11132. that.menuItems.eq( item.index ).attr( "id" ) );
  11133. }
  11134. } )
  11135. .menu( "instance" );
  11136. // Don't close the menu on mouseleave
  11137. this.menuInstance._off( this.menu, "mouseleave" );
  11138. // Cancel the menu's collapseAll on document click
  11139. this.menuInstance._closeOnDocumentClick = function() {
  11140. return false;
  11141. };
  11142. // Selects often contain empty items, but never contain dividers
  11143. this.menuInstance._isDivider = function() {
  11144. return false;
  11145. };
  11146. },
  11147. refresh: function() {
  11148. this._refreshMenu();
  11149. this.buttonItem.replaceWith(
  11150. this.buttonItem = this._renderButtonItem(
  11151. // Fall back to an empty object in case there are no options
  11152. this._getSelectedItem().data( "ui-selectmenu-item" ) || {}
  11153. )
  11154. );
  11155. if ( this.options.width === null ) {
  11156. this._resizeButton();
  11157. }
  11158. },
  11159. _refreshMenu: function() {
  11160. var item,
  11161. options = this.element.find( "option" );
  11162. this.menu.empty();
  11163. this._parseOptions( options );
  11164. this._renderMenu( this.menu, this.items );
  11165. this.menuInstance.refresh();
  11166. this.menuItems = this.menu.find( "li" )
  11167. .not( ".ui-selectmenu-optgroup" )
  11168. .find( ".ui-menu-item-wrapper" );
  11169. this._rendered = true;
  11170. if ( !options.length ) {
  11171. return;
  11172. }
  11173. item = this._getSelectedItem();
  11174. // Update the menu to have the correct item focused
  11175. this.menuInstance.focus( null, item );
  11176. this._setAria( item.data( "ui-selectmenu-item" ) );
  11177. // Set disabled state
  11178. this._setOption( "disabled", this.element.prop( "disabled" ) );
  11179. },
  11180. open: function( event ) {
  11181. if ( this.options.disabled ) {
  11182. return;
  11183. }
  11184. // If this is the first time the menu is being opened, render the items
  11185. if ( !this._rendered ) {
  11186. this._refreshMenu();
  11187. } else {
  11188. // Menu clears focus on close, reset focus to selected item
  11189. this._removeClass( this.menu.find( ".ui-state-active" ), null, "ui-state-active" );
  11190. this.menuInstance.focus( null, this._getSelectedItem() );
  11191. }
  11192. // If there are no options, don't open the menu
  11193. if ( !this.menuItems.length ) {
  11194. return;
  11195. }
  11196. this.isOpen = true;
  11197. this._toggleAttr();
  11198. this._resizeMenu();
  11199. this._position();
  11200. this._on( this.document, this._documentClick );
  11201. this._trigger( "open", event );
  11202. },
  11203. _position: function() {
  11204. this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
  11205. },
  11206. close: function( event ) {
  11207. if ( !this.isOpen ) {
  11208. return;
  11209. }
  11210. this.isOpen = false;
  11211. this._toggleAttr();
  11212. this.range = null;
  11213. this._off( this.document );
  11214. this._trigger( "close", event );
  11215. },
  11216. widget: function() {
  11217. return this.button;
  11218. },
  11219. menuWidget: function() {
  11220. return this.menu;
  11221. },
  11222. _renderButtonItem: function( item ) {
  11223. var buttonItem = $( "<span>" );
  11224. this._setText( buttonItem, item.label );
  11225. this._addClass( buttonItem, "ui-selectmenu-text" );
  11226. return buttonItem;
  11227. },
  11228. _renderMenu: function( ul, items ) {
  11229. var that = this,
  11230. currentOptgroup = "";
  11231. $.each( items, function( index, item ) {
  11232. var li;
  11233. if ( item.optgroup !== currentOptgroup ) {
  11234. li = $( "<li>", {
  11235. text: item.optgroup
  11236. } );
  11237. that._addClass( li, "ui-selectmenu-optgroup", "ui-menu-divider" +
  11238. ( item.element.parent( "optgroup" ).prop( "disabled" ) ?
  11239. " ui-state-disabled" :
  11240. "" ) );
  11241. li.appendTo( ul );
  11242. currentOptgroup = item.optgroup;
  11243. }
  11244. that._renderItemData( ul, item );
  11245. } );
  11246. },
  11247. _renderItemData: function( ul, item ) {
  11248. return this._renderItem( ul, item ).data( "ui-selectmenu-item", item );
  11249. },
  11250. _renderItem: function( ul, item ) {
  11251. var li = $( "<li>" ),
  11252. wrapper = $( "<div>", {
  11253. title: item.element.attr( "title" )
  11254. } );
  11255. if ( item.disabled ) {
  11256. this._addClass( li, null, "ui-state-disabled" );
  11257. }
  11258. this._setText( wrapper, item.label );
  11259. return li.append( wrapper ).appendTo( ul );
  11260. },
  11261. _setText: function( element, value ) {
  11262. if ( value ) {
  11263. element.text( value );
  11264. } else {
  11265. element.html( "&#160;" );
  11266. }
  11267. },
  11268. _move: function( direction, event ) {
  11269. var item, next,
  11270. filter = ".ui-menu-item";
  11271. if ( this.isOpen ) {
  11272. item = this.menuItems.eq( this.focusIndex ).parent( "li" );
  11273. } else {
  11274. item = this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );
  11275. filter += ":not(.ui-state-disabled)";
  11276. }
  11277. if ( direction === "first" || direction === "last" ) {
  11278. next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 );
  11279. } else {
  11280. next = item[ direction + "All" ]( filter ).eq( 0 );
  11281. }
  11282. if ( next.length ) {
  11283. this.menuInstance.focus( event, next );
  11284. }
  11285. },
  11286. _getSelectedItem: function() {
  11287. return this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );
  11288. },
  11289. _toggle: function( event ) {
  11290. this[ this.isOpen ? "close" : "open" ]( event );
  11291. },
  11292. _setSelection: function() {
  11293. var selection;
  11294. if ( !this.range ) {
  11295. return;
  11296. }
  11297. if ( window.getSelection ) {
  11298. selection = window.getSelection();
  11299. selection.removeAllRanges();
  11300. selection.addRange( this.range );
  11301. // Support: IE8
  11302. } else {
  11303. this.range.select();
  11304. }
  11305. // Support: IE
  11306. // Setting the text selection kills the button focus in IE, but
  11307. // restoring the focus doesn't kill the selection.
  11308. this.button.trigger( "focus" );
  11309. },
  11310. _documentClick: {
  11311. mousedown: function( event ) {
  11312. if ( !this.isOpen ) {
  11313. return;
  11314. }
  11315. if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" +
  11316. $.escapeSelector( this.ids.button ) ).length ) {
  11317. this.close( event );
  11318. }
  11319. }
  11320. },
  11321. _buttonEvents: {
  11322. // Prevent text selection from being reset when interacting with the selectmenu (#10144)
  11323. mousedown: function() {
  11324. var selection;
  11325. if ( window.getSelection ) {
  11326. selection = window.getSelection();
  11327. if ( selection.rangeCount ) {
  11328. this.range = selection.getRangeAt( 0 );
  11329. }
  11330. // Support: IE8
  11331. } else {
  11332. this.range = document.selection.createRange();
  11333. }
  11334. },
  11335. click: function( event ) {
  11336. this._setSelection();
  11337. this._toggle( event );
  11338. },
  11339. keydown: function( event ) {
  11340. var preventDefault = true;
  11341. switch ( event.keyCode ) {
  11342. case $.ui.keyCode.TAB:
  11343. case $.ui.keyCode.ESCAPE:
  11344. this.close( event );
  11345. preventDefault = false;
  11346. break;
  11347. case $.ui.keyCode.ENTER:
  11348. if ( this.isOpen ) {
  11349. this._selectFocusedItem( event );
  11350. }
  11351. break;
  11352. case $.ui.keyCode.UP:
  11353. if ( event.altKey ) {
  11354. this._toggle( event );
  11355. } else {
  11356. this._move( "prev", event );
  11357. }
  11358. break;
  11359. case $.ui.keyCode.DOWN:
  11360. if ( event.altKey ) {
  11361. this._toggle( event );
  11362. } else {
  11363. this._move( "next", event );
  11364. }
  11365. break;
  11366. case $.ui.keyCode.SPACE:
  11367. if ( this.isOpen ) {
  11368. this._selectFocusedItem( event );
  11369. } else {
  11370. this._toggle( event );
  11371. }
  11372. break;
  11373. case $.ui.keyCode.LEFT:
  11374. this._move( "prev", event );
  11375. break;
  11376. case $.ui.keyCode.RIGHT:
  11377. this._move( "next", event );
  11378. break;
  11379. case $.ui.keyCode.HOME:
  11380. case $.ui.keyCode.PAGE_UP:
  11381. this._move( "first", event );
  11382. break;
  11383. case $.ui.keyCode.END:
  11384. case $.ui.keyCode.PAGE_DOWN:
  11385. this._move( "last", event );
  11386. break;
  11387. default:
  11388. this.menu.trigger( event );
  11389. preventDefault = false;
  11390. }
  11391. if ( preventDefault ) {
  11392. event.preventDefault();
  11393. }
  11394. }
  11395. },
  11396. _selectFocusedItem: function( event ) {
  11397. var item = this.menuItems.eq( this.focusIndex ).parent( "li" );
  11398. if ( !item.hasClass( "ui-state-disabled" ) ) {
  11399. this._select( item.data( "ui-selectmenu-item" ), event );
  11400. }
  11401. },
  11402. _select: function( item, event ) {
  11403. var oldIndex = this.element[ 0 ].selectedIndex;
  11404. // Change native select element
  11405. this.element[ 0 ].selectedIndex = item.index;
  11406. this.buttonItem.replaceWith( this.buttonItem = this._renderButtonItem( item ) );
  11407. this._setAria( item );
  11408. this._trigger( "select", event, { item: item } );
  11409. if ( item.index !== oldIndex ) {
  11410. this._trigger( "change", event, { item: item } );
  11411. }
  11412. this.close( event );
  11413. },
  11414. _setAria: function( item ) {
  11415. var id = this.menuItems.eq( item.index ).attr( "id" );
  11416. this.button.attr( {
  11417. "aria-labelledby": id,
  11418. "aria-activedescendant": id
  11419. } );
  11420. this.menu.attr( "aria-activedescendant", id );
  11421. },
  11422. _setOption: function( key, value ) {
  11423. if ( key === "icons" ) {
  11424. var icon = this.button.find( "span.ui-icon" );
  11425. this._removeClass( icon, null, this.options.icons.button )
  11426. ._addClass( icon, null, value.button );
  11427. }
  11428. this._super( key, value );
  11429. if ( key === "appendTo" ) {
  11430. this.menuWrap.appendTo( this._appendTo() );
  11431. }
  11432. if ( key === "width" ) {
  11433. this._resizeButton();
  11434. }
  11435. },
  11436. _setOptionDisabled: function( value ) {
  11437. this._super( value );
  11438. this.menuInstance.option( "disabled", value );
  11439. this.button.attr( "aria-disabled", value );
  11440. this._toggleClass( this.button, null, "ui-state-disabled", value );
  11441. this.element.prop( "disabled", value );
  11442. if ( value ) {
  11443. this.button.attr( "tabindex", -1 );
  11444. this.close();
  11445. } else {
  11446. this.button.attr( "tabindex", 0 );
  11447. }
  11448. },
  11449. _appendTo: function() {
  11450. var element = this.options.appendTo;
  11451. if ( element ) {
  11452. element = element.jquery || element.nodeType ?
  11453. $( element ) :
  11454. this.document.find( element ).eq( 0 );
  11455. }
  11456. if ( !element || !element[ 0 ] ) {
  11457. element = this.element.closest( ".ui-front, dialog" );
  11458. }
  11459. if ( !element.length ) {
  11460. element = this.document[ 0 ].body;
  11461. }
  11462. return element;
  11463. },
  11464. _toggleAttr: function() {
  11465. this.button.attr( "aria-expanded", this.isOpen );
  11466. // We can't use two _toggleClass() calls here, because we need to make sure
  11467. // we always remove classes first and add them second, otherwise if both classes have the
  11468. // same theme class, it will be removed after we add it.
  11469. this._removeClass( this.button, "ui-selectmenu-button-" +
  11470. ( this.isOpen ? "closed" : "open" ) )
  11471. ._addClass( this.button, "ui-selectmenu-button-" +
  11472. ( this.isOpen ? "open" : "closed" ) )
  11473. ._toggleClass( this.menuWrap, "ui-selectmenu-open", null, this.isOpen );
  11474. this.menu.attr( "aria-hidden", !this.isOpen );
  11475. },
  11476. _resizeButton: function() {
  11477. var width = this.options.width;
  11478. // For `width: false`, just remove inline style and stop
  11479. if ( width === false ) {
  11480. this.button.css( "width", "" );
  11481. return;
  11482. }
  11483. // For `width: null`, match the width of the original element
  11484. if ( width === null ) {
  11485. width = this.element.show().outerWidth();
  11486. this.element.hide();
  11487. }
  11488. this.button.outerWidth( width );
  11489. },
  11490. _resizeMenu: function() {
  11491. this.menu.outerWidth( Math.max(
  11492. this.button.outerWidth(),
  11493. // Support: IE10
  11494. // IE10 wraps long text (possibly a rounding bug)
  11495. // so we add 1px to avoid the wrapping
  11496. this.menu.width( "" ).outerWidth() + 1
  11497. ) );
  11498. },
  11499. _getCreateOptions: function() {
  11500. var options = this._super();
  11501. options.disabled = this.element.prop( "disabled" );
  11502. return options;
  11503. },
  11504. _parseOptions: function( options ) {
  11505. var that = this,
  11506. data = [];
  11507. options.each( function( index, item ) {
  11508. if ( item.hidden ) {
  11509. return;
  11510. }
  11511. data.push( that._parseOption( $( item ), index ) );
  11512. } );
  11513. this.items = data;
  11514. },
  11515. _parseOption: function( option, index ) {
  11516. var optgroup = option.parent( "optgroup" );
  11517. return {
  11518. element: option,
  11519. index: index,
  11520. value: option.val(),
  11521. label: option.text(),
  11522. optgroup: optgroup.attr( "label" ) || "",
  11523. disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" )
  11524. };
  11525. },
  11526. _destroy: function() {
  11527. this._unbindFormResetHandler();
  11528. this.menuWrap.remove();
  11529. this.button.remove();
  11530. this.element.show();
  11531. this.element.removeUniqueId();
  11532. this.labels.attr( "for", this.ids.element );
  11533. }
  11534. } ] );
  11535. /*!
  11536. * jQuery UI Slider 1.13.2
  11537. * http://jqueryui.com
  11538. *
  11539. * Copyright jQuery Foundation and other contributors
  11540. * Released under the MIT license.
  11541. * http://jquery.org/license
  11542. */
  11543. //>>label: Slider
  11544. //>>group: Widgets
  11545. //>>description: Displays a flexible slider with ranges and accessibility via keyboard.
  11546. //>>docs: http://api.jqueryui.com/slider/
  11547. //>>demos: http://jqueryui.com/slider/
  11548. //>>css.structure: ../../themes/base/core.css
  11549. //>>css.structure: ../../themes/base/slider.css
  11550. //>>css.theme: ../../themes/base/theme.css
  11551. var widgetsSlider = $.widget( "ui.slider", $.ui.mouse, {
  11552. version: "1.13.2",
  11553. widgetEventPrefix: "slide",
  11554. options: {
  11555. animate: false,
  11556. classes: {
  11557. "ui-slider": "ui-corner-all",
  11558. "ui-slider-handle": "ui-corner-all",
  11559. // Note: ui-widget-header isn't the most fittingly semantic framework class for this
  11560. // element, but worked best visually with a variety of themes
  11561. "ui-slider-range": "ui-corner-all ui-widget-header"
  11562. },
  11563. distance: 0,
  11564. max: 100,
  11565. min: 0,
  11566. orientation: "horizontal",
  11567. range: false,
  11568. step: 1,
  11569. value: 0,
  11570. values: null,
  11571. // Callbacks
  11572. change: null,
  11573. slide: null,
  11574. start: null,
  11575. stop: null
  11576. },
  11577. // Number of pages in a slider
  11578. // (how many times can you page up/down to go through the whole range)
  11579. numPages: 5,
  11580. _create: function() {
  11581. this._keySliding = false;
  11582. this._mouseSliding = false;
  11583. this._animateOff = true;
  11584. this._handleIndex = null;
  11585. this._detectOrientation();
  11586. this._mouseInit();
  11587. this._calculateNewMax();
  11588. this._addClass( "ui-slider ui-slider-" + this.orientation,
  11589. "ui-widget ui-widget-content" );
  11590. this._refresh();
  11591. this._animateOff = false;
  11592. },
  11593. _refresh: function() {
  11594. this._createRange();
  11595. this._createHandles();
  11596. this._setupEvents();
  11597. this._refreshValue();
  11598. },
  11599. _createHandles: function() {
  11600. var i, handleCount,
  11601. options = this.options,
  11602. existingHandles = this.element.find( ".ui-slider-handle" ),
  11603. handle = "<span tabindex='0'></span>",
  11604. handles = [];
  11605. handleCount = ( options.values && options.values.length ) || 1;
  11606. if ( existingHandles.length > handleCount ) {
  11607. existingHandles.slice( handleCount ).remove();
  11608. existingHandles = existingHandles.slice( 0, handleCount );
  11609. }
  11610. for ( i = existingHandles.length; i < handleCount; i++ ) {
  11611. handles.push( handle );
  11612. }
  11613. this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
  11614. this._addClass( this.handles, "ui-slider-handle", "ui-state-default" );
  11615. this.handle = this.handles.eq( 0 );
  11616. this.handles.each( function( i ) {
  11617. $( this )
  11618. .data( "ui-slider-handle-index", i )
  11619. .attr( "tabIndex", 0 );
  11620. } );
  11621. },
  11622. _createRange: function() {
  11623. var options = this.options;
  11624. if ( options.range ) {
  11625. if ( options.range === true ) {
  11626. if ( !options.values ) {
  11627. options.values = [ this._valueMin(), this._valueMin() ];
  11628. } else if ( options.values.length && options.values.length !== 2 ) {
  11629. options.values = [ options.values[ 0 ], options.values[ 0 ] ];
  11630. } else if ( Array.isArray( options.values ) ) {
  11631. options.values = options.values.slice( 0 );
  11632. }
  11633. }
  11634. if ( !this.range || !this.range.length ) {
  11635. this.range = $( "<div>" )
  11636. .appendTo( this.element );
  11637. this._addClass( this.range, "ui-slider-range" );
  11638. } else {
  11639. this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" );
  11640. // Handle range switching from true to min/max
  11641. this.range.css( {
  11642. "left": "",
  11643. "bottom": ""
  11644. } );
  11645. }
  11646. if ( options.range === "min" || options.range === "max" ) {
  11647. this._addClass( this.range, "ui-slider-range-" + options.range );
  11648. }
  11649. } else {
  11650. if ( this.range ) {
  11651. this.range.remove();
  11652. }
  11653. this.range = null;
  11654. }
  11655. },
  11656. _setupEvents: function() {
  11657. this._off( this.handles );
  11658. this._on( this.handles, this._handleEvents );
  11659. this._hoverable( this.handles );
  11660. this._focusable( this.handles );
  11661. },
  11662. _destroy: function() {
  11663. this.handles.remove();
  11664. if ( this.range ) {
  11665. this.range.remove();
  11666. }
  11667. this._mouseDestroy();
  11668. },
  11669. _mouseCapture: function( event ) {
  11670. var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
  11671. that = this,
  11672. o = this.options;
  11673. if ( o.disabled ) {
  11674. return false;
  11675. }
  11676. this.elementSize = {
  11677. width: this.element.outerWidth(),
  11678. height: this.element.outerHeight()
  11679. };
  11680. this.elementOffset = this.element.offset();
  11681. position = { x: event.pageX, y: event.pageY };
  11682. normValue = this._normValueFromMouse( position );
  11683. distance = this._valueMax() - this._valueMin() + 1;
  11684. this.handles.each( function( i ) {
  11685. var thisDistance = Math.abs( normValue - that.values( i ) );
  11686. if ( ( distance > thisDistance ) ||
  11687. ( distance === thisDistance &&
  11688. ( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) {
  11689. distance = thisDistance;
  11690. closestHandle = $( this );
  11691. index = i;
  11692. }
  11693. } );
  11694. allowed = this._start( event, index );
  11695. if ( allowed === false ) {
  11696. return false;
  11697. }
  11698. this._mouseSliding = true;
  11699. this._handleIndex = index;
  11700. this._addClass( closestHandle, null, "ui-state-active" );
  11701. closestHandle.trigger( "focus" );
  11702. offset = closestHandle.offset();
  11703. mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
  11704. this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
  11705. left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
  11706. top: event.pageY - offset.top -
  11707. ( closestHandle.height() / 2 ) -
  11708. ( parseInt( closestHandle.css( "borderTopWidth" ), 10 ) || 0 ) -
  11709. ( parseInt( closestHandle.css( "borderBottomWidth" ), 10 ) || 0 ) +
  11710. ( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 )
  11711. };
  11712. if ( !this.handles.hasClass( "ui-state-hover" ) ) {
  11713. this._slide( event, index, normValue );
  11714. }
  11715. this._animateOff = true;
  11716. return true;
  11717. },
  11718. _mouseStart: function() {
  11719. return true;
  11720. },
  11721. _mouseDrag: function( event ) {
  11722. var position = { x: event.pageX, y: event.pageY },
  11723. normValue = this._normValueFromMouse( position );
  11724. this._slide( event, this._handleIndex, normValue );
  11725. return false;
  11726. },
  11727. _mouseStop: function( event ) {
  11728. this._removeClass( this.handles, null, "ui-state-active" );
  11729. this._mouseSliding = false;
  11730. this._stop( event, this._handleIndex );
  11731. this._change( event, this._handleIndex );
  11732. this._handleIndex = null;
  11733. this._clickOffset = null;
  11734. this._animateOff = false;
  11735. return false;
  11736. },
  11737. _detectOrientation: function() {
  11738. this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
  11739. },
  11740. _normValueFromMouse: function( position ) {
  11741. var pixelTotal,
  11742. pixelMouse,
  11743. percentMouse,
  11744. valueTotal,
  11745. valueMouse;
  11746. if ( this.orientation === "horizontal" ) {
  11747. pixelTotal = this.elementSize.width;
  11748. pixelMouse = position.x - this.elementOffset.left -
  11749. ( this._clickOffset ? this._clickOffset.left : 0 );
  11750. } else {
  11751. pixelTotal = this.elementSize.height;
  11752. pixelMouse = position.y - this.elementOffset.top -
  11753. ( this._clickOffset ? this._clickOffset.top : 0 );
  11754. }
  11755. percentMouse = ( pixelMouse / pixelTotal );
  11756. if ( percentMouse > 1 ) {
  11757. percentMouse = 1;
  11758. }
  11759. if ( percentMouse < 0 ) {
  11760. percentMouse = 0;
  11761. }
  11762. if ( this.orientation === "vertical" ) {
  11763. percentMouse = 1 - percentMouse;
  11764. }
  11765. valueTotal = this._valueMax() - this._valueMin();
  11766. valueMouse = this._valueMin() + percentMouse * valueTotal;
  11767. return this._trimAlignValue( valueMouse );
  11768. },
  11769. _uiHash: function( index, value, values ) {
  11770. var uiHash = {
  11771. handle: this.handles[ index ],
  11772. handleIndex: index,
  11773. value: value !== undefined ? value : this.value()
  11774. };
  11775. if ( this._hasMultipleValues() ) {
  11776. uiHash.value = value !== undefined ? value : this.values( index );
  11777. uiHash.values = values || this.values();
  11778. }
  11779. return uiHash;
  11780. },
  11781. _hasMultipleValues: function() {
  11782. return this.options.values && this.options.values.length;
  11783. },
  11784. _start: function( event, index ) {
  11785. return this._trigger( "start", event, this._uiHash( index ) );
  11786. },
  11787. _slide: function( event, index, newVal ) {
  11788. var allowed, otherVal,
  11789. currentValue = this.value(),
  11790. newValues = this.values();
  11791. if ( this._hasMultipleValues() ) {
  11792. otherVal = this.values( index ? 0 : 1 );
  11793. currentValue = this.values( index );
  11794. if ( this.options.values.length === 2 && this.options.range === true ) {
  11795. newVal = index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, newVal );
  11796. }
  11797. newValues[ index ] = newVal;
  11798. }
  11799. if ( newVal === currentValue ) {
  11800. return;
  11801. }
  11802. allowed = this._trigger( "slide", event, this._uiHash( index, newVal, newValues ) );
  11803. // A slide can be canceled by returning false from the slide callback
  11804. if ( allowed === false ) {
  11805. return;
  11806. }
  11807. if ( this._hasMultipleValues() ) {
  11808. this.values( index, newVal );
  11809. } else {
  11810. this.value( newVal );
  11811. }
  11812. },
  11813. _stop: function( event, index ) {
  11814. this._trigger( "stop", event, this._uiHash( index ) );
  11815. },
  11816. _change: function( event, index ) {
  11817. if ( !this._keySliding && !this._mouseSliding ) {
  11818. //store the last changed value index for reference when handles overlap
  11819. this._lastChangedValue = index;
  11820. this._trigger( "change", event, this._uiHash( index ) );
  11821. }
  11822. },
  11823. value: function( newValue ) {
  11824. if ( arguments.length ) {
  11825. this.options.value = this._trimAlignValue( newValue );
  11826. this._refreshValue();
  11827. this._change( null, 0 );
  11828. return;
  11829. }
  11830. return this._value();
  11831. },
  11832. values: function( index, newValue ) {
  11833. var vals,
  11834. newValues,
  11835. i;
  11836. if ( arguments.length > 1 ) {
  11837. this.options.values[ index ] = this._trimAlignValue( newValue );
  11838. this._refreshValue();
  11839. this._change( null, index );
  11840. return;
  11841. }
  11842. if ( arguments.length ) {
  11843. if ( Array.isArray( arguments[ 0 ] ) ) {
  11844. vals = this.options.values;
  11845. newValues = arguments[ 0 ];
  11846. for ( i = 0; i < vals.length; i += 1 ) {
  11847. vals[ i ] = this._trimAlignValue( newValues[ i ] );
  11848. this._change( null, i );
  11849. }
  11850. this._refreshValue();
  11851. } else {
  11852. if ( this._hasMultipleValues() ) {
  11853. return this._values( index );
  11854. } else {
  11855. return this.value();
  11856. }
  11857. }
  11858. } else {
  11859. return this._values();
  11860. }
  11861. },
  11862. _setOption: function( key, value ) {
  11863. var i,
  11864. valsLength = 0;
  11865. if ( key === "range" && this.options.range === true ) {
  11866. if ( value === "min" ) {
  11867. this.options.value = this._values( 0 );
  11868. this.options.values = null;
  11869. } else if ( value === "max" ) {
  11870. this.options.value = this._values( this.options.values.length - 1 );
  11871. this.options.values = null;
  11872. }
  11873. }
  11874. if ( Array.isArray( this.options.values ) ) {
  11875. valsLength = this.options.values.length;
  11876. }
  11877. this._super( key, value );
  11878. switch ( key ) {
  11879. case "orientation":
  11880. this._detectOrientation();
  11881. this._removeClass( "ui-slider-horizontal ui-slider-vertical" )
  11882. ._addClass( "ui-slider-" + this.orientation );
  11883. this._refreshValue();
  11884. if ( this.options.range ) {
  11885. this._refreshRange( value );
  11886. }
  11887. // Reset positioning from previous orientation
  11888. this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
  11889. break;
  11890. case "value":
  11891. this._animateOff = true;
  11892. this._refreshValue();
  11893. this._change( null, 0 );
  11894. this._animateOff = false;
  11895. break;
  11896. case "values":
  11897. this._animateOff = true;
  11898. this._refreshValue();
  11899. // Start from the last handle to prevent unreachable handles (#9046)
  11900. for ( i = valsLength - 1; i >= 0; i-- ) {
  11901. this._change( null, i );
  11902. }
  11903. this._animateOff = false;
  11904. break;
  11905. case "step":
  11906. case "min":
  11907. case "max":
  11908. this._animateOff = true;
  11909. this._calculateNewMax();
  11910. this._refreshValue();
  11911. this._animateOff = false;
  11912. break;
  11913. case "range":
  11914. this._animateOff = true;
  11915. this._refresh();
  11916. this._animateOff = false;
  11917. break;
  11918. }
  11919. },
  11920. _setOptionDisabled: function( value ) {
  11921. this._super( value );
  11922. this._toggleClass( null, "ui-state-disabled", !!value );
  11923. },
  11924. //internal value getter
  11925. // _value() returns value trimmed by min and max, aligned by step
  11926. _value: function() {
  11927. var val = this.options.value;
  11928. val = this._trimAlignValue( val );
  11929. return val;
  11930. },
  11931. //internal values getter
  11932. // _values() returns array of values trimmed by min and max, aligned by step
  11933. // _values( index ) returns single value trimmed by min and max, aligned by step
  11934. _values: function( index ) {
  11935. var val,
  11936. vals,
  11937. i;
  11938. if ( arguments.length ) {
  11939. val = this.options.values[ index ];
  11940. val = this._trimAlignValue( val );
  11941. return val;
  11942. } else if ( this._hasMultipleValues() ) {
  11943. // .slice() creates a copy of the array
  11944. // this copy gets trimmed by min and max and then returned
  11945. vals = this.options.values.slice();
  11946. for ( i = 0; i < vals.length; i += 1 ) {
  11947. vals[ i ] = this._trimAlignValue( vals[ i ] );
  11948. }
  11949. return vals;
  11950. } else {
  11951. return [];
  11952. }
  11953. },
  11954. // Returns the step-aligned value that val is closest to, between (inclusive) min and max
  11955. _trimAlignValue: function( val ) {
  11956. if ( val <= this._valueMin() ) {
  11957. return this._valueMin();
  11958. }
  11959. if ( val >= this._valueMax() ) {
  11960. return this._valueMax();
  11961. }
  11962. var step = ( this.options.step > 0 ) ? this.options.step : 1,
  11963. valModStep = ( val - this._valueMin() ) % step,
  11964. alignValue = val - valModStep;
  11965. if ( Math.abs( valModStep ) * 2 >= step ) {
  11966. alignValue += ( valModStep > 0 ) ? step : ( -step );
  11967. }
  11968. // Since JavaScript has problems with large floats, round
  11969. // the final value to 5 digits after the decimal point (see #4124)
  11970. return parseFloat( alignValue.toFixed( 5 ) );
  11971. },
  11972. _calculateNewMax: function() {
  11973. var max = this.options.max,
  11974. min = this._valueMin(),
  11975. step = this.options.step,
  11976. aboveMin = Math.round( ( max - min ) / step ) * step;
  11977. max = aboveMin + min;
  11978. if ( max > this.options.max ) {
  11979. //If max is not divisible by step, rounding off may increase its value
  11980. max -= step;
  11981. }
  11982. this.max = parseFloat( max.toFixed( this._precision() ) );
  11983. },
  11984. _precision: function() {
  11985. var precision = this._precisionOf( this.options.step );
  11986. if ( this.options.min !== null ) {
  11987. precision = Math.max( precision, this._precisionOf( this.options.min ) );
  11988. }
  11989. return precision;
  11990. },
  11991. _precisionOf: function( num ) {
  11992. var str = num.toString(),
  11993. decimal = str.indexOf( "." );
  11994. return decimal === -1 ? 0 : str.length - decimal - 1;
  11995. },
  11996. _valueMin: function() {
  11997. return this.options.min;
  11998. },
  11999. _valueMax: function() {
  12000. return this.max;
  12001. },
  12002. _refreshRange: function( orientation ) {
  12003. if ( orientation === "vertical" ) {
  12004. this.range.css( { "width": "", "left": "" } );
  12005. }
  12006. if ( orientation === "horizontal" ) {
  12007. this.range.css( { "height": "", "bottom": "" } );
  12008. }
  12009. },
  12010. _refreshValue: function() {
  12011. var lastValPercent, valPercent, value, valueMin, valueMax,
  12012. oRange = this.options.range,
  12013. o = this.options,
  12014. that = this,
  12015. animate = ( !this._animateOff ) ? o.animate : false,
  12016. _set = {};
  12017. if ( this._hasMultipleValues() ) {
  12018. this.handles.each( function( i ) {
  12019. valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() -
  12020. that._valueMin() ) * 100;
  12021. _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  12022. $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  12023. if ( that.options.range === true ) {
  12024. if ( that.orientation === "horizontal" ) {
  12025. if ( i === 0 ) {
  12026. that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  12027. left: valPercent + "%"
  12028. }, o.animate );
  12029. }
  12030. if ( i === 1 ) {
  12031. that.range[ animate ? "animate" : "css" ]( {
  12032. width: ( valPercent - lastValPercent ) + "%"
  12033. }, {
  12034. queue: false,
  12035. duration: o.animate
  12036. } );
  12037. }
  12038. } else {
  12039. if ( i === 0 ) {
  12040. that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  12041. bottom: ( valPercent ) + "%"
  12042. }, o.animate );
  12043. }
  12044. if ( i === 1 ) {
  12045. that.range[ animate ? "animate" : "css" ]( {
  12046. height: ( valPercent - lastValPercent ) + "%"
  12047. }, {
  12048. queue: false,
  12049. duration: o.animate
  12050. } );
  12051. }
  12052. }
  12053. }
  12054. lastValPercent = valPercent;
  12055. } );
  12056. } else {
  12057. value = this.value();
  12058. valueMin = this._valueMin();
  12059. valueMax = this._valueMax();
  12060. valPercent = ( valueMax !== valueMin ) ?
  12061. ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
  12062. 0;
  12063. _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  12064. this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  12065. if ( oRange === "min" && this.orientation === "horizontal" ) {
  12066. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  12067. width: valPercent + "%"
  12068. }, o.animate );
  12069. }
  12070. if ( oRange === "max" && this.orientation === "horizontal" ) {
  12071. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  12072. width: ( 100 - valPercent ) + "%"
  12073. }, o.animate );
  12074. }
  12075. if ( oRange === "min" && this.orientation === "vertical" ) {
  12076. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  12077. height: valPercent + "%"
  12078. }, o.animate );
  12079. }
  12080. if ( oRange === "max" && this.orientation === "vertical" ) {
  12081. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  12082. height: ( 100 - valPercent ) + "%"
  12083. }, o.animate );
  12084. }
  12085. }
  12086. },
  12087. _handleEvents: {
  12088. keydown: function( event ) {
  12089. var allowed, curVal, newVal, step,
  12090. index = $( event.target ).data( "ui-slider-handle-index" );
  12091. switch ( event.keyCode ) {
  12092. case $.ui.keyCode.HOME:
  12093. case $.ui.keyCode.END:
  12094. case $.ui.keyCode.PAGE_UP:
  12095. case $.ui.keyCode.PAGE_DOWN:
  12096. case $.ui.keyCode.UP:
  12097. case $.ui.keyCode.RIGHT:
  12098. case $.ui.keyCode.DOWN:
  12099. case $.ui.keyCode.LEFT:
  12100. event.preventDefault();
  12101. if ( !this._keySliding ) {
  12102. this._keySliding = true;
  12103. this._addClass( $( event.target ), null, "ui-state-active" );
  12104. allowed = this._start( event, index );
  12105. if ( allowed === false ) {
  12106. return;
  12107. }
  12108. }
  12109. break;
  12110. }
  12111. step = this.options.step;
  12112. if ( this._hasMultipleValues() ) {
  12113. curVal = newVal = this.values( index );
  12114. } else {
  12115. curVal = newVal = this.value();
  12116. }
  12117. switch ( event.keyCode ) {
  12118. case $.ui.keyCode.HOME:
  12119. newVal = this._valueMin();
  12120. break;
  12121. case $.ui.keyCode.END:
  12122. newVal = this._valueMax();
  12123. break;
  12124. case $.ui.keyCode.PAGE_UP:
  12125. newVal = this._trimAlignValue(
  12126. curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
  12127. );
  12128. break;
  12129. case $.ui.keyCode.PAGE_DOWN:
  12130. newVal = this._trimAlignValue(
  12131. curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) );
  12132. break;
  12133. case $.ui.keyCode.UP:
  12134. case $.ui.keyCode.RIGHT:
  12135. if ( curVal === this._valueMax() ) {
  12136. return;
  12137. }
  12138. newVal = this._trimAlignValue( curVal + step );
  12139. break;
  12140. case $.ui.keyCode.DOWN:
  12141. case $.ui.keyCode.LEFT:
  12142. if ( curVal === this._valueMin() ) {
  12143. return;
  12144. }
  12145. newVal = this._trimAlignValue( curVal - step );
  12146. break;
  12147. }
  12148. this._slide( event, index, newVal );
  12149. },
  12150. keyup: function( event ) {
  12151. var index = $( event.target ).data( "ui-slider-handle-index" );
  12152. if ( this._keySliding ) {
  12153. this._keySliding = false;
  12154. this._stop( event, index );
  12155. this._change( event, index );
  12156. this._removeClass( $( event.target ), null, "ui-state-active" );
  12157. }
  12158. }
  12159. }
  12160. } );
  12161. /*!
  12162. * jQuery UI Spinner 1.13.2
  12163. * http://jqueryui.com
  12164. *
  12165. * Copyright jQuery Foundation and other contributors
  12166. * Released under the MIT license.
  12167. * http://jquery.org/license
  12168. */
  12169. //>>label: Spinner
  12170. //>>group: Widgets
  12171. //>>description: Displays buttons to easily input numbers via the keyboard or mouse.
  12172. //>>docs: http://api.jqueryui.com/spinner/
  12173. //>>demos: http://jqueryui.com/spinner/
  12174. //>>css.structure: ../../themes/base/core.css
  12175. //>>css.structure: ../../themes/base/spinner.css
  12176. //>>css.theme: ../../themes/base/theme.css
  12177. function spinnerModifier( fn ) {
  12178. return function() {
  12179. var previous = this.element.val();
  12180. fn.apply( this, arguments );
  12181. this._refresh();
  12182. if ( previous !== this.element.val() ) {
  12183. this._trigger( "change" );
  12184. }
  12185. };
  12186. }
  12187. $.widget( "ui.spinner", {
  12188. version: "1.13.2",
  12189. defaultElement: "<input>",
  12190. widgetEventPrefix: "spin",
  12191. options: {
  12192. classes: {
  12193. "ui-spinner": "ui-corner-all",
  12194. "ui-spinner-down": "ui-corner-br",
  12195. "ui-spinner-up": "ui-corner-tr"
  12196. },
  12197. culture: null,
  12198. icons: {
  12199. down: "ui-icon-triangle-1-s",
  12200. up: "ui-icon-triangle-1-n"
  12201. },
  12202. incremental: true,
  12203. max: null,
  12204. min: null,
  12205. numberFormat: null,
  12206. page: 10,
  12207. step: 1,
  12208. change: null,
  12209. spin: null,
  12210. start: null,
  12211. stop: null
  12212. },
  12213. _create: function() {
  12214. // handle string values that need to be parsed
  12215. this._setOption( "max", this.options.max );
  12216. this._setOption( "min", this.options.min );
  12217. this._setOption( "step", this.options.step );
  12218. // Only format if there is a value, prevents the field from being marked
  12219. // as invalid in Firefox, see #9573.
  12220. if ( this.value() !== "" ) {
  12221. // Format the value, but don't constrain.
  12222. this._value( this.element.val(), true );
  12223. }
  12224. this._draw();
  12225. this._on( this._events );
  12226. this._refresh();
  12227. // Turning off autocomplete prevents the browser from remembering the
  12228. // value when navigating through history, so we re-enable autocomplete
  12229. // if the page is unloaded before the widget is destroyed. #7790
  12230. this._on( this.window, {
  12231. beforeunload: function() {
  12232. this.element.removeAttr( "autocomplete" );
  12233. }
  12234. } );
  12235. },
  12236. _getCreateOptions: function() {
  12237. var options = this._super();
  12238. var element = this.element;
  12239. $.each( [ "min", "max", "step" ], function( i, option ) {
  12240. var value = element.attr( option );
  12241. if ( value != null && value.length ) {
  12242. options[ option ] = value;
  12243. }
  12244. } );
  12245. return options;
  12246. },
  12247. _events: {
  12248. keydown: function( event ) {
  12249. if ( this._start( event ) && this._keydown( event ) ) {
  12250. event.preventDefault();
  12251. }
  12252. },
  12253. keyup: "_stop",
  12254. focus: function() {
  12255. this.previous = this.element.val();
  12256. },
  12257. blur: function( event ) {
  12258. if ( this.cancelBlur ) {
  12259. delete this.cancelBlur;
  12260. return;
  12261. }
  12262. this._stop();
  12263. this._refresh();
  12264. if ( this.previous !== this.element.val() ) {
  12265. this._trigger( "change", event );
  12266. }
  12267. },
  12268. mousewheel: function( event, delta ) {
  12269. var activeElement = $.ui.safeActiveElement( this.document[ 0 ] );
  12270. var isActive = this.element[ 0 ] === activeElement;
  12271. if ( !isActive || !delta ) {
  12272. return;
  12273. }
  12274. if ( !this.spinning && !this._start( event ) ) {
  12275. return false;
  12276. }
  12277. this._spin( ( delta > 0 ? 1 : -1 ) * this.options.step, event );
  12278. clearTimeout( this.mousewheelTimer );
  12279. this.mousewheelTimer = this._delay( function() {
  12280. if ( this.spinning ) {
  12281. this._stop( event );
  12282. }
  12283. }, 100 );
  12284. event.preventDefault();
  12285. },
  12286. "mousedown .ui-spinner-button": function( event ) {
  12287. var previous;
  12288. // We never want the buttons to have focus; whenever the user is
  12289. // interacting with the spinner, the focus should be on the input.
  12290. // If the input is focused then this.previous is properly set from
  12291. // when the input first received focus. If the input is not focused
  12292. // then we need to set this.previous based on the value before spinning.
  12293. previous = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] ) ?
  12294. this.previous : this.element.val();
  12295. function checkFocus() {
  12296. var isActive = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] );
  12297. if ( !isActive ) {
  12298. this.element.trigger( "focus" );
  12299. this.previous = previous;
  12300. // support: IE
  12301. // IE sets focus asynchronously, so we need to check if focus
  12302. // moved off of the input because the user clicked on the button.
  12303. this._delay( function() {
  12304. this.previous = previous;
  12305. } );
  12306. }
  12307. }
  12308. // Ensure focus is on (or stays on) the text field
  12309. event.preventDefault();
  12310. checkFocus.call( this );
  12311. // Support: IE
  12312. // IE doesn't prevent moving focus even with event.preventDefault()
  12313. // so we set a flag to know when we should ignore the blur event
  12314. // and check (again) if focus moved off of the input.
  12315. this.cancelBlur = true;
  12316. this._delay( function() {
  12317. delete this.cancelBlur;
  12318. checkFocus.call( this );
  12319. } );
  12320. if ( this._start( event ) === false ) {
  12321. return;
  12322. }
  12323. this._repeat( null, $( event.currentTarget )
  12324. .hasClass( "ui-spinner-up" ) ? 1 : -1, event );
  12325. },
  12326. "mouseup .ui-spinner-button": "_stop",
  12327. "mouseenter .ui-spinner-button": function( event ) {
  12328. // button will add ui-state-active if mouse was down while mouseleave and kept down
  12329. if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
  12330. return;
  12331. }
  12332. if ( this._start( event ) === false ) {
  12333. return false;
  12334. }
  12335. this._repeat( null, $( event.currentTarget )
  12336. .hasClass( "ui-spinner-up" ) ? 1 : -1, event );
  12337. },
  12338. // TODO: do we really want to consider this a stop?
  12339. // shouldn't we just stop the repeater and wait until mouseup before
  12340. // we trigger the stop event?
  12341. "mouseleave .ui-spinner-button": "_stop"
  12342. },
  12343. // Support mobile enhanced option and make backcompat more sane
  12344. _enhance: function() {
  12345. this.uiSpinner = this.element
  12346. .attr( "autocomplete", "off" )
  12347. .wrap( "<span>" )
  12348. .parent()
  12349. // Add buttons
  12350. .append(
  12351. "<a></a><a></a>"
  12352. );
  12353. },
  12354. _draw: function() {
  12355. this._enhance();
  12356. this._addClass( this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content" );
  12357. this._addClass( "ui-spinner-input" );
  12358. this.element.attr( "role", "spinbutton" );
  12359. // Button bindings
  12360. this.buttons = this.uiSpinner.children( "a" )
  12361. .attr( "tabIndex", -1 )
  12362. .attr( "aria-hidden", true )
  12363. .button( {
  12364. classes: {
  12365. "ui-button": ""
  12366. }
  12367. } );
  12368. // TODO: Right now button does not support classes this is already updated in button PR
  12369. this._removeClass( this.buttons, "ui-corner-all" );
  12370. this._addClass( this.buttons.first(), "ui-spinner-button ui-spinner-up" );
  12371. this._addClass( this.buttons.last(), "ui-spinner-button ui-spinner-down" );
  12372. this.buttons.first().button( {
  12373. "icon": this.options.icons.up,
  12374. "showLabel": false
  12375. } );
  12376. this.buttons.last().button( {
  12377. "icon": this.options.icons.down,
  12378. "showLabel": false
  12379. } );
  12380. // IE 6 doesn't understand height: 50% for the buttons
  12381. // unless the wrapper has an explicit height
  12382. if ( this.buttons.height() > Math.ceil( this.uiSpinner.height() * 0.5 ) &&
  12383. this.uiSpinner.height() > 0 ) {
  12384. this.uiSpinner.height( this.uiSpinner.height() );
  12385. }
  12386. },
  12387. _keydown: function( event ) {
  12388. var options = this.options,
  12389. keyCode = $.ui.keyCode;
  12390. switch ( event.keyCode ) {
  12391. case keyCode.UP:
  12392. this._repeat( null, 1, event );
  12393. return true;
  12394. case keyCode.DOWN:
  12395. this._repeat( null, -1, event );
  12396. return true;
  12397. case keyCode.PAGE_UP:
  12398. this._repeat( null, options.page, event );
  12399. return true;
  12400. case keyCode.PAGE_DOWN:
  12401. this._repeat( null, -options.page, event );
  12402. return true;
  12403. }
  12404. return false;
  12405. },
  12406. _start: function( event ) {
  12407. if ( !this.spinning && this._trigger( "start", event ) === false ) {
  12408. return false;
  12409. }
  12410. if ( !this.counter ) {
  12411. this.counter = 1;
  12412. }
  12413. this.spinning = true;
  12414. return true;
  12415. },
  12416. _repeat: function( i, steps, event ) {
  12417. i = i || 500;
  12418. clearTimeout( this.timer );
  12419. this.timer = this._delay( function() {
  12420. this._repeat( 40, steps, event );
  12421. }, i );
  12422. this._spin( steps * this.options.step, event );
  12423. },
  12424. _spin: function( step, event ) {
  12425. var value = this.value() || 0;
  12426. if ( !this.counter ) {
  12427. this.counter = 1;
  12428. }
  12429. value = this._adjustValue( value + step * this._increment( this.counter ) );
  12430. if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false ) {
  12431. this._value( value );
  12432. this.counter++;
  12433. }
  12434. },
  12435. _increment: function( i ) {
  12436. var incremental = this.options.incremental;
  12437. if ( incremental ) {
  12438. return typeof incremental === "function" ?
  12439. incremental( i ) :
  12440. Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 );
  12441. }
  12442. return 1;
  12443. },
  12444. _precision: function() {
  12445. var precision = this._precisionOf( this.options.step );
  12446. if ( this.options.min !== null ) {
  12447. precision = Math.max( precision, this._precisionOf( this.options.min ) );
  12448. }
  12449. return precision;
  12450. },
  12451. _precisionOf: function( num ) {
  12452. var str = num.toString(),
  12453. decimal = str.indexOf( "." );
  12454. return decimal === -1 ? 0 : str.length - decimal - 1;
  12455. },
  12456. _adjustValue: function( value ) {
  12457. var base, aboveMin,
  12458. options = this.options;
  12459. // Make sure we're at a valid step
  12460. // - find out where we are relative to the base (min or 0)
  12461. base = options.min !== null ? options.min : 0;
  12462. aboveMin = value - base;
  12463. // - round to the nearest step
  12464. aboveMin = Math.round( aboveMin / options.step ) * options.step;
  12465. // - rounding is based on 0, so adjust back to our base
  12466. value = base + aboveMin;
  12467. // Fix precision from bad JS floating point math
  12468. value = parseFloat( value.toFixed( this._precision() ) );
  12469. // Clamp the value
  12470. if ( options.max !== null && value > options.max ) {
  12471. return options.max;
  12472. }
  12473. if ( options.min !== null && value < options.min ) {
  12474. return options.min;
  12475. }
  12476. return value;
  12477. },
  12478. _stop: function( event ) {
  12479. if ( !this.spinning ) {
  12480. return;
  12481. }
  12482. clearTimeout( this.timer );
  12483. clearTimeout( this.mousewheelTimer );
  12484. this.counter = 0;
  12485. this.spinning = false;
  12486. this._trigger( "stop", event );
  12487. },
  12488. _setOption: function( key, value ) {
  12489. var prevValue, first, last;
  12490. if ( key === "culture" || key === "numberFormat" ) {
  12491. prevValue = this._parse( this.element.val() );
  12492. this.options[ key ] = value;
  12493. this.element.val( this._format( prevValue ) );
  12494. return;
  12495. }
  12496. if ( key === "max" || key === "min" || key === "step" ) {
  12497. if ( typeof value === "string" ) {
  12498. value = this._parse( value );
  12499. }
  12500. }
  12501. if ( key === "icons" ) {
  12502. first = this.buttons.first().find( ".ui-icon" );
  12503. this._removeClass( first, null, this.options.icons.up );
  12504. this._addClass( first, null, value.up );
  12505. last = this.buttons.last().find( ".ui-icon" );
  12506. this._removeClass( last, null, this.options.icons.down );
  12507. this._addClass( last, null, value.down );
  12508. }
  12509. this._super( key, value );
  12510. },
  12511. _setOptionDisabled: function( value ) {
  12512. this._super( value );
  12513. this._toggleClass( this.uiSpinner, null, "ui-state-disabled", !!value );
  12514. this.element.prop( "disabled", !!value );
  12515. this.buttons.button( value ? "disable" : "enable" );
  12516. },
  12517. _setOptions: spinnerModifier( function( options ) {
  12518. this._super( options );
  12519. } ),
  12520. _parse: function( val ) {
  12521. if ( typeof val === "string" && val !== "" ) {
  12522. val = window.Globalize && this.options.numberFormat ?
  12523. Globalize.parseFloat( val, 10, this.options.culture ) : +val;
  12524. }
  12525. return val === "" || isNaN( val ) ? null : val;
  12526. },
  12527. _format: function( value ) {
  12528. if ( value === "" ) {
  12529. return "";
  12530. }
  12531. return window.Globalize && this.options.numberFormat ?
  12532. Globalize.format( value, this.options.numberFormat, this.options.culture ) :
  12533. value;
  12534. },
  12535. _refresh: function() {
  12536. this.element.attr( {
  12537. "aria-valuemin": this.options.min,
  12538. "aria-valuemax": this.options.max,
  12539. // TODO: what should we do with values that can't be parsed?
  12540. "aria-valuenow": this._parse( this.element.val() )
  12541. } );
  12542. },
  12543. isValid: function() {
  12544. var value = this.value();
  12545. // Null is invalid
  12546. if ( value === null ) {
  12547. return false;
  12548. }
  12549. // If value gets adjusted, it's invalid
  12550. return value === this._adjustValue( value );
  12551. },
  12552. // Update the value without triggering change
  12553. _value: function( value, allowAny ) {
  12554. var parsed;
  12555. if ( value !== "" ) {
  12556. parsed = this._parse( value );
  12557. if ( parsed !== null ) {
  12558. if ( !allowAny ) {
  12559. parsed = this._adjustValue( parsed );
  12560. }
  12561. value = this._format( parsed );
  12562. }
  12563. }
  12564. this.element.val( value );
  12565. this._refresh();
  12566. },
  12567. _destroy: function() {
  12568. this.element
  12569. .prop( "disabled", false )
  12570. .removeAttr( "autocomplete role aria-valuemin aria-valuemax aria-valuenow" );
  12571. this.uiSpinner.replaceWith( this.element );
  12572. },
  12573. stepUp: spinnerModifier( function( steps ) {
  12574. this._stepUp( steps );
  12575. } ),
  12576. _stepUp: function( steps ) {
  12577. if ( this._start() ) {
  12578. this._spin( ( steps || 1 ) * this.options.step );
  12579. this._stop();
  12580. }
  12581. },
  12582. stepDown: spinnerModifier( function( steps ) {
  12583. this._stepDown( steps );
  12584. } ),
  12585. _stepDown: function( steps ) {
  12586. if ( this._start() ) {
  12587. this._spin( ( steps || 1 ) * -this.options.step );
  12588. this._stop();
  12589. }
  12590. },
  12591. pageUp: spinnerModifier( function( pages ) {
  12592. this._stepUp( ( pages || 1 ) * this.options.page );
  12593. } ),
  12594. pageDown: spinnerModifier( function( pages ) {
  12595. this._stepDown( ( pages || 1 ) * this.options.page );
  12596. } ),
  12597. value: function( newVal ) {
  12598. if ( !arguments.length ) {
  12599. return this._parse( this.element.val() );
  12600. }
  12601. spinnerModifier( this._value ).call( this, newVal );
  12602. },
  12603. widget: function() {
  12604. return this.uiSpinner;
  12605. }
  12606. } );
  12607. // DEPRECATED
  12608. // TODO: switch return back to widget declaration at top of file when this is removed
  12609. if ( $.uiBackCompat !== false ) {
  12610. // Backcompat for spinner html extension points
  12611. $.widget( "ui.spinner", $.ui.spinner, {
  12612. _enhance: function() {
  12613. this.uiSpinner = this.element
  12614. .attr( "autocomplete", "off" )
  12615. .wrap( this._uiSpinnerHtml() )
  12616. .parent()
  12617. // Add buttons
  12618. .append( this._buttonHtml() );
  12619. },
  12620. _uiSpinnerHtml: function() {
  12621. return "<span>";
  12622. },
  12623. _buttonHtml: function() {
  12624. return "<a></a><a></a>";
  12625. }
  12626. } );
  12627. }
  12628. var widgetsSpinner = $.ui.spinner;
  12629. /*!
  12630. * jQuery UI Tabs 1.13.2
  12631. * http://jqueryui.com
  12632. *
  12633. * Copyright jQuery Foundation and other contributors
  12634. * Released under the MIT license.
  12635. * http://jquery.org/license
  12636. */
  12637. //>>label: Tabs
  12638. //>>group: Widgets
  12639. //>>description: Transforms a set of container elements into a tab structure.
  12640. //>>docs: http://api.jqueryui.com/tabs/
  12641. //>>demos: http://jqueryui.com/tabs/
  12642. //>>css.structure: ../../themes/base/core.css
  12643. //>>css.structure: ../../themes/base/tabs.css
  12644. //>>css.theme: ../../themes/base/theme.css
  12645. $.widget( "ui.tabs", {
  12646. version: "1.13.2",
  12647. delay: 300,
  12648. options: {
  12649. active: null,
  12650. classes: {
  12651. "ui-tabs": "ui-corner-all",
  12652. "ui-tabs-nav": "ui-corner-all",
  12653. "ui-tabs-panel": "ui-corner-bottom",
  12654. "ui-tabs-tab": "ui-corner-top"
  12655. },
  12656. collapsible: false,
  12657. event: "click",
  12658. heightStyle: "content",
  12659. hide: null,
  12660. show: null,
  12661. // Callbacks
  12662. activate: null,
  12663. beforeActivate: null,
  12664. beforeLoad: null,
  12665. load: null
  12666. },
  12667. _isLocal: ( function() {
  12668. var rhash = /#.*$/;
  12669. return function( anchor ) {
  12670. var anchorUrl, locationUrl;
  12671. anchorUrl = anchor.href.replace( rhash, "" );
  12672. locationUrl = location.href.replace( rhash, "" );
  12673. // Decoding may throw an error if the URL isn't UTF-8 (#9518)
  12674. try {
  12675. anchorUrl = decodeURIComponent( anchorUrl );
  12676. } catch ( error ) {}
  12677. try {
  12678. locationUrl = decodeURIComponent( locationUrl );
  12679. } catch ( error ) {}
  12680. return anchor.hash.length > 1 && anchorUrl === locationUrl;
  12681. };
  12682. } )(),
  12683. _create: function() {
  12684. var that = this,
  12685. options = this.options;
  12686. this.running = false;
  12687. this._addClass( "ui-tabs", "ui-widget ui-widget-content" );
  12688. this._toggleClass( "ui-tabs-collapsible", null, options.collapsible );
  12689. this._processTabs();
  12690. options.active = this._initialActive();
  12691. // Take disabling tabs via class attribute from HTML
  12692. // into account and update option properly.
  12693. if ( Array.isArray( options.disabled ) ) {
  12694. options.disabled = $.uniqueSort( options.disabled.concat(
  12695. $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
  12696. return that.tabs.index( li );
  12697. } )
  12698. ) ).sort();
  12699. }
  12700. // Check for length avoids error when initializing empty list
  12701. if ( this.options.active !== false && this.anchors.length ) {
  12702. this.active = this._findActive( options.active );
  12703. } else {
  12704. this.active = $();
  12705. }
  12706. this._refresh();
  12707. if ( this.active.length ) {
  12708. this.load( options.active );
  12709. }
  12710. },
  12711. _initialActive: function() {
  12712. var active = this.options.active,
  12713. collapsible = this.options.collapsible,
  12714. locationHash = location.hash.substring( 1 );
  12715. if ( active === null ) {
  12716. // check the fragment identifier in the URL
  12717. if ( locationHash ) {
  12718. this.tabs.each( function( i, tab ) {
  12719. if ( $( tab ).attr( "aria-controls" ) === locationHash ) {
  12720. active = i;
  12721. return false;
  12722. }
  12723. } );
  12724. }
  12725. // Check for a tab marked active via a class
  12726. if ( active === null ) {
  12727. active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );
  12728. }
  12729. // No active tab, set to false
  12730. if ( active === null || active === -1 ) {
  12731. active = this.tabs.length ? 0 : false;
  12732. }
  12733. }
  12734. // Handle numbers: negative, out of range
  12735. if ( active !== false ) {
  12736. active = this.tabs.index( this.tabs.eq( active ) );
  12737. if ( active === -1 ) {
  12738. active = collapsible ? false : 0;
  12739. }
  12740. }
  12741. // Don't allow collapsible: false and active: false
  12742. if ( !collapsible && active === false && this.anchors.length ) {
  12743. active = 0;
  12744. }
  12745. return active;
  12746. },
  12747. _getCreateEventData: function() {
  12748. return {
  12749. tab: this.active,
  12750. panel: !this.active.length ? $() : this._getPanelForTab( this.active )
  12751. };
  12752. },
  12753. _tabKeydown: function( event ) {
  12754. var focusedTab = $( $.ui.safeActiveElement( this.document[ 0 ] ) ).closest( "li" ),
  12755. selectedIndex = this.tabs.index( focusedTab ),
  12756. goingForward = true;
  12757. if ( this._handlePageNav( event ) ) {
  12758. return;
  12759. }
  12760. switch ( event.keyCode ) {
  12761. case $.ui.keyCode.RIGHT:
  12762. case $.ui.keyCode.DOWN:
  12763. selectedIndex++;
  12764. break;
  12765. case $.ui.keyCode.UP:
  12766. case $.ui.keyCode.LEFT:
  12767. goingForward = false;
  12768. selectedIndex--;
  12769. break;
  12770. case $.ui.keyCode.END:
  12771. selectedIndex = this.anchors.length - 1;
  12772. break;
  12773. case $.ui.keyCode.HOME:
  12774. selectedIndex = 0;
  12775. break;
  12776. case $.ui.keyCode.SPACE:
  12777. // Activate only, no collapsing
  12778. event.preventDefault();
  12779. clearTimeout( this.activating );
  12780. this._activate( selectedIndex );
  12781. return;
  12782. case $.ui.keyCode.ENTER:
  12783. // Toggle (cancel delayed activation, allow collapsing)
  12784. event.preventDefault();
  12785. clearTimeout( this.activating );
  12786. // Determine if we should collapse or activate
  12787. this._activate( selectedIndex === this.options.active ? false : selectedIndex );
  12788. return;
  12789. default:
  12790. return;
  12791. }
  12792. // Focus the appropriate tab, based on which key was pressed
  12793. event.preventDefault();
  12794. clearTimeout( this.activating );
  12795. selectedIndex = this._focusNextTab( selectedIndex, goingForward );
  12796. // Navigating with control/command key will prevent automatic activation
  12797. if ( !event.ctrlKey && !event.metaKey ) {
  12798. // Update aria-selected immediately so that AT think the tab is already selected.
  12799. // Otherwise AT may confuse the user by stating that they need to activate the tab,
  12800. // but the tab will already be activated by the time the announcement finishes.
  12801. focusedTab.attr( "aria-selected", "false" );
  12802. this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
  12803. this.activating = this._delay( function() {
  12804. this.option( "active", selectedIndex );
  12805. }, this.delay );
  12806. }
  12807. },
  12808. _panelKeydown: function( event ) {
  12809. if ( this._handlePageNav( event ) ) {
  12810. return;
  12811. }
  12812. // Ctrl+up moves focus to the current tab
  12813. if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
  12814. event.preventDefault();
  12815. this.active.trigger( "focus" );
  12816. }
  12817. },
  12818. // Alt+page up/down moves focus to the previous/next tab (and activates)
  12819. _handlePageNav: function( event ) {
  12820. if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {
  12821. this._activate( this._focusNextTab( this.options.active - 1, false ) );
  12822. return true;
  12823. }
  12824. if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) {
  12825. this._activate( this._focusNextTab( this.options.active + 1, true ) );
  12826. return true;
  12827. }
  12828. },
  12829. _findNextTab: function( index, goingForward ) {
  12830. var lastTabIndex = this.tabs.length - 1;
  12831. function constrain() {
  12832. if ( index > lastTabIndex ) {
  12833. index = 0;
  12834. }
  12835. if ( index < 0 ) {
  12836. index = lastTabIndex;
  12837. }
  12838. return index;
  12839. }
  12840. while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) {
  12841. index = goingForward ? index + 1 : index - 1;
  12842. }
  12843. return index;
  12844. },
  12845. _focusNextTab: function( index, goingForward ) {
  12846. index = this._findNextTab( index, goingForward );
  12847. this.tabs.eq( index ).trigger( "focus" );
  12848. return index;
  12849. },
  12850. _setOption: function( key, value ) {
  12851. if ( key === "active" ) {
  12852. // _activate() will handle invalid values and update this.options
  12853. this._activate( value );
  12854. return;
  12855. }
  12856. this._super( key, value );
  12857. if ( key === "collapsible" ) {
  12858. this._toggleClass( "ui-tabs-collapsible", null, value );
  12859. // Setting collapsible: false while collapsed; open first panel
  12860. if ( !value && this.options.active === false ) {
  12861. this._activate( 0 );
  12862. }
  12863. }
  12864. if ( key === "event" ) {
  12865. this._setupEvents( value );
  12866. }
  12867. if ( key === "heightStyle" ) {
  12868. this._setupHeightStyle( value );
  12869. }
  12870. },
  12871. _sanitizeSelector: function( hash ) {
  12872. return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";
  12873. },
  12874. refresh: function() {
  12875. var options = this.options,
  12876. lis = this.tablist.children( ":has(a[href])" );
  12877. // Get disabled tabs from class attribute from HTML
  12878. // this will get converted to a boolean if needed in _refresh()
  12879. options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) {
  12880. return lis.index( tab );
  12881. } );
  12882. this._processTabs();
  12883. // Was collapsed or no tabs
  12884. if ( options.active === false || !this.anchors.length ) {
  12885. options.active = false;
  12886. this.active = $();
  12887. // was active, but active tab is gone
  12888. } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {
  12889. // all remaining tabs are disabled
  12890. if ( this.tabs.length === options.disabled.length ) {
  12891. options.active = false;
  12892. this.active = $();
  12893. // activate previous tab
  12894. } else {
  12895. this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );
  12896. }
  12897. // was active, active tab still exists
  12898. } else {
  12899. // make sure active index is correct
  12900. options.active = this.tabs.index( this.active );
  12901. }
  12902. this._refresh();
  12903. },
  12904. _refresh: function() {
  12905. this._setOptionDisabled( this.options.disabled );
  12906. this._setupEvents( this.options.event );
  12907. this._setupHeightStyle( this.options.heightStyle );
  12908. this.tabs.not( this.active ).attr( {
  12909. "aria-selected": "false",
  12910. "aria-expanded": "false",
  12911. tabIndex: -1
  12912. } );
  12913. this.panels.not( this._getPanelForTab( this.active ) )
  12914. .hide()
  12915. .attr( {
  12916. "aria-hidden": "true"
  12917. } );
  12918. // Make sure one tab is in the tab order
  12919. if ( !this.active.length ) {
  12920. this.tabs.eq( 0 ).attr( "tabIndex", 0 );
  12921. } else {
  12922. this.active
  12923. .attr( {
  12924. "aria-selected": "true",
  12925. "aria-expanded": "true",
  12926. tabIndex: 0
  12927. } );
  12928. this._addClass( this.active, "ui-tabs-active", "ui-state-active" );
  12929. this._getPanelForTab( this.active )
  12930. .show()
  12931. .attr( {
  12932. "aria-hidden": "false"
  12933. } );
  12934. }
  12935. },
  12936. _processTabs: function() {
  12937. var that = this,
  12938. prevTabs = this.tabs,
  12939. prevAnchors = this.anchors,
  12940. prevPanels = this.panels;
  12941. this.tablist = this._getList().attr( "role", "tablist" );
  12942. this._addClass( this.tablist, "ui-tabs-nav",
  12943. "ui-helper-reset ui-helper-clearfix ui-widget-header" );
  12944. // Prevent users from focusing disabled tabs via click
  12945. this.tablist
  12946. .on( "mousedown" + this.eventNamespace, "> li", function( event ) {
  12947. if ( $( this ).is( ".ui-state-disabled" ) ) {
  12948. event.preventDefault();
  12949. }
  12950. } )
  12951. // Support: IE <9
  12952. // Preventing the default action in mousedown doesn't prevent IE
  12953. // from focusing the element, so if the anchor gets focused, blur.
  12954. // We don't have to worry about focusing the previously focused
  12955. // element since clicking on a non-focusable element should focus
  12956. // the body anyway.
  12957. .on( "focus" + this.eventNamespace, ".ui-tabs-anchor", function() {
  12958. if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
  12959. this.blur();
  12960. }
  12961. } );
  12962. this.tabs = this.tablist.find( "> li:has(a[href])" )
  12963. .attr( {
  12964. role: "tab",
  12965. tabIndex: -1
  12966. } );
  12967. this._addClass( this.tabs, "ui-tabs-tab", "ui-state-default" );
  12968. this.anchors = this.tabs.map( function() {
  12969. return $( "a", this )[ 0 ];
  12970. } )
  12971. .attr( {
  12972. tabIndex: -1
  12973. } );
  12974. this._addClass( this.anchors, "ui-tabs-anchor" );
  12975. this.panels = $();
  12976. this.anchors.each( function( i, anchor ) {
  12977. var selector, panel, panelId,
  12978. anchorId = $( anchor ).uniqueId().attr( "id" ),
  12979. tab = $( anchor ).closest( "li" ),
  12980. originalAriaControls = tab.attr( "aria-controls" );
  12981. // Inline tab
  12982. if ( that._isLocal( anchor ) ) {
  12983. selector = anchor.hash;
  12984. panelId = selector.substring( 1 );
  12985. panel = that.element.find( that._sanitizeSelector( selector ) );
  12986. // remote tab
  12987. } else {
  12988. // If the tab doesn't already have aria-controls,
  12989. // generate an id by using a throw-away element
  12990. panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id;
  12991. selector = "#" + panelId;
  12992. panel = that.element.find( selector );
  12993. if ( !panel.length ) {
  12994. panel = that._createPanel( panelId );
  12995. panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
  12996. }
  12997. panel.attr( "aria-live", "polite" );
  12998. }
  12999. if ( panel.length ) {
  13000. that.panels = that.panels.add( panel );
  13001. }
  13002. if ( originalAriaControls ) {
  13003. tab.data( "ui-tabs-aria-controls", originalAriaControls );
  13004. }
  13005. tab.attr( {
  13006. "aria-controls": panelId,
  13007. "aria-labelledby": anchorId
  13008. } );
  13009. panel.attr( "aria-labelledby", anchorId );
  13010. } );
  13011. this.panels.attr( "role", "tabpanel" );
  13012. this._addClass( this.panels, "ui-tabs-panel", "ui-widget-content" );
  13013. // Avoid memory leaks (#10056)
  13014. if ( prevTabs ) {
  13015. this._off( prevTabs.not( this.tabs ) );
  13016. this._off( prevAnchors.not( this.anchors ) );
  13017. this._off( prevPanels.not( this.panels ) );
  13018. }
  13019. },
  13020. // Allow overriding how to find the list for rare usage scenarios (#7715)
  13021. _getList: function() {
  13022. return this.tablist || this.element.find( "ol, ul" ).eq( 0 );
  13023. },
  13024. _createPanel: function( id ) {
  13025. return $( "<div>" )
  13026. .attr( "id", id )
  13027. .data( "ui-tabs-destroy", true );
  13028. },
  13029. _setOptionDisabled: function( disabled ) {
  13030. var currentItem, li, i;
  13031. if ( Array.isArray( disabled ) ) {
  13032. if ( !disabled.length ) {
  13033. disabled = false;
  13034. } else if ( disabled.length === this.anchors.length ) {
  13035. disabled = true;
  13036. }
  13037. }
  13038. // Disable tabs
  13039. for ( i = 0; ( li = this.tabs[ i ] ); i++ ) {
  13040. currentItem = $( li );
  13041. if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {
  13042. currentItem.attr( "aria-disabled", "true" );
  13043. this._addClass( currentItem, null, "ui-state-disabled" );
  13044. } else {
  13045. currentItem.removeAttr( "aria-disabled" );
  13046. this._removeClass( currentItem, null, "ui-state-disabled" );
  13047. }
  13048. }
  13049. this.options.disabled = disabled;
  13050. this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null,
  13051. disabled === true );
  13052. },
  13053. _setupEvents: function( event ) {
  13054. var events = {};
  13055. if ( event ) {
  13056. $.each( event.split( " " ), function( index, eventName ) {
  13057. events[ eventName ] = "_eventHandler";
  13058. } );
  13059. }
  13060. this._off( this.anchors.add( this.tabs ).add( this.panels ) );
  13061. // Always prevent the default action, even when disabled
  13062. this._on( true, this.anchors, {
  13063. click: function( event ) {
  13064. event.preventDefault();
  13065. }
  13066. } );
  13067. this._on( this.anchors, events );
  13068. this._on( this.tabs, { keydown: "_tabKeydown" } );
  13069. this._on( this.panels, { keydown: "_panelKeydown" } );
  13070. this._focusable( this.tabs );
  13071. this._hoverable( this.tabs );
  13072. },
  13073. _setupHeightStyle: function( heightStyle ) {
  13074. var maxHeight,
  13075. parent = this.element.parent();
  13076. if ( heightStyle === "fill" ) {
  13077. maxHeight = parent.height();
  13078. maxHeight -= this.element.outerHeight() - this.element.height();
  13079. this.element.siblings( ":visible" ).each( function() {
  13080. var elem = $( this ),
  13081. position = elem.css( "position" );
  13082. if ( position === "absolute" || position === "fixed" ) {
  13083. return;
  13084. }
  13085. maxHeight -= elem.outerHeight( true );
  13086. } );
  13087. this.element.children().not( this.panels ).each( function() {
  13088. maxHeight -= $( this ).outerHeight( true );
  13089. } );
  13090. this.panels.each( function() {
  13091. $( this ).height( Math.max( 0, maxHeight -
  13092. $( this ).innerHeight() + $( this ).height() ) );
  13093. } )
  13094. .css( "overflow", "auto" );
  13095. } else if ( heightStyle === "auto" ) {
  13096. maxHeight = 0;
  13097. this.panels.each( function() {
  13098. maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
  13099. } ).height( maxHeight );
  13100. }
  13101. },
  13102. _eventHandler: function( event ) {
  13103. var options = this.options,
  13104. active = this.active,
  13105. anchor = $( event.currentTarget ),
  13106. tab = anchor.closest( "li" ),
  13107. clickedIsActive = tab[ 0 ] === active[ 0 ],
  13108. collapsing = clickedIsActive && options.collapsible,
  13109. toShow = collapsing ? $() : this._getPanelForTab( tab ),
  13110. toHide = !active.length ? $() : this._getPanelForTab( active ),
  13111. eventData = {
  13112. oldTab: active,
  13113. oldPanel: toHide,
  13114. newTab: collapsing ? $() : tab,
  13115. newPanel: toShow
  13116. };
  13117. event.preventDefault();
  13118. if ( tab.hasClass( "ui-state-disabled" ) ||
  13119. // tab is already loading
  13120. tab.hasClass( "ui-tabs-loading" ) ||
  13121. // can't switch durning an animation
  13122. this.running ||
  13123. // click on active header, but not collapsible
  13124. ( clickedIsActive && !options.collapsible ) ||
  13125. // allow canceling activation
  13126. ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
  13127. return;
  13128. }
  13129. options.active = collapsing ? false : this.tabs.index( tab );
  13130. this.active = clickedIsActive ? $() : tab;
  13131. if ( this.xhr ) {
  13132. this.xhr.abort();
  13133. }
  13134. if ( !toHide.length && !toShow.length ) {
  13135. $.error( "jQuery UI Tabs: Mismatching fragment identifier." );
  13136. }
  13137. if ( toShow.length ) {
  13138. this.load( this.tabs.index( tab ), event );
  13139. }
  13140. this._toggle( event, eventData );
  13141. },
  13142. // Handles show/hide for selecting tabs
  13143. _toggle: function( event, eventData ) {
  13144. var that = this,
  13145. toShow = eventData.newPanel,
  13146. toHide = eventData.oldPanel;
  13147. this.running = true;
  13148. function complete() {
  13149. that.running = false;
  13150. that._trigger( "activate", event, eventData );
  13151. }
  13152. function show() {
  13153. that._addClass( eventData.newTab.closest( "li" ), "ui-tabs-active", "ui-state-active" );
  13154. if ( toShow.length && that.options.show ) {
  13155. that._show( toShow, that.options.show, complete );
  13156. } else {
  13157. toShow.show();
  13158. complete();
  13159. }
  13160. }
  13161. // Start out by hiding, then showing, then completing
  13162. if ( toHide.length && this.options.hide ) {
  13163. this._hide( toHide, this.options.hide, function() {
  13164. that._removeClass( eventData.oldTab.closest( "li" ),
  13165. "ui-tabs-active", "ui-state-active" );
  13166. show();
  13167. } );
  13168. } else {
  13169. this._removeClass( eventData.oldTab.closest( "li" ),
  13170. "ui-tabs-active", "ui-state-active" );
  13171. toHide.hide();
  13172. show();
  13173. }
  13174. toHide.attr( "aria-hidden", "true" );
  13175. eventData.oldTab.attr( {
  13176. "aria-selected": "false",
  13177. "aria-expanded": "false"
  13178. } );
  13179. // If we're switching tabs, remove the old tab from the tab order.
  13180. // If we're opening from collapsed state, remove the previous tab from the tab order.
  13181. // If we're collapsing, then keep the collapsing tab in the tab order.
  13182. if ( toShow.length && toHide.length ) {
  13183. eventData.oldTab.attr( "tabIndex", -1 );
  13184. } else if ( toShow.length ) {
  13185. this.tabs.filter( function() {
  13186. return $( this ).attr( "tabIndex" ) === 0;
  13187. } )
  13188. .attr( "tabIndex", -1 );
  13189. }
  13190. toShow.attr( "aria-hidden", "false" );
  13191. eventData.newTab.attr( {
  13192. "aria-selected": "true",
  13193. "aria-expanded": "true",
  13194. tabIndex: 0
  13195. } );
  13196. },
  13197. _activate: function( index ) {
  13198. var anchor,
  13199. active = this._findActive( index );
  13200. // Trying to activate the already active panel
  13201. if ( active[ 0 ] === this.active[ 0 ] ) {
  13202. return;
  13203. }
  13204. // Trying to collapse, simulate a click on the current active header
  13205. if ( !active.length ) {
  13206. active = this.active;
  13207. }
  13208. anchor = active.find( ".ui-tabs-anchor" )[ 0 ];
  13209. this._eventHandler( {
  13210. target: anchor,
  13211. currentTarget: anchor,
  13212. preventDefault: $.noop
  13213. } );
  13214. },
  13215. _findActive: function( index ) {
  13216. return index === false ? $() : this.tabs.eq( index );
  13217. },
  13218. _getIndex: function( index ) {
  13219. // meta-function to give users option to provide a href string instead of a numerical index.
  13220. if ( typeof index === "string" ) {
  13221. index = this.anchors.index( this.anchors.filter( "[href$='" +
  13222. $.escapeSelector( index ) + "']" ) );
  13223. }
  13224. return index;
  13225. },
  13226. _destroy: function() {
  13227. if ( this.xhr ) {
  13228. this.xhr.abort();
  13229. }
  13230. this.tablist
  13231. .removeAttr( "role" )
  13232. .off( this.eventNamespace );
  13233. this.anchors
  13234. .removeAttr( "role tabIndex" )
  13235. .removeUniqueId();
  13236. this.tabs.add( this.panels ).each( function() {
  13237. if ( $.data( this, "ui-tabs-destroy" ) ) {
  13238. $( this ).remove();
  13239. } else {
  13240. $( this ).removeAttr( "role tabIndex " +
  13241. "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded" );
  13242. }
  13243. } );
  13244. this.tabs.each( function() {
  13245. var li = $( this ),
  13246. prev = li.data( "ui-tabs-aria-controls" );
  13247. if ( prev ) {
  13248. li
  13249. .attr( "aria-controls", prev )
  13250. .removeData( "ui-tabs-aria-controls" );
  13251. } else {
  13252. li.removeAttr( "aria-controls" );
  13253. }
  13254. } );
  13255. this.panels.show();
  13256. if ( this.options.heightStyle !== "content" ) {
  13257. this.panels.css( "height", "" );
  13258. }
  13259. },
  13260. enable: function( index ) {
  13261. var disabled = this.options.disabled;
  13262. if ( disabled === false ) {
  13263. return;
  13264. }
  13265. if ( index === undefined ) {
  13266. disabled = false;
  13267. } else {
  13268. index = this._getIndex( index );
  13269. if ( Array.isArray( disabled ) ) {
  13270. disabled = $.map( disabled, function( num ) {
  13271. return num !== index ? num : null;
  13272. } );
  13273. } else {
  13274. disabled = $.map( this.tabs, function( li, num ) {
  13275. return num !== index ? num : null;
  13276. } );
  13277. }
  13278. }
  13279. this._setOptionDisabled( disabled );
  13280. },
  13281. disable: function( index ) {
  13282. var disabled = this.options.disabled;
  13283. if ( disabled === true ) {
  13284. return;
  13285. }
  13286. if ( index === undefined ) {
  13287. disabled = true;
  13288. } else {
  13289. index = this._getIndex( index );
  13290. if ( $.inArray( index, disabled ) !== -1 ) {
  13291. return;
  13292. }
  13293. if ( Array.isArray( disabled ) ) {
  13294. disabled = $.merge( [ index ], disabled ).sort();
  13295. } else {
  13296. disabled = [ index ];
  13297. }
  13298. }
  13299. this._setOptionDisabled( disabled );
  13300. },
  13301. load: function( index, event ) {
  13302. index = this._getIndex( index );
  13303. var that = this,
  13304. tab = this.tabs.eq( index ),
  13305. anchor = tab.find( ".ui-tabs-anchor" ),
  13306. panel = this._getPanelForTab( tab ),
  13307. eventData = {
  13308. tab: tab,
  13309. panel: panel
  13310. },
  13311. complete = function( jqXHR, status ) {
  13312. if ( status === "abort" ) {
  13313. that.panels.stop( false, true );
  13314. }
  13315. that._removeClass( tab, "ui-tabs-loading" );
  13316. panel.removeAttr( "aria-busy" );
  13317. if ( jqXHR === that.xhr ) {
  13318. delete that.xhr;
  13319. }
  13320. };
  13321. // Not remote
  13322. if ( this._isLocal( anchor[ 0 ] ) ) {
  13323. return;
  13324. }
  13325. this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
  13326. // Support: jQuery <1.8
  13327. // jQuery <1.8 returns false if the request is canceled in beforeSend,
  13328. // but as of 1.8, $.ajax() always returns a jqXHR object.
  13329. if ( this.xhr && this.xhr.statusText !== "canceled" ) {
  13330. this._addClass( tab, "ui-tabs-loading" );
  13331. panel.attr( "aria-busy", "true" );
  13332. this.xhr
  13333. .done( function( response, status, jqXHR ) {
  13334. // support: jQuery <1.8
  13335. // http://bugs.jquery.com/ticket/11778
  13336. setTimeout( function() {
  13337. panel.html( response );
  13338. that._trigger( "load", event, eventData );
  13339. complete( jqXHR, status );
  13340. }, 1 );
  13341. } )
  13342. .fail( function( jqXHR, status ) {
  13343. // support: jQuery <1.8
  13344. // http://bugs.jquery.com/ticket/11778
  13345. setTimeout( function() {
  13346. complete( jqXHR, status );
  13347. }, 1 );
  13348. } );
  13349. }
  13350. },
  13351. _ajaxSettings: function( anchor, event, eventData ) {
  13352. var that = this;
  13353. return {
  13354. // Support: IE <11 only
  13355. // Strip any hash that exists to prevent errors with the Ajax request
  13356. url: anchor.attr( "href" ).replace( /#.*$/, "" ),
  13357. beforeSend: function( jqXHR, settings ) {
  13358. return that._trigger( "beforeLoad", event,
  13359. $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) );
  13360. }
  13361. };
  13362. },
  13363. _getPanelForTab: function( tab ) {
  13364. var id = $( tab ).attr( "aria-controls" );
  13365. return this.element.find( this._sanitizeSelector( "#" + id ) );
  13366. }
  13367. } );
  13368. // DEPRECATED
  13369. // TODO: Switch return back to widget declaration at top of file when this is removed
  13370. if ( $.uiBackCompat !== false ) {
  13371. // Backcompat for ui-tab class (now ui-tabs-tab)
  13372. $.widget( "ui.tabs", $.ui.tabs, {
  13373. _processTabs: function() {
  13374. this._superApply( arguments );
  13375. this._addClass( this.tabs, "ui-tab" );
  13376. }
  13377. } );
  13378. }
  13379. var widgetsTabs = $.ui.tabs;
  13380. /*!
  13381. * jQuery UI Tooltip 1.13.2
  13382. * http://jqueryui.com
  13383. *
  13384. * Copyright jQuery Foundation and other contributors
  13385. * Released under the MIT license.
  13386. * http://jquery.org/license
  13387. */
  13388. //>>label: Tooltip
  13389. //>>group: Widgets
  13390. //>>description: Shows additional information for any element on hover or focus.
  13391. //>>docs: http://api.jqueryui.com/tooltip/
  13392. //>>demos: http://jqueryui.com/tooltip/
  13393. //>>css.structure: ../../themes/base/core.css
  13394. //>>css.structure: ../../themes/base/tooltip.css
  13395. //>>css.theme: ../../themes/base/theme.css
  13396. $.widget( "ui.tooltip", {
  13397. version: "1.13.2",
  13398. options: {
  13399. classes: {
  13400. "ui-tooltip": "ui-corner-all ui-widget-shadow"
  13401. },
  13402. content: function() {
  13403. var title = $( this ).attr( "title" );
  13404. // Escape title, since we're going from an attribute to raw HTML
  13405. return $( "<a>" ).text( title ).html();
  13406. },
  13407. hide: true,
  13408. // Disabled elements have inconsistent behavior across browsers (#8661)
  13409. items: "[title]:not([disabled])",
  13410. position: {
  13411. my: "left top+15",
  13412. at: "left bottom",
  13413. collision: "flipfit flip"
  13414. },
  13415. show: true,
  13416. track: false,
  13417. // Callbacks
  13418. close: null,
  13419. open: null
  13420. },
  13421. _addDescribedBy: function( elem, id ) {
  13422. var describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ );
  13423. describedby.push( id );
  13424. elem
  13425. .data( "ui-tooltip-id", id )
  13426. .attr( "aria-describedby", String.prototype.trim.call( describedby.join( " " ) ) );
  13427. },
  13428. _removeDescribedBy: function( elem ) {
  13429. var id = elem.data( "ui-tooltip-id" ),
  13430. describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ),
  13431. index = $.inArray( id, describedby );
  13432. if ( index !== -1 ) {
  13433. describedby.splice( index, 1 );
  13434. }
  13435. elem.removeData( "ui-tooltip-id" );
  13436. describedby = String.prototype.trim.call( describedby.join( " " ) );
  13437. if ( describedby ) {
  13438. elem.attr( "aria-describedby", describedby );
  13439. } else {
  13440. elem.removeAttr( "aria-describedby" );
  13441. }
  13442. },
  13443. _create: function() {
  13444. this._on( {
  13445. mouseover: "open",
  13446. focusin: "open"
  13447. } );
  13448. // IDs of generated tooltips, needed for destroy
  13449. this.tooltips = {};
  13450. // IDs of parent tooltips where we removed the title attribute
  13451. this.parents = {};
  13452. // Append the aria-live region so tooltips announce correctly
  13453. this.liveRegion = $( "<div>" )
  13454. .attr( {
  13455. role: "log",
  13456. "aria-live": "assertive",
  13457. "aria-relevant": "additions"
  13458. } )
  13459. .appendTo( this.document[ 0 ].body );
  13460. this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" );
  13461. this.disabledTitles = $( [] );
  13462. },
  13463. _setOption: function( key, value ) {
  13464. var that = this;
  13465. this._super( key, value );
  13466. if ( key === "content" ) {
  13467. $.each( this.tooltips, function( id, tooltipData ) {
  13468. that._updateContent( tooltipData.element );
  13469. } );
  13470. }
  13471. },
  13472. _setOptionDisabled: function( value ) {
  13473. this[ value ? "_disable" : "_enable" ]();
  13474. },
  13475. _disable: function() {
  13476. var that = this;
  13477. // Close open tooltips
  13478. $.each( this.tooltips, function( id, tooltipData ) {
  13479. var event = $.Event( "blur" );
  13480. event.target = event.currentTarget = tooltipData.element[ 0 ];
  13481. that.close( event, true );
  13482. } );
  13483. // Remove title attributes to prevent native tooltips
  13484. this.disabledTitles = this.disabledTitles.add(
  13485. this.element.find( this.options.items ).addBack()
  13486. .filter( function() {
  13487. var element = $( this );
  13488. if ( element.is( "[title]" ) ) {
  13489. return element
  13490. .data( "ui-tooltip-title", element.attr( "title" ) )
  13491. .removeAttr( "title" );
  13492. }
  13493. } )
  13494. );
  13495. },
  13496. _enable: function() {
  13497. // restore title attributes
  13498. this.disabledTitles.each( function() {
  13499. var element = $( this );
  13500. if ( element.data( "ui-tooltip-title" ) ) {
  13501. element.attr( "title", element.data( "ui-tooltip-title" ) );
  13502. }
  13503. } );
  13504. this.disabledTitles = $( [] );
  13505. },
  13506. open: function( event ) {
  13507. var that = this,
  13508. target = $( event ? event.target : this.element )
  13509. // we need closest here due to mouseover bubbling,
  13510. // but always pointing at the same event target
  13511. .closest( this.options.items );
  13512. // No element to show a tooltip for or the tooltip is already open
  13513. if ( !target.length || target.data( "ui-tooltip-id" ) ) {
  13514. return;
  13515. }
  13516. if ( target.attr( "title" ) ) {
  13517. target.data( "ui-tooltip-title", target.attr( "title" ) );
  13518. }
  13519. target.data( "ui-tooltip-open", true );
  13520. // Kill parent tooltips, custom or native, for hover
  13521. if ( event && event.type === "mouseover" ) {
  13522. target.parents().each( function() {
  13523. var parent = $( this ),
  13524. blurEvent;
  13525. if ( parent.data( "ui-tooltip-open" ) ) {
  13526. blurEvent = $.Event( "blur" );
  13527. blurEvent.target = blurEvent.currentTarget = this;
  13528. that.close( blurEvent, true );
  13529. }
  13530. if ( parent.attr( "title" ) ) {
  13531. parent.uniqueId();
  13532. that.parents[ this.id ] = {
  13533. element: this,
  13534. title: parent.attr( "title" )
  13535. };
  13536. parent.attr( "title", "" );
  13537. }
  13538. } );
  13539. }
  13540. this._registerCloseHandlers( event, target );
  13541. this._updateContent( target, event );
  13542. },
  13543. _updateContent: function( target, event ) {
  13544. var content,
  13545. contentOption = this.options.content,
  13546. that = this,
  13547. eventType = event ? event.type : null;
  13548. if ( typeof contentOption === "string" || contentOption.nodeType ||
  13549. contentOption.jquery ) {
  13550. return this._open( event, target, contentOption );
  13551. }
  13552. content = contentOption.call( target[ 0 ], function( response ) {
  13553. // IE may instantly serve a cached response for ajax requests
  13554. // delay this call to _open so the other call to _open runs first
  13555. that._delay( function() {
  13556. // Ignore async response if tooltip was closed already
  13557. if ( !target.data( "ui-tooltip-open" ) ) {
  13558. return;
  13559. }
  13560. // JQuery creates a special event for focusin when it doesn't
  13561. // exist natively. To improve performance, the native event
  13562. // object is reused and the type is changed. Therefore, we can't
  13563. // rely on the type being correct after the event finished
  13564. // bubbling, so we set it back to the previous value. (#8740)
  13565. if ( event ) {
  13566. event.type = eventType;
  13567. }
  13568. this._open( event, target, response );
  13569. } );
  13570. } );
  13571. if ( content ) {
  13572. this._open( event, target, content );
  13573. }
  13574. },
  13575. _open: function( event, target, content ) {
  13576. var tooltipData, tooltip, delayedShow, a11yContent,
  13577. positionOption = $.extend( {}, this.options.position );
  13578. if ( !content ) {
  13579. return;
  13580. }
  13581. // Content can be updated multiple times. If the tooltip already
  13582. // exists, then just update the content and bail.
  13583. tooltipData = this._find( target );
  13584. if ( tooltipData ) {
  13585. tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content );
  13586. return;
  13587. }
  13588. // If we have a title, clear it to prevent the native tooltip
  13589. // we have to check first to avoid defining a title if none exists
  13590. // (we don't want to cause an element to start matching [title])
  13591. //
  13592. // We use removeAttr only for key events, to allow IE to export the correct
  13593. // accessible attributes. For mouse events, set to empty string to avoid
  13594. // native tooltip showing up (happens only when removing inside mouseover).
  13595. if ( target.is( "[title]" ) ) {
  13596. if ( event && event.type === "mouseover" ) {
  13597. target.attr( "title", "" );
  13598. } else {
  13599. target.removeAttr( "title" );
  13600. }
  13601. }
  13602. tooltipData = this._tooltip( target );
  13603. tooltip = tooltipData.tooltip;
  13604. this._addDescribedBy( target, tooltip.attr( "id" ) );
  13605. tooltip.find( ".ui-tooltip-content" ).html( content );
  13606. // Support: Voiceover on OS X, JAWS on IE <= 9
  13607. // JAWS announces deletions even when aria-relevant="additions"
  13608. // Voiceover will sometimes re-read the entire log region's contents from the beginning
  13609. this.liveRegion.children().hide();
  13610. a11yContent = $( "<div>" ).html( tooltip.find( ".ui-tooltip-content" ).html() );
  13611. a11yContent.removeAttr( "name" ).find( "[name]" ).removeAttr( "name" );
  13612. a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" );
  13613. a11yContent.appendTo( this.liveRegion );
  13614. function position( event ) {
  13615. positionOption.of = event;
  13616. if ( tooltip.is( ":hidden" ) ) {
  13617. return;
  13618. }
  13619. tooltip.position( positionOption );
  13620. }
  13621. if ( this.options.track && event && /^mouse/.test( event.type ) ) {
  13622. this._on( this.document, {
  13623. mousemove: position
  13624. } );
  13625. // trigger once to override element-relative positioning
  13626. position( event );
  13627. } else {
  13628. tooltip.position( $.extend( {
  13629. of: target
  13630. }, this.options.position ) );
  13631. }
  13632. tooltip.hide();
  13633. this._show( tooltip, this.options.show );
  13634. // Handle tracking tooltips that are shown with a delay (#8644). As soon
  13635. // as the tooltip is visible, position the tooltip using the most recent
  13636. // event.
  13637. // Adds the check to add the timers only when both delay and track options are set (#14682)
  13638. if ( this.options.track && this.options.show && this.options.show.delay ) {
  13639. delayedShow = this.delayedShow = setInterval( function() {
  13640. if ( tooltip.is( ":visible" ) ) {
  13641. position( positionOption.of );
  13642. clearInterval( delayedShow );
  13643. }
  13644. }, 13 );
  13645. }
  13646. this._trigger( "open", event, { tooltip: tooltip } );
  13647. },
  13648. _registerCloseHandlers: function( event, target ) {
  13649. var events = {
  13650. keyup: function( event ) {
  13651. if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
  13652. var fakeEvent = $.Event( event );
  13653. fakeEvent.currentTarget = target[ 0 ];
  13654. this.close( fakeEvent, true );
  13655. }
  13656. }
  13657. };
  13658. // Only bind remove handler for delegated targets. Non-delegated
  13659. // tooltips will handle this in destroy.
  13660. if ( target[ 0 ] !== this.element[ 0 ] ) {
  13661. events.remove = function() {
  13662. var targetElement = this._find( target );
  13663. if ( targetElement ) {
  13664. this._removeTooltip( targetElement.tooltip );
  13665. }
  13666. };
  13667. }
  13668. if ( !event || event.type === "mouseover" ) {
  13669. events.mouseleave = "close";
  13670. }
  13671. if ( !event || event.type === "focusin" ) {
  13672. events.focusout = "close";
  13673. }
  13674. this._on( true, target, events );
  13675. },
  13676. close: function( event ) {
  13677. var tooltip,
  13678. that = this,
  13679. target = $( event ? event.currentTarget : this.element ),
  13680. tooltipData = this._find( target );
  13681. // The tooltip may already be closed
  13682. if ( !tooltipData ) {
  13683. // We set ui-tooltip-open immediately upon open (in open()), but only set the
  13684. // additional data once there's actually content to show (in _open()). So even if the
  13685. // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in
  13686. // the period between open() and _open().
  13687. target.removeData( "ui-tooltip-open" );
  13688. return;
  13689. }
  13690. tooltip = tooltipData.tooltip;
  13691. // Disabling closes the tooltip, so we need to track when we're closing
  13692. // to avoid an infinite loop in case the tooltip becomes disabled on close
  13693. if ( tooltipData.closing ) {
  13694. return;
  13695. }
  13696. // Clear the interval for delayed tracking tooltips
  13697. clearInterval( this.delayedShow );
  13698. // Only set title if we had one before (see comment in _open())
  13699. // If the title attribute has changed since open(), don't restore
  13700. if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) {
  13701. target.attr( "title", target.data( "ui-tooltip-title" ) );
  13702. }
  13703. this._removeDescribedBy( target );
  13704. tooltipData.hiding = true;
  13705. tooltip.stop( true );
  13706. this._hide( tooltip, this.options.hide, function() {
  13707. that._removeTooltip( $( this ) );
  13708. } );
  13709. target.removeData( "ui-tooltip-open" );
  13710. this._off( target, "mouseleave focusout keyup" );
  13711. // Remove 'remove' binding only on delegated targets
  13712. if ( target[ 0 ] !== this.element[ 0 ] ) {
  13713. this._off( target, "remove" );
  13714. }
  13715. this._off( this.document, "mousemove" );
  13716. if ( event && event.type === "mouseleave" ) {
  13717. $.each( this.parents, function( id, parent ) {
  13718. $( parent.element ).attr( "title", parent.title );
  13719. delete that.parents[ id ];
  13720. } );
  13721. }
  13722. tooltipData.closing = true;
  13723. this._trigger( "close", event, { tooltip: tooltip } );
  13724. if ( !tooltipData.hiding ) {
  13725. tooltipData.closing = false;
  13726. }
  13727. },
  13728. _tooltip: function( element ) {
  13729. var tooltip = $( "<div>" ).attr( "role", "tooltip" ),
  13730. content = $( "<div>" ).appendTo( tooltip ),
  13731. id = tooltip.uniqueId().attr( "id" );
  13732. this._addClass( content, "ui-tooltip-content" );
  13733. this._addClass( tooltip, "ui-tooltip", "ui-widget ui-widget-content" );
  13734. tooltip.appendTo( this._appendTo( element ) );
  13735. return this.tooltips[ id ] = {
  13736. element: element,
  13737. tooltip: tooltip
  13738. };
  13739. },
  13740. _find: function( target ) {
  13741. var id = target.data( "ui-tooltip-id" );
  13742. return id ? this.tooltips[ id ] : null;
  13743. },
  13744. _removeTooltip: function( tooltip ) {
  13745. // Clear the interval for delayed tracking tooltips
  13746. clearInterval( this.delayedShow );
  13747. tooltip.remove();
  13748. delete this.tooltips[ tooltip.attr( "id" ) ];
  13749. },
  13750. _appendTo: function( target ) {
  13751. var element = target.closest( ".ui-front, dialog" );
  13752. if ( !element.length ) {
  13753. element = this.document[ 0 ].body;
  13754. }
  13755. return element;
  13756. },
  13757. _destroy: function() {
  13758. var that = this;
  13759. // Close open tooltips
  13760. $.each( this.tooltips, function( id, tooltipData ) {
  13761. // Delegate to close method to handle common cleanup
  13762. var event = $.Event( "blur" ),
  13763. element = tooltipData.element;
  13764. event.target = event.currentTarget = element[ 0 ];
  13765. that.close( event, true );
  13766. // Remove immediately; destroying an open tooltip doesn't use the
  13767. // hide animation
  13768. $( "#" + id ).remove();
  13769. // Restore the title
  13770. if ( element.data( "ui-tooltip-title" ) ) {
  13771. // If the title attribute has changed since open(), don't restore
  13772. if ( !element.attr( "title" ) ) {
  13773. element.attr( "title", element.data( "ui-tooltip-title" ) );
  13774. }
  13775. element.removeData( "ui-tooltip-title" );
  13776. }
  13777. } );
  13778. this.liveRegion.remove();
  13779. }
  13780. } );
  13781. // DEPRECATED
  13782. // TODO: Switch return back to widget declaration at top of file when this is removed
  13783. if ( $.uiBackCompat !== false ) {
  13784. // Backcompat for tooltipClass option
  13785. $.widget( "ui.tooltip", $.ui.tooltip, {
  13786. options: {
  13787. tooltipClass: null
  13788. },
  13789. _tooltip: function() {
  13790. var tooltipData = this._superApply( arguments );
  13791. if ( this.options.tooltipClass ) {
  13792. tooltipData.tooltip.addClass( this.options.tooltipClass );
  13793. }
  13794. return tooltipData;
  13795. }
  13796. } );
  13797. }
  13798. var widgetsTooltip = $.ui.tooltip;
  13799. // Create a local jQuery because jQuery Color relies on it and the
  13800. // global may not exist with AMD and a custom build (#10199).
  13801. // This module is a noop if used as a regular AMD module.
  13802. // eslint-disable-next-line no-unused-vars
  13803. var jQuery = $;
  13804. /*!
  13805. * jQuery Color Animations v2.2.0
  13806. * https://github.com/jquery/jquery-color
  13807. *
  13808. * Copyright OpenJS Foundation and other contributors
  13809. * Released under the MIT license.
  13810. * http://jquery.org/license
  13811. *
  13812. * Date: Sun May 10 09:02:36 2020 +0200
  13813. */
  13814. var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " +
  13815. "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
  13816. class2type = {},
  13817. toString = class2type.toString,
  13818. // plusequals test for += 100 -= 100
  13819. rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
  13820. // a set of RE's that can match strings and generate color tuples.
  13821. stringParsers = [ {
  13822. re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  13823. parse: function( execResult ) {
  13824. return [
  13825. execResult[ 1 ],
  13826. execResult[ 2 ],
  13827. execResult[ 3 ],
  13828. execResult[ 4 ]
  13829. ];
  13830. }
  13831. }, {
  13832. re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  13833. parse: function( execResult ) {
  13834. return [
  13835. execResult[ 1 ] * 2.55,
  13836. execResult[ 2 ] * 2.55,
  13837. execResult[ 3 ] * 2.55,
  13838. execResult[ 4 ]
  13839. ];
  13840. }
  13841. }, {
  13842. // this regex ignores A-F because it's compared against an already lowercased string
  13843. re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/,
  13844. parse: function( execResult ) {
  13845. return [
  13846. parseInt( execResult[ 1 ], 16 ),
  13847. parseInt( execResult[ 2 ], 16 ),
  13848. parseInt( execResult[ 3 ], 16 ),
  13849. execResult[ 4 ] ?
  13850. ( parseInt( execResult[ 4 ], 16 ) / 255 ).toFixed( 2 ) :
  13851. 1
  13852. ];
  13853. }
  13854. }, {
  13855. // this regex ignores A-F because it's compared against an already lowercased string
  13856. re: /#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/,
  13857. parse: function( execResult ) {
  13858. return [
  13859. parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
  13860. parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
  13861. parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ),
  13862. execResult[ 4 ] ?
  13863. ( parseInt( execResult[ 4 ] + execResult[ 4 ], 16 ) / 255 )
  13864. .toFixed( 2 ) :
  13865. 1
  13866. ];
  13867. }
  13868. }, {
  13869. re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  13870. space: "hsla",
  13871. parse: function( execResult ) {
  13872. return [
  13873. execResult[ 1 ],
  13874. execResult[ 2 ] / 100,
  13875. execResult[ 3 ] / 100,
  13876. execResult[ 4 ]
  13877. ];
  13878. }
  13879. } ],
  13880. // jQuery.Color( )
  13881. color = jQuery.Color = function( color, green, blue, alpha ) {
  13882. return new jQuery.Color.fn.parse( color, green, blue, alpha );
  13883. },
  13884. spaces = {
  13885. rgba: {
  13886. props: {
  13887. red: {
  13888. idx: 0,
  13889. type: "byte"
  13890. },
  13891. green: {
  13892. idx: 1,
  13893. type: "byte"
  13894. },
  13895. blue: {
  13896. idx: 2,
  13897. type: "byte"
  13898. }
  13899. }
  13900. },
  13901. hsla: {
  13902. props: {
  13903. hue: {
  13904. idx: 0,
  13905. type: "degrees"
  13906. },
  13907. saturation: {
  13908. idx: 1,
  13909. type: "percent"
  13910. },
  13911. lightness: {
  13912. idx: 2,
  13913. type: "percent"
  13914. }
  13915. }
  13916. }
  13917. },
  13918. propTypes = {
  13919. "byte": {
  13920. floor: true,
  13921. max: 255
  13922. },
  13923. "percent": {
  13924. max: 1
  13925. },
  13926. "degrees": {
  13927. mod: 360,
  13928. floor: true
  13929. }
  13930. },
  13931. support = color.support = {},
  13932. // element for support tests
  13933. supportElem = jQuery( "<p>" )[ 0 ],
  13934. // colors = jQuery.Color.names
  13935. colors,
  13936. // local aliases of functions called often
  13937. each = jQuery.each;
  13938. // determine rgba support immediately
  13939. supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
  13940. support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
  13941. // define cache name and alpha properties
  13942. // for rgba and hsla spaces
  13943. each( spaces, function( spaceName, space ) {
  13944. space.cache = "_" + spaceName;
  13945. space.props.alpha = {
  13946. idx: 3,
  13947. type: "percent",
  13948. def: 1
  13949. };
  13950. } );
  13951. // Populate the class2type map
  13952. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  13953. function( _i, name ) {
  13954. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  13955. } );
  13956. function getType( obj ) {
  13957. if ( obj == null ) {
  13958. return obj + "";
  13959. }
  13960. return typeof obj === "object" ?
  13961. class2type[ toString.call( obj ) ] || "object" :
  13962. typeof obj;
  13963. }
  13964. function clamp( value, prop, allowEmpty ) {
  13965. var type = propTypes[ prop.type ] || {};
  13966. if ( value == null ) {
  13967. return ( allowEmpty || !prop.def ) ? null : prop.def;
  13968. }
  13969. // ~~ is an short way of doing floor for positive numbers
  13970. value = type.floor ? ~~value : parseFloat( value );
  13971. // IE will pass in empty strings as value for alpha,
  13972. // which will hit this case
  13973. if ( isNaN( value ) ) {
  13974. return prop.def;
  13975. }
  13976. if ( type.mod ) {
  13977. // we add mod before modding to make sure that negatives values
  13978. // get converted properly: -10 -> 350
  13979. return ( value + type.mod ) % type.mod;
  13980. }
  13981. // for now all property types without mod have min and max
  13982. return Math.min( type.max, Math.max( 0, value ) );
  13983. }
  13984. function stringParse( string ) {
  13985. var inst = color(),
  13986. rgba = inst._rgba = [];
  13987. string = string.toLowerCase();
  13988. each( stringParsers, function( _i, parser ) {
  13989. var parsed,
  13990. match = parser.re.exec( string ),
  13991. values = match && parser.parse( match ),
  13992. spaceName = parser.space || "rgba";
  13993. if ( values ) {
  13994. parsed = inst[ spaceName ]( values );
  13995. // if this was an rgba parse the assignment might happen twice
  13996. // oh well....
  13997. inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
  13998. rgba = inst._rgba = parsed._rgba;
  13999. // exit each( stringParsers ) here because we matched
  14000. return false;
  14001. }
  14002. } );
  14003. // Found a stringParser that handled it
  14004. if ( rgba.length ) {
  14005. // if this came from a parsed string, force "transparent" when alpha is 0
  14006. // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
  14007. if ( rgba.join() === "0,0,0,0" ) {
  14008. jQuery.extend( rgba, colors.transparent );
  14009. }
  14010. return inst;
  14011. }
  14012. // named colors
  14013. return colors[ string ];
  14014. }
  14015. color.fn = jQuery.extend( color.prototype, {
  14016. parse: function( red, green, blue, alpha ) {
  14017. if ( red === undefined ) {
  14018. this._rgba = [ null, null, null, null ];
  14019. return this;
  14020. }
  14021. if ( red.jquery || red.nodeType ) {
  14022. red = jQuery( red ).css( green );
  14023. green = undefined;
  14024. }
  14025. var inst = this,
  14026. type = getType( red ),
  14027. rgba = this._rgba = [];
  14028. // more than 1 argument specified - assume ( red, green, blue, alpha )
  14029. if ( green !== undefined ) {
  14030. red = [ red, green, blue, alpha ];
  14031. type = "array";
  14032. }
  14033. if ( type === "string" ) {
  14034. return this.parse( stringParse( red ) || colors._default );
  14035. }
  14036. if ( type === "array" ) {
  14037. each( spaces.rgba.props, function( _key, prop ) {
  14038. rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
  14039. } );
  14040. return this;
  14041. }
  14042. if ( type === "object" ) {
  14043. if ( red instanceof color ) {
  14044. each( spaces, function( _spaceName, space ) {
  14045. if ( red[ space.cache ] ) {
  14046. inst[ space.cache ] = red[ space.cache ].slice();
  14047. }
  14048. } );
  14049. } else {
  14050. each( spaces, function( _spaceName, space ) {
  14051. var cache = space.cache;
  14052. each( space.props, function( key, prop ) {
  14053. // if the cache doesn't exist, and we know how to convert
  14054. if ( !inst[ cache ] && space.to ) {
  14055. // if the value was null, we don't need to copy it
  14056. // if the key was alpha, we don't need to copy it either
  14057. if ( key === "alpha" || red[ key ] == null ) {
  14058. return;
  14059. }
  14060. inst[ cache ] = space.to( inst._rgba );
  14061. }
  14062. // this is the only case where we allow nulls for ALL properties.
  14063. // call clamp with alwaysAllowEmpty
  14064. inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
  14065. } );
  14066. // everything defined but alpha?
  14067. if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
  14068. // use the default of 1
  14069. if ( inst[ cache ][ 3 ] == null ) {
  14070. inst[ cache ][ 3 ] = 1;
  14071. }
  14072. if ( space.from ) {
  14073. inst._rgba = space.from( inst[ cache ] );
  14074. }
  14075. }
  14076. } );
  14077. }
  14078. return this;
  14079. }
  14080. },
  14081. is: function( compare ) {
  14082. var is = color( compare ),
  14083. same = true,
  14084. inst = this;
  14085. each( spaces, function( _, space ) {
  14086. var localCache,
  14087. isCache = is[ space.cache ];
  14088. if ( isCache ) {
  14089. localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
  14090. each( space.props, function( _, prop ) {
  14091. if ( isCache[ prop.idx ] != null ) {
  14092. same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
  14093. return same;
  14094. }
  14095. } );
  14096. }
  14097. return same;
  14098. } );
  14099. return same;
  14100. },
  14101. _space: function() {
  14102. var used = [],
  14103. inst = this;
  14104. each( spaces, function( spaceName, space ) {
  14105. if ( inst[ space.cache ] ) {
  14106. used.push( spaceName );
  14107. }
  14108. } );
  14109. return used.pop();
  14110. },
  14111. transition: function( other, distance ) {
  14112. var end = color( other ),
  14113. spaceName = end._space(),
  14114. space = spaces[ spaceName ],
  14115. startColor = this.alpha() === 0 ? color( "transparent" ) : this,
  14116. start = startColor[ space.cache ] || space.to( startColor._rgba ),
  14117. result = start.slice();
  14118. end = end[ space.cache ];
  14119. each( space.props, function( _key, prop ) {
  14120. var index = prop.idx,
  14121. startValue = start[ index ],
  14122. endValue = end[ index ],
  14123. type = propTypes[ prop.type ] || {};
  14124. // if null, don't override start value
  14125. if ( endValue === null ) {
  14126. return;
  14127. }
  14128. // if null - use end
  14129. if ( startValue === null ) {
  14130. result[ index ] = endValue;
  14131. } else {
  14132. if ( type.mod ) {
  14133. if ( endValue - startValue > type.mod / 2 ) {
  14134. startValue += type.mod;
  14135. } else if ( startValue - endValue > type.mod / 2 ) {
  14136. startValue -= type.mod;
  14137. }
  14138. }
  14139. result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
  14140. }
  14141. } );
  14142. return this[ spaceName ]( result );
  14143. },
  14144. blend: function( opaque ) {
  14145. // if we are already opaque - return ourself
  14146. if ( this._rgba[ 3 ] === 1 ) {
  14147. return this;
  14148. }
  14149. var rgb = this._rgba.slice(),
  14150. a = rgb.pop(),
  14151. blend = color( opaque )._rgba;
  14152. return color( jQuery.map( rgb, function( v, i ) {
  14153. return ( 1 - a ) * blend[ i ] + a * v;
  14154. } ) );
  14155. },
  14156. toRgbaString: function() {
  14157. var prefix = "rgba(",
  14158. rgba = jQuery.map( this._rgba, function( v, i ) {
  14159. if ( v != null ) {
  14160. return v;
  14161. }
  14162. return i > 2 ? 1 : 0;
  14163. } );
  14164. if ( rgba[ 3 ] === 1 ) {
  14165. rgba.pop();
  14166. prefix = "rgb(";
  14167. }
  14168. return prefix + rgba.join() + ")";
  14169. },
  14170. toHslaString: function() {
  14171. var prefix = "hsla(",
  14172. hsla = jQuery.map( this.hsla(), function( v, i ) {
  14173. if ( v == null ) {
  14174. v = i > 2 ? 1 : 0;
  14175. }
  14176. // catch 1 and 2
  14177. if ( i && i < 3 ) {
  14178. v = Math.round( v * 100 ) + "%";
  14179. }
  14180. return v;
  14181. } );
  14182. if ( hsla[ 3 ] === 1 ) {
  14183. hsla.pop();
  14184. prefix = "hsl(";
  14185. }
  14186. return prefix + hsla.join() + ")";
  14187. },
  14188. toHexString: function( includeAlpha ) {
  14189. var rgba = this._rgba.slice(),
  14190. alpha = rgba.pop();
  14191. if ( includeAlpha ) {
  14192. rgba.push( ~~( alpha * 255 ) );
  14193. }
  14194. return "#" + jQuery.map( rgba, function( v ) {
  14195. // default to 0 when nulls exist
  14196. v = ( v || 0 ).toString( 16 );
  14197. return v.length === 1 ? "0" + v : v;
  14198. } ).join( "" );
  14199. },
  14200. toString: function() {
  14201. return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
  14202. }
  14203. } );
  14204. color.fn.parse.prototype = color.fn;
  14205. // hsla conversions adapted from:
  14206. // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
  14207. function hue2rgb( p, q, h ) {
  14208. h = ( h + 1 ) % 1;
  14209. if ( h * 6 < 1 ) {
  14210. return p + ( q - p ) * h * 6;
  14211. }
  14212. if ( h * 2 < 1 ) {
  14213. return q;
  14214. }
  14215. if ( h * 3 < 2 ) {
  14216. return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
  14217. }
  14218. return p;
  14219. }
  14220. spaces.hsla.to = function( rgba ) {
  14221. if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
  14222. return [ null, null, null, rgba[ 3 ] ];
  14223. }
  14224. var r = rgba[ 0 ] / 255,
  14225. g = rgba[ 1 ] / 255,
  14226. b = rgba[ 2 ] / 255,
  14227. a = rgba[ 3 ],
  14228. max = Math.max( r, g, b ),
  14229. min = Math.min( r, g, b ),
  14230. diff = max - min,
  14231. add = max + min,
  14232. l = add * 0.5,
  14233. h, s;
  14234. if ( min === max ) {
  14235. h = 0;
  14236. } else if ( r === max ) {
  14237. h = ( 60 * ( g - b ) / diff ) + 360;
  14238. } else if ( g === max ) {
  14239. h = ( 60 * ( b - r ) / diff ) + 120;
  14240. } else {
  14241. h = ( 60 * ( r - g ) / diff ) + 240;
  14242. }
  14243. // chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
  14244. // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
  14245. if ( diff === 0 ) {
  14246. s = 0;
  14247. } else if ( l <= 0.5 ) {
  14248. s = diff / add;
  14249. } else {
  14250. s = diff / ( 2 - add );
  14251. }
  14252. return [ Math.round( h ) % 360, s, l, a == null ? 1 : a ];
  14253. };
  14254. spaces.hsla.from = function( hsla ) {
  14255. if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
  14256. return [ null, null, null, hsla[ 3 ] ];
  14257. }
  14258. var h = hsla[ 0 ] / 360,
  14259. s = hsla[ 1 ],
  14260. l = hsla[ 2 ],
  14261. a = hsla[ 3 ],
  14262. q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
  14263. p = 2 * l - q;
  14264. return [
  14265. Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
  14266. Math.round( hue2rgb( p, q, h ) * 255 ),
  14267. Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
  14268. a
  14269. ];
  14270. };
  14271. each( spaces, function( spaceName, space ) {
  14272. var props = space.props,
  14273. cache = space.cache,
  14274. to = space.to,
  14275. from = space.from;
  14276. // makes rgba() and hsla()
  14277. color.fn[ spaceName ] = function( value ) {
  14278. // generate a cache for this space if it doesn't exist
  14279. if ( to && !this[ cache ] ) {
  14280. this[ cache ] = to( this._rgba );
  14281. }
  14282. if ( value === undefined ) {
  14283. return this[ cache ].slice();
  14284. }
  14285. var ret,
  14286. type = getType( value ),
  14287. arr = ( type === "array" || type === "object" ) ? value : arguments,
  14288. local = this[ cache ].slice();
  14289. each( props, function( key, prop ) {
  14290. var val = arr[ type === "object" ? key : prop.idx ];
  14291. if ( val == null ) {
  14292. val = local[ prop.idx ];
  14293. }
  14294. local[ prop.idx ] = clamp( val, prop );
  14295. } );
  14296. if ( from ) {
  14297. ret = color( from( local ) );
  14298. ret[ cache ] = local;
  14299. return ret;
  14300. } else {
  14301. return color( local );
  14302. }
  14303. };
  14304. // makes red() green() blue() alpha() hue() saturation() lightness()
  14305. each( props, function( key, prop ) {
  14306. // alpha is included in more than one space
  14307. if ( color.fn[ key ] ) {
  14308. return;
  14309. }
  14310. color.fn[ key ] = function( value ) {
  14311. var local, cur, match, fn,
  14312. vtype = getType( value );
  14313. if ( key === "alpha" ) {
  14314. fn = this._hsla ? "hsla" : "rgba";
  14315. } else {
  14316. fn = spaceName;
  14317. }
  14318. local = this[ fn ]();
  14319. cur = local[ prop.idx ];
  14320. if ( vtype === "undefined" ) {
  14321. return cur;
  14322. }
  14323. if ( vtype === "function" ) {
  14324. value = value.call( this, cur );
  14325. vtype = getType( value );
  14326. }
  14327. if ( value == null && prop.empty ) {
  14328. return this;
  14329. }
  14330. if ( vtype === "string" ) {
  14331. match = rplusequals.exec( value );
  14332. if ( match ) {
  14333. value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
  14334. }
  14335. }
  14336. local[ prop.idx ] = value;
  14337. return this[ fn ]( local );
  14338. };
  14339. } );
  14340. } );
  14341. // add cssHook and .fx.step function for each named hook.
  14342. // accept a space separated string of properties
  14343. color.hook = function( hook ) {
  14344. var hooks = hook.split( " " );
  14345. each( hooks, function( _i, hook ) {
  14346. jQuery.cssHooks[ hook ] = {
  14347. set: function( elem, value ) {
  14348. var parsed, curElem,
  14349. backgroundColor = "";
  14350. if ( value !== "transparent" && ( getType( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
  14351. value = color( parsed || value );
  14352. if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
  14353. curElem = hook === "backgroundColor" ? elem.parentNode : elem;
  14354. while (
  14355. ( backgroundColor === "" || backgroundColor === "transparent" ) &&
  14356. curElem && curElem.style
  14357. ) {
  14358. try {
  14359. backgroundColor = jQuery.css( curElem, "backgroundColor" );
  14360. curElem = curElem.parentNode;
  14361. } catch ( e ) {
  14362. }
  14363. }
  14364. value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
  14365. backgroundColor :
  14366. "_default" );
  14367. }
  14368. value = value.toRgbaString();
  14369. }
  14370. try {
  14371. elem.style[ hook ] = value;
  14372. } catch ( e ) {
  14373. // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
  14374. }
  14375. }
  14376. };
  14377. jQuery.fx.step[ hook ] = function( fx ) {
  14378. if ( !fx.colorInit ) {
  14379. fx.start = color( fx.elem, hook );
  14380. fx.end = color( fx.end );
  14381. fx.colorInit = true;
  14382. }
  14383. jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
  14384. };
  14385. } );
  14386. };
  14387. color.hook( stepHooks );
  14388. jQuery.cssHooks.borderColor = {
  14389. expand: function( value ) {
  14390. var expanded = {};
  14391. each( [ "Top", "Right", "Bottom", "Left" ], function( _i, part ) {
  14392. expanded[ "border" + part + "Color" ] = value;
  14393. } );
  14394. return expanded;
  14395. }
  14396. };
  14397. // Basic color names only.
  14398. // Usage of any of the other color names requires adding yourself or including
  14399. // jquery.color.svg-names.js.
  14400. colors = jQuery.Color.names = {
  14401. // 4.1. Basic color keywords
  14402. aqua: "#00ffff",
  14403. black: "#000000",
  14404. blue: "#0000ff",
  14405. fuchsia: "#ff00ff",
  14406. gray: "#808080",
  14407. green: "#008000",
  14408. lime: "#00ff00",
  14409. maroon: "#800000",
  14410. navy: "#000080",
  14411. olive: "#808000",
  14412. purple: "#800080",
  14413. red: "#ff0000",
  14414. silver: "#c0c0c0",
  14415. teal: "#008080",
  14416. white: "#ffffff",
  14417. yellow: "#ffff00",
  14418. // 4.2.3. "transparent" color keyword
  14419. transparent: [ null, null, null, 0 ],
  14420. _default: "#ffffff"
  14421. };
  14422. /*!
  14423. * jQuery UI Effects 1.13.2
  14424. * http://jqueryui.com
  14425. *
  14426. * Copyright jQuery Foundation and other contributors
  14427. * Released under the MIT license.
  14428. * http://jquery.org/license
  14429. */
  14430. //>>label: Effects Core
  14431. //>>group: Effects
  14432. /* eslint-disable max-len */
  14433. //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects.
  14434. /* eslint-enable max-len */
  14435. //>>docs: http://api.jqueryui.com/category/effects-core/
  14436. //>>demos: http://jqueryui.com/effect/
  14437. var dataSpace = "ui-effects-",
  14438. dataSpaceStyle = "ui-effects-style",
  14439. dataSpaceAnimated = "ui-effects-animated";
  14440. $.effects = {
  14441. effect: {}
  14442. };
  14443. /******************************************************************************/
  14444. /****************************** CLASS ANIMATIONS ******************************/
  14445. /******************************************************************************/
  14446. ( function() {
  14447. var classAnimationActions = [ "add", "remove", "toggle" ],
  14448. shorthandStyles = {
  14449. border: 1,
  14450. borderBottom: 1,
  14451. borderColor: 1,
  14452. borderLeft: 1,
  14453. borderRight: 1,
  14454. borderTop: 1,
  14455. borderWidth: 1,
  14456. margin: 1,
  14457. padding: 1
  14458. };
  14459. $.each(
  14460. [ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ],
  14461. function( _, prop ) {
  14462. $.fx.step[ prop ] = function( fx ) {
  14463. if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
  14464. jQuery.style( fx.elem, prop, fx.end );
  14465. fx.setAttr = true;
  14466. }
  14467. };
  14468. }
  14469. );
  14470. function camelCase( string ) {
  14471. return string.replace( /-([\da-z])/gi, function( all, letter ) {
  14472. return letter.toUpperCase();
  14473. } );
  14474. }
  14475. function getElementStyles( elem ) {
  14476. var key, len,
  14477. style = elem.ownerDocument.defaultView ?
  14478. elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
  14479. elem.currentStyle,
  14480. styles = {};
  14481. if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
  14482. len = style.length;
  14483. while ( len-- ) {
  14484. key = style[ len ];
  14485. if ( typeof style[ key ] === "string" ) {
  14486. styles[ camelCase( key ) ] = style[ key ];
  14487. }
  14488. }
  14489. // Support: Opera, IE <9
  14490. } else {
  14491. for ( key in style ) {
  14492. if ( typeof style[ key ] === "string" ) {
  14493. styles[ key ] = style[ key ];
  14494. }
  14495. }
  14496. }
  14497. return styles;
  14498. }
  14499. function styleDifference( oldStyle, newStyle ) {
  14500. var diff = {},
  14501. name, value;
  14502. for ( name in newStyle ) {
  14503. value = newStyle[ name ];
  14504. if ( oldStyle[ name ] !== value ) {
  14505. if ( !shorthandStyles[ name ] ) {
  14506. if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
  14507. diff[ name ] = value;
  14508. }
  14509. }
  14510. }
  14511. }
  14512. return diff;
  14513. }
  14514. // Support: jQuery <1.8
  14515. if ( !$.fn.addBack ) {
  14516. $.fn.addBack = function( selector ) {
  14517. return this.add( selector == null ?
  14518. this.prevObject : this.prevObject.filter( selector )
  14519. );
  14520. };
  14521. }
  14522. $.effects.animateClass = function( value, duration, easing, callback ) {
  14523. var o = $.speed( duration, easing, callback );
  14524. return this.queue( function() {
  14525. var animated = $( this ),
  14526. baseClass = animated.attr( "class" ) || "",
  14527. applyClassChange,
  14528. allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
  14529. // Map the animated objects to store the original styles.
  14530. allAnimations = allAnimations.map( function() {
  14531. var el = $( this );
  14532. return {
  14533. el: el,
  14534. start: getElementStyles( this )
  14535. };
  14536. } );
  14537. // Apply class change
  14538. applyClassChange = function() {
  14539. $.each( classAnimationActions, function( i, action ) {
  14540. if ( value[ action ] ) {
  14541. animated[ action + "Class" ]( value[ action ] );
  14542. }
  14543. } );
  14544. };
  14545. applyClassChange();
  14546. // Map all animated objects again - calculate new styles and diff
  14547. allAnimations = allAnimations.map( function() {
  14548. this.end = getElementStyles( this.el[ 0 ] );
  14549. this.diff = styleDifference( this.start, this.end );
  14550. return this;
  14551. } );
  14552. // Apply original class
  14553. animated.attr( "class", baseClass );
  14554. // Map all animated objects again - this time collecting a promise
  14555. allAnimations = allAnimations.map( function() {
  14556. var styleInfo = this,
  14557. dfd = $.Deferred(),
  14558. opts = $.extend( {}, o, {
  14559. queue: false,
  14560. complete: function() {
  14561. dfd.resolve( styleInfo );
  14562. }
  14563. } );
  14564. this.el.animate( this.diff, opts );
  14565. return dfd.promise();
  14566. } );
  14567. // Once all animations have completed:
  14568. $.when.apply( $, allAnimations.get() ).done( function() {
  14569. // Set the final class
  14570. applyClassChange();
  14571. // For each animated element,
  14572. // clear all css properties that were animated
  14573. $.each( arguments, function() {
  14574. var el = this.el;
  14575. $.each( this.diff, function( key ) {
  14576. el.css( key, "" );
  14577. } );
  14578. } );
  14579. // This is guarnteed to be there if you use jQuery.speed()
  14580. // it also handles dequeuing the next anim...
  14581. o.complete.call( animated[ 0 ] );
  14582. } );
  14583. } );
  14584. };
  14585. $.fn.extend( {
  14586. addClass: ( function( orig ) {
  14587. return function( classNames, speed, easing, callback ) {
  14588. return speed ?
  14589. $.effects.animateClass.call( this,
  14590. { add: classNames }, speed, easing, callback ) :
  14591. orig.apply( this, arguments );
  14592. };
  14593. } )( $.fn.addClass ),
  14594. removeClass: ( function( orig ) {
  14595. return function( classNames, speed, easing, callback ) {
  14596. return arguments.length > 1 ?
  14597. $.effects.animateClass.call( this,
  14598. { remove: classNames }, speed, easing, callback ) :
  14599. orig.apply( this, arguments );
  14600. };
  14601. } )( $.fn.removeClass ),
  14602. toggleClass: ( function( orig ) {
  14603. return function( classNames, force, speed, easing, callback ) {
  14604. if ( typeof force === "boolean" || force === undefined ) {
  14605. if ( !speed ) {
  14606. // Without speed parameter
  14607. return orig.apply( this, arguments );
  14608. } else {
  14609. return $.effects.animateClass.call( this,
  14610. ( force ? { add: classNames } : { remove: classNames } ),
  14611. speed, easing, callback );
  14612. }
  14613. } else {
  14614. // Without force parameter
  14615. return $.effects.animateClass.call( this,
  14616. { toggle: classNames }, force, speed, easing );
  14617. }
  14618. };
  14619. } )( $.fn.toggleClass ),
  14620. switchClass: function( remove, add, speed, easing, callback ) {
  14621. return $.effects.animateClass.call( this, {
  14622. add: add,
  14623. remove: remove
  14624. }, speed, easing, callback );
  14625. }
  14626. } );
  14627. } )();
  14628. /******************************************************************************/
  14629. /*********************************** EFFECTS **********************************/
  14630. /******************************************************************************/
  14631. ( function() {
  14632. if ( $.expr && $.expr.pseudos && $.expr.pseudos.animated ) {
  14633. $.expr.pseudos.animated = ( function( orig ) {
  14634. return function( elem ) {
  14635. return !!$( elem ).data( dataSpaceAnimated ) || orig( elem );
  14636. };
  14637. } )( $.expr.pseudos.animated );
  14638. }
  14639. if ( $.uiBackCompat !== false ) {
  14640. $.extend( $.effects, {
  14641. // Saves a set of properties in a data storage
  14642. save: function( element, set ) {
  14643. var i = 0, length = set.length;
  14644. for ( ; i < length; i++ ) {
  14645. if ( set[ i ] !== null ) {
  14646. element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
  14647. }
  14648. }
  14649. },
  14650. // Restores a set of previously saved properties from a data storage
  14651. restore: function( element, set ) {
  14652. var val, i = 0, length = set.length;
  14653. for ( ; i < length; i++ ) {
  14654. if ( set[ i ] !== null ) {
  14655. val = element.data( dataSpace + set[ i ] );
  14656. element.css( set[ i ], val );
  14657. }
  14658. }
  14659. },
  14660. setMode: function( el, mode ) {
  14661. if ( mode === "toggle" ) {
  14662. mode = el.is( ":hidden" ) ? "show" : "hide";
  14663. }
  14664. return mode;
  14665. },
  14666. // Wraps the element around a wrapper that copies position properties
  14667. createWrapper: function( element ) {
  14668. // If the element is already wrapped, return it
  14669. if ( element.parent().is( ".ui-effects-wrapper" ) ) {
  14670. return element.parent();
  14671. }
  14672. // Wrap the element
  14673. var props = {
  14674. width: element.outerWidth( true ),
  14675. height: element.outerHeight( true ),
  14676. "float": element.css( "float" )
  14677. },
  14678. wrapper = $( "<div></div>" )
  14679. .addClass( "ui-effects-wrapper" )
  14680. .css( {
  14681. fontSize: "100%",
  14682. background: "transparent",
  14683. border: "none",
  14684. margin: 0,
  14685. padding: 0
  14686. } ),
  14687. // Store the size in case width/height are defined in % - Fixes #5245
  14688. size = {
  14689. width: element.width(),
  14690. height: element.height()
  14691. },
  14692. active = document.activeElement;
  14693. // Support: Firefox
  14694. // Firefox incorrectly exposes anonymous content
  14695. // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
  14696. try {
  14697. // eslint-disable-next-line no-unused-expressions
  14698. active.id;
  14699. } catch ( e ) {
  14700. active = document.body;
  14701. }
  14702. element.wrap( wrapper );
  14703. // Fixes #7595 - Elements lose focus when wrapped.
  14704. if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  14705. $( active ).trigger( "focus" );
  14706. }
  14707. // Hotfix for jQuery 1.4 since some change in wrap() seems to actually
  14708. // lose the reference to the wrapped element
  14709. wrapper = element.parent();
  14710. // Transfer positioning properties to the wrapper
  14711. if ( element.css( "position" ) === "static" ) {
  14712. wrapper.css( { position: "relative" } );
  14713. element.css( { position: "relative" } );
  14714. } else {
  14715. $.extend( props, {
  14716. position: element.css( "position" ),
  14717. zIndex: element.css( "z-index" )
  14718. } );
  14719. $.each( [ "top", "left", "bottom", "right" ], function( i, pos ) {
  14720. props[ pos ] = element.css( pos );
  14721. if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
  14722. props[ pos ] = "auto";
  14723. }
  14724. } );
  14725. element.css( {
  14726. position: "relative",
  14727. top: 0,
  14728. left: 0,
  14729. right: "auto",
  14730. bottom: "auto"
  14731. } );
  14732. }
  14733. element.css( size );
  14734. return wrapper.css( props ).show();
  14735. },
  14736. removeWrapper: function( element ) {
  14737. var active = document.activeElement;
  14738. if ( element.parent().is( ".ui-effects-wrapper" ) ) {
  14739. element.parent().replaceWith( element );
  14740. // Fixes #7595 - Elements lose focus when wrapped.
  14741. if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  14742. $( active ).trigger( "focus" );
  14743. }
  14744. }
  14745. return element;
  14746. }
  14747. } );
  14748. }
  14749. $.extend( $.effects, {
  14750. version: "1.13.2",
  14751. define: function( name, mode, effect ) {
  14752. if ( !effect ) {
  14753. effect = mode;
  14754. mode = "effect";
  14755. }
  14756. $.effects.effect[ name ] = effect;
  14757. $.effects.effect[ name ].mode = mode;
  14758. return effect;
  14759. },
  14760. scaledDimensions: function( element, percent, direction ) {
  14761. if ( percent === 0 ) {
  14762. return {
  14763. height: 0,
  14764. width: 0,
  14765. outerHeight: 0,
  14766. outerWidth: 0
  14767. };
  14768. }
  14769. var x = direction !== "horizontal" ? ( ( percent || 100 ) / 100 ) : 1,
  14770. y = direction !== "vertical" ? ( ( percent || 100 ) / 100 ) : 1;
  14771. return {
  14772. height: element.height() * y,
  14773. width: element.width() * x,
  14774. outerHeight: element.outerHeight() * y,
  14775. outerWidth: element.outerWidth() * x
  14776. };
  14777. },
  14778. clipToBox: function( animation ) {
  14779. return {
  14780. width: animation.clip.right - animation.clip.left,
  14781. height: animation.clip.bottom - animation.clip.top,
  14782. left: animation.clip.left,
  14783. top: animation.clip.top
  14784. };
  14785. },
  14786. // Injects recently queued functions to be first in line (after "inprogress")
  14787. unshift: function( element, queueLength, count ) {
  14788. var queue = element.queue();
  14789. if ( queueLength > 1 ) {
  14790. queue.splice.apply( queue,
  14791. [ 1, 0 ].concat( queue.splice( queueLength, count ) ) );
  14792. }
  14793. element.dequeue();
  14794. },
  14795. saveStyle: function( element ) {
  14796. element.data( dataSpaceStyle, element[ 0 ].style.cssText );
  14797. },
  14798. restoreStyle: function( element ) {
  14799. element[ 0 ].style.cssText = element.data( dataSpaceStyle ) || "";
  14800. element.removeData( dataSpaceStyle );
  14801. },
  14802. mode: function( element, mode ) {
  14803. var hidden = element.is( ":hidden" );
  14804. if ( mode === "toggle" ) {
  14805. mode = hidden ? "show" : "hide";
  14806. }
  14807. if ( hidden ? mode === "hide" : mode === "show" ) {
  14808. mode = "none";
  14809. }
  14810. return mode;
  14811. },
  14812. // Translates a [top,left] array into a baseline value
  14813. getBaseline: function( origin, original ) {
  14814. var y, x;
  14815. switch ( origin[ 0 ] ) {
  14816. case "top":
  14817. y = 0;
  14818. break;
  14819. case "middle":
  14820. y = 0.5;
  14821. break;
  14822. case "bottom":
  14823. y = 1;
  14824. break;
  14825. default:
  14826. y = origin[ 0 ] / original.height;
  14827. }
  14828. switch ( origin[ 1 ] ) {
  14829. case "left":
  14830. x = 0;
  14831. break;
  14832. case "center":
  14833. x = 0.5;
  14834. break;
  14835. case "right":
  14836. x = 1;
  14837. break;
  14838. default:
  14839. x = origin[ 1 ] / original.width;
  14840. }
  14841. return {
  14842. x: x,
  14843. y: y
  14844. };
  14845. },
  14846. // Creates a placeholder element so that the original element can be made absolute
  14847. createPlaceholder: function( element ) {
  14848. var placeholder,
  14849. cssPosition = element.css( "position" ),
  14850. position = element.position();
  14851. // Lock in margins first to account for form elements, which
  14852. // will change margin if you explicitly set height
  14853. // see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380
  14854. // Support: Safari
  14855. element.css( {
  14856. marginTop: element.css( "marginTop" ),
  14857. marginBottom: element.css( "marginBottom" ),
  14858. marginLeft: element.css( "marginLeft" ),
  14859. marginRight: element.css( "marginRight" )
  14860. } )
  14861. .outerWidth( element.outerWidth() )
  14862. .outerHeight( element.outerHeight() );
  14863. if ( /^(static|relative)/.test( cssPosition ) ) {
  14864. cssPosition = "absolute";
  14865. placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( {
  14866. // Convert inline to inline block to account for inline elements
  14867. // that turn to inline block based on content (like img)
  14868. display: /^(inline|ruby)/.test( element.css( "display" ) ) ?
  14869. "inline-block" :
  14870. "block",
  14871. visibility: "hidden",
  14872. // Margins need to be set to account for margin collapse
  14873. marginTop: element.css( "marginTop" ),
  14874. marginBottom: element.css( "marginBottom" ),
  14875. marginLeft: element.css( "marginLeft" ),
  14876. marginRight: element.css( "marginRight" ),
  14877. "float": element.css( "float" )
  14878. } )
  14879. .outerWidth( element.outerWidth() )
  14880. .outerHeight( element.outerHeight() )
  14881. .addClass( "ui-effects-placeholder" );
  14882. element.data( dataSpace + "placeholder", placeholder );
  14883. }
  14884. element.css( {
  14885. position: cssPosition,
  14886. left: position.left,
  14887. top: position.top
  14888. } );
  14889. return placeholder;
  14890. },
  14891. removePlaceholder: function( element ) {
  14892. var dataKey = dataSpace + "placeholder",
  14893. placeholder = element.data( dataKey );
  14894. if ( placeholder ) {
  14895. placeholder.remove();
  14896. element.removeData( dataKey );
  14897. }
  14898. },
  14899. // Removes a placeholder if it exists and restores
  14900. // properties that were modified during placeholder creation
  14901. cleanUp: function( element ) {
  14902. $.effects.restoreStyle( element );
  14903. $.effects.removePlaceholder( element );
  14904. },
  14905. setTransition: function( element, list, factor, value ) {
  14906. value = value || {};
  14907. $.each( list, function( i, x ) {
  14908. var unit = element.cssUnit( x );
  14909. if ( unit[ 0 ] > 0 ) {
  14910. value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
  14911. }
  14912. } );
  14913. return value;
  14914. }
  14915. } );
  14916. // Return an effect options object for the given parameters:
  14917. function _normalizeArguments( effect, options, speed, callback ) {
  14918. // Allow passing all options as the first parameter
  14919. if ( $.isPlainObject( effect ) ) {
  14920. options = effect;
  14921. effect = effect.effect;
  14922. }
  14923. // Convert to an object
  14924. effect = { effect: effect };
  14925. // Catch (effect, null, ...)
  14926. if ( options == null ) {
  14927. options = {};
  14928. }
  14929. // Catch (effect, callback)
  14930. if ( typeof options === "function" ) {
  14931. callback = options;
  14932. speed = null;
  14933. options = {};
  14934. }
  14935. // Catch (effect, speed, ?)
  14936. if ( typeof options === "number" || $.fx.speeds[ options ] ) {
  14937. callback = speed;
  14938. speed = options;
  14939. options = {};
  14940. }
  14941. // Catch (effect, options, callback)
  14942. if ( typeof speed === "function" ) {
  14943. callback = speed;
  14944. speed = null;
  14945. }
  14946. // Add options to effect
  14947. if ( options ) {
  14948. $.extend( effect, options );
  14949. }
  14950. speed = speed || options.duration;
  14951. effect.duration = $.fx.off ? 0 :
  14952. typeof speed === "number" ? speed :
  14953. speed in $.fx.speeds ? $.fx.speeds[ speed ] :
  14954. $.fx.speeds._default;
  14955. effect.complete = callback || options.complete;
  14956. return effect;
  14957. }
  14958. function standardAnimationOption( option ) {
  14959. // Valid standard speeds (nothing, number, named speed)
  14960. if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
  14961. return true;
  14962. }
  14963. // Invalid strings - treat as "normal" speed
  14964. if ( typeof option === "string" && !$.effects.effect[ option ] ) {
  14965. return true;
  14966. }
  14967. // Complete callback
  14968. if ( typeof option === "function" ) {
  14969. return true;
  14970. }
  14971. // Options hash (but not naming an effect)
  14972. if ( typeof option === "object" && !option.effect ) {
  14973. return true;
  14974. }
  14975. // Didn't match any standard API
  14976. return false;
  14977. }
  14978. $.fn.extend( {
  14979. effect: function( /* effect, options, speed, callback */ ) {
  14980. var args = _normalizeArguments.apply( this, arguments ),
  14981. effectMethod = $.effects.effect[ args.effect ],
  14982. defaultMode = effectMethod.mode,
  14983. queue = args.queue,
  14984. queueName = queue || "fx",
  14985. complete = args.complete,
  14986. mode = args.mode,
  14987. modes = [],
  14988. prefilter = function( next ) {
  14989. var el = $( this ),
  14990. normalizedMode = $.effects.mode( el, mode ) || defaultMode;
  14991. // Sentinel for duck-punching the :animated pseudo-selector
  14992. el.data( dataSpaceAnimated, true );
  14993. // Save effect mode for later use,
  14994. // we can't just call $.effects.mode again later,
  14995. // as the .show() below destroys the initial state
  14996. modes.push( normalizedMode );
  14997. // See $.uiBackCompat inside of run() for removal of defaultMode in 1.14
  14998. if ( defaultMode && ( normalizedMode === "show" ||
  14999. ( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) {
  15000. el.show();
  15001. }
  15002. if ( !defaultMode || normalizedMode !== "none" ) {
  15003. $.effects.saveStyle( el );
  15004. }
  15005. if ( typeof next === "function" ) {
  15006. next();
  15007. }
  15008. };
  15009. if ( $.fx.off || !effectMethod ) {
  15010. // Delegate to the original method (e.g., .show()) if possible
  15011. if ( mode ) {
  15012. return this[ mode ]( args.duration, complete );
  15013. } else {
  15014. return this.each( function() {
  15015. if ( complete ) {
  15016. complete.call( this );
  15017. }
  15018. } );
  15019. }
  15020. }
  15021. function run( next ) {
  15022. var elem = $( this );
  15023. function cleanup() {
  15024. elem.removeData( dataSpaceAnimated );
  15025. $.effects.cleanUp( elem );
  15026. if ( args.mode === "hide" ) {
  15027. elem.hide();
  15028. }
  15029. done();
  15030. }
  15031. function done() {
  15032. if ( typeof complete === "function" ) {
  15033. complete.call( elem[ 0 ] );
  15034. }
  15035. if ( typeof next === "function" ) {
  15036. next();
  15037. }
  15038. }
  15039. // Override mode option on a per element basis,
  15040. // as toggle can be either show or hide depending on element state
  15041. args.mode = modes.shift();
  15042. if ( $.uiBackCompat !== false && !defaultMode ) {
  15043. if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
  15044. // Call the core method to track "olddisplay" properly
  15045. elem[ mode ]();
  15046. done();
  15047. } else {
  15048. effectMethod.call( elem[ 0 ], args, done );
  15049. }
  15050. } else {
  15051. if ( args.mode === "none" ) {
  15052. // Call the core method to track "olddisplay" properly
  15053. elem[ mode ]();
  15054. done();
  15055. } else {
  15056. effectMethod.call( elem[ 0 ], args, cleanup );
  15057. }
  15058. }
  15059. }
  15060. // Run prefilter on all elements first to ensure that
  15061. // any showing or hiding happens before placeholder creation,
  15062. // which ensures that any layout changes are correctly captured.
  15063. return queue === false ?
  15064. this.each( prefilter ).each( run ) :
  15065. this.queue( queueName, prefilter ).queue( queueName, run );
  15066. },
  15067. show: ( function( orig ) {
  15068. return function( option ) {
  15069. if ( standardAnimationOption( option ) ) {
  15070. return orig.apply( this, arguments );
  15071. } else {
  15072. var args = _normalizeArguments.apply( this, arguments );
  15073. args.mode = "show";
  15074. return this.effect.call( this, args );
  15075. }
  15076. };
  15077. } )( $.fn.show ),
  15078. hide: ( function( orig ) {
  15079. return function( option ) {
  15080. if ( standardAnimationOption( option ) ) {
  15081. return orig.apply( this, arguments );
  15082. } else {
  15083. var args = _normalizeArguments.apply( this, arguments );
  15084. args.mode = "hide";
  15085. return this.effect.call( this, args );
  15086. }
  15087. };
  15088. } )( $.fn.hide ),
  15089. toggle: ( function( orig ) {
  15090. return function( option ) {
  15091. if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
  15092. return orig.apply( this, arguments );
  15093. } else {
  15094. var args = _normalizeArguments.apply( this, arguments );
  15095. args.mode = "toggle";
  15096. return this.effect.call( this, args );
  15097. }
  15098. };
  15099. } )( $.fn.toggle ),
  15100. cssUnit: function( key ) {
  15101. var style = this.css( key ),
  15102. val = [];
  15103. $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
  15104. if ( style.indexOf( unit ) > 0 ) {
  15105. val = [ parseFloat( style ), unit ];
  15106. }
  15107. } );
  15108. return val;
  15109. },
  15110. cssClip: function( clipObj ) {
  15111. if ( clipObj ) {
  15112. return this.css( "clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " +
  15113. clipObj.bottom + "px " + clipObj.left + "px)" );
  15114. }
  15115. return parseClip( this.css( "clip" ), this );
  15116. },
  15117. transfer: function( options, done ) {
  15118. var element = $( this ),
  15119. target = $( options.to ),
  15120. targetFixed = target.css( "position" ) === "fixed",
  15121. body = $( "body" ),
  15122. fixTop = targetFixed ? body.scrollTop() : 0,
  15123. fixLeft = targetFixed ? body.scrollLeft() : 0,
  15124. endPosition = target.offset(),
  15125. animation = {
  15126. top: endPosition.top - fixTop,
  15127. left: endPosition.left - fixLeft,
  15128. height: target.innerHeight(),
  15129. width: target.innerWidth()
  15130. },
  15131. startPosition = element.offset(),
  15132. transfer = $( "<div class='ui-effects-transfer'></div>" );
  15133. transfer
  15134. .appendTo( "body" )
  15135. .addClass( options.className )
  15136. .css( {
  15137. top: startPosition.top - fixTop,
  15138. left: startPosition.left - fixLeft,
  15139. height: element.innerHeight(),
  15140. width: element.innerWidth(),
  15141. position: targetFixed ? "fixed" : "absolute"
  15142. } )
  15143. .animate( animation, options.duration, options.easing, function() {
  15144. transfer.remove();
  15145. if ( typeof done === "function" ) {
  15146. done();
  15147. }
  15148. } );
  15149. }
  15150. } );
  15151. function parseClip( str, element ) {
  15152. var outerWidth = element.outerWidth(),
  15153. outerHeight = element.outerHeight(),
  15154. 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)\)$/,
  15155. values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ];
  15156. return {
  15157. top: parseFloat( values[ 1 ] ) || 0,
  15158. right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ),
  15159. bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ),
  15160. left: parseFloat( values[ 4 ] ) || 0
  15161. };
  15162. }
  15163. $.fx.step.clip = function( fx ) {
  15164. if ( !fx.clipInit ) {
  15165. fx.start = $( fx.elem ).cssClip();
  15166. if ( typeof fx.end === "string" ) {
  15167. fx.end = parseClip( fx.end, fx.elem );
  15168. }
  15169. fx.clipInit = true;
  15170. }
  15171. $( fx.elem ).cssClip( {
  15172. top: fx.pos * ( fx.end.top - fx.start.top ) + fx.start.top,
  15173. right: fx.pos * ( fx.end.right - fx.start.right ) + fx.start.right,
  15174. bottom: fx.pos * ( fx.end.bottom - fx.start.bottom ) + fx.start.bottom,
  15175. left: fx.pos * ( fx.end.left - fx.start.left ) + fx.start.left
  15176. } );
  15177. };
  15178. } )();
  15179. /******************************************************************************/
  15180. /*********************************** EASING ***********************************/
  15181. /******************************************************************************/
  15182. ( function() {
  15183. // Based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
  15184. var baseEasings = {};
  15185. $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
  15186. baseEasings[ name ] = function( p ) {
  15187. return Math.pow( p, i + 2 );
  15188. };
  15189. } );
  15190. $.extend( baseEasings, {
  15191. Sine: function( p ) {
  15192. return 1 - Math.cos( p * Math.PI / 2 );
  15193. },
  15194. Circ: function( p ) {
  15195. return 1 - Math.sqrt( 1 - p * p );
  15196. },
  15197. Elastic: function( p ) {
  15198. return p === 0 || p === 1 ? p :
  15199. -Math.pow( 2, 8 * ( p - 1 ) ) * Math.sin( ( ( p - 1 ) * 80 - 7.5 ) * Math.PI / 15 );
  15200. },
  15201. Back: function( p ) {
  15202. return p * p * ( 3 * p - 2 );
  15203. },
  15204. Bounce: function( p ) {
  15205. var pow2,
  15206. bounce = 4;
  15207. while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
  15208. return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
  15209. }
  15210. } );
  15211. $.each( baseEasings, function( name, easeIn ) {
  15212. $.easing[ "easeIn" + name ] = easeIn;
  15213. $.easing[ "easeOut" + name ] = function( p ) {
  15214. return 1 - easeIn( 1 - p );
  15215. };
  15216. $.easing[ "easeInOut" + name ] = function( p ) {
  15217. return p < 0.5 ?
  15218. easeIn( p * 2 ) / 2 :
  15219. 1 - easeIn( p * -2 + 2 ) / 2;
  15220. };
  15221. } );
  15222. } )();
  15223. var effect = $.effects;
  15224. /*!
  15225. * jQuery UI Effects Blind 1.13.2
  15226. * http://jqueryui.com
  15227. *
  15228. * Copyright jQuery Foundation and other contributors
  15229. * Released under the MIT license.
  15230. * http://jquery.org/license
  15231. */
  15232. //>>label: Blind Effect
  15233. //>>group: Effects
  15234. //>>description: Blinds the element.
  15235. //>>docs: http://api.jqueryui.com/blind-effect/
  15236. //>>demos: http://jqueryui.com/effect/
  15237. var effectsEffectBlind = $.effects.define( "blind", "hide", function( options, done ) {
  15238. var map = {
  15239. up: [ "bottom", "top" ],
  15240. vertical: [ "bottom", "top" ],
  15241. down: [ "top", "bottom" ],
  15242. left: [ "right", "left" ],
  15243. horizontal: [ "right", "left" ],
  15244. right: [ "left", "right" ]
  15245. },
  15246. element = $( this ),
  15247. direction = options.direction || "up",
  15248. start = element.cssClip(),
  15249. animate = { clip: $.extend( {}, start ) },
  15250. placeholder = $.effects.createPlaceholder( element );
  15251. animate.clip[ map[ direction ][ 0 ] ] = animate.clip[ map[ direction ][ 1 ] ];
  15252. if ( options.mode === "show" ) {
  15253. element.cssClip( animate.clip );
  15254. if ( placeholder ) {
  15255. placeholder.css( $.effects.clipToBox( animate ) );
  15256. }
  15257. animate.clip = start;
  15258. }
  15259. if ( placeholder ) {
  15260. placeholder.animate( $.effects.clipToBox( animate ), options.duration, options.easing );
  15261. }
  15262. element.animate( animate, {
  15263. queue: false,
  15264. duration: options.duration,
  15265. easing: options.easing,
  15266. complete: done
  15267. } );
  15268. } );
  15269. /*!
  15270. * jQuery UI Effects Bounce 1.13.2
  15271. * http://jqueryui.com
  15272. *
  15273. * Copyright jQuery Foundation and other contributors
  15274. * Released under the MIT license.
  15275. * http://jquery.org/license
  15276. */
  15277. //>>label: Bounce Effect
  15278. //>>group: Effects
  15279. //>>description: Bounces an element horizontally or vertically n times.
  15280. //>>docs: http://api.jqueryui.com/bounce-effect/
  15281. //>>demos: http://jqueryui.com/effect/
  15282. var effectsEffectBounce = $.effects.define( "bounce", function( options, done ) {
  15283. var upAnim, downAnim, refValue,
  15284. element = $( this ),
  15285. // Defaults:
  15286. mode = options.mode,
  15287. hide = mode === "hide",
  15288. show = mode === "show",
  15289. direction = options.direction || "up",
  15290. distance = options.distance,
  15291. times = options.times || 5,
  15292. // Number of internal animations
  15293. anims = times * 2 + ( show || hide ? 1 : 0 ),
  15294. speed = options.duration / anims,
  15295. easing = options.easing,
  15296. // Utility:
  15297. ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
  15298. motion = ( direction === "up" || direction === "left" ),
  15299. i = 0,
  15300. queuelen = element.queue().length;
  15301. $.effects.createPlaceholder( element );
  15302. refValue = element.css( ref );
  15303. // Default distance for the BIGGEST bounce is the outer Distance / 3
  15304. if ( !distance ) {
  15305. distance = element[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
  15306. }
  15307. if ( show ) {
  15308. downAnim = { opacity: 1 };
  15309. downAnim[ ref ] = refValue;
  15310. // If we are showing, force opacity 0 and set the initial position
  15311. // then do the "first" animation
  15312. element
  15313. .css( "opacity", 0 )
  15314. .css( ref, motion ? -distance * 2 : distance * 2 )
  15315. .animate( downAnim, speed, easing );
  15316. }
  15317. // Start at the smallest distance if we are hiding
  15318. if ( hide ) {
  15319. distance = distance / Math.pow( 2, times - 1 );
  15320. }
  15321. downAnim = {};
  15322. downAnim[ ref ] = refValue;
  15323. // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
  15324. for ( ; i < times; i++ ) {
  15325. upAnim = {};
  15326. upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
  15327. element
  15328. .animate( upAnim, speed, easing )
  15329. .animate( downAnim, speed, easing );
  15330. distance = hide ? distance * 2 : distance / 2;
  15331. }
  15332. // Last Bounce when Hiding
  15333. if ( hide ) {
  15334. upAnim = { opacity: 0 };
  15335. upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
  15336. element.animate( upAnim, speed, easing );
  15337. }
  15338. element.queue( done );
  15339. $.effects.unshift( element, queuelen, anims + 1 );
  15340. } );
  15341. /*!
  15342. * jQuery UI Effects Clip 1.13.2
  15343. * http://jqueryui.com
  15344. *
  15345. * Copyright jQuery Foundation and other contributors
  15346. * Released under the MIT license.
  15347. * http://jquery.org/license
  15348. */
  15349. //>>label: Clip Effect
  15350. //>>group: Effects
  15351. //>>description: Clips the element on and off like an old TV.
  15352. //>>docs: http://api.jqueryui.com/clip-effect/
  15353. //>>demos: http://jqueryui.com/effect/
  15354. var effectsEffectClip = $.effects.define( "clip", "hide", function( options, done ) {
  15355. var start,
  15356. animate = {},
  15357. element = $( this ),
  15358. direction = options.direction || "vertical",
  15359. both = direction === "both",
  15360. horizontal = both || direction === "horizontal",
  15361. vertical = both || direction === "vertical";
  15362. start = element.cssClip();
  15363. animate.clip = {
  15364. top: vertical ? ( start.bottom - start.top ) / 2 : start.top,
  15365. right: horizontal ? ( start.right - start.left ) / 2 : start.right,
  15366. bottom: vertical ? ( start.bottom - start.top ) / 2 : start.bottom,
  15367. left: horizontal ? ( start.right - start.left ) / 2 : start.left
  15368. };
  15369. $.effects.createPlaceholder( element );
  15370. if ( options.mode === "show" ) {
  15371. element.cssClip( animate.clip );
  15372. animate.clip = start;
  15373. }
  15374. element.animate( animate, {
  15375. queue: false,
  15376. duration: options.duration,
  15377. easing: options.easing,
  15378. complete: done
  15379. } );
  15380. } );
  15381. /*!
  15382. * jQuery UI Effects Drop 1.13.2
  15383. * http://jqueryui.com
  15384. *
  15385. * Copyright jQuery Foundation and other contributors
  15386. * Released under the MIT license.
  15387. * http://jquery.org/license
  15388. */
  15389. //>>label: Drop Effect
  15390. //>>group: Effects
  15391. //>>description: Moves an element in one direction and hides it at the same time.
  15392. //>>docs: http://api.jqueryui.com/drop-effect/
  15393. //>>demos: http://jqueryui.com/effect/
  15394. var effectsEffectDrop = $.effects.define( "drop", "hide", function( options, done ) {
  15395. var distance,
  15396. element = $( this ),
  15397. mode = options.mode,
  15398. show = mode === "show",
  15399. direction = options.direction || "left",
  15400. ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
  15401. motion = ( direction === "up" || direction === "left" ) ? "-=" : "+=",
  15402. oppositeMotion = ( motion === "+=" ) ? "-=" : "+=",
  15403. animation = {
  15404. opacity: 0
  15405. };
  15406. $.effects.createPlaceholder( element );
  15407. distance = options.distance ||
  15408. element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2;
  15409. animation[ ref ] = motion + distance;
  15410. if ( show ) {
  15411. element.css( animation );
  15412. animation[ ref ] = oppositeMotion + distance;
  15413. animation.opacity = 1;
  15414. }
  15415. // Animate
  15416. element.animate( animation, {
  15417. queue: false,
  15418. duration: options.duration,
  15419. easing: options.easing,
  15420. complete: done
  15421. } );
  15422. } );
  15423. /*!
  15424. * jQuery UI Effects Explode 1.13.2
  15425. * http://jqueryui.com
  15426. *
  15427. * Copyright jQuery Foundation and other contributors
  15428. * Released under the MIT license.
  15429. * http://jquery.org/license
  15430. */
  15431. //>>label: Explode Effect
  15432. //>>group: Effects
  15433. /* eslint-disable max-len */
  15434. //>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness.
  15435. /* eslint-enable max-len */
  15436. //>>docs: http://api.jqueryui.com/explode-effect/
  15437. //>>demos: http://jqueryui.com/effect/
  15438. var effectsEffectExplode = $.effects.define( "explode", "hide", function( options, done ) {
  15439. var i, j, left, top, mx, my,
  15440. rows = options.pieces ? Math.round( Math.sqrt( options.pieces ) ) : 3,
  15441. cells = rows,
  15442. element = $( this ),
  15443. mode = options.mode,
  15444. show = mode === "show",
  15445. // Show and then visibility:hidden the element before calculating offset
  15446. offset = element.show().css( "visibility", "hidden" ).offset(),
  15447. // Width and height of a piece
  15448. width = Math.ceil( element.outerWidth() / cells ),
  15449. height = Math.ceil( element.outerHeight() / rows ),
  15450. pieces = [];
  15451. // Children animate complete:
  15452. function childComplete() {
  15453. pieces.push( this );
  15454. if ( pieces.length === rows * cells ) {
  15455. animComplete();
  15456. }
  15457. }
  15458. // Clone the element for each row and cell.
  15459. for ( i = 0; i < rows; i++ ) { // ===>
  15460. top = offset.top + i * height;
  15461. my = i - ( rows - 1 ) / 2;
  15462. for ( j = 0; j < cells; j++ ) { // |||
  15463. left = offset.left + j * width;
  15464. mx = j - ( cells - 1 ) / 2;
  15465. // Create a clone of the now hidden main element that will be absolute positioned
  15466. // within a wrapper div off the -left and -top equal to size of our pieces
  15467. element
  15468. .clone()
  15469. .appendTo( "body" )
  15470. .wrap( "<div></div>" )
  15471. .css( {
  15472. position: "absolute",
  15473. visibility: "visible",
  15474. left: -j * width,
  15475. top: -i * height
  15476. } )
  15477. // Select the wrapper - make it overflow: hidden and absolute positioned based on
  15478. // where the original was located +left and +top equal to the size of pieces
  15479. .parent()
  15480. .addClass( "ui-effects-explode" )
  15481. .css( {
  15482. position: "absolute",
  15483. overflow: "hidden",
  15484. width: width,
  15485. height: height,
  15486. left: left + ( show ? mx * width : 0 ),
  15487. top: top + ( show ? my * height : 0 ),
  15488. opacity: show ? 0 : 1
  15489. } )
  15490. .animate( {
  15491. left: left + ( show ? 0 : mx * width ),
  15492. top: top + ( show ? 0 : my * height ),
  15493. opacity: show ? 1 : 0
  15494. }, options.duration || 500, options.easing, childComplete );
  15495. }
  15496. }
  15497. function animComplete() {
  15498. element.css( {
  15499. visibility: "visible"
  15500. } );
  15501. $( pieces ).remove();
  15502. done();
  15503. }
  15504. } );
  15505. /*!
  15506. * jQuery UI Effects Fade 1.13.2
  15507. * http://jqueryui.com
  15508. *
  15509. * Copyright jQuery Foundation and other contributors
  15510. * Released under the MIT license.
  15511. * http://jquery.org/license
  15512. */
  15513. //>>label: Fade Effect
  15514. //>>group: Effects
  15515. //>>description: Fades the element.
  15516. //>>docs: http://api.jqueryui.com/fade-effect/
  15517. //>>demos: http://jqueryui.com/effect/
  15518. var effectsEffectFade = $.effects.define( "fade", "toggle", function( options, done ) {
  15519. var show = options.mode === "show";
  15520. $( this )
  15521. .css( "opacity", show ? 0 : 1 )
  15522. .animate( {
  15523. opacity: show ? 1 : 0
  15524. }, {
  15525. queue: false,
  15526. duration: options.duration,
  15527. easing: options.easing,
  15528. complete: done
  15529. } );
  15530. } );
  15531. /*!
  15532. * jQuery UI Effects Fold 1.13.2
  15533. * http://jqueryui.com
  15534. *
  15535. * Copyright jQuery Foundation and other contributors
  15536. * Released under the MIT license.
  15537. * http://jquery.org/license
  15538. */
  15539. //>>label: Fold Effect
  15540. //>>group: Effects
  15541. //>>description: Folds an element first horizontally and then vertically.
  15542. //>>docs: http://api.jqueryui.com/fold-effect/
  15543. //>>demos: http://jqueryui.com/effect/
  15544. var effectsEffectFold = $.effects.define( "fold", "hide", function( options, done ) {
  15545. // Create element
  15546. var element = $( this ),
  15547. mode = options.mode,
  15548. show = mode === "show",
  15549. hide = mode === "hide",
  15550. size = options.size || 15,
  15551. percent = /([0-9]+)%/.exec( size ),
  15552. horizFirst = !!options.horizFirst,
  15553. ref = horizFirst ? [ "right", "bottom" ] : [ "bottom", "right" ],
  15554. duration = options.duration / 2,
  15555. placeholder = $.effects.createPlaceholder( element ),
  15556. start = element.cssClip(),
  15557. animation1 = { clip: $.extend( {}, start ) },
  15558. animation2 = { clip: $.extend( {}, start ) },
  15559. distance = [ start[ ref[ 0 ] ], start[ ref[ 1 ] ] ],
  15560. queuelen = element.queue().length;
  15561. if ( percent ) {
  15562. size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
  15563. }
  15564. animation1.clip[ ref[ 0 ] ] = size;
  15565. animation2.clip[ ref[ 0 ] ] = size;
  15566. animation2.clip[ ref[ 1 ] ] = 0;
  15567. if ( show ) {
  15568. element.cssClip( animation2.clip );
  15569. if ( placeholder ) {
  15570. placeholder.css( $.effects.clipToBox( animation2 ) );
  15571. }
  15572. animation2.clip = start;
  15573. }
  15574. // Animate
  15575. element
  15576. .queue( function( next ) {
  15577. if ( placeholder ) {
  15578. placeholder
  15579. .animate( $.effects.clipToBox( animation1 ), duration, options.easing )
  15580. .animate( $.effects.clipToBox( animation2 ), duration, options.easing );
  15581. }
  15582. next();
  15583. } )
  15584. .animate( animation1, duration, options.easing )
  15585. .animate( animation2, duration, options.easing )
  15586. .queue( done );
  15587. $.effects.unshift( element, queuelen, 4 );
  15588. } );
  15589. /*!
  15590. * jQuery UI Effects Highlight 1.13.2
  15591. * http://jqueryui.com
  15592. *
  15593. * Copyright jQuery Foundation and other contributors
  15594. * Released under the MIT license.
  15595. * http://jquery.org/license
  15596. */
  15597. //>>label: Highlight Effect
  15598. //>>group: Effects
  15599. //>>description: Highlights the background of an element in a defined color for a custom duration.
  15600. //>>docs: http://api.jqueryui.com/highlight-effect/
  15601. //>>demos: http://jqueryui.com/effect/
  15602. var effectsEffectHighlight = $.effects.define( "highlight", "show", function( options, done ) {
  15603. var element = $( this ),
  15604. animation = {
  15605. backgroundColor: element.css( "backgroundColor" )
  15606. };
  15607. if ( options.mode === "hide" ) {
  15608. animation.opacity = 0;
  15609. }
  15610. $.effects.saveStyle( element );
  15611. element
  15612. .css( {
  15613. backgroundImage: "none",
  15614. backgroundColor: options.color || "#ffff99"
  15615. } )
  15616. .animate( animation, {
  15617. queue: false,
  15618. duration: options.duration,
  15619. easing: options.easing,
  15620. complete: done
  15621. } );
  15622. } );
  15623. /*!
  15624. * jQuery UI Effects Size 1.13.2
  15625. * http://jqueryui.com
  15626. *
  15627. * Copyright jQuery Foundation and other contributors
  15628. * Released under the MIT license.
  15629. * http://jquery.org/license
  15630. */
  15631. //>>label: Size Effect
  15632. //>>group: Effects
  15633. //>>description: Resize an element to a specified width and height.
  15634. //>>docs: http://api.jqueryui.com/size-effect/
  15635. //>>demos: http://jqueryui.com/effect/
  15636. var effectsEffectSize = $.effects.define( "size", function( options, done ) {
  15637. // Create element
  15638. var baseline, factor, temp,
  15639. element = $( this ),
  15640. // Copy for children
  15641. cProps = [ "fontSize" ],
  15642. vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
  15643. hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
  15644. // Set options
  15645. mode = options.mode,
  15646. restore = mode !== "effect",
  15647. scale = options.scale || "both",
  15648. origin = options.origin || [ "middle", "center" ],
  15649. position = element.css( "position" ),
  15650. pos = element.position(),
  15651. original = $.effects.scaledDimensions( element ),
  15652. from = options.from || original,
  15653. to = options.to || $.effects.scaledDimensions( element, 0 );
  15654. $.effects.createPlaceholder( element );
  15655. if ( mode === "show" ) {
  15656. temp = from;
  15657. from = to;
  15658. to = temp;
  15659. }
  15660. // Set scaling factor
  15661. factor = {
  15662. from: {
  15663. y: from.height / original.height,
  15664. x: from.width / original.width
  15665. },
  15666. to: {
  15667. y: to.height / original.height,
  15668. x: to.width / original.width
  15669. }
  15670. };
  15671. // Scale the css box
  15672. if ( scale === "box" || scale === "both" ) {
  15673. // Vertical props scaling
  15674. if ( factor.from.y !== factor.to.y ) {
  15675. from = $.effects.setTransition( element, vProps, factor.from.y, from );
  15676. to = $.effects.setTransition( element, vProps, factor.to.y, to );
  15677. }
  15678. // Horizontal props scaling
  15679. if ( factor.from.x !== factor.to.x ) {
  15680. from = $.effects.setTransition( element, hProps, factor.from.x, from );
  15681. to = $.effects.setTransition( element, hProps, factor.to.x, to );
  15682. }
  15683. }
  15684. // Scale the content
  15685. if ( scale === "content" || scale === "both" ) {
  15686. // Vertical props scaling
  15687. if ( factor.from.y !== factor.to.y ) {
  15688. from = $.effects.setTransition( element, cProps, factor.from.y, from );
  15689. to = $.effects.setTransition( element, cProps, factor.to.y, to );
  15690. }
  15691. }
  15692. // Adjust the position properties based on the provided origin points
  15693. if ( origin ) {
  15694. baseline = $.effects.getBaseline( origin, original );
  15695. from.top = ( original.outerHeight - from.outerHeight ) * baseline.y + pos.top;
  15696. from.left = ( original.outerWidth - from.outerWidth ) * baseline.x + pos.left;
  15697. to.top = ( original.outerHeight - to.outerHeight ) * baseline.y + pos.top;
  15698. to.left = ( original.outerWidth - to.outerWidth ) * baseline.x + pos.left;
  15699. }
  15700. delete from.outerHeight;
  15701. delete from.outerWidth;
  15702. element.css( from );
  15703. // Animate the children if desired
  15704. if ( scale === "content" || scale === "both" ) {
  15705. vProps = vProps.concat( [ "marginTop", "marginBottom" ] ).concat( cProps );
  15706. hProps = hProps.concat( [ "marginLeft", "marginRight" ] );
  15707. // Only animate children with width attributes specified
  15708. // TODO: is this right? should we include anything with css width specified as well
  15709. element.find( "*[width]" ).each( function() {
  15710. var child = $( this ),
  15711. childOriginal = $.effects.scaledDimensions( child ),
  15712. childFrom = {
  15713. height: childOriginal.height * factor.from.y,
  15714. width: childOriginal.width * factor.from.x,
  15715. outerHeight: childOriginal.outerHeight * factor.from.y,
  15716. outerWidth: childOriginal.outerWidth * factor.from.x
  15717. },
  15718. childTo = {
  15719. height: childOriginal.height * factor.to.y,
  15720. width: childOriginal.width * factor.to.x,
  15721. outerHeight: childOriginal.height * factor.to.y,
  15722. outerWidth: childOriginal.width * factor.to.x
  15723. };
  15724. // Vertical props scaling
  15725. if ( factor.from.y !== factor.to.y ) {
  15726. childFrom = $.effects.setTransition( child, vProps, factor.from.y, childFrom );
  15727. childTo = $.effects.setTransition( child, vProps, factor.to.y, childTo );
  15728. }
  15729. // Horizontal props scaling
  15730. if ( factor.from.x !== factor.to.x ) {
  15731. childFrom = $.effects.setTransition( child, hProps, factor.from.x, childFrom );
  15732. childTo = $.effects.setTransition( child, hProps, factor.to.x, childTo );
  15733. }
  15734. if ( restore ) {
  15735. $.effects.saveStyle( child );
  15736. }
  15737. // Animate children
  15738. child.css( childFrom );
  15739. child.animate( childTo, options.duration, options.easing, function() {
  15740. // Restore children
  15741. if ( restore ) {
  15742. $.effects.restoreStyle( child );
  15743. }
  15744. } );
  15745. } );
  15746. }
  15747. // Animate
  15748. element.animate( to, {
  15749. queue: false,
  15750. duration: options.duration,
  15751. easing: options.easing,
  15752. complete: function() {
  15753. var offset = element.offset();
  15754. if ( to.opacity === 0 ) {
  15755. element.css( "opacity", from.opacity );
  15756. }
  15757. if ( !restore ) {
  15758. element
  15759. .css( "position", position === "static" ? "relative" : position )
  15760. .offset( offset );
  15761. // Need to save style here so that automatic style restoration
  15762. // doesn't restore to the original styles from before the animation.
  15763. $.effects.saveStyle( element );
  15764. }
  15765. done();
  15766. }
  15767. } );
  15768. } );
  15769. /*!
  15770. * jQuery UI Effects Scale 1.13.2
  15771. * http://jqueryui.com
  15772. *
  15773. * Copyright jQuery Foundation and other contributors
  15774. * Released under the MIT license.
  15775. * http://jquery.org/license
  15776. */
  15777. //>>label: Scale Effect
  15778. //>>group: Effects
  15779. //>>description: Grows or shrinks an element and its content.
  15780. //>>docs: http://api.jqueryui.com/scale-effect/
  15781. //>>demos: http://jqueryui.com/effect/
  15782. var effectsEffectScale = $.effects.define( "scale", function( options, done ) {
  15783. // Create element
  15784. var el = $( this ),
  15785. mode = options.mode,
  15786. percent = parseInt( options.percent, 10 ) ||
  15787. ( parseInt( options.percent, 10 ) === 0 ? 0 : ( mode !== "effect" ? 0 : 100 ) ),
  15788. newOptions = $.extend( true, {
  15789. from: $.effects.scaledDimensions( el ),
  15790. to: $.effects.scaledDimensions( el, percent, options.direction || "both" ),
  15791. origin: options.origin || [ "middle", "center" ]
  15792. }, options );
  15793. // Fade option to support puff
  15794. if ( options.fade ) {
  15795. newOptions.from.opacity = 1;
  15796. newOptions.to.opacity = 0;
  15797. }
  15798. $.effects.effect.size.call( this, newOptions, done );
  15799. } );
  15800. /*!
  15801. * jQuery UI Effects Puff 1.13.2
  15802. * http://jqueryui.com
  15803. *
  15804. * Copyright jQuery Foundation and other contributors
  15805. * Released under the MIT license.
  15806. * http://jquery.org/license
  15807. */
  15808. //>>label: Puff Effect
  15809. //>>group: Effects
  15810. //>>description: Creates a puff effect by scaling the element up and hiding it at the same time.
  15811. //>>docs: http://api.jqueryui.com/puff-effect/
  15812. //>>demos: http://jqueryui.com/effect/
  15813. var effectsEffectPuff = $.effects.define( "puff", "hide", function( options, done ) {
  15814. var newOptions = $.extend( true, {}, options, {
  15815. fade: true,
  15816. percent: parseInt( options.percent, 10 ) || 150
  15817. } );
  15818. $.effects.effect.scale.call( this, newOptions, done );
  15819. } );
  15820. /*!
  15821. * jQuery UI Effects Pulsate 1.13.2
  15822. * http://jqueryui.com
  15823. *
  15824. * Copyright jQuery Foundation and other contributors
  15825. * Released under the MIT license.
  15826. * http://jquery.org/license
  15827. */
  15828. //>>label: Pulsate Effect
  15829. //>>group: Effects
  15830. //>>description: Pulsates an element n times by changing the opacity to zero and back.
  15831. //>>docs: http://api.jqueryui.com/pulsate-effect/
  15832. //>>demos: http://jqueryui.com/effect/
  15833. var effectsEffectPulsate = $.effects.define( "pulsate", "show", function( options, done ) {
  15834. var element = $( this ),
  15835. mode = options.mode,
  15836. show = mode === "show",
  15837. hide = mode === "hide",
  15838. showhide = show || hide,
  15839. // Showing or hiding leaves off the "last" animation
  15840. anims = ( ( options.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
  15841. duration = options.duration / anims,
  15842. animateTo = 0,
  15843. i = 1,
  15844. queuelen = element.queue().length;
  15845. if ( show || !element.is( ":visible" ) ) {
  15846. element.css( "opacity", 0 ).show();
  15847. animateTo = 1;
  15848. }
  15849. // Anims - 1 opacity "toggles"
  15850. for ( ; i < anims; i++ ) {
  15851. element.animate( { opacity: animateTo }, duration, options.easing );
  15852. animateTo = 1 - animateTo;
  15853. }
  15854. element.animate( { opacity: animateTo }, duration, options.easing );
  15855. element.queue( done );
  15856. $.effects.unshift( element, queuelen, anims + 1 );
  15857. } );
  15858. /*!
  15859. * jQuery UI Effects Shake 1.13.2
  15860. * http://jqueryui.com
  15861. *
  15862. * Copyright jQuery Foundation and other contributors
  15863. * Released under the MIT license.
  15864. * http://jquery.org/license
  15865. */
  15866. //>>label: Shake Effect
  15867. //>>group: Effects
  15868. //>>description: Shakes an element horizontally or vertically n times.
  15869. //>>docs: http://api.jqueryui.com/shake-effect/
  15870. //>>demos: http://jqueryui.com/effect/
  15871. var effectsEffectShake = $.effects.define( "shake", function( options, done ) {
  15872. var i = 1,
  15873. element = $( this ),
  15874. direction = options.direction || "left",
  15875. distance = options.distance || 20,
  15876. times = options.times || 3,
  15877. anims = times * 2 + 1,
  15878. speed = Math.round( options.duration / anims ),
  15879. ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
  15880. positiveMotion = ( direction === "up" || direction === "left" ),
  15881. animation = {},
  15882. animation1 = {},
  15883. animation2 = {},
  15884. queuelen = element.queue().length;
  15885. $.effects.createPlaceholder( element );
  15886. // Animation
  15887. animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
  15888. animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
  15889. animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
  15890. // Animate
  15891. element.animate( animation, speed, options.easing );
  15892. // Shakes
  15893. for ( ; i < times; i++ ) {
  15894. element
  15895. .animate( animation1, speed, options.easing )
  15896. .animate( animation2, speed, options.easing );
  15897. }
  15898. element
  15899. .animate( animation1, speed, options.easing )
  15900. .animate( animation, speed / 2, options.easing )
  15901. .queue( done );
  15902. $.effects.unshift( element, queuelen, anims + 1 );
  15903. } );
  15904. /*!
  15905. * jQuery UI Effects Slide 1.13.2
  15906. * http://jqueryui.com
  15907. *
  15908. * Copyright jQuery Foundation and other contributors
  15909. * Released under the MIT license.
  15910. * http://jquery.org/license
  15911. */
  15912. //>>label: Slide Effect
  15913. //>>group: Effects
  15914. //>>description: Slides an element in and out of the viewport.
  15915. //>>docs: http://api.jqueryui.com/slide-effect/
  15916. //>>demos: http://jqueryui.com/effect/
  15917. var effectsEffectSlide = $.effects.define( "slide", "show", function( options, done ) {
  15918. var startClip, startRef,
  15919. element = $( this ),
  15920. map = {
  15921. up: [ "bottom", "top" ],
  15922. down: [ "top", "bottom" ],
  15923. left: [ "right", "left" ],
  15924. right: [ "left", "right" ]
  15925. },
  15926. mode = options.mode,
  15927. direction = options.direction || "left",
  15928. ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
  15929. positiveMotion = ( direction === "up" || direction === "left" ),
  15930. distance = options.distance ||
  15931. element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ),
  15932. animation = {};
  15933. $.effects.createPlaceholder( element );
  15934. startClip = element.cssClip();
  15935. startRef = element.position()[ ref ];
  15936. // Define hide animation
  15937. animation[ ref ] = ( positiveMotion ? -1 : 1 ) * distance + startRef;
  15938. animation.clip = element.cssClip();
  15939. animation.clip[ map[ direction ][ 1 ] ] = animation.clip[ map[ direction ][ 0 ] ];
  15940. // Reverse the animation if we're showing
  15941. if ( mode === "show" ) {
  15942. element.cssClip( animation.clip );
  15943. element.css( ref, animation[ ref ] );
  15944. animation.clip = startClip;
  15945. animation[ ref ] = startRef;
  15946. }
  15947. // Actually animate
  15948. element.animate( animation, {
  15949. queue: false,
  15950. duration: options.duration,
  15951. easing: options.easing,
  15952. complete: done
  15953. } );
  15954. } );
  15955. /*!
  15956. * jQuery UI Effects Transfer 1.13.2
  15957. * http://jqueryui.com
  15958. *
  15959. * Copyright jQuery Foundation and other contributors
  15960. * Released under the MIT license.
  15961. * http://jquery.org/license
  15962. */
  15963. //>>label: Transfer Effect
  15964. //>>group: Effects
  15965. //>>description: Displays a transfer effect from one element to another.
  15966. //>>docs: http://api.jqueryui.com/transfer-effect/
  15967. //>>demos: http://jqueryui.com/effect/
  15968. var effect;
  15969. if ( $.uiBackCompat !== false ) {
  15970. effect = $.effects.define( "transfer", function( options, done ) {
  15971. $( this ).transfer( options, done );
  15972. } );
  15973. }
  15974. var effectsEffectTransfer = effect;
  15975. } );