jquery-ui.js 509 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706
  1. /*! jQuery UI - v1.12.1 - 2018-03-25
  2. * http://jqueryui.com
  3. * Includes: widget.js, position.js, data.js, disable-selection.js, focusable.js, form-reset-mixin.js, jquery-1-7.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. if ( typeof define === "function" && define.amd ) {
  7. // AMD. Register as an anonymous module.
  8. define([ "jquery" ], factory );
  9. } else {
  10. // Browser globals
  11. factory( jQuery );
  12. }
  13. }(function( $ ) {
  14. $.ui = $.ui || {};
  15. var version = $.ui.version = "1.12.1";
  16. /*!
  17. * jQuery UI Widget 1.12.1
  18. * http://jqueryui.com
  19. *
  20. * Copyright jQuery Foundation and other contributors
  21. * Released under the MIT license.
  22. * http://jquery.org/license
  23. */
  24. //>>label: Widget
  25. //>>group: Core
  26. //>>description: Provides a factory for creating stateful widgets with a common API.
  27. //>>docs: http://api.jqueryui.com/jQuery.widget/
  28. //>>demos: http://jqueryui.com/widget/
  29. var widgetUuid = 0;
  30. var widgetSlice = Array.prototype.slice;
  31. $.cleanData = ( function( orig ) {
  32. return function( elems ) {
  33. var events, elem, i;
  34. for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
  35. try {
  36. // Only trigger remove when necessary to save time
  37. events = $._data( elem, "events" );
  38. if ( events && events.remove ) {
  39. $( elem ).triggerHandler( "remove" );
  40. }
  41. // Http://bugs.jquery.com/ticket/8235
  42. } catch ( e ) {}
  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 ( $.isArray( prototype ) ) {
  60. prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
  61. }
  62. // Create selector for plugin
  63. $.expr[ ":" ][ 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._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 ( !$.isFunction( value ) ) {
  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 ( input[ inputIndex ].hasOwnProperty( 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 ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) {
  201. return $.error( "no such method '" + options + "' for " + name +
  202. " widget instance" );
  203. }
  204. methodValue = instance[ options ].apply( instance, args );
  205. if ( methodValue !== instance && methodValue !== undefined ) {
  206. returnValue = methodValue && methodValue.jquery ?
  207. returnValue.pushStack( methodValue.get() ) :
  208. methodValue;
  209. return false;
  210. }
  211. } );
  212. }
  213. } else {
  214. // Allow multiple hashes to be passed on init
  215. if ( args.length ) {
  216. options = $.widget.extend.apply( null, [ options ].concat( args ) );
  217. }
  218. this.each( function() {
  219. var instance = $.data( this, fullName );
  220. if ( instance ) {
  221. instance.option( options || {} );
  222. if ( instance._init ) {
  223. instance._init();
  224. }
  225. } else {
  226. $.data( this, fullName, new object( options, this ) );
  227. }
  228. } );
  229. }
  230. return returnValue;
  231. };
  232. };
  233. $.Widget = function( /* options, element */ ) {};
  234. $.Widget._childConstructors = [];
  235. $.Widget.prototype = {
  236. widgetName: "widget",
  237. widgetEventPrefix: "",
  238. defaultElement: "<div>",
  239. options: {
  240. classes: {},
  241. disabled: false,
  242. // Callbacks
  243. create: null
  244. },
  245. _createWidget: function( options, element ) {
  246. element = $( element || this.defaultElement || this )[ 0 ];
  247. this.element = $( element );
  248. this.uuid = widgetUuid++;
  249. this.eventNamespace = "." + this.widgetName + this.uuid;
  250. this.bindings = $();
  251. this.hoverable = $();
  252. this.focusable = $();
  253. this.classesElementLookup = {};
  254. if ( element !== this ) {
  255. $.data( element, this.widgetFullName, this );
  256. this._on( true, this.element, {
  257. remove: function( event ) {
  258. if ( event.target === element ) {
  259. this.destroy();
  260. }
  261. }
  262. } );
  263. this.document = $( element.style ?
  264. // Element within the document
  265. element.ownerDocument :
  266. // Element is window or document
  267. element.document || element );
  268. this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );
  269. }
  270. this.options = $.widget.extend( {},
  271. this.options,
  272. this._getCreateOptions(),
  273. options );
  274. this._create();
  275. if ( this.options.disabled ) {
  276. this._setOptionDisabled( this.options.disabled );
  277. }
  278. this._trigger( "create", null, this._getCreateEventData() );
  279. this._init();
  280. },
  281. _getCreateOptions: function() {
  282. return {};
  283. },
  284. _getCreateEventData: $.noop,
  285. _create: $.noop,
  286. _init: $.noop,
  287. destroy: function() {
  288. var that = this;
  289. this._destroy();
  290. $.each( this.classesElementLookup, function( key, value ) {
  291. that._removeClass( value, key );
  292. } );
  293. // We can probably remove the unbind calls in 2.0
  294. // all event bindings should go through this._on()
  295. this.element
  296. .off( this.eventNamespace )
  297. .removeData( this.widgetFullName );
  298. this.widget()
  299. .off( this.eventNamespace )
  300. .removeAttr( "aria-disabled" );
  301. // Clean up events and states
  302. this.bindings.off( this.eventNamespace );
  303. },
  304. _destroy: $.noop,
  305. widget: function() {
  306. return this.element;
  307. },
  308. option: function( key, value ) {
  309. var options = key;
  310. var parts;
  311. var curOption;
  312. var i;
  313. if ( arguments.length === 0 ) {
  314. // Don't return a reference to the internal hash
  315. return $.widget.extend( {}, this.options );
  316. }
  317. if ( typeof key === "string" ) {
  318. // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
  319. options = {};
  320. parts = key.split( "." );
  321. key = parts.shift();
  322. if ( parts.length ) {
  323. curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
  324. for ( i = 0; i < parts.length - 1; i++ ) {
  325. curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
  326. curOption = curOption[ parts[ i ] ];
  327. }
  328. key = parts.pop();
  329. if ( arguments.length === 1 ) {
  330. return curOption[ key ] === undefined ? null : curOption[ key ];
  331. }
  332. curOption[ key ] = value;
  333. } else {
  334. if ( arguments.length === 1 ) {
  335. return this.options[ key ] === undefined ? null : this.options[ key ];
  336. }
  337. options[ key ] = value;
  338. }
  339. }
  340. this._setOptions( options );
  341. return this;
  342. },
  343. _setOptions: function( options ) {
  344. var key;
  345. for ( key in options ) {
  346. this._setOption( key, options[ key ] );
  347. }
  348. return this;
  349. },
  350. _setOption: function( key, value ) {
  351. if ( key === "classes" ) {
  352. this._setOptionClasses( value );
  353. }
  354. this.options[ key ] = value;
  355. if ( key === "disabled" ) {
  356. this._setOptionDisabled( value );
  357. }
  358. return this;
  359. },
  360. _setOptionClasses: function( value ) {
  361. var classKey, elements, currentElements;
  362. for ( classKey in value ) {
  363. currentElements = this.classesElementLookup[ classKey ];
  364. if ( value[ classKey ] === this.options.classes[ classKey ] ||
  365. !currentElements ||
  366. !currentElements.length ) {
  367. continue;
  368. }
  369. // We are doing this to create a new jQuery object because the _removeClass() call
  370. // on the next line is going to destroy the reference to the current elements being
  371. // tracked. We need to save a copy of this collection so that we can add the new classes
  372. // below.
  373. elements = $( currentElements.get() );
  374. this._removeClass( currentElements, classKey );
  375. // We don't use _addClass() here, because that uses this.options.classes
  376. // for generating the string of classes. We want to use the value passed in from
  377. // _setOption(), this is the new value of the classes option which was passed to
  378. // _setOption(). We pass this value directly to _classes().
  379. elements.addClass( this._classes( {
  380. element: elements,
  381. keys: classKey,
  382. classes: value,
  383. add: true
  384. } ) );
  385. }
  386. },
  387. _setOptionDisabled: function( value ) {
  388. this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );
  389. // If the widget is becoming disabled, then nothing is interactive
  390. if ( value ) {
  391. this._removeClass( this.hoverable, null, "ui-state-hover" );
  392. this._removeClass( this.focusable, null, "ui-state-focus" );
  393. }
  394. },
  395. enable: function() {
  396. return this._setOptions( { disabled: false } );
  397. },
  398. disable: function() {
  399. return this._setOptions( { disabled: true } );
  400. },
  401. _classes: function( options ) {
  402. var full = [];
  403. var that = this;
  404. options = $.extend( {
  405. element: this.element,
  406. classes: this.options.classes || {}
  407. }, options );
  408. function processClassString( classes, checkOption ) {
  409. var current, i;
  410. for ( i = 0; i < classes.length; i++ ) {
  411. current = that.classesElementLookup[ classes[ i ] ] || $();
  412. if ( options.add ) {
  413. current = $( $.unique( current.get().concat( options.element.get() ) ) );
  414. } else {
  415. current = $( current.not( options.element ).get() );
  416. }
  417. that.classesElementLookup[ classes[ i ] ] = current;
  418. full.push( classes[ i ] );
  419. if ( checkOption && options.classes[ classes[ i ] ] ) {
  420. full.push( options.classes[ classes[ i ] ] );
  421. }
  422. }
  423. }
  424. this._on( options.element, {
  425. "remove": "_untrackClassesElement"
  426. } );
  427. if ( options.keys ) {
  428. processClassString( options.keys.match( /\S+/g ) || [], true );
  429. }
  430. if ( options.extra ) {
  431. processClassString( options.extra.match( /\S+/g ) || [] );
  432. }
  433. return full.join( " " );
  434. },
  435. _untrackClassesElement: function( event ) {
  436. var that = this;
  437. $.each( that.classesElementLookup, function( key, value ) {
  438. if ( $.inArray( event.target, value ) !== -1 ) {
  439. that.classesElementLookup[ key ] = $( value.not( event.target ).get() );
  440. }
  441. } );
  442. },
  443. _removeClass: function( element, keys, extra ) {
  444. return this._toggleClass( element, keys, extra, false );
  445. },
  446. _addClass: function( element, keys, extra ) {
  447. return this._toggleClass( element, keys, extra, true );
  448. },
  449. _toggleClass: function( element, keys, extra, add ) {
  450. add = ( typeof add === "boolean" ) ? add : extra;
  451. var shift = ( typeof element === "string" || element === null ),
  452. options = {
  453. extra: shift ? keys : extra,
  454. keys: shift ? element : keys,
  455. element: shift ? this.element : element,
  456. add: add
  457. };
  458. options.element.toggleClass( this._classes( options ), add );
  459. return this;
  460. },
  461. _on: function( suppressDisabledCheck, element, handlers ) {
  462. var delegateElement;
  463. var instance = this;
  464. // No suppressDisabledCheck flag, shuffle arguments
  465. if ( typeof suppressDisabledCheck !== "boolean" ) {
  466. handlers = element;
  467. element = suppressDisabledCheck;
  468. suppressDisabledCheck = false;
  469. }
  470. // No element argument, shuffle and use this.element
  471. if ( !handlers ) {
  472. handlers = element;
  473. element = this.element;
  474. delegateElement = this.widget();
  475. } else {
  476. element = delegateElement = $( element );
  477. this.bindings = this.bindings.add( element );
  478. }
  479. $.each( handlers, function( event, handler ) {
  480. function handlerProxy() {
  481. // Allow widgets to customize the disabled handling
  482. // - disabled as an array instead of boolean
  483. // - disabled class as method for disabling individual parts
  484. if ( !suppressDisabledCheck &&
  485. ( instance.options.disabled === true ||
  486. $( this ).hasClass( "ui-state-disabled" ) ) ) {
  487. return;
  488. }
  489. return ( typeof handler === "string" ? instance[ handler ] : handler )
  490. .apply( instance, arguments );
  491. }
  492. // Copy the guid so direct unbinding works
  493. if ( typeof handler !== "string" ) {
  494. handlerProxy.guid = handler.guid =
  495. handler.guid || handlerProxy.guid || $.guid++;
  496. }
  497. var match = event.match( /^([\w:-]*)\s*(.*)$/ );
  498. var eventName = match[ 1 ] + instance.eventNamespace;
  499. var selector = match[ 2 ];
  500. if ( selector ) {
  501. delegateElement.on( eventName, selector, handlerProxy );
  502. } else {
  503. element.on( eventName, handlerProxy );
  504. }
  505. } );
  506. },
  507. _off: function( element, eventName ) {
  508. eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
  509. this.eventNamespace;
  510. element.off( eventName ).off( eventName );
  511. // Clear the stack to avoid memory leaks (#10056)
  512. this.bindings = $( this.bindings.not( element ).get() );
  513. this.focusable = $( this.focusable.not( element ).get() );
  514. this.hoverable = $( this.hoverable.not( element ).get() );
  515. },
  516. _delay: function( handler, delay ) {
  517. function handlerProxy() {
  518. return ( typeof handler === "string" ? instance[ handler ] : handler )
  519. .apply( instance, arguments );
  520. }
  521. var instance = this;
  522. return setTimeout( handlerProxy, delay || 0 );
  523. },
  524. _hoverable: function( element ) {
  525. this.hoverable = this.hoverable.add( element );
  526. this._on( element, {
  527. mouseenter: function( event ) {
  528. this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
  529. },
  530. mouseleave: function( event ) {
  531. this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
  532. }
  533. } );
  534. },
  535. _focusable: function( element ) {
  536. this.focusable = this.focusable.add( element );
  537. this._on( element, {
  538. focusin: function( event ) {
  539. this._addClass( $( event.currentTarget ), null, "ui-state-focus" );
  540. },
  541. focusout: function( event ) {
  542. this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
  543. }
  544. } );
  545. },
  546. _trigger: function( type, event, data ) {
  547. var prop, orig;
  548. var callback = this.options[ type ];
  549. data = data || {};
  550. event = $.Event( event );
  551. event.type = ( type === this.widgetEventPrefix ?
  552. type :
  553. this.widgetEventPrefix + type ).toLowerCase();
  554. // The original event may come from any element
  555. // so we need to reset the target on the new event
  556. event.target = this.element[ 0 ];
  557. // Copy original event properties over to the new event
  558. orig = event.originalEvent;
  559. if ( orig ) {
  560. for ( prop in orig ) {
  561. if ( !( prop in event ) ) {
  562. event[ prop ] = orig[ prop ];
  563. }
  564. }
  565. }
  566. this.element.trigger( event, data );
  567. return !( $.isFunction( callback ) &&
  568. callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
  569. event.isDefaultPrevented() );
  570. }
  571. };
  572. $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
  573. $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
  574. if ( typeof options === "string" ) {
  575. options = { effect: options };
  576. }
  577. var hasOptions;
  578. var effectName = !options ?
  579. method :
  580. options === true || typeof options === "number" ?
  581. defaultEffect :
  582. options.effect || defaultEffect;
  583. options = options || {};
  584. if ( typeof options === "number" ) {
  585. options = { duration: options };
  586. }
  587. hasOptions = !$.isEmptyObject( options );
  588. options.complete = callback;
  589. if ( options.delay ) {
  590. element.delay( options.delay );
  591. }
  592. if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
  593. element[ method ]( options );
  594. } else if ( effectName !== method && element[ effectName ] ) {
  595. element[ effectName ]( options.duration, options.easing, callback );
  596. } else {
  597. element.queue( function( next ) {
  598. $( this )[ method ]();
  599. if ( callback ) {
  600. callback.call( element[ 0 ] );
  601. }
  602. next();
  603. } );
  604. }
  605. };
  606. } );
  607. var widget = $.widget;
  608. /*!
  609. * jQuery UI Position 1.12.1
  610. * http://jqueryui.com
  611. *
  612. * Copyright jQuery Foundation and other contributors
  613. * Released under the MIT license.
  614. * http://jquery.org/license
  615. *
  616. * http://api.jqueryui.com/position/
  617. */
  618. //>>label: Position
  619. //>>group: Core
  620. //>>description: Positions elements relative to other elements.
  621. //>>docs: http://api.jqueryui.com/position/
  622. //>>demos: http://jqueryui.com/position/
  623. ( function() {
  624. var cachedScrollbarWidth,
  625. max = Math.max,
  626. abs = Math.abs,
  627. rhorizontal = /left|center|right/,
  628. rvertical = /top|center|bottom/,
  629. roffset = /[\+\-]\d+(\.[\d]+)?%?/,
  630. rposition = /^\w+/,
  631. rpercent = /%$/,
  632. _position = $.fn.position;
  633. function getOffsets( offsets, width, height ) {
  634. return [
  635. parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
  636. parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
  637. ];
  638. }
  639. function parseCss( element, property ) {
  640. return parseInt( $.css( element, property ), 10 ) || 0;
  641. }
  642. function getDimensions( elem ) {
  643. var raw = elem[ 0 ];
  644. if ( raw.nodeType === 9 ) {
  645. return {
  646. width: elem.width(),
  647. height: elem.height(),
  648. offset: { top: 0, left: 0 }
  649. };
  650. }
  651. if ( $.isWindow( raw ) ) {
  652. return {
  653. width: elem.width(),
  654. height: elem.height(),
  655. offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
  656. };
  657. }
  658. if ( raw.preventDefault ) {
  659. return {
  660. width: 0,
  661. height: 0,
  662. offset: { top: raw.pageY, left: raw.pageX }
  663. };
  664. }
  665. return {
  666. width: elem.outerWidth(),
  667. height: elem.outerHeight(),
  668. offset: elem.offset()
  669. };
  670. }
  671. $.position = {
  672. scrollbarWidth: function() {
  673. if ( cachedScrollbarWidth !== undefined ) {
  674. return cachedScrollbarWidth;
  675. }
  676. var w1, w2,
  677. div = $( "<div " +
  678. "style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'>" +
  679. "<div style='height:100px;width:auto;'></div></div>" ),
  680. innerDiv = div.children()[ 0 ];
  681. $( "body" ).append( div );
  682. w1 = innerDiv.offsetWidth;
  683. div.css( "overflow", "scroll" );
  684. w2 = innerDiv.offsetWidth;
  685. if ( w1 === w2 ) {
  686. w2 = div[ 0 ].clientWidth;
  687. }
  688. div.remove();
  689. return ( cachedScrollbarWidth = w1 - w2 );
  690. },
  691. getScrollInfo: function( within ) {
  692. var overflowX = within.isWindow || within.isDocument ? "" :
  693. within.element.css( "overflow-x" ),
  694. overflowY = within.isWindow || within.isDocument ? "" :
  695. within.element.css( "overflow-y" ),
  696. hasOverflowX = overflowX === "scroll" ||
  697. ( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ),
  698. hasOverflowY = overflowY === "scroll" ||
  699. ( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight );
  700. return {
  701. width: hasOverflowY ? $.position.scrollbarWidth() : 0,
  702. height: hasOverflowX ? $.position.scrollbarWidth() : 0
  703. };
  704. },
  705. getWithinInfo: function( element ) {
  706. var withinElement = $( element || window ),
  707. isWindow = $.isWindow( withinElement[ 0 ] ),
  708. isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9,
  709. hasOffset = !isWindow && !isDocument;
  710. return {
  711. element: withinElement,
  712. isWindow: isWindow,
  713. isDocument: isDocument,
  714. offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 },
  715. scrollLeft: withinElement.scrollLeft(),
  716. scrollTop: withinElement.scrollTop(),
  717. width: withinElement.outerWidth(),
  718. height: withinElement.outerHeight()
  719. };
  720. }
  721. };
  722. $.fn.position = function( options ) {
  723. if ( !options || !options.of ) {
  724. return _position.apply( this, arguments );
  725. }
  726. // Make a copy, we don't want to modify arguments
  727. options = $.extend( {}, options );
  728. var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
  729. target = $( options.of ),
  730. within = $.position.getWithinInfo( options.within ),
  731. scrollInfo = $.position.getScrollInfo( within ),
  732. collision = ( options.collision || "flip" ).split( " " ),
  733. offsets = {};
  734. dimensions = getDimensions( target );
  735. if ( target[ 0 ].preventDefault ) {
  736. // Force left top to allow flipping
  737. options.at = "left top";
  738. }
  739. targetWidth = dimensions.width;
  740. targetHeight = dimensions.height;
  741. targetOffset = dimensions.offset;
  742. // Clone to reuse original targetOffset later
  743. basePosition = $.extend( {}, targetOffset );
  744. // Force my and at to have valid horizontal and vertical positions
  745. // if a value is missing or invalid, it will be converted to center
  746. $.each( [ "my", "at" ], function() {
  747. var pos = ( options[ this ] || "" ).split( " " ),
  748. horizontalOffset,
  749. verticalOffset;
  750. if ( pos.length === 1 ) {
  751. pos = rhorizontal.test( pos[ 0 ] ) ?
  752. pos.concat( [ "center" ] ) :
  753. rvertical.test( pos[ 0 ] ) ?
  754. [ "center" ].concat( pos ) :
  755. [ "center", "center" ];
  756. }
  757. pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
  758. pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
  759. // Calculate offsets
  760. horizontalOffset = roffset.exec( pos[ 0 ] );
  761. verticalOffset = roffset.exec( pos[ 1 ] );
  762. offsets[ this ] = [
  763. horizontalOffset ? horizontalOffset[ 0 ] : 0,
  764. verticalOffset ? verticalOffset[ 0 ] : 0
  765. ];
  766. // Reduce to just the positions without the offsets
  767. options[ this ] = [
  768. rposition.exec( pos[ 0 ] )[ 0 ],
  769. rposition.exec( pos[ 1 ] )[ 0 ]
  770. ];
  771. } );
  772. // Normalize collision option
  773. if ( collision.length === 1 ) {
  774. collision[ 1 ] = collision[ 0 ];
  775. }
  776. if ( options.at[ 0 ] === "right" ) {
  777. basePosition.left += targetWidth;
  778. } else if ( options.at[ 0 ] === "center" ) {
  779. basePosition.left += targetWidth / 2;
  780. }
  781. if ( options.at[ 1 ] === "bottom" ) {
  782. basePosition.top += targetHeight;
  783. } else if ( options.at[ 1 ] === "center" ) {
  784. basePosition.top += targetHeight / 2;
  785. }
  786. atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
  787. basePosition.left += atOffset[ 0 ];
  788. basePosition.top += atOffset[ 1 ];
  789. return this.each( function() {
  790. var collisionPosition, using,
  791. elem = $( this ),
  792. elemWidth = elem.outerWidth(),
  793. elemHeight = elem.outerHeight(),
  794. marginLeft = parseCss( this, "marginLeft" ),
  795. marginTop = parseCss( this, "marginTop" ),
  796. collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) +
  797. scrollInfo.width,
  798. collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) +
  799. scrollInfo.height,
  800. position = $.extend( {}, basePosition ),
  801. myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
  802. if ( options.my[ 0 ] === "right" ) {
  803. position.left -= elemWidth;
  804. } else if ( options.my[ 0 ] === "center" ) {
  805. position.left -= elemWidth / 2;
  806. }
  807. if ( options.my[ 1 ] === "bottom" ) {
  808. position.top -= elemHeight;
  809. } else if ( options.my[ 1 ] === "center" ) {
  810. position.top -= elemHeight / 2;
  811. }
  812. position.left += myOffset[ 0 ];
  813. position.top += myOffset[ 1 ];
  814. collisionPosition = {
  815. marginLeft: marginLeft,
  816. marginTop: marginTop
  817. };
  818. $.each( [ "left", "top" ], function( i, dir ) {
  819. if ( $.ui.position[ collision[ i ] ] ) {
  820. $.ui.position[ collision[ i ] ][ dir ]( position, {
  821. targetWidth: targetWidth,
  822. targetHeight: targetHeight,
  823. elemWidth: elemWidth,
  824. elemHeight: elemHeight,
  825. collisionPosition: collisionPosition,
  826. collisionWidth: collisionWidth,
  827. collisionHeight: collisionHeight,
  828. offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
  829. my: options.my,
  830. at: options.at,
  831. within: within,
  832. elem: elem
  833. } );
  834. }
  835. } );
  836. if ( options.using ) {
  837. // Adds feedback as second argument to using callback, if present
  838. using = function( props ) {
  839. var left = targetOffset.left - position.left,
  840. right = left + targetWidth - elemWidth,
  841. top = targetOffset.top - position.top,
  842. bottom = top + targetHeight - elemHeight,
  843. feedback = {
  844. target: {
  845. element: target,
  846. left: targetOffset.left,
  847. top: targetOffset.top,
  848. width: targetWidth,
  849. height: targetHeight
  850. },
  851. element: {
  852. element: elem,
  853. left: position.left,
  854. top: position.top,
  855. width: elemWidth,
  856. height: elemHeight
  857. },
  858. horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
  859. vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
  860. };
  861. if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
  862. feedback.horizontal = "center";
  863. }
  864. if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
  865. feedback.vertical = "middle";
  866. }
  867. if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
  868. feedback.important = "horizontal";
  869. } else {
  870. feedback.important = "vertical";
  871. }
  872. options.using.call( this, props, feedback );
  873. };
  874. }
  875. elem.offset( $.extend( position, { using: using } ) );
  876. } );
  877. };
  878. $.ui.position = {
  879. fit: {
  880. left: function( position, data ) {
  881. var within = data.within,
  882. withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
  883. outerWidth = within.width,
  884. collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  885. overLeft = withinOffset - collisionPosLeft,
  886. overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
  887. newOverRight;
  888. // Element is wider than within
  889. if ( data.collisionWidth > outerWidth ) {
  890. // Element is initially over the left side of within
  891. if ( overLeft > 0 && overRight <= 0 ) {
  892. newOverRight = position.left + overLeft + data.collisionWidth - outerWidth -
  893. withinOffset;
  894. position.left += overLeft - newOverRight;
  895. // Element is initially over right side of within
  896. } else if ( overRight > 0 && overLeft <= 0 ) {
  897. position.left = withinOffset;
  898. // Element is initially over both left and right sides of within
  899. } else {
  900. if ( overLeft > overRight ) {
  901. position.left = withinOffset + outerWidth - data.collisionWidth;
  902. } else {
  903. position.left = withinOffset;
  904. }
  905. }
  906. // Too far left -> align with left edge
  907. } else if ( overLeft > 0 ) {
  908. position.left += overLeft;
  909. // Too far right -> align with right edge
  910. } else if ( overRight > 0 ) {
  911. position.left -= overRight;
  912. // Adjust based on position and margin
  913. } else {
  914. position.left = max( position.left - collisionPosLeft, position.left );
  915. }
  916. },
  917. top: function( position, data ) {
  918. var within = data.within,
  919. withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
  920. outerHeight = data.within.height,
  921. collisionPosTop = position.top - data.collisionPosition.marginTop,
  922. overTop = withinOffset - collisionPosTop,
  923. overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
  924. newOverBottom;
  925. // Element is taller than within
  926. if ( data.collisionHeight > outerHeight ) {
  927. // Element is initially over the top of within
  928. if ( overTop > 0 && overBottom <= 0 ) {
  929. newOverBottom = position.top + overTop + data.collisionHeight - outerHeight -
  930. withinOffset;
  931. position.top += overTop - newOverBottom;
  932. // Element is initially over bottom of within
  933. } else if ( overBottom > 0 && overTop <= 0 ) {
  934. position.top = withinOffset;
  935. // Element is initially over both top and bottom of within
  936. } else {
  937. if ( overTop > overBottom ) {
  938. position.top = withinOffset + outerHeight - data.collisionHeight;
  939. } else {
  940. position.top = withinOffset;
  941. }
  942. }
  943. // Too far up -> align with top
  944. } else if ( overTop > 0 ) {
  945. position.top += overTop;
  946. // Too far down -> align with bottom edge
  947. } else if ( overBottom > 0 ) {
  948. position.top -= overBottom;
  949. // Adjust based on position and margin
  950. } else {
  951. position.top = max( position.top - collisionPosTop, position.top );
  952. }
  953. }
  954. },
  955. flip: {
  956. left: function( position, data ) {
  957. var within = data.within,
  958. withinOffset = within.offset.left + within.scrollLeft,
  959. outerWidth = within.width,
  960. offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
  961. collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  962. overLeft = collisionPosLeft - offsetLeft,
  963. overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
  964. myOffset = data.my[ 0 ] === "left" ?
  965. -data.elemWidth :
  966. data.my[ 0 ] === "right" ?
  967. data.elemWidth :
  968. 0,
  969. atOffset = data.at[ 0 ] === "left" ?
  970. data.targetWidth :
  971. data.at[ 0 ] === "right" ?
  972. -data.targetWidth :
  973. 0,
  974. offset = -2 * data.offset[ 0 ],
  975. newOverRight,
  976. newOverLeft;
  977. if ( overLeft < 0 ) {
  978. newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth -
  979. outerWidth - withinOffset;
  980. if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
  981. position.left += myOffset + atOffset + offset;
  982. }
  983. } else if ( overRight > 0 ) {
  984. newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset +
  985. atOffset + offset - offsetLeft;
  986. if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
  987. position.left += myOffset + atOffset + offset;
  988. }
  989. }
  990. },
  991. top: function( position, data ) {
  992. var within = data.within,
  993. withinOffset = within.offset.top + within.scrollTop,
  994. outerHeight = within.height,
  995. offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
  996. collisionPosTop = position.top - data.collisionPosition.marginTop,
  997. overTop = collisionPosTop - offsetTop,
  998. overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
  999. top = data.my[ 1 ] === "top",
  1000. myOffset = top ?
  1001. -data.elemHeight :
  1002. data.my[ 1 ] === "bottom" ?
  1003. data.elemHeight :
  1004. 0,
  1005. atOffset = data.at[ 1 ] === "top" ?
  1006. data.targetHeight :
  1007. data.at[ 1 ] === "bottom" ?
  1008. -data.targetHeight :
  1009. 0,
  1010. offset = -2 * data.offset[ 1 ],
  1011. newOverTop,
  1012. newOverBottom;
  1013. if ( overTop < 0 ) {
  1014. newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight -
  1015. outerHeight - withinOffset;
  1016. if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
  1017. position.top += myOffset + atOffset + offset;
  1018. }
  1019. } else if ( overBottom > 0 ) {
  1020. newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset +
  1021. offset - offsetTop;
  1022. if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
  1023. position.top += myOffset + atOffset + offset;
  1024. }
  1025. }
  1026. }
  1027. },
  1028. flipfit: {
  1029. left: function() {
  1030. $.ui.position.flip.left.apply( this, arguments );
  1031. $.ui.position.fit.left.apply( this, arguments );
  1032. },
  1033. top: function() {
  1034. $.ui.position.flip.top.apply( this, arguments );
  1035. $.ui.position.fit.top.apply( this, arguments );
  1036. }
  1037. }
  1038. };
  1039. } )();
  1040. var position = $.ui.position;
  1041. /*!
  1042. * jQuery UI :data 1.12.1
  1043. * http://jqueryui.com
  1044. *
  1045. * Copyright jQuery Foundation and other contributors
  1046. * Released under the MIT license.
  1047. * http://jquery.org/license
  1048. */
  1049. //>>label: :data Selector
  1050. //>>group: Core
  1051. //>>description: Selects elements which have data stored under the specified key.
  1052. //>>docs: http://api.jqueryui.com/data-selector/
  1053. var data = $.extend( $.expr[ ":" ], {
  1054. data: $.expr.createPseudo ?
  1055. $.expr.createPseudo( function( dataName ) {
  1056. return function( elem ) {
  1057. return !!$.data( elem, dataName );
  1058. };
  1059. } ) :
  1060. // Support: jQuery <1.8
  1061. function( elem, i, match ) {
  1062. return !!$.data( elem, match[ 3 ] );
  1063. }
  1064. } );
  1065. /*!
  1066. * jQuery UI Disable Selection 1.12.1
  1067. * http://jqueryui.com
  1068. *
  1069. * Copyright jQuery Foundation and other contributors
  1070. * Released under the MIT license.
  1071. * http://jquery.org/license
  1072. */
  1073. //>>label: disableSelection
  1074. //>>group: Core
  1075. //>>description: Disable selection of text content within the set of matched elements.
  1076. //>>docs: http://api.jqueryui.com/disableSelection/
  1077. // This file is deprecated
  1078. var disableSelection = $.fn.extend( {
  1079. disableSelection: ( function() {
  1080. var eventType = "onselectstart" in document.createElement( "div" ) ?
  1081. "selectstart" :
  1082. "mousedown";
  1083. return function() {
  1084. return this.on( eventType + ".ui-disableSelection", function( event ) {
  1085. event.preventDefault();
  1086. } );
  1087. };
  1088. } )(),
  1089. enableSelection: function() {
  1090. return this.off( ".ui-disableSelection" );
  1091. }
  1092. } );
  1093. /*!
  1094. * jQuery UI Focusable 1.12.1
  1095. * http://jqueryui.com
  1096. *
  1097. * Copyright jQuery Foundation and other contributors
  1098. * Released under the MIT license.
  1099. * http://jquery.org/license
  1100. */
  1101. //>>label: :focusable Selector
  1102. //>>group: Core
  1103. //>>description: Selects elements which can be focused.
  1104. //>>docs: http://api.jqueryui.com/focusable-selector/
  1105. // Selectors
  1106. $.ui.focusable = function( element, hasTabindex ) {
  1107. var map, mapName, img, focusableIfVisible, fieldset,
  1108. nodeName = element.nodeName.toLowerCase();
  1109. if ( "area" === nodeName ) {
  1110. map = element.parentNode;
  1111. mapName = map.name;
  1112. if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
  1113. return false;
  1114. }
  1115. img = $( "img[usemap='#" + mapName + "']" );
  1116. return img.length > 0 && img.is( ":visible" );
  1117. }
  1118. if ( /^(input|select|textarea|button|object)$/.test( nodeName ) ) {
  1119. focusableIfVisible = !element.disabled;
  1120. if ( focusableIfVisible ) {
  1121. // Form controls within a disabled fieldset are disabled.
  1122. // However, controls within the fieldset's legend do not get disabled.
  1123. // Since controls generally aren't placed inside legends, we skip
  1124. // this portion of the check.
  1125. fieldset = $( element ).closest( "fieldset" )[ 0 ];
  1126. if ( fieldset ) {
  1127. focusableIfVisible = !fieldset.disabled;
  1128. }
  1129. }
  1130. } else if ( "a" === nodeName ) {
  1131. focusableIfVisible = element.href || hasTabindex;
  1132. } else {
  1133. focusableIfVisible = hasTabindex;
  1134. }
  1135. return focusableIfVisible && $( element ).is( ":visible" ) && visible( $( element ) );
  1136. };
  1137. // Support: IE 8 only
  1138. // IE 8 doesn't resolve inherit to visible/hidden for computed values
  1139. function visible( element ) {
  1140. var visibility = element.css( "visibility" );
  1141. while ( visibility === "inherit" ) {
  1142. element = element.parent();
  1143. visibility = element.css( "visibility" );
  1144. }
  1145. return visibility !== "hidden";
  1146. }
  1147. $.extend( $.expr[ ":" ], {
  1148. focusable: function( element ) {
  1149. return $.ui.focusable( element, $.attr( element, "tabindex" ) != null );
  1150. }
  1151. } );
  1152. var focusable = $.ui.focusable;
  1153. // Support: IE8 Only
  1154. // IE8 does not support the form attribute and when it is supplied. It overwrites the form prop
  1155. // with a string, so we need to find the proper form.
  1156. var form = $.fn.form = function() {
  1157. return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form );
  1158. };
  1159. /*!
  1160. * jQuery UI Form Reset Mixin 1.12.1
  1161. * http://jqueryui.com
  1162. *
  1163. * Copyright jQuery Foundation and other contributors
  1164. * Released under the MIT license.
  1165. * http://jquery.org/license
  1166. */
  1167. //>>label: Form Reset Mixin
  1168. //>>group: Core
  1169. //>>description: Refresh input widgets when their form is reset
  1170. //>>docs: http://api.jqueryui.com/form-reset-mixin/
  1171. var formResetMixin = $.ui.formResetMixin = {
  1172. _formResetHandler: function() {
  1173. var form = $( this );
  1174. // Wait for the form reset to actually happen before refreshing
  1175. setTimeout( function() {
  1176. var instances = form.data( "ui-form-reset-instances" );
  1177. $.each( instances, function() {
  1178. this.refresh();
  1179. } );
  1180. } );
  1181. },
  1182. _bindFormResetHandler: function() {
  1183. this.form = this.element.form();
  1184. if ( !this.form.length ) {
  1185. return;
  1186. }
  1187. var instances = this.form.data( "ui-form-reset-instances" ) || [];
  1188. if ( !instances.length ) {
  1189. // We don't use _on() here because we use a single event handler per form
  1190. this.form.on( "reset.ui-form-reset", this._formResetHandler );
  1191. }
  1192. instances.push( this );
  1193. this.form.data( "ui-form-reset-instances", instances );
  1194. },
  1195. _unbindFormResetHandler: function() {
  1196. if ( !this.form.length ) {
  1197. return;
  1198. }
  1199. var instances = this.form.data( "ui-form-reset-instances" );
  1200. instances.splice( $.inArray( this, instances ), 1 );
  1201. if ( instances.length ) {
  1202. this.form.data( "ui-form-reset-instances", instances );
  1203. } else {
  1204. this.form
  1205. .removeData( "ui-form-reset-instances" )
  1206. .off( "reset.ui-form-reset" );
  1207. }
  1208. }
  1209. };
  1210. /*!
  1211. * jQuery UI Support for jQuery core 1.7.x 1.12.1
  1212. * http://jqueryui.com
  1213. *
  1214. * Copyright jQuery Foundation and other contributors
  1215. * Released under the MIT license.
  1216. * http://jquery.org/license
  1217. *
  1218. */
  1219. //>>label: jQuery 1.7 Support
  1220. //>>group: Core
  1221. //>>description: Support version 1.7.x of jQuery core
  1222. // Support: jQuery 1.7 only
  1223. // Not a great way to check versions, but since we only support 1.7+ and only
  1224. // need to detect <1.8, this is a simple check that should suffice. Checking
  1225. // for "1.7." would be a bit safer, but the version string is 1.7, not 1.7.0
  1226. // and we'll never reach 1.70.0 (if we do, we certainly won't be supporting
  1227. // 1.7 anymore). See #11197 for why we're not using feature detection.
  1228. if ( $.fn.jquery.substring( 0, 3 ) === "1.7" ) {
  1229. // Setters for .innerWidth(), .innerHeight(), .outerWidth(), .outerHeight()
  1230. // Unlike jQuery Core 1.8+, these only support numeric values to set the
  1231. // dimensions in pixels
  1232. $.each( [ "Width", "Height" ], function( i, name ) {
  1233. var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
  1234. type = name.toLowerCase(),
  1235. orig = {
  1236. innerWidth: $.fn.innerWidth,
  1237. innerHeight: $.fn.innerHeight,
  1238. outerWidth: $.fn.outerWidth,
  1239. outerHeight: $.fn.outerHeight
  1240. };
  1241. function reduce( elem, size, border, margin ) {
  1242. $.each( side, function() {
  1243. size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
  1244. if ( border ) {
  1245. size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
  1246. }
  1247. if ( margin ) {
  1248. size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
  1249. }
  1250. } );
  1251. return size;
  1252. }
  1253. $.fn[ "inner" + name ] = function( size ) {
  1254. if ( size === undefined ) {
  1255. return orig[ "inner" + name ].call( this );
  1256. }
  1257. return this.each( function() {
  1258. $( this ).css( type, reduce( this, size ) + "px" );
  1259. } );
  1260. };
  1261. $.fn[ "outer" + name ] = function( size, margin ) {
  1262. if ( typeof size !== "number" ) {
  1263. return orig[ "outer" + name ].call( this, size );
  1264. }
  1265. return this.each( function() {
  1266. $( this ).css( type, reduce( this, size, true, margin ) + "px" );
  1267. } );
  1268. };
  1269. } );
  1270. $.fn.addBack = function( selector ) {
  1271. return this.add( selector == null ?
  1272. this.prevObject : this.prevObject.filter( selector )
  1273. );
  1274. };
  1275. }
  1276. ;
  1277. /*!
  1278. * jQuery UI Keycode 1.12.1
  1279. * http://jqueryui.com
  1280. *
  1281. * Copyright jQuery Foundation and other contributors
  1282. * Released under the MIT license.
  1283. * http://jquery.org/license
  1284. */
  1285. //>>label: Keycode
  1286. //>>group: Core
  1287. //>>description: Provide keycodes as keynames
  1288. //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
  1289. var keycode = $.ui.keyCode = {
  1290. BACKSPACE: 8,
  1291. COMMA: 188,
  1292. DELETE: 46,
  1293. DOWN: 40,
  1294. END: 35,
  1295. ENTER: 13,
  1296. ESCAPE: 27,
  1297. HOME: 36,
  1298. LEFT: 37,
  1299. PAGE_DOWN: 34,
  1300. PAGE_UP: 33,
  1301. PERIOD: 190,
  1302. RIGHT: 39,
  1303. SPACE: 32,
  1304. TAB: 9,
  1305. UP: 38
  1306. };
  1307. // Internal use only
  1308. var escapeSelector = $.ui.escapeSelector = ( function() {
  1309. var selectorEscape = /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;
  1310. return function( selector ) {
  1311. return selector.replace( selectorEscape, "\\$1" );
  1312. };
  1313. } )();
  1314. /*!
  1315. * jQuery UI Labels 1.12.1
  1316. * http://jqueryui.com
  1317. *
  1318. * Copyright jQuery Foundation and other contributors
  1319. * Released under the MIT license.
  1320. * http://jquery.org/license
  1321. */
  1322. //>>label: labels
  1323. //>>group: Core
  1324. //>>description: Find all the labels associated with a given input
  1325. //>>docs: http://api.jqueryui.com/labels/
  1326. var labels = $.fn.labels = function() {
  1327. var ancestor, selector, id, labels, ancestors;
  1328. // Check control.labels first
  1329. if ( this[ 0 ].labels && this[ 0 ].labels.length ) {
  1330. return this.pushStack( this[ 0 ].labels );
  1331. }
  1332. // Support: IE <= 11, FF <= 37, Android <= 2.3 only
  1333. // Above browsers do not support control.labels. Everything below is to support them
  1334. // as well as document fragments. control.labels does not work on document fragments
  1335. labels = this.eq( 0 ).parents( "label" );
  1336. // Look for the label based on the id
  1337. id = this.attr( "id" );
  1338. if ( id ) {
  1339. // We don't search against the document in case the element
  1340. // is disconnected from the DOM
  1341. ancestor = this.eq( 0 ).parents().last();
  1342. // Get a full set of top level ancestors
  1343. ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() );
  1344. // Create a selector for the label based on the id
  1345. selector = "label[for='" + $.ui.escapeSelector( id ) + "']";
  1346. labels = labels.add( ancestors.find( selector ).addBack( selector ) );
  1347. }
  1348. // Return whatever we have found for labels
  1349. return this.pushStack( labels );
  1350. };
  1351. /*!
  1352. * jQuery UI Scroll Parent 1.12.1
  1353. * http://jqueryui.com
  1354. *
  1355. * Copyright jQuery Foundation and other contributors
  1356. * Released under the MIT license.
  1357. * http://jquery.org/license
  1358. */
  1359. //>>label: scrollParent
  1360. //>>group: Core
  1361. //>>description: Get the closest ancestor element that is scrollable.
  1362. //>>docs: http://api.jqueryui.com/scrollParent/
  1363. var scrollParent = $.fn.scrollParent = function( includeHidden ) {
  1364. var position = this.css( "position" ),
  1365. excludeStaticParent = position === "absolute",
  1366. overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
  1367. scrollParent = this.parents().filter( function() {
  1368. var parent = $( this );
  1369. if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
  1370. return false;
  1371. }
  1372. return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) +
  1373. parent.css( "overflow-x" ) );
  1374. } ).eq( 0 );
  1375. return position === "fixed" || !scrollParent.length ?
  1376. $( this[ 0 ].ownerDocument || document ) :
  1377. scrollParent;
  1378. };
  1379. /*!
  1380. * jQuery UI Tabbable 1.12.1
  1381. * http://jqueryui.com
  1382. *
  1383. * Copyright jQuery Foundation and other contributors
  1384. * Released under the MIT license.
  1385. * http://jquery.org/license
  1386. */
  1387. //>>label: :tabbable Selector
  1388. //>>group: Core
  1389. //>>description: Selects elements which can be tabbed to.
  1390. //>>docs: http://api.jqueryui.com/tabbable-selector/
  1391. var tabbable = $.extend( $.expr[ ":" ], {
  1392. tabbable: function( element ) {
  1393. var tabIndex = $.attr( element, "tabindex" ),
  1394. hasTabindex = tabIndex != null;
  1395. return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex );
  1396. }
  1397. } );
  1398. /*!
  1399. * jQuery UI Unique ID 1.12.1
  1400. * http://jqueryui.com
  1401. *
  1402. * Copyright jQuery Foundation and other contributors
  1403. * Released under the MIT license.
  1404. * http://jquery.org/license
  1405. */
  1406. //>>label: uniqueId
  1407. //>>group: Core
  1408. //>>description: Functions to generate and remove uniqueId's
  1409. //>>docs: http://api.jqueryui.com/uniqueId/
  1410. var uniqueId = $.fn.extend( {
  1411. uniqueId: ( function() {
  1412. var uuid = 0;
  1413. return function() {
  1414. return this.each( function() {
  1415. if ( !this.id ) {
  1416. this.id = "ui-id-" + ( ++uuid );
  1417. }
  1418. } );
  1419. };
  1420. } )(),
  1421. removeUniqueId: function() {
  1422. return this.each( function() {
  1423. if ( /^ui-id-\d+$/.test( this.id ) ) {
  1424. $( this ).removeAttr( "id" );
  1425. }
  1426. } );
  1427. }
  1428. } );
  1429. // This file is deprecated
  1430. var ie = $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
  1431. /*!
  1432. * jQuery UI Mouse 1.12.1
  1433. * http://jqueryui.com
  1434. *
  1435. * Copyright jQuery Foundation and other contributors
  1436. * Released under the MIT license.
  1437. * http://jquery.org/license
  1438. */
  1439. //>>label: Mouse
  1440. //>>group: Widgets
  1441. //>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
  1442. //>>docs: http://api.jqueryui.com/mouse/
  1443. var mouseHandled = false;
  1444. $( document ).on( "mouseup", function() {
  1445. mouseHandled = false;
  1446. } );
  1447. var widgetsMouse = $.widget( "ui.mouse", {
  1448. version: "1.12.1",
  1449. options: {
  1450. cancel: "input, textarea, button, select, option",
  1451. distance: 1,
  1452. delay: 0
  1453. },
  1454. _mouseInit: function() {
  1455. var that = this;
  1456. this.element
  1457. .on( "mousedown." + this.widgetName, function( event ) {
  1458. return that._mouseDown( event );
  1459. } )
  1460. .on( "click." + this.widgetName, function( event ) {
  1461. if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) {
  1462. $.removeData( event.target, that.widgetName + ".preventClickEvent" );
  1463. event.stopImmediatePropagation();
  1464. return false;
  1465. }
  1466. } );
  1467. this.started = false;
  1468. },
  1469. // TODO: make sure destroying one instance of mouse doesn't mess with
  1470. // other instances of mouse
  1471. _mouseDestroy: function() {
  1472. this.element.off( "." + this.widgetName );
  1473. if ( this._mouseMoveDelegate ) {
  1474. this.document
  1475. .off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  1476. .off( "mouseup." + this.widgetName, this._mouseUpDelegate );
  1477. }
  1478. },
  1479. _mouseDown: function( event ) {
  1480. // don't let more than one widget handle mouseStart
  1481. if ( mouseHandled ) {
  1482. return;
  1483. }
  1484. this._mouseMoved = false;
  1485. // We may have missed mouseup (out of window)
  1486. ( this._mouseStarted && this._mouseUp( event ) );
  1487. this._mouseDownEvent = event;
  1488. var that = this,
  1489. btnIsLeft = ( event.which === 1 ),
  1490. // event.target.nodeName works around a bug in IE 8 with
  1491. // disabled inputs (#7620)
  1492. elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ?
  1493. $( event.target ).closest( this.options.cancel ).length : false );
  1494. if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) {
  1495. return true;
  1496. }
  1497. this.mouseDelayMet = !this.options.delay;
  1498. if ( !this.mouseDelayMet ) {
  1499. this._mouseDelayTimer = setTimeout( function() {
  1500. that.mouseDelayMet = true;
  1501. }, this.options.delay );
  1502. }
  1503. if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
  1504. this._mouseStarted = ( this._mouseStart( event ) !== false );
  1505. if ( !this._mouseStarted ) {
  1506. event.preventDefault();
  1507. return true;
  1508. }
  1509. }
  1510. // Click event may never have fired (Gecko & Opera)
  1511. if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) {
  1512. $.removeData( event.target, this.widgetName + ".preventClickEvent" );
  1513. }
  1514. // These delegates are required to keep context
  1515. this._mouseMoveDelegate = function( event ) {
  1516. return that._mouseMove( event );
  1517. };
  1518. this._mouseUpDelegate = function( event ) {
  1519. return that._mouseUp( event );
  1520. };
  1521. this.document
  1522. .on( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  1523. .on( "mouseup." + this.widgetName, this._mouseUpDelegate );
  1524. event.preventDefault();
  1525. mouseHandled = true;
  1526. return true;
  1527. },
  1528. _mouseMove: function( event ) {
  1529. // Only check for mouseups outside the document if you've moved inside the document
  1530. // at least once. This prevents the firing of mouseup in the case of IE<9, which will
  1531. // fire a mousemove event if content is placed under the cursor. See #7778
  1532. // Support: IE <9
  1533. if ( this._mouseMoved ) {
  1534. // IE mouseup check - mouseup happened when mouse was out of window
  1535. if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) &&
  1536. !event.button ) {
  1537. return this._mouseUp( event );
  1538. // Iframe mouseup check - mouseup occurred in another document
  1539. } else if ( !event.which ) {
  1540. // Support: Safari <=8 - 9
  1541. // Safari sets which to 0 if you press any of the following keys
  1542. // during a drag (#14461)
  1543. if ( event.originalEvent.altKey || event.originalEvent.ctrlKey ||
  1544. event.originalEvent.metaKey || event.originalEvent.shiftKey ) {
  1545. this.ignoreMissingWhich = true;
  1546. } else if ( !this.ignoreMissingWhich ) {
  1547. return this._mouseUp( event );
  1548. }
  1549. }
  1550. }
  1551. if ( event.which || event.button ) {
  1552. this._mouseMoved = true;
  1553. }
  1554. if ( this._mouseStarted ) {
  1555. this._mouseDrag( event );
  1556. return event.preventDefault();
  1557. }
  1558. if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
  1559. this._mouseStarted =
  1560. ( this._mouseStart( this._mouseDownEvent, event ) !== false );
  1561. ( this._mouseStarted ? this._mouseDrag( event ) : this._mouseUp( event ) );
  1562. }
  1563. return !this._mouseStarted;
  1564. },
  1565. _mouseUp: function( event ) {
  1566. this.document
  1567. .off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  1568. .off( "mouseup." + this.widgetName, this._mouseUpDelegate );
  1569. if ( this._mouseStarted ) {
  1570. this._mouseStarted = false;
  1571. if ( event.target === this._mouseDownEvent.target ) {
  1572. $.data( event.target, this.widgetName + ".preventClickEvent", true );
  1573. }
  1574. this._mouseStop( event );
  1575. }
  1576. if ( this._mouseDelayTimer ) {
  1577. clearTimeout( this._mouseDelayTimer );
  1578. delete this._mouseDelayTimer;
  1579. }
  1580. this.ignoreMissingWhich = false;
  1581. mouseHandled = false;
  1582. event.preventDefault();
  1583. },
  1584. _mouseDistanceMet: function( event ) {
  1585. return ( Math.max(
  1586. Math.abs( this._mouseDownEvent.pageX - event.pageX ),
  1587. Math.abs( this._mouseDownEvent.pageY - event.pageY )
  1588. ) >= this.options.distance
  1589. );
  1590. },
  1591. _mouseDelayMet: function( /* event */ ) {
  1592. return this.mouseDelayMet;
  1593. },
  1594. // These are placeholder methods, to be overriden by extending plugin
  1595. _mouseStart: function( /* event */ ) {},
  1596. _mouseDrag: function( /* event */ ) {},
  1597. _mouseStop: function( /* event */ ) {},
  1598. _mouseCapture: function( /* event */ ) { return true; }
  1599. } );
  1600. // $.ui.plugin is deprecated. Use $.widget() extensions instead.
  1601. var plugin = $.ui.plugin = {
  1602. add: function( module, option, set ) {
  1603. var i,
  1604. proto = $.ui[ module ].prototype;
  1605. for ( i in set ) {
  1606. proto.plugins[ i ] = proto.plugins[ i ] || [];
  1607. proto.plugins[ i ].push( [ option, set[ i ] ] );
  1608. }
  1609. },
  1610. call: function( instance, name, args, allowDisconnected ) {
  1611. var i,
  1612. set = instance.plugins[ name ];
  1613. if ( !set ) {
  1614. return;
  1615. }
  1616. if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode ||
  1617. instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
  1618. return;
  1619. }
  1620. for ( i = 0; i < set.length; i++ ) {
  1621. if ( instance.options[ set[ i ][ 0 ] ] ) {
  1622. set[ i ][ 1 ].apply( instance.element, args );
  1623. }
  1624. }
  1625. }
  1626. };
  1627. var safeActiveElement = $.ui.safeActiveElement = function( document ) {
  1628. var activeElement;
  1629. // Support: IE 9 only
  1630. // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
  1631. try {
  1632. activeElement = document.activeElement;
  1633. } catch ( error ) {
  1634. activeElement = document.body;
  1635. }
  1636. // Support: IE 9 - 11 only
  1637. // IE may return null instead of an element
  1638. // Interestingly, this only seems to occur when NOT in an iframe
  1639. if ( !activeElement ) {
  1640. activeElement = document.body;
  1641. }
  1642. // Support: IE 11 only
  1643. // IE11 returns a seemingly empty object in some cases when accessing
  1644. // document.activeElement from an <iframe>
  1645. if ( !activeElement.nodeName ) {
  1646. activeElement = document.body;
  1647. }
  1648. return activeElement;
  1649. };
  1650. var safeBlur = $.ui.safeBlur = function( element ) {
  1651. // Support: IE9 - 10 only
  1652. // If the <body> is blurred, IE will switch windows, see #9420
  1653. if ( element && element.nodeName.toLowerCase() !== "body" ) {
  1654. $( element ).trigger( "blur" );
  1655. }
  1656. };
  1657. /*!
  1658. * jQuery UI Draggable 1.12.1
  1659. * http://jqueryui.com
  1660. *
  1661. * Copyright jQuery Foundation and other contributors
  1662. * Released under the MIT license.
  1663. * http://jquery.org/license
  1664. */
  1665. //>>label: Draggable
  1666. //>>group: Interactions
  1667. //>>description: Enables dragging functionality for any element.
  1668. //>>docs: http://api.jqueryui.com/draggable/
  1669. //>>demos: http://jqueryui.com/draggable/
  1670. //>>css.structure: ../../themes/base/draggable.css
  1671. $.widget( "ui.draggable", $.ui.mouse, {
  1672. version: "1.12.1",
  1673. widgetEventPrefix: "drag",
  1674. options: {
  1675. addClasses: true,
  1676. appendTo: "parent",
  1677. axis: false,
  1678. connectToSortable: false,
  1679. containment: false,
  1680. cursor: "auto",
  1681. cursorAt: false,
  1682. grid: false,
  1683. handle: false,
  1684. helper: "original",
  1685. iframeFix: false,
  1686. opacity: false,
  1687. refreshPositions: false,
  1688. revert: false,
  1689. revertDuration: 500,
  1690. scope: "default",
  1691. scroll: true,
  1692. scrollSensitivity: 20,
  1693. scrollSpeed: 20,
  1694. snap: false,
  1695. snapMode: "both",
  1696. snapTolerance: 20,
  1697. stack: false,
  1698. zIndex: false,
  1699. // Callbacks
  1700. drag: null,
  1701. start: null,
  1702. stop: null
  1703. },
  1704. _create: function() {
  1705. if ( this.options.helper === "original" ) {
  1706. this._setPositionRelative();
  1707. }
  1708. if ( this.options.addClasses ) {
  1709. this._addClass( "ui-draggable" );
  1710. }
  1711. this._setHandleClassName();
  1712. this._mouseInit();
  1713. },
  1714. _setOption: function( key, value ) {
  1715. this._super( key, value );
  1716. if ( key === "handle" ) {
  1717. this._removeHandleClassName();
  1718. this._setHandleClassName();
  1719. }
  1720. },
  1721. _destroy: function() {
  1722. if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {
  1723. this.destroyOnClear = true;
  1724. return;
  1725. }
  1726. this._removeHandleClassName();
  1727. this._mouseDestroy();
  1728. },
  1729. _mouseCapture: function( event ) {
  1730. var o = this.options;
  1731. // Among others, prevent a drag on a resizable-handle
  1732. if ( this.helper || o.disabled ||
  1733. $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) {
  1734. return false;
  1735. }
  1736. //Quit if we're not on a valid handle
  1737. this.handle = this._getHandle( event );
  1738. if ( !this.handle ) {
  1739. return false;
  1740. }
  1741. this._blurActiveElement( event );
  1742. this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );
  1743. return true;
  1744. },
  1745. _blockFrames: function( selector ) {
  1746. this.iframeBlocks = this.document.find( selector ).map( function() {
  1747. var iframe = $( this );
  1748. return $( "<div>" )
  1749. .css( "position", "absolute" )
  1750. .appendTo( iframe.parent() )
  1751. .outerWidth( iframe.outerWidth() )
  1752. .outerHeight( iframe.outerHeight() )
  1753. .offset( iframe.offset() )[ 0 ];
  1754. } );
  1755. },
  1756. _unblockFrames: function() {
  1757. if ( this.iframeBlocks ) {
  1758. this.iframeBlocks.remove();
  1759. delete this.iframeBlocks;
  1760. }
  1761. },
  1762. _blurActiveElement: function( event ) {
  1763. var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
  1764. target = $( event.target );
  1765. // Don't blur if the event occurred on an element that is within
  1766. // the currently focused element
  1767. // See #10527, #12472
  1768. if ( target.closest( activeElement ).length ) {
  1769. return;
  1770. }
  1771. // Blur any element that currently has focus, see #4261
  1772. $.ui.safeBlur( activeElement );
  1773. },
  1774. _mouseStart: function( event ) {
  1775. var o = this.options;
  1776. //Create and append the visible helper
  1777. this.helper = this._createHelper( event );
  1778. this._addClass( this.helper, "ui-draggable-dragging" );
  1779. //Cache the helper size
  1780. this._cacheHelperProportions();
  1781. //If ddmanager is used for droppables, set the global draggable
  1782. if ( $.ui.ddmanager ) {
  1783. $.ui.ddmanager.current = this;
  1784. }
  1785. /*
  1786. * - Position generation -
  1787. * This block generates everything position related - it's the core of draggables.
  1788. */
  1789. //Cache the margins of the original element
  1790. this._cacheMargins();
  1791. //Store the helper's css position
  1792. this.cssPosition = this.helper.css( "position" );
  1793. this.scrollParent = this.helper.scrollParent( true );
  1794. this.offsetParent = this.helper.offsetParent();
  1795. this.hasFixedAncestor = this.helper.parents().filter( function() {
  1796. return $( this ).css( "position" ) === "fixed";
  1797. } ).length > 0;
  1798. //The element's absolute position on the page minus margins
  1799. this.positionAbs = this.element.offset();
  1800. this._refreshOffsets( event );
  1801. //Generate the original position
  1802. this.originalPosition = this.position = this._generatePosition( event, false );
  1803. this.originalPageX = event.pageX;
  1804. this.originalPageY = event.pageY;
  1805. //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
  1806. ( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) );
  1807. //Set a containment if given in the options
  1808. this._setContainment();
  1809. //Trigger event + callbacks
  1810. if ( this._trigger( "start", event ) === false ) {
  1811. this._clear();
  1812. return false;
  1813. }
  1814. //Recache the helper size
  1815. this._cacheHelperProportions();
  1816. //Prepare the droppable offsets
  1817. if ( $.ui.ddmanager && !o.dropBehaviour ) {
  1818. $.ui.ddmanager.prepareOffsets( this, event );
  1819. }
  1820. // Execute the drag once - this causes the helper not to be visible before getting its
  1821. // correct position
  1822. this._mouseDrag( event, true );
  1823. // If the ddmanager is used for droppables, inform the manager that dragging has started
  1824. // (see #5003)
  1825. if ( $.ui.ddmanager ) {
  1826. $.ui.ddmanager.dragStart( this, event );
  1827. }
  1828. return true;
  1829. },
  1830. _refreshOffsets: function( event ) {
  1831. this.offset = {
  1832. top: this.positionAbs.top - this.margins.top,
  1833. left: this.positionAbs.left - this.margins.left,
  1834. scroll: false,
  1835. parent: this._getParentOffset(),
  1836. relative: this._getRelativeOffset()
  1837. };
  1838. this.offset.click = {
  1839. left: event.pageX - this.offset.left,
  1840. top: event.pageY - this.offset.top
  1841. };
  1842. },
  1843. _mouseDrag: function( event, noPropagation ) {
  1844. // reset any necessary cached properties (see #5009)
  1845. if ( this.hasFixedAncestor ) {
  1846. this.offset.parent = this._getParentOffset();
  1847. }
  1848. //Compute the helpers position
  1849. this.position = this._generatePosition( event, true );
  1850. this.positionAbs = this._convertPositionTo( "absolute" );
  1851. //Call plugins and callbacks and use the resulting position if something is returned
  1852. if ( !noPropagation ) {
  1853. var ui = this._uiHash();
  1854. if ( this._trigger( "drag", event, ui ) === false ) {
  1855. this._mouseUp( new $.Event( "mouseup", event ) );
  1856. return false;
  1857. }
  1858. this.position = ui.position;
  1859. }
  1860. this.helper[ 0 ].style.left = this.position.left + "px";
  1861. this.helper[ 0 ].style.top = this.position.top + "px";
  1862. if ( $.ui.ddmanager ) {
  1863. $.ui.ddmanager.drag( this, event );
  1864. }
  1865. return false;
  1866. },
  1867. _mouseStop: function( event ) {
  1868. //If we are using droppables, inform the manager about the drop
  1869. var that = this,
  1870. dropped = false;
  1871. if ( $.ui.ddmanager && !this.options.dropBehaviour ) {
  1872. dropped = $.ui.ddmanager.drop( this, event );
  1873. }
  1874. //if a drop comes from outside (a sortable)
  1875. if ( this.dropped ) {
  1876. dropped = this.dropped;
  1877. this.dropped = false;
  1878. }
  1879. if ( ( this.options.revert === "invalid" && !dropped ) ||
  1880. ( this.options.revert === "valid" && dropped ) ||
  1881. this.options.revert === true || ( $.isFunction( this.options.revert ) &&
  1882. this.options.revert.call( this.element, dropped ) )
  1883. ) {
  1884. $( this.helper ).animate(
  1885. this.originalPosition,
  1886. parseInt( this.options.revertDuration, 10 ),
  1887. function() {
  1888. if ( that._trigger( "stop", event ) !== false ) {
  1889. that._clear();
  1890. }
  1891. }
  1892. );
  1893. } else {
  1894. if ( this._trigger( "stop", event ) !== false ) {
  1895. this._clear();
  1896. }
  1897. }
  1898. return false;
  1899. },
  1900. _mouseUp: function( event ) {
  1901. this._unblockFrames();
  1902. // If the ddmanager is used for droppables, inform the manager that dragging has stopped
  1903. // (see #5003)
  1904. if ( $.ui.ddmanager ) {
  1905. $.ui.ddmanager.dragStop( this, event );
  1906. }
  1907. // Only need to focus if the event occurred on the draggable itself, see #10527
  1908. if ( this.handleElement.is( event.target ) ) {
  1909. // The interaction is over; whether or not the click resulted in a drag,
  1910. // focus the element
  1911. this.element.trigger( "focus" );
  1912. }
  1913. return $.ui.mouse.prototype._mouseUp.call( this, event );
  1914. },
  1915. cancel: function() {
  1916. if ( this.helper.is( ".ui-draggable-dragging" ) ) {
  1917. this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) );
  1918. } else {
  1919. this._clear();
  1920. }
  1921. return this;
  1922. },
  1923. _getHandle: function( event ) {
  1924. return this.options.handle ?
  1925. !!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
  1926. true;
  1927. },
  1928. _setHandleClassName: function() {
  1929. this.handleElement = this.options.handle ?
  1930. this.element.find( this.options.handle ) : this.element;
  1931. this._addClass( this.handleElement, "ui-draggable-handle" );
  1932. },
  1933. _removeHandleClassName: function() {
  1934. this._removeClass( this.handleElement, "ui-draggable-handle" );
  1935. },
  1936. _createHelper: function( event ) {
  1937. var o = this.options,
  1938. helperIsFunction = $.isFunction( o.helper ),
  1939. helper = helperIsFunction ?
  1940. $( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
  1941. ( o.helper === "clone" ?
  1942. this.element.clone().removeAttr( "id" ) :
  1943. this.element );
  1944. if ( !helper.parents( "body" ).length ) {
  1945. helper.appendTo( ( o.appendTo === "parent" ?
  1946. this.element[ 0 ].parentNode :
  1947. o.appendTo ) );
  1948. }
  1949. // Http://bugs.jqueryui.com/ticket/9446
  1950. // a helper function can return the original element
  1951. // which wouldn't have been set to relative in _create
  1952. if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {
  1953. this._setPositionRelative();
  1954. }
  1955. if ( helper[ 0 ] !== this.element[ 0 ] &&
  1956. !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) {
  1957. helper.css( "position", "absolute" );
  1958. }
  1959. return helper;
  1960. },
  1961. _setPositionRelative: function() {
  1962. if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {
  1963. this.element[ 0 ].style.position = "relative";
  1964. }
  1965. },
  1966. _adjustOffsetFromHelper: function( obj ) {
  1967. if ( typeof obj === "string" ) {
  1968. obj = obj.split( " " );
  1969. }
  1970. if ( $.isArray( obj ) ) {
  1971. obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
  1972. }
  1973. if ( "left" in obj ) {
  1974. this.offset.click.left = obj.left + this.margins.left;
  1975. }
  1976. if ( "right" in obj ) {
  1977. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  1978. }
  1979. if ( "top" in obj ) {
  1980. this.offset.click.top = obj.top + this.margins.top;
  1981. }
  1982. if ( "bottom" in obj ) {
  1983. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  1984. }
  1985. },
  1986. _isRootNode: function( element ) {
  1987. return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];
  1988. },
  1989. _getParentOffset: function() {
  1990. //Get the offsetParent and cache its position
  1991. var po = this.offsetParent.offset(),
  1992. document = this.document[ 0 ];
  1993. // This is a special case where we need to modify a offset calculated on start, since the
  1994. // following happened:
  1995. // 1. The position of the helper is absolute, so it's position is calculated based on the
  1996. // next positioned parent
  1997. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
  1998. // the document, which means that the scroll is included in the initial calculation of the
  1999. // offset of the parent, and never recalculated upon drag
  2000. if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document &&
  2001. $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
  2002. po.left += this.scrollParent.scrollLeft();
  2003. po.top += this.scrollParent.scrollTop();
  2004. }
  2005. if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {
  2006. po = { top: 0, left: 0 };
  2007. }
  2008. return {
  2009. top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),
  2010. left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )
  2011. };
  2012. },
  2013. _getRelativeOffset: function() {
  2014. if ( this.cssPosition !== "relative" ) {
  2015. return { top: 0, left: 0 };
  2016. }
  2017. var p = this.element.position(),
  2018. scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
  2019. return {
  2020. top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +
  2021. ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),
  2022. left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +
  2023. ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 )
  2024. };
  2025. },
  2026. _cacheMargins: function() {
  2027. this.margins = {
  2028. left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ),
  2029. top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ),
  2030. right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ),
  2031. bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 )
  2032. };
  2033. },
  2034. _cacheHelperProportions: function() {
  2035. this.helperProportions = {
  2036. width: this.helper.outerWidth(),
  2037. height: this.helper.outerHeight()
  2038. };
  2039. },
  2040. _setContainment: function() {
  2041. var isUserScrollable, c, ce,
  2042. o = this.options,
  2043. document = this.document[ 0 ];
  2044. this.relativeContainer = null;
  2045. if ( !o.containment ) {
  2046. this.containment = null;
  2047. return;
  2048. }
  2049. if ( o.containment === "window" ) {
  2050. this.containment = [
  2051. $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
  2052. $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
  2053. $( window ).scrollLeft() + $( window ).width() -
  2054. this.helperProportions.width - this.margins.left,
  2055. $( window ).scrollTop() +
  2056. ( $( window ).height() || document.body.parentNode.scrollHeight ) -
  2057. this.helperProportions.height - this.margins.top
  2058. ];
  2059. return;
  2060. }
  2061. if ( o.containment === "document" ) {
  2062. this.containment = [
  2063. 0,
  2064. 0,
  2065. $( document ).width() - this.helperProportions.width - this.margins.left,
  2066. ( $( document ).height() || document.body.parentNode.scrollHeight ) -
  2067. this.helperProportions.height - this.margins.top
  2068. ];
  2069. return;
  2070. }
  2071. if ( o.containment.constructor === Array ) {
  2072. this.containment = o.containment;
  2073. return;
  2074. }
  2075. if ( o.containment === "parent" ) {
  2076. o.containment = this.helper[ 0 ].parentNode;
  2077. }
  2078. c = $( o.containment );
  2079. ce = c[ 0 ];
  2080. if ( !ce ) {
  2081. return;
  2082. }
  2083. isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );
  2084. this.containment = [
  2085. ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) +
  2086. ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
  2087. ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) +
  2088. ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
  2089. ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
  2090. ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -
  2091. ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -
  2092. this.helperProportions.width -
  2093. this.margins.left -
  2094. this.margins.right,
  2095. ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
  2096. ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -
  2097. ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -
  2098. this.helperProportions.height -
  2099. this.margins.top -
  2100. this.margins.bottom
  2101. ];
  2102. this.relativeContainer = c;
  2103. },
  2104. _convertPositionTo: function( d, pos ) {
  2105. if ( !pos ) {
  2106. pos = this.position;
  2107. }
  2108. var mod = d === "absolute" ? 1 : -1,
  2109. scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
  2110. return {
  2111. top: (
  2112. // The absolute mouse position
  2113. pos.top +
  2114. // Only for relative positioned nodes: Relative offset from element to offset parent
  2115. this.offset.relative.top * mod +
  2116. // The offsetParent's offset without borders (offset + border)
  2117. this.offset.parent.top * mod -
  2118. ( ( this.cssPosition === "fixed" ?
  2119. -this.offset.scroll.top :
  2120. ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod )
  2121. ),
  2122. left: (
  2123. // The absolute mouse position
  2124. pos.left +
  2125. // Only for relative positioned nodes: Relative offset from element to offset parent
  2126. this.offset.relative.left * mod +
  2127. // The offsetParent's offset without borders (offset + border)
  2128. this.offset.parent.left * mod -
  2129. ( ( this.cssPosition === "fixed" ?
  2130. -this.offset.scroll.left :
  2131. ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod )
  2132. )
  2133. };
  2134. },
  2135. _generatePosition: function( event, constrainPosition ) {
  2136. var containment, co, top, left,
  2137. o = this.options,
  2138. scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),
  2139. pageX = event.pageX,
  2140. pageY = event.pageY;
  2141. // Cache the scroll
  2142. if ( !scrollIsRootNode || !this.offset.scroll ) {
  2143. this.offset.scroll = {
  2144. top: this.scrollParent.scrollTop(),
  2145. left: this.scrollParent.scrollLeft()
  2146. };
  2147. }
  2148. /*
  2149. * - Position constraining -
  2150. * Constrain the position to a mix of grid, containment.
  2151. */
  2152. // If we are not dragging yet, we won't check for options
  2153. if ( constrainPosition ) {
  2154. if ( this.containment ) {
  2155. if ( this.relativeContainer ) {
  2156. co = this.relativeContainer.offset();
  2157. containment = [
  2158. this.containment[ 0 ] + co.left,
  2159. this.containment[ 1 ] + co.top,
  2160. this.containment[ 2 ] + co.left,
  2161. this.containment[ 3 ] + co.top
  2162. ];
  2163. } else {
  2164. containment = this.containment;
  2165. }
  2166. if ( event.pageX - this.offset.click.left < containment[ 0 ] ) {
  2167. pageX = containment[ 0 ] + this.offset.click.left;
  2168. }
  2169. if ( event.pageY - this.offset.click.top < containment[ 1 ] ) {
  2170. pageY = containment[ 1 ] + this.offset.click.top;
  2171. }
  2172. if ( event.pageX - this.offset.click.left > containment[ 2 ] ) {
  2173. pageX = containment[ 2 ] + this.offset.click.left;
  2174. }
  2175. if ( event.pageY - this.offset.click.top > containment[ 3 ] ) {
  2176. pageY = containment[ 3 ] + this.offset.click.top;
  2177. }
  2178. }
  2179. if ( o.grid ) {
  2180. //Check for grid elements set to 0 to prevent divide by 0 error causing invalid
  2181. // argument errors in IE (see ticket #6950)
  2182. top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY -
  2183. this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY;
  2184. pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] ||
  2185. top - this.offset.click.top > containment[ 3 ] ) ?
  2186. top :
  2187. ( ( top - this.offset.click.top >= containment[ 1 ] ) ?
  2188. top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top;
  2189. left = o.grid[ 0 ] ? this.originalPageX +
  2190. Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] :
  2191. this.originalPageX;
  2192. pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] ||
  2193. left - this.offset.click.left > containment[ 2 ] ) ?
  2194. left :
  2195. ( ( left - this.offset.click.left >= containment[ 0 ] ) ?
  2196. left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left;
  2197. }
  2198. if ( o.axis === "y" ) {
  2199. pageX = this.originalPageX;
  2200. }
  2201. if ( o.axis === "x" ) {
  2202. pageY = this.originalPageY;
  2203. }
  2204. }
  2205. return {
  2206. top: (
  2207. // The absolute mouse position
  2208. pageY -
  2209. // Click offset (relative to the element)
  2210. this.offset.click.top -
  2211. // Only for relative positioned nodes: Relative offset from element to offset parent
  2212. this.offset.relative.top -
  2213. // The offsetParent's offset without borders (offset + border)
  2214. this.offset.parent.top +
  2215. ( this.cssPosition === "fixed" ?
  2216. -this.offset.scroll.top :
  2217. ( scrollIsRootNode ? 0 : this.offset.scroll.top ) )
  2218. ),
  2219. left: (
  2220. // The absolute mouse position
  2221. pageX -
  2222. // Click offset (relative to the element)
  2223. this.offset.click.left -
  2224. // Only for relative positioned nodes: Relative offset from element to offset parent
  2225. this.offset.relative.left -
  2226. // The offsetParent's offset without borders (offset + border)
  2227. this.offset.parent.left +
  2228. ( this.cssPosition === "fixed" ?
  2229. -this.offset.scroll.left :
  2230. ( scrollIsRootNode ? 0 : this.offset.scroll.left ) )
  2231. )
  2232. };
  2233. },
  2234. _clear: function() {
  2235. this._removeClass( this.helper, "ui-draggable-dragging" );
  2236. if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) {
  2237. this.helper.remove();
  2238. }
  2239. this.helper = null;
  2240. this.cancelHelperRemoval = false;
  2241. if ( this.destroyOnClear ) {
  2242. this.destroy();
  2243. }
  2244. },
  2245. // From now on bulk stuff - mainly helpers
  2246. _trigger: function( type, event, ui ) {
  2247. ui = ui || this._uiHash();
  2248. $.ui.plugin.call( this, type, [ event, ui, this ], true );
  2249. // Absolute position and offset (see #6884 ) have to be recalculated after plugins
  2250. if ( /^(drag|start|stop)/.test( type ) ) {
  2251. this.positionAbs = this._convertPositionTo( "absolute" );
  2252. ui.offset = this.positionAbs;
  2253. }
  2254. return $.Widget.prototype._trigger.call( this, type, event, ui );
  2255. },
  2256. plugins: {},
  2257. _uiHash: function() {
  2258. return {
  2259. helper: this.helper,
  2260. position: this.position,
  2261. originalPosition: this.originalPosition,
  2262. offset: this.positionAbs
  2263. };
  2264. }
  2265. } );
  2266. $.ui.plugin.add( "draggable", "connectToSortable", {
  2267. start: function( event, ui, draggable ) {
  2268. var uiSortable = $.extend( {}, ui, {
  2269. item: draggable.element
  2270. } );
  2271. draggable.sortables = [];
  2272. $( draggable.options.connectToSortable ).each( function() {
  2273. var sortable = $( this ).sortable( "instance" );
  2274. if ( sortable && !sortable.options.disabled ) {
  2275. draggable.sortables.push( sortable );
  2276. // RefreshPositions is called at drag start to refresh the containerCache
  2277. // which is used in drag. This ensures it's initialized and synchronized
  2278. // with any changes that might have happened on the page since initialization.
  2279. sortable.refreshPositions();
  2280. sortable._trigger( "activate", event, uiSortable );
  2281. }
  2282. } );
  2283. },
  2284. stop: function( event, ui, draggable ) {
  2285. var uiSortable = $.extend( {}, ui, {
  2286. item: draggable.element
  2287. } );
  2288. draggable.cancelHelperRemoval = false;
  2289. $.each( draggable.sortables, function() {
  2290. var sortable = this;
  2291. if ( sortable.isOver ) {
  2292. sortable.isOver = 0;
  2293. // Allow this sortable to handle removing the helper
  2294. draggable.cancelHelperRemoval = true;
  2295. sortable.cancelHelperRemoval = false;
  2296. // Use _storedCSS To restore properties in the sortable,
  2297. // as this also handles revert (#9675) since the draggable
  2298. // may have modified them in unexpected ways (#8809)
  2299. sortable._storedCSS = {
  2300. position: sortable.placeholder.css( "position" ),
  2301. top: sortable.placeholder.css( "top" ),
  2302. left: sortable.placeholder.css( "left" )
  2303. };
  2304. sortable._mouseStop( event );
  2305. // Once drag has ended, the sortable should return to using
  2306. // its original helper, not the shared helper from draggable
  2307. sortable.options.helper = sortable.options._helper;
  2308. } else {
  2309. // Prevent this Sortable from removing the helper.
  2310. // However, don't set the draggable to remove the helper
  2311. // either as another connected Sortable may yet handle the removal.
  2312. sortable.cancelHelperRemoval = true;
  2313. sortable._trigger( "deactivate", event, uiSortable );
  2314. }
  2315. } );
  2316. },
  2317. drag: function( event, ui, draggable ) {
  2318. $.each( draggable.sortables, function() {
  2319. var innermostIntersecting = false,
  2320. sortable = this;
  2321. // Copy over variables that sortable's _intersectsWith uses
  2322. sortable.positionAbs = draggable.positionAbs;
  2323. sortable.helperProportions = draggable.helperProportions;
  2324. sortable.offset.click = draggable.offset.click;
  2325. if ( sortable._intersectsWith( sortable.containerCache ) ) {
  2326. innermostIntersecting = true;
  2327. $.each( draggable.sortables, function() {
  2328. // Copy over variables that sortable's _intersectsWith uses
  2329. this.positionAbs = draggable.positionAbs;
  2330. this.helperProportions = draggable.helperProportions;
  2331. this.offset.click = draggable.offset.click;
  2332. if ( this !== sortable &&
  2333. this._intersectsWith( this.containerCache ) &&
  2334. $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {
  2335. innermostIntersecting = false;
  2336. }
  2337. return innermostIntersecting;
  2338. } );
  2339. }
  2340. if ( innermostIntersecting ) {
  2341. // If it intersects, we use a little isOver variable and set it once,
  2342. // so that the move-in stuff gets fired only once.
  2343. if ( !sortable.isOver ) {
  2344. sortable.isOver = 1;
  2345. // Store draggable's parent in case we need to reappend to it later.
  2346. draggable._parent = ui.helper.parent();
  2347. sortable.currentItem = ui.helper
  2348. .appendTo( sortable.element )
  2349. .data( "ui-sortable-item", true );
  2350. // Store helper option to later restore it
  2351. sortable.options._helper = sortable.options.helper;
  2352. sortable.options.helper = function() {
  2353. return ui.helper[ 0 ];
  2354. };
  2355. // Fire the start events of the sortable with our passed browser event,
  2356. // and our own helper (so it doesn't create a new one)
  2357. event.target = sortable.currentItem[ 0 ];
  2358. sortable._mouseCapture( event, true );
  2359. sortable._mouseStart( event, true, true );
  2360. // Because the browser event is way off the new appended portlet,
  2361. // modify necessary variables to reflect the changes
  2362. sortable.offset.click.top = draggable.offset.click.top;
  2363. sortable.offset.click.left = draggable.offset.click.left;
  2364. sortable.offset.parent.left -= draggable.offset.parent.left -
  2365. sortable.offset.parent.left;
  2366. sortable.offset.parent.top -= draggable.offset.parent.top -
  2367. sortable.offset.parent.top;
  2368. draggable._trigger( "toSortable", event );
  2369. // Inform draggable that the helper is in a valid drop zone,
  2370. // used solely in the revert option to handle "valid/invalid".
  2371. draggable.dropped = sortable.element;
  2372. // Need to refreshPositions of all sortables in the case that
  2373. // adding to one sortable changes the location of the other sortables (#9675)
  2374. $.each( draggable.sortables, function() {
  2375. this.refreshPositions();
  2376. } );
  2377. // Hack so receive/update callbacks work (mostly)
  2378. draggable.currentItem = draggable.element;
  2379. sortable.fromOutside = draggable;
  2380. }
  2381. if ( sortable.currentItem ) {
  2382. sortable._mouseDrag( event );
  2383. // Copy the sortable's position because the draggable's can potentially reflect
  2384. // a relative position, while sortable is always absolute, which the dragged
  2385. // element has now become. (#8809)
  2386. ui.position = sortable.position;
  2387. }
  2388. } else {
  2389. // If it doesn't intersect with the sortable, and it intersected before,
  2390. // we fake the drag stop of the sortable, but make sure it doesn't remove
  2391. // the helper by using cancelHelperRemoval.
  2392. if ( sortable.isOver ) {
  2393. sortable.isOver = 0;
  2394. sortable.cancelHelperRemoval = true;
  2395. // Calling sortable's mouseStop would trigger a revert,
  2396. // so revert must be temporarily false until after mouseStop is called.
  2397. sortable.options._revert = sortable.options.revert;
  2398. sortable.options.revert = false;
  2399. sortable._trigger( "out", event, sortable._uiHash( sortable ) );
  2400. sortable._mouseStop( event, true );
  2401. // Restore sortable behaviors that were modfied
  2402. // when the draggable entered the sortable area (#9481)
  2403. sortable.options.revert = sortable.options._revert;
  2404. sortable.options.helper = sortable.options._helper;
  2405. if ( sortable.placeholder ) {
  2406. sortable.placeholder.remove();
  2407. }
  2408. // Restore and recalculate the draggable's offset considering the sortable
  2409. // may have modified them in unexpected ways. (#8809, #10669)
  2410. ui.helper.appendTo( draggable._parent );
  2411. draggable._refreshOffsets( event );
  2412. ui.position = draggable._generatePosition( event, true );
  2413. draggable._trigger( "fromSortable", event );
  2414. // Inform draggable that the helper is no longer in a valid drop zone
  2415. draggable.dropped = false;
  2416. // Need to refreshPositions of all sortables just in case removing
  2417. // from one sortable changes the location of other sortables (#9675)
  2418. $.each( draggable.sortables, function() {
  2419. this.refreshPositions();
  2420. } );
  2421. }
  2422. }
  2423. } );
  2424. }
  2425. } );
  2426. $.ui.plugin.add( "draggable", "cursor", {
  2427. start: function( event, ui, instance ) {
  2428. var t = $( "body" ),
  2429. o = instance.options;
  2430. if ( t.css( "cursor" ) ) {
  2431. o._cursor = t.css( "cursor" );
  2432. }
  2433. t.css( "cursor", o.cursor );
  2434. },
  2435. stop: function( event, ui, instance ) {
  2436. var o = instance.options;
  2437. if ( o._cursor ) {
  2438. $( "body" ).css( "cursor", o._cursor );
  2439. }
  2440. }
  2441. } );
  2442. $.ui.plugin.add( "draggable", "opacity", {
  2443. start: function( event, ui, instance ) {
  2444. var t = $( ui.helper ),
  2445. o = instance.options;
  2446. if ( t.css( "opacity" ) ) {
  2447. o._opacity = t.css( "opacity" );
  2448. }
  2449. t.css( "opacity", o.opacity );
  2450. },
  2451. stop: function( event, ui, instance ) {
  2452. var o = instance.options;
  2453. if ( o._opacity ) {
  2454. $( ui.helper ).css( "opacity", o._opacity );
  2455. }
  2456. }
  2457. } );
  2458. $.ui.plugin.add( "draggable", "scroll", {
  2459. start: function( event, ui, i ) {
  2460. if ( !i.scrollParentNotHidden ) {
  2461. i.scrollParentNotHidden = i.helper.scrollParent( false );
  2462. }
  2463. if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] &&
  2464. i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {
  2465. i.overflowOffset = i.scrollParentNotHidden.offset();
  2466. }
  2467. },
  2468. drag: function( event, ui, i ) {
  2469. var o = i.options,
  2470. scrolled = false,
  2471. scrollParent = i.scrollParentNotHidden[ 0 ],
  2472. document = i.document[ 0 ];
  2473. if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {
  2474. if ( !o.axis || o.axis !== "x" ) {
  2475. if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY <
  2476. o.scrollSensitivity ) {
  2477. scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
  2478. } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {
  2479. scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
  2480. }
  2481. }
  2482. if ( !o.axis || o.axis !== "y" ) {
  2483. if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX <
  2484. o.scrollSensitivity ) {
  2485. scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
  2486. } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {
  2487. scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
  2488. }
  2489. }
  2490. } else {
  2491. if ( !o.axis || o.axis !== "x" ) {
  2492. if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) {
  2493. scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed );
  2494. } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) <
  2495. o.scrollSensitivity ) {
  2496. scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed );
  2497. }
  2498. }
  2499. if ( !o.axis || o.axis !== "y" ) {
  2500. if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) {
  2501. scrolled = $( document ).scrollLeft(
  2502. $( document ).scrollLeft() - o.scrollSpeed
  2503. );
  2504. } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) <
  2505. o.scrollSensitivity ) {
  2506. scrolled = $( document ).scrollLeft(
  2507. $( document ).scrollLeft() + o.scrollSpeed
  2508. );
  2509. }
  2510. }
  2511. }
  2512. if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) {
  2513. $.ui.ddmanager.prepareOffsets( i, event );
  2514. }
  2515. }
  2516. } );
  2517. $.ui.plugin.add( "draggable", "snap", {
  2518. start: function( event, ui, i ) {
  2519. var o = i.options;
  2520. i.snapElements = [];
  2521. $( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap )
  2522. .each( function() {
  2523. var $t = $( this ),
  2524. $o = $t.offset();
  2525. if ( this !== i.element[ 0 ] ) {
  2526. i.snapElements.push( {
  2527. item: this,
  2528. width: $t.outerWidth(), height: $t.outerHeight(),
  2529. top: $o.top, left: $o.left
  2530. } );
  2531. }
  2532. } );
  2533. },
  2534. drag: function( event, ui, inst ) {
  2535. var ts, bs, ls, rs, l, r, t, b, i, first,
  2536. o = inst.options,
  2537. d = o.snapTolerance,
  2538. x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
  2539. y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
  2540. for ( i = inst.snapElements.length - 1; i >= 0; i-- ) {
  2541. l = inst.snapElements[ i ].left - inst.margins.left;
  2542. r = l + inst.snapElements[ i ].width;
  2543. t = inst.snapElements[ i ].top - inst.margins.top;
  2544. b = t + inst.snapElements[ i ].height;
  2545. if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d ||
  2546. !$.contains( inst.snapElements[ i ].item.ownerDocument,
  2547. inst.snapElements[ i ].item ) ) {
  2548. if ( inst.snapElements[ i ].snapping ) {
  2549. ( inst.options.snap.release &&
  2550. inst.options.snap.release.call(
  2551. inst.element,
  2552. event,
  2553. $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } )
  2554. ) );
  2555. }
  2556. inst.snapElements[ i ].snapping = false;
  2557. continue;
  2558. }
  2559. if ( o.snapMode !== "inner" ) {
  2560. ts = Math.abs( t - y2 ) <= d;
  2561. bs = Math.abs( b - y1 ) <= d;
  2562. ls = Math.abs( l - x2 ) <= d;
  2563. rs = Math.abs( r - x1 ) <= d;
  2564. if ( ts ) {
  2565. ui.position.top = inst._convertPositionTo( "relative", {
  2566. top: t - inst.helperProportions.height,
  2567. left: 0
  2568. } ).top;
  2569. }
  2570. if ( bs ) {
  2571. ui.position.top = inst._convertPositionTo( "relative", {
  2572. top: b,
  2573. left: 0
  2574. } ).top;
  2575. }
  2576. if ( ls ) {
  2577. ui.position.left = inst._convertPositionTo( "relative", {
  2578. top: 0,
  2579. left: l - inst.helperProportions.width
  2580. } ).left;
  2581. }
  2582. if ( rs ) {
  2583. ui.position.left = inst._convertPositionTo( "relative", {
  2584. top: 0,
  2585. left: r
  2586. } ).left;
  2587. }
  2588. }
  2589. first = ( ts || bs || ls || rs );
  2590. if ( o.snapMode !== "outer" ) {
  2591. ts = Math.abs( t - y1 ) <= d;
  2592. bs = Math.abs( b - y2 ) <= d;
  2593. ls = Math.abs( l - x1 ) <= d;
  2594. rs = Math.abs( r - x2 ) <= d;
  2595. if ( ts ) {
  2596. ui.position.top = inst._convertPositionTo( "relative", {
  2597. top: t,
  2598. left: 0
  2599. } ).top;
  2600. }
  2601. if ( bs ) {
  2602. ui.position.top = inst._convertPositionTo( "relative", {
  2603. top: b - inst.helperProportions.height,
  2604. left: 0
  2605. } ).top;
  2606. }
  2607. if ( ls ) {
  2608. ui.position.left = inst._convertPositionTo( "relative", {
  2609. top: 0,
  2610. left: l
  2611. } ).left;
  2612. }
  2613. if ( rs ) {
  2614. ui.position.left = inst._convertPositionTo( "relative", {
  2615. top: 0,
  2616. left: r - inst.helperProportions.width
  2617. } ).left;
  2618. }
  2619. }
  2620. if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) {
  2621. ( inst.options.snap.snap &&
  2622. inst.options.snap.snap.call(
  2623. inst.element,
  2624. event,
  2625. $.extend( inst._uiHash(), {
  2626. snapItem: inst.snapElements[ i ].item
  2627. } ) ) );
  2628. }
  2629. inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first );
  2630. }
  2631. }
  2632. } );
  2633. $.ui.plugin.add( "draggable", "stack", {
  2634. start: function( event, ui, instance ) {
  2635. var min,
  2636. o = instance.options,
  2637. group = $.makeArray( $( o.stack ) ).sort( function( a, b ) {
  2638. return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) -
  2639. ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 );
  2640. } );
  2641. if ( !group.length ) { return; }
  2642. min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0;
  2643. $( group ).each( function( i ) {
  2644. $( this ).css( "zIndex", min + i );
  2645. } );
  2646. this.css( "zIndex", ( min + group.length ) );
  2647. }
  2648. } );
  2649. $.ui.plugin.add( "draggable", "zIndex", {
  2650. start: function( event, ui, instance ) {
  2651. var t = $( ui.helper ),
  2652. o = instance.options;
  2653. if ( t.css( "zIndex" ) ) {
  2654. o._zIndex = t.css( "zIndex" );
  2655. }
  2656. t.css( "zIndex", o.zIndex );
  2657. },
  2658. stop: function( event, ui, instance ) {
  2659. var o = instance.options;
  2660. if ( o._zIndex ) {
  2661. $( ui.helper ).css( "zIndex", o._zIndex );
  2662. }
  2663. }
  2664. } );
  2665. var widgetsDraggable = $.ui.draggable;
  2666. /*!
  2667. * jQuery UI Droppable 1.12.1
  2668. * http://jqueryui.com
  2669. *
  2670. * Copyright jQuery Foundation and other contributors
  2671. * Released under the MIT license.
  2672. * http://jquery.org/license
  2673. */
  2674. //>>label: Droppable
  2675. //>>group: Interactions
  2676. //>>description: Enables drop targets for draggable elements.
  2677. //>>docs: http://api.jqueryui.com/droppable/
  2678. //>>demos: http://jqueryui.com/droppable/
  2679. $.widget( "ui.droppable", {
  2680. version: "1.12.1",
  2681. widgetEventPrefix: "drop",
  2682. options: {
  2683. accept: "*",
  2684. addClasses: true,
  2685. greedy: false,
  2686. scope: "default",
  2687. tolerance: "intersect",
  2688. // Callbacks
  2689. activate: null,
  2690. deactivate: null,
  2691. drop: null,
  2692. out: null,
  2693. over: null
  2694. },
  2695. _create: function() {
  2696. var proportions,
  2697. o = this.options,
  2698. accept = o.accept;
  2699. this.isover = false;
  2700. this.isout = true;
  2701. this.accept = $.isFunction( accept ) ? accept : function( d ) {
  2702. return d.is( accept );
  2703. };
  2704. this.proportions = function( /* valueToWrite */ ) {
  2705. if ( arguments.length ) {
  2706. // Store the droppable's proportions
  2707. proportions = arguments[ 0 ];
  2708. } else {
  2709. // Retrieve or derive the droppable's proportions
  2710. return proportions ?
  2711. proportions :
  2712. proportions = {
  2713. width: this.element[ 0 ].offsetWidth,
  2714. height: this.element[ 0 ].offsetHeight
  2715. };
  2716. }
  2717. };
  2718. this._addToManager( o.scope );
  2719. o.addClasses && this._addClass( "ui-droppable" );
  2720. },
  2721. _addToManager: function( scope ) {
  2722. // Add the reference and positions to the manager
  2723. $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || [];
  2724. $.ui.ddmanager.droppables[ scope ].push( this );
  2725. },
  2726. _splice: function( drop ) {
  2727. var i = 0;
  2728. for ( ; i < drop.length; i++ ) {
  2729. if ( drop[ i ] === this ) {
  2730. drop.splice( i, 1 );
  2731. }
  2732. }
  2733. },
  2734. _destroy: function() {
  2735. var drop = $.ui.ddmanager.droppables[ this.options.scope ];
  2736. this._splice( drop );
  2737. },
  2738. _setOption: function( key, value ) {
  2739. if ( key === "accept" ) {
  2740. this.accept = $.isFunction( value ) ? value : function( d ) {
  2741. return d.is( value );
  2742. };
  2743. } else if ( key === "scope" ) {
  2744. var drop = $.ui.ddmanager.droppables[ this.options.scope ];
  2745. this._splice( drop );
  2746. this._addToManager( value );
  2747. }
  2748. this._super( key, value );
  2749. },
  2750. _activate: function( event ) {
  2751. var draggable = $.ui.ddmanager.current;
  2752. this._addActiveClass();
  2753. if ( draggable ) {
  2754. this._trigger( "activate", event, this.ui( draggable ) );
  2755. }
  2756. },
  2757. _deactivate: function( event ) {
  2758. var draggable = $.ui.ddmanager.current;
  2759. this._removeActiveClass();
  2760. if ( draggable ) {
  2761. this._trigger( "deactivate", event, this.ui( draggable ) );
  2762. }
  2763. },
  2764. _over: function( event ) {
  2765. var draggable = $.ui.ddmanager.current;
  2766. // Bail if draggable and droppable are same element
  2767. if ( !draggable || ( draggable.currentItem ||
  2768. draggable.element )[ 0 ] === this.element[ 0 ] ) {
  2769. return;
  2770. }
  2771. if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
  2772. draggable.element ) ) ) {
  2773. this._addHoverClass();
  2774. this._trigger( "over", event, this.ui( draggable ) );
  2775. }
  2776. },
  2777. _out: function( event ) {
  2778. var draggable = $.ui.ddmanager.current;
  2779. // Bail if draggable and droppable are same element
  2780. if ( !draggable || ( draggable.currentItem ||
  2781. draggable.element )[ 0 ] === this.element[ 0 ] ) {
  2782. return;
  2783. }
  2784. if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
  2785. draggable.element ) ) ) {
  2786. this._removeHoverClass();
  2787. this._trigger( "out", event, this.ui( draggable ) );
  2788. }
  2789. },
  2790. _drop: function( event, custom ) {
  2791. var draggable = custom || $.ui.ddmanager.current,
  2792. childrenIntersection = false;
  2793. // Bail if draggable and droppable are same element
  2794. if ( !draggable || ( draggable.currentItem ||
  2795. draggable.element )[ 0 ] === this.element[ 0 ] ) {
  2796. return false;
  2797. }
  2798. this.element
  2799. .find( ":data(ui-droppable)" )
  2800. .not( ".ui-draggable-dragging" )
  2801. .each( function() {
  2802. var inst = $( this ).droppable( "instance" );
  2803. if (
  2804. inst.options.greedy &&
  2805. !inst.options.disabled &&
  2806. inst.options.scope === draggable.options.scope &&
  2807. inst.accept.call(
  2808. inst.element[ 0 ], ( draggable.currentItem || draggable.element )
  2809. ) &&
  2810. intersect(
  2811. draggable,
  2812. $.extend( inst, { offset: inst.element.offset() } ),
  2813. inst.options.tolerance, event
  2814. )
  2815. ) {
  2816. childrenIntersection = true;
  2817. return false; }
  2818. } );
  2819. if ( childrenIntersection ) {
  2820. return false;
  2821. }
  2822. if ( this.accept.call( this.element[ 0 ],
  2823. ( draggable.currentItem || draggable.element ) ) ) {
  2824. this._removeActiveClass();
  2825. this._removeHoverClass();
  2826. this._trigger( "drop", event, this.ui( draggable ) );
  2827. return this.element;
  2828. }
  2829. return false;
  2830. },
  2831. ui: function( c ) {
  2832. return {
  2833. draggable: ( c.currentItem || c.element ),
  2834. helper: c.helper,
  2835. position: c.position,
  2836. offset: c.positionAbs
  2837. };
  2838. },
  2839. // Extension points just to make backcompat sane and avoid duplicating logic
  2840. // TODO: Remove in 1.13 along with call to it below
  2841. _addHoverClass: function() {
  2842. this._addClass( "ui-droppable-hover" );
  2843. },
  2844. _removeHoverClass: function() {
  2845. this._removeClass( "ui-droppable-hover" );
  2846. },
  2847. _addActiveClass: function() {
  2848. this._addClass( "ui-droppable-active" );
  2849. },
  2850. _removeActiveClass: function() {
  2851. this._removeClass( "ui-droppable-active" );
  2852. }
  2853. } );
  2854. var intersect = $.ui.intersect = ( function() {
  2855. function isOverAxis( x, reference, size ) {
  2856. return ( x >= reference ) && ( x < ( reference + size ) );
  2857. }
  2858. return function( draggable, droppable, toleranceMode, event ) {
  2859. if ( !droppable.offset ) {
  2860. return false;
  2861. }
  2862. var x1 = ( draggable.positionAbs ||
  2863. draggable.position.absolute ).left + draggable.margins.left,
  2864. y1 = ( draggable.positionAbs ||
  2865. draggable.position.absolute ).top + draggable.margins.top,
  2866. x2 = x1 + draggable.helperProportions.width,
  2867. y2 = y1 + draggable.helperProportions.height,
  2868. l = droppable.offset.left,
  2869. t = droppable.offset.top,
  2870. r = l + droppable.proportions().width,
  2871. b = t + droppable.proportions().height;
  2872. switch ( toleranceMode ) {
  2873. case "fit":
  2874. return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
  2875. case "intersect":
  2876. return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half
  2877. x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half
  2878. t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
  2879. y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
  2880. case "pointer":
  2881. return isOverAxis( event.pageY, t, droppable.proportions().height ) &&
  2882. isOverAxis( event.pageX, l, droppable.proportions().width );
  2883. case "touch":
  2884. return (
  2885. ( y1 >= t && y1 <= b ) || // Top edge touching
  2886. ( y2 >= t && y2 <= b ) || // Bottom edge touching
  2887. ( y1 < t && y2 > b ) // Surrounded vertically
  2888. ) && (
  2889. ( x1 >= l && x1 <= r ) || // Left edge touching
  2890. ( x2 >= l && x2 <= r ) || // Right edge touching
  2891. ( x1 < l && x2 > r ) // Surrounded horizontally
  2892. );
  2893. default:
  2894. return false;
  2895. }
  2896. };
  2897. } )();
  2898. /*
  2899. This manager tracks offsets of draggables and droppables
  2900. */
  2901. $.ui.ddmanager = {
  2902. current: null,
  2903. droppables: { "default": [] },
  2904. prepareOffsets: function( t, event ) {
  2905. var i, j,
  2906. m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
  2907. type = event ? event.type : null, // workaround for #2317
  2908. list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack();
  2909. droppablesLoop: for ( i = 0; i < m.length; i++ ) {
  2910. // No disabled and non-accepted
  2911. if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ],
  2912. ( t.currentItem || t.element ) ) ) ) {
  2913. continue;
  2914. }
  2915. // Filter out elements in the current dragged item
  2916. for ( j = 0; j < list.length; j++ ) {
  2917. if ( list[ j ] === m[ i ].element[ 0 ] ) {
  2918. m[ i ].proportions().height = 0;
  2919. continue droppablesLoop;
  2920. }
  2921. }
  2922. m[ i ].visible = m[ i ].element.css( "display" ) !== "none";
  2923. if ( !m[ i ].visible ) {
  2924. continue;
  2925. }
  2926. // Activate the droppable if used directly from draggables
  2927. if ( type === "mousedown" ) {
  2928. m[ i ]._activate.call( m[ i ], event );
  2929. }
  2930. m[ i ].offset = m[ i ].element.offset();
  2931. m[ i ].proportions( {
  2932. width: m[ i ].element[ 0 ].offsetWidth,
  2933. height: m[ i ].element[ 0 ].offsetHeight
  2934. } );
  2935. }
  2936. },
  2937. drop: function( draggable, event ) {
  2938. var dropped = false;
  2939. // Create a copy of the droppables in case the list changes during the drop (#9116)
  2940. $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() {
  2941. if ( !this.options ) {
  2942. return;
  2943. }
  2944. if ( !this.options.disabled && this.visible &&
  2945. intersect( draggable, this, this.options.tolerance, event ) ) {
  2946. dropped = this._drop.call( this, event ) || dropped;
  2947. }
  2948. if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ],
  2949. ( draggable.currentItem || draggable.element ) ) ) {
  2950. this.isout = true;
  2951. this.isover = false;
  2952. this._deactivate.call( this, event );
  2953. }
  2954. } );
  2955. return dropped;
  2956. },
  2957. dragStart: function( draggable, event ) {
  2958. // Listen for scrolling so that if the dragging causes scrolling the position of the
  2959. // droppables can be recalculated (see #5003)
  2960. draggable.element.parentsUntil( "body" ).on( "scroll.droppable", function() {
  2961. if ( !draggable.options.refreshPositions ) {
  2962. $.ui.ddmanager.prepareOffsets( draggable, event );
  2963. }
  2964. } );
  2965. },
  2966. drag: function( draggable, event ) {
  2967. // If you have a highly dynamic page, you might try this option. It renders positions
  2968. // every time you move the mouse.
  2969. if ( draggable.options.refreshPositions ) {
  2970. $.ui.ddmanager.prepareOffsets( draggable, event );
  2971. }
  2972. // Run through all droppables and check their positions based on specific tolerance options
  2973. $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() {
  2974. if ( this.options.disabled || this.greedyChild || !this.visible ) {
  2975. return;
  2976. }
  2977. var parentInstance, scope, parent,
  2978. intersects = intersect( draggable, this, this.options.tolerance, event ),
  2979. c = !intersects && this.isover ?
  2980. "isout" :
  2981. ( intersects && !this.isover ? "isover" : null );
  2982. if ( !c ) {
  2983. return;
  2984. }
  2985. if ( this.options.greedy ) {
  2986. // find droppable parents with same scope
  2987. scope = this.options.scope;
  2988. parent = this.element.parents( ":data(ui-droppable)" ).filter( function() {
  2989. return $( this ).droppable( "instance" ).options.scope === scope;
  2990. } );
  2991. if ( parent.length ) {
  2992. parentInstance = $( parent[ 0 ] ).droppable( "instance" );
  2993. parentInstance.greedyChild = ( c === "isover" );
  2994. }
  2995. }
  2996. // We just moved into a greedy child
  2997. if ( parentInstance && c === "isover" ) {
  2998. parentInstance.isover = false;
  2999. parentInstance.isout = true;
  3000. parentInstance._out.call( parentInstance, event );
  3001. }
  3002. this[ c ] = true;
  3003. this[ c === "isout" ? "isover" : "isout" ] = false;
  3004. this[ c === "isover" ? "_over" : "_out" ].call( this, event );
  3005. // We just moved out of a greedy child
  3006. if ( parentInstance && c === "isout" ) {
  3007. parentInstance.isout = false;
  3008. parentInstance.isover = true;
  3009. parentInstance._over.call( parentInstance, event );
  3010. }
  3011. } );
  3012. },
  3013. dragStop: function( draggable, event ) {
  3014. draggable.element.parentsUntil( "body" ).off( "scroll.droppable" );
  3015. // Call prepareOffsets one final time since IE does not fire return scroll events when
  3016. // overflow was caused by drag (see #5003)
  3017. if ( !draggable.options.refreshPositions ) {
  3018. $.ui.ddmanager.prepareOffsets( draggable, event );
  3019. }
  3020. }
  3021. };
  3022. // DEPRECATED
  3023. // TODO: switch return back to widget declaration at top of file when this is removed
  3024. if ( $.uiBackCompat !== false ) {
  3025. // Backcompat for activeClass and hoverClass options
  3026. $.widget( "ui.droppable", $.ui.droppable, {
  3027. options: {
  3028. hoverClass: false,
  3029. activeClass: false
  3030. },
  3031. _addActiveClass: function() {
  3032. this._super();
  3033. if ( this.options.activeClass ) {
  3034. this.element.addClass( this.options.activeClass );
  3035. }
  3036. },
  3037. _removeActiveClass: function() {
  3038. this._super();
  3039. if ( this.options.activeClass ) {
  3040. this.element.removeClass( this.options.activeClass );
  3041. }
  3042. },
  3043. _addHoverClass: function() {
  3044. this._super();
  3045. if ( this.options.hoverClass ) {
  3046. this.element.addClass( this.options.hoverClass );
  3047. }
  3048. },
  3049. _removeHoverClass: function() {
  3050. this._super();
  3051. if ( this.options.hoverClass ) {
  3052. this.element.removeClass( this.options.hoverClass );
  3053. }
  3054. }
  3055. } );
  3056. }
  3057. var widgetsDroppable = $.ui.droppable;
  3058. /*!
  3059. * jQuery UI Resizable 1.12.1
  3060. * http://jqueryui.com
  3061. *
  3062. * Copyright jQuery Foundation and other contributors
  3063. * Released under the MIT license.
  3064. * http://jquery.org/license
  3065. */
  3066. //>>label: Resizable
  3067. //>>group: Interactions
  3068. //>>description: Enables resize functionality for any element.
  3069. //>>docs: http://api.jqueryui.com/resizable/
  3070. //>>demos: http://jqueryui.com/resizable/
  3071. //>>css.structure: ../../themes/base/core.css
  3072. //>>css.structure: ../../themes/base/resizable.css
  3073. //>>css.theme: ../../themes/base/theme.css
  3074. $.widget( "ui.resizable", $.ui.mouse, {
  3075. version: "1.12.1",
  3076. widgetEventPrefix: "resize",
  3077. options: {
  3078. alsoResize: false,
  3079. animate: false,
  3080. animateDuration: "slow",
  3081. animateEasing: "swing",
  3082. aspectRatio: false,
  3083. autoHide: false,
  3084. classes: {
  3085. "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se"
  3086. },
  3087. containment: false,
  3088. ghost: false,
  3089. grid: false,
  3090. handles: "e,s,se",
  3091. helper: false,
  3092. maxHeight: null,
  3093. maxWidth: null,
  3094. minHeight: 10,
  3095. minWidth: 10,
  3096. // See #7960
  3097. zIndex: 90,
  3098. // Callbacks
  3099. resize: null,
  3100. start: null,
  3101. stop: null
  3102. },
  3103. _num: function( value ) {
  3104. return parseFloat( value ) || 0;
  3105. },
  3106. _isNumber: function( value ) {
  3107. return !isNaN( parseFloat( value ) );
  3108. },
  3109. _hasScroll: function( el, a ) {
  3110. if ( $( el ).css( "overflow" ) === "hidden" ) {
  3111. return false;
  3112. }
  3113. var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
  3114. has = false;
  3115. if ( el[ scroll ] > 0 ) {
  3116. return true;
  3117. }
  3118. // TODO: determine which cases actually cause this to happen
  3119. // if the element doesn't have the scroll set, see if it's possible to
  3120. // set the scroll
  3121. el[ scroll ] = 1;
  3122. has = ( el[ scroll ] > 0 );
  3123. el[ scroll ] = 0;
  3124. return has;
  3125. },
  3126. _create: function() {
  3127. var margins,
  3128. o = this.options,
  3129. that = this;
  3130. this._addClass( "ui-resizable" );
  3131. $.extend( this, {
  3132. _aspectRatio: !!( o.aspectRatio ),
  3133. aspectRatio: o.aspectRatio,
  3134. originalElement: this.element,
  3135. _proportionallyResizeElements: [],
  3136. _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
  3137. } );
  3138. // Wrap the element if it cannot hold child nodes
  3139. if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) {
  3140. this.element.wrap(
  3141. $( "<div class='ui-wrapper' style='overflow: hidden;'></div>" ).css( {
  3142. position: this.element.css( "position" ),
  3143. width: this.element.outerWidth(),
  3144. height: this.element.outerHeight(),
  3145. top: this.element.css( "top" ),
  3146. left: this.element.css( "left" )
  3147. } )
  3148. );
  3149. this.element = this.element.parent().data(
  3150. "ui-resizable", this.element.resizable( "instance" )
  3151. );
  3152. this.elementIsWrapper = true;
  3153. margins = {
  3154. marginTop: this.originalElement.css( "marginTop" ),
  3155. marginRight: this.originalElement.css( "marginRight" ),
  3156. marginBottom: this.originalElement.css( "marginBottom" ),
  3157. marginLeft: this.originalElement.css( "marginLeft" )
  3158. };
  3159. this.element.css( margins );
  3160. this.originalElement.css( "margin", 0 );
  3161. // support: Safari
  3162. // Prevent Safari textarea resize
  3163. this.originalResizeStyle = this.originalElement.css( "resize" );
  3164. this.originalElement.css( "resize", "none" );
  3165. this._proportionallyResizeElements.push( this.originalElement.css( {
  3166. position: "static",
  3167. zoom: 1,
  3168. display: "block"
  3169. } ) );
  3170. // Support: IE9
  3171. // avoid IE jump (hard set the margin)
  3172. this.originalElement.css( margins );
  3173. this._proportionallyResize();
  3174. }
  3175. this._setupHandles();
  3176. if ( o.autoHide ) {
  3177. $( this.element )
  3178. .on( "mouseenter", function() {
  3179. if ( o.disabled ) {
  3180. return;
  3181. }
  3182. that._removeClass( "ui-resizable-autohide" );
  3183. that._handles.show();
  3184. } )
  3185. .on( "mouseleave", function() {
  3186. if ( o.disabled ) {
  3187. return;
  3188. }
  3189. if ( !that.resizing ) {
  3190. that._addClass( "ui-resizable-autohide" );
  3191. that._handles.hide();
  3192. }
  3193. } );
  3194. }
  3195. this._mouseInit();
  3196. },
  3197. _destroy: function() {
  3198. this._mouseDestroy();
  3199. var wrapper,
  3200. _destroy = function( exp ) {
  3201. $( exp )
  3202. .removeData( "resizable" )
  3203. .removeData( "ui-resizable" )
  3204. .off( ".resizable" )
  3205. .find( ".ui-resizable-handle" )
  3206. .remove();
  3207. };
  3208. // TODO: Unwrap at same DOM position
  3209. if ( this.elementIsWrapper ) {
  3210. _destroy( this.element );
  3211. wrapper = this.element;
  3212. this.originalElement.css( {
  3213. position: wrapper.css( "position" ),
  3214. width: wrapper.outerWidth(),
  3215. height: wrapper.outerHeight(),
  3216. top: wrapper.css( "top" ),
  3217. left: wrapper.css( "left" )
  3218. } ).insertAfter( wrapper );
  3219. wrapper.remove();
  3220. }
  3221. this.originalElement.css( "resize", this.originalResizeStyle );
  3222. _destroy( this.originalElement );
  3223. return this;
  3224. },
  3225. _setOption: function( key, value ) {
  3226. this._super( key, value );
  3227. switch ( key ) {
  3228. case "handles":
  3229. this._removeHandles();
  3230. this._setupHandles();
  3231. break;
  3232. default:
  3233. break;
  3234. }
  3235. },
  3236. _setupHandles: function() {
  3237. var o = this.options, handle, i, n, hname, axis, that = this;
  3238. this.handles = o.handles ||
  3239. ( !$( ".ui-resizable-handle", this.element ).length ?
  3240. "e,s,se" : {
  3241. n: ".ui-resizable-n",
  3242. e: ".ui-resizable-e",
  3243. s: ".ui-resizable-s",
  3244. w: ".ui-resizable-w",
  3245. se: ".ui-resizable-se",
  3246. sw: ".ui-resizable-sw",
  3247. ne: ".ui-resizable-ne",
  3248. nw: ".ui-resizable-nw"
  3249. } );
  3250. this._handles = $();
  3251. if ( this.handles.constructor === String ) {
  3252. if ( this.handles === "all" ) {
  3253. this.handles = "n,e,s,w,se,sw,ne,nw";
  3254. }
  3255. n = this.handles.split( "," );
  3256. this.handles = {};
  3257. for ( i = 0; i < n.length; i++ ) {
  3258. handle = $.trim( n[ i ] );
  3259. hname = "ui-resizable-" + handle;
  3260. axis = $( "<div>" );
  3261. this._addClass( axis, "ui-resizable-handle " + hname );
  3262. axis.css( { zIndex: o.zIndex } );
  3263. this.handles[ handle ] = ".ui-resizable-" + handle;
  3264. this.element.append( axis );
  3265. }
  3266. }
  3267. this._renderAxis = function( target ) {
  3268. var i, axis, padPos, padWrapper;
  3269. target = target || this.element;
  3270. for ( i in this.handles ) {
  3271. if ( this.handles[ i ].constructor === String ) {
  3272. this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show();
  3273. } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) {
  3274. this.handles[ i ] = $( this.handles[ i ] );
  3275. this._on( this.handles[ i ], { "mousedown": that._mouseDown } );
  3276. }
  3277. if ( this.elementIsWrapper &&
  3278. this.originalElement[ 0 ]
  3279. .nodeName
  3280. .match( /^(textarea|input|select|button)$/i ) ) {
  3281. axis = $( this.handles[ i ], this.element );
  3282. padWrapper = /sw|ne|nw|se|n|s/.test( i ) ?
  3283. axis.outerHeight() :
  3284. axis.outerWidth();
  3285. padPos = [ "padding",
  3286. /ne|nw|n/.test( i ) ? "Top" :
  3287. /se|sw|s/.test( i ) ? "Bottom" :
  3288. /^e$/.test( i ) ? "Right" : "Left" ].join( "" );
  3289. target.css( padPos, padWrapper );
  3290. this._proportionallyResize();
  3291. }
  3292. this._handles = this._handles.add( this.handles[ i ] );
  3293. }
  3294. };
  3295. // TODO: make renderAxis a prototype function
  3296. this._renderAxis( this.element );
  3297. this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) );
  3298. this._handles.disableSelection();
  3299. this._handles.on( "mouseover", function() {
  3300. if ( !that.resizing ) {
  3301. if ( this.className ) {
  3302. axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i );
  3303. }
  3304. that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se";
  3305. }
  3306. } );
  3307. if ( o.autoHide ) {
  3308. this._handles.hide();
  3309. this._addClass( "ui-resizable-autohide" );
  3310. }
  3311. },
  3312. _removeHandles: function() {
  3313. this._handles.remove();
  3314. },
  3315. _mouseCapture: function( event ) {
  3316. var i, handle,
  3317. capture = false;
  3318. for ( i in this.handles ) {
  3319. handle = $( this.handles[ i ] )[ 0 ];
  3320. if ( handle === event.target || $.contains( handle, event.target ) ) {
  3321. capture = true;
  3322. }
  3323. }
  3324. return !this.options.disabled && capture;
  3325. },
  3326. _mouseStart: function( event ) {
  3327. var curleft, curtop, cursor,
  3328. o = this.options,
  3329. el = this.element;
  3330. this.resizing = true;
  3331. this._renderProxy();
  3332. curleft = this._num( this.helper.css( "left" ) );
  3333. curtop = this._num( this.helper.css( "top" ) );
  3334. if ( o.containment ) {
  3335. curleft += $( o.containment ).scrollLeft() || 0;
  3336. curtop += $( o.containment ).scrollTop() || 0;
  3337. }
  3338. this.offset = this.helper.offset();
  3339. this.position = { left: curleft, top: curtop };
  3340. this.size = this._helper ? {
  3341. width: this.helper.width(),
  3342. height: this.helper.height()
  3343. } : {
  3344. width: el.width(),
  3345. height: el.height()
  3346. };
  3347. this.originalSize = this._helper ? {
  3348. width: el.outerWidth(),
  3349. height: el.outerHeight()
  3350. } : {
  3351. width: el.width(),
  3352. height: el.height()
  3353. };
  3354. this.sizeDiff = {
  3355. width: el.outerWidth() - el.width(),
  3356. height: el.outerHeight() - el.height()
  3357. };
  3358. this.originalPosition = { left: curleft, top: curtop };
  3359. this.originalMousePosition = { left: event.pageX, top: event.pageY };
  3360. this.aspectRatio = ( typeof o.aspectRatio === "number" ) ?
  3361. o.aspectRatio :
  3362. ( ( this.originalSize.width / this.originalSize.height ) || 1 );
  3363. cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" );
  3364. $( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor );
  3365. this._addClass( "ui-resizable-resizing" );
  3366. this._propagate( "start", event );
  3367. return true;
  3368. },
  3369. _mouseDrag: function( event ) {
  3370. var data, props,
  3371. smp = this.originalMousePosition,
  3372. a = this.axis,
  3373. dx = ( event.pageX - smp.left ) || 0,
  3374. dy = ( event.pageY - smp.top ) || 0,
  3375. trigger = this._change[ a ];
  3376. this._updatePrevProperties();
  3377. if ( !trigger ) {
  3378. return false;
  3379. }
  3380. data = trigger.apply( this, [ event, dx, dy ] );
  3381. this._updateVirtualBoundaries( event.shiftKey );
  3382. if ( this._aspectRatio || event.shiftKey ) {
  3383. data = this._updateRatio( data, event );
  3384. }
  3385. data = this._respectSize( data, event );
  3386. this._updateCache( data );
  3387. this._propagate( "resize", event );
  3388. props = this._applyChanges();
  3389. if ( !this._helper && this._proportionallyResizeElements.length ) {
  3390. this._proportionallyResize();
  3391. }
  3392. if ( !$.isEmptyObject( props ) ) {
  3393. this._updatePrevProperties();
  3394. this._trigger( "resize", event, this.ui() );
  3395. this._applyChanges();
  3396. }
  3397. return false;
  3398. },
  3399. _mouseStop: function( event ) {
  3400. this.resizing = false;
  3401. var pr, ista, soffseth, soffsetw, s, left, top,
  3402. o = this.options, that = this;
  3403. if ( this._helper ) {
  3404. pr = this._proportionallyResizeElements;
  3405. ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName );
  3406. soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height;
  3407. soffsetw = ista ? 0 : that.sizeDiff.width;
  3408. s = {
  3409. width: ( that.helper.width() - soffsetw ),
  3410. height: ( that.helper.height() - soffseth )
  3411. };
  3412. left = ( parseFloat( that.element.css( "left" ) ) +
  3413. ( that.position.left - that.originalPosition.left ) ) || null;
  3414. top = ( parseFloat( that.element.css( "top" ) ) +
  3415. ( that.position.top - that.originalPosition.top ) ) || null;
  3416. if ( !o.animate ) {
  3417. this.element.css( $.extend( s, { top: top, left: left } ) );
  3418. }
  3419. that.helper.height( that.size.height );
  3420. that.helper.width( that.size.width );
  3421. if ( this._helper && !o.animate ) {
  3422. this._proportionallyResize();
  3423. }
  3424. }
  3425. $( "body" ).css( "cursor", "auto" );
  3426. this._removeClass( "ui-resizable-resizing" );
  3427. this._propagate( "stop", event );
  3428. if ( this._helper ) {
  3429. this.helper.remove();
  3430. }
  3431. return false;
  3432. },
  3433. _updatePrevProperties: function() {
  3434. this.prevPosition = {
  3435. top: this.position.top,
  3436. left: this.position.left
  3437. };
  3438. this.prevSize = {
  3439. width: this.size.width,
  3440. height: this.size.height
  3441. };
  3442. },
  3443. _applyChanges: function() {
  3444. var props = {};
  3445. if ( this.position.top !== this.prevPosition.top ) {
  3446. props.top = this.position.top + "px";
  3447. }
  3448. if ( this.position.left !== this.prevPosition.left ) {
  3449. props.left = this.position.left + "px";
  3450. }
  3451. if ( this.size.width !== this.prevSize.width ) {
  3452. props.width = this.size.width + "px";
  3453. }
  3454. if ( this.size.height !== this.prevSize.height ) {
  3455. props.height = this.size.height + "px";
  3456. }
  3457. this.helper.css( props );
  3458. return props;
  3459. },
  3460. _updateVirtualBoundaries: function( forceAspectRatio ) {
  3461. var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
  3462. o = this.options;
  3463. b = {
  3464. minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0,
  3465. maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity,
  3466. minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0,
  3467. maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity
  3468. };
  3469. if ( this._aspectRatio || forceAspectRatio ) {
  3470. pMinWidth = b.minHeight * this.aspectRatio;
  3471. pMinHeight = b.minWidth / this.aspectRatio;
  3472. pMaxWidth = b.maxHeight * this.aspectRatio;
  3473. pMaxHeight = b.maxWidth / this.aspectRatio;
  3474. if ( pMinWidth > b.minWidth ) {
  3475. b.minWidth = pMinWidth;
  3476. }
  3477. if ( pMinHeight > b.minHeight ) {
  3478. b.minHeight = pMinHeight;
  3479. }
  3480. if ( pMaxWidth < b.maxWidth ) {
  3481. b.maxWidth = pMaxWidth;
  3482. }
  3483. if ( pMaxHeight < b.maxHeight ) {
  3484. b.maxHeight = pMaxHeight;
  3485. }
  3486. }
  3487. this._vBoundaries = b;
  3488. },
  3489. _updateCache: function( data ) {
  3490. this.offset = this.helper.offset();
  3491. if ( this._isNumber( data.left ) ) {
  3492. this.position.left = data.left;
  3493. }
  3494. if ( this._isNumber( data.top ) ) {
  3495. this.position.top = data.top;
  3496. }
  3497. if ( this._isNumber( data.height ) ) {
  3498. this.size.height = data.height;
  3499. }
  3500. if ( this._isNumber( data.width ) ) {
  3501. this.size.width = data.width;
  3502. }
  3503. },
  3504. _updateRatio: function( data ) {
  3505. var cpos = this.position,
  3506. csize = this.size,
  3507. a = this.axis;
  3508. if ( this._isNumber( data.height ) ) {
  3509. data.width = ( data.height * this.aspectRatio );
  3510. } else if ( this._isNumber( data.width ) ) {
  3511. data.height = ( data.width / this.aspectRatio );
  3512. }
  3513. if ( a === "sw" ) {
  3514. data.left = cpos.left + ( csize.width - data.width );
  3515. data.top = null;
  3516. }
  3517. if ( a === "nw" ) {
  3518. data.top = cpos.top + ( csize.height - data.height );
  3519. data.left = cpos.left + ( csize.width - data.width );
  3520. }
  3521. return data;
  3522. },
  3523. _respectSize: function( data ) {
  3524. var o = this._vBoundaries,
  3525. a = this.axis,
  3526. ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ),
  3527. ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ),
  3528. isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ),
  3529. isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ),
  3530. dw = this.originalPosition.left + this.originalSize.width,
  3531. dh = this.originalPosition.top + this.originalSize.height,
  3532. cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a );
  3533. if ( isminw ) {
  3534. data.width = o.minWidth;
  3535. }
  3536. if ( isminh ) {
  3537. data.height = o.minHeight;
  3538. }
  3539. if ( ismaxw ) {
  3540. data.width = o.maxWidth;
  3541. }
  3542. if ( ismaxh ) {
  3543. data.height = o.maxHeight;
  3544. }
  3545. if ( isminw && cw ) {
  3546. data.left = dw - o.minWidth;
  3547. }
  3548. if ( ismaxw && cw ) {
  3549. data.left = dw - o.maxWidth;
  3550. }
  3551. if ( isminh && ch ) {
  3552. data.top = dh - o.minHeight;
  3553. }
  3554. if ( ismaxh && ch ) {
  3555. data.top = dh - o.maxHeight;
  3556. }
  3557. // Fixing jump error on top/left - bug #2330
  3558. if ( !data.width && !data.height && !data.left && data.top ) {
  3559. data.top = null;
  3560. } else if ( !data.width && !data.height && !data.top && data.left ) {
  3561. data.left = null;
  3562. }
  3563. return data;
  3564. },
  3565. _getPaddingPlusBorderDimensions: function( element ) {
  3566. var i = 0,
  3567. widths = [],
  3568. borders = [
  3569. element.css( "borderTopWidth" ),
  3570. element.css( "borderRightWidth" ),
  3571. element.css( "borderBottomWidth" ),
  3572. element.css( "borderLeftWidth" )
  3573. ],
  3574. paddings = [
  3575. element.css( "paddingTop" ),
  3576. element.css( "paddingRight" ),
  3577. element.css( "paddingBottom" ),
  3578. element.css( "paddingLeft" )
  3579. ];
  3580. for ( ; i < 4; i++ ) {
  3581. widths[ i ] = ( parseFloat( borders[ i ] ) || 0 );
  3582. widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 );
  3583. }
  3584. return {
  3585. height: widths[ 0 ] + widths[ 2 ],
  3586. width: widths[ 1 ] + widths[ 3 ]
  3587. };
  3588. },
  3589. _proportionallyResize: function() {
  3590. if ( !this._proportionallyResizeElements.length ) {
  3591. return;
  3592. }
  3593. var prel,
  3594. i = 0,
  3595. element = this.helper || this.element;
  3596. for ( ; i < this._proportionallyResizeElements.length; i++ ) {
  3597. prel = this._proportionallyResizeElements[ i ];
  3598. // TODO: Seems like a bug to cache this.outerDimensions
  3599. // considering that we are in a loop.
  3600. if ( !this.outerDimensions ) {
  3601. this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
  3602. }
  3603. prel.css( {
  3604. height: ( element.height() - this.outerDimensions.height ) || 0,
  3605. width: ( element.width() - this.outerDimensions.width ) || 0
  3606. } );
  3607. }
  3608. },
  3609. _renderProxy: function() {
  3610. var el = this.element, o = this.options;
  3611. this.elementOffset = el.offset();
  3612. if ( this._helper ) {
  3613. this.helper = this.helper || $( "<div style='overflow:hidden;'></div>" );
  3614. this._addClass( this.helper, this._helper );
  3615. this.helper.css( {
  3616. width: this.element.outerWidth(),
  3617. height: this.element.outerHeight(),
  3618. position: "absolute",
  3619. left: this.elementOffset.left + "px",
  3620. top: this.elementOffset.top + "px",
  3621. zIndex: ++o.zIndex //TODO: Don't modify option
  3622. } );
  3623. this.helper
  3624. .appendTo( "body" )
  3625. .disableSelection();
  3626. } else {
  3627. this.helper = this.element;
  3628. }
  3629. },
  3630. _change: {
  3631. e: function( event, dx ) {
  3632. return { width: this.originalSize.width + dx };
  3633. },
  3634. w: function( event, dx ) {
  3635. var cs = this.originalSize, sp = this.originalPosition;
  3636. return { left: sp.left + dx, width: cs.width - dx };
  3637. },
  3638. n: function( event, dx, dy ) {
  3639. var cs = this.originalSize, sp = this.originalPosition;
  3640. return { top: sp.top + dy, height: cs.height - dy };
  3641. },
  3642. s: function( event, dx, dy ) {
  3643. return { height: this.originalSize.height + dy };
  3644. },
  3645. se: function( event, dx, dy ) {
  3646. return $.extend( this._change.s.apply( this, arguments ),
  3647. this._change.e.apply( this, [ event, dx, dy ] ) );
  3648. },
  3649. sw: function( event, dx, dy ) {
  3650. return $.extend( this._change.s.apply( this, arguments ),
  3651. this._change.w.apply( this, [ event, dx, dy ] ) );
  3652. },
  3653. ne: function( event, dx, dy ) {
  3654. return $.extend( this._change.n.apply( this, arguments ),
  3655. this._change.e.apply( this, [ event, dx, dy ] ) );
  3656. },
  3657. nw: function( event, dx, dy ) {
  3658. return $.extend( this._change.n.apply( this, arguments ),
  3659. this._change.w.apply( this, [ event, dx, dy ] ) );
  3660. }
  3661. },
  3662. _propagate: function( n, event ) {
  3663. $.ui.plugin.call( this, n, [ event, this.ui() ] );
  3664. ( n !== "resize" && this._trigger( n, event, this.ui() ) );
  3665. },
  3666. plugins: {},
  3667. ui: function() {
  3668. return {
  3669. originalElement: this.originalElement,
  3670. element: this.element,
  3671. helper: this.helper,
  3672. position: this.position,
  3673. size: this.size,
  3674. originalSize: this.originalSize,
  3675. originalPosition: this.originalPosition
  3676. };
  3677. }
  3678. } );
  3679. /*
  3680. * Resizable Extensions
  3681. */
  3682. $.ui.plugin.add( "resizable", "animate", {
  3683. stop: function( event ) {
  3684. var that = $( this ).resizable( "instance" ),
  3685. o = that.options,
  3686. pr = that._proportionallyResizeElements,
  3687. ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ),
  3688. soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height,
  3689. soffsetw = ista ? 0 : that.sizeDiff.width,
  3690. style = {
  3691. width: ( that.size.width - soffsetw ),
  3692. height: ( that.size.height - soffseth )
  3693. },
  3694. left = ( parseFloat( that.element.css( "left" ) ) +
  3695. ( that.position.left - that.originalPosition.left ) ) || null,
  3696. top = ( parseFloat( that.element.css( "top" ) ) +
  3697. ( that.position.top - that.originalPosition.top ) ) || null;
  3698. that.element.animate(
  3699. $.extend( style, top && left ? { top: top, left: left } : {} ), {
  3700. duration: o.animateDuration,
  3701. easing: o.animateEasing,
  3702. step: function() {
  3703. var data = {
  3704. width: parseFloat( that.element.css( "width" ) ),
  3705. height: parseFloat( that.element.css( "height" ) ),
  3706. top: parseFloat( that.element.css( "top" ) ),
  3707. left: parseFloat( that.element.css( "left" ) )
  3708. };
  3709. if ( pr && pr.length ) {
  3710. $( pr[ 0 ] ).css( { width: data.width, height: data.height } );
  3711. }
  3712. // Propagating resize, and updating values for each animation step
  3713. that._updateCache( data );
  3714. that._propagate( "resize", event );
  3715. }
  3716. }
  3717. );
  3718. }
  3719. } );
  3720. $.ui.plugin.add( "resizable", "containment", {
  3721. start: function() {
  3722. var element, p, co, ch, cw, width, height,
  3723. that = $( this ).resizable( "instance" ),
  3724. o = that.options,
  3725. el = that.element,
  3726. oc = o.containment,
  3727. ce = ( oc instanceof $ ) ?
  3728. oc.get( 0 ) :
  3729. ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc;
  3730. if ( !ce ) {
  3731. return;
  3732. }
  3733. that.containerElement = $( ce );
  3734. if ( /document/.test( oc ) || oc === document ) {
  3735. that.containerOffset = {
  3736. left: 0,
  3737. top: 0
  3738. };
  3739. that.containerPosition = {
  3740. left: 0,
  3741. top: 0
  3742. };
  3743. that.parentData = {
  3744. element: $( document ),
  3745. left: 0,
  3746. top: 0,
  3747. width: $( document ).width(),
  3748. height: $( document ).height() || document.body.parentNode.scrollHeight
  3749. };
  3750. } else {
  3751. element = $( ce );
  3752. p = [];
  3753. $( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) {
  3754. p[ i ] = that._num( element.css( "padding" + name ) );
  3755. } );
  3756. that.containerOffset = element.offset();
  3757. that.containerPosition = element.position();
  3758. that.containerSize = {
  3759. height: ( element.innerHeight() - p[ 3 ] ),
  3760. width: ( element.innerWidth() - p[ 1 ] )
  3761. };
  3762. co = that.containerOffset;
  3763. ch = that.containerSize.height;
  3764. cw = that.containerSize.width;
  3765. width = ( that._hasScroll ( ce, "left" ) ? ce.scrollWidth : cw );
  3766. height = ( that._hasScroll ( ce ) ? ce.scrollHeight : ch ) ;
  3767. that.parentData = {
  3768. element: ce,
  3769. left: co.left,
  3770. top: co.top,
  3771. width: width,
  3772. height: height
  3773. };
  3774. }
  3775. },
  3776. resize: function( event ) {
  3777. var woset, hoset, isParent, isOffsetRelative,
  3778. that = $( this ).resizable( "instance" ),
  3779. o = that.options,
  3780. co = that.containerOffset,
  3781. cp = that.position,
  3782. pRatio = that._aspectRatio || event.shiftKey,
  3783. cop = {
  3784. top: 0,
  3785. left: 0
  3786. },
  3787. ce = that.containerElement,
  3788. continueResize = true;
  3789. if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {
  3790. cop = co;
  3791. }
  3792. if ( cp.left < ( that._helper ? co.left : 0 ) ) {
  3793. that.size.width = that.size.width +
  3794. ( that._helper ?
  3795. ( that.position.left - co.left ) :
  3796. ( that.position.left - cop.left ) );
  3797. if ( pRatio ) {
  3798. that.size.height = that.size.width / that.aspectRatio;
  3799. continueResize = false;
  3800. }
  3801. that.position.left = o.helper ? co.left : 0;
  3802. }
  3803. if ( cp.top < ( that._helper ? co.top : 0 ) ) {
  3804. that.size.height = that.size.height +
  3805. ( that._helper ?
  3806. ( that.position.top - co.top ) :
  3807. that.position.top );
  3808. if ( pRatio ) {
  3809. that.size.width = that.size.height * that.aspectRatio;
  3810. continueResize = false;
  3811. }
  3812. that.position.top = that._helper ? co.top : 0;
  3813. }
  3814. isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
  3815. isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );
  3816. if ( isParent && isOffsetRelative ) {
  3817. that.offset.left = that.parentData.left + that.position.left;
  3818. that.offset.top = that.parentData.top + that.position.top;
  3819. } else {
  3820. that.offset.left = that.element.offset().left;
  3821. that.offset.top = that.element.offset().top;
  3822. }
  3823. woset = Math.abs( that.sizeDiff.width +
  3824. ( that._helper ?
  3825. that.offset.left - cop.left :
  3826. ( that.offset.left - co.left ) ) );
  3827. hoset = Math.abs( that.sizeDiff.height +
  3828. ( that._helper ?
  3829. that.offset.top - cop.top :
  3830. ( that.offset.top - co.top ) ) );
  3831. if ( woset + that.size.width >= that.parentData.width ) {
  3832. that.size.width = that.parentData.width - woset;
  3833. if ( pRatio ) {
  3834. that.size.height = that.size.width / that.aspectRatio;
  3835. continueResize = false;
  3836. }
  3837. }
  3838. if ( hoset + that.size.height >= that.parentData.height ) {
  3839. that.size.height = that.parentData.height - hoset;
  3840. if ( pRatio ) {
  3841. that.size.width = that.size.height * that.aspectRatio;
  3842. continueResize = false;
  3843. }
  3844. }
  3845. if ( !continueResize ) {
  3846. that.position.left = that.prevPosition.left;
  3847. that.position.top = that.prevPosition.top;
  3848. that.size.width = that.prevSize.width;
  3849. that.size.height = that.prevSize.height;
  3850. }
  3851. },
  3852. stop: function() {
  3853. var that = $( this ).resizable( "instance" ),
  3854. o = that.options,
  3855. co = that.containerOffset,
  3856. cop = that.containerPosition,
  3857. ce = that.containerElement,
  3858. helper = $( that.helper ),
  3859. ho = helper.offset(),
  3860. w = helper.outerWidth() - that.sizeDiff.width,
  3861. h = helper.outerHeight() - that.sizeDiff.height;
  3862. if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {
  3863. $( this ).css( {
  3864. left: ho.left - cop.left - co.left,
  3865. width: w,
  3866. height: h
  3867. } );
  3868. }
  3869. if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {
  3870. $( this ).css( {
  3871. left: ho.left - cop.left - co.left,
  3872. width: w,
  3873. height: h
  3874. } );
  3875. }
  3876. }
  3877. } );
  3878. $.ui.plugin.add( "resizable", "alsoResize", {
  3879. start: function() {
  3880. var that = $( this ).resizable( "instance" ),
  3881. o = that.options;
  3882. $( o.alsoResize ).each( function() {
  3883. var el = $( this );
  3884. el.data( "ui-resizable-alsoresize", {
  3885. width: parseFloat( el.width() ), height: parseFloat( el.height() ),
  3886. left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) )
  3887. } );
  3888. } );
  3889. },
  3890. resize: function( event, ui ) {
  3891. var that = $( this ).resizable( "instance" ),
  3892. o = that.options,
  3893. os = that.originalSize,
  3894. op = that.originalPosition,
  3895. delta = {
  3896. height: ( that.size.height - os.height ) || 0,
  3897. width: ( that.size.width - os.width ) || 0,
  3898. top: ( that.position.top - op.top ) || 0,
  3899. left: ( that.position.left - op.left ) || 0
  3900. };
  3901. $( o.alsoResize ).each( function() {
  3902. var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {},
  3903. css = el.parents( ui.originalElement[ 0 ] ).length ?
  3904. [ "width", "height" ] :
  3905. [ "width", "height", "top", "left" ];
  3906. $.each( css, function( i, prop ) {
  3907. var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 );
  3908. if ( sum && sum >= 0 ) {
  3909. style[ prop ] = sum || null;
  3910. }
  3911. } );
  3912. el.css( style );
  3913. } );
  3914. },
  3915. stop: function() {
  3916. $( this ).removeData( "ui-resizable-alsoresize" );
  3917. }
  3918. } );
  3919. $.ui.plugin.add( "resizable", "ghost", {
  3920. start: function() {
  3921. var that = $( this ).resizable( "instance" ), cs = that.size;
  3922. that.ghost = that.originalElement.clone();
  3923. that.ghost.css( {
  3924. opacity: 0.25,
  3925. display: "block",
  3926. position: "relative",
  3927. height: cs.height,
  3928. width: cs.width,
  3929. margin: 0,
  3930. left: 0,
  3931. top: 0
  3932. } );
  3933. that._addClass( that.ghost, "ui-resizable-ghost" );
  3934. // DEPRECATED
  3935. // TODO: remove after 1.12
  3936. if ( $.uiBackCompat !== false && typeof that.options.ghost === "string" ) {
  3937. // Ghost option
  3938. that.ghost.addClass( this.options.ghost );
  3939. }
  3940. that.ghost.appendTo( that.helper );
  3941. },
  3942. resize: function() {
  3943. var that = $( this ).resizable( "instance" );
  3944. if ( that.ghost ) {
  3945. that.ghost.css( {
  3946. position: "relative",
  3947. height: that.size.height,
  3948. width: that.size.width
  3949. } );
  3950. }
  3951. },
  3952. stop: function() {
  3953. var that = $( this ).resizable( "instance" );
  3954. if ( that.ghost && that.helper ) {
  3955. that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) );
  3956. }
  3957. }
  3958. } );
  3959. $.ui.plugin.add( "resizable", "grid", {
  3960. resize: function() {
  3961. var outerDimensions,
  3962. that = $( this ).resizable( "instance" ),
  3963. o = that.options,
  3964. cs = that.size,
  3965. os = that.originalSize,
  3966. op = that.originalPosition,
  3967. a = that.axis,
  3968. grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
  3969. gridX = ( grid[ 0 ] || 1 ),
  3970. gridY = ( grid[ 1 ] || 1 ),
  3971. ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX,
  3972. oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY,
  3973. newWidth = os.width + ox,
  3974. newHeight = os.height + oy,
  3975. isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ),
  3976. isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ),
  3977. isMinWidth = o.minWidth && ( o.minWidth > newWidth ),
  3978. isMinHeight = o.minHeight && ( o.minHeight > newHeight );
  3979. o.grid = grid;
  3980. if ( isMinWidth ) {
  3981. newWidth += gridX;
  3982. }
  3983. if ( isMinHeight ) {
  3984. newHeight += gridY;
  3985. }
  3986. if ( isMaxWidth ) {
  3987. newWidth -= gridX;
  3988. }
  3989. if ( isMaxHeight ) {
  3990. newHeight -= gridY;
  3991. }
  3992. if ( /^(se|s|e)$/.test( a ) ) {
  3993. that.size.width = newWidth;
  3994. that.size.height = newHeight;
  3995. } else if ( /^(ne)$/.test( a ) ) {
  3996. that.size.width = newWidth;
  3997. that.size.height = newHeight;
  3998. that.position.top = op.top - oy;
  3999. } else if ( /^(sw)$/.test( a ) ) {
  4000. that.size.width = newWidth;
  4001. that.size.height = newHeight;
  4002. that.position.left = op.left - ox;
  4003. } else {
  4004. if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) {
  4005. outerDimensions = that._getPaddingPlusBorderDimensions( this );
  4006. }
  4007. if ( newHeight - gridY > 0 ) {
  4008. that.size.height = newHeight;
  4009. that.position.top = op.top - oy;
  4010. } else {
  4011. newHeight = gridY - outerDimensions.height;
  4012. that.size.height = newHeight;
  4013. that.position.top = op.top + os.height - newHeight;
  4014. }
  4015. if ( newWidth - gridX > 0 ) {
  4016. that.size.width = newWidth;
  4017. that.position.left = op.left - ox;
  4018. } else {
  4019. newWidth = gridX - outerDimensions.width;
  4020. that.size.width = newWidth;
  4021. that.position.left = op.left + os.width - newWidth;
  4022. }
  4023. }
  4024. }
  4025. } );
  4026. var widgetsResizable = $.ui.resizable;
  4027. /*!
  4028. * jQuery UI Selectable 1.12.1
  4029. * http://jqueryui.com
  4030. *
  4031. * Copyright jQuery Foundation and other contributors
  4032. * Released under the MIT license.
  4033. * http://jquery.org/license
  4034. */
  4035. //>>label: Selectable
  4036. //>>group: Interactions
  4037. //>>description: Allows groups of elements to be selected with the mouse.
  4038. //>>docs: http://api.jqueryui.com/selectable/
  4039. //>>demos: http://jqueryui.com/selectable/
  4040. //>>css.structure: ../../themes/base/selectable.css
  4041. var widgetsSelectable = $.widget( "ui.selectable", $.ui.mouse, {
  4042. version: "1.12.1",
  4043. options: {
  4044. appendTo: "body",
  4045. autoRefresh: true,
  4046. distance: 0,
  4047. filter: "*",
  4048. tolerance: "touch",
  4049. // Callbacks
  4050. selected: null,
  4051. selecting: null,
  4052. start: null,
  4053. stop: null,
  4054. unselected: null,
  4055. unselecting: null
  4056. },
  4057. _create: function() {
  4058. var that = this;
  4059. this._addClass( "ui-selectable" );
  4060. this.dragged = false;
  4061. // Cache selectee children based on filter
  4062. this.refresh = function() {
  4063. that.elementPos = $( that.element[ 0 ] ).offset();
  4064. that.selectees = $( that.options.filter, that.element[ 0 ] );
  4065. that._addClass( that.selectees, "ui-selectee" );
  4066. that.selectees.each( function() {
  4067. var $this = $( this ),
  4068. selecteeOffset = $this.offset(),
  4069. pos = {
  4070. left: selecteeOffset.left - that.elementPos.left,
  4071. top: selecteeOffset.top - that.elementPos.top
  4072. };
  4073. $.data( this, "selectable-item", {
  4074. element: this,
  4075. $element: $this,
  4076. left: pos.left,
  4077. top: pos.top,
  4078. right: pos.left + $this.outerWidth(),
  4079. bottom: pos.top + $this.outerHeight(),
  4080. startselected: false,
  4081. selected: $this.hasClass( "ui-selected" ),
  4082. selecting: $this.hasClass( "ui-selecting" ),
  4083. unselecting: $this.hasClass( "ui-unselecting" )
  4084. } );
  4085. } );
  4086. };
  4087. this.refresh();
  4088. this._mouseInit();
  4089. this.helper = $( "<div>" );
  4090. this._addClass( this.helper, "ui-selectable-helper" );
  4091. },
  4092. _destroy: function() {
  4093. this.selectees.removeData( "selectable-item" );
  4094. this._mouseDestroy();
  4095. },
  4096. _mouseStart: function( event ) {
  4097. var that = this,
  4098. options = this.options;
  4099. this.opos = [ event.pageX, event.pageY ];
  4100. this.elementPos = $( this.element[ 0 ] ).offset();
  4101. if ( this.options.disabled ) {
  4102. return;
  4103. }
  4104. this.selectees = $( options.filter, this.element[ 0 ] );
  4105. this._trigger( "start", event );
  4106. $( options.appendTo ).append( this.helper );
  4107. // position helper (lasso)
  4108. this.helper.css( {
  4109. "left": event.pageX,
  4110. "top": event.pageY,
  4111. "width": 0,
  4112. "height": 0
  4113. } );
  4114. if ( options.autoRefresh ) {
  4115. this.refresh();
  4116. }
  4117. this.selectees.filter( ".ui-selected" ).each( function() {
  4118. var selectee = $.data( this, "selectable-item" );
  4119. selectee.startselected = true;
  4120. if ( !event.metaKey && !event.ctrlKey ) {
  4121. that._removeClass( selectee.$element, "ui-selected" );
  4122. selectee.selected = false;
  4123. that._addClass( selectee.$element, "ui-unselecting" );
  4124. selectee.unselecting = true;
  4125. // selectable UNSELECTING callback
  4126. that._trigger( "unselecting", event, {
  4127. unselecting: selectee.element
  4128. } );
  4129. }
  4130. } );
  4131. $( event.target ).parents().addBack().each( function() {
  4132. var doSelect,
  4133. selectee = $.data( this, "selectable-item" );
  4134. if ( selectee ) {
  4135. doSelect = ( !event.metaKey && !event.ctrlKey ) ||
  4136. !selectee.$element.hasClass( "ui-selected" );
  4137. that._removeClass( selectee.$element, doSelect ? "ui-unselecting" : "ui-selected" )
  4138. ._addClass( selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting" );
  4139. selectee.unselecting = !doSelect;
  4140. selectee.selecting = doSelect;
  4141. selectee.selected = doSelect;
  4142. // selectable (UN)SELECTING callback
  4143. if ( doSelect ) {
  4144. that._trigger( "selecting", event, {
  4145. selecting: selectee.element
  4146. } );
  4147. } else {
  4148. that._trigger( "unselecting", event, {
  4149. unselecting: selectee.element
  4150. } );
  4151. }
  4152. return false;
  4153. }
  4154. } );
  4155. },
  4156. _mouseDrag: function( event ) {
  4157. this.dragged = true;
  4158. if ( this.options.disabled ) {
  4159. return;
  4160. }
  4161. var tmp,
  4162. that = this,
  4163. options = this.options,
  4164. x1 = this.opos[ 0 ],
  4165. y1 = this.opos[ 1 ],
  4166. x2 = event.pageX,
  4167. y2 = event.pageY;
  4168. if ( x1 > x2 ) { tmp = x2; x2 = x1; x1 = tmp; }
  4169. if ( y1 > y2 ) { tmp = y2; y2 = y1; y1 = tmp; }
  4170. this.helper.css( { left: x1, top: y1, width: x2 - x1, height: y2 - y1 } );
  4171. this.selectees.each( function() {
  4172. var selectee = $.data( this, "selectable-item" ),
  4173. hit = false,
  4174. offset = {};
  4175. //prevent helper from being selected if appendTo: selectable
  4176. if ( !selectee || selectee.element === that.element[ 0 ] ) {
  4177. return;
  4178. }
  4179. offset.left = selectee.left + that.elementPos.left;
  4180. offset.right = selectee.right + that.elementPos.left;
  4181. offset.top = selectee.top + that.elementPos.top;
  4182. offset.bottom = selectee.bottom + that.elementPos.top;
  4183. if ( options.tolerance === "touch" ) {
  4184. hit = ( !( offset.left > x2 || offset.right < x1 || offset.top > y2 ||
  4185. offset.bottom < y1 ) );
  4186. } else if ( options.tolerance === "fit" ) {
  4187. hit = ( offset.left > x1 && offset.right < x2 && offset.top > y1 &&
  4188. offset.bottom < y2 );
  4189. }
  4190. if ( hit ) {
  4191. // SELECT
  4192. if ( selectee.selected ) {
  4193. that._removeClass( selectee.$element, "ui-selected" );
  4194. selectee.selected = false;
  4195. }
  4196. if ( selectee.unselecting ) {
  4197. that._removeClass( selectee.$element, "ui-unselecting" );
  4198. selectee.unselecting = false;
  4199. }
  4200. if ( !selectee.selecting ) {
  4201. that._addClass( selectee.$element, "ui-selecting" );
  4202. selectee.selecting = true;
  4203. // selectable SELECTING callback
  4204. that._trigger( "selecting", event, {
  4205. selecting: selectee.element
  4206. } );
  4207. }
  4208. } else {
  4209. // UNSELECT
  4210. if ( selectee.selecting ) {
  4211. if ( ( event.metaKey || event.ctrlKey ) && selectee.startselected ) {
  4212. that._removeClass( selectee.$element, "ui-selecting" );
  4213. selectee.selecting = false;
  4214. that._addClass( selectee.$element, "ui-selected" );
  4215. selectee.selected = true;
  4216. } else {
  4217. that._removeClass( selectee.$element, "ui-selecting" );
  4218. selectee.selecting = false;
  4219. if ( selectee.startselected ) {
  4220. that._addClass( selectee.$element, "ui-unselecting" );
  4221. selectee.unselecting = true;
  4222. }
  4223. // selectable UNSELECTING callback
  4224. that._trigger( "unselecting", event, {
  4225. unselecting: selectee.element
  4226. } );
  4227. }
  4228. }
  4229. if ( selectee.selected ) {
  4230. if ( !event.metaKey && !event.ctrlKey && !selectee.startselected ) {
  4231. that._removeClass( selectee.$element, "ui-selected" );
  4232. selectee.selected = false;
  4233. that._addClass( selectee.$element, "ui-unselecting" );
  4234. selectee.unselecting = true;
  4235. // selectable UNSELECTING callback
  4236. that._trigger( "unselecting", event, {
  4237. unselecting: selectee.element
  4238. } );
  4239. }
  4240. }
  4241. }
  4242. } );
  4243. return false;
  4244. },
  4245. _mouseStop: function( event ) {
  4246. var that = this;
  4247. this.dragged = false;
  4248. $( ".ui-unselecting", this.element[ 0 ] ).each( function() {
  4249. var selectee = $.data( this, "selectable-item" );
  4250. that._removeClass( selectee.$element, "ui-unselecting" );
  4251. selectee.unselecting = false;
  4252. selectee.startselected = false;
  4253. that._trigger( "unselected", event, {
  4254. unselected: selectee.element
  4255. } );
  4256. } );
  4257. $( ".ui-selecting", this.element[ 0 ] ).each( function() {
  4258. var selectee = $.data( this, "selectable-item" );
  4259. that._removeClass( selectee.$element, "ui-selecting" )
  4260. ._addClass( selectee.$element, "ui-selected" );
  4261. selectee.selecting = false;
  4262. selectee.selected = true;
  4263. selectee.startselected = true;
  4264. that._trigger( "selected", event, {
  4265. selected: selectee.element
  4266. } );
  4267. } );
  4268. this._trigger( "stop", event );
  4269. this.helper.remove();
  4270. return false;
  4271. }
  4272. } );
  4273. /*!
  4274. * jQuery UI Sortable 1.12.1
  4275. * http://jqueryui.com
  4276. *
  4277. * Copyright jQuery Foundation and other contributors
  4278. * Released under the MIT license.
  4279. * http://jquery.org/license
  4280. */
  4281. //>>label: Sortable
  4282. //>>group: Interactions
  4283. //>>description: Enables items in a list to be sorted using the mouse.
  4284. //>>docs: http://api.jqueryui.com/sortable/
  4285. //>>demos: http://jqueryui.com/sortable/
  4286. //>>css.structure: ../../themes/base/sortable.css
  4287. var widgetsSortable = $.widget( "ui.sortable", $.ui.mouse, {
  4288. version: "1.12.1",
  4289. widgetEventPrefix: "sort",
  4290. ready: false,
  4291. options: {
  4292. appendTo: "parent",
  4293. axis: false,
  4294. connectWith: false,
  4295. containment: false,
  4296. cursor: "auto",
  4297. cursorAt: false,
  4298. dropOnEmpty: true,
  4299. forcePlaceholderSize: false,
  4300. forceHelperSize: false,
  4301. grid: false,
  4302. handle: false,
  4303. helper: "original",
  4304. items: "> *",
  4305. opacity: false,
  4306. placeholder: false,
  4307. revert: false,
  4308. scroll: true,
  4309. scrollSensitivity: 20,
  4310. scrollSpeed: 20,
  4311. scope: "default",
  4312. tolerance: "intersect",
  4313. zIndex: 1000,
  4314. // Callbacks
  4315. activate: null,
  4316. beforeStop: null,
  4317. change: null,
  4318. deactivate: null,
  4319. out: null,
  4320. over: null,
  4321. receive: null,
  4322. remove: null,
  4323. sort: null,
  4324. start: null,
  4325. stop: null,
  4326. update: null
  4327. },
  4328. _isOverAxis: function( x, reference, size ) {
  4329. return ( x >= reference ) && ( x < ( reference + size ) );
  4330. },
  4331. _isFloating: function( item ) {
  4332. return ( /left|right/ ).test( item.css( "float" ) ) ||
  4333. ( /inline|table-cell/ ).test( item.css( "display" ) );
  4334. },
  4335. _create: function() {
  4336. this.containerCache = {};
  4337. this._addClass( "ui-sortable" );
  4338. //Get the items
  4339. this.refresh();
  4340. //Let's determine the parent's offset
  4341. this.offset = this.element.offset();
  4342. //Initialize mouse events for interaction
  4343. this._mouseInit();
  4344. this._setHandleClassName();
  4345. //We're ready to go
  4346. this.ready = true;
  4347. },
  4348. _setOption: function( key, value ) {
  4349. this._super( key, value );
  4350. if ( key === "handle" ) {
  4351. this._setHandleClassName();
  4352. }
  4353. },
  4354. _setHandleClassName: function() {
  4355. var that = this;
  4356. this._removeClass( this.element.find( ".ui-sortable-handle" ), "ui-sortable-handle" );
  4357. $.each( this.items, function() {
  4358. that._addClass(
  4359. this.instance.options.handle ?
  4360. this.item.find( this.instance.options.handle ) :
  4361. this.item,
  4362. "ui-sortable-handle"
  4363. );
  4364. } );
  4365. },
  4366. _destroy: function() {
  4367. this._mouseDestroy();
  4368. for ( var i = this.items.length - 1; i >= 0; i-- ) {
  4369. this.items[ i ].item.removeData( this.widgetName + "-item" );
  4370. }
  4371. return this;
  4372. },
  4373. _mouseCapture: function( event, overrideHandle ) {
  4374. var currentItem = null,
  4375. validHandle = false,
  4376. that = this;
  4377. if ( this.reverting ) {
  4378. return false;
  4379. }
  4380. if ( this.options.disabled || this.options.type === "static" ) {
  4381. return false;
  4382. }
  4383. //We have to refresh the items data once first
  4384. this._refreshItems( event );
  4385. //Find out if the clicked node (or one of its parents) is a actual item in this.items
  4386. $( event.target ).parents().each( function() {
  4387. if ( $.data( this, that.widgetName + "-item" ) === that ) {
  4388. currentItem = $( this );
  4389. return false;
  4390. }
  4391. } );
  4392. if ( $.data( event.target, that.widgetName + "-item" ) === that ) {
  4393. currentItem = $( event.target );
  4394. }
  4395. if ( !currentItem ) {
  4396. return false;
  4397. }
  4398. if ( this.options.handle && !overrideHandle ) {
  4399. $( this.options.handle, currentItem ).find( "*" ).addBack().each( function() {
  4400. if ( this === event.target ) {
  4401. validHandle = true;
  4402. }
  4403. } );
  4404. if ( !validHandle ) {
  4405. return false;
  4406. }
  4407. }
  4408. this.currentItem = currentItem;
  4409. this._removeCurrentsFromItems();
  4410. return true;
  4411. },
  4412. _mouseStart: function( event, overrideHandle, noActivation ) {
  4413. var i, body,
  4414. o = this.options;
  4415. this.currentContainer = this;
  4416. //We only need to call refreshPositions, because the refreshItems call has been moved to
  4417. // mouseCapture
  4418. this.refreshPositions();
  4419. //Create and append the visible helper
  4420. this.helper = this._createHelper( event );
  4421. //Cache the helper size
  4422. this._cacheHelperProportions();
  4423. /*
  4424. * - Position generation -
  4425. * This block generates everything position related - it's the core of draggables.
  4426. */
  4427. //Cache the margins of the original element
  4428. this._cacheMargins();
  4429. //Get the next scrolling parent
  4430. this.scrollParent = this.helper.scrollParent();
  4431. //The element's absolute position on the page minus margins
  4432. this.offset = this.currentItem.offset();
  4433. this.offset = {
  4434. top: this.offset.top - this.margins.top,
  4435. left: this.offset.left - this.margins.left
  4436. };
  4437. $.extend( this.offset, {
  4438. click: { //Where the click happened, relative to the element
  4439. left: event.pageX - this.offset.left,
  4440. top: event.pageY - this.offset.top
  4441. },
  4442. parent: this._getParentOffset(),
  4443. // This is a relative to absolute position minus the actual position calculation -
  4444. // only used for relative positioned helper
  4445. relative: this._getRelativeOffset()
  4446. } );
  4447. // Only after we got the offset, we can change the helper's position to absolute
  4448. // TODO: Still need to figure out a way to make relative sorting possible
  4449. this.helper.css( "position", "absolute" );
  4450. this.cssPosition = this.helper.css( "position" );
  4451. //Generate the original position
  4452. this.originalPosition = this._generatePosition( event );
  4453. this.originalPageX = event.pageX;
  4454. this.originalPageY = event.pageY;
  4455. //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
  4456. ( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) );
  4457. //Cache the former DOM position
  4458. this.domPosition = {
  4459. prev: this.currentItem.prev()[ 0 ],
  4460. parent: this.currentItem.parent()[ 0 ]
  4461. };
  4462. // If the helper is not the original, hide the original so it's not playing any role during
  4463. // the drag, won't cause anything bad this way
  4464. if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
  4465. this.currentItem.hide();
  4466. }
  4467. //Create the placeholder
  4468. this._createPlaceholder();
  4469. //Set a containment if given in the options
  4470. if ( o.containment ) {
  4471. this._setContainment();
  4472. }
  4473. if ( o.cursor && o.cursor !== "auto" ) { // cursor option
  4474. body = this.document.find( "body" );
  4475. // Support: IE
  4476. this.storedCursor = body.css( "cursor" );
  4477. body.css( "cursor", o.cursor );
  4478. this.storedStylesheet =
  4479. $( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body );
  4480. }
  4481. if ( o.opacity ) { // opacity option
  4482. if ( this.helper.css( "opacity" ) ) {
  4483. this._storedOpacity = this.helper.css( "opacity" );
  4484. }
  4485. this.helper.css( "opacity", o.opacity );
  4486. }
  4487. if ( o.zIndex ) { // zIndex option
  4488. if ( this.helper.css( "zIndex" ) ) {
  4489. this._storedZIndex = this.helper.css( "zIndex" );
  4490. }
  4491. this.helper.css( "zIndex", o.zIndex );
  4492. }
  4493. //Prepare scrolling
  4494. if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  4495. this.scrollParent[ 0 ].tagName !== "HTML" ) {
  4496. this.overflowOffset = this.scrollParent.offset();
  4497. }
  4498. //Call callbacks
  4499. this._trigger( "start", event, this._uiHash() );
  4500. //Recache the helper size
  4501. if ( !this._preserveHelperProportions ) {
  4502. this._cacheHelperProportions();
  4503. }
  4504. //Post "activate" events to possible containers
  4505. if ( !noActivation ) {
  4506. for ( i = this.containers.length - 1; i >= 0; i-- ) {
  4507. this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
  4508. }
  4509. }
  4510. //Prepare possible droppables
  4511. if ( $.ui.ddmanager ) {
  4512. $.ui.ddmanager.current = this;
  4513. }
  4514. if ( $.ui.ddmanager && !o.dropBehaviour ) {
  4515. $.ui.ddmanager.prepareOffsets( this, event );
  4516. }
  4517. this.dragging = true;
  4518. this._addClass( this.helper, "ui-sortable-helper" );
  4519. // Execute the drag once - this causes the helper not to be visiblebefore getting its
  4520. // correct position
  4521. this._mouseDrag( event );
  4522. return true;
  4523. },
  4524. _mouseDrag: function( event ) {
  4525. var i, item, itemElement, intersection,
  4526. o = this.options,
  4527. scrolled = false;
  4528. //Compute the helpers position
  4529. this.position = this._generatePosition( event );
  4530. this.positionAbs = this._convertPositionTo( "absolute" );
  4531. if ( !this.lastPositionAbs ) {
  4532. this.lastPositionAbs = this.positionAbs;
  4533. }
  4534. //Do scrolling
  4535. if ( this.options.scroll ) {
  4536. if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  4537. this.scrollParent[ 0 ].tagName !== "HTML" ) {
  4538. if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) -
  4539. event.pageY < o.scrollSensitivity ) {
  4540. this.scrollParent[ 0 ].scrollTop =
  4541. scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed;
  4542. } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) {
  4543. this.scrollParent[ 0 ].scrollTop =
  4544. scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed;
  4545. }
  4546. if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) -
  4547. event.pageX < o.scrollSensitivity ) {
  4548. this.scrollParent[ 0 ].scrollLeft = scrolled =
  4549. this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed;
  4550. } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) {
  4551. this.scrollParent[ 0 ].scrollLeft = scrolled =
  4552. this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed;
  4553. }
  4554. } else {
  4555. if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) {
  4556. scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed );
  4557. } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) <
  4558. o.scrollSensitivity ) {
  4559. scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed );
  4560. }
  4561. if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) {
  4562. scrolled = this.document.scrollLeft(
  4563. this.document.scrollLeft() - o.scrollSpeed
  4564. );
  4565. } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) <
  4566. o.scrollSensitivity ) {
  4567. scrolled = this.document.scrollLeft(
  4568. this.document.scrollLeft() + o.scrollSpeed
  4569. );
  4570. }
  4571. }
  4572. if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) {
  4573. $.ui.ddmanager.prepareOffsets( this, event );
  4574. }
  4575. }
  4576. //Regenerate the absolute position used for position checks
  4577. this.positionAbs = this._convertPositionTo( "absolute" );
  4578. //Set the helper position
  4579. if ( !this.options.axis || this.options.axis !== "y" ) {
  4580. this.helper[ 0 ].style.left = this.position.left + "px";
  4581. }
  4582. if ( !this.options.axis || this.options.axis !== "x" ) {
  4583. this.helper[ 0 ].style.top = this.position.top + "px";
  4584. }
  4585. //Rearrange
  4586. for ( i = this.items.length - 1; i >= 0; i-- ) {
  4587. //Cache variables and intersection, continue if no intersection
  4588. item = this.items[ i ];
  4589. itemElement = item.item[ 0 ];
  4590. intersection = this._intersectsWithPointer( item );
  4591. if ( !intersection ) {
  4592. continue;
  4593. }
  4594. // Only put the placeholder inside the current Container, skip all
  4595. // items from other containers. This works because when moving
  4596. // an item from one container to another the
  4597. // currentContainer is switched before the placeholder is moved.
  4598. //
  4599. // Without this, moving items in "sub-sortables" can cause
  4600. // the placeholder to jitter between the outer and inner container.
  4601. if ( item.instance !== this.currentContainer ) {
  4602. continue;
  4603. }
  4604. // Cannot intersect with itself
  4605. // no useless actions that have been done before
  4606. // no action if the item moved is the parent of the item checked
  4607. if ( itemElement !== this.currentItem[ 0 ] &&
  4608. this.placeholder[ intersection === 1 ? "next" : "prev" ]()[ 0 ] !== itemElement &&
  4609. !$.contains( this.placeholder[ 0 ], itemElement ) &&
  4610. ( this.options.type === "semi-dynamic" ?
  4611. !$.contains( this.element[ 0 ], itemElement ) :
  4612. true
  4613. )
  4614. ) {
  4615. this.direction = intersection === 1 ? "down" : "up";
  4616. if ( this.options.tolerance === "pointer" || this._intersectsWithSides( item ) ) {
  4617. this._rearrange( event, item );
  4618. } else {
  4619. break;
  4620. }
  4621. this._trigger( "change", event, this._uiHash() );
  4622. break;
  4623. }
  4624. }
  4625. //Post events to containers
  4626. this._contactContainers( event );
  4627. //Interconnect with droppables
  4628. if ( $.ui.ddmanager ) {
  4629. $.ui.ddmanager.drag( this, event );
  4630. }
  4631. //Call callbacks
  4632. this._trigger( "sort", event, this._uiHash() );
  4633. this.lastPositionAbs = this.positionAbs;
  4634. return false;
  4635. },
  4636. _mouseStop: function( event, noPropagation ) {
  4637. if ( !event ) {
  4638. return;
  4639. }
  4640. //If we are using droppables, inform the manager about the drop
  4641. if ( $.ui.ddmanager && !this.options.dropBehaviour ) {
  4642. $.ui.ddmanager.drop( this, event );
  4643. }
  4644. if ( this.options.revert ) {
  4645. var that = this,
  4646. cur = this.placeholder.offset(),
  4647. axis = this.options.axis,
  4648. animation = {};
  4649. if ( !axis || axis === "x" ) {
  4650. animation.left = cur.left - this.offset.parent.left - this.margins.left +
  4651. ( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
  4652. 0 :
  4653. this.offsetParent[ 0 ].scrollLeft
  4654. );
  4655. }
  4656. if ( !axis || axis === "y" ) {
  4657. animation.top = cur.top - this.offset.parent.top - this.margins.top +
  4658. ( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
  4659. 0 :
  4660. this.offsetParent[ 0 ].scrollTop
  4661. );
  4662. }
  4663. this.reverting = true;
  4664. $( this.helper ).animate(
  4665. animation,
  4666. parseInt( this.options.revert, 10 ) || 500,
  4667. function() {
  4668. that._clear( event );
  4669. }
  4670. );
  4671. } else {
  4672. this._clear( event, noPropagation );
  4673. }
  4674. return false;
  4675. },
  4676. cancel: function() {
  4677. if ( this.dragging ) {
  4678. this._mouseUp( new $.Event( "mouseup", { target: null } ) );
  4679. if ( this.options.helper === "original" ) {
  4680. this.currentItem.css( this._storedCSS );
  4681. this._removeClass( this.currentItem, "ui-sortable-helper" );
  4682. } else {
  4683. this.currentItem.show();
  4684. }
  4685. //Post deactivating events to containers
  4686. for ( var i = this.containers.length - 1; i >= 0; i-- ) {
  4687. this.containers[ i ]._trigger( "deactivate", null, this._uiHash( this ) );
  4688. if ( this.containers[ i ].containerCache.over ) {
  4689. this.containers[ i ]._trigger( "out", null, this._uiHash( this ) );
  4690. this.containers[ i ].containerCache.over = 0;
  4691. }
  4692. }
  4693. }
  4694. if ( this.placeholder ) {
  4695. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
  4696. // it unbinds ALL events from the original node!
  4697. if ( this.placeholder[ 0 ].parentNode ) {
  4698. this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );
  4699. }
  4700. if ( this.options.helper !== "original" && this.helper &&
  4701. this.helper[ 0 ].parentNode ) {
  4702. this.helper.remove();
  4703. }
  4704. $.extend( this, {
  4705. helper: null,
  4706. dragging: false,
  4707. reverting: false,
  4708. _noFinalSort: null
  4709. } );
  4710. if ( this.domPosition.prev ) {
  4711. $( this.domPosition.prev ).after( this.currentItem );
  4712. } else {
  4713. $( this.domPosition.parent ).prepend( this.currentItem );
  4714. }
  4715. }
  4716. return this;
  4717. },
  4718. serialize: function( o ) {
  4719. var items = this._getItemsAsjQuery( o && o.connected ),
  4720. str = [];
  4721. o = o || {};
  4722. $( items ).each( function() {
  4723. var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" )
  4724. .match( o.expression || ( /(.+)[\-=_](.+)/ ) );
  4725. if ( res ) {
  4726. str.push(
  4727. ( o.key || res[ 1 ] + "[]" ) +
  4728. "=" + ( o.key && o.expression ? res[ 1 ] : res[ 2 ] ) );
  4729. }
  4730. } );
  4731. if ( !str.length && o.key ) {
  4732. str.push( o.key + "=" );
  4733. }
  4734. return str.join( "&" );
  4735. },
  4736. toArray: function( o ) {
  4737. var items = this._getItemsAsjQuery( o && o.connected ),
  4738. ret = [];
  4739. o = o || {};
  4740. items.each( function() {
  4741. ret.push( $( o.item || this ).attr( o.attribute || "id" ) || "" );
  4742. } );
  4743. return ret;
  4744. },
  4745. /* Be careful with the following core functions */
  4746. _intersectsWith: function( item ) {
  4747. var x1 = this.positionAbs.left,
  4748. x2 = x1 + this.helperProportions.width,
  4749. y1 = this.positionAbs.top,
  4750. y2 = y1 + this.helperProportions.height,
  4751. l = item.left,
  4752. r = l + item.width,
  4753. t = item.top,
  4754. b = t + item.height,
  4755. dyClick = this.offset.click.top,
  4756. dxClick = this.offset.click.left,
  4757. isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t &&
  4758. ( y1 + dyClick ) < b ),
  4759. isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l &&
  4760. ( x1 + dxClick ) < r ),
  4761. isOverElement = isOverElementHeight && isOverElementWidth;
  4762. if ( this.options.tolerance === "pointer" ||
  4763. this.options.forcePointerForContainers ||
  4764. ( this.options.tolerance !== "pointer" &&
  4765. this.helperProportions[ this.floating ? "width" : "height" ] >
  4766. item[ this.floating ? "width" : "height" ] )
  4767. ) {
  4768. return isOverElement;
  4769. } else {
  4770. return ( l < x1 + ( this.helperProportions.width / 2 ) && // Right Half
  4771. x2 - ( this.helperProportions.width / 2 ) < r && // Left Half
  4772. t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half
  4773. y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half
  4774. }
  4775. },
  4776. _intersectsWithPointer: function( item ) {
  4777. var verticalDirection, horizontalDirection,
  4778. isOverElementHeight = ( this.options.axis === "x" ) ||
  4779. this._isOverAxis(
  4780. this.positionAbs.top + this.offset.click.top, item.top, item.height ),
  4781. isOverElementWidth = ( this.options.axis === "y" ) ||
  4782. this._isOverAxis(
  4783. this.positionAbs.left + this.offset.click.left, item.left, item.width ),
  4784. isOverElement = isOverElementHeight && isOverElementWidth;
  4785. if ( !isOverElement ) {
  4786. return false;
  4787. }
  4788. verticalDirection = this._getDragVerticalDirection();
  4789. horizontalDirection = this._getDragHorizontalDirection();
  4790. return this.floating ?
  4791. ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 )
  4792. : ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) );
  4793. },
  4794. _intersectsWithSides: function( item ) {
  4795. var isOverBottomHalf = this._isOverAxis( this.positionAbs.top +
  4796. this.offset.click.top, item.top + ( item.height / 2 ), item.height ),
  4797. isOverRightHalf = this._isOverAxis( this.positionAbs.left +
  4798. this.offset.click.left, item.left + ( item.width / 2 ), item.width ),
  4799. verticalDirection = this._getDragVerticalDirection(),
  4800. horizontalDirection = this._getDragHorizontalDirection();
  4801. if ( this.floating && horizontalDirection ) {
  4802. return ( ( horizontalDirection === "right" && isOverRightHalf ) ||
  4803. ( horizontalDirection === "left" && !isOverRightHalf ) );
  4804. } else {
  4805. return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) ||
  4806. ( verticalDirection === "up" && !isOverBottomHalf ) );
  4807. }
  4808. },
  4809. _getDragVerticalDirection: function() {
  4810. var delta = this.positionAbs.top - this.lastPositionAbs.top;
  4811. return delta !== 0 && ( delta > 0 ? "down" : "up" );
  4812. },
  4813. _getDragHorizontalDirection: function() {
  4814. var delta = this.positionAbs.left - this.lastPositionAbs.left;
  4815. return delta !== 0 && ( delta > 0 ? "right" : "left" );
  4816. },
  4817. refresh: function( event ) {
  4818. this._refreshItems( event );
  4819. this._setHandleClassName();
  4820. this.refreshPositions();
  4821. return this;
  4822. },
  4823. _connectWith: function() {
  4824. var options = this.options;
  4825. return options.connectWith.constructor === String ?
  4826. [ options.connectWith ] :
  4827. options.connectWith;
  4828. },
  4829. _getItemsAsjQuery: function( connected ) {
  4830. var i, j, cur, inst,
  4831. items = [],
  4832. queries = [],
  4833. connectWith = this._connectWith();
  4834. if ( connectWith && connected ) {
  4835. for ( i = connectWith.length - 1; i >= 0; i-- ) {
  4836. cur = $( connectWith[ i ], this.document[ 0 ] );
  4837. for ( j = cur.length - 1; j >= 0; j-- ) {
  4838. inst = $.data( cur[ j ], this.widgetFullName );
  4839. if ( inst && inst !== this && !inst.options.disabled ) {
  4840. queries.push( [ $.isFunction( inst.options.items ) ?
  4841. inst.options.items.call( inst.element ) :
  4842. $( inst.options.items, inst.element )
  4843. .not( ".ui-sortable-helper" )
  4844. .not( ".ui-sortable-placeholder" ), inst ] );
  4845. }
  4846. }
  4847. }
  4848. }
  4849. queries.push( [ $.isFunction( this.options.items ) ?
  4850. this.options.items
  4851. .call( this.element, null, { options: this.options, item: this.currentItem } ) :
  4852. $( this.options.items, this.element )
  4853. .not( ".ui-sortable-helper" )
  4854. .not( ".ui-sortable-placeholder" ), this ] );
  4855. function addItems() {
  4856. items.push( this );
  4857. }
  4858. for ( i = queries.length - 1; i >= 0; i-- ) {
  4859. queries[ i ][ 0 ].each( addItems );
  4860. }
  4861. return $( items );
  4862. },
  4863. _removeCurrentsFromItems: function() {
  4864. var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" );
  4865. this.items = $.grep( this.items, function( item ) {
  4866. for ( var j = 0; j < list.length; j++ ) {
  4867. if ( list[ j ] === item.item[ 0 ] ) {
  4868. return false;
  4869. }
  4870. }
  4871. return true;
  4872. } );
  4873. },
  4874. _refreshItems: function( event ) {
  4875. this.items = [];
  4876. this.containers = [ this ];
  4877. var i, j, cur, inst, targetData, _queries, item, queriesLength,
  4878. items = this.items,
  4879. queries = [ [ $.isFunction( this.options.items ) ?
  4880. this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) :
  4881. $( this.options.items, this.element ), this ] ],
  4882. connectWith = this._connectWith();
  4883. //Shouldn't be run the first time through due to massive slow-down
  4884. if ( connectWith && this.ready ) {
  4885. for ( i = connectWith.length - 1; i >= 0; i-- ) {
  4886. cur = $( connectWith[ i ], this.document[ 0 ] );
  4887. for ( j = cur.length - 1; j >= 0; j-- ) {
  4888. inst = $.data( cur[ j ], this.widgetFullName );
  4889. if ( inst && inst !== this && !inst.options.disabled ) {
  4890. queries.push( [ $.isFunction( inst.options.items ) ?
  4891. inst.options.items
  4892. .call( inst.element[ 0 ], event, { item: this.currentItem } ) :
  4893. $( inst.options.items, inst.element ), inst ] );
  4894. this.containers.push( inst );
  4895. }
  4896. }
  4897. }
  4898. }
  4899. for ( i = queries.length - 1; i >= 0; i-- ) {
  4900. targetData = queries[ i ][ 1 ];
  4901. _queries = queries[ i ][ 0 ];
  4902. for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) {
  4903. item = $( _queries[ j ] );
  4904. // Data for target checking (mouse manager)
  4905. item.data( this.widgetName + "-item", targetData );
  4906. items.push( {
  4907. item: item,
  4908. instance: targetData,
  4909. width: 0, height: 0,
  4910. left: 0, top: 0
  4911. } );
  4912. }
  4913. }
  4914. },
  4915. refreshPositions: function( fast ) {
  4916. // Determine whether items are being displayed horizontally
  4917. this.floating = this.items.length ?
  4918. this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
  4919. false;
  4920. //This has to be redone because due to the item being moved out/into the offsetParent,
  4921. // the offsetParent's position will change
  4922. if ( this.offsetParent && this.helper ) {
  4923. this.offset.parent = this._getParentOffset();
  4924. }
  4925. var i, item, t, p;
  4926. for ( i = this.items.length - 1; i >= 0; i-- ) {
  4927. item = this.items[ i ];
  4928. //We ignore calculating positions of all connected containers when we're not over them
  4929. if ( item.instance !== this.currentContainer && this.currentContainer &&
  4930. item.item[ 0 ] !== this.currentItem[ 0 ] ) {
  4931. continue;
  4932. }
  4933. t = this.options.toleranceElement ?
  4934. $( this.options.toleranceElement, item.item ) :
  4935. item.item;
  4936. if ( !fast ) {
  4937. item.width = t.outerWidth();
  4938. item.height = t.outerHeight();
  4939. }
  4940. p = t.offset();
  4941. item.left = p.left;
  4942. item.top = p.top;
  4943. }
  4944. if ( this.options.custom && this.options.custom.refreshContainers ) {
  4945. this.options.custom.refreshContainers.call( this );
  4946. } else {
  4947. for ( i = this.containers.length - 1; i >= 0; i-- ) {
  4948. p = this.containers[ i ].element.offset();
  4949. this.containers[ i ].containerCache.left = p.left;
  4950. this.containers[ i ].containerCache.top = p.top;
  4951. this.containers[ i ].containerCache.width =
  4952. this.containers[ i ].element.outerWidth();
  4953. this.containers[ i ].containerCache.height =
  4954. this.containers[ i ].element.outerHeight();
  4955. }
  4956. }
  4957. return this;
  4958. },
  4959. _createPlaceholder: function( that ) {
  4960. that = that || this;
  4961. var className,
  4962. o = that.options;
  4963. if ( !o.placeholder || o.placeholder.constructor === String ) {
  4964. className = o.placeholder;
  4965. o.placeholder = {
  4966. element: function() {
  4967. var nodeName = that.currentItem[ 0 ].nodeName.toLowerCase(),
  4968. element = $( "<" + nodeName + ">", that.document[ 0 ] );
  4969. that._addClass( element, "ui-sortable-placeholder",
  4970. className || that.currentItem[ 0 ].className )
  4971. ._removeClass( element, "ui-sortable-helper" );
  4972. if ( nodeName === "tbody" ) {
  4973. that._createTrPlaceholder(
  4974. that.currentItem.find( "tr" ).eq( 0 ),
  4975. $( "<tr>", that.document[ 0 ] ).appendTo( element )
  4976. );
  4977. } else if ( nodeName === "tr" ) {
  4978. that._createTrPlaceholder( that.currentItem, element );
  4979. } else if ( nodeName === "img" ) {
  4980. element.attr( "src", that.currentItem.attr( "src" ) );
  4981. }
  4982. if ( !className ) {
  4983. element.css( "visibility", "hidden" );
  4984. }
  4985. return element;
  4986. },
  4987. update: function( container, p ) {
  4988. // 1. If a className is set as 'placeholder option, we don't force sizes -
  4989. // the class is responsible for that
  4990. // 2. The option 'forcePlaceholderSize can be enabled to force it even if a
  4991. // class name is specified
  4992. if ( className && !o.forcePlaceholderSize ) {
  4993. return;
  4994. }
  4995. //If the element doesn't have a actual height by itself (without styles coming
  4996. // from a stylesheet), it receives the inline height from the dragged item
  4997. if ( !p.height() ) {
  4998. p.height(
  4999. that.currentItem.innerHeight() -
  5000. parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) -
  5001. parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) );
  5002. }
  5003. if ( !p.width() ) {
  5004. p.width(
  5005. that.currentItem.innerWidth() -
  5006. parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) -
  5007. parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) );
  5008. }
  5009. }
  5010. };
  5011. }
  5012. //Create the placeholder
  5013. that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) );
  5014. //Append it after the actual current item
  5015. that.currentItem.after( that.placeholder );
  5016. //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
  5017. o.placeholder.update( that, that.placeholder );
  5018. },
  5019. _createTrPlaceholder: function( sourceTr, targetTr ) {
  5020. var that = this;
  5021. sourceTr.children().each( function() {
  5022. $( "<td>&#160;</td>", that.document[ 0 ] )
  5023. .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
  5024. .appendTo( targetTr );
  5025. } );
  5026. },
  5027. _contactContainers: function( event ) {
  5028. var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom,
  5029. floating, axis,
  5030. innermostContainer = null,
  5031. innermostIndex = null;
  5032. // Get innermost container that intersects with item
  5033. for ( i = this.containers.length - 1; i >= 0; i-- ) {
  5034. // Never consider a container that's located within the item itself
  5035. if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) {
  5036. continue;
  5037. }
  5038. if ( this._intersectsWith( this.containers[ i ].containerCache ) ) {
  5039. // If we've already found a container and it's more "inner" than this, then continue
  5040. if ( innermostContainer &&
  5041. $.contains(
  5042. this.containers[ i ].element[ 0 ],
  5043. innermostContainer.element[ 0 ] ) ) {
  5044. continue;
  5045. }
  5046. innermostContainer = this.containers[ i ];
  5047. innermostIndex = i;
  5048. } else {
  5049. // container doesn't intersect. trigger "out" event if necessary
  5050. if ( this.containers[ i ].containerCache.over ) {
  5051. this.containers[ i ]._trigger( "out", event, this._uiHash( this ) );
  5052. this.containers[ i ].containerCache.over = 0;
  5053. }
  5054. }
  5055. }
  5056. // If no intersecting containers found, return
  5057. if ( !innermostContainer ) {
  5058. return;
  5059. }
  5060. // Move the item into the container if it's not there already
  5061. if ( this.containers.length === 1 ) {
  5062. if ( !this.containers[ innermostIndex ].containerCache.over ) {
  5063. this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
  5064. this.containers[ innermostIndex ].containerCache.over = 1;
  5065. }
  5066. } else {
  5067. // When entering a new container, we will find the item with the least distance and
  5068. // append our item near it
  5069. dist = 10000;
  5070. itemWithLeastDistance = null;
  5071. floating = innermostContainer.floating || this._isFloating( this.currentItem );
  5072. posProperty = floating ? "left" : "top";
  5073. sizeProperty = floating ? "width" : "height";
  5074. axis = floating ? "pageX" : "pageY";
  5075. for ( j = this.items.length - 1; j >= 0; j-- ) {
  5076. if ( !$.contains(
  5077. this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] )
  5078. ) {
  5079. continue;
  5080. }
  5081. if ( this.items[ j ].item[ 0 ] === this.currentItem[ 0 ] ) {
  5082. continue;
  5083. }
  5084. cur = this.items[ j ].item.offset()[ posProperty ];
  5085. nearBottom = false;
  5086. if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
  5087. nearBottom = true;
  5088. }
  5089. if ( Math.abs( event[ axis ] - cur ) < dist ) {
  5090. dist = Math.abs( event[ axis ] - cur );
  5091. itemWithLeastDistance = this.items[ j ];
  5092. this.direction = nearBottom ? "up" : "down";
  5093. }
  5094. }
  5095. //Check if dropOnEmpty is enabled
  5096. if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) {
  5097. return;
  5098. }
  5099. if ( this.currentContainer === this.containers[ innermostIndex ] ) {
  5100. if ( !this.currentContainer.containerCache.over ) {
  5101. this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
  5102. this.currentContainer.containerCache.over = 1;
  5103. }
  5104. return;
  5105. }
  5106. itemWithLeastDistance ?
  5107. this._rearrange( event, itemWithLeastDistance, null, true ) :
  5108. this._rearrange( event, null, this.containers[ innermostIndex ].element, true );
  5109. this._trigger( "change", event, this._uiHash() );
  5110. this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) );
  5111. this.currentContainer = this.containers[ innermostIndex ];
  5112. //Update the placeholder
  5113. this.options.placeholder.update( this.currentContainer, this.placeholder );
  5114. this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
  5115. this.containers[ innermostIndex ].containerCache.over = 1;
  5116. }
  5117. },
  5118. _createHelper: function( event ) {
  5119. var o = this.options,
  5120. helper = $.isFunction( o.helper ) ?
  5121. $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) :
  5122. ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem );
  5123. //Add the helper to the DOM if that didn't happen already
  5124. if ( !helper.parents( "body" ).length ) {
  5125. $( o.appendTo !== "parent" ?
  5126. o.appendTo :
  5127. this.currentItem[ 0 ].parentNode )[ 0 ].appendChild( helper[ 0 ] );
  5128. }
  5129. if ( helper[ 0 ] === this.currentItem[ 0 ] ) {
  5130. this._storedCSS = {
  5131. width: this.currentItem[ 0 ].style.width,
  5132. height: this.currentItem[ 0 ].style.height,
  5133. position: this.currentItem.css( "position" ),
  5134. top: this.currentItem.css( "top" ),
  5135. left: this.currentItem.css( "left" )
  5136. };
  5137. }
  5138. if ( !helper[ 0 ].style.width || o.forceHelperSize ) {
  5139. helper.width( this.currentItem.width() );
  5140. }
  5141. if ( !helper[ 0 ].style.height || o.forceHelperSize ) {
  5142. helper.height( this.currentItem.height() );
  5143. }
  5144. return helper;
  5145. },
  5146. _adjustOffsetFromHelper: function( obj ) {
  5147. if ( typeof obj === "string" ) {
  5148. obj = obj.split( " " );
  5149. }
  5150. if ( $.isArray( obj ) ) {
  5151. obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
  5152. }
  5153. if ( "left" in obj ) {
  5154. this.offset.click.left = obj.left + this.margins.left;
  5155. }
  5156. if ( "right" in obj ) {
  5157. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  5158. }
  5159. if ( "top" in obj ) {
  5160. this.offset.click.top = obj.top + this.margins.top;
  5161. }
  5162. if ( "bottom" in obj ) {
  5163. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  5164. }
  5165. },
  5166. _getParentOffset: function() {
  5167. //Get the offsetParent and cache its position
  5168. this.offsetParent = this.helper.offsetParent();
  5169. var po = this.offsetParent.offset();
  5170. // This is a special case where we need to modify a offset calculated on start, since the
  5171. // following happened:
  5172. // 1. The position of the helper is absolute, so it's position is calculated based on the
  5173. // next positioned parent
  5174. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
  5175. // the document, which means that the scroll is included in the initial calculation of the
  5176. // offset of the parent, and never recalculated upon drag
  5177. if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  5178. $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
  5179. po.left += this.scrollParent.scrollLeft();
  5180. po.top += this.scrollParent.scrollTop();
  5181. }
  5182. // This needs to be actually done for all browsers, since pageX/pageY includes this
  5183. // information with an ugly IE fix
  5184. if ( this.offsetParent[ 0 ] === this.document[ 0 ].body ||
  5185. ( this.offsetParent[ 0 ].tagName &&
  5186. this.offsetParent[ 0 ].tagName.toLowerCase() === "html" && $.ui.ie ) ) {
  5187. po = { top: 0, left: 0 };
  5188. }
  5189. return {
  5190. top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),
  5191. left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )
  5192. };
  5193. },
  5194. _getRelativeOffset: function() {
  5195. if ( this.cssPosition === "relative" ) {
  5196. var p = this.currentItem.position();
  5197. return {
  5198. top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +
  5199. this.scrollParent.scrollTop(),
  5200. left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +
  5201. this.scrollParent.scrollLeft()
  5202. };
  5203. } else {
  5204. return { top: 0, left: 0 };
  5205. }
  5206. },
  5207. _cacheMargins: function() {
  5208. this.margins = {
  5209. left: ( parseInt( this.currentItem.css( "marginLeft" ), 10 ) || 0 ),
  5210. top: ( parseInt( this.currentItem.css( "marginTop" ), 10 ) || 0 )
  5211. };
  5212. },
  5213. _cacheHelperProportions: function() {
  5214. this.helperProportions = {
  5215. width: this.helper.outerWidth(),
  5216. height: this.helper.outerHeight()
  5217. };
  5218. },
  5219. _setContainment: function() {
  5220. var ce, co, over,
  5221. o = this.options;
  5222. if ( o.containment === "parent" ) {
  5223. o.containment = this.helper[ 0 ].parentNode;
  5224. }
  5225. if ( o.containment === "document" || o.containment === "window" ) {
  5226. this.containment = [
  5227. 0 - this.offset.relative.left - this.offset.parent.left,
  5228. 0 - this.offset.relative.top - this.offset.parent.top,
  5229. o.containment === "document" ?
  5230. this.document.width() :
  5231. this.window.width() - this.helperProportions.width - this.margins.left,
  5232. ( o.containment === "document" ?
  5233. ( this.document.height() || document.body.parentNode.scrollHeight ) :
  5234. this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight
  5235. ) - this.helperProportions.height - this.margins.top
  5236. ];
  5237. }
  5238. if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) {
  5239. ce = $( o.containment )[ 0 ];
  5240. co = $( o.containment ).offset();
  5241. over = ( $( ce ).css( "overflow" ) !== "hidden" );
  5242. this.containment = [
  5243. co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) +
  5244. ( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left,
  5245. co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) +
  5246. ( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top,
  5247. co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
  5248. ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) -
  5249. ( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) -
  5250. this.helperProportions.width - this.margins.left,
  5251. co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
  5252. ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) -
  5253. ( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) -
  5254. this.helperProportions.height - this.margins.top
  5255. ];
  5256. }
  5257. },
  5258. _convertPositionTo: function( d, pos ) {
  5259. if ( !pos ) {
  5260. pos = this.position;
  5261. }
  5262. var mod = d === "absolute" ? 1 : -1,
  5263. scroll = this.cssPosition === "absolute" &&
  5264. !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  5265. $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
  5266. this.offsetParent :
  5267. this.scrollParent,
  5268. scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
  5269. return {
  5270. top: (
  5271. // The absolute mouse position
  5272. pos.top +
  5273. // Only for relative positioned nodes: Relative offset from element to offset parent
  5274. this.offset.relative.top * mod +
  5275. // The offsetParent's offset without borders (offset + border)
  5276. this.offset.parent.top * mod -
  5277. ( ( this.cssPosition === "fixed" ?
  5278. -this.scrollParent.scrollTop() :
  5279. ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod )
  5280. ),
  5281. left: (
  5282. // The absolute mouse position
  5283. pos.left +
  5284. // Only for relative positioned nodes: Relative offset from element to offset parent
  5285. this.offset.relative.left * mod +
  5286. // The offsetParent's offset without borders (offset + border)
  5287. this.offset.parent.left * mod -
  5288. ( ( this.cssPosition === "fixed" ?
  5289. -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
  5290. scroll.scrollLeft() ) * mod )
  5291. )
  5292. };
  5293. },
  5294. _generatePosition: function( event ) {
  5295. var top, left,
  5296. o = this.options,
  5297. pageX = event.pageX,
  5298. pageY = event.pageY,
  5299. scroll = this.cssPosition === "absolute" &&
  5300. !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  5301. $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
  5302. this.offsetParent :
  5303. this.scrollParent,
  5304. scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );
  5305. // This is another very weird special case that only happens for relative elements:
  5306. // 1. If the css position is relative
  5307. // 2. and the scroll parent is the document or similar to the offset parent
  5308. // we have to refresh the relative offset during the scroll so there are no jumps
  5309. if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
  5310. this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) {
  5311. this.offset.relative = this._getRelativeOffset();
  5312. }
  5313. /*
  5314. * - Position constraining -
  5315. * Constrain the position to a mix of grid, containment.
  5316. */
  5317. if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options
  5318. if ( this.containment ) {
  5319. if ( event.pageX - this.offset.click.left < this.containment[ 0 ] ) {
  5320. pageX = this.containment[ 0 ] + this.offset.click.left;
  5321. }
  5322. if ( event.pageY - this.offset.click.top < this.containment[ 1 ] ) {
  5323. pageY = this.containment[ 1 ] + this.offset.click.top;
  5324. }
  5325. if ( event.pageX - this.offset.click.left > this.containment[ 2 ] ) {
  5326. pageX = this.containment[ 2 ] + this.offset.click.left;
  5327. }
  5328. if ( event.pageY - this.offset.click.top > this.containment[ 3 ] ) {
  5329. pageY = this.containment[ 3 ] + this.offset.click.top;
  5330. }
  5331. }
  5332. if ( o.grid ) {
  5333. top = this.originalPageY + Math.round( ( pageY - this.originalPageY ) /
  5334. o.grid[ 1 ] ) * o.grid[ 1 ];
  5335. pageY = this.containment ?
  5336. ( ( top - this.offset.click.top >= this.containment[ 1 ] &&
  5337. top - this.offset.click.top <= this.containment[ 3 ] ) ?
  5338. top :
  5339. ( ( top - this.offset.click.top >= this.containment[ 1 ] ) ?
  5340. top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) :
  5341. top;
  5342. left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) /
  5343. o.grid[ 0 ] ) * o.grid[ 0 ];
  5344. pageX = this.containment ?
  5345. ( ( left - this.offset.click.left >= this.containment[ 0 ] &&
  5346. left - this.offset.click.left <= this.containment[ 2 ] ) ?
  5347. left :
  5348. ( ( left - this.offset.click.left >= this.containment[ 0 ] ) ?
  5349. left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) :
  5350. left;
  5351. }
  5352. }
  5353. return {
  5354. top: (
  5355. // The absolute mouse position
  5356. pageY -
  5357. // Click offset (relative to the element)
  5358. this.offset.click.top -
  5359. // Only for relative positioned nodes: Relative offset from element to offset parent
  5360. this.offset.relative.top -
  5361. // The offsetParent's offset without borders (offset + border)
  5362. this.offset.parent.top +
  5363. ( ( this.cssPosition === "fixed" ?
  5364. -this.scrollParent.scrollTop() :
  5365. ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) )
  5366. ),
  5367. left: (
  5368. // The absolute mouse position
  5369. pageX -
  5370. // Click offset (relative to the element)
  5371. this.offset.click.left -
  5372. // Only for relative positioned nodes: Relative offset from element to offset parent
  5373. this.offset.relative.left -
  5374. // The offsetParent's offset without borders (offset + border)
  5375. this.offset.parent.left +
  5376. ( ( this.cssPosition === "fixed" ?
  5377. -this.scrollParent.scrollLeft() :
  5378. scrollIsRootNode ? 0 : scroll.scrollLeft() ) )
  5379. )
  5380. };
  5381. },
  5382. _rearrange: function( event, i, a, hardRefresh ) {
  5383. a ? a[ 0 ].appendChild( this.placeholder[ 0 ] ) :
  5384. i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ],
  5385. ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) );
  5386. //Various things done here to improve the performance:
  5387. // 1. we create a setTimeout, that calls refreshPositions
  5388. // 2. on the instance, we have a counter variable, that get's higher after every append
  5389. // 3. on the local scope, we copy the counter variable, and check in the timeout,
  5390. // if it's still the same
  5391. // 4. this lets only the last addition to the timeout stack through
  5392. this.counter = this.counter ? ++this.counter : 1;
  5393. var counter = this.counter;
  5394. this._delay( function() {
  5395. if ( counter === this.counter ) {
  5396. //Precompute after each DOM insertion, NOT on mousemove
  5397. this.refreshPositions( !hardRefresh );
  5398. }
  5399. } );
  5400. },
  5401. _clear: function( event, noPropagation ) {
  5402. this.reverting = false;
  5403. // We delay all events that have to be triggered to after the point where the placeholder
  5404. // has been removed and everything else normalized again
  5405. var i,
  5406. delayedTriggers = [];
  5407. // We first have to update the dom position of the actual currentItem
  5408. // Note: don't do it if the current item is already removed (by a user), or it gets
  5409. // reappended (see #4088)
  5410. if ( !this._noFinalSort && this.currentItem.parent().length ) {
  5411. this.placeholder.before( this.currentItem );
  5412. }
  5413. this._noFinalSort = null;
  5414. if ( this.helper[ 0 ] === this.currentItem[ 0 ] ) {
  5415. for ( i in this._storedCSS ) {
  5416. if ( this._storedCSS[ i ] === "auto" || this._storedCSS[ i ] === "static" ) {
  5417. this._storedCSS[ i ] = "";
  5418. }
  5419. }
  5420. this.currentItem.css( this._storedCSS );
  5421. this._removeClass( this.currentItem, "ui-sortable-helper" );
  5422. } else {
  5423. this.currentItem.show();
  5424. }
  5425. if ( this.fromOutside && !noPropagation ) {
  5426. delayedTriggers.push( function( event ) {
  5427. this._trigger( "receive", event, this._uiHash( this.fromOutside ) );
  5428. } );
  5429. }
  5430. if ( ( this.fromOutside ||
  5431. this.domPosition.prev !==
  5432. this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] ||
  5433. this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) {
  5434. // Trigger update callback if the DOM position has changed
  5435. delayedTriggers.push( function( event ) {
  5436. this._trigger( "update", event, this._uiHash() );
  5437. } );
  5438. }
  5439. // Check if the items Container has Changed and trigger appropriate
  5440. // events.
  5441. if ( this !== this.currentContainer ) {
  5442. if ( !noPropagation ) {
  5443. delayedTriggers.push( function( event ) {
  5444. this._trigger( "remove", event, this._uiHash() );
  5445. } );
  5446. delayedTriggers.push( ( function( c ) {
  5447. return function( event ) {
  5448. c._trigger( "receive", event, this._uiHash( this ) );
  5449. };
  5450. } ).call( this, this.currentContainer ) );
  5451. delayedTriggers.push( ( function( c ) {
  5452. return function( event ) {
  5453. c._trigger( "update", event, this._uiHash( this ) );
  5454. };
  5455. } ).call( this, this.currentContainer ) );
  5456. }
  5457. }
  5458. //Post events to containers
  5459. function delayEvent( type, instance, container ) {
  5460. return function( event ) {
  5461. container._trigger( type, event, instance._uiHash( instance ) );
  5462. };
  5463. }
  5464. for ( i = this.containers.length - 1; i >= 0; i-- ) {
  5465. if ( !noPropagation ) {
  5466. delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
  5467. }
  5468. if ( this.containers[ i ].containerCache.over ) {
  5469. delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
  5470. this.containers[ i ].containerCache.over = 0;
  5471. }
  5472. }
  5473. //Do what was originally in plugins
  5474. if ( this.storedCursor ) {
  5475. this.document.find( "body" ).css( "cursor", this.storedCursor );
  5476. this.storedStylesheet.remove();
  5477. }
  5478. if ( this._storedOpacity ) {
  5479. this.helper.css( "opacity", this._storedOpacity );
  5480. }
  5481. if ( this._storedZIndex ) {
  5482. this.helper.css( "zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex );
  5483. }
  5484. this.dragging = false;
  5485. if ( !noPropagation ) {
  5486. this._trigger( "beforeStop", event, this._uiHash() );
  5487. }
  5488. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
  5489. // it unbinds ALL events from the original node!
  5490. this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );
  5491. if ( !this.cancelHelperRemoval ) {
  5492. if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
  5493. this.helper.remove();
  5494. }
  5495. this.helper = null;
  5496. }
  5497. if ( !noPropagation ) {
  5498. for ( i = 0; i < delayedTriggers.length; i++ ) {
  5499. // Trigger all delayed events
  5500. delayedTriggers[ i ].call( this, event );
  5501. }
  5502. this._trigger( "stop", event, this._uiHash() );
  5503. }
  5504. this.fromOutside = false;
  5505. return !this.cancelHelperRemoval;
  5506. },
  5507. _trigger: function() {
  5508. if ( $.Widget.prototype._trigger.apply( this, arguments ) === false ) {
  5509. this.cancel();
  5510. }
  5511. },
  5512. _uiHash: function( _inst ) {
  5513. var inst = _inst || this;
  5514. return {
  5515. helper: inst.helper,
  5516. placeholder: inst.placeholder || $( [] ),
  5517. position: inst.position,
  5518. originalPosition: inst.originalPosition,
  5519. offset: inst.positionAbs,
  5520. item: inst.currentItem,
  5521. sender: _inst ? _inst.element : null
  5522. };
  5523. }
  5524. } );
  5525. /*!
  5526. * jQuery UI Accordion 1.12.1
  5527. * http://jqueryui.com
  5528. *
  5529. * Copyright jQuery Foundation and other contributors
  5530. * Released under the MIT license.
  5531. * http://jquery.org/license
  5532. */
  5533. //>>label: Accordion
  5534. //>>group: Widgets
  5535. // jscs:disable maximumLineLength
  5536. //>>description: Displays collapsible content panels for presenting information in a limited amount of space.
  5537. // jscs:enable maximumLineLength
  5538. //>>docs: http://api.jqueryui.com/accordion/
  5539. //>>demos: http://jqueryui.com/accordion/
  5540. //>>css.structure: ../../themes/base/core.css
  5541. //>>css.structure: ../../themes/base/accordion.css
  5542. //>>css.theme: ../../themes/base/theme.css
  5543. var widgetsAccordion = $.widget( "ui.accordion", {
  5544. version: "1.12.1",
  5545. options: {
  5546. active: 0,
  5547. animate: {},
  5548. classes: {
  5549. "ui-accordion-header": "ui-corner-top",
  5550. "ui-accordion-header-collapsed": "ui-corner-all",
  5551. "ui-accordion-content": "ui-corner-bottom"
  5552. },
  5553. collapsible: false,
  5554. event: "click",
  5555. header: "> li > :first-child, > :not(li):even",
  5556. heightStyle: "auto",
  5557. icons: {
  5558. activeHeader: "ui-icon-triangle-1-s",
  5559. header: "ui-icon-triangle-1-e"
  5560. },
  5561. // Callbacks
  5562. activate: null,
  5563. beforeActivate: null
  5564. },
  5565. hideProps: {
  5566. borderTopWidth: "hide",
  5567. borderBottomWidth: "hide",
  5568. paddingTop: "hide",
  5569. paddingBottom: "hide",
  5570. height: "hide"
  5571. },
  5572. showProps: {
  5573. borderTopWidth: "show",
  5574. borderBottomWidth: "show",
  5575. paddingTop: "show",
  5576. paddingBottom: "show",
  5577. height: "show"
  5578. },
  5579. _create: function() {
  5580. var options = this.options;
  5581. this.prevShow = this.prevHide = $();
  5582. this._addClass( "ui-accordion", "ui-widget ui-helper-reset" );
  5583. this.element.attr( "role", "tablist" );
  5584. // Don't allow collapsible: false and active: false / null
  5585. if ( !options.collapsible && ( options.active === false || options.active == null ) ) {
  5586. options.active = 0;
  5587. }
  5588. this._processPanels();
  5589. // handle negative values
  5590. if ( options.active < 0 ) {
  5591. options.active += this.headers.length;
  5592. }
  5593. this._refresh();
  5594. },
  5595. _getCreateEventData: function() {
  5596. return {
  5597. header: this.active,
  5598. panel: !this.active.length ? $() : this.active.next()
  5599. };
  5600. },
  5601. _createIcons: function() {
  5602. var icon, children,
  5603. icons = this.options.icons;
  5604. if ( icons ) {
  5605. icon = $( "<span>" );
  5606. this._addClass( icon, "ui-accordion-header-icon", "ui-icon " + icons.header );
  5607. icon.prependTo( this.headers );
  5608. children = this.active.children( ".ui-accordion-header-icon" );
  5609. this._removeClass( children, icons.header )
  5610. ._addClass( children, null, icons.activeHeader )
  5611. ._addClass( this.headers, "ui-accordion-icons" );
  5612. }
  5613. },
  5614. _destroyIcons: function() {
  5615. this._removeClass( this.headers, "ui-accordion-icons" );
  5616. this.headers.children( ".ui-accordion-header-icon" ).remove();
  5617. },
  5618. _destroy: function() {
  5619. var contents;
  5620. // Clean up main element
  5621. this.element.removeAttr( "role" );
  5622. // Clean up headers
  5623. this.headers
  5624. .removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" )
  5625. .removeUniqueId();
  5626. this._destroyIcons();
  5627. // Clean up content panels
  5628. contents = this.headers.next()
  5629. .css( "display", "" )
  5630. .removeAttr( "role aria-hidden aria-labelledby" )
  5631. .removeUniqueId();
  5632. if ( this.options.heightStyle !== "content" ) {
  5633. contents.css( "height", "" );
  5634. }
  5635. },
  5636. _setOption: function( key, value ) {
  5637. if ( key === "active" ) {
  5638. // _activate() will handle invalid values and update this.options
  5639. this._activate( value );
  5640. return;
  5641. }
  5642. if ( key === "event" ) {
  5643. if ( this.options.event ) {
  5644. this._off( this.headers, this.options.event );
  5645. }
  5646. this._setupEvents( value );
  5647. }
  5648. this._super( key, value );
  5649. // Setting collapsible: false while collapsed; open first panel
  5650. if ( key === "collapsible" && !value && this.options.active === false ) {
  5651. this._activate( 0 );
  5652. }
  5653. if ( key === "icons" ) {
  5654. this._destroyIcons();
  5655. if ( value ) {
  5656. this._createIcons();
  5657. }
  5658. }
  5659. },
  5660. _setOptionDisabled: function( value ) {
  5661. this._super( value );
  5662. this.element.attr( "aria-disabled", value );
  5663. // Support: IE8 Only
  5664. // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE
  5665. // so we need to add the disabled class to the headers and panels
  5666. this._toggleClass( null, "ui-state-disabled", !!value );
  5667. this._toggleClass( this.headers.add( this.headers.next() ), null, "ui-state-disabled",
  5668. !!value );
  5669. },
  5670. _keydown: function( event ) {
  5671. if ( event.altKey || event.ctrlKey ) {
  5672. return;
  5673. }
  5674. var keyCode = $.ui.keyCode,
  5675. length = this.headers.length,
  5676. currentIndex = this.headers.index( event.target ),
  5677. toFocus = false;
  5678. switch ( event.keyCode ) {
  5679. case keyCode.RIGHT:
  5680. case keyCode.DOWN:
  5681. toFocus = this.headers[ ( currentIndex + 1 ) % length ];
  5682. break;
  5683. case keyCode.LEFT:
  5684. case keyCode.UP:
  5685. toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
  5686. break;
  5687. case keyCode.SPACE:
  5688. case keyCode.ENTER:
  5689. this._eventHandler( event );
  5690. break;
  5691. case keyCode.HOME:
  5692. toFocus = this.headers[ 0 ];
  5693. break;
  5694. case keyCode.END:
  5695. toFocus = this.headers[ length - 1 ];
  5696. break;
  5697. }
  5698. if ( toFocus ) {
  5699. $( event.target ).attr( "tabIndex", -1 );
  5700. $( toFocus ).attr( "tabIndex", 0 );
  5701. $( toFocus ).trigger( "focus" );
  5702. event.preventDefault();
  5703. }
  5704. },
  5705. _panelKeyDown: function( event ) {
  5706. if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
  5707. $( event.currentTarget ).prev().trigger( "focus" );
  5708. }
  5709. },
  5710. refresh: function() {
  5711. var options = this.options;
  5712. this._processPanels();
  5713. // Was collapsed or no panel
  5714. if ( ( options.active === false && options.collapsible === true ) ||
  5715. !this.headers.length ) {
  5716. options.active = false;
  5717. this.active = $();
  5718. // active false only when collapsible is true
  5719. } else if ( options.active === false ) {
  5720. this._activate( 0 );
  5721. // was active, but active panel is gone
  5722. } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
  5723. // all remaining panel are disabled
  5724. if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) {
  5725. options.active = false;
  5726. this.active = $();
  5727. // activate previous panel
  5728. } else {
  5729. this._activate( Math.max( 0, options.active - 1 ) );
  5730. }
  5731. // was active, active panel still exists
  5732. } else {
  5733. // make sure active index is correct
  5734. options.active = this.headers.index( this.active );
  5735. }
  5736. this._destroyIcons();
  5737. this._refresh();
  5738. },
  5739. _processPanels: function() {
  5740. var prevHeaders = this.headers,
  5741. prevPanels = this.panels;
  5742. this.headers = this.element.find( this.options.header );
  5743. this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed",
  5744. "ui-state-default" );
  5745. this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide();
  5746. this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" );
  5747. // Avoid memory leaks (#10056)
  5748. if ( prevPanels ) {
  5749. this._off( prevHeaders.not( this.headers ) );
  5750. this._off( prevPanels.not( this.panels ) );
  5751. }
  5752. },
  5753. _refresh: function() {
  5754. var maxHeight,
  5755. options = this.options,
  5756. heightStyle = options.heightStyle,
  5757. parent = this.element.parent();
  5758. this.active = this._findActive( options.active );
  5759. this._addClass( this.active, "ui-accordion-header-active", "ui-state-active" )
  5760. ._removeClass( this.active, "ui-accordion-header-collapsed" );
  5761. this._addClass( this.active.next(), "ui-accordion-content-active" );
  5762. this.active.next().show();
  5763. this.headers
  5764. .attr( "role", "tab" )
  5765. .each( function() {
  5766. var header = $( this ),
  5767. headerId = header.uniqueId().attr( "id" ),
  5768. panel = header.next(),
  5769. panelId = panel.uniqueId().attr( "id" );
  5770. header.attr( "aria-controls", panelId );
  5771. panel.attr( "aria-labelledby", headerId );
  5772. } )
  5773. .next()
  5774. .attr( "role", "tabpanel" );
  5775. this.headers
  5776. .not( this.active )
  5777. .attr( {
  5778. "aria-selected": "false",
  5779. "aria-expanded": "false",
  5780. tabIndex: -1
  5781. } )
  5782. .next()
  5783. .attr( {
  5784. "aria-hidden": "true"
  5785. } )
  5786. .hide();
  5787. // Make sure at least one header is in the tab order
  5788. if ( !this.active.length ) {
  5789. this.headers.eq( 0 ).attr( "tabIndex", 0 );
  5790. } else {
  5791. this.active.attr( {
  5792. "aria-selected": "true",
  5793. "aria-expanded": "true",
  5794. tabIndex: 0
  5795. } )
  5796. .next()
  5797. .attr( {
  5798. "aria-hidden": "false"
  5799. } );
  5800. }
  5801. this._createIcons();
  5802. this._setupEvents( options.event );
  5803. if ( heightStyle === "fill" ) {
  5804. maxHeight = parent.height();
  5805. this.element.siblings( ":visible" ).each( function() {
  5806. var elem = $( this ),
  5807. position = elem.css( "position" );
  5808. if ( position === "absolute" || position === "fixed" ) {
  5809. return;
  5810. }
  5811. maxHeight -= elem.outerHeight( true );
  5812. } );
  5813. this.headers.each( function() {
  5814. maxHeight -= $( this ).outerHeight( true );
  5815. } );
  5816. this.headers.next()
  5817. .each( function() {
  5818. $( this ).height( Math.max( 0, maxHeight -
  5819. $( this ).innerHeight() + $( this ).height() ) );
  5820. } )
  5821. .css( "overflow", "auto" );
  5822. } else if ( heightStyle === "auto" ) {
  5823. maxHeight = 0;
  5824. this.headers.next()
  5825. .each( function() {
  5826. var isVisible = $( this ).is( ":visible" );
  5827. if ( !isVisible ) {
  5828. $( this ).show();
  5829. }
  5830. maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
  5831. if ( !isVisible ) {
  5832. $( this ).hide();
  5833. }
  5834. } )
  5835. .height( maxHeight );
  5836. }
  5837. },
  5838. _activate: function( index ) {
  5839. var active = this._findActive( index )[ 0 ];
  5840. // Trying to activate the already active panel
  5841. if ( active === this.active[ 0 ] ) {
  5842. return;
  5843. }
  5844. // Trying to collapse, simulate a click on the currently active header
  5845. active = active || this.active[ 0 ];
  5846. this._eventHandler( {
  5847. target: active,
  5848. currentTarget: active,
  5849. preventDefault: $.noop
  5850. } );
  5851. },
  5852. _findActive: function( selector ) {
  5853. return typeof selector === "number" ? this.headers.eq( selector ) : $();
  5854. },
  5855. _setupEvents: function( event ) {
  5856. var events = {
  5857. keydown: "_keydown"
  5858. };
  5859. if ( event ) {
  5860. $.each( event.split( " " ), function( index, eventName ) {
  5861. events[ eventName ] = "_eventHandler";
  5862. } );
  5863. }
  5864. this._off( this.headers.add( this.headers.next() ) );
  5865. this._on( this.headers, events );
  5866. this._on( this.headers.next(), { keydown: "_panelKeyDown" } );
  5867. this._hoverable( this.headers );
  5868. this._focusable( this.headers );
  5869. },
  5870. _eventHandler: function( event ) {
  5871. var activeChildren, clickedChildren,
  5872. options = this.options,
  5873. active = this.active,
  5874. clicked = $( event.currentTarget ),
  5875. clickedIsActive = clicked[ 0 ] === active[ 0 ],
  5876. collapsing = clickedIsActive && options.collapsible,
  5877. toShow = collapsing ? $() : clicked.next(),
  5878. toHide = active.next(),
  5879. eventData = {
  5880. oldHeader: active,
  5881. oldPanel: toHide,
  5882. newHeader: collapsing ? $() : clicked,
  5883. newPanel: toShow
  5884. };
  5885. event.preventDefault();
  5886. if (
  5887. // click on active header, but not collapsible
  5888. ( clickedIsActive && !options.collapsible ) ||
  5889. // allow canceling activation
  5890. ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
  5891. return;
  5892. }
  5893. options.active = collapsing ? false : this.headers.index( clicked );
  5894. // When the call to ._toggle() comes after the class changes
  5895. // it causes a very odd bug in IE 8 (see #6720)
  5896. this.active = clickedIsActive ? $() : clicked;
  5897. this._toggle( eventData );
  5898. // Switch classes
  5899. // corner classes on the previously active header stay after the animation
  5900. this._removeClass( active, "ui-accordion-header-active", "ui-state-active" );
  5901. if ( options.icons ) {
  5902. activeChildren = active.children( ".ui-accordion-header-icon" );
  5903. this._removeClass( activeChildren, null, options.icons.activeHeader )
  5904. ._addClass( activeChildren, null, options.icons.header );
  5905. }
  5906. if ( !clickedIsActive ) {
  5907. this._removeClass( clicked, "ui-accordion-header-collapsed" )
  5908. ._addClass( clicked, "ui-accordion-header-active", "ui-state-active" );
  5909. if ( options.icons ) {
  5910. clickedChildren = clicked.children( ".ui-accordion-header-icon" );
  5911. this._removeClass( clickedChildren, null, options.icons.header )
  5912. ._addClass( clickedChildren, null, options.icons.activeHeader );
  5913. }
  5914. this._addClass( clicked.next(), "ui-accordion-content-active" );
  5915. }
  5916. },
  5917. _toggle: function( data ) {
  5918. var toShow = data.newPanel,
  5919. toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
  5920. // Handle activating a panel during the animation for another activation
  5921. this.prevShow.add( this.prevHide ).stop( true, true );
  5922. this.prevShow = toShow;
  5923. this.prevHide = toHide;
  5924. if ( this.options.animate ) {
  5925. this._animate( toShow, toHide, data );
  5926. } else {
  5927. toHide.hide();
  5928. toShow.show();
  5929. this._toggleComplete( data );
  5930. }
  5931. toHide.attr( {
  5932. "aria-hidden": "true"
  5933. } );
  5934. toHide.prev().attr( {
  5935. "aria-selected": "false",
  5936. "aria-expanded": "false"
  5937. } );
  5938. // if we're switching panels, remove the old header from the tab order
  5939. // if we're opening from collapsed state, remove the previous header from the tab order
  5940. // if we're collapsing, then keep the collapsing header in the tab order
  5941. if ( toShow.length && toHide.length ) {
  5942. toHide.prev().attr( {
  5943. "tabIndex": -1,
  5944. "aria-expanded": "false"
  5945. } );
  5946. } else if ( toShow.length ) {
  5947. this.headers.filter( function() {
  5948. return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;
  5949. } )
  5950. .attr( "tabIndex", -1 );
  5951. }
  5952. toShow
  5953. .attr( "aria-hidden", "false" )
  5954. .prev()
  5955. .attr( {
  5956. "aria-selected": "true",
  5957. "aria-expanded": "true",
  5958. tabIndex: 0
  5959. } );
  5960. },
  5961. _animate: function( toShow, toHide, data ) {
  5962. var total, easing, duration,
  5963. that = this,
  5964. adjust = 0,
  5965. boxSizing = toShow.css( "box-sizing" ),
  5966. down = toShow.length &&
  5967. ( !toHide.length || ( toShow.index() < toHide.index() ) ),
  5968. animate = this.options.animate || {},
  5969. options = down && animate.down || animate,
  5970. complete = function() {
  5971. that._toggleComplete( data );
  5972. };
  5973. if ( typeof options === "number" ) {
  5974. duration = options;
  5975. }
  5976. if ( typeof options === "string" ) {
  5977. easing = options;
  5978. }
  5979. // fall back from options to animation in case of partial down settings
  5980. easing = easing || options.easing || animate.easing;
  5981. duration = duration || options.duration || animate.duration;
  5982. if ( !toHide.length ) {
  5983. return toShow.animate( this.showProps, duration, easing, complete );
  5984. }
  5985. if ( !toShow.length ) {
  5986. return toHide.animate( this.hideProps, duration, easing, complete );
  5987. }
  5988. total = toShow.show().outerHeight();
  5989. toHide.animate( this.hideProps, {
  5990. duration: duration,
  5991. easing: easing,
  5992. step: function( now, fx ) {
  5993. fx.now = Math.round( now );
  5994. }
  5995. } );
  5996. toShow
  5997. .hide()
  5998. .animate( this.showProps, {
  5999. duration: duration,
  6000. easing: easing,
  6001. complete: complete,
  6002. step: function( now, fx ) {
  6003. fx.now = Math.round( now );
  6004. if ( fx.prop !== "height" ) {
  6005. if ( boxSizing === "content-box" ) {
  6006. adjust += fx.now;
  6007. }
  6008. } else if ( that.options.heightStyle !== "content" ) {
  6009. fx.now = Math.round( total - toHide.outerHeight() - adjust );
  6010. adjust = 0;
  6011. }
  6012. }
  6013. } );
  6014. },
  6015. _toggleComplete: function( data ) {
  6016. var toHide = data.oldPanel,
  6017. prev = toHide.prev();
  6018. this._removeClass( toHide, "ui-accordion-content-active" );
  6019. this._removeClass( prev, "ui-accordion-header-active" )
  6020. ._addClass( prev, "ui-accordion-header-collapsed" );
  6021. // Work around for rendering bug in IE (#5421)
  6022. if ( toHide.length ) {
  6023. toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className;
  6024. }
  6025. this._trigger( "activate", null, data );
  6026. }
  6027. } );
  6028. /*!
  6029. * jQuery UI Menu 1.12.1
  6030. * http://jqueryui.com
  6031. *
  6032. * Copyright jQuery Foundation and other contributors
  6033. * Released under the MIT license.
  6034. * http://jquery.org/license
  6035. */
  6036. //>>label: Menu
  6037. //>>group: Widgets
  6038. //>>description: Creates nestable menus.
  6039. //>>docs: http://api.jqueryui.com/menu/
  6040. //>>demos: http://jqueryui.com/menu/
  6041. //>>css.structure: ../../themes/base/core.css
  6042. //>>css.structure: ../../themes/base/menu.css
  6043. //>>css.theme: ../../themes/base/theme.css
  6044. var widgetsMenu = $.widget( "ui.menu", {
  6045. version: "1.12.1",
  6046. defaultElement: "<ul>",
  6047. delay: 300,
  6048. options: {
  6049. icons: {
  6050. submenu: "ui-icon-caret-1-e"
  6051. },
  6052. items: "> *",
  6053. menus: "ul",
  6054. position: {
  6055. my: "left top",
  6056. at: "right top"
  6057. },
  6058. role: "menu",
  6059. // Callbacks
  6060. blur: null,
  6061. focus: null,
  6062. select: null
  6063. },
  6064. _create: function() {
  6065. this.activeMenu = this.element;
  6066. // Flag used to prevent firing of the click handler
  6067. // as the event bubbles up through nested menus
  6068. this.mouseHandled = false;
  6069. this.element
  6070. .uniqueId()
  6071. .attr( {
  6072. role: this.options.role,
  6073. tabIndex: 0
  6074. } );
  6075. this._addClass( "ui-menu", "ui-widget ui-widget-content" );
  6076. this._on( {
  6077. // Prevent focus from sticking to links inside menu after clicking
  6078. // them (focus should always stay on UL during navigation).
  6079. "mousedown .ui-menu-item": function( event ) {
  6080. event.preventDefault();
  6081. },
  6082. "click .ui-menu-item": function( event ) {
  6083. var target = $( event.target );
  6084. var active = $( $.ui.safeActiveElement( this.document[ 0 ] ) );
  6085. if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
  6086. this.select( event );
  6087. // Only set the mouseHandled flag if the event will bubble, see #9469.
  6088. if ( !event.isPropagationStopped() ) {
  6089. this.mouseHandled = true;
  6090. }
  6091. // Open submenu on click
  6092. if ( target.has( ".ui-menu" ).length ) {
  6093. this.expand( event );
  6094. } else if ( !this.element.is( ":focus" ) &&
  6095. active.closest( ".ui-menu" ).length ) {
  6096. // Redirect focus to the menu
  6097. this.element.trigger( "focus", [ true ] );
  6098. // If the active item is on the top level, let it stay active.
  6099. // Otherwise, blur the active item since it is no longer visible.
  6100. if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
  6101. clearTimeout( this.timer );
  6102. }
  6103. }
  6104. }
  6105. },
  6106. "mouseenter .ui-menu-item": function( event ) {
  6107. // Ignore mouse events while typeahead is active, see #10458.
  6108. // Prevents focusing the wrong item when typeahead causes a scroll while the mouse
  6109. // is over an item in the menu
  6110. if ( this.previousFilter ) {
  6111. return;
  6112. }
  6113. var actualTarget = $( event.target ).closest( ".ui-menu-item" ),
  6114. target = $( event.currentTarget );
  6115. // Ignore bubbled events on parent items, see #11641
  6116. if ( actualTarget[ 0 ] !== target[ 0 ] ) {
  6117. return;
  6118. }
  6119. // Remove ui-state-active class from siblings of the newly focused menu item
  6120. // to avoid a jump caused by adjacent elements both having a class with a border
  6121. this._removeClass( target.siblings().children( ".ui-state-active" ),
  6122. null, "ui-state-active" );
  6123. this.focus( event, target );
  6124. },
  6125. mouseleave: "collapseAll",
  6126. "mouseleave .ui-menu": "collapseAll",
  6127. focus: function( event, keepActiveItem ) {
  6128. // If there's already an active item, keep it active
  6129. // If not, activate the first item
  6130. var item = this.active || this.element.find( this.options.items ).eq( 0 );
  6131. if ( !keepActiveItem ) {
  6132. this.focus( event, item );
  6133. }
  6134. },
  6135. blur: function( event ) {
  6136. this._delay( function() {
  6137. var notContained = !$.contains(
  6138. this.element[ 0 ],
  6139. $.ui.safeActiveElement( this.document[ 0 ] )
  6140. );
  6141. if ( notContained ) {
  6142. this.collapseAll( event );
  6143. }
  6144. } );
  6145. },
  6146. keydown: "_keydown"
  6147. } );
  6148. this.refresh();
  6149. // Clicks outside of a menu collapse any open menus
  6150. this._on( this.document, {
  6151. click: function( event ) {
  6152. if ( this._closeOnDocumentClick( event ) ) {
  6153. this.collapseAll( event );
  6154. }
  6155. // Reset the mouseHandled flag
  6156. this.mouseHandled = false;
  6157. }
  6158. } );
  6159. },
  6160. _destroy: function() {
  6161. var items = this.element.find( ".ui-menu-item" )
  6162. .removeAttr( "role aria-disabled" ),
  6163. submenus = items.children( ".ui-menu-item-wrapper" )
  6164. .removeUniqueId()
  6165. .removeAttr( "tabIndex role aria-haspopup" );
  6166. // Destroy (sub)menus
  6167. this.element
  6168. .removeAttr( "aria-activedescendant" )
  6169. .find( ".ui-menu" ).addBack()
  6170. .removeAttr( "role aria-labelledby aria-expanded aria-hidden aria-disabled " +
  6171. "tabIndex" )
  6172. .removeUniqueId()
  6173. .show();
  6174. submenus.children().each( function() {
  6175. var elem = $( this );
  6176. if ( elem.data( "ui-menu-submenu-caret" ) ) {
  6177. elem.remove();
  6178. }
  6179. } );
  6180. },
  6181. _keydown: function( event ) {
  6182. var match, prev, character, skip,
  6183. preventDefault = true;
  6184. switch ( event.keyCode ) {
  6185. case $.ui.keyCode.PAGE_UP:
  6186. this.previousPage( event );
  6187. break;
  6188. case $.ui.keyCode.PAGE_DOWN:
  6189. this.nextPage( event );
  6190. break;
  6191. case $.ui.keyCode.HOME:
  6192. this._move( "first", "first", event );
  6193. break;
  6194. case $.ui.keyCode.END:
  6195. this._move( "last", "last", event );
  6196. break;
  6197. case $.ui.keyCode.UP:
  6198. this.previous( event );
  6199. break;
  6200. case $.ui.keyCode.DOWN:
  6201. this.next( event );
  6202. break;
  6203. case $.ui.keyCode.LEFT:
  6204. this.collapse( event );
  6205. break;
  6206. case $.ui.keyCode.RIGHT:
  6207. if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
  6208. this.expand( event );
  6209. }
  6210. break;
  6211. case $.ui.keyCode.ENTER:
  6212. case $.ui.keyCode.SPACE:
  6213. this._activate( event );
  6214. break;
  6215. case $.ui.keyCode.ESCAPE:
  6216. this.collapse( event );
  6217. break;
  6218. default:
  6219. preventDefault = false;
  6220. prev = this.previousFilter || "";
  6221. skip = false;
  6222. // Support number pad values
  6223. character = event.keyCode >= 96 && event.keyCode <= 105 ?
  6224. ( event.keyCode - 96 ).toString() : String.fromCharCode( event.keyCode );
  6225. clearTimeout( this.filterTimer );
  6226. if ( character === prev ) {
  6227. skip = true;
  6228. } else {
  6229. character = prev + character;
  6230. }
  6231. match = this._filterMenuItems( character );
  6232. match = skip && match.index( this.active.next() ) !== -1 ?
  6233. this.active.nextAll( ".ui-menu-item" ) :
  6234. match;
  6235. // If no matches on the current filter, reset to the last character pressed
  6236. // to move down the menu to the first item that starts with that character
  6237. if ( !match.length ) {
  6238. character = String.fromCharCode( event.keyCode );
  6239. match = this._filterMenuItems( character );
  6240. }
  6241. if ( match.length ) {
  6242. this.focus( event, match );
  6243. this.previousFilter = character;
  6244. this.filterTimer = this._delay( function() {
  6245. delete this.previousFilter;
  6246. }, 1000 );
  6247. } else {
  6248. delete this.previousFilter;
  6249. }
  6250. }
  6251. if ( preventDefault ) {
  6252. event.preventDefault();
  6253. }
  6254. },
  6255. _activate: function( event ) {
  6256. if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
  6257. if ( this.active.children( "[aria-haspopup='true']" ).length ) {
  6258. this.expand( event );
  6259. } else {
  6260. this.select( event );
  6261. }
  6262. }
  6263. },
  6264. refresh: function() {
  6265. var menus, items, newSubmenus, newItems, newWrappers,
  6266. that = this,
  6267. icon = this.options.icons.submenu,
  6268. submenus = this.element.find( this.options.menus );
  6269. this._toggleClass( "ui-menu-icons", null, !!this.element.find( ".ui-icon" ).length );
  6270. // Initialize nested menus
  6271. newSubmenus = submenus.filter( ":not(.ui-menu)" )
  6272. .hide()
  6273. .attr( {
  6274. role: this.options.role,
  6275. "aria-hidden": "true",
  6276. "aria-expanded": "false"
  6277. } )
  6278. .each( function() {
  6279. var menu = $( this ),
  6280. item = menu.prev(),
  6281. submenuCaret = $( "<span>" ).data( "ui-menu-submenu-caret", true );
  6282. that._addClass( submenuCaret, "ui-menu-icon", "ui-icon " + icon );
  6283. item
  6284. .attr( "aria-haspopup", "true" )
  6285. .prepend( submenuCaret );
  6286. menu.attr( "aria-labelledby", item.attr( "id" ) );
  6287. } );
  6288. this._addClass( newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front" );
  6289. menus = submenus.add( this.element );
  6290. items = menus.find( this.options.items );
  6291. // Initialize menu-items containing spaces and/or dashes only as dividers
  6292. items.not( ".ui-menu-item" ).each( function() {
  6293. var item = $( this );
  6294. if ( that._isDivider( item ) ) {
  6295. that._addClass( item, "ui-menu-divider", "ui-widget-content" );
  6296. }
  6297. } );
  6298. // Don't refresh list items that are already adapted
  6299. newItems = items.not( ".ui-menu-item, .ui-menu-divider" );
  6300. newWrappers = newItems.children()
  6301. .not( ".ui-menu" )
  6302. .uniqueId()
  6303. .attr( {
  6304. tabIndex: -1,
  6305. role: this._itemRole()
  6306. } );
  6307. this._addClass( newItems, "ui-menu-item" )
  6308. ._addClass( newWrappers, "ui-menu-item-wrapper" );
  6309. // Add aria-disabled attribute to any disabled menu item
  6310. items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
  6311. // If the active item has been removed, blur the menu
  6312. if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
  6313. this.blur();
  6314. }
  6315. },
  6316. _itemRole: function() {
  6317. return {
  6318. menu: "menuitem",
  6319. listbox: "option"
  6320. }[ this.options.role ];
  6321. },
  6322. _setOption: function( key, value ) {
  6323. if ( key === "icons" ) {
  6324. var icons = this.element.find( ".ui-menu-icon" );
  6325. this._removeClass( icons, null, this.options.icons.submenu )
  6326. ._addClass( icons, null, value.submenu );
  6327. }
  6328. this._super( key, value );
  6329. },
  6330. _setOptionDisabled: function( value ) {
  6331. this._super( value );
  6332. this.element.attr( "aria-disabled", String( value ) );
  6333. this._toggleClass( null, "ui-state-disabled", !!value );
  6334. },
  6335. focus: function( event, item ) {
  6336. var nested, focused, activeParent;
  6337. this.blur( event, event && event.type === "focus" );
  6338. this._scrollIntoView( item );
  6339. this.active = item.first();
  6340. focused = this.active.children( ".ui-menu-item-wrapper" );
  6341. this._addClass( focused, null, "ui-state-active" );
  6342. // Only update aria-activedescendant if there's a role
  6343. // otherwise we assume focus is managed elsewhere
  6344. if ( this.options.role ) {
  6345. this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
  6346. }
  6347. // Highlight active parent menu item, if any
  6348. activeParent = this.active
  6349. .parent()
  6350. .closest( ".ui-menu-item" )
  6351. .children( ".ui-menu-item-wrapper" );
  6352. this._addClass( activeParent, null, "ui-state-active" );
  6353. if ( event && event.type === "keydown" ) {
  6354. this._close();
  6355. } else {
  6356. this.timer = this._delay( function() {
  6357. this._close();
  6358. }, this.delay );
  6359. }
  6360. nested = item.children( ".ui-menu" );
  6361. if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {
  6362. this._startOpening( nested );
  6363. }
  6364. this.activeMenu = item.parent();
  6365. this._trigger( "focus", event, { item: item } );
  6366. },
  6367. _scrollIntoView: function( item ) {
  6368. var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
  6369. if ( this._hasScroll() ) {
  6370. borderTop = parseFloat( $.css( this.activeMenu[ 0 ], "borderTopWidth" ) ) || 0;
  6371. paddingTop = parseFloat( $.css( this.activeMenu[ 0 ], "paddingTop" ) ) || 0;
  6372. offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
  6373. scroll = this.activeMenu.scrollTop();
  6374. elementHeight = this.activeMenu.height();
  6375. itemHeight = item.outerHeight();
  6376. if ( offset < 0 ) {
  6377. this.activeMenu.scrollTop( scroll + offset );
  6378. } else if ( offset + itemHeight > elementHeight ) {
  6379. this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
  6380. }
  6381. }
  6382. },
  6383. blur: function( event, fromFocus ) {
  6384. if ( !fromFocus ) {
  6385. clearTimeout( this.timer );
  6386. }
  6387. if ( !this.active ) {
  6388. return;
  6389. }
  6390. this._removeClass( this.active.children( ".ui-menu-item-wrapper" ),
  6391. null, "ui-state-active" );
  6392. this._trigger( "blur", event, { item: this.active } );
  6393. this.active = null;
  6394. },
  6395. _startOpening: function( submenu ) {
  6396. clearTimeout( this.timer );
  6397. // Don't open if already open fixes a Firefox bug that caused a .5 pixel
  6398. // shift in the submenu position when mousing over the caret icon
  6399. if ( submenu.attr( "aria-hidden" ) !== "true" ) {
  6400. return;
  6401. }
  6402. this.timer = this._delay( function() {
  6403. this._close();
  6404. this._open( submenu );
  6405. }, this.delay );
  6406. },
  6407. _open: function( submenu ) {
  6408. var position = $.extend( {
  6409. of: this.active
  6410. }, this.options.position );
  6411. clearTimeout( this.timer );
  6412. this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
  6413. .hide()
  6414. .attr( "aria-hidden", "true" );
  6415. submenu
  6416. .show()
  6417. .removeAttr( "aria-hidden" )
  6418. .attr( "aria-expanded", "true" )
  6419. .position( position );
  6420. },
  6421. collapseAll: function( event, all ) {
  6422. clearTimeout( this.timer );
  6423. this.timer = this._delay( function() {
  6424. // If we were passed an event, look for the submenu that contains the event
  6425. var currentMenu = all ? this.element :
  6426. $( event && event.target ).closest( this.element.find( ".ui-menu" ) );
  6427. // If we found no valid submenu ancestor, use the main menu to close all
  6428. // sub menus anyway
  6429. if ( !currentMenu.length ) {
  6430. currentMenu = this.element;
  6431. }
  6432. this._close( currentMenu );
  6433. this.blur( event );
  6434. // Work around active item staying active after menu is blurred
  6435. this._removeClass( currentMenu.find( ".ui-state-active" ), null, "ui-state-active" );
  6436. this.activeMenu = currentMenu;
  6437. }, this.delay );
  6438. },
  6439. // With no arguments, closes the currently active menu - if nothing is active
  6440. // it closes all menus. If passed an argument, it will search for menus BELOW
  6441. _close: function( startMenu ) {
  6442. if ( !startMenu ) {
  6443. startMenu = this.active ? this.active.parent() : this.element;
  6444. }
  6445. startMenu.find( ".ui-menu" )
  6446. .hide()
  6447. .attr( "aria-hidden", "true" )
  6448. .attr( "aria-expanded", "false" );
  6449. },
  6450. _closeOnDocumentClick: function( event ) {
  6451. return !$( event.target ).closest( ".ui-menu" ).length;
  6452. },
  6453. _isDivider: function( item ) {
  6454. // Match hyphen, em dash, en dash
  6455. return !/[^\-\u2014\u2013\s]/.test( item.text() );
  6456. },
  6457. collapse: function( event ) {
  6458. var newItem = this.active &&
  6459. this.active.parent().closest( ".ui-menu-item", this.element );
  6460. if ( newItem && newItem.length ) {
  6461. this._close();
  6462. this.focus( event, newItem );
  6463. }
  6464. },
  6465. expand: function( event ) {
  6466. var newItem = this.active &&
  6467. this.active
  6468. .children( ".ui-menu " )
  6469. .find( this.options.items )
  6470. .first();
  6471. if ( newItem && newItem.length ) {
  6472. this._open( newItem.parent() );
  6473. // Delay so Firefox will not hide activedescendant change in expanding submenu from AT
  6474. this._delay( function() {
  6475. this.focus( event, newItem );
  6476. } );
  6477. }
  6478. },
  6479. next: function( event ) {
  6480. this._move( "next", "first", event );
  6481. },
  6482. previous: function( event ) {
  6483. this._move( "prev", "last", event );
  6484. },
  6485. isFirstItem: function() {
  6486. return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
  6487. },
  6488. isLastItem: function() {
  6489. return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
  6490. },
  6491. _move: function( direction, filter, event ) {
  6492. var next;
  6493. if ( this.active ) {
  6494. if ( direction === "first" || direction === "last" ) {
  6495. next = this.active
  6496. [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
  6497. .eq( -1 );
  6498. } else {
  6499. next = this.active
  6500. [ direction + "All" ]( ".ui-menu-item" )
  6501. .eq( 0 );
  6502. }
  6503. }
  6504. if ( !next || !next.length || !this.active ) {
  6505. next = this.activeMenu.find( this.options.items )[ filter ]();
  6506. }
  6507. this.focus( event, next );
  6508. },
  6509. nextPage: function( event ) {
  6510. var item, base, height;
  6511. if ( !this.active ) {
  6512. this.next( event );
  6513. return;
  6514. }
  6515. if ( this.isLastItem() ) {
  6516. return;
  6517. }
  6518. if ( this._hasScroll() ) {
  6519. base = this.active.offset().top;
  6520. height = this.element.height();
  6521. this.active.nextAll( ".ui-menu-item" ).each( function() {
  6522. item = $( this );
  6523. return item.offset().top - base - height < 0;
  6524. } );
  6525. this.focus( event, item );
  6526. } else {
  6527. this.focus( event, this.activeMenu.find( this.options.items )
  6528. [ !this.active ? "first" : "last" ]() );
  6529. }
  6530. },
  6531. previousPage: function( event ) {
  6532. var item, base, height;
  6533. if ( !this.active ) {
  6534. this.next( event );
  6535. return;
  6536. }
  6537. if ( this.isFirstItem() ) {
  6538. return;
  6539. }
  6540. if ( this._hasScroll() ) {
  6541. base = this.active.offset().top;
  6542. height = this.element.height();
  6543. this.active.prevAll( ".ui-menu-item" ).each( function() {
  6544. item = $( this );
  6545. return item.offset().top - base + height > 0;
  6546. } );
  6547. this.focus( event, item );
  6548. } else {
  6549. this.focus( event, this.activeMenu.find( this.options.items ).first() );
  6550. }
  6551. },
  6552. _hasScroll: function() {
  6553. return this.element.outerHeight() < this.element.prop( "scrollHeight" );
  6554. },
  6555. select: function( event ) {
  6556. // TODO: It should never be possible to not have an active item at this
  6557. // point, but the tests don't trigger mouseenter before click.
  6558. this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
  6559. var ui = { item: this.active };
  6560. if ( !this.active.has( ".ui-menu" ).length ) {
  6561. this.collapseAll( event, true );
  6562. }
  6563. this._trigger( "select", event, ui );
  6564. },
  6565. _filterMenuItems: function( character ) {
  6566. var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ),
  6567. regex = new RegExp( "^" + escapedCharacter, "i" );
  6568. return this.activeMenu
  6569. .find( this.options.items )
  6570. // Only match on items, not dividers or other content (#10571)
  6571. .filter( ".ui-menu-item" )
  6572. .filter( function() {
  6573. return regex.test(
  6574. $.trim( $( this ).children( ".ui-menu-item-wrapper" ).text() ) );
  6575. } );
  6576. }
  6577. } );
  6578. /*!
  6579. * jQuery UI Autocomplete 1.12.1
  6580. * http://jqueryui.com
  6581. *
  6582. * Copyright jQuery Foundation and other contributors
  6583. * Released under the MIT license.
  6584. * http://jquery.org/license
  6585. */
  6586. //>>label: Autocomplete
  6587. //>>group: Widgets
  6588. //>>description: Lists suggested words as the user is typing.
  6589. //>>docs: http://api.jqueryui.com/autocomplete/
  6590. //>>demos: http://jqueryui.com/autocomplete/
  6591. //>>css.structure: ../../themes/base/core.css
  6592. //>>css.structure: ../../themes/base/autocomplete.css
  6593. //>>css.theme: ../../themes/base/theme.css
  6594. $.widget( "ui.autocomplete", {
  6595. version: "1.12.1",
  6596. defaultElement: "<input>",
  6597. options: {
  6598. appendTo: null,
  6599. autoFocus: false,
  6600. delay: 300,
  6601. minLength: 1,
  6602. position: {
  6603. my: "left top",
  6604. at: "left bottom",
  6605. collision: "none"
  6606. },
  6607. source: null,
  6608. // Callbacks
  6609. change: null,
  6610. close: null,
  6611. focus: null,
  6612. open: null,
  6613. response: null,
  6614. search: null,
  6615. select: null
  6616. },
  6617. requestIndex: 0,
  6618. pending: 0,
  6619. _create: function() {
  6620. // Some browsers only repeat keydown events, not keypress events,
  6621. // so we use the suppressKeyPress flag to determine if we've already
  6622. // handled the keydown event. #7269
  6623. // Unfortunately the code for & in keypress is the same as the up arrow,
  6624. // so we use the suppressKeyPressRepeat flag to avoid handling keypress
  6625. // events when we know the keydown event was used to modify the
  6626. // search term. #7799
  6627. var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
  6628. nodeName = this.element[ 0 ].nodeName.toLowerCase(),
  6629. isTextarea = nodeName === "textarea",
  6630. isInput = nodeName === "input";
  6631. // Textareas are always multi-line
  6632. // Inputs are always single-line, even if inside a contentEditable element
  6633. // IE also treats inputs as contentEditable
  6634. // All other element types are determined by whether or not they're contentEditable
  6635. this.isMultiLine = isTextarea || !isInput && this._isContentEditable( this.element );
  6636. this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];
  6637. this.isNewMenu = true;
  6638. this._addClass( "ui-autocomplete-input" );
  6639. this.element.attr( "autocomplete", "off" );
  6640. this._on( this.element, {
  6641. keydown: function( event ) {
  6642. if ( this.element.prop( "readOnly" ) ) {
  6643. suppressKeyPress = true;
  6644. suppressInput = true;
  6645. suppressKeyPressRepeat = true;
  6646. return;
  6647. }
  6648. suppressKeyPress = false;
  6649. suppressInput = false;
  6650. suppressKeyPressRepeat = false;
  6651. var keyCode = $.ui.keyCode;
  6652. switch ( event.keyCode ) {
  6653. case keyCode.PAGE_UP:
  6654. suppressKeyPress = true;
  6655. this._move( "previousPage", event );
  6656. break;
  6657. case keyCode.PAGE_DOWN:
  6658. suppressKeyPress = true;
  6659. this._move( "nextPage", event );
  6660. break;
  6661. case keyCode.UP:
  6662. suppressKeyPress = true;
  6663. this._keyEvent( "previous", event );
  6664. break;
  6665. case keyCode.DOWN:
  6666. suppressKeyPress = true;
  6667. this._keyEvent( "next", event );
  6668. break;
  6669. case keyCode.ENTER:
  6670. // when menu is open and has focus
  6671. if ( this.menu.active ) {
  6672. // #6055 - Opera still allows the keypress to occur
  6673. // which causes forms to submit
  6674. suppressKeyPress = true;
  6675. event.preventDefault();
  6676. this.menu.select( event );
  6677. }
  6678. break;
  6679. case keyCode.TAB:
  6680. if ( this.menu.active ) {
  6681. this.menu.select( event );
  6682. }
  6683. break;
  6684. case keyCode.ESCAPE:
  6685. if ( this.menu.element.is( ":visible" ) ) {
  6686. if ( !this.isMultiLine ) {
  6687. this._value( this.term );
  6688. }
  6689. this.close( event );
  6690. // Different browsers have different default behavior for escape
  6691. // Single press can mean undo or clear
  6692. // Double press in IE means clear the whole form
  6693. event.preventDefault();
  6694. }
  6695. break;
  6696. default:
  6697. suppressKeyPressRepeat = true;
  6698. // search timeout should be triggered before the input value is changed
  6699. this._searchTimeout( event );
  6700. break;
  6701. }
  6702. },
  6703. keypress: function( event ) {
  6704. if ( suppressKeyPress ) {
  6705. suppressKeyPress = false;
  6706. if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
  6707. event.preventDefault();
  6708. }
  6709. return;
  6710. }
  6711. if ( suppressKeyPressRepeat ) {
  6712. return;
  6713. }
  6714. // Replicate some key handlers to allow them to repeat in Firefox and Opera
  6715. var keyCode = $.ui.keyCode;
  6716. switch ( event.keyCode ) {
  6717. case keyCode.PAGE_UP:
  6718. this._move( "previousPage", event );
  6719. break;
  6720. case keyCode.PAGE_DOWN:
  6721. this._move( "nextPage", event );
  6722. break;
  6723. case keyCode.UP:
  6724. this._keyEvent( "previous", event );
  6725. break;
  6726. case keyCode.DOWN:
  6727. this._keyEvent( "next", event );
  6728. break;
  6729. }
  6730. },
  6731. input: function( event ) {
  6732. if ( suppressInput ) {
  6733. suppressInput = false;
  6734. event.preventDefault();
  6735. return;
  6736. }
  6737. this._searchTimeout( event );
  6738. },
  6739. focus: function() {
  6740. this.selectedItem = null;
  6741. this.previous = this._value();
  6742. },
  6743. blur: function( event ) {
  6744. if ( this.cancelBlur ) {
  6745. delete this.cancelBlur;
  6746. return;
  6747. }
  6748. clearTimeout( this.searching );
  6749. this.close( event );
  6750. this._change( event );
  6751. }
  6752. } );
  6753. this._initSource();
  6754. this.menu = $( "<ul>" )
  6755. .appendTo( this._appendTo() )
  6756. .menu( {
  6757. // disable ARIA support, the live region takes care of that
  6758. role: null
  6759. } )
  6760. .hide()
  6761. .menu( "instance" );
  6762. this._addClass( this.menu.element, "ui-autocomplete", "ui-front" );
  6763. this._on( this.menu.element, {
  6764. mousedown: function( event ) {
  6765. // prevent moving focus out of the text field
  6766. event.preventDefault();
  6767. // IE doesn't prevent moving focus even with event.preventDefault()
  6768. // so we set a flag to know when we should ignore the blur event
  6769. this.cancelBlur = true;
  6770. this._delay( function() {
  6771. delete this.cancelBlur;
  6772. // Support: IE 8 only
  6773. // Right clicking a menu item or selecting text from the menu items will
  6774. // result in focus moving out of the input. However, we've already received
  6775. // and ignored the blur event because of the cancelBlur flag set above. So
  6776. // we restore focus to ensure that the menu closes properly based on the user's
  6777. // next actions.
  6778. if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) {
  6779. this.element.trigger( "focus" );
  6780. }
  6781. } );
  6782. },
  6783. menufocus: function( event, ui ) {
  6784. var label, item;
  6785. // support: Firefox
  6786. // Prevent accidental activation of menu items in Firefox (#7024 #9118)
  6787. if ( this.isNewMenu ) {
  6788. this.isNewMenu = false;
  6789. if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
  6790. this.menu.blur();
  6791. this.document.one( "mousemove", function() {
  6792. $( event.target ).trigger( event.originalEvent );
  6793. } );
  6794. return;
  6795. }
  6796. }
  6797. item = ui.item.data( "ui-autocomplete-item" );
  6798. if ( false !== this._trigger( "focus", event, { item: item } ) ) {
  6799. // use value to match what will end up in the input, if it was a key event
  6800. if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
  6801. this._value( item.value );
  6802. }
  6803. }
  6804. // Announce the value in the liveRegion
  6805. label = ui.item.attr( "aria-label" ) || item.value;
  6806. if ( label && $.trim( label ).length ) {
  6807. this.liveRegion.children().hide();
  6808. $( "<div>" ).text( label ).appendTo( this.liveRegion );
  6809. }
  6810. },
  6811. menuselect: function( event, ui ) {
  6812. var item = ui.item.data( "ui-autocomplete-item" ),
  6813. previous = this.previous;
  6814. // Only trigger when focus was lost (click on menu)
  6815. if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) {
  6816. this.element.trigger( "focus" );
  6817. this.previous = previous;
  6818. // #6109 - IE triggers two focus events and the second
  6819. // is asynchronous, so we need to reset the previous
  6820. // term synchronously and asynchronously :-(
  6821. this._delay( function() {
  6822. this.previous = previous;
  6823. this.selectedItem = item;
  6824. } );
  6825. }
  6826. if ( false !== this._trigger( "select", event, { item: item } ) ) {
  6827. this._value( item.value );
  6828. }
  6829. // reset the term after the select event
  6830. // this allows custom select handling to work properly
  6831. this.term = this._value();
  6832. this.close( event );
  6833. this.selectedItem = item;
  6834. }
  6835. } );
  6836. this.liveRegion = $( "<div>", {
  6837. role: "status",
  6838. "aria-live": "assertive",
  6839. "aria-relevant": "additions"
  6840. } )
  6841. .appendTo( this.document[ 0 ].body );
  6842. this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" );
  6843. // Turning off autocomplete prevents the browser from remembering the
  6844. // value when navigating through history, so we re-enable autocomplete
  6845. // if the page is unloaded before the widget is destroyed. #7790
  6846. this._on( this.window, {
  6847. beforeunload: function() {
  6848. this.element.removeAttr( "autocomplete" );
  6849. }
  6850. } );
  6851. },
  6852. _destroy: function() {
  6853. clearTimeout( this.searching );
  6854. this.element.removeAttr( "autocomplete" );
  6855. this.menu.element.remove();
  6856. this.liveRegion.remove();
  6857. },
  6858. _setOption: function( key, value ) {
  6859. this._super( key, value );
  6860. if ( key === "source" ) {
  6861. this._initSource();
  6862. }
  6863. if ( key === "appendTo" ) {
  6864. this.menu.element.appendTo( this._appendTo() );
  6865. }
  6866. if ( key === "disabled" && value && this.xhr ) {
  6867. this.xhr.abort();
  6868. }
  6869. },
  6870. _isEventTargetInWidget: function( event ) {
  6871. var menuElement = this.menu.element[ 0 ];
  6872. return event.target === this.element[ 0 ] ||
  6873. event.target === menuElement ||
  6874. $.contains( menuElement, event.target );
  6875. },
  6876. _closeOnClickOutside: function( event ) {
  6877. if ( !this._isEventTargetInWidget( event ) ) {
  6878. this.close();
  6879. }
  6880. },
  6881. _appendTo: function() {
  6882. var element = this.options.appendTo;
  6883. if ( element ) {
  6884. element = element.jquery || element.nodeType ?
  6885. $( element ) :
  6886. this.document.find( element ).eq( 0 );
  6887. }
  6888. if ( !element || !element[ 0 ] ) {
  6889. element = this.element.closest( ".ui-front, dialog" );
  6890. }
  6891. if ( !element.length ) {
  6892. element = this.document[ 0 ].body;
  6893. }
  6894. return element;
  6895. },
  6896. _initSource: function() {
  6897. var array, url,
  6898. that = this;
  6899. if ( $.isArray( this.options.source ) ) {
  6900. array = this.options.source;
  6901. this.source = function( request, response ) {
  6902. response( $.ui.autocomplete.filter( array, request.term ) );
  6903. };
  6904. } else if ( typeof this.options.source === "string" ) {
  6905. url = this.options.source;
  6906. this.source = function( request, response ) {
  6907. if ( that.xhr ) {
  6908. that.xhr.abort();
  6909. }
  6910. that.xhr = $.ajax( {
  6911. url: url,
  6912. data: request,
  6913. dataType: "json",
  6914. success: function( data ) {
  6915. response( data );
  6916. },
  6917. error: function() {
  6918. response( [] );
  6919. }
  6920. } );
  6921. };
  6922. } else {
  6923. this.source = this.options.source;
  6924. }
  6925. },
  6926. _searchTimeout: function( event ) {
  6927. clearTimeout( this.searching );
  6928. this.searching = this._delay( function() {
  6929. // Search if the value has changed, or if the user retypes the same value (see #7434)
  6930. var equalValues = this.term === this._value(),
  6931. menuVisible = this.menu.element.is( ":visible" ),
  6932. modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
  6933. if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) {
  6934. this.selectedItem = null;
  6935. this.search( null, event );
  6936. }
  6937. }, this.options.delay );
  6938. },
  6939. search: function( value, event ) {
  6940. value = value != null ? value : this._value();
  6941. // Always save the actual value, not the one passed as an argument
  6942. this.term = this._value();
  6943. if ( value.length < this.options.minLength ) {
  6944. return this.close( event );
  6945. }
  6946. if ( this._trigger( "search", event ) === false ) {
  6947. return;
  6948. }
  6949. return this._search( value );
  6950. },
  6951. _search: function( value ) {
  6952. this.pending++;
  6953. this._addClass( "ui-autocomplete-loading" );
  6954. this.cancelSearch = false;
  6955. this.source( { term: value }, this._response() );
  6956. },
  6957. _response: function() {
  6958. var index = ++this.requestIndex;
  6959. return $.proxy( function( content ) {
  6960. if ( index === this.requestIndex ) {
  6961. this.__response( content );
  6962. }
  6963. this.pending--;
  6964. if ( !this.pending ) {
  6965. this._removeClass( "ui-autocomplete-loading" );
  6966. }
  6967. }, this );
  6968. },
  6969. __response: function( content ) {
  6970. if ( content ) {
  6971. content = this._normalize( content );
  6972. }
  6973. this._trigger( "response", null, { content: content } );
  6974. if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
  6975. this._suggest( content );
  6976. this._trigger( "open" );
  6977. } else {
  6978. // use ._close() instead of .close() so we don't cancel future searches
  6979. this._close();
  6980. }
  6981. },
  6982. close: function( event ) {
  6983. this.cancelSearch = true;
  6984. this._close( event );
  6985. },
  6986. _close: function( event ) {
  6987. // Remove the handler that closes the menu on outside clicks
  6988. this._off( this.document, "mousedown" );
  6989. if ( this.menu.element.is( ":visible" ) ) {
  6990. this.menu.element.hide();
  6991. this.menu.blur();
  6992. this.isNewMenu = true;
  6993. this._trigger( "close", event );
  6994. }
  6995. },
  6996. _change: function( event ) {
  6997. if ( this.previous !== this._value() ) {
  6998. this._trigger( "change", event, { item: this.selectedItem } );
  6999. }
  7000. },
  7001. _normalize: function( items ) {
  7002. // assume all items have the right format when the first item is complete
  7003. if ( items.length && items[ 0 ].label && items[ 0 ].value ) {
  7004. return items;
  7005. }
  7006. return $.map( items, function( item ) {
  7007. if ( typeof item === "string" ) {
  7008. return {
  7009. label: item,
  7010. value: item
  7011. };
  7012. }
  7013. return $.extend( {}, item, {
  7014. label: item.label || item.value,
  7015. value: item.value || item.label
  7016. } );
  7017. } );
  7018. },
  7019. _suggest: function( items ) {
  7020. var ul = this.menu.element.empty();
  7021. this._renderMenu( ul, items );
  7022. this.isNewMenu = true;
  7023. this.menu.refresh();
  7024. // Size and position menu
  7025. ul.show();
  7026. this._resizeMenu();
  7027. ul.position( $.extend( {
  7028. of: this.element
  7029. }, this.options.position ) );
  7030. if ( this.options.autoFocus ) {
  7031. this.menu.next();
  7032. }
  7033. // Listen for interactions outside of the widget (#6642)
  7034. this._on( this.document, {
  7035. mousedown: "_closeOnClickOutside"
  7036. } );
  7037. },
  7038. _resizeMenu: function() {
  7039. var ul = this.menu.element;
  7040. ul.outerWidth( Math.max(
  7041. // Firefox wraps long text (possibly a rounding bug)
  7042. // so we add 1px to avoid the wrapping (#7513)
  7043. ul.width( "" ).outerWidth() + 1,
  7044. this.element.outerWidth()
  7045. ) );
  7046. },
  7047. _renderMenu: function( ul, items ) {
  7048. var that = this;
  7049. $.each( items, function( index, item ) {
  7050. that._renderItemData( ul, item );
  7051. } );
  7052. },
  7053. _renderItemData: function( ul, item ) {
  7054. return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
  7055. },
  7056. _renderItem: function( ul, item ) {
  7057. return $( "<li>" )
  7058. .append( $( "<div>" ).text( item.label ) )
  7059. .appendTo( ul );
  7060. },
  7061. _move: function( direction, event ) {
  7062. if ( !this.menu.element.is( ":visible" ) ) {
  7063. this.search( null, event );
  7064. return;
  7065. }
  7066. if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
  7067. this.menu.isLastItem() && /^next/.test( direction ) ) {
  7068. if ( !this.isMultiLine ) {
  7069. this._value( this.term );
  7070. }
  7071. this.menu.blur();
  7072. return;
  7073. }
  7074. this.menu[ direction ]( event );
  7075. },
  7076. widget: function() {
  7077. return this.menu.element;
  7078. },
  7079. _value: function() {
  7080. return this.valueMethod.apply( this.element, arguments );
  7081. },
  7082. _keyEvent: function( keyEvent, event ) {
  7083. if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
  7084. this._move( keyEvent, event );
  7085. // Prevents moving cursor to beginning/end of the text field in some browsers
  7086. event.preventDefault();
  7087. }
  7088. },
  7089. // Support: Chrome <=50
  7090. // We should be able to just use this.element.prop( "isContentEditable" )
  7091. // but hidden elements always report false in Chrome.
  7092. // https://code.google.com/p/chromium/issues/detail?id=313082
  7093. _isContentEditable: function( element ) {
  7094. if ( !element.length ) {
  7095. return false;
  7096. }
  7097. var editable = element.prop( "contentEditable" );
  7098. if ( editable === "inherit" ) {
  7099. return this._isContentEditable( element.parent() );
  7100. }
  7101. return editable === "true";
  7102. }
  7103. } );
  7104. $.extend( $.ui.autocomplete, {
  7105. escapeRegex: function( value ) {
  7106. return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
  7107. },
  7108. filter: function( array, term ) {
  7109. var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" );
  7110. return $.grep( array, function( value ) {
  7111. return matcher.test( value.label || value.value || value );
  7112. } );
  7113. }
  7114. } );
  7115. // Live region extension, adding a `messages` option
  7116. // NOTE: This is an experimental API. We are still investigating
  7117. // a full solution for string manipulation and internationalization.
  7118. $.widget( "ui.autocomplete", $.ui.autocomplete, {
  7119. options: {
  7120. messages: {
  7121. noResults: "No search results.",
  7122. results: function( amount ) {
  7123. return amount + ( amount > 1 ? " results are" : " result is" ) +
  7124. " available, use up and down arrow keys to navigate.";
  7125. }
  7126. }
  7127. },
  7128. __response: function( content ) {
  7129. var message;
  7130. this._superApply( arguments );
  7131. if ( this.options.disabled || this.cancelSearch ) {
  7132. return;
  7133. }
  7134. if ( content && content.length ) {
  7135. message = this.options.messages.results( content.length );
  7136. } else {
  7137. message = this.options.messages.noResults;
  7138. }
  7139. this.liveRegion.children().hide();
  7140. $( "<div>" ).text( message ).appendTo( this.liveRegion );
  7141. }
  7142. } );
  7143. var widgetsAutocomplete = $.ui.autocomplete;
  7144. /*!
  7145. * jQuery UI Controlgroup 1.12.1
  7146. * http://jqueryui.com
  7147. *
  7148. * Copyright jQuery Foundation and other contributors
  7149. * Released under the MIT license.
  7150. * http://jquery.org/license
  7151. */
  7152. //>>label: Controlgroup
  7153. //>>group: Widgets
  7154. //>>description: Visually groups form control widgets
  7155. //>>docs: http://api.jqueryui.com/controlgroup/
  7156. //>>demos: http://jqueryui.com/controlgroup/
  7157. //>>css.structure: ../../themes/base/core.css
  7158. //>>css.structure: ../../themes/base/controlgroup.css
  7159. //>>css.theme: ../../themes/base/theme.css
  7160. var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g;
  7161. var widgetsControlgroup = $.widget( "ui.controlgroup", {
  7162. version: "1.12.1",
  7163. defaultElement: "<div>",
  7164. options: {
  7165. direction: "horizontal",
  7166. disabled: null,
  7167. onlyVisible: true,
  7168. items: {
  7169. "button": "input[type=button], input[type=submit], input[type=reset], button, a",
  7170. "controlgroupLabel": ".ui-controlgroup-label",
  7171. "checkboxradio": "input[type='checkbox'], input[type='radio']",
  7172. "selectmenu": "select",
  7173. "spinner": ".ui-spinner-input"
  7174. }
  7175. },
  7176. _create: function() {
  7177. this._enhance();
  7178. },
  7179. // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation
  7180. _enhance: function() {
  7181. this.element.attr( "role", "toolbar" );
  7182. this.refresh();
  7183. },
  7184. _destroy: function() {
  7185. this._callChildMethod( "destroy" );
  7186. this.childWidgets.removeData( "ui-controlgroup-data" );
  7187. this.element.removeAttr( "role" );
  7188. if ( this.options.items.controlgroupLabel ) {
  7189. this.element
  7190. .find( this.options.items.controlgroupLabel )
  7191. .find( ".ui-controlgroup-label-contents" )
  7192. .contents().unwrap();
  7193. }
  7194. },
  7195. _initWidgets: function() {
  7196. var that = this,
  7197. childWidgets = [];
  7198. // First we iterate over each of the items options
  7199. $.each( this.options.items, function( widget, selector ) {
  7200. var labels;
  7201. var options = {};
  7202. // Make sure the widget has a selector set
  7203. if ( !selector ) {
  7204. return;
  7205. }
  7206. if ( widget === "controlgroupLabel" ) {
  7207. labels = that.element.find( selector );
  7208. labels.each( function() {
  7209. var element = $( this );
  7210. if ( element.children( ".ui-controlgroup-label-contents" ).length ) {
  7211. return;
  7212. }
  7213. element.contents()
  7214. .wrapAll( "<span class='ui-controlgroup-label-contents'></span>" );
  7215. } );
  7216. that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" );
  7217. childWidgets = childWidgets.concat( labels.get() );
  7218. return;
  7219. }
  7220. // Make sure the widget actually exists
  7221. if ( !$.fn[ widget ] ) {
  7222. return;
  7223. }
  7224. // We assume everything is in the middle to start because we can't determine
  7225. // first / last elements until all enhancments are done.
  7226. if ( that[ "_" + widget + "Options" ] ) {
  7227. options = that[ "_" + widget + "Options" ]( "middle" );
  7228. } else {
  7229. options = { classes: {} };
  7230. }
  7231. // Find instances of this widget inside controlgroup and init them
  7232. that.element
  7233. .find( selector )
  7234. .each( function() {
  7235. var element = $( this );
  7236. var instance = element[ widget ]( "instance" );
  7237. // We need to clone the default options for this type of widget to avoid
  7238. // polluting the variable options which has a wider scope than a single widget.
  7239. var instanceOptions = $.widget.extend( {}, options );
  7240. // If the button is the child of a spinner ignore it
  7241. // TODO: Find a more generic solution
  7242. if ( widget === "button" && element.parent( ".ui-spinner" ).length ) {
  7243. return;
  7244. }
  7245. // Create the widget if it doesn't exist
  7246. if ( !instance ) {
  7247. instance = element[ widget ]()[ widget ]( "instance" );
  7248. }
  7249. if ( instance ) {
  7250. instanceOptions.classes =
  7251. that._resolveClassesValues( instanceOptions.classes, instance );
  7252. }
  7253. element[ widget ]( instanceOptions );
  7254. // Store an instance of the controlgroup to be able to reference
  7255. // from the outermost element for changing options and refresh
  7256. var widgetElement = element[ widget ]( "widget" );
  7257. $.data( widgetElement[ 0 ], "ui-controlgroup-data",
  7258. instance ? instance : element[ widget ]( "instance" ) );
  7259. childWidgets.push( widgetElement[ 0 ] );
  7260. } );
  7261. } );
  7262. this.childWidgets = $( $.unique( childWidgets ) );
  7263. this._addClass( this.childWidgets, "ui-controlgroup-item" );
  7264. },
  7265. _callChildMethod: function( method ) {
  7266. this.childWidgets.each( function() {
  7267. var element = $( this ),
  7268. data = element.data( "ui-controlgroup-data" );
  7269. if ( data && data[ method ] ) {
  7270. data[ method ]();
  7271. }
  7272. } );
  7273. },
  7274. _updateCornerClass: function( element, position ) {
  7275. var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all";
  7276. var add = this._buildSimpleOptions( position, "label" ).classes.label;
  7277. this._removeClass( element, null, remove );
  7278. this._addClass( element, null, add );
  7279. },
  7280. _buildSimpleOptions: function( position, key ) {
  7281. var direction = this.options.direction === "vertical";
  7282. var result = {
  7283. classes: {}
  7284. };
  7285. result.classes[ key ] = {
  7286. "middle": "",
  7287. "first": "ui-corner-" + ( direction ? "top" : "left" ),
  7288. "last": "ui-corner-" + ( direction ? "bottom" : "right" ),
  7289. "only": "ui-corner-all"
  7290. }[ position ];
  7291. return result;
  7292. },
  7293. _spinnerOptions: function( position ) {
  7294. var options = this._buildSimpleOptions( position, "ui-spinner" );
  7295. options.classes[ "ui-spinner-up" ] = "";
  7296. options.classes[ "ui-spinner-down" ] = "";
  7297. return options;
  7298. },
  7299. _buttonOptions: function( position ) {
  7300. return this._buildSimpleOptions( position, "ui-button" );
  7301. },
  7302. _checkboxradioOptions: function( position ) {
  7303. return this._buildSimpleOptions( position, "ui-checkboxradio-label" );
  7304. },
  7305. _selectmenuOptions: function( position ) {
  7306. var direction = this.options.direction === "vertical";
  7307. return {
  7308. width: direction ? "auto" : false,
  7309. classes: {
  7310. middle: {
  7311. "ui-selectmenu-button-open": "",
  7312. "ui-selectmenu-button-closed": ""
  7313. },
  7314. first: {
  7315. "ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ),
  7316. "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" )
  7317. },
  7318. last: {
  7319. "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr",
  7320. "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" )
  7321. },
  7322. only: {
  7323. "ui-selectmenu-button-open": "ui-corner-top",
  7324. "ui-selectmenu-button-closed": "ui-corner-all"
  7325. }
  7326. }[ position ]
  7327. };
  7328. },
  7329. _resolveClassesValues: function( classes, instance ) {
  7330. var result = {};
  7331. $.each( classes, function( key ) {
  7332. var current = instance.options.classes[ key ] || "";
  7333. current = $.trim( current.replace( controlgroupCornerRegex, "" ) );
  7334. result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " );
  7335. } );
  7336. return result;
  7337. },
  7338. _setOption: function( key, value ) {
  7339. if ( key === "direction" ) {
  7340. this._removeClass( "ui-controlgroup-" + this.options.direction );
  7341. }
  7342. this._super( key, value );
  7343. if ( key === "disabled" ) {
  7344. this._callChildMethod( value ? "disable" : "enable" );
  7345. return;
  7346. }
  7347. this.refresh();
  7348. },
  7349. refresh: function() {
  7350. var children,
  7351. that = this;
  7352. this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction );
  7353. if ( this.options.direction === "horizontal" ) {
  7354. this._addClass( null, "ui-helper-clearfix" );
  7355. }
  7356. this._initWidgets();
  7357. children = this.childWidgets;
  7358. // We filter here because we need to track all childWidgets not just the visible ones
  7359. if ( this.options.onlyVisible ) {
  7360. children = children.filter( ":visible" );
  7361. }
  7362. if ( children.length ) {
  7363. // We do this last because we need to make sure all enhancment is done
  7364. // before determining first and last
  7365. $.each( [ "first", "last" ], function( index, value ) {
  7366. var instance = children[ value ]().data( "ui-controlgroup-data" );
  7367. if ( instance && that[ "_" + instance.widgetName + "Options" ] ) {
  7368. var options = that[ "_" + instance.widgetName + "Options" ](
  7369. children.length === 1 ? "only" : value
  7370. );
  7371. options.classes = that._resolveClassesValues( options.classes, instance );
  7372. instance.element[ instance.widgetName ]( options );
  7373. } else {
  7374. that._updateCornerClass( children[ value ](), value );
  7375. }
  7376. } );
  7377. // Finally call the refresh method on each of the child widgets.
  7378. this._callChildMethod( "refresh" );
  7379. }
  7380. }
  7381. } );
  7382. /*!
  7383. * jQuery UI Checkboxradio 1.12.1
  7384. * http://jqueryui.com
  7385. *
  7386. * Copyright jQuery Foundation and other contributors
  7387. * Released under the MIT license.
  7388. * http://jquery.org/license
  7389. */
  7390. //>>label: Checkboxradio
  7391. //>>group: Widgets
  7392. //>>description: Enhances a form with multiple themeable checkboxes or radio buttons.
  7393. //>>docs: http://api.jqueryui.com/checkboxradio/
  7394. //>>demos: http://jqueryui.com/checkboxradio/
  7395. //>>css.structure: ../../themes/base/core.css
  7396. //>>css.structure: ../../themes/base/button.css
  7397. //>>css.structure: ../../themes/base/checkboxradio.css
  7398. //>>css.theme: ../../themes/base/theme.css
  7399. $.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
  7400. version: "1.12.1",
  7401. options: {
  7402. disabled: null,
  7403. label: null,
  7404. icon: true,
  7405. classes: {
  7406. "ui-checkboxradio-label": "ui-corner-all",
  7407. "ui-checkboxradio-icon": "ui-corner-all"
  7408. }
  7409. },
  7410. _getCreateOptions: function() {
  7411. var disabled, labels;
  7412. var that = this;
  7413. var options = this._super() || {};
  7414. // We read the type here, because it makes more sense to throw a element type error first,
  7415. // rather then the error for lack of a label. Often if its the wrong type, it
  7416. // won't have a label (e.g. calling on a div, btn, etc)
  7417. this._readType();
  7418. labels = this.element.labels();
  7419. // If there are multiple labels, use the last one
  7420. this.label = $( labels[ labels.length - 1 ] );
  7421. if ( !this.label.length ) {
  7422. $.error( "No label found for checkboxradio widget" );
  7423. }
  7424. this.originalLabel = "";
  7425. // We need to get the label text but this may also need to make sure it does not contain the
  7426. // input itself.
  7427. this.label.contents().not( this.element[ 0 ] ).each( function() {
  7428. // The label contents could be text, html, or a mix. We concat each element to get a
  7429. // string representation of the label, without the input as part of it.
  7430. that.originalLabel += this.nodeType === 3 ? $( this ).text() : this.outerHTML;
  7431. } );
  7432. // Set the label option if we found label text
  7433. if ( this.originalLabel ) {
  7434. options.label = this.originalLabel;
  7435. }
  7436. disabled = this.element[ 0 ].disabled;
  7437. if ( disabled != null ) {
  7438. options.disabled = disabled;
  7439. }
  7440. return options;
  7441. },
  7442. _create: function() {
  7443. var checked = this.element[ 0 ].checked;
  7444. this._bindFormResetHandler();
  7445. if ( this.options.disabled == null ) {
  7446. this.options.disabled = this.element[ 0 ].disabled;
  7447. }
  7448. this._setOption( "disabled", this.options.disabled );
  7449. this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" );
  7450. this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" );
  7451. if ( this.type === "radio" ) {
  7452. this._addClass( this.label, "ui-checkboxradio-radio-label" );
  7453. }
  7454. if ( this.options.label && this.options.label !== this.originalLabel ) {
  7455. this._updateLabel();
  7456. } else if ( this.originalLabel ) {
  7457. this.options.label = this.originalLabel;
  7458. }
  7459. this._enhance();
  7460. if ( checked ) {
  7461. this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" );
  7462. if ( this.icon ) {
  7463. this._addClass( this.icon, null, "ui-state-hover" );
  7464. }
  7465. }
  7466. this._on( {
  7467. change: "_toggleClasses",
  7468. focus: function() {
  7469. this._addClass( this.label, null, "ui-state-focus ui-visual-focus" );
  7470. },
  7471. blur: function() {
  7472. this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" );
  7473. }
  7474. } );
  7475. },
  7476. _readType: function() {
  7477. var nodeName = this.element[ 0 ].nodeName.toLowerCase();
  7478. this.type = this.element[ 0 ].type;
  7479. if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) {
  7480. $.error( "Can't create checkboxradio on element.nodeName=" + nodeName +
  7481. " and element.type=" + this.type );
  7482. }
  7483. },
  7484. // Support jQuery Mobile enhanced option
  7485. _enhance: function() {
  7486. this._updateIcon( this.element[ 0 ].checked );
  7487. },
  7488. widget: function() {
  7489. return this.label;
  7490. },
  7491. _getRadioGroup: function() {
  7492. var group;
  7493. var name = this.element[ 0 ].name;
  7494. var nameSelector = "input[name='" + $.ui.escapeSelector( name ) + "']";
  7495. if ( !name ) {
  7496. return $( [] );
  7497. }
  7498. if ( this.form.length ) {
  7499. group = $( this.form[ 0 ].elements ).filter( nameSelector );
  7500. } else {
  7501. // Not inside a form, check all inputs that also are not inside a form
  7502. group = $( nameSelector ).filter( function() {
  7503. return $( this ).form().length === 0;
  7504. } );
  7505. }
  7506. return group.not( this.element );
  7507. },
  7508. _toggleClasses: function() {
  7509. var checked = this.element[ 0 ].checked;
  7510. this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
  7511. if ( this.options.icon && this.type === "checkbox" ) {
  7512. this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked )
  7513. ._toggleClass( this.icon, null, "ui-icon-blank", !checked );
  7514. }
  7515. if ( this.type === "radio" ) {
  7516. this._getRadioGroup()
  7517. .each( function() {
  7518. var instance = $( this ).checkboxradio( "instance" );
  7519. if ( instance ) {
  7520. instance._removeClass( instance.label,
  7521. "ui-checkboxradio-checked", "ui-state-active" );
  7522. }
  7523. } );
  7524. }
  7525. },
  7526. _destroy: function() {
  7527. this._unbindFormResetHandler();
  7528. if ( this.icon ) {
  7529. this.icon.remove();
  7530. this.iconSpace.remove();
  7531. }
  7532. },
  7533. _setOption: function( key, value ) {
  7534. // We don't allow the value to be set to nothing
  7535. if ( key === "label" && !value ) {
  7536. return;
  7537. }
  7538. this._super( key, value );
  7539. if ( key === "disabled" ) {
  7540. this._toggleClass( this.label, null, "ui-state-disabled", value );
  7541. this.element[ 0 ].disabled = value;
  7542. // Don't refresh when setting disabled
  7543. return;
  7544. }
  7545. this.refresh();
  7546. },
  7547. _updateIcon: function( checked ) {
  7548. var toAdd = "ui-icon ui-icon-background ";
  7549. if ( this.options.icon ) {
  7550. if ( !this.icon ) {
  7551. this.icon = $( "<span>" );
  7552. this.iconSpace = $( "<span> </span>" );
  7553. this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" );
  7554. }
  7555. if ( this.type === "checkbox" ) {
  7556. toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank";
  7557. this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" );
  7558. } else {
  7559. toAdd += "ui-icon-blank";
  7560. }
  7561. this._addClass( this.icon, "ui-checkboxradio-icon", toAdd );
  7562. if ( !checked ) {
  7563. this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" );
  7564. }
  7565. this.icon.prependTo( this.label ).after( this.iconSpace );
  7566. } else if ( this.icon !== undefined ) {
  7567. this.icon.remove();
  7568. this.iconSpace.remove();
  7569. delete this.icon;
  7570. }
  7571. },
  7572. _updateLabel: function() {
  7573. // Remove the contents of the label ( minus the icon, icon space, and input )
  7574. var contents = this.label.contents().not( this.element[ 0 ] );
  7575. if ( this.icon ) {
  7576. contents = contents.not( this.icon[ 0 ] );
  7577. }
  7578. if ( this.iconSpace ) {
  7579. contents = contents.not( this.iconSpace[ 0 ] );
  7580. }
  7581. contents.remove();
  7582. this.label.append( this.options.label );
  7583. },
  7584. refresh: function() {
  7585. var checked = this.element[ 0 ].checked,
  7586. isDisabled = this.element[ 0 ].disabled;
  7587. this._updateIcon( checked );
  7588. this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
  7589. if ( this.options.label !== null ) {
  7590. this._updateLabel();
  7591. }
  7592. if ( isDisabled !== this.options.disabled ) {
  7593. this._setOptions( { "disabled": isDisabled } );
  7594. }
  7595. }
  7596. } ] );
  7597. var widgetsCheckboxradio = $.ui.checkboxradio;
  7598. /*!
  7599. * jQuery UI Button 1.12.1
  7600. * http://jqueryui.com
  7601. *
  7602. * Copyright jQuery Foundation and other contributors
  7603. * Released under the MIT license.
  7604. * http://jquery.org/license
  7605. */
  7606. //>>label: Button
  7607. //>>group: Widgets
  7608. //>>description: Enhances a form with themeable buttons.
  7609. //>>docs: http://api.jqueryui.com/button/
  7610. //>>demos: http://jqueryui.com/button/
  7611. //>>css.structure: ../../themes/base/core.css
  7612. //>>css.structure: ../../themes/base/button.css
  7613. //>>css.theme: ../../themes/base/theme.css
  7614. $.widget( "ui.button", {
  7615. version: "1.12.1",
  7616. defaultElement: "<button>",
  7617. options: {
  7618. classes: {
  7619. "ui-button": "ui-corner-all"
  7620. },
  7621. disabled: null,
  7622. icon: null,
  7623. iconPosition: "beginning",
  7624. label: null,
  7625. showLabel: true
  7626. },
  7627. _getCreateOptions: function() {
  7628. var disabled,
  7629. // This is to support cases like in jQuery Mobile where the base widget does have
  7630. // an implementation of _getCreateOptions
  7631. options = this._super() || {};
  7632. this.isInput = this.element.is( "input" );
  7633. disabled = this.element[ 0 ].disabled;
  7634. if ( disabled != null ) {
  7635. options.disabled = disabled;
  7636. }
  7637. this.originalLabel = this.isInput ? this.element.val() : this.element.html();
  7638. if ( this.originalLabel ) {
  7639. options.label = this.originalLabel;
  7640. }
  7641. return options;
  7642. },
  7643. _create: function() {
  7644. if ( !this.option.showLabel & !this.options.icon ) {
  7645. this.options.showLabel = true;
  7646. }
  7647. // We have to check the option again here even though we did in _getCreateOptions,
  7648. // because null may have been passed on init which would override what was set in
  7649. // _getCreateOptions
  7650. if ( this.options.disabled == null ) {
  7651. this.options.disabled = this.element[ 0 ].disabled || false;
  7652. }
  7653. this.hasTitle = !!this.element.attr( "title" );
  7654. // Check to see if the label needs to be set or if its already correct
  7655. if ( this.options.label && this.options.label !== this.originalLabel ) {
  7656. if ( this.isInput ) {
  7657. this.element.val( this.options.label );
  7658. } else {
  7659. this.element.html( this.options.label );
  7660. }
  7661. }
  7662. this._addClass( "ui-button", "ui-widget" );
  7663. this._setOption( "disabled", this.options.disabled );
  7664. this._enhance();
  7665. if ( this.element.is( "a" ) ) {
  7666. this._on( {
  7667. "keyup": function( event ) {
  7668. if ( event.keyCode === $.ui.keyCode.SPACE ) {
  7669. event.preventDefault();
  7670. // Support: PhantomJS <= 1.9, IE 8 Only
  7671. // If a native click is available use it so we actually cause navigation
  7672. // otherwise just trigger a click event
  7673. if ( this.element[ 0 ].click ) {
  7674. this.element[ 0 ].click();
  7675. } else {
  7676. this.element.trigger( "click" );
  7677. }
  7678. }
  7679. }
  7680. } );
  7681. }
  7682. },
  7683. _enhance: function() {
  7684. if ( !this.element.is( "button" ) ) {
  7685. this.element.attr( "role", "button" );
  7686. }
  7687. if ( this.options.icon ) {
  7688. this._updateIcon( "icon", this.options.icon );
  7689. this._updateTooltip();
  7690. }
  7691. },
  7692. _updateTooltip: function() {
  7693. this.title = this.element.attr( "title" );
  7694. if ( !this.options.showLabel && !this.title ) {
  7695. this.element.attr( "title", this.options.label );
  7696. }
  7697. },
  7698. _updateIcon: function( option, value ) {
  7699. var icon = option !== "iconPosition",
  7700. position = icon ? this.options.iconPosition : value,
  7701. displayBlock = position === "top" || position === "bottom";
  7702. // Create icon
  7703. if ( !this.icon ) {
  7704. this.icon = $( "<span>" );
  7705. this._addClass( this.icon, "ui-button-icon", "ui-icon" );
  7706. if ( !this.options.showLabel ) {
  7707. this._addClass( "ui-button-icon-only" );
  7708. }
  7709. } else if ( icon ) {
  7710. // If we are updating the icon remove the old icon class
  7711. this._removeClass( this.icon, null, this.options.icon );
  7712. }
  7713. // If we are updating the icon add the new icon class
  7714. if ( icon ) {
  7715. this._addClass( this.icon, null, value );
  7716. }
  7717. this._attachIcon( position );
  7718. // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove
  7719. // the iconSpace if there is one.
  7720. if ( displayBlock ) {
  7721. this._addClass( this.icon, null, "ui-widget-icon-block" );
  7722. if ( this.iconSpace ) {
  7723. this.iconSpace.remove();
  7724. }
  7725. } else {
  7726. // Position is beginning or end so remove the ui-widget-icon-block class and add the
  7727. // space if it does not exist
  7728. if ( !this.iconSpace ) {
  7729. this.iconSpace = $( "<span> </span>" );
  7730. this._addClass( this.iconSpace, "ui-button-icon-space" );
  7731. }
  7732. this._removeClass( this.icon, null, "ui-wiget-icon-block" );
  7733. this._attachIconSpace( position );
  7734. }
  7735. },
  7736. _destroy: function() {
  7737. this.element.removeAttr( "role" );
  7738. if ( this.icon ) {
  7739. this.icon.remove();
  7740. }
  7741. if ( this.iconSpace ) {
  7742. this.iconSpace.remove();
  7743. }
  7744. if ( !this.hasTitle ) {
  7745. this.element.removeAttr( "title" );
  7746. }
  7747. },
  7748. _attachIconSpace: function( iconPosition ) {
  7749. this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace );
  7750. },
  7751. _attachIcon: function( iconPosition ) {
  7752. this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon );
  7753. },
  7754. _setOptions: function( options ) {
  7755. var newShowLabel = options.showLabel === undefined ?
  7756. this.options.showLabel :
  7757. options.showLabel,
  7758. newIcon = options.icon === undefined ? this.options.icon : options.icon;
  7759. if ( !newShowLabel && !newIcon ) {
  7760. options.showLabel = true;
  7761. }
  7762. this._super( options );
  7763. },
  7764. _setOption: function( key, value ) {
  7765. if ( key === "icon" ) {
  7766. if ( value ) {
  7767. this._updateIcon( key, value );
  7768. } else if ( this.icon ) {
  7769. this.icon.remove();
  7770. if ( this.iconSpace ) {
  7771. this.iconSpace.remove();
  7772. }
  7773. }
  7774. }
  7775. if ( key === "iconPosition" ) {
  7776. this._updateIcon( key, value );
  7777. }
  7778. // Make sure we can't end up with a button that has neither text nor icon
  7779. if ( key === "showLabel" ) {
  7780. this._toggleClass( "ui-button-icon-only", null, !value );
  7781. this._updateTooltip();
  7782. }
  7783. if ( key === "label" ) {
  7784. if ( this.isInput ) {
  7785. this.element.val( value );
  7786. } else {
  7787. // If there is an icon, append it, else nothing then append the value
  7788. // this avoids removal of the icon when setting label text
  7789. this.element.html( value );
  7790. if ( this.icon ) {
  7791. this._attachIcon( this.options.iconPosition );
  7792. this._attachIconSpace( this.options.iconPosition );
  7793. }
  7794. }
  7795. }
  7796. this._super( key, value );
  7797. if ( key === "disabled" ) {
  7798. this._toggleClass( null, "ui-state-disabled", value );
  7799. this.element[ 0 ].disabled = value;
  7800. if ( value ) {
  7801. this.element.blur();
  7802. }
  7803. }
  7804. },
  7805. refresh: function() {
  7806. // Make sure to only check disabled if its an element that supports this otherwise
  7807. // check for the disabled class to determine state
  7808. var isDisabled = this.element.is( "input, button" ) ?
  7809. this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" );
  7810. if ( isDisabled !== this.options.disabled ) {
  7811. this._setOptions( { disabled: isDisabled } );
  7812. }
  7813. this._updateTooltip();
  7814. }
  7815. } );
  7816. // DEPRECATED
  7817. if ( $.uiBackCompat !== false ) {
  7818. // Text and Icons options
  7819. $.widget( "ui.button", $.ui.button, {
  7820. options: {
  7821. text: true,
  7822. icons: {
  7823. primary: null,
  7824. secondary: null
  7825. }
  7826. },
  7827. _create: function() {
  7828. if ( this.options.showLabel && !this.options.text ) {
  7829. this.options.showLabel = this.options.text;
  7830. }
  7831. if ( !this.options.showLabel && this.options.text ) {
  7832. this.options.text = this.options.showLabel;
  7833. }
  7834. if ( !this.options.icon && ( this.options.icons.primary ||
  7835. this.options.icons.secondary ) ) {
  7836. if ( this.options.icons.primary ) {
  7837. this.options.icon = this.options.icons.primary;
  7838. } else {
  7839. this.options.icon = this.options.icons.secondary;
  7840. this.options.iconPosition = "end";
  7841. }
  7842. } else if ( this.options.icon ) {
  7843. this.options.icons.primary = this.options.icon;
  7844. }
  7845. this._super();
  7846. },
  7847. _setOption: function( key, value ) {
  7848. if ( key === "text" ) {
  7849. this._super( "showLabel", value );
  7850. return;
  7851. }
  7852. if ( key === "showLabel" ) {
  7853. this.options.text = value;
  7854. }
  7855. if ( key === "icon" ) {
  7856. this.options.icons.primary = value;
  7857. }
  7858. if ( key === "icons" ) {
  7859. if ( value.primary ) {
  7860. this._super( "icon", value.primary );
  7861. this._super( "iconPosition", "beginning" );
  7862. } else if ( value.secondary ) {
  7863. this._super( "icon", value.secondary );
  7864. this._super( "iconPosition", "end" );
  7865. }
  7866. }
  7867. this._superApply( arguments );
  7868. }
  7869. } );
  7870. $.fn.button = ( function( orig ) {
  7871. return function() {
  7872. if ( !this.length || ( this.length && this[ 0 ].tagName !== "INPUT" ) ||
  7873. ( this.length && this[ 0 ].tagName === "INPUT" && (
  7874. this.attr( "type" ) !== "checkbox" && this.attr( "type" ) !== "radio"
  7875. ) ) ) {
  7876. return orig.apply( this, arguments );
  7877. }
  7878. if ( !$.ui.checkboxradio ) {
  7879. $.error( "Checkboxradio widget missing" );
  7880. }
  7881. if ( arguments.length === 0 ) {
  7882. return this.checkboxradio( {
  7883. "icon": false
  7884. } );
  7885. }
  7886. return this.checkboxradio.apply( this, arguments );
  7887. };
  7888. } )( $.fn.button );
  7889. $.fn.buttonset = function() {
  7890. if ( !$.ui.controlgroup ) {
  7891. $.error( "Controlgroup widget missing" );
  7892. }
  7893. if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) {
  7894. return this.controlgroup.apply( this,
  7895. [ arguments[ 0 ], "items.button", arguments[ 2 ] ] );
  7896. }
  7897. if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) {
  7898. return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] );
  7899. }
  7900. if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) {
  7901. arguments[ 0 ].items = {
  7902. button: arguments[ 0 ].items
  7903. };
  7904. }
  7905. return this.controlgroup.apply( this, arguments );
  7906. };
  7907. }
  7908. var widgetsButton = $.ui.button;
  7909. // jscs:disable maximumLineLength
  7910. /* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
  7911. /*!
  7912. * jQuery UI Datepicker 1.12.1
  7913. * http://jqueryui.com
  7914. *
  7915. * Copyright jQuery Foundation and other contributors
  7916. * Released under the MIT license.
  7917. * http://jquery.org/license
  7918. */
  7919. //>>label: Datepicker
  7920. //>>group: Widgets
  7921. //>>description: Displays a calendar from an input or inline for selecting dates.
  7922. //>>docs: http://api.jqueryui.com/datepicker/
  7923. //>>demos: http://jqueryui.com/datepicker/
  7924. //>>css.structure: ../../themes/base/core.css
  7925. //>>css.structure: ../../themes/base/datepicker.css
  7926. //>>css.theme: ../../themes/base/theme.css
  7927. $.extend( $.ui, { datepicker: { version: "1.12.1" } } );
  7928. var datepicker_instActive;
  7929. function datepicker_getZindex( elem ) {
  7930. var position, value;
  7931. while ( elem.length && elem[ 0 ] !== document ) {
  7932. // Ignore z-index if position is set to a value where z-index is ignored by the browser
  7933. // This makes behavior of this function consistent across browsers
  7934. // WebKit always returns auto if the element is positioned
  7935. position = elem.css( "position" );
  7936. if ( position === "absolute" || position === "relative" || position === "fixed" ) {
  7937. // IE returns 0 when zIndex is not specified
  7938. // other browsers return a string
  7939. // we ignore the case of nested elements with an explicit value of 0
  7940. // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
  7941. value = parseInt( elem.css( "zIndex" ), 10 );
  7942. if ( !isNaN( value ) && value !== 0 ) {
  7943. return value;
  7944. }
  7945. }
  7946. elem = elem.parent();
  7947. }
  7948. return 0;
  7949. }
  7950. /* Date picker manager.
  7951. Use the singleton instance of this class, $.datepicker, to interact with the date picker.
  7952. Settings for (groups of) date pickers are maintained in an instance object,
  7953. allowing multiple different settings on the same page. */
  7954. function Datepicker() {
  7955. this._curInst = null; // The current instance in use
  7956. this._keyEvent = false; // If the last event was a key event
  7957. this._disabledInputs = []; // List of date picker inputs that have been disabled
  7958. this._datepickerShowing = false; // True if the popup picker is showing , false if not
  7959. this._inDialog = false; // True if showing within a "dialog", false if not
  7960. this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division
  7961. this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class
  7962. this._appendClass = "ui-datepicker-append"; // The name of the append marker class
  7963. this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class
  7964. this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class
  7965. this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class
  7966. this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class
  7967. this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class
  7968. this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class
  7969. this.regional = []; // Available regional settings, indexed by language code
  7970. this.regional[ "" ] = { // Default regional settings
  7971. closeText: "Done", // Display text for close link
  7972. prevText: "Prev", // Display text for previous month link
  7973. nextText: "Next", // Display text for next month link
  7974. currentText: "Today", // Display text for current month link
  7975. monthNames: [ "January","February","March","April","May","June",
  7976. "July","August","September","October","November","December" ], // Names of months for drop-down and formatting
  7977. monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting
  7978. dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting
  7979. dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting
  7980. dayNamesMin: [ "Su","Mo","Tu","We","Th","Fr","Sa" ], // Column headings for days starting at Sunday
  7981. weekHeader: "Wk", // Column header for week of the year
  7982. dateFormat: "mm/dd/yy", // See format options on parseDate
  7983. firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
  7984. isRTL: false, // True if right-to-left language, false if left-to-right
  7985. showMonthAfterYear: false, // True if the year select precedes month, false for month then year
  7986. yearSuffix: "" // Additional text to append to the year in the month headers
  7987. };
  7988. this._defaults = { // Global defaults for all the date picker instances
  7989. showOn: "focus", // "focus" for popup on focus,
  7990. // "button" for trigger button, or "both" for either
  7991. showAnim: "fadeIn", // Name of jQuery animation for popup
  7992. showOptions: {}, // Options for enhanced animations
  7993. defaultDate: null, // Used when field is blank: actual date,
  7994. // +/-number for offset from today, null for today
  7995. appendText: "", // Display text following the input box, e.g. showing the format
  7996. buttonText: "...", // Text for trigger button
  7997. buttonImage: "", // URL for trigger button image
  7998. buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
  7999. hideIfNoPrevNext: false, // True to hide next/previous month links
  8000. // if not applicable, false to just disable them
  8001. navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
  8002. gotoCurrent: false, // True if today link goes back to current selection instead
  8003. changeMonth: false, // True if month can be selected directly, false if only prev/next
  8004. changeYear: false, // True if year can be selected directly, false if only prev/next
  8005. yearRange: "c-10:c+10", // Range of years to display in drop-down,
  8006. // either relative to today's year (-nn:+nn), relative to currently displayed year
  8007. // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
  8008. showOtherMonths: false, // True to show dates in other months, false to leave blank
  8009. selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
  8010. showWeek: false, // True to show week of the year, false to not show it
  8011. calculateWeek: this.iso8601Week, // How to calculate the week of the year,
  8012. // takes a Date and returns the number of the week for it
  8013. shortYearCutoff: "+10", // Short year values < this are in the current century,
  8014. // > this are in the previous century,
  8015. // string value starting with "+" for current year + value
  8016. minDate: null, // The earliest selectable date, or null for no limit
  8017. maxDate: null, // The latest selectable date, or null for no limit
  8018. duration: "fast", // Duration of display/closure
  8019. beforeShowDay: null, // Function that takes a date and returns an array with
  8020. // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
  8021. // [2] = cell title (optional), e.g. $.datepicker.noWeekends
  8022. beforeShow: null, // Function that takes an input field and
  8023. // returns a set of custom settings for the date picker
  8024. onSelect: null, // Define a callback function when a date is selected
  8025. onChangeMonthYear: null, // Define a callback function when the month or year is changed
  8026. onClose: null, // Define a callback function when the datepicker is closed
  8027. numberOfMonths: 1, // Number of months to show at a time
  8028. showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
  8029. stepMonths: 1, // Number of months to step back/forward
  8030. stepBigMonths: 12, // Number of months to step back/forward for the big links
  8031. altField: "", // Selector for an alternate field to store selected dates into
  8032. altFormat: "", // The date format to use for the alternate field
  8033. constrainInput: true, // The input is constrained by the current date format
  8034. showButtonPanel: false, // True to show button panel, false to not show it
  8035. autoSize: false, // True to size the input for the date format, false to leave as is
  8036. disabled: false // The initial disabled state
  8037. };
  8038. $.extend( this._defaults, this.regional[ "" ] );
  8039. this.regional.en = $.extend( true, {}, this.regional[ "" ] );
  8040. this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en );
  8041. this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) );
  8042. }
  8043. $.extend( Datepicker.prototype, {
  8044. /* Class name added to elements to indicate already configured with a date picker. */
  8045. markerClassName: "hasDatepicker",
  8046. //Keep track of the maximum number of rows displayed (see #7043)
  8047. maxRows: 4,
  8048. // TODO rename to "widget" when switching to widget factory
  8049. _widgetDatepicker: function() {
  8050. return this.dpDiv;
  8051. },
  8052. /* Override the default settings for all instances of the date picker.
  8053. * @param settings object - the new settings to use as defaults (anonymous object)
  8054. * @return the manager object
  8055. */
  8056. setDefaults: function( settings ) {
  8057. datepicker_extendRemove( this._defaults, settings || {} );
  8058. return this;
  8059. },
  8060. /* Attach the date picker to a jQuery selection.
  8061. * @param target element - the target input field or division or span
  8062. * @param settings object - the new settings to use for this date picker instance (anonymous)
  8063. */
  8064. _attachDatepicker: function( target, settings ) {
  8065. var nodeName, inline, inst;
  8066. nodeName = target.nodeName.toLowerCase();
  8067. inline = ( nodeName === "div" || nodeName === "span" );
  8068. if ( !target.id ) {
  8069. this.uuid += 1;
  8070. target.id = "dp" + this.uuid;
  8071. }
  8072. inst = this._newInst( $( target ), inline );
  8073. inst.settings = $.extend( {}, settings || {} );
  8074. if ( nodeName === "input" ) {
  8075. this._connectDatepicker( target, inst );
  8076. } else if ( inline ) {
  8077. this._inlineDatepicker( target, inst );
  8078. }
  8079. },
  8080. /* Create a new instance object. */
  8081. _newInst: function( target, inline ) {
  8082. var id = target[ 0 ].id.replace( /([^A-Za-z0-9_\-])/g, "\\\\$1" ); // escape jQuery meta chars
  8083. return { id: id, input: target, // associated target
  8084. selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
  8085. drawMonth: 0, drawYear: 0, // month being drawn
  8086. inline: inline, // is datepicker inline or not
  8087. dpDiv: ( !inline ? this.dpDiv : // presentation div
  8088. datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) };
  8089. },
  8090. /* Attach the date picker to an input field. */
  8091. _connectDatepicker: function( target, inst ) {
  8092. var input = $( target );
  8093. inst.append = $( [] );
  8094. inst.trigger = $( [] );
  8095. if ( input.hasClass( this.markerClassName ) ) {
  8096. return;
  8097. }
  8098. this._attachments( input, inst );
  8099. input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ).
  8100. on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp );
  8101. this._autoSize( inst );
  8102. $.data( target, "datepicker", inst );
  8103. //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
  8104. if ( inst.settings.disabled ) {
  8105. this._disableDatepicker( target );
  8106. }
  8107. },
  8108. /* Make attachments based on settings. */
  8109. _attachments: function( input, inst ) {
  8110. var showOn, buttonText, buttonImage,
  8111. appendText = this._get( inst, "appendText" ),
  8112. isRTL = this._get( inst, "isRTL" );
  8113. if ( inst.append ) {
  8114. inst.append.remove();
  8115. }
  8116. if ( appendText ) {
  8117. inst.append = $( "<span class='" + this._appendClass + "'>" + appendText + "</span>" );
  8118. input[ isRTL ? "before" : "after" ]( inst.append );
  8119. }
  8120. input.off( "focus", this._showDatepicker );
  8121. if ( inst.trigger ) {
  8122. inst.trigger.remove();
  8123. }
  8124. showOn = this._get( inst, "showOn" );
  8125. if ( showOn === "focus" || showOn === "both" ) { // pop-up date picker when in the marked field
  8126. input.on( "focus", this._showDatepicker );
  8127. }
  8128. if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked
  8129. buttonText = this._get( inst, "buttonText" );
  8130. buttonImage = this._get( inst, "buttonImage" );
  8131. inst.trigger = $( this._get( inst, "buttonImageOnly" ) ?
  8132. $( "<img/>" ).addClass( this._triggerClass ).
  8133. attr( { src: buttonImage, alt: buttonText, title: buttonText } ) :
  8134. $( "<button type='button'></button>" ).addClass( this._triggerClass ).
  8135. html( !buttonImage ? buttonText : $( "<img/>" ).attr(
  8136. { src:buttonImage, alt:buttonText, title:buttonText } ) ) );
  8137. input[ isRTL ? "before" : "after" ]( inst.trigger );
  8138. inst.trigger.on( "click", function() {
  8139. if ( $.datepicker._datepickerShowing && $.datepicker._lastInput === input[ 0 ] ) {
  8140. $.datepicker._hideDatepicker();
  8141. } else if ( $.datepicker._datepickerShowing && $.datepicker._lastInput !== input[ 0 ] ) {
  8142. $.datepicker._hideDatepicker();
  8143. $.datepicker._showDatepicker( input[ 0 ] );
  8144. } else {
  8145. $.datepicker._showDatepicker( input[ 0 ] );
  8146. }
  8147. return false;
  8148. } );
  8149. }
  8150. },
  8151. /* Apply the maximum length for the date format. */
  8152. _autoSize: function( inst ) {
  8153. if ( this._get( inst, "autoSize" ) && !inst.inline ) {
  8154. var findMax, max, maxI, i,
  8155. date = new Date( 2009, 12 - 1, 20 ), // Ensure double digits
  8156. dateFormat = this._get( inst, "dateFormat" );
  8157. if ( dateFormat.match( /[DM]/ ) ) {
  8158. findMax = function( names ) {
  8159. max = 0;
  8160. maxI = 0;
  8161. for ( i = 0; i < names.length; i++ ) {
  8162. if ( names[ i ].length > max ) {
  8163. max = names[ i ].length;
  8164. maxI = i;
  8165. }
  8166. }
  8167. return maxI;
  8168. };
  8169. date.setMonth( findMax( this._get( inst, ( dateFormat.match( /MM/ ) ?
  8170. "monthNames" : "monthNamesShort" ) ) ) );
  8171. date.setDate( findMax( this._get( inst, ( dateFormat.match( /DD/ ) ?
  8172. "dayNames" : "dayNamesShort" ) ) ) + 20 - date.getDay() );
  8173. }
  8174. inst.input.attr( "size", this._formatDate( inst, date ).length );
  8175. }
  8176. },
  8177. /* Attach an inline date picker to a div. */
  8178. _inlineDatepicker: function( target, inst ) {
  8179. var divSpan = $( target );
  8180. if ( divSpan.hasClass( this.markerClassName ) ) {
  8181. return;
  8182. }
  8183. divSpan.addClass( this.markerClassName ).append( inst.dpDiv );
  8184. $.data( target, "datepicker", inst );
  8185. this._setDate( inst, this._getDefaultDate( inst ), true );
  8186. this._updateDatepicker( inst );
  8187. this._updateAlternate( inst );
  8188. //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
  8189. if ( inst.settings.disabled ) {
  8190. this._disableDatepicker( target );
  8191. }
  8192. // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
  8193. // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
  8194. inst.dpDiv.css( "display", "block" );
  8195. },
  8196. /* Pop-up the date picker in a "dialog" box.
  8197. * @param input element - ignored
  8198. * @param date string or Date - the initial date to display
  8199. * @param onSelect function - the function to call when a date is selected
  8200. * @param settings object - update the dialog date picker instance's settings (anonymous object)
  8201. * @param pos int[2] - coordinates for the dialog's position within the screen or
  8202. * event - with x/y coordinates or
  8203. * leave empty for default (screen centre)
  8204. * @return the manager object
  8205. */
  8206. _dialogDatepicker: function( input, date, onSelect, settings, pos ) {
  8207. var id, browserWidth, browserHeight, scrollX, scrollY,
  8208. inst = this._dialogInst; // internal instance
  8209. if ( !inst ) {
  8210. this.uuid += 1;
  8211. id = "dp" + this.uuid;
  8212. this._dialogInput = $( "<input type='text' id='" + id +
  8213. "' style='position: absolute; top: -100px; width: 0px;'/>" );
  8214. this._dialogInput.on( "keydown", this._doKeyDown );
  8215. $( "body" ).append( this._dialogInput );
  8216. inst = this._dialogInst = this._newInst( this._dialogInput, false );
  8217. inst.settings = {};
  8218. $.data( this._dialogInput[ 0 ], "datepicker", inst );
  8219. }
  8220. datepicker_extendRemove( inst.settings, settings || {} );
  8221. date = ( date && date.constructor === Date ? this._formatDate( inst, date ) : date );
  8222. this._dialogInput.val( date );
  8223. this._pos = ( pos ? ( pos.length ? pos : [ pos.pageX, pos.pageY ] ) : null );
  8224. if ( !this._pos ) {
  8225. browserWidth = document.documentElement.clientWidth;
  8226. browserHeight = document.documentElement.clientHeight;
  8227. scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
  8228. scrollY = document.documentElement.scrollTop || document.body.scrollTop;
  8229. this._pos = // should use actual width/height below
  8230. [ ( browserWidth / 2 ) - 100 + scrollX, ( browserHeight / 2 ) - 150 + scrollY ];
  8231. }
  8232. // Move input on screen for focus, but hidden behind dialog
  8233. this._dialogInput.css( "left", ( this._pos[ 0 ] + 20 ) + "px" ).css( "top", this._pos[ 1 ] + "px" );
  8234. inst.settings.onSelect = onSelect;
  8235. this._inDialog = true;
  8236. this.dpDiv.addClass( this._dialogClass );
  8237. this._showDatepicker( this._dialogInput[ 0 ] );
  8238. if ( $.blockUI ) {
  8239. $.blockUI( this.dpDiv );
  8240. }
  8241. $.data( this._dialogInput[ 0 ], "datepicker", inst );
  8242. return this;
  8243. },
  8244. /* Detach a datepicker from its control.
  8245. * @param target element - the target input field or division or span
  8246. */
  8247. _destroyDatepicker: function( target ) {
  8248. var nodeName,
  8249. $target = $( target ),
  8250. inst = $.data( target, "datepicker" );
  8251. if ( !$target.hasClass( this.markerClassName ) ) {
  8252. return;
  8253. }
  8254. nodeName = target.nodeName.toLowerCase();
  8255. $.removeData( target, "datepicker" );
  8256. if ( nodeName === "input" ) {
  8257. inst.append.remove();
  8258. inst.trigger.remove();
  8259. $target.removeClass( this.markerClassName ).
  8260. off( "focus", this._showDatepicker ).
  8261. off( "keydown", this._doKeyDown ).
  8262. off( "keypress", this._doKeyPress ).
  8263. off( "keyup", this._doKeyUp );
  8264. } else if ( nodeName === "div" || nodeName === "span" ) {
  8265. $target.removeClass( this.markerClassName ).empty();
  8266. }
  8267. if ( datepicker_instActive === inst ) {
  8268. datepicker_instActive = null;
  8269. }
  8270. },
  8271. /* Enable the date picker to a jQuery selection.
  8272. * @param target element - the target input field or division or span
  8273. */
  8274. _enableDatepicker: function( target ) {
  8275. var nodeName, inline,
  8276. $target = $( target ),
  8277. inst = $.data( target, "datepicker" );
  8278. if ( !$target.hasClass( this.markerClassName ) ) {
  8279. return;
  8280. }
  8281. nodeName = target.nodeName.toLowerCase();
  8282. if ( nodeName === "input" ) {
  8283. target.disabled = false;
  8284. inst.trigger.filter( "button" ).
  8285. each( function() { this.disabled = false; } ).end().
  8286. filter( "img" ).css( { opacity: "1.0", cursor: "" } );
  8287. } else if ( nodeName === "div" || nodeName === "span" ) {
  8288. inline = $target.children( "." + this._inlineClass );
  8289. inline.children().removeClass( "ui-state-disabled" );
  8290. inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ).
  8291. prop( "disabled", false );
  8292. }
  8293. this._disabledInputs = $.map( this._disabledInputs,
  8294. function( value ) { return ( value === target ? null : value ); } ); // delete entry
  8295. },
  8296. /* Disable the date picker to a jQuery selection.
  8297. * @param target element - the target input field or division or span
  8298. */
  8299. _disableDatepicker: function( target ) {
  8300. var nodeName, inline,
  8301. $target = $( target ),
  8302. inst = $.data( target, "datepicker" );
  8303. if ( !$target.hasClass( this.markerClassName ) ) {
  8304. return;
  8305. }
  8306. nodeName = target.nodeName.toLowerCase();
  8307. if ( nodeName === "input" ) {
  8308. target.disabled = true;
  8309. inst.trigger.filter( "button" ).
  8310. each( function() { this.disabled = true; } ).end().
  8311. filter( "img" ).css( { opacity: "0.5", cursor: "default" } );
  8312. } else if ( nodeName === "div" || nodeName === "span" ) {
  8313. inline = $target.children( "." + this._inlineClass );
  8314. inline.children().addClass( "ui-state-disabled" );
  8315. inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ).
  8316. prop( "disabled", true );
  8317. }
  8318. this._disabledInputs = $.map( this._disabledInputs,
  8319. function( value ) { return ( value === target ? null : value ); } ); // delete entry
  8320. this._disabledInputs[ this._disabledInputs.length ] = target;
  8321. },
  8322. /* Is the first field in a jQuery collection disabled as a datepicker?
  8323. * @param target element - the target input field or division or span
  8324. * @return boolean - true if disabled, false if enabled
  8325. */
  8326. _isDisabledDatepicker: function( target ) {
  8327. if ( !target ) {
  8328. return false;
  8329. }
  8330. for ( var i = 0; i < this._disabledInputs.length; i++ ) {
  8331. if ( this._disabledInputs[ i ] === target ) {
  8332. return true;
  8333. }
  8334. }
  8335. return false;
  8336. },
  8337. /* Retrieve the instance data for the target control.
  8338. * @param target element - the target input field or division or span
  8339. * @return object - the associated instance data
  8340. * @throws error if a jQuery problem getting data
  8341. */
  8342. _getInst: function( target ) {
  8343. try {
  8344. return $.data( target, "datepicker" );
  8345. }
  8346. catch ( err ) {
  8347. throw "Missing instance data for this datepicker";
  8348. }
  8349. },
  8350. /* Update or retrieve the settings for a date picker attached to an input field or division.
  8351. * @param target element - the target input field or division or span
  8352. * @param name object - the new settings to update or
  8353. * string - the name of the setting to change or retrieve,
  8354. * when retrieving also "all" for all instance settings or
  8355. * "defaults" for all global defaults
  8356. * @param value any - the new value for the setting
  8357. * (omit if above is an object or to retrieve a value)
  8358. */
  8359. _optionDatepicker: function( target, name, value ) {
  8360. var settings, date, minDate, maxDate,
  8361. inst = this._getInst( target );
  8362. if ( arguments.length === 2 && typeof name === "string" ) {
  8363. return ( name === "defaults" ? $.extend( {}, $.datepicker._defaults ) :
  8364. ( inst ? ( name === "all" ? $.extend( {}, inst.settings ) :
  8365. this._get( inst, name ) ) : null ) );
  8366. }
  8367. settings = name || {};
  8368. if ( typeof name === "string" ) {
  8369. settings = {};
  8370. settings[ name ] = value;
  8371. }
  8372. if ( inst ) {
  8373. if ( this._curInst === inst ) {
  8374. this._hideDatepicker();
  8375. }
  8376. date = this._getDateDatepicker( target, true );
  8377. minDate = this._getMinMaxDate( inst, "min" );
  8378. maxDate = this._getMinMaxDate( inst, "max" );
  8379. datepicker_extendRemove( inst.settings, settings );
  8380. // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
  8381. if ( minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined ) {
  8382. inst.settings.minDate = this._formatDate( inst, minDate );
  8383. }
  8384. if ( maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined ) {
  8385. inst.settings.maxDate = this._formatDate( inst, maxDate );
  8386. }
  8387. if ( "disabled" in settings ) {
  8388. if ( settings.disabled ) {
  8389. this._disableDatepicker( target );
  8390. } else {
  8391. this._enableDatepicker( target );
  8392. }
  8393. }
  8394. this._attachments( $( target ), inst );
  8395. this._autoSize( inst );
  8396. this._setDate( inst, date );
  8397. this._updateAlternate( inst );
  8398. this._updateDatepicker( inst );
  8399. }
  8400. },
  8401. // Change method deprecated
  8402. _changeDatepicker: function( target, name, value ) {
  8403. this._optionDatepicker( target, name, value );
  8404. },
  8405. /* Redraw the date picker attached to an input field or division.
  8406. * @param target element - the target input field or division or span
  8407. */
  8408. _refreshDatepicker: function( target ) {
  8409. var inst = this._getInst( target );
  8410. if ( inst ) {
  8411. this._updateDatepicker( inst );
  8412. }
  8413. },
  8414. /* Set the dates for a jQuery selection.
  8415. * @param target element - the target input field or division or span
  8416. * @param date Date - the new date
  8417. */
  8418. _setDateDatepicker: function( target, date ) {
  8419. var inst = this._getInst( target );
  8420. if ( inst ) {
  8421. this._setDate( inst, date );
  8422. this._updateDatepicker( inst );
  8423. this._updateAlternate( inst );
  8424. }
  8425. },
  8426. /* Get the date(s) for the first entry in a jQuery selection.
  8427. * @param target element - the target input field or division or span
  8428. * @param noDefault boolean - true if no default date is to be used
  8429. * @return Date - the current date
  8430. */
  8431. _getDateDatepicker: function( target, noDefault ) {
  8432. var inst = this._getInst( target );
  8433. if ( inst && !inst.inline ) {
  8434. this._setDateFromField( inst, noDefault );
  8435. }
  8436. return ( inst ? this._getDate( inst ) : null );
  8437. },
  8438. /* Handle keystrokes. */
  8439. _doKeyDown: function( event ) {
  8440. var onSelect, dateStr, sel,
  8441. inst = $.datepicker._getInst( event.target ),
  8442. handled = true,
  8443. isRTL = inst.dpDiv.is( ".ui-datepicker-rtl" );
  8444. inst._keyEvent = true;
  8445. if ( $.datepicker._datepickerShowing ) {
  8446. switch ( event.keyCode ) {
  8447. case 9: $.datepicker._hideDatepicker();
  8448. handled = false;
  8449. break; // hide on tab out
  8450. case 13: sel = $( "td." + $.datepicker._dayOverClass + ":not(." +
  8451. $.datepicker._currentClass + ")", inst.dpDiv );
  8452. if ( sel[ 0 ] ) {
  8453. $.datepicker._selectDay( event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ] );
  8454. }
  8455. onSelect = $.datepicker._get( inst, "onSelect" );
  8456. if ( onSelect ) {
  8457. dateStr = $.datepicker._formatDate( inst );
  8458. // Trigger custom callback
  8459. onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] );
  8460. } else {
  8461. $.datepicker._hideDatepicker();
  8462. }
  8463. return false; // don't submit the form
  8464. case 27: $.datepicker._hideDatepicker();
  8465. break; // hide on escape
  8466. case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
  8467. -$.datepicker._get( inst, "stepBigMonths" ) :
  8468. -$.datepicker._get( inst, "stepMonths" ) ), "M" );
  8469. break; // previous month/year on page up/+ ctrl
  8470. case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
  8471. +$.datepicker._get( inst, "stepBigMonths" ) :
  8472. +$.datepicker._get( inst, "stepMonths" ) ), "M" );
  8473. break; // next month/year on page down/+ ctrl
  8474. case 35: if ( event.ctrlKey || event.metaKey ) {
  8475. $.datepicker._clearDate( event.target );
  8476. }
  8477. handled = event.ctrlKey || event.metaKey;
  8478. break; // clear on ctrl or command +end
  8479. case 36: if ( event.ctrlKey || event.metaKey ) {
  8480. $.datepicker._gotoToday( event.target );
  8481. }
  8482. handled = event.ctrlKey || event.metaKey;
  8483. break; // current on ctrl or command +home
  8484. case 37: if ( event.ctrlKey || event.metaKey ) {
  8485. $.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" );
  8486. }
  8487. handled = event.ctrlKey || event.metaKey;
  8488. // -1 day on ctrl or command +left
  8489. if ( event.originalEvent.altKey ) {
  8490. $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
  8491. -$.datepicker._get( inst, "stepBigMonths" ) :
  8492. -$.datepicker._get( inst, "stepMonths" ) ), "M" );
  8493. }
  8494. // next month/year on alt +left on Mac
  8495. break;
  8496. case 38: if ( event.ctrlKey || event.metaKey ) {
  8497. $.datepicker._adjustDate( event.target, -7, "D" );
  8498. }
  8499. handled = event.ctrlKey || event.metaKey;
  8500. break; // -1 week on ctrl or command +up
  8501. case 39: if ( event.ctrlKey || event.metaKey ) {
  8502. $.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" );
  8503. }
  8504. handled = event.ctrlKey || event.metaKey;
  8505. // +1 day on ctrl or command +right
  8506. if ( event.originalEvent.altKey ) {
  8507. $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
  8508. +$.datepicker._get( inst, "stepBigMonths" ) :
  8509. +$.datepicker._get( inst, "stepMonths" ) ), "M" );
  8510. }
  8511. // next month/year on alt +right
  8512. break;
  8513. case 40: if ( event.ctrlKey || event.metaKey ) {
  8514. $.datepicker._adjustDate( event.target, +7, "D" );
  8515. }
  8516. handled = event.ctrlKey || event.metaKey;
  8517. break; // +1 week on ctrl or command +down
  8518. default: handled = false;
  8519. }
  8520. } else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home
  8521. $.datepicker._showDatepicker( this );
  8522. } else {
  8523. handled = false;
  8524. }
  8525. if ( handled ) {
  8526. event.preventDefault();
  8527. event.stopPropagation();
  8528. }
  8529. },
  8530. /* Filter entered characters - based on date format. */
  8531. _doKeyPress: function( event ) {
  8532. var chars, chr,
  8533. inst = $.datepicker._getInst( event.target );
  8534. if ( $.datepicker._get( inst, "constrainInput" ) ) {
  8535. chars = $.datepicker._possibleChars( $.datepicker._get( inst, "dateFormat" ) );
  8536. chr = String.fromCharCode( event.charCode == null ? event.keyCode : event.charCode );
  8537. return event.ctrlKey || event.metaKey || ( chr < " " || !chars || chars.indexOf( chr ) > -1 );
  8538. }
  8539. },
  8540. /* Synchronise manual entry and field/alternate field. */
  8541. _doKeyUp: function( event ) {
  8542. var date,
  8543. inst = $.datepicker._getInst( event.target );
  8544. if ( inst.input.val() !== inst.lastVal ) {
  8545. try {
  8546. date = $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ),
  8547. ( inst.input ? inst.input.val() : null ),
  8548. $.datepicker._getFormatConfig( inst ) );
  8549. if ( date ) { // only if valid
  8550. $.datepicker._setDateFromField( inst );
  8551. $.datepicker._updateAlternate( inst );
  8552. $.datepicker._updateDatepicker( inst );
  8553. }
  8554. }
  8555. catch ( err ) {
  8556. }
  8557. }
  8558. return true;
  8559. },
  8560. /* Pop-up the date picker for a given input field.
  8561. * If false returned from beforeShow event handler do not show.
  8562. * @param input element - the input field attached to the date picker or
  8563. * event - if triggered by focus
  8564. */
  8565. _showDatepicker: function( input ) {
  8566. input = input.target || input;
  8567. if ( input.nodeName.toLowerCase() !== "input" ) { // find from button/image trigger
  8568. input = $( "input", input.parentNode )[ 0 ];
  8569. }
  8570. if ( $.datepicker._isDisabledDatepicker( input ) || $.datepicker._lastInput === input ) { // already here
  8571. return;
  8572. }
  8573. var inst, beforeShow, beforeShowSettings, isFixed,
  8574. offset, showAnim, duration;
  8575. inst = $.datepicker._getInst( input );
  8576. if ( $.datepicker._curInst && $.datepicker._curInst !== inst ) {
  8577. $.datepicker._curInst.dpDiv.stop( true, true );
  8578. if ( inst && $.datepicker._datepickerShowing ) {
  8579. $.datepicker._hideDatepicker( $.datepicker._curInst.input[ 0 ] );
  8580. }
  8581. }
  8582. beforeShow = $.datepicker._get( inst, "beforeShow" );
  8583. beforeShowSettings = beforeShow ? beforeShow.apply( input, [ input, inst ] ) : {};
  8584. if ( beforeShowSettings === false ) {
  8585. return;
  8586. }
  8587. datepicker_extendRemove( inst.settings, beforeShowSettings );
  8588. inst.lastVal = null;
  8589. $.datepicker._lastInput = input;
  8590. $.datepicker._setDateFromField( inst );
  8591. if ( $.datepicker._inDialog ) { // hide cursor
  8592. input.value = "";
  8593. }
  8594. if ( !$.datepicker._pos ) { // position below input
  8595. $.datepicker._pos = $.datepicker._findPos( input );
  8596. $.datepicker._pos[ 1 ] += input.offsetHeight; // add the height
  8597. }
  8598. isFixed = false;
  8599. $( input ).parents().each( function() {
  8600. isFixed |= $( this ).css( "position" ) === "fixed";
  8601. return !isFixed;
  8602. } );
  8603. offset = { left: $.datepicker._pos[ 0 ], top: $.datepicker._pos[ 1 ] };
  8604. $.datepicker._pos = null;
  8605. //to avoid flashes on Firefox
  8606. inst.dpDiv.empty();
  8607. // determine sizing offscreen
  8608. inst.dpDiv.css( { position: "absolute", display: "block", top: "-1000px" } );
  8609. $.datepicker._updateDatepicker( inst );
  8610. // fix width for dynamic number of date pickers
  8611. // and adjust position before showing
  8612. offset = $.datepicker._checkOffset( inst, offset, isFixed );
  8613. inst.dpDiv.css( { position: ( $.datepicker._inDialog && $.blockUI ?
  8614. "static" : ( isFixed ? "fixed" : "absolute" ) ), display: "none",
  8615. left: offset.left + "px", top: offset.top + "px" } );
  8616. if ( !inst.inline ) {
  8617. showAnim = $.datepicker._get( inst, "showAnim" );
  8618. duration = $.datepicker._get( inst, "duration" );
  8619. inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 );
  8620. $.datepicker._datepickerShowing = true;
  8621. if ( $.effects && $.effects.effect[ showAnim ] ) {
  8622. inst.dpDiv.show( showAnim, $.datepicker._get( inst, "showOptions" ), duration );
  8623. } else {
  8624. inst.dpDiv[ showAnim || "show" ]( showAnim ? duration : null );
  8625. }
  8626. if ( $.datepicker._shouldFocusInput( inst ) ) {
  8627. inst.input.trigger( "focus" );
  8628. }
  8629. $.datepicker._curInst = inst;
  8630. }
  8631. },
  8632. /* Generate the date picker content. */
  8633. _updateDatepicker: function( inst ) {
  8634. this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
  8635. datepicker_instActive = inst; // for delegate hover events
  8636. inst.dpDiv.empty().append( this._generateHTML( inst ) );
  8637. this._attachHandlers( inst );
  8638. var origyearshtml,
  8639. numMonths = this._getNumberOfMonths( inst ),
  8640. cols = numMonths[ 1 ],
  8641. width = 17,
  8642. activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" );
  8643. if ( activeCell.length > 0 ) {
  8644. datepicker_handleMouseover.apply( activeCell.get( 0 ) );
  8645. }
  8646. inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" );
  8647. if ( cols > 1 ) {
  8648. inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" );
  8649. }
  8650. inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) +
  8651. "Class" ]( "ui-datepicker-multi" );
  8652. inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) +
  8653. "Class" ]( "ui-datepicker-rtl" );
  8654. if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) {
  8655. inst.input.trigger( "focus" );
  8656. }
  8657. // Deffered render of the years select (to avoid flashes on Firefox)
  8658. if ( inst.yearshtml ) {
  8659. origyearshtml = inst.yearshtml;
  8660. setTimeout( function() {
  8661. //assure that inst.yearshtml didn't change.
  8662. if ( origyearshtml === inst.yearshtml && inst.yearshtml ) {
  8663. inst.dpDiv.find( "select.ui-datepicker-year:first" ).replaceWith( inst.yearshtml );
  8664. }
  8665. origyearshtml = inst.yearshtml = null;
  8666. }, 0 );
  8667. }
  8668. },
  8669. // #6694 - don't focus the input if it's already focused
  8670. // this breaks the change event in IE
  8671. // Support: IE and jQuery <1.9
  8672. _shouldFocusInput: function( inst ) {
  8673. return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" );
  8674. },
  8675. /* Check positioning to remain on screen. */
  8676. _checkOffset: function( inst, offset, isFixed ) {
  8677. var dpWidth = inst.dpDiv.outerWidth(),
  8678. dpHeight = inst.dpDiv.outerHeight(),
  8679. inputWidth = inst.input ? inst.input.outerWidth() : 0,
  8680. inputHeight = inst.input ? inst.input.outerHeight() : 0,
  8681. viewWidth = document.documentElement.clientWidth + ( isFixed ? 0 : $( document ).scrollLeft() ),
  8682. viewHeight = document.documentElement.clientHeight + ( isFixed ? 0 : $( document ).scrollTop() );
  8683. offset.left -= ( this._get( inst, "isRTL" ) ? ( dpWidth - inputWidth ) : 0 );
  8684. offset.left -= ( isFixed && offset.left === inst.input.offset().left ) ? $( document ).scrollLeft() : 0;
  8685. offset.top -= ( isFixed && offset.top === ( inst.input.offset().top + inputHeight ) ) ? $( document ).scrollTop() : 0;
  8686. // Now check if datepicker is showing outside window viewport - move to a better place if so.
  8687. offset.left -= Math.min( offset.left, ( offset.left + dpWidth > viewWidth && viewWidth > dpWidth ) ?
  8688. Math.abs( offset.left + dpWidth - viewWidth ) : 0 );
  8689. offset.top -= Math.min( offset.top, ( offset.top + dpHeight > viewHeight && viewHeight > dpHeight ) ?
  8690. Math.abs( dpHeight + inputHeight ) : 0 );
  8691. return offset;
  8692. },
  8693. /* Find an object's position on the screen. */
  8694. _findPos: function( obj ) {
  8695. var position,
  8696. inst = this._getInst( obj ),
  8697. isRTL = this._get( inst, "isRTL" );
  8698. while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden( obj ) ) ) {
  8699. obj = obj[ isRTL ? "previousSibling" : "nextSibling" ];
  8700. }
  8701. position = $( obj ).offset();
  8702. return [ position.left, position.top ];
  8703. },
  8704. /* Hide the date picker from view.
  8705. * @param input element - the input field attached to the date picker
  8706. */
  8707. _hideDatepicker: function( input ) {
  8708. var showAnim, duration, postProcess, onClose,
  8709. inst = this._curInst;
  8710. if ( !inst || ( input && inst !== $.data( input, "datepicker" ) ) ) {
  8711. return;
  8712. }
  8713. if ( this._datepickerShowing ) {
  8714. showAnim = this._get( inst, "showAnim" );
  8715. duration = this._get( inst, "duration" );
  8716. postProcess = function() {
  8717. $.datepicker._tidyDialog( inst );
  8718. };
  8719. // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
  8720. if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) {
  8721. inst.dpDiv.hide( showAnim, $.datepicker._get( inst, "showOptions" ), duration, postProcess );
  8722. } else {
  8723. inst.dpDiv[ ( showAnim === "slideDown" ? "slideUp" :
  8724. ( showAnim === "fadeIn" ? "fadeOut" : "hide" ) ) ]( ( showAnim ? duration : null ), postProcess );
  8725. }
  8726. if ( !showAnim ) {
  8727. postProcess();
  8728. }
  8729. this._datepickerShowing = false;
  8730. onClose = this._get( inst, "onClose" );
  8731. if ( onClose ) {
  8732. onClose.apply( ( inst.input ? inst.input[ 0 ] : null ), [ ( inst.input ? inst.input.val() : "" ), inst ] );
  8733. }
  8734. this._lastInput = null;
  8735. if ( this._inDialog ) {
  8736. this._dialogInput.css( { position: "absolute", left: "0", top: "-100px" } );
  8737. if ( $.blockUI ) {
  8738. $.unblockUI();
  8739. $( "body" ).append( this.dpDiv );
  8740. }
  8741. }
  8742. this._inDialog = false;
  8743. }
  8744. },
  8745. /* Tidy up after a dialog display. */
  8746. _tidyDialog: function( inst ) {
  8747. inst.dpDiv.removeClass( this._dialogClass ).off( ".ui-datepicker-calendar" );
  8748. },
  8749. /* Close date picker if clicked elsewhere. */
  8750. _checkExternalClick: function( event ) {
  8751. if ( !$.datepicker._curInst ) {
  8752. return;
  8753. }
  8754. var $target = $( event.target ),
  8755. inst = $.datepicker._getInst( $target[ 0 ] );
  8756. if ( ( ( $target[ 0 ].id !== $.datepicker._mainDivId &&
  8757. $target.parents( "#" + $.datepicker._mainDivId ).length === 0 &&
  8758. !$target.hasClass( $.datepicker.markerClassName ) &&
  8759. !$target.closest( "." + $.datepicker._triggerClass ).length &&
  8760. $.datepicker._datepickerShowing && !( $.datepicker._inDialog && $.blockUI ) ) ) ||
  8761. ( $target.hasClass( $.datepicker.markerClassName ) && $.datepicker._curInst !== inst ) ) {
  8762. $.datepicker._hideDatepicker();
  8763. }
  8764. },
  8765. /* Adjust one of the date sub-fields. */
  8766. _adjustDate: function( id, offset, period ) {
  8767. var target = $( id ),
  8768. inst = this._getInst( target[ 0 ] );
  8769. if ( this._isDisabledDatepicker( target[ 0 ] ) ) {
  8770. return;
  8771. }
  8772. this._adjustInstDate( inst, offset +
  8773. ( period === "M" ? this._get( inst, "showCurrentAtPos" ) : 0 ), // undo positioning
  8774. period );
  8775. this._updateDatepicker( inst );
  8776. },
  8777. /* Action for current link. */
  8778. _gotoToday: function( id ) {
  8779. var date,
  8780. target = $( id ),
  8781. inst = this._getInst( target[ 0 ] );
  8782. if ( this._get( inst, "gotoCurrent" ) && inst.currentDay ) {
  8783. inst.selectedDay = inst.currentDay;
  8784. inst.drawMonth = inst.selectedMonth = inst.currentMonth;
  8785. inst.drawYear = inst.selectedYear = inst.currentYear;
  8786. } else {
  8787. date = new Date();
  8788. inst.selectedDay = date.getDate();
  8789. inst.drawMonth = inst.selectedMonth = date.getMonth();
  8790. inst.drawYear = inst.selectedYear = date.getFullYear();
  8791. }
  8792. this._notifyChange( inst );
  8793. this._adjustDate( target );
  8794. },
  8795. /* Action for selecting a new month/year. */
  8796. _selectMonthYear: function( id, select, period ) {
  8797. var target = $( id ),
  8798. inst = this._getInst( target[ 0 ] );
  8799. inst[ "selected" + ( period === "M" ? "Month" : "Year" ) ] =
  8800. inst[ "draw" + ( period === "M" ? "Month" : "Year" ) ] =
  8801. parseInt( select.options[ select.selectedIndex ].value, 10 );
  8802. this._notifyChange( inst );
  8803. this._adjustDate( target );
  8804. },
  8805. /* Action for selecting a day. */
  8806. _selectDay: function( id, month, year, td ) {
  8807. var inst,
  8808. target = $( id );
  8809. if ( $( td ).hasClass( this._unselectableClass ) || this._isDisabledDatepicker( target[ 0 ] ) ) {
  8810. return;
  8811. }
  8812. inst = this._getInst( target[ 0 ] );
  8813. inst.selectedDay = inst.currentDay = $( "a", td ).html();
  8814. inst.selectedMonth = inst.currentMonth = month;
  8815. inst.selectedYear = inst.currentYear = year;
  8816. this._selectDate( id, this._formatDate( inst,
  8817. inst.currentDay, inst.currentMonth, inst.currentYear ) );
  8818. },
  8819. /* Erase the input field and hide the date picker. */
  8820. _clearDate: function( id ) {
  8821. var target = $( id );
  8822. this._selectDate( target, "" );
  8823. },
  8824. /* Update the input field with the selected date. */
  8825. _selectDate: function( id, dateStr ) {
  8826. var onSelect,
  8827. target = $( id ),
  8828. inst = this._getInst( target[ 0 ] );
  8829. dateStr = ( dateStr != null ? dateStr : this._formatDate( inst ) );
  8830. if ( inst.input ) {
  8831. inst.input.val( dateStr );
  8832. }
  8833. this._updateAlternate( inst );
  8834. onSelect = this._get( inst, "onSelect" );
  8835. if ( onSelect ) {
  8836. onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); // trigger custom callback
  8837. } else if ( inst.input ) {
  8838. inst.input.trigger( "change" ); // fire the change event
  8839. }
  8840. if ( inst.inline ) {
  8841. this._updateDatepicker( inst );
  8842. } else {
  8843. this._hideDatepicker();
  8844. this._lastInput = inst.input[ 0 ];
  8845. if ( typeof( inst.input[ 0 ] ) !== "object" ) {
  8846. inst.input.trigger( "focus" ); // restore focus
  8847. }
  8848. this._lastInput = null;
  8849. }
  8850. },
  8851. /* Update any alternate field to synchronise with the main field. */
  8852. _updateAlternate: function( inst ) {
  8853. var altFormat, date, dateStr,
  8854. altField = this._get( inst, "altField" );
  8855. if ( altField ) { // update alternate field too
  8856. altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" );
  8857. date = this._getDate( inst );
  8858. dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) );
  8859. $( altField ).val( dateStr );
  8860. }
  8861. },
  8862. /* Set as beforeShowDay function to prevent selection of weekends.
  8863. * @param date Date - the date to customise
  8864. * @return [boolean, string] - is this date selectable?, what is its CSS class?
  8865. */
  8866. noWeekends: function( date ) {
  8867. var day = date.getDay();
  8868. return [ ( day > 0 && day < 6 ), "" ];
  8869. },
  8870. /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
  8871. * @param date Date - the date to get the week for
  8872. * @return number - the number of the week within the year that contains this date
  8873. */
  8874. iso8601Week: function( date ) {
  8875. var time,
  8876. checkDate = new Date( date.getTime() );
  8877. // Find Thursday of this week starting on Monday
  8878. checkDate.setDate( checkDate.getDate() + 4 - ( checkDate.getDay() || 7 ) );
  8879. time = checkDate.getTime();
  8880. checkDate.setMonth( 0 ); // Compare with Jan 1
  8881. checkDate.setDate( 1 );
  8882. return Math.floor( Math.round( ( time - checkDate ) / 86400000 ) / 7 ) + 1;
  8883. },
  8884. /* Parse a string value into a date object.
  8885. * See formatDate below for the possible formats.
  8886. *
  8887. * @param format string - the expected format of the date
  8888. * @param value string - the date in the above format
  8889. * @param settings Object - attributes include:
  8890. * shortYearCutoff number - the cutoff year for determining the century (optional)
  8891. * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
  8892. * dayNames string[7] - names of the days from Sunday (optional)
  8893. * monthNamesShort string[12] - abbreviated names of the months (optional)
  8894. * monthNames string[12] - names of the months (optional)
  8895. * @return Date - the extracted date value or null if value is blank
  8896. */
  8897. parseDate: function( format, value, settings ) {
  8898. if ( format == null || value == null ) {
  8899. throw "Invalid arguments";
  8900. }
  8901. value = ( typeof value === "object" ? value.toString() : value + "" );
  8902. if ( value === "" ) {
  8903. return null;
  8904. }
  8905. var iFormat, dim, extra,
  8906. iValue = 0,
  8907. shortYearCutoffTemp = ( settings ? settings.shortYearCutoff : null ) || this._defaults.shortYearCutoff,
  8908. shortYearCutoff = ( typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp :
  8909. new Date().getFullYear() % 100 + parseInt( shortYearCutoffTemp, 10 ) ),
  8910. dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort,
  8911. dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames,
  8912. monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort,
  8913. monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames,
  8914. year = -1,
  8915. month = -1,
  8916. day = -1,
  8917. doy = -1,
  8918. literal = false,
  8919. date,
  8920. // Check whether a format character is doubled
  8921. lookAhead = function( match ) {
  8922. var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
  8923. if ( matches ) {
  8924. iFormat++;
  8925. }
  8926. return matches;
  8927. },
  8928. // Extract a number from the string value
  8929. getNumber = function( match ) {
  8930. var isDoubled = lookAhead( match ),
  8931. size = ( match === "@" ? 14 : ( match === "!" ? 20 :
  8932. ( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ),
  8933. minSize = ( match === "y" ? size : 1 ),
  8934. digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ),
  8935. num = value.substring( iValue ).match( digits );
  8936. if ( !num ) {
  8937. throw "Missing number at position " + iValue;
  8938. }
  8939. iValue += num[ 0 ].length;
  8940. return parseInt( num[ 0 ], 10 );
  8941. },
  8942. // Extract a name from the string value and convert to an index
  8943. getName = function( match, shortNames, longNames ) {
  8944. var index = -1,
  8945. names = $.map( lookAhead( match ) ? longNames : shortNames, function( v, k ) {
  8946. return [ [ k, v ] ];
  8947. } ).sort( function( a, b ) {
  8948. return -( a[ 1 ].length - b[ 1 ].length );
  8949. } );
  8950. $.each( names, function( i, pair ) {
  8951. var name = pair[ 1 ];
  8952. if ( value.substr( iValue, name.length ).toLowerCase() === name.toLowerCase() ) {
  8953. index = pair[ 0 ];
  8954. iValue += name.length;
  8955. return false;
  8956. }
  8957. } );
  8958. if ( index !== -1 ) {
  8959. return index + 1;
  8960. } else {
  8961. throw "Unknown name at position " + iValue;
  8962. }
  8963. },
  8964. // Confirm that a literal character matches the string value
  8965. checkLiteral = function() {
  8966. if ( value.charAt( iValue ) !== format.charAt( iFormat ) ) {
  8967. throw "Unexpected literal at position " + iValue;
  8968. }
  8969. iValue++;
  8970. };
  8971. for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
  8972. if ( literal ) {
  8973. if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
  8974. literal = false;
  8975. } else {
  8976. checkLiteral();
  8977. }
  8978. } else {
  8979. switch ( format.charAt( iFormat ) ) {
  8980. case "d":
  8981. day = getNumber( "d" );
  8982. break;
  8983. case "D":
  8984. getName( "D", dayNamesShort, dayNames );
  8985. break;
  8986. case "o":
  8987. doy = getNumber( "o" );
  8988. break;
  8989. case "m":
  8990. month = getNumber( "m" );
  8991. break;
  8992. case "M":
  8993. month = getName( "M", monthNamesShort, monthNames );
  8994. break;
  8995. case "y":
  8996. year = getNumber( "y" );
  8997. break;
  8998. case "@":
  8999. date = new Date( getNumber( "@" ) );
  9000. year = date.getFullYear();
  9001. month = date.getMonth() + 1;
  9002. day = date.getDate();
  9003. break;
  9004. case "!":
  9005. date = new Date( ( getNumber( "!" ) - this._ticksTo1970 ) / 10000 );
  9006. year = date.getFullYear();
  9007. month = date.getMonth() + 1;
  9008. day = date.getDate();
  9009. break;
  9010. case "'":
  9011. if ( lookAhead( "'" ) ) {
  9012. checkLiteral();
  9013. } else {
  9014. literal = true;
  9015. }
  9016. break;
  9017. default:
  9018. checkLiteral();
  9019. }
  9020. }
  9021. }
  9022. if ( iValue < value.length ) {
  9023. extra = value.substr( iValue );
  9024. if ( !/^\s+/.test( extra ) ) {
  9025. throw "Extra/unparsed characters found in date: " + extra;
  9026. }
  9027. }
  9028. if ( year === -1 ) {
  9029. year = new Date().getFullYear();
  9030. } else if ( year < 100 ) {
  9031. year += new Date().getFullYear() - new Date().getFullYear() % 100 +
  9032. ( year <= shortYearCutoff ? 0 : -100 );
  9033. }
  9034. if ( doy > -1 ) {
  9035. month = 1;
  9036. day = doy;
  9037. do {
  9038. dim = this._getDaysInMonth( year, month - 1 );
  9039. if ( day <= dim ) {
  9040. break;
  9041. }
  9042. month++;
  9043. day -= dim;
  9044. } while ( true );
  9045. }
  9046. date = this._daylightSavingAdjust( new Date( year, month - 1, day ) );
  9047. if ( date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day ) {
  9048. throw "Invalid date"; // E.g. 31/02/00
  9049. }
  9050. return date;
  9051. },
  9052. /* Standard date formats. */
  9053. ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)
  9054. COOKIE: "D, dd M yy",
  9055. ISO_8601: "yy-mm-dd",
  9056. RFC_822: "D, d M y",
  9057. RFC_850: "DD, dd-M-y",
  9058. RFC_1036: "D, d M y",
  9059. RFC_1123: "D, d M yy",
  9060. RFC_2822: "D, d M yy",
  9061. RSS: "D, d M y", // RFC 822
  9062. TICKS: "!",
  9063. TIMESTAMP: "@",
  9064. W3C: "yy-mm-dd", // ISO 8601
  9065. _ticksTo1970: ( ( ( 1970 - 1 ) * 365 + Math.floor( 1970 / 4 ) - Math.floor( 1970 / 100 ) +
  9066. Math.floor( 1970 / 400 ) ) * 24 * 60 * 60 * 10000000 ),
  9067. /* Format a date object into a string value.
  9068. * The format can be combinations of the following:
  9069. * d - day of month (no leading zero)
  9070. * dd - day of month (two digit)
  9071. * o - day of year (no leading zeros)
  9072. * oo - day of year (three digit)
  9073. * D - day name short
  9074. * DD - day name long
  9075. * m - month of year (no leading zero)
  9076. * mm - month of year (two digit)
  9077. * M - month name short
  9078. * MM - month name long
  9079. * y - year (two digit)
  9080. * yy - year (four digit)
  9081. * @ - Unix timestamp (ms since 01/01/1970)
  9082. * ! - Windows ticks (100ns since 01/01/0001)
  9083. * "..." - literal text
  9084. * '' - single quote
  9085. *
  9086. * @param format string - the desired format of the date
  9087. * @param date Date - the date value to format
  9088. * @param settings Object - attributes include:
  9089. * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
  9090. * dayNames string[7] - names of the days from Sunday (optional)
  9091. * monthNamesShort string[12] - abbreviated names of the months (optional)
  9092. * monthNames string[12] - names of the months (optional)
  9093. * @return string - the date in the above format
  9094. */
  9095. formatDate: function( format, date, settings ) {
  9096. if ( !date ) {
  9097. return "";
  9098. }
  9099. var iFormat,
  9100. dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort,
  9101. dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames,
  9102. monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort,
  9103. monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames,
  9104. // Check whether a format character is doubled
  9105. lookAhead = function( match ) {
  9106. var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
  9107. if ( matches ) {
  9108. iFormat++;
  9109. }
  9110. return matches;
  9111. },
  9112. // Format a number, with leading zero if necessary
  9113. formatNumber = function( match, value, len ) {
  9114. var num = "" + value;
  9115. if ( lookAhead( match ) ) {
  9116. while ( num.length < len ) {
  9117. num = "0" + num;
  9118. }
  9119. }
  9120. return num;
  9121. },
  9122. // Format a name, short or long as requested
  9123. formatName = function( match, value, shortNames, longNames ) {
  9124. return ( lookAhead( match ) ? longNames[ value ] : shortNames[ value ] );
  9125. },
  9126. output = "",
  9127. literal = false;
  9128. if ( date ) {
  9129. for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
  9130. if ( literal ) {
  9131. if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
  9132. literal = false;
  9133. } else {
  9134. output += format.charAt( iFormat );
  9135. }
  9136. } else {
  9137. switch ( format.charAt( iFormat ) ) {
  9138. case "d":
  9139. output += formatNumber( "d", date.getDate(), 2 );
  9140. break;
  9141. case "D":
  9142. output += formatName( "D", date.getDay(), dayNamesShort, dayNames );
  9143. break;
  9144. case "o":
  9145. output += formatNumber( "o",
  9146. Math.round( ( new Date( date.getFullYear(), date.getMonth(), date.getDate() ).getTime() - new Date( date.getFullYear(), 0, 0 ).getTime() ) / 86400000 ), 3 );
  9147. break;
  9148. case "m":
  9149. output += formatNumber( "m", date.getMonth() + 1, 2 );
  9150. break;
  9151. case "M":
  9152. output += formatName( "M", date.getMonth(), monthNamesShort, monthNames );
  9153. break;
  9154. case "y":
  9155. output += ( lookAhead( "y" ) ? date.getFullYear() :
  9156. ( date.getFullYear() % 100 < 10 ? "0" : "" ) + date.getFullYear() % 100 );
  9157. break;
  9158. case "@":
  9159. output += date.getTime();
  9160. break;
  9161. case "!":
  9162. output += date.getTime() * 10000 + this._ticksTo1970;
  9163. break;
  9164. case "'":
  9165. if ( lookAhead( "'" ) ) {
  9166. output += "'";
  9167. } else {
  9168. literal = true;
  9169. }
  9170. break;
  9171. default:
  9172. output += format.charAt( iFormat );
  9173. }
  9174. }
  9175. }
  9176. }
  9177. return output;
  9178. },
  9179. /* Extract all possible characters from the date format. */
  9180. _possibleChars: function( format ) {
  9181. var iFormat,
  9182. chars = "",
  9183. literal = false,
  9184. // Check whether a format character is doubled
  9185. lookAhead = function( match ) {
  9186. var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
  9187. if ( matches ) {
  9188. iFormat++;
  9189. }
  9190. return matches;
  9191. };
  9192. for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
  9193. if ( literal ) {
  9194. if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
  9195. literal = false;
  9196. } else {
  9197. chars += format.charAt( iFormat );
  9198. }
  9199. } else {
  9200. switch ( format.charAt( iFormat ) ) {
  9201. case "d": case "m": case "y": case "@":
  9202. chars += "0123456789";
  9203. break;
  9204. case "D": case "M":
  9205. return null; // Accept anything
  9206. case "'":
  9207. if ( lookAhead( "'" ) ) {
  9208. chars += "'";
  9209. } else {
  9210. literal = true;
  9211. }
  9212. break;
  9213. default:
  9214. chars += format.charAt( iFormat );
  9215. }
  9216. }
  9217. }
  9218. return chars;
  9219. },
  9220. /* Get a setting value, defaulting if necessary. */
  9221. _get: function( inst, name ) {
  9222. return inst.settings[ name ] !== undefined ?
  9223. inst.settings[ name ] : this._defaults[ name ];
  9224. },
  9225. /* Parse existing date and initialise date picker. */
  9226. _setDateFromField: function( inst, noDefault ) {
  9227. if ( inst.input.val() === inst.lastVal ) {
  9228. return;
  9229. }
  9230. var dateFormat = this._get( inst, "dateFormat" ),
  9231. dates = inst.lastVal = inst.input ? inst.input.val() : null,
  9232. defaultDate = this._getDefaultDate( inst ),
  9233. date = defaultDate,
  9234. settings = this._getFormatConfig( inst );
  9235. try {
  9236. date = this.parseDate( dateFormat, dates, settings ) || defaultDate;
  9237. } catch ( event ) {
  9238. dates = ( noDefault ? "" : dates );
  9239. }
  9240. inst.selectedDay = date.getDate();
  9241. inst.drawMonth = inst.selectedMonth = date.getMonth();
  9242. inst.drawYear = inst.selectedYear = date.getFullYear();
  9243. inst.currentDay = ( dates ? date.getDate() : 0 );
  9244. inst.currentMonth = ( dates ? date.getMonth() : 0 );
  9245. inst.currentYear = ( dates ? date.getFullYear() : 0 );
  9246. this._adjustInstDate( inst );
  9247. },
  9248. /* Retrieve the default date shown on opening. */
  9249. _getDefaultDate: function( inst ) {
  9250. return this._restrictMinMax( inst,
  9251. this._determineDate( inst, this._get( inst, "defaultDate" ), new Date() ) );
  9252. },
  9253. /* A date may be specified as an exact value or a relative one. */
  9254. _determineDate: function( inst, date, defaultDate ) {
  9255. var offsetNumeric = function( offset ) {
  9256. var date = new Date();
  9257. date.setDate( date.getDate() + offset );
  9258. return date;
  9259. },
  9260. offsetString = function( offset ) {
  9261. try {
  9262. return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ),
  9263. offset, $.datepicker._getFormatConfig( inst ) );
  9264. }
  9265. catch ( e ) {
  9266. // Ignore
  9267. }
  9268. var date = ( offset.toLowerCase().match( /^c/ ) ?
  9269. $.datepicker._getDate( inst ) : null ) || new Date(),
  9270. year = date.getFullYear(),
  9271. month = date.getMonth(),
  9272. day = date.getDate(),
  9273. pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
  9274. matches = pattern.exec( offset );
  9275. while ( matches ) {
  9276. switch ( matches[ 2 ] || "d" ) {
  9277. case "d" : case "D" :
  9278. day += parseInt( matches[ 1 ], 10 ); break;
  9279. case "w" : case "W" :
  9280. day += parseInt( matches[ 1 ], 10 ) * 7; break;
  9281. case "m" : case "M" :
  9282. month += parseInt( matches[ 1 ], 10 );
  9283. day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) );
  9284. break;
  9285. case "y": case "Y" :
  9286. year += parseInt( matches[ 1 ], 10 );
  9287. day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) );
  9288. break;
  9289. }
  9290. matches = pattern.exec( offset );
  9291. }
  9292. return new Date( year, month, day );
  9293. },
  9294. newDate = ( date == null || date === "" ? defaultDate : ( typeof date === "string" ? offsetString( date ) :
  9295. ( typeof date === "number" ? ( isNaN( date ) ? defaultDate : offsetNumeric( date ) ) : new Date( date.getTime() ) ) ) );
  9296. newDate = ( newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate );
  9297. if ( newDate ) {
  9298. newDate.setHours( 0 );
  9299. newDate.setMinutes( 0 );
  9300. newDate.setSeconds( 0 );
  9301. newDate.setMilliseconds( 0 );
  9302. }
  9303. return this._daylightSavingAdjust( newDate );
  9304. },
  9305. /* Handle switch to/from daylight saving.
  9306. * Hours may be non-zero on daylight saving cut-over:
  9307. * > 12 when midnight changeover, but then cannot generate
  9308. * midnight datetime, so jump to 1AM, otherwise reset.
  9309. * @param date (Date) the date to check
  9310. * @return (Date) the corrected date
  9311. */
  9312. _daylightSavingAdjust: function( date ) {
  9313. if ( !date ) {
  9314. return null;
  9315. }
  9316. date.setHours( date.getHours() > 12 ? date.getHours() + 2 : 0 );
  9317. return date;
  9318. },
  9319. /* Set the date(s) directly. */
  9320. _setDate: function( inst, date, noChange ) {
  9321. var clear = !date,
  9322. origMonth = inst.selectedMonth,
  9323. origYear = inst.selectedYear,
  9324. newDate = this._restrictMinMax( inst, this._determineDate( inst, date, new Date() ) );
  9325. inst.selectedDay = inst.currentDay = newDate.getDate();
  9326. inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
  9327. inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
  9328. if ( ( origMonth !== inst.selectedMonth || origYear !== inst.selectedYear ) && !noChange ) {
  9329. this._notifyChange( inst );
  9330. }
  9331. this._adjustInstDate( inst );
  9332. if ( inst.input ) {
  9333. inst.input.val( clear ? "" : this._formatDate( inst ) );
  9334. }
  9335. },
  9336. /* Retrieve the date(s) directly. */
  9337. _getDate: function( inst ) {
  9338. var startDate = ( !inst.currentYear || ( inst.input && inst.input.val() === "" ) ? null :
  9339. this._daylightSavingAdjust( new Date(
  9340. inst.currentYear, inst.currentMonth, inst.currentDay ) ) );
  9341. return startDate;
  9342. },
  9343. /* Attach the onxxx handlers. These are declared statically so
  9344. * they work with static code transformers like Caja.
  9345. */
  9346. _attachHandlers: function( inst ) {
  9347. var stepMonths = this._get( inst, "stepMonths" ),
  9348. id = "#" + inst.id.replace( /\\\\/g, "\\" );
  9349. inst.dpDiv.find( "[data-handler]" ).map( function() {
  9350. var handler = {
  9351. prev: function() {
  9352. $.datepicker._adjustDate( id, -stepMonths, "M" );
  9353. },
  9354. next: function() {
  9355. $.datepicker._adjustDate( id, +stepMonths, "M" );
  9356. },
  9357. hide: function() {
  9358. $.datepicker._hideDatepicker();
  9359. },
  9360. today: function() {
  9361. $.datepicker._gotoToday( id );
  9362. },
  9363. selectDay: function() {
  9364. $.datepicker._selectDay( id, +this.getAttribute( "data-month" ), +this.getAttribute( "data-year" ), this );
  9365. return false;
  9366. },
  9367. selectMonth: function() {
  9368. $.datepicker._selectMonthYear( id, this, "M" );
  9369. return false;
  9370. },
  9371. selectYear: function() {
  9372. $.datepicker._selectMonthYear( id, this, "Y" );
  9373. return false;
  9374. }
  9375. };
  9376. $( this ).on( this.getAttribute( "data-event" ), handler[ this.getAttribute( "data-handler" ) ] );
  9377. } );
  9378. },
  9379. /* Generate the HTML for the current state of the date picker. */
  9380. _generateHTML: function( inst ) {
  9381. var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
  9382. controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
  9383. monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
  9384. selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
  9385. cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,
  9386. printDate, dRow, tbody, daySettings, otherMonth, unselectable,
  9387. tempDate = new Date(),
  9388. today = this._daylightSavingAdjust(
  9389. new Date( tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate() ) ), // clear time
  9390. isRTL = this._get( inst, "isRTL" ),
  9391. showButtonPanel = this._get( inst, "showButtonPanel" ),
  9392. hideIfNoPrevNext = this._get( inst, "hideIfNoPrevNext" ),
  9393. navigationAsDateFormat = this._get( inst, "navigationAsDateFormat" ),
  9394. numMonths = this._getNumberOfMonths( inst ),
  9395. showCurrentAtPos = this._get( inst, "showCurrentAtPos" ),
  9396. stepMonths = this._get( inst, "stepMonths" ),
  9397. isMultiMonth = ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ),
  9398. currentDate = this._daylightSavingAdjust( ( !inst.currentDay ? new Date( 9999, 9, 9 ) :
  9399. new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ),
  9400. minDate = this._getMinMaxDate( inst, "min" ),
  9401. maxDate = this._getMinMaxDate( inst, "max" ),
  9402. drawMonth = inst.drawMonth - showCurrentAtPos,
  9403. drawYear = inst.drawYear;
  9404. if ( drawMonth < 0 ) {
  9405. drawMonth += 12;
  9406. drawYear--;
  9407. }
  9408. if ( maxDate ) {
  9409. maxDraw = this._daylightSavingAdjust( new Date( maxDate.getFullYear(),
  9410. maxDate.getMonth() - ( numMonths[ 0 ] * numMonths[ 1 ] ) + 1, maxDate.getDate() ) );
  9411. maxDraw = ( minDate && maxDraw < minDate ? minDate : maxDraw );
  9412. while ( this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 ) ) > maxDraw ) {
  9413. drawMonth--;
  9414. if ( drawMonth < 0 ) {
  9415. drawMonth = 11;
  9416. drawYear--;
  9417. }
  9418. }
  9419. }
  9420. inst.drawMonth = drawMonth;
  9421. inst.drawYear = drawYear;
  9422. prevText = this._get( inst, "prevText" );
  9423. prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText,
  9424. this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ),
  9425. this._getFormatConfig( inst ) ) );
  9426. prev = ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ?
  9427. "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" +
  9428. " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w" ) + "'>" + prevText + "</span></a>" :
  9429. ( hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w" ) + "'>" + prevText + "</span></a>" ) );
  9430. nextText = this._get( inst, "nextText" );
  9431. nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText,
  9432. this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ),
  9433. this._getFormatConfig( inst ) ) );
  9434. next = ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ?
  9435. "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" +
  9436. " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e" ) + "'>" + nextText + "</span></a>" :
  9437. ( hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e" ) + "'>" + nextText + "</span></a>" ) );
  9438. currentText = this._get( inst, "currentText" );
  9439. gotoDate = ( this._get( inst, "gotoCurrent" ) && inst.currentDay ? currentDate : today );
  9440. currentText = ( !navigationAsDateFormat ? currentText :
  9441. this.formatDate( currentText, gotoDate, this._getFormatConfig( inst ) ) );
  9442. controls = ( !inst.inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" +
  9443. this._get( inst, "closeText" ) + "</button>" : "" );
  9444. buttonPanel = ( showButtonPanel ) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + ( isRTL ? controls : "" ) +
  9445. ( this._isInRange( inst, gotoDate ) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" +
  9446. ">" + currentText + "</button>" : "" ) + ( isRTL ? "" : controls ) + "</div>" : "";
  9447. firstDay = parseInt( this._get( inst, "firstDay" ), 10 );
  9448. firstDay = ( isNaN( firstDay ) ? 0 : firstDay );
  9449. showWeek = this._get( inst, "showWeek" );
  9450. dayNames = this._get( inst, "dayNames" );
  9451. dayNamesMin = this._get( inst, "dayNamesMin" );
  9452. monthNames = this._get( inst, "monthNames" );
  9453. monthNamesShort = this._get( inst, "monthNamesShort" );
  9454. beforeShowDay = this._get( inst, "beforeShowDay" );
  9455. showOtherMonths = this._get( inst, "showOtherMonths" );
  9456. selectOtherMonths = this._get( inst, "selectOtherMonths" );
  9457. defaultDate = this._getDefaultDate( inst );
  9458. html = "";
  9459. for ( row = 0; row < numMonths[ 0 ]; row++ ) {
  9460. group = "";
  9461. this.maxRows = 4;
  9462. for ( col = 0; col < numMonths[ 1 ]; col++ ) {
  9463. selectedDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, inst.selectedDay ) );
  9464. cornerClass = " ui-corner-all";
  9465. calender = "";
  9466. if ( isMultiMonth ) {
  9467. calender += "<div class='ui-datepicker-group";
  9468. if ( numMonths[ 1 ] > 1 ) {
  9469. switch ( col ) {
  9470. case 0: calender += " ui-datepicker-group-first";
  9471. cornerClass = " ui-corner-" + ( isRTL ? "right" : "left" ); break;
  9472. case numMonths[ 1 ] - 1: calender += " ui-datepicker-group-last";
  9473. cornerClass = " ui-corner-" + ( isRTL ? "left" : "right" ); break;
  9474. default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break;
  9475. }
  9476. }
  9477. calender += "'>";
  9478. }
  9479. calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" +
  9480. ( /all|left/.test( cornerClass ) && row === 0 ? ( isRTL ? next : prev ) : "" ) +
  9481. ( /all|right/.test( cornerClass ) && row === 0 ? ( isRTL ? prev : next ) : "" ) +
  9482. this._generateMonthYearHeader( inst, drawMonth, drawYear, minDate, maxDate,
  9483. row > 0 || col > 0, monthNames, monthNamesShort ) + // draw month headers
  9484. "</div><table class='ui-datepicker-calendar'><thead>" +
  9485. "<tr>";
  9486. thead = ( showWeek ? "<th class='ui-datepicker-week-col'>" + this._get( inst, "weekHeader" ) + "</th>" : "" );
  9487. for ( dow = 0; dow < 7; dow++ ) { // days of the week
  9488. day = ( dow + firstDay ) % 7;
  9489. thead += "<th scope='col'" + ( ( dow + firstDay + 6 ) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "" ) + ">" +
  9490. "<span title='" + dayNames[ day ] + "'>" + dayNamesMin[ day ] + "</span></th>";
  9491. }
  9492. calender += thead + "</tr></thead><tbody>";
  9493. daysInMonth = this._getDaysInMonth( drawYear, drawMonth );
  9494. if ( drawYear === inst.selectedYear && drawMonth === inst.selectedMonth ) {
  9495. inst.selectedDay = Math.min( inst.selectedDay, daysInMonth );
  9496. }
  9497. leadDays = ( this._getFirstDayOfMonth( drawYear, drawMonth ) - firstDay + 7 ) % 7;
  9498. curRows = Math.ceil( ( leadDays + daysInMonth ) / 7 ); // calculate the number of rows to generate
  9499. numRows = ( isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows ); //If multiple months, use the higher number of rows (see #7043)
  9500. this.maxRows = numRows;
  9501. printDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 - leadDays ) );
  9502. for ( dRow = 0; dRow < numRows; dRow++ ) { // create date picker rows
  9503. calender += "<tr>";
  9504. tbody = ( !showWeek ? "" : "<td class='ui-datepicker-week-col'>" +
  9505. this._get( inst, "calculateWeek" )( printDate ) + "</td>" );
  9506. for ( dow = 0; dow < 7; dow++ ) { // create date picker days
  9507. daySettings = ( beforeShowDay ?
  9508. beforeShowDay.apply( ( inst.input ? inst.input[ 0 ] : null ), [ printDate ] ) : [ true, "" ] );
  9509. otherMonth = ( printDate.getMonth() !== drawMonth );
  9510. unselectable = ( otherMonth && !selectOtherMonths ) || !daySettings[ 0 ] ||
  9511. ( minDate && printDate < minDate ) || ( maxDate && printDate > maxDate );
  9512. tbody += "<td class='" +
  9513. ( ( dow + firstDay + 6 ) % 7 >= 5 ? " ui-datepicker-week-end" : "" ) + // highlight weekends
  9514. ( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months
  9515. ( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key
  9516. ( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ?
  9517. // or defaultDate is current printedDate and defaultDate is selectedDate
  9518. " " + this._dayOverClass : "" ) + // highlight selected day
  9519. ( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) + // highlight unselectable days
  9520. ( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates
  9521. ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day
  9522. ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different)
  9523. ( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "&#39;" ) + "'" : "" ) + // cell title
  9524. ( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions
  9525. ( otherMonth && !showOtherMonths ? "&#xa0;" : // display for other months
  9526. ( unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" +
  9527. ( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) +
  9528. ( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day
  9529. ( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months
  9530. "' href='#'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date
  9531. printDate.setDate( printDate.getDate() + 1 );
  9532. printDate = this._daylightSavingAdjust( printDate );
  9533. }
  9534. calender += tbody + "</tr>";
  9535. }
  9536. drawMonth++;
  9537. if ( drawMonth > 11 ) {
  9538. drawMonth = 0;
  9539. drawYear++;
  9540. }
  9541. calender += "</tbody></table>" + ( isMultiMonth ? "</div>" +
  9542. ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "<div class='ui-datepicker-row-break'></div>" : "" ) : "" );
  9543. group += calender;
  9544. }
  9545. html += group;
  9546. }
  9547. html += buttonPanel;
  9548. inst._keyEvent = false;
  9549. return html;
  9550. },
  9551. /* Generate the month and year header. */
  9552. _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate,
  9553. secondary, monthNames, monthNamesShort ) {
  9554. var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
  9555. changeMonth = this._get( inst, "changeMonth" ),
  9556. changeYear = this._get( inst, "changeYear" ),
  9557. showMonthAfterYear = this._get( inst, "showMonthAfterYear" ),
  9558. html = "<div class='ui-datepicker-title'>",
  9559. monthHtml = "";
  9560. // Month selection
  9561. if ( secondary || !changeMonth ) {
  9562. monthHtml += "<span class='ui-datepicker-month'>" + monthNames[ drawMonth ] + "</span>";
  9563. } else {
  9564. inMinYear = ( minDate && minDate.getFullYear() === drawYear );
  9565. inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear );
  9566. monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";
  9567. for ( month = 0; month < 12; month++ ) {
  9568. if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) {
  9569. monthHtml += "<option value='" + month + "'" +
  9570. ( month === drawMonth ? " selected='selected'" : "" ) +
  9571. ">" + monthNamesShort[ month ] + "</option>";
  9572. }
  9573. }
  9574. monthHtml += "</select>";
  9575. }
  9576. if ( !showMonthAfterYear ) {
  9577. html += monthHtml + ( secondary || !( changeMonth && changeYear ) ? "&#xa0;" : "" );
  9578. }
  9579. // Year selection
  9580. if ( !inst.yearshtml ) {
  9581. inst.yearshtml = "";
  9582. if ( secondary || !changeYear ) {
  9583. html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";
  9584. } else {
  9585. // determine range of years to display
  9586. years = this._get( inst, "yearRange" ).split( ":" );
  9587. thisYear = new Date().getFullYear();
  9588. determineYear = function( value ) {
  9589. var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) :
  9590. ( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) :
  9591. parseInt( value, 10 ) ) );
  9592. return ( isNaN( year ) ? thisYear : year );
  9593. };
  9594. year = determineYear( years[ 0 ] );
  9595. endYear = Math.max( year, determineYear( years[ 1 ] || "" ) );
  9596. year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year );
  9597. endYear = ( maxDate ? Math.min( endYear, maxDate.getFullYear() ) : endYear );
  9598. inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";
  9599. for ( ; year <= endYear; year++ ) {
  9600. inst.yearshtml += "<option value='" + year + "'" +
  9601. ( year === drawYear ? " selected='selected'" : "" ) +
  9602. ">" + year + "</option>";
  9603. }
  9604. inst.yearshtml += "</select>";
  9605. html += inst.yearshtml;
  9606. inst.yearshtml = null;
  9607. }
  9608. }
  9609. html += this._get( inst, "yearSuffix" );
  9610. if ( showMonthAfterYear ) {
  9611. html += ( secondary || !( changeMonth && changeYear ) ? "&#xa0;" : "" ) + monthHtml;
  9612. }
  9613. html += "</div>"; // Close datepicker_header
  9614. return html;
  9615. },
  9616. /* Adjust one of the date sub-fields. */
  9617. _adjustInstDate: function( inst, offset, period ) {
  9618. var year = inst.selectedYear + ( period === "Y" ? offset : 0 ),
  9619. month = inst.selectedMonth + ( period === "M" ? offset : 0 ),
  9620. day = Math.min( inst.selectedDay, this._getDaysInMonth( year, month ) ) + ( period === "D" ? offset : 0 ),
  9621. date = this._restrictMinMax( inst, this._daylightSavingAdjust( new Date( year, month, day ) ) );
  9622. inst.selectedDay = date.getDate();
  9623. inst.drawMonth = inst.selectedMonth = date.getMonth();
  9624. inst.drawYear = inst.selectedYear = date.getFullYear();
  9625. if ( period === "M" || period === "Y" ) {
  9626. this._notifyChange( inst );
  9627. }
  9628. },
  9629. /* Ensure a date is within any min/max bounds. */
  9630. _restrictMinMax: function( inst, date ) {
  9631. var minDate = this._getMinMaxDate( inst, "min" ),
  9632. maxDate = this._getMinMaxDate( inst, "max" ),
  9633. newDate = ( minDate && date < minDate ? minDate : date );
  9634. return ( maxDate && newDate > maxDate ? maxDate : newDate );
  9635. },
  9636. /* Notify change of month/year. */
  9637. _notifyChange: function( inst ) {
  9638. var onChange = this._get( inst, "onChangeMonthYear" );
  9639. if ( onChange ) {
  9640. onChange.apply( ( inst.input ? inst.input[ 0 ] : null ),
  9641. [ inst.selectedYear, inst.selectedMonth + 1, inst ] );
  9642. }
  9643. },
  9644. /* Determine the number of months to show. */
  9645. _getNumberOfMonths: function( inst ) {
  9646. var numMonths = this._get( inst, "numberOfMonths" );
  9647. return ( numMonths == null ? [ 1, 1 ] : ( typeof numMonths === "number" ? [ 1, numMonths ] : numMonths ) );
  9648. },
  9649. /* Determine the current maximum date - ensure no time components are set. */
  9650. _getMinMaxDate: function( inst, minMax ) {
  9651. return this._determineDate( inst, this._get( inst, minMax + "Date" ), null );
  9652. },
  9653. /* Find the number of days in a given month. */
  9654. _getDaysInMonth: function( year, month ) {
  9655. return 32 - this._daylightSavingAdjust( new Date( year, month, 32 ) ).getDate();
  9656. },
  9657. /* Find the day of the week of the first of a month. */
  9658. _getFirstDayOfMonth: function( year, month ) {
  9659. return new Date( year, month, 1 ).getDay();
  9660. },
  9661. /* Determines if we should allow a "next/prev" month display change. */
  9662. _canAdjustMonth: function( inst, offset, curYear, curMonth ) {
  9663. var numMonths = this._getNumberOfMonths( inst ),
  9664. date = this._daylightSavingAdjust( new Date( curYear,
  9665. curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) );
  9666. if ( offset < 0 ) {
  9667. date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) );
  9668. }
  9669. return this._isInRange( inst, date );
  9670. },
  9671. /* Is the given date in the accepted range? */
  9672. _isInRange: function( inst, date ) {
  9673. var yearSplit, currentYear,
  9674. minDate = this._getMinMaxDate( inst, "min" ),
  9675. maxDate = this._getMinMaxDate( inst, "max" ),
  9676. minYear = null,
  9677. maxYear = null,
  9678. years = this._get( inst, "yearRange" );
  9679. if ( years ) {
  9680. yearSplit = years.split( ":" );
  9681. currentYear = new Date().getFullYear();
  9682. minYear = parseInt( yearSplit[ 0 ], 10 );
  9683. maxYear = parseInt( yearSplit[ 1 ], 10 );
  9684. if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) {
  9685. minYear += currentYear;
  9686. }
  9687. if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) {
  9688. maxYear += currentYear;
  9689. }
  9690. }
  9691. return ( ( !minDate || date.getTime() >= minDate.getTime() ) &&
  9692. ( !maxDate || date.getTime() <= maxDate.getTime() ) &&
  9693. ( !minYear || date.getFullYear() >= minYear ) &&
  9694. ( !maxYear || date.getFullYear() <= maxYear ) );
  9695. },
  9696. /* Provide the configuration settings for formatting/parsing. */
  9697. _getFormatConfig: function( inst ) {
  9698. var shortYearCutoff = this._get( inst, "shortYearCutoff" );
  9699. shortYearCutoff = ( typeof shortYearCutoff !== "string" ? shortYearCutoff :
  9700. new Date().getFullYear() % 100 + parseInt( shortYearCutoff, 10 ) );
  9701. return { shortYearCutoff: shortYearCutoff,
  9702. dayNamesShort: this._get( inst, "dayNamesShort" ), dayNames: this._get( inst, "dayNames" ),
  9703. monthNamesShort: this._get( inst, "monthNamesShort" ), monthNames: this._get( inst, "monthNames" ) };
  9704. },
  9705. /* Format the given date for display. */
  9706. _formatDate: function( inst, day, month, year ) {
  9707. if ( !day ) {
  9708. inst.currentDay = inst.selectedDay;
  9709. inst.currentMonth = inst.selectedMonth;
  9710. inst.currentYear = inst.selectedYear;
  9711. }
  9712. var date = ( day ? ( typeof day === "object" ? day :
  9713. this._daylightSavingAdjust( new Date( year, month, day ) ) ) :
  9714. this._daylightSavingAdjust( new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) );
  9715. return this.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) );
  9716. }
  9717. } );
  9718. /*
  9719. * Bind hover events for datepicker elements.
  9720. * Done via delegate so the binding only occurs once in the lifetime of the parent div.
  9721. * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
  9722. */
  9723. function datepicker_bindHover( dpDiv ) {
  9724. var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
  9725. return dpDiv.on( "mouseout", selector, function() {
  9726. $( this ).removeClass( "ui-state-hover" );
  9727. if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) {
  9728. $( this ).removeClass( "ui-datepicker-prev-hover" );
  9729. }
  9730. if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) {
  9731. $( this ).removeClass( "ui-datepicker-next-hover" );
  9732. }
  9733. } )
  9734. .on( "mouseover", selector, datepicker_handleMouseover );
  9735. }
  9736. function datepicker_handleMouseover() {
  9737. if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) {
  9738. $( this ).parents( ".ui-datepicker-calendar" ).find( "a" ).removeClass( "ui-state-hover" );
  9739. $( this ).addClass( "ui-state-hover" );
  9740. if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) {
  9741. $( this ).addClass( "ui-datepicker-prev-hover" );
  9742. }
  9743. if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) {
  9744. $( this ).addClass( "ui-datepicker-next-hover" );
  9745. }
  9746. }
  9747. }
  9748. /* jQuery extend now ignores nulls! */
  9749. function datepicker_extendRemove( target, props ) {
  9750. $.extend( target, props );
  9751. for ( var name in props ) {
  9752. if ( props[ name ] == null ) {
  9753. target[ name ] = props[ name ];
  9754. }
  9755. }
  9756. return target;
  9757. }
  9758. /* Invoke the datepicker functionality.
  9759. @param options string - a command, optionally followed by additional parameters or
  9760. Object - settings for attaching new datepicker functionality
  9761. @return jQuery object */
  9762. $.fn.datepicker = function( options ) {
  9763. /* Verify an empty collection wasn't passed - Fixes #6976 */
  9764. if ( !this.length ) {
  9765. return this;
  9766. }
  9767. /* Initialise the date picker. */
  9768. if ( !$.datepicker.initialized ) {
  9769. $( document ).on( "mousedown", $.datepicker._checkExternalClick );
  9770. $.datepicker.initialized = true;
  9771. }
  9772. /* Append datepicker main container to body if not exist. */
  9773. if ( $( "#" + $.datepicker._mainDivId ).length === 0 ) {
  9774. $( "body" ).append( $.datepicker.dpDiv );
  9775. }
  9776. var otherArgs = Array.prototype.slice.call( arguments, 1 );
  9777. if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) {
  9778. return $.datepicker[ "_" + options + "Datepicker" ].
  9779. apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) );
  9780. }
  9781. if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) {
  9782. return $.datepicker[ "_" + options + "Datepicker" ].
  9783. apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) );
  9784. }
  9785. return this.each( function() {
  9786. typeof options === "string" ?
  9787. $.datepicker[ "_" + options + "Datepicker" ].
  9788. apply( $.datepicker, [ this ].concat( otherArgs ) ) :
  9789. $.datepicker._attachDatepicker( this, options );
  9790. } );
  9791. };
  9792. $.datepicker = new Datepicker(); // singleton instance
  9793. $.datepicker.initialized = false;
  9794. $.datepicker.uuid = new Date().getTime();
  9795. $.datepicker.version = "1.12.1";
  9796. var widgetsDatepicker = $.datepicker;
  9797. /*!
  9798. * jQuery UI Dialog 1.12.1
  9799. * http://jqueryui.com
  9800. *
  9801. * Copyright jQuery Foundation and other contributors
  9802. * Released under the MIT license.
  9803. * http://jquery.org/license
  9804. */
  9805. //>>label: Dialog
  9806. //>>group: Widgets
  9807. //>>description: Displays customizable dialog windows.
  9808. //>>docs: http://api.jqueryui.com/dialog/
  9809. //>>demos: http://jqueryui.com/dialog/
  9810. //>>css.structure: ../../themes/base/core.css
  9811. //>>css.structure: ../../themes/base/dialog.css
  9812. //>>css.theme: ../../themes/base/theme.css
  9813. $.widget( "ui.dialog", {
  9814. version: "1.12.1",
  9815. options: {
  9816. appendTo: "body",
  9817. autoOpen: true,
  9818. buttons: [],
  9819. classes: {
  9820. "ui-dialog": "ui-corner-all",
  9821. "ui-dialog-titlebar": "ui-corner-all"
  9822. },
  9823. closeOnEscape: true,
  9824. closeText: "Close",
  9825. draggable: true,
  9826. hide: null,
  9827. height: "auto",
  9828. maxHeight: null,
  9829. maxWidth: null,
  9830. minHeight: 150,
  9831. minWidth: 150,
  9832. modal: false,
  9833. position: {
  9834. my: "center",
  9835. at: "center",
  9836. of: window,
  9837. collision: "fit",
  9838. // Ensure the titlebar is always visible
  9839. using: function( pos ) {
  9840. var topOffset = $( this ).css( pos ).offset().top;
  9841. if ( topOffset < 0 ) {
  9842. $( this ).css( "top", pos.top - topOffset );
  9843. }
  9844. }
  9845. },
  9846. resizable: true,
  9847. show: null,
  9848. title: null,
  9849. width: 300,
  9850. // Callbacks
  9851. beforeClose: null,
  9852. close: null,
  9853. drag: null,
  9854. dragStart: null,
  9855. dragStop: null,
  9856. focus: null,
  9857. open: null,
  9858. resize: null,
  9859. resizeStart: null,
  9860. resizeStop: null
  9861. },
  9862. sizeRelatedOptions: {
  9863. buttons: true,
  9864. height: true,
  9865. maxHeight: true,
  9866. maxWidth: true,
  9867. minHeight: true,
  9868. minWidth: true,
  9869. width: true
  9870. },
  9871. resizableRelatedOptions: {
  9872. maxHeight: true,
  9873. maxWidth: true,
  9874. minHeight: true,
  9875. minWidth: true
  9876. },
  9877. _create: function() {
  9878. this.originalCss = {
  9879. display: this.element[ 0 ].style.display,
  9880. width: this.element[ 0 ].style.width,
  9881. minHeight: this.element[ 0 ].style.minHeight,
  9882. maxHeight: this.element[ 0 ].style.maxHeight,
  9883. height: this.element[ 0 ].style.height
  9884. };
  9885. this.originalPosition = {
  9886. parent: this.element.parent(),
  9887. index: this.element.parent().children().index( this.element )
  9888. };
  9889. this.originalTitle = this.element.attr( "title" );
  9890. if ( this.options.title == null && this.originalTitle != null ) {
  9891. this.options.title = this.originalTitle;
  9892. }
  9893. // Dialogs can't be disabled
  9894. if ( this.options.disabled ) {
  9895. this.options.disabled = false;
  9896. }
  9897. this._createWrapper();
  9898. this.element
  9899. .show()
  9900. .removeAttr( "title" )
  9901. .appendTo( this.uiDialog );
  9902. this._addClass( "ui-dialog-content", "ui-widget-content" );
  9903. this._createTitlebar();
  9904. this._createButtonPane();
  9905. if ( this.options.draggable && $.fn.draggable ) {
  9906. this._makeDraggable();
  9907. }
  9908. if ( this.options.resizable && $.fn.resizable ) {
  9909. this._makeResizable();
  9910. }
  9911. this._isOpen = false;
  9912. this._trackFocus();
  9913. },
  9914. _init: function() {
  9915. if ( this.options.autoOpen ) {
  9916. this.open();
  9917. }
  9918. },
  9919. _appendTo: function() {
  9920. var element = this.options.appendTo;
  9921. if ( element && ( element.jquery || element.nodeType ) ) {
  9922. return $( element );
  9923. }
  9924. return this.document.find( element || "body" ).eq( 0 );
  9925. },
  9926. _destroy: function() {
  9927. var next,
  9928. originalPosition = this.originalPosition;
  9929. this._untrackInstance();
  9930. this._destroyOverlay();
  9931. this.element
  9932. .removeUniqueId()
  9933. .css( this.originalCss )
  9934. // Without detaching first, the following becomes really slow
  9935. .detach();
  9936. this.uiDialog.remove();
  9937. if ( this.originalTitle ) {
  9938. this.element.attr( "title", this.originalTitle );
  9939. }
  9940. next = originalPosition.parent.children().eq( originalPosition.index );
  9941. // Don't try to place the dialog next to itself (#8613)
  9942. if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
  9943. next.before( this.element );
  9944. } else {
  9945. originalPosition.parent.append( this.element );
  9946. }
  9947. },
  9948. widget: function() {
  9949. return this.uiDialog;
  9950. },
  9951. disable: $.noop,
  9952. enable: $.noop,
  9953. close: function( event ) {
  9954. var that = this;
  9955. if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
  9956. return;
  9957. }
  9958. this._isOpen = false;
  9959. this._focusedElement = null;
  9960. this._destroyOverlay();
  9961. this._untrackInstance();
  9962. if ( !this.opener.filter( ":focusable" ).trigger( "focus" ).length ) {
  9963. // Hiding a focused element doesn't trigger blur in WebKit
  9964. // so in case we have nothing to focus on, explicitly blur the active element
  9965. // https://bugs.webkit.org/show_bug.cgi?id=47182
  9966. $.ui.safeBlur( $.ui.safeActiveElement( this.document[ 0 ] ) );
  9967. }
  9968. this._hide( this.uiDialog, this.options.hide, function() {
  9969. that._trigger( "close", event );
  9970. } );
  9971. },
  9972. isOpen: function() {
  9973. return this._isOpen;
  9974. },
  9975. moveToTop: function() {
  9976. this._moveToTop();
  9977. },
  9978. _moveToTop: function( event, silent ) {
  9979. var moved = false,
  9980. zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map( function() {
  9981. return +$( this ).css( "z-index" );
  9982. } ).get(),
  9983. zIndexMax = Math.max.apply( null, zIndices );
  9984. if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) {
  9985. this.uiDialog.css( "z-index", zIndexMax + 1 );
  9986. moved = true;
  9987. }
  9988. if ( moved && !silent ) {
  9989. this._trigger( "focus", event );
  9990. }
  9991. return moved;
  9992. },
  9993. open: function() {
  9994. var that = this;
  9995. if ( this._isOpen ) {
  9996. if ( this._moveToTop() ) {
  9997. this._focusTabbable();
  9998. }
  9999. return;
  10000. }
  10001. this._isOpen = true;
  10002. this.opener = $( $.ui.safeActiveElement( this.document[ 0 ] ) );
  10003. this._size();
  10004. this._position();
  10005. this._createOverlay();
  10006. this._moveToTop( null, true );
  10007. // Ensure the overlay is moved to the top with the dialog, but only when
  10008. // opening. The overlay shouldn't move after the dialog is open so that
  10009. // modeless dialogs opened after the modal dialog stack properly.
  10010. if ( this.overlay ) {
  10011. this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 );
  10012. }
  10013. this._show( this.uiDialog, this.options.show, function() {
  10014. that._focusTabbable();
  10015. that._trigger( "focus" );
  10016. } );
  10017. // Track the dialog immediately upon openening in case a focus event
  10018. // somehow occurs outside of the dialog before an element inside the
  10019. // dialog is focused (#10152)
  10020. this._makeFocusTarget();
  10021. this._trigger( "open" );
  10022. },
  10023. _focusTabbable: function() {
  10024. // Set focus to the first match:
  10025. // 1. An element that was focused previously
  10026. // 2. First element inside the dialog matching [autofocus]
  10027. // 3. Tabbable element inside the content element
  10028. // 4. Tabbable element inside the buttonpane
  10029. // 5. The close button
  10030. // 6. The dialog itself
  10031. var hasFocus = this._focusedElement;
  10032. if ( !hasFocus ) {
  10033. hasFocus = this.element.find( "[autofocus]" );
  10034. }
  10035. if ( !hasFocus.length ) {
  10036. hasFocus = this.element.find( ":tabbable" );
  10037. }
  10038. if ( !hasFocus.length ) {
  10039. hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
  10040. }
  10041. if ( !hasFocus.length ) {
  10042. hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" );
  10043. }
  10044. if ( !hasFocus.length ) {
  10045. hasFocus = this.uiDialog;
  10046. }
  10047. hasFocus.eq( 0 ).trigger( "focus" );
  10048. },
  10049. _keepFocus: function( event ) {
  10050. function checkFocus() {
  10051. var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
  10052. isActive = this.uiDialog[ 0 ] === activeElement ||
  10053. $.contains( this.uiDialog[ 0 ], activeElement );
  10054. if ( !isActive ) {
  10055. this._focusTabbable();
  10056. }
  10057. }
  10058. event.preventDefault();
  10059. checkFocus.call( this );
  10060. // support: IE
  10061. // IE <= 8 doesn't prevent moving focus even with event.preventDefault()
  10062. // so we check again later
  10063. this._delay( checkFocus );
  10064. },
  10065. _createWrapper: function() {
  10066. this.uiDialog = $( "<div>" )
  10067. .hide()
  10068. .attr( {
  10069. // Setting tabIndex makes the div focusable
  10070. tabIndex: -1,
  10071. role: "dialog"
  10072. } )
  10073. .appendTo( this._appendTo() );
  10074. this._addClass( this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front" );
  10075. this._on( this.uiDialog, {
  10076. keydown: function( event ) {
  10077. if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
  10078. event.keyCode === $.ui.keyCode.ESCAPE ) {
  10079. event.preventDefault();
  10080. this.close( event );
  10081. return;
  10082. }
  10083. // Prevent tabbing out of dialogs
  10084. if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) {
  10085. return;
  10086. }
  10087. var tabbables = this.uiDialog.find( ":tabbable" ),
  10088. first = tabbables.filter( ":first" ),
  10089. last = tabbables.filter( ":last" );
  10090. if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) &&
  10091. !event.shiftKey ) {
  10092. this._delay( function() {
  10093. first.trigger( "focus" );
  10094. } );
  10095. event.preventDefault();
  10096. } else if ( ( event.target === first[ 0 ] ||
  10097. event.target === this.uiDialog[ 0 ] ) && event.shiftKey ) {
  10098. this._delay( function() {
  10099. last.trigger( "focus" );
  10100. } );
  10101. event.preventDefault();
  10102. }
  10103. },
  10104. mousedown: function( event ) {
  10105. if ( this._moveToTop( event ) ) {
  10106. this._focusTabbable();
  10107. }
  10108. }
  10109. } );
  10110. // We assume that any existing aria-describedby attribute means
  10111. // that the dialog content is marked up properly
  10112. // otherwise we brute force the content as the description
  10113. if ( !this.element.find( "[aria-describedby]" ).length ) {
  10114. this.uiDialog.attr( {
  10115. "aria-describedby": this.element.uniqueId().attr( "id" )
  10116. } );
  10117. }
  10118. },
  10119. _createTitlebar: function() {
  10120. var uiDialogTitle;
  10121. this.uiDialogTitlebar = $( "<div>" );
  10122. this._addClass( this.uiDialogTitlebar,
  10123. "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix" );
  10124. this._on( this.uiDialogTitlebar, {
  10125. mousedown: function( event ) {
  10126. // Don't prevent click on close button (#8838)
  10127. // Focusing a dialog that is partially scrolled out of view
  10128. // causes the browser to scroll it into view, preventing the click event
  10129. if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) {
  10130. // Dialog isn't getting focus when dragging (#8063)
  10131. this.uiDialog.trigger( "focus" );
  10132. }
  10133. }
  10134. } );
  10135. // Support: IE
  10136. // Use type="button" to prevent enter keypresses in textboxes from closing the
  10137. // dialog in IE (#9312)
  10138. this.uiDialogTitlebarClose = $( "<button type='button'></button>" )
  10139. .button( {
  10140. label: $( "<a>" ).text( this.options.closeText ).html(),
  10141. icon: "ui-icon-closethick",
  10142. showLabel: false
  10143. } )
  10144. .appendTo( this.uiDialogTitlebar );
  10145. this._addClass( this.uiDialogTitlebarClose, "ui-dialog-titlebar-close" );
  10146. this._on( this.uiDialogTitlebarClose, {
  10147. click: function( event ) {
  10148. event.preventDefault();
  10149. this.close( event );
  10150. }
  10151. } );
  10152. uiDialogTitle = $( "<span>" ).uniqueId().prependTo( this.uiDialogTitlebar );
  10153. this._addClass( uiDialogTitle, "ui-dialog-title" );
  10154. this._title( uiDialogTitle );
  10155. this.uiDialogTitlebar.prependTo( this.uiDialog );
  10156. this.uiDialog.attr( {
  10157. "aria-labelledby": uiDialogTitle.attr( "id" )
  10158. } );
  10159. },
  10160. _title: function( title ) {
  10161. if ( this.options.title ) {
  10162. title.text( this.options.title );
  10163. } else {
  10164. title.html( "&#160;" );
  10165. }
  10166. },
  10167. _createButtonPane: function() {
  10168. this.uiDialogButtonPane = $( "<div>" );
  10169. this._addClass( this.uiDialogButtonPane, "ui-dialog-buttonpane",
  10170. "ui-widget-content ui-helper-clearfix" );
  10171. this.uiButtonSet = $( "<div>" )
  10172. .appendTo( this.uiDialogButtonPane );
  10173. this._addClass( this.uiButtonSet, "ui-dialog-buttonset" );
  10174. this._createButtons();
  10175. },
  10176. _createButtons: function() {
  10177. var that = this,
  10178. buttons = this.options.buttons;
  10179. // If we already have a button pane, remove it
  10180. this.uiDialogButtonPane.remove();
  10181. this.uiButtonSet.empty();
  10182. if ( $.isEmptyObject( buttons ) || ( $.isArray( buttons ) && !buttons.length ) ) {
  10183. this._removeClass( this.uiDialog, "ui-dialog-buttons" );
  10184. return;
  10185. }
  10186. $.each( buttons, function( name, props ) {
  10187. var click, buttonOptions;
  10188. props = $.isFunction( props ) ?
  10189. { click: props, text: name } :
  10190. props;
  10191. // Default to a non-submitting button
  10192. props = $.extend( { type: "button" }, props );
  10193. // Change the context for the click callback to be the main element
  10194. click = props.click;
  10195. buttonOptions = {
  10196. icon: props.icon,
  10197. iconPosition: props.iconPosition,
  10198. showLabel: props.showLabel,
  10199. // Deprecated options
  10200. icons: props.icons,
  10201. text: props.text
  10202. };
  10203. delete props.click;
  10204. delete props.icon;
  10205. delete props.iconPosition;
  10206. delete props.showLabel;
  10207. // Deprecated options
  10208. delete props.icons;
  10209. if ( typeof props.text === "boolean" ) {
  10210. delete props.text;
  10211. }
  10212. $( "<button></button>", props )
  10213. .button( buttonOptions )
  10214. .appendTo( that.uiButtonSet )
  10215. .on( "click", function() {
  10216. click.apply( that.element[ 0 ], arguments );
  10217. } );
  10218. } );
  10219. this._addClass( this.uiDialog, "ui-dialog-buttons" );
  10220. this.uiDialogButtonPane.appendTo( this.uiDialog );
  10221. },
  10222. _makeDraggable: function() {
  10223. var that = this,
  10224. options = this.options;
  10225. function filteredUi( ui ) {
  10226. return {
  10227. position: ui.position,
  10228. offset: ui.offset
  10229. };
  10230. }
  10231. this.uiDialog.draggable( {
  10232. cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
  10233. handle: ".ui-dialog-titlebar",
  10234. containment: "document",
  10235. start: function( event, ui ) {
  10236. that._addClass( $( this ), "ui-dialog-dragging" );
  10237. that._blockFrames();
  10238. that._trigger( "dragStart", event, filteredUi( ui ) );
  10239. },
  10240. drag: function( event, ui ) {
  10241. that._trigger( "drag", event, filteredUi( ui ) );
  10242. },
  10243. stop: function( event, ui ) {
  10244. var left = ui.offset.left - that.document.scrollLeft(),
  10245. top = ui.offset.top - that.document.scrollTop();
  10246. options.position = {
  10247. my: "left top",
  10248. at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
  10249. "top" + ( top >= 0 ? "+" : "" ) + top,
  10250. of: that.window
  10251. };
  10252. that._removeClass( $( this ), "ui-dialog-dragging" );
  10253. that._unblockFrames();
  10254. that._trigger( "dragStop", event, filteredUi( ui ) );
  10255. }
  10256. } );
  10257. },
  10258. _makeResizable: function() {
  10259. var that = this,
  10260. options = this.options,
  10261. handles = options.resizable,
  10262. // .ui-resizable has position: relative defined in the stylesheet
  10263. // but dialogs have to use absolute or fixed positioning
  10264. position = this.uiDialog.css( "position" ),
  10265. resizeHandles = typeof handles === "string" ?
  10266. handles :
  10267. "n,e,s,w,se,sw,ne,nw";
  10268. function filteredUi( ui ) {
  10269. return {
  10270. originalPosition: ui.originalPosition,
  10271. originalSize: ui.originalSize,
  10272. position: ui.position,
  10273. size: ui.size
  10274. };
  10275. }
  10276. this.uiDialog.resizable( {
  10277. cancel: ".ui-dialog-content",
  10278. containment: "document",
  10279. alsoResize: this.element,
  10280. maxWidth: options.maxWidth,
  10281. maxHeight: options.maxHeight,
  10282. minWidth: options.minWidth,
  10283. minHeight: this._minHeight(),
  10284. handles: resizeHandles,
  10285. start: function( event, ui ) {
  10286. that._addClass( $( this ), "ui-dialog-resizing" );
  10287. that._blockFrames();
  10288. that._trigger( "resizeStart", event, filteredUi( ui ) );
  10289. },
  10290. resize: function( event, ui ) {
  10291. that._trigger( "resize", event, filteredUi( ui ) );
  10292. },
  10293. stop: function( event, ui ) {
  10294. var offset = that.uiDialog.offset(),
  10295. left = offset.left - that.document.scrollLeft(),
  10296. top = offset.top - that.document.scrollTop();
  10297. options.height = that.uiDialog.height();
  10298. options.width = that.uiDialog.width();
  10299. options.position = {
  10300. my: "left top",
  10301. at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
  10302. "top" + ( top >= 0 ? "+" : "" ) + top,
  10303. of: that.window
  10304. };
  10305. that._removeClass( $( this ), "ui-dialog-resizing" );
  10306. that._unblockFrames();
  10307. that._trigger( "resizeStop", event, filteredUi( ui ) );
  10308. }
  10309. } )
  10310. .css( "position", position );
  10311. },
  10312. _trackFocus: function() {
  10313. this._on( this.widget(), {
  10314. focusin: function( event ) {
  10315. this._makeFocusTarget();
  10316. this._focusedElement = $( event.target );
  10317. }
  10318. } );
  10319. },
  10320. _makeFocusTarget: function() {
  10321. this._untrackInstance();
  10322. this._trackingInstances().unshift( this );
  10323. },
  10324. _untrackInstance: function() {
  10325. var instances = this._trackingInstances(),
  10326. exists = $.inArray( this, instances );
  10327. if ( exists !== -1 ) {
  10328. instances.splice( exists, 1 );
  10329. }
  10330. },
  10331. _trackingInstances: function() {
  10332. var instances = this.document.data( "ui-dialog-instances" );
  10333. if ( !instances ) {
  10334. instances = [];
  10335. this.document.data( "ui-dialog-instances", instances );
  10336. }
  10337. return instances;
  10338. },
  10339. _minHeight: function() {
  10340. var options = this.options;
  10341. return options.height === "auto" ?
  10342. options.minHeight :
  10343. Math.min( options.minHeight, options.height );
  10344. },
  10345. _position: function() {
  10346. // Need to show the dialog to get the actual offset in the position plugin
  10347. var isVisible = this.uiDialog.is( ":visible" );
  10348. if ( !isVisible ) {
  10349. this.uiDialog.show();
  10350. }
  10351. this.uiDialog.position( this.options.position );
  10352. if ( !isVisible ) {
  10353. this.uiDialog.hide();
  10354. }
  10355. },
  10356. _setOptions: function( options ) {
  10357. var that = this,
  10358. resize = false,
  10359. resizableOptions = {};
  10360. $.each( options, function( key, value ) {
  10361. that._setOption( key, value );
  10362. if ( key in that.sizeRelatedOptions ) {
  10363. resize = true;
  10364. }
  10365. if ( key in that.resizableRelatedOptions ) {
  10366. resizableOptions[ key ] = value;
  10367. }
  10368. } );
  10369. if ( resize ) {
  10370. this._size();
  10371. this._position();
  10372. }
  10373. if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
  10374. this.uiDialog.resizable( "option", resizableOptions );
  10375. }
  10376. },
  10377. _setOption: function( key, value ) {
  10378. var isDraggable, isResizable,
  10379. uiDialog = this.uiDialog;
  10380. if ( key === "disabled" ) {
  10381. return;
  10382. }
  10383. this._super( key, value );
  10384. if ( key === "appendTo" ) {
  10385. this.uiDialog.appendTo( this._appendTo() );
  10386. }
  10387. if ( key === "buttons" ) {
  10388. this._createButtons();
  10389. }
  10390. if ( key === "closeText" ) {
  10391. this.uiDialogTitlebarClose.button( {
  10392. // Ensure that we always pass a string
  10393. label: $( "<a>" ).text( "" + this.options.closeText ).html()
  10394. } );
  10395. }
  10396. if ( key === "draggable" ) {
  10397. isDraggable = uiDialog.is( ":data(ui-draggable)" );
  10398. if ( isDraggable && !value ) {
  10399. uiDialog.draggable( "destroy" );
  10400. }
  10401. if ( !isDraggable && value ) {
  10402. this._makeDraggable();
  10403. }
  10404. }
  10405. if ( key === "position" ) {
  10406. this._position();
  10407. }
  10408. if ( key === "resizable" ) {
  10409. // currently resizable, becoming non-resizable
  10410. isResizable = uiDialog.is( ":data(ui-resizable)" );
  10411. if ( isResizable && !value ) {
  10412. uiDialog.resizable( "destroy" );
  10413. }
  10414. // Currently resizable, changing handles
  10415. if ( isResizable && typeof value === "string" ) {
  10416. uiDialog.resizable( "option", "handles", value );
  10417. }
  10418. // Currently non-resizable, becoming resizable
  10419. if ( !isResizable && value !== false ) {
  10420. this._makeResizable();
  10421. }
  10422. }
  10423. if ( key === "title" ) {
  10424. this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) );
  10425. }
  10426. },
  10427. _size: function() {
  10428. // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
  10429. // divs will both have width and height set, so we need to reset them
  10430. var nonContentHeight, minContentHeight, maxContentHeight,
  10431. options = this.options;
  10432. // Reset content sizing
  10433. this.element.show().css( {
  10434. width: "auto",
  10435. minHeight: 0,
  10436. maxHeight: "none",
  10437. height: 0
  10438. } );
  10439. if ( options.minWidth > options.width ) {
  10440. options.width = options.minWidth;
  10441. }
  10442. // Reset wrapper sizing
  10443. // determine the height of all the non-content elements
  10444. nonContentHeight = this.uiDialog.css( {
  10445. height: "auto",
  10446. width: options.width
  10447. } )
  10448. .outerHeight();
  10449. minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
  10450. maxContentHeight = typeof options.maxHeight === "number" ?
  10451. Math.max( 0, options.maxHeight - nonContentHeight ) :
  10452. "none";
  10453. if ( options.height === "auto" ) {
  10454. this.element.css( {
  10455. minHeight: minContentHeight,
  10456. maxHeight: maxContentHeight,
  10457. height: "auto"
  10458. } );
  10459. } else {
  10460. this.element.height( Math.max( 0, options.height - nonContentHeight ) );
  10461. }
  10462. if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
  10463. this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
  10464. }
  10465. },
  10466. _blockFrames: function() {
  10467. this.iframeBlocks = this.document.find( "iframe" ).map( function() {
  10468. var iframe = $( this );
  10469. return $( "<div>" )
  10470. .css( {
  10471. position: "absolute",
  10472. width: iframe.outerWidth(),
  10473. height: iframe.outerHeight()
  10474. } )
  10475. .appendTo( iframe.parent() )
  10476. .offset( iframe.offset() )[ 0 ];
  10477. } );
  10478. },
  10479. _unblockFrames: function() {
  10480. if ( this.iframeBlocks ) {
  10481. this.iframeBlocks.remove();
  10482. delete this.iframeBlocks;
  10483. }
  10484. },
  10485. _allowInteraction: function( event ) {
  10486. if ( $( event.target ).closest( ".ui-dialog" ).length ) {
  10487. return true;
  10488. }
  10489. // TODO: Remove hack when datepicker implements
  10490. // the .ui-front logic (#8989)
  10491. return !!$( event.target ).closest( ".ui-datepicker" ).length;
  10492. },
  10493. _createOverlay: function() {
  10494. if ( !this.options.modal ) {
  10495. return;
  10496. }
  10497. // We use a delay in case the overlay is created from an
  10498. // event that we're going to be cancelling (#2804)
  10499. var isOpening = true;
  10500. this._delay( function() {
  10501. isOpening = false;
  10502. } );
  10503. if ( !this.document.data( "ui-dialog-overlays" ) ) {
  10504. // Prevent use of anchors and inputs
  10505. // Using _on() for an event handler shared across many instances is
  10506. // safe because the dialogs stack and must be closed in reverse order
  10507. this._on( this.document, {
  10508. focusin: function( event ) {
  10509. if ( isOpening ) {
  10510. return;
  10511. }
  10512. if ( !this._allowInteraction( event ) ) {
  10513. event.preventDefault();
  10514. this._trackingInstances()[ 0 ]._focusTabbable();
  10515. }
  10516. }
  10517. } );
  10518. }
  10519. this.overlay = $( "<div>" )
  10520. .appendTo( this._appendTo() );
  10521. this._addClass( this.overlay, null, "ui-widget-overlay ui-front" );
  10522. this._on( this.overlay, {
  10523. mousedown: "_keepFocus"
  10524. } );
  10525. this.document.data( "ui-dialog-overlays",
  10526. ( this.document.data( "ui-dialog-overlays" ) || 0 ) + 1 );
  10527. },
  10528. _destroyOverlay: function() {
  10529. if ( !this.options.modal ) {
  10530. return;
  10531. }
  10532. if ( this.overlay ) {
  10533. var overlays = this.document.data( "ui-dialog-overlays" ) - 1;
  10534. if ( !overlays ) {
  10535. this._off( this.document, "focusin" );
  10536. this.document.removeData( "ui-dialog-overlays" );
  10537. } else {
  10538. this.document.data( "ui-dialog-overlays", overlays );
  10539. }
  10540. this.overlay.remove();
  10541. this.overlay = null;
  10542. }
  10543. }
  10544. } );
  10545. // DEPRECATED
  10546. // TODO: switch return back to widget declaration at top of file when this is removed
  10547. if ( $.uiBackCompat !== false ) {
  10548. // Backcompat for dialogClass option
  10549. $.widget( "ui.dialog", $.ui.dialog, {
  10550. options: {
  10551. dialogClass: ""
  10552. },
  10553. _createWrapper: function() {
  10554. this._super();
  10555. this.uiDialog.addClass( this.options.dialogClass );
  10556. },
  10557. _setOption: function( key, value ) {
  10558. if ( key === "dialogClass" ) {
  10559. this.uiDialog
  10560. .removeClass( this.options.dialogClass )
  10561. .addClass( value );
  10562. }
  10563. this._superApply( arguments );
  10564. }
  10565. } );
  10566. }
  10567. var widgetsDialog = $.ui.dialog;
  10568. /*!
  10569. * jQuery UI Progressbar 1.12.1
  10570. * http://jqueryui.com
  10571. *
  10572. * Copyright jQuery Foundation and other contributors
  10573. * Released under the MIT license.
  10574. * http://jquery.org/license
  10575. */
  10576. //>>label: Progressbar
  10577. //>>group: Widgets
  10578. // jscs:disable maximumLineLength
  10579. //>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators.
  10580. // jscs:enable maximumLineLength
  10581. //>>docs: http://api.jqueryui.com/progressbar/
  10582. //>>demos: http://jqueryui.com/progressbar/
  10583. //>>css.structure: ../../themes/base/core.css
  10584. //>>css.structure: ../../themes/base/progressbar.css
  10585. //>>css.theme: ../../themes/base/theme.css
  10586. var widgetsProgressbar = $.widget( "ui.progressbar", {
  10587. version: "1.12.1",
  10588. options: {
  10589. classes: {
  10590. "ui-progressbar": "ui-corner-all",
  10591. "ui-progressbar-value": "ui-corner-left",
  10592. "ui-progressbar-complete": "ui-corner-right"
  10593. },
  10594. max: 100,
  10595. value: 0,
  10596. change: null,
  10597. complete: null
  10598. },
  10599. min: 0,
  10600. _create: function() {
  10601. // Constrain initial value
  10602. this.oldValue = this.options.value = this._constrainedValue();
  10603. this.element.attr( {
  10604. // Only set static values; aria-valuenow and aria-valuemax are
  10605. // set inside _refreshValue()
  10606. role: "progressbar",
  10607. "aria-valuemin": this.min
  10608. } );
  10609. this._addClass( "ui-progressbar", "ui-widget ui-widget-content" );
  10610. this.valueDiv = $( "<div>" ).appendTo( this.element );
  10611. this._addClass( this.valueDiv, "ui-progressbar-value", "ui-widget-header" );
  10612. this._refreshValue();
  10613. },
  10614. _destroy: function() {
  10615. this.element.removeAttr( "role aria-valuemin aria-valuemax aria-valuenow" );
  10616. this.valueDiv.remove();
  10617. },
  10618. value: function( newValue ) {
  10619. if ( newValue === undefined ) {
  10620. return this.options.value;
  10621. }
  10622. this.options.value = this._constrainedValue( newValue );
  10623. this._refreshValue();
  10624. },
  10625. _constrainedValue: function( newValue ) {
  10626. if ( newValue === undefined ) {
  10627. newValue = this.options.value;
  10628. }
  10629. this.indeterminate = newValue === false;
  10630. // Sanitize value
  10631. if ( typeof newValue !== "number" ) {
  10632. newValue = 0;
  10633. }
  10634. return this.indeterminate ? false :
  10635. Math.min( this.options.max, Math.max( this.min, newValue ) );
  10636. },
  10637. _setOptions: function( options ) {
  10638. // Ensure "value" option is set after other values (like max)
  10639. var value = options.value;
  10640. delete options.value;
  10641. this._super( options );
  10642. this.options.value = this._constrainedValue( value );
  10643. this._refreshValue();
  10644. },
  10645. _setOption: function( key, value ) {
  10646. if ( key === "max" ) {
  10647. // Don't allow a max less than min
  10648. value = Math.max( this.min, value );
  10649. }
  10650. this._super( key, value );
  10651. },
  10652. _setOptionDisabled: function( value ) {
  10653. this._super( value );
  10654. this.element.attr( "aria-disabled", value );
  10655. this._toggleClass( null, "ui-state-disabled", !!value );
  10656. },
  10657. _percentage: function() {
  10658. return this.indeterminate ?
  10659. 100 :
  10660. 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
  10661. },
  10662. _refreshValue: function() {
  10663. var value = this.options.value,
  10664. percentage = this._percentage();
  10665. this.valueDiv
  10666. .toggle( this.indeterminate || value > this.min )
  10667. .width( percentage.toFixed( 0 ) + "%" );
  10668. this
  10669. ._toggleClass( this.valueDiv, "ui-progressbar-complete", null,
  10670. value === this.options.max )
  10671. ._toggleClass( "ui-progressbar-indeterminate", null, this.indeterminate );
  10672. if ( this.indeterminate ) {
  10673. this.element.removeAttr( "aria-valuenow" );
  10674. if ( !this.overlayDiv ) {
  10675. this.overlayDiv = $( "<div>" ).appendTo( this.valueDiv );
  10676. this._addClass( this.overlayDiv, "ui-progressbar-overlay" );
  10677. }
  10678. } else {
  10679. this.element.attr( {
  10680. "aria-valuemax": this.options.max,
  10681. "aria-valuenow": value
  10682. } );
  10683. if ( this.overlayDiv ) {
  10684. this.overlayDiv.remove();
  10685. this.overlayDiv = null;
  10686. }
  10687. }
  10688. if ( this.oldValue !== value ) {
  10689. this.oldValue = value;
  10690. this._trigger( "change" );
  10691. }
  10692. if ( value === this.options.max ) {
  10693. this._trigger( "complete" );
  10694. }
  10695. }
  10696. } );
  10697. /*!
  10698. * jQuery UI Selectmenu 1.12.1
  10699. * http://jqueryui.com
  10700. *
  10701. * Copyright jQuery Foundation and other contributors
  10702. * Released under the MIT license.
  10703. * http://jquery.org/license
  10704. */
  10705. //>>label: Selectmenu
  10706. //>>group: Widgets
  10707. // jscs:disable maximumLineLength
  10708. //>>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.
  10709. // jscs:enable maximumLineLength
  10710. //>>docs: http://api.jqueryui.com/selectmenu/
  10711. //>>demos: http://jqueryui.com/selectmenu/
  10712. //>>css.structure: ../../themes/base/core.css
  10713. //>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css
  10714. //>>css.theme: ../../themes/base/theme.css
  10715. var widgetsSelectmenu = $.widget( "ui.selectmenu", [ $.ui.formResetMixin, {
  10716. version: "1.12.1",
  10717. defaultElement: "<select>",
  10718. options: {
  10719. appendTo: null,
  10720. classes: {
  10721. "ui-selectmenu-button-open": "ui-corner-top",
  10722. "ui-selectmenu-button-closed": "ui-corner-all"
  10723. },
  10724. disabled: null,
  10725. icons: {
  10726. button: "ui-icon-triangle-1-s"
  10727. },
  10728. position: {
  10729. my: "left top",
  10730. at: "left bottom",
  10731. collision: "none"
  10732. },
  10733. width: false,
  10734. // Callbacks
  10735. change: null,
  10736. close: null,
  10737. focus: null,
  10738. open: null,
  10739. select: null
  10740. },
  10741. _create: function() {
  10742. var selectmenuId = this.element.uniqueId().attr( "id" );
  10743. this.ids = {
  10744. element: selectmenuId,
  10745. button: selectmenuId + "-button",
  10746. menu: selectmenuId + "-menu"
  10747. };
  10748. this._drawButton();
  10749. this._drawMenu();
  10750. this._bindFormResetHandler();
  10751. this._rendered = false;
  10752. this.menuItems = $();
  10753. },
  10754. _drawButton: function() {
  10755. var icon,
  10756. that = this,
  10757. item = this._parseOption(
  10758. this.element.find( "option:selected" ),
  10759. this.element[ 0 ].selectedIndex
  10760. );
  10761. // Associate existing label with the new button
  10762. this.labels = this.element.labels().attr( "for", this.ids.button );
  10763. this._on( this.labels, {
  10764. click: function( event ) {
  10765. this.button.focus();
  10766. event.preventDefault();
  10767. }
  10768. } );
  10769. // Hide original select element
  10770. this.element.hide();
  10771. // Create button
  10772. this.button = $( "<span>", {
  10773. tabindex: this.options.disabled ? -1 : 0,
  10774. id: this.ids.button,
  10775. role: "combobox",
  10776. "aria-expanded": "false",
  10777. "aria-autocomplete": "list",
  10778. "aria-owns": this.ids.menu,
  10779. "aria-haspopup": "true",
  10780. title: this.element.attr( "title" )
  10781. } )
  10782. .insertAfter( this.element );
  10783. this._addClass( this.button, "ui-selectmenu-button ui-selectmenu-button-closed",
  10784. "ui-button ui-widget" );
  10785. icon = $( "<span>" ).appendTo( this.button );
  10786. this._addClass( icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button );
  10787. this.buttonItem = this._renderButtonItem( item )
  10788. .appendTo( this.button );
  10789. if ( this.options.width !== false ) {
  10790. this._resizeButton();
  10791. }
  10792. this._on( this.button, this._buttonEvents );
  10793. this.button.one( "focusin", function() {
  10794. // Delay rendering the menu items until the button receives focus.
  10795. // The menu may have already been rendered via a programmatic open.
  10796. if ( !that._rendered ) {
  10797. that._refreshMenu();
  10798. }
  10799. } );
  10800. },
  10801. _drawMenu: function() {
  10802. var that = this;
  10803. // Create menu
  10804. this.menu = $( "<ul>", {
  10805. "aria-hidden": "true",
  10806. "aria-labelledby": this.ids.button,
  10807. id: this.ids.menu
  10808. } );
  10809. // Wrap menu
  10810. this.menuWrap = $( "<div>" ).append( this.menu );
  10811. this._addClass( this.menuWrap, "ui-selectmenu-menu", "ui-front" );
  10812. this.menuWrap.appendTo( this._appendTo() );
  10813. // Initialize menu widget
  10814. this.menuInstance = this.menu
  10815. .menu( {
  10816. classes: {
  10817. "ui-menu": "ui-corner-bottom"
  10818. },
  10819. role: "listbox",
  10820. select: function( event, ui ) {
  10821. event.preventDefault();
  10822. // Support: IE8
  10823. // If the item was selected via a click, the text selection
  10824. // will be destroyed in IE
  10825. that._setSelection();
  10826. that._select( ui.item.data( "ui-selectmenu-item" ), event );
  10827. },
  10828. focus: function( event, ui ) {
  10829. var item = ui.item.data( "ui-selectmenu-item" );
  10830. // Prevent inital focus from firing and check if its a newly focused item
  10831. if ( that.focusIndex != null && item.index !== that.focusIndex ) {
  10832. that._trigger( "focus", event, { item: item } );
  10833. if ( !that.isOpen ) {
  10834. that._select( item, event );
  10835. }
  10836. }
  10837. that.focusIndex = item.index;
  10838. that.button.attr( "aria-activedescendant",
  10839. that.menuItems.eq( item.index ).attr( "id" ) );
  10840. }
  10841. } )
  10842. .menu( "instance" );
  10843. // Don't close the menu on mouseleave
  10844. this.menuInstance._off( this.menu, "mouseleave" );
  10845. // Cancel the menu's collapseAll on document click
  10846. this.menuInstance._closeOnDocumentClick = function() {
  10847. return false;
  10848. };
  10849. // Selects often contain empty items, but never contain dividers
  10850. this.menuInstance._isDivider = function() {
  10851. return false;
  10852. };
  10853. },
  10854. refresh: function() {
  10855. this._refreshMenu();
  10856. this.buttonItem.replaceWith(
  10857. this.buttonItem = this._renderButtonItem(
  10858. // Fall back to an empty object in case there are no options
  10859. this._getSelectedItem().data( "ui-selectmenu-item" ) || {}
  10860. )
  10861. );
  10862. if ( this.options.width === null ) {
  10863. this._resizeButton();
  10864. }
  10865. },
  10866. _refreshMenu: function() {
  10867. var item,
  10868. options = this.element.find( "option" );
  10869. this.menu.empty();
  10870. this._parseOptions( options );
  10871. this._renderMenu( this.menu, this.items );
  10872. this.menuInstance.refresh();
  10873. this.menuItems = this.menu.find( "li" )
  10874. .not( ".ui-selectmenu-optgroup" )
  10875. .find( ".ui-menu-item-wrapper" );
  10876. this._rendered = true;
  10877. if ( !options.length ) {
  10878. return;
  10879. }
  10880. item = this._getSelectedItem();
  10881. // Update the menu to have the correct item focused
  10882. this.menuInstance.focus( null, item );
  10883. this._setAria( item.data( "ui-selectmenu-item" ) );
  10884. // Set disabled state
  10885. this._setOption( "disabled", this.element.prop( "disabled" ) );
  10886. },
  10887. open: function( event ) {
  10888. if ( this.options.disabled ) {
  10889. return;
  10890. }
  10891. // If this is the first time the menu is being opened, render the items
  10892. if ( !this._rendered ) {
  10893. this._refreshMenu();
  10894. } else {
  10895. // Menu clears focus on close, reset focus to selected item
  10896. this._removeClass( this.menu.find( ".ui-state-active" ), null, "ui-state-active" );
  10897. this.menuInstance.focus( null, this._getSelectedItem() );
  10898. }
  10899. // If there are no options, don't open the menu
  10900. if ( !this.menuItems.length ) {
  10901. return;
  10902. }
  10903. this.isOpen = true;
  10904. this._toggleAttr();
  10905. this._resizeMenu();
  10906. this._position();
  10907. this._on( this.document, this._documentClick );
  10908. this._trigger( "open", event );
  10909. },
  10910. _position: function() {
  10911. this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
  10912. },
  10913. close: function( event ) {
  10914. if ( !this.isOpen ) {
  10915. return;
  10916. }
  10917. this.isOpen = false;
  10918. this._toggleAttr();
  10919. this.range = null;
  10920. this._off( this.document );
  10921. this._trigger( "close", event );
  10922. },
  10923. widget: function() {
  10924. return this.button;
  10925. },
  10926. menuWidget: function() {
  10927. return this.menu;
  10928. },
  10929. _renderButtonItem: function( item ) {
  10930. var buttonItem = $( "<span>" );
  10931. this._setText( buttonItem, item.label );
  10932. this._addClass( buttonItem, "ui-selectmenu-text" );
  10933. return buttonItem;
  10934. },
  10935. _renderMenu: function( ul, items ) {
  10936. var that = this,
  10937. currentOptgroup = "";
  10938. $.each( items, function( index, item ) {
  10939. var li;
  10940. if ( item.optgroup !== currentOptgroup ) {
  10941. li = $( "<li>", {
  10942. text: item.optgroup
  10943. } );
  10944. that._addClass( li, "ui-selectmenu-optgroup", "ui-menu-divider" +
  10945. ( item.element.parent( "optgroup" ).prop( "disabled" ) ?
  10946. " ui-state-disabled" :
  10947. "" ) );
  10948. li.appendTo( ul );
  10949. currentOptgroup = item.optgroup;
  10950. }
  10951. that._renderItemData( ul, item );
  10952. } );
  10953. },
  10954. _renderItemData: function( ul, item ) {
  10955. return this._renderItem( ul, item ).data( "ui-selectmenu-item", item );
  10956. },
  10957. _renderItem: function( ul, item ) {
  10958. var li = $( "<li>" ),
  10959. wrapper = $( "<div>", {
  10960. title: item.element.attr( "title" )
  10961. } );
  10962. if ( item.disabled ) {
  10963. this._addClass( li, null, "ui-state-disabled" );
  10964. }
  10965. this._setText( wrapper, item.label );
  10966. return li.append( wrapper ).appendTo( ul );
  10967. },
  10968. _setText: function( element, value ) {
  10969. if ( value ) {
  10970. element.text( value );
  10971. } else {
  10972. element.html( "&#160;" );
  10973. }
  10974. },
  10975. _move: function( direction, event ) {
  10976. var item, next,
  10977. filter = ".ui-menu-item";
  10978. if ( this.isOpen ) {
  10979. item = this.menuItems.eq( this.focusIndex ).parent( "li" );
  10980. } else {
  10981. item = this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );
  10982. filter += ":not(.ui-state-disabled)";
  10983. }
  10984. if ( direction === "first" || direction === "last" ) {
  10985. next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 );
  10986. } else {
  10987. next = item[ direction + "All" ]( filter ).eq( 0 );
  10988. }
  10989. if ( next.length ) {
  10990. this.menuInstance.focus( event, next );
  10991. }
  10992. },
  10993. _getSelectedItem: function() {
  10994. return this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );
  10995. },
  10996. _toggle: function( event ) {
  10997. this[ this.isOpen ? "close" : "open" ]( event );
  10998. },
  10999. _setSelection: function() {
  11000. var selection;
  11001. if ( !this.range ) {
  11002. return;
  11003. }
  11004. if ( window.getSelection ) {
  11005. selection = window.getSelection();
  11006. selection.removeAllRanges();
  11007. selection.addRange( this.range );
  11008. // Support: IE8
  11009. } else {
  11010. this.range.select();
  11011. }
  11012. // Support: IE
  11013. // Setting the text selection kills the button focus in IE, but
  11014. // restoring the focus doesn't kill the selection.
  11015. this.button.focus();
  11016. },
  11017. _documentClick: {
  11018. mousedown: function( event ) {
  11019. if ( !this.isOpen ) {
  11020. return;
  11021. }
  11022. if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" +
  11023. $.ui.escapeSelector( this.ids.button ) ).length ) {
  11024. this.close( event );
  11025. }
  11026. }
  11027. },
  11028. _buttonEvents: {
  11029. // Prevent text selection from being reset when interacting with the selectmenu (#10144)
  11030. mousedown: function() {
  11031. var selection;
  11032. if ( window.getSelection ) {
  11033. selection = window.getSelection();
  11034. if ( selection.rangeCount ) {
  11035. this.range = selection.getRangeAt( 0 );
  11036. }
  11037. // Support: IE8
  11038. } else {
  11039. this.range = document.selection.createRange();
  11040. }
  11041. },
  11042. click: function( event ) {
  11043. this._setSelection();
  11044. this._toggle( event );
  11045. },
  11046. keydown: function( event ) {
  11047. var preventDefault = true;
  11048. switch ( event.keyCode ) {
  11049. case $.ui.keyCode.TAB:
  11050. case $.ui.keyCode.ESCAPE:
  11051. this.close( event );
  11052. preventDefault = false;
  11053. break;
  11054. case $.ui.keyCode.ENTER:
  11055. if ( this.isOpen ) {
  11056. this._selectFocusedItem( event );
  11057. }
  11058. break;
  11059. case $.ui.keyCode.UP:
  11060. if ( event.altKey ) {
  11061. this._toggle( event );
  11062. } else {
  11063. this._move( "prev", event );
  11064. }
  11065. break;
  11066. case $.ui.keyCode.DOWN:
  11067. if ( event.altKey ) {
  11068. this._toggle( event );
  11069. } else {
  11070. this._move( "next", event );
  11071. }
  11072. break;
  11073. case $.ui.keyCode.SPACE:
  11074. if ( this.isOpen ) {
  11075. this._selectFocusedItem( event );
  11076. } else {
  11077. this._toggle( event );
  11078. }
  11079. break;
  11080. case $.ui.keyCode.LEFT:
  11081. this._move( "prev", event );
  11082. break;
  11083. case $.ui.keyCode.RIGHT:
  11084. this._move( "next", event );
  11085. break;
  11086. case $.ui.keyCode.HOME:
  11087. case $.ui.keyCode.PAGE_UP:
  11088. this._move( "first", event );
  11089. break;
  11090. case $.ui.keyCode.END:
  11091. case $.ui.keyCode.PAGE_DOWN:
  11092. this._move( "last", event );
  11093. break;
  11094. default:
  11095. this.menu.trigger( event );
  11096. preventDefault = false;
  11097. }
  11098. if ( preventDefault ) {
  11099. event.preventDefault();
  11100. }
  11101. }
  11102. },
  11103. _selectFocusedItem: function( event ) {
  11104. var item = this.menuItems.eq( this.focusIndex ).parent( "li" );
  11105. if ( !item.hasClass( "ui-state-disabled" ) ) {
  11106. this._select( item.data( "ui-selectmenu-item" ), event );
  11107. }
  11108. },
  11109. _select: function( item, event ) {
  11110. var oldIndex = this.element[ 0 ].selectedIndex;
  11111. // Change native select element
  11112. this.element[ 0 ].selectedIndex = item.index;
  11113. this.buttonItem.replaceWith( this.buttonItem = this._renderButtonItem( item ) );
  11114. this._setAria( item );
  11115. this._trigger( "select", event, { item: item } );
  11116. if ( item.index !== oldIndex ) {
  11117. this._trigger( "change", event, { item: item } );
  11118. }
  11119. this.close( event );
  11120. },
  11121. _setAria: function( item ) {
  11122. var id = this.menuItems.eq( item.index ).attr( "id" );
  11123. this.button.attr( {
  11124. "aria-labelledby": id,
  11125. "aria-activedescendant": id
  11126. } );
  11127. this.menu.attr( "aria-activedescendant", id );
  11128. },
  11129. _setOption: function( key, value ) {
  11130. if ( key === "icons" ) {
  11131. var icon = this.button.find( "span.ui-icon" );
  11132. this._removeClass( icon, null, this.options.icons.button )
  11133. ._addClass( icon, null, value.button );
  11134. }
  11135. this._super( key, value );
  11136. if ( key === "appendTo" ) {
  11137. this.menuWrap.appendTo( this._appendTo() );
  11138. }
  11139. if ( key === "width" ) {
  11140. this._resizeButton();
  11141. }
  11142. },
  11143. _setOptionDisabled: function( value ) {
  11144. this._super( value );
  11145. this.menuInstance.option( "disabled", value );
  11146. this.button.attr( "aria-disabled", value );
  11147. this._toggleClass( this.button, null, "ui-state-disabled", value );
  11148. this.element.prop( "disabled", value );
  11149. if ( value ) {
  11150. this.button.attr( "tabindex", -1 );
  11151. this.close();
  11152. } else {
  11153. this.button.attr( "tabindex", 0 );
  11154. }
  11155. },
  11156. _appendTo: function() {
  11157. var element = this.options.appendTo;
  11158. if ( element ) {
  11159. element = element.jquery || element.nodeType ?
  11160. $( element ) :
  11161. this.document.find( element ).eq( 0 );
  11162. }
  11163. if ( !element || !element[ 0 ] ) {
  11164. element = this.element.closest( ".ui-front, dialog" );
  11165. }
  11166. if ( !element.length ) {
  11167. element = this.document[ 0 ].body;
  11168. }
  11169. return element;
  11170. },
  11171. _toggleAttr: function() {
  11172. this.button.attr( "aria-expanded", this.isOpen );
  11173. // We can't use two _toggleClass() calls here, because we need to make sure
  11174. // we always remove classes first and add them second, otherwise if both classes have the
  11175. // same theme class, it will be removed after we add it.
  11176. this._removeClass( this.button, "ui-selectmenu-button-" +
  11177. ( this.isOpen ? "closed" : "open" ) )
  11178. ._addClass( this.button, "ui-selectmenu-button-" +
  11179. ( this.isOpen ? "open" : "closed" ) )
  11180. ._toggleClass( this.menuWrap, "ui-selectmenu-open", null, this.isOpen );
  11181. this.menu.attr( "aria-hidden", !this.isOpen );
  11182. },
  11183. _resizeButton: function() {
  11184. var width = this.options.width;
  11185. // For `width: false`, just remove inline style and stop
  11186. if ( width === false ) {
  11187. this.button.css( "width", "" );
  11188. return;
  11189. }
  11190. // For `width: null`, match the width of the original element
  11191. if ( width === null ) {
  11192. width = this.element.show().outerWidth();
  11193. this.element.hide();
  11194. }
  11195. this.button.outerWidth( width );
  11196. },
  11197. _resizeMenu: function() {
  11198. this.menu.outerWidth( Math.max(
  11199. this.button.outerWidth(),
  11200. // Support: IE10
  11201. // IE10 wraps long text (possibly a rounding bug)
  11202. // so we add 1px to avoid the wrapping
  11203. this.menu.width( "" ).outerWidth() + 1
  11204. ) );
  11205. },
  11206. _getCreateOptions: function() {
  11207. var options = this._super();
  11208. options.disabled = this.element.prop( "disabled" );
  11209. return options;
  11210. },
  11211. _parseOptions: function( options ) {
  11212. var that = this,
  11213. data = [];
  11214. options.each( function( index, item ) {
  11215. data.push( that._parseOption( $( item ), index ) );
  11216. } );
  11217. this.items = data;
  11218. },
  11219. _parseOption: function( option, index ) {
  11220. var optgroup = option.parent( "optgroup" );
  11221. return {
  11222. element: option,
  11223. index: index,
  11224. value: option.val(),
  11225. label: option.text(),
  11226. optgroup: optgroup.attr( "label" ) || "",
  11227. disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" )
  11228. };
  11229. },
  11230. _destroy: function() {
  11231. this._unbindFormResetHandler();
  11232. this.menuWrap.remove();
  11233. this.button.remove();
  11234. this.element.show();
  11235. this.element.removeUniqueId();
  11236. this.labels.attr( "for", this.ids.element );
  11237. }
  11238. } ] );
  11239. /*!
  11240. * jQuery UI Slider 1.12.1
  11241. * http://jqueryui.com
  11242. *
  11243. * Copyright jQuery Foundation and other contributors
  11244. * Released under the MIT license.
  11245. * http://jquery.org/license
  11246. */
  11247. //>>label: Slider
  11248. //>>group: Widgets
  11249. //>>description: Displays a flexible slider with ranges and accessibility via keyboard.
  11250. //>>docs: http://api.jqueryui.com/slider/
  11251. //>>demos: http://jqueryui.com/slider/
  11252. //>>css.structure: ../../themes/base/core.css
  11253. //>>css.structure: ../../themes/base/slider.css
  11254. //>>css.theme: ../../themes/base/theme.css
  11255. var widgetsSlider = $.widget( "ui.slider", $.ui.mouse, {
  11256. version: "1.12.1",
  11257. widgetEventPrefix: "slide",
  11258. options: {
  11259. animate: false,
  11260. classes: {
  11261. "ui-slider": "ui-corner-all",
  11262. "ui-slider-handle": "ui-corner-all",
  11263. // Note: ui-widget-header isn't the most fittingly semantic framework class for this
  11264. // element, but worked best visually with a variety of themes
  11265. "ui-slider-range": "ui-corner-all ui-widget-header"
  11266. },
  11267. distance: 0,
  11268. max: 100,
  11269. min: 0,
  11270. orientation: "horizontal",
  11271. range: false,
  11272. step: 1,
  11273. value: 0,
  11274. values: null,
  11275. // Callbacks
  11276. change: null,
  11277. slide: null,
  11278. start: null,
  11279. stop: null
  11280. },
  11281. // Number of pages in a slider
  11282. // (how many times can you page up/down to go through the whole range)
  11283. numPages: 5,
  11284. _create: function() {
  11285. this._keySliding = false;
  11286. this._mouseSliding = false;
  11287. this._animateOff = true;
  11288. this._handleIndex = null;
  11289. this._detectOrientation();
  11290. this._mouseInit();
  11291. this._calculateNewMax();
  11292. this._addClass( "ui-slider ui-slider-" + this.orientation,
  11293. "ui-widget ui-widget-content" );
  11294. this._refresh();
  11295. this._animateOff = false;
  11296. },
  11297. _refresh: function() {
  11298. this._createRange();
  11299. this._createHandles();
  11300. this._setupEvents();
  11301. this._refreshValue();
  11302. },
  11303. _createHandles: function() {
  11304. var i, handleCount,
  11305. options = this.options,
  11306. existingHandles = this.element.find( ".ui-slider-handle" ),
  11307. handle = "<span tabindex='0'></span>",
  11308. handles = [];
  11309. handleCount = ( options.values && options.values.length ) || 1;
  11310. if ( existingHandles.length > handleCount ) {
  11311. existingHandles.slice( handleCount ).remove();
  11312. existingHandles = existingHandles.slice( 0, handleCount );
  11313. }
  11314. for ( i = existingHandles.length; i < handleCount; i++ ) {
  11315. handles.push( handle );
  11316. }
  11317. this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
  11318. this._addClass( this.handles, "ui-slider-handle", "ui-state-default" );
  11319. this.handle = this.handles.eq( 0 );
  11320. this.handles.each( function( i ) {
  11321. $( this )
  11322. .data( "ui-slider-handle-index", i )
  11323. .attr( "tabIndex", 0 );
  11324. } );
  11325. },
  11326. _createRange: function() {
  11327. var options = this.options;
  11328. if ( options.range ) {
  11329. if ( options.range === true ) {
  11330. if ( !options.values ) {
  11331. options.values = [ this._valueMin(), this._valueMin() ];
  11332. } else if ( options.values.length && options.values.length !== 2 ) {
  11333. options.values = [ options.values[ 0 ], options.values[ 0 ] ];
  11334. } else if ( $.isArray( options.values ) ) {
  11335. options.values = options.values.slice( 0 );
  11336. }
  11337. }
  11338. if ( !this.range || !this.range.length ) {
  11339. this.range = $( "<div>" )
  11340. .appendTo( this.element );
  11341. this._addClass( this.range, "ui-slider-range" );
  11342. } else {
  11343. this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" );
  11344. // Handle range switching from true to min/max
  11345. this.range.css( {
  11346. "left": "",
  11347. "bottom": ""
  11348. } );
  11349. }
  11350. if ( options.range === "min" || options.range === "max" ) {
  11351. this._addClass( this.range, "ui-slider-range-" + options.range );
  11352. }
  11353. } else {
  11354. if ( this.range ) {
  11355. this.range.remove();
  11356. }
  11357. this.range = null;
  11358. }
  11359. },
  11360. _setupEvents: function() {
  11361. this._off( this.handles );
  11362. this._on( this.handles, this._handleEvents );
  11363. this._hoverable( this.handles );
  11364. this._focusable( this.handles );
  11365. },
  11366. _destroy: function() {
  11367. this.handles.remove();
  11368. if ( this.range ) {
  11369. this.range.remove();
  11370. }
  11371. this._mouseDestroy();
  11372. },
  11373. _mouseCapture: function( event ) {
  11374. var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
  11375. that = this,
  11376. o = this.options;
  11377. if ( o.disabled ) {
  11378. return false;
  11379. }
  11380. this.elementSize = {
  11381. width: this.element.outerWidth(),
  11382. height: this.element.outerHeight()
  11383. };
  11384. this.elementOffset = this.element.offset();
  11385. position = { x: event.pageX, y: event.pageY };
  11386. normValue = this._normValueFromMouse( position );
  11387. distance = this._valueMax() - this._valueMin() + 1;
  11388. this.handles.each( function( i ) {
  11389. var thisDistance = Math.abs( normValue - that.values( i ) );
  11390. if ( ( distance > thisDistance ) ||
  11391. ( distance === thisDistance &&
  11392. ( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) {
  11393. distance = thisDistance;
  11394. closestHandle = $( this );
  11395. index = i;
  11396. }
  11397. } );
  11398. allowed = this._start( event, index );
  11399. if ( allowed === false ) {
  11400. return false;
  11401. }
  11402. this._mouseSliding = true;
  11403. this._handleIndex = index;
  11404. this._addClass( closestHandle, null, "ui-state-active" );
  11405. closestHandle.trigger( "focus" );
  11406. offset = closestHandle.offset();
  11407. mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
  11408. this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
  11409. left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
  11410. top: event.pageY - offset.top -
  11411. ( closestHandle.height() / 2 ) -
  11412. ( parseInt( closestHandle.css( "borderTopWidth" ), 10 ) || 0 ) -
  11413. ( parseInt( closestHandle.css( "borderBottomWidth" ), 10 ) || 0 ) +
  11414. ( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 )
  11415. };
  11416. if ( !this.handles.hasClass( "ui-state-hover" ) ) {
  11417. this._slide( event, index, normValue );
  11418. }
  11419. this._animateOff = true;
  11420. return true;
  11421. },
  11422. _mouseStart: function() {
  11423. return true;
  11424. },
  11425. _mouseDrag: function( event ) {
  11426. var position = { x: event.pageX, y: event.pageY },
  11427. normValue = this._normValueFromMouse( position );
  11428. this._slide( event, this._handleIndex, normValue );
  11429. return false;
  11430. },
  11431. _mouseStop: function( event ) {
  11432. this._removeClass( this.handles, null, "ui-state-active" );
  11433. this._mouseSliding = false;
  11434. this._stop( event, this._handleIndex );
  11435. this._change( event, this._handleIndex );
  11436. this._handleIndex = null;
  11437. this._clickOffset = null;
  11438. this._animateOff = false;
  11439. return false;
  11440. },
  11441. _detectOrientation: function() {
  11442. this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
  11443. },
  11444. _normValueFromMouse: function( position ) {
  11445. var pixelTotal,
  11446. pixelMouse,
  11447. percentMouse,
  11448. valueTotal,
  11449. valueMouse;
  11450. if ( this.orientation === "horizontal" ) {
  11451. pixelTotal = this.elementSize.width;
  11452. pixelMouse = position.x - this.elementOffset.left -
  11453. ( this._clickOffset ? this._clickOffset.left : 0 );
  11454. } else {
  11455. pixelTotal = this.elementSize.height;
  11456. pixelMouse = position.y - this.elementOffset.top -
  11457. ( this._clickOffset ? this._clickOffset.top : 0 );
  11458. }
  11459. percentMouse = ( pixelMouse / pixelTotal );
  11460. if ( percentMouse > 1 ) {
  11461. percentMouse = 1;
  11462. }
  11463. if ( percentMouse < 0 ) {
  11464. percentMouse = 0;
  11465. }
  11466. if ( this.orientation === "vertical" ) {
  11467. percentMouse = 1 - percentMouse;
  11468. }
  11469. valueTotal = this._valueMax() - this._valueMin();
  11470. valueMouse = this._valueMin() + percentMouse * valueTotal;
  11471. return this._trimAlignValue( valueMouse );
  11472. },
  11473. _uiHash: function( index, value, values ) {
  11474. var uiHash = {
  11475. handle: this.handles[ index ],
  11476. handleIndex: index,
  11477. value: value !== undefined ? value : this.value()
  11478. };
  11479. if ( this._hasMultipleValues() ) {
  11480. uiHash.value = value !== undefined ? value : this.values( index );
  11481. uiHash.values = values || this.values();
  11482. }
  11483. return uiHash;
  11484. },
  11485. _hasMultipleValues: function() {
  11486. return this.options.values && this.options.values.length;
  11487. },
  11488. _start: function( event, index ) {
  11489. return this._trigger( "start", event, this._uiHash( index ) );
  11490. },
  11491. _slide: function( event, index, newVal ) {
  11492. var allowed, otherVal,
  11493. currentValue = this.value(),
  11494. newValues = this.values();
  11495. if ( this._hasMultipleValues() ) {
  11496. otherVal = this.values( index ? 0 : 1 );
  11497. currentValue = this.values( index );
  11498. if ( this.options.values.length === 2 && this.options.range === true ) {
  11499. newVal = index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, newVal );
  11500. }
  11501. newValues[ index ] = newVal;
  11502. }
  11503. if ( newVal === currentValue ) {
  11504. return;
  11505. }
  11506. allowed = this._trigger( "slide", event, this._uiHash( index, newVal, newValues ) );
  11507. // A slide can be canceled by returning false from the slide callback
  11508. if ( allowed === false ) {
  11509. return;
  11510. }
  11511. if ( this._hasMultipleValues() ) {
  11512. this.values( index, newVal );
  11513. } else {
  11514. this.value( newVal );
  11515. }
  11516. },
  11517. _stop: function( event, index ) {
  11518. this._trigger( "stop", event, this._uiHash( index ) );
  11519. },
  11520. _change: function( event, index ) {
  11521. if ( !this._keySliding && !this._mouseSliding ) {
  11522. //store the last changed value index for reference when handles overlap
  11523. this._lastChangedValue = index;
  11524. this._trigger( "change", event, this._uiHash( index ) );
  11525. }
  11526. },
  11527. value: function( newValue ) {
  11528. if ( arguments.length ) {
  11529. this.options.value = this._trimAlignValue( newValue );
  11530. this._refreshValue();
  11531. this._change( null, 0 );
  11532. return;
  11533. }
  11534. return this._value();
  11535. },
  11536. values: function( index, newValue ) {
  11537. var vals,
  11538. newValues,
  11539. i;
  11540. if ( arguments.length > 1 ) {
  11541. this.options.values[ index ] = this._trimAlignValue( newValue );
  11542. this._refreshValue();
  11543. this._change( null, index );
  11544. return;
  11545. }
  11546. if ( arguments.length ) {
  11547. if ( $.isArray( arguments[ 0 ] ) ) {
  11548. vals = this.options.values;
  11549. newValues = arguments[ 0 ];
  11550. for ( i = 0; i < vals.length; i += 1 ) {
  11551. vals[ i ] = this._trimAlignValue( newValues[ i ] );
  11552. this._change( null, i );
  11553. }
  11554. this._refreshValue();
  11555. } else {
  11556. if ( this._hasMultipleValues() ) {
  11557. return this._values( index );
  11558. } else {
  11559. return this.value();
  11560. }
  11561. }
  11562. } else {
  11563. return this._values();
  11564. }
  11565. },
  11566. _setOption: function( key, value ) {
  11567. var i,
  11568. valsLength = 0;
  11569. if ( key === "range" && this.options.range === true ) {
  11570. if ( value === "min" ) {
  11571. this.options.value = this._values( 0 );
  11572. this.options.values = null;
  11573. } else if ( value === "max" ) {
  11574. this.options.value = this._values( this.options.values.length - 1 );
  11575. this.options.values = null;
  11576. }
  11577. }
  11578. if ( $.isArray( this.options.values ) ) {
  11579. valsLength = this.options.values.length;
  11580. }
  11581. this._super( key, value );
  11582. switch ( key ) {
  11583. case "orientation":
  11584. this._detectOrientation();
  11585. this._removeClass( "ui-slider-horizontal ui-slider-vertical" )
  11586. ._addClass( "ui-slider-" + this.orientation );
  11587. this._refreshValue();
  11588. if ( this.options.range ) {
  11589. this._refreshRange( value );
  11590. }
  11591. // Reset positioning from previous orientation
  11592. this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
  11593. break;
  11594. case "value":
  11595. this._animateOff = true;
  11596. this._refreshValue();
  11597. this._change( null, 0 );
  11598. this._animateOff = false;
  11599. break;
  11600. case "values":
  11601. this._animateOff = true;
  11602. this._refreshValue();
  11603. // Start from the last handle to prevent unreachable handles (#9046)
  11604. for ( i = valsLength - 1; i >= 0; i-- ) {
  11605. this._change( null, i );
  11606. }
  11607. this._animateOff = false;
  11608. break;
  11609. case "step":
  11610. case "min":
  11611. case "max":
  11612. this._animateOff = true;
  11613. this._calculateNewMax();
  11614. this._refreshValue();
  11615. this._animateOff = false;
  11616. break;
  11617. case "range":
  11618. this._animateOff = true;
  11619. this._refresh();
  11620. this._animateOff = false;
  11621. break;
  11622. }
  11623. },
  11624. _setOptionDisabled: function( value ) {
  11625. this._super( value );
  11626. this._toggleClass( null, "ui-state-disabled", !!value );
  11627. },
  11628. //internal value getter
  11629. // _value() returns value trimmed by min and max, aligned by step
  11630. _value: function() {
  11631. var val = this.options.value;
  11632. val = this._trimAlignValue( val );
  11633. return val;
  11634. },
  11635. //internal values getter
  11636. // _values() returns array of values trimmed by min and max, aligned by step
  11637. // _values( index ) returns single value trimmed by min and max, aligned by step
  11638. _values: function( index ) {
  11639. var val,
  11640. vals,
  11641. i;
  11642. if ( arguments.length ) {
  11643. val = this.options.values[ index ];
  11644. val = this._trimAlignValue( val );
  11645. return val;
  11646. } else if ( this._hasMultipleValues() ) {
  11647. // .slice() creates a copy of the array
  11648. // this copy gets trimmed by min and max and then returned
  11649. vals = this.options.values.slice();
  11650. for ( i = 0; i < vals.length; i += 1 ) {
  11651. vals[ i ] = this._trimAlignValue( vals[ i ] );
  11652. }
  11653. return vals;
  11654. } else {
  11655. return [];
  11656. }
  11657. },
  11658. // Returns the step-aligned value that val is closest to, between (inclusive) min and max
  11659. _trimAlignValue: function( val ) {
  11660. if ( val <= this._valueMin() ) {
  11661. return this._valueMin();
  11662. }
  11663. if ( val >= this._valueMax() ) {
  11664. return this._valueMax();
  11665. }
  11666. var step = ( this.options.step > 0 ) ? this.options.step : 1,
  11667. valModStep = ( val - this._valueMin() ) % step,
  11668. alignValue = val - valModStep;
  11669. if ( Math.abs( valModStep ) * 2 >= step ) {
  11670. alignValue += ( valModStep > 0 ) ? step : ( -step );
  11671. }
  11672. // Since JavaScript has problems with large floats, round
  11673. // the final value to 5 digits after the decimal point (see #4124)
  11674. return parseFloat( alignValue.toFixed( 5 ) );
  11675. },
  11676. _calculateNewMax: function() {
  11677. var max = this.options.max,
  11678. min = this._valueMin(),
  11679. step = this.options.step,
  11680. aboveMin = Math.round( ( max - min ) / step ) * step;
  11681. max = aboveMin + min;
  11682. if ( max > this.options.max ) {
  11683. //If max is not divisible by step, rounding off may increase its value
  11684. max -= step;
  11685. }
  11686. this.max = parseFloat( max.toFixed( this._precision() ) );
  11687. },
  11688. _precision: function() {
  11689. var precision = this._precisionOf( this.options.step );
  11690. if ( this.options.min !== null ) {
  11691. precision = Math.max( precision, this._precisionOf( this.options.min ) );
  11692. }
  11693. return precision;
  11694. },
  11695. _precisionOf: function( num ) {
  11696. var str = num.toString(),
  11697. decimal = str.indexOf( "." );
  11698. return decimal === -1 ? 0 : str.length - decimal - 1;
  11699. },
  11700. _valueMin: function() {
  11701. return this.options.min;
  11702. },
  11703. _valueMax: function() {
  11704. return this.max;
  11705. },
  11706. _refreshRange: function( orientation ) {
  11707. if ( orientation === "vertical" ) {
  11708. this.range.css( { "width": "", "left": "" } );
  11709. }
  11710. if ( orientation === "horizontal" ) {
  11711. this.range.css( { "height": "", "bottom": "" } );
  11712. }
  11713. },
  11714. _refreshValue: function() {
  11715. var lastValPercent, valPercent, value, valueMin, valueMax,
  11716. oRange = this.options.range,
  11717. o = this.options,
  11718. that = this,
  11719. animate = ( !this._animateOff ) ? o.animate : false,
  11720. _set = {};
  11721. if ( this._hasMultipleValues() ) {
  11722. this.handles.each( function( i ) {
  11723. valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() -
  11724. that._valueMin() ) * 100;
  11725. _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  11726. $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  11727. if ( that.options.range === true ) {
  11728. if ( that.orientation === "horizontal" ) {
  11729. if ( i === 0 ) {
  11730. that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  11731. left: valPercent + "%"
  11732. }, o.animate );
  11733. }
  11734. if ( i === 1 ) {
  11735. that.range[ animate ? "animate" : "css" ]( {
  11736. width: ( valPercent - lastValPercent ) + "%"
  11737. }, {
  11738. queue: false,
  11739. duration: o.animate
  11740. } );
  11741. }
  11742. } else {
  11743. if ( i === 0 ) {
  11744. that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  11745. bottom: ( valPercent ) + "%"
  11746. }, o.animate );
  11747. }
  11748. if ( i === 1 ) {
  11749. that.range[ animate ? "animate" : "css" ]( {
  11750. height: ( valPercent - lastValPercent ) + "%"
  11751. }, {
  11752. queue: false,
  11753. duration: o.animate
  11754. } );
  11755. }
  11756. }
  11757. }
  11758. lastValPercent = valPercent;
  11759. } );
  11760. } else {
  11761. value = this.value();
  11762. valueMin = this._valueMin();
  11763. valueMax = this._valueMax();
  11764. valPercent = ( valueMax !== valueMin ) ?
  11765. ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
  11766. 0;
  11767. _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  11768. this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  11769. if ( oRange === "min" && this.orientation === "horizontal" ) {
  11770. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  11771. width: valPercent + "%"
  11772. }, o.animate );
  11773. }
  11774. if ( oRange === "max" && this.orientation === "horizontal" ) {
  11775. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  11776. width: ( 100 - valPercent ) + "%"
  11777. }, o.animate );
  11778. }
  11779. if ( oRange === "min" && this.orientation === "vertical" ) {
  11780. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  11781. height: valPercent + "%"
  11782. }, o.animate );
  11783. }
  11784. if ( oRange === "max" && this.orientation === "vertical" ) {
  11785. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  11786. height: ( 100 - valPercent ) + "%"
  11787. }, o.animate );
  11788. }
  11789. }
  11790. },
  11791. _handleEvents: {
  11792. keydown: function( event ) {
  11793. var allowed, curVal, newVal, step,
  11794. index = $( event.target ).data( "ui-slider-handle-index" );
  11795. switch ( event.keyCode ) {
  11796. case $.ui.keyCode.HOME:
  11797. case $.ui.keyCode.END:
  11798. case $.ui.keyCode.PAGE_UP:
  11799. case $.ui.keyCode.PAGE_DOWN:
  11800. case $.ui.keyCode.UP:
  11801. case $.ui.keyCode.RIGHT:
  11802. case $.ui.keyCode.DOWN:
  11803. case $.ui.keyCode.LEFT:
  11804. event.preventDefault();
  11805. if ( !this._keySliding ) {
  11806. this._keySliding = true;
  11807. this._addClass( $( event.target ), null, "ui-state-active" );
  11808. allowed = this._start( event, index );
  11809. if ( allowed === false ) {
  11810. return;
  11811. }
  11812. }
  11813. break;
  11814. }
  11815. step = this.options.step;
  11816. if ( this._hasMultipleValues() ) {
  11817. curVal = newVal = this.values( index );
  11818. } else {
  11819. curVal = newVal = this.value();
  11820. }
  11821. switch ( event.keyCode ) {
  11822. case $.ui.keyCode.HOME:
  11823. newVal = this._valueMin();
  11824. break;
  11825. case $.ui.keyCode.END:
  11826. newVal = this._valueMax();
  11827. break;
  11828. case $.ui.keyCode.PAGE_UP:
  11829. newVal = this._trimAlignValue(
  11830. curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
  11831. );
  11832. break;
  11833. case $.ui.keyCode.PAGE_DOWN:
  11834. newVal = this._trimAlignValue(
  11835. curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) );
  11836. break;
  11837. case $.ui.keyCode.UP:
  11838. case $.ui.keyCode.RIGHT:
  11839. if ( curVal === this._valueMax() ) {
  11840. return;
  11841. }
  11842. newVal = this._trimAlignValue( curVal + step );
  11843. break;
  11844. case $.ui.keyCode.DOWN:
  11845. case $.ui.keyCode.LEFT:
  11846. if ( curVal === this._valueMin() ) {
  11847. return;
  11848. }
  11849. newVal = this._trimAlignValue( curVal - step );
  11850. break;
  11851. }
  11852. this._slide( event, index, newVal );
  11853. },
  11854. keyup: function( event ) {
  11855. var index = $( event.target ).data( "ui-slider-handle-index" );
  11856. if ( this._keySliding ) {
  11857. this._keySliding = false;
  11858. this._stop( event, index );
  11859. this._change( event, index );
  11860. this._removeClass( $( event.target ), null, "ui-state-active" );
  11861. }
  11862. }
  11863. }
  11864. } );
  11865. /*!
  11866. * jQuery UI Spinner 1.12.1
  11867. * http://jqueryui.com
  11868. *
  11869. * Copyright jQuery Foundation and other contributors
  11870. * Released under the MIT license.
  11871. * http://jquery.org/license
  11872. */
  11873. //>>label: Spinner
  11874. //>>group: Widgets
  11875. //>>description: Displays buttons to easily input numbers via the keyboard or mouse.
  11876. //>>docs: http://api.jqueryui.com/spinner/
  11877. //>>demos: http://jqueryui.com/spinner/
  11878. //>>css.structure: ../../themes/base/core.css
  11879. //>>css.structure: ../../themes/base/spinner.css
  11880. //>>css.theme: ../../themes/base/theme.css
  11881. function spinnerModifer( fn ) {
  11882. return function() {
  11883. var previous = this.element.val();
  11884. fn.apply( this, arguments );
  11885. this._refresh();
  11886. if ( previous !== this.element.val() ) {
  11887. this._trigger( "change" );
  11888. }
  11889. };
  11890. }
  11891. $.widget( "ui.spinner", {
  11892. version: "1.12.1",
  11893. defaultElement: "<input>",
  11894. widgetEventPrefix: "spin",
  11895. options: {
  11896. classes: {
  11897. "ui-spinner": "ui-corner-all",
  11898. "ui-spinner-down": "ui-corner-br",
  11899. "ui-spinner-up": "ui-corner-tr"
  11900. },
  11901. culture: null,
  11902. icons: {
  11903. down: "ui-icon-triangle-1-s",
  11904. up: "ui-icon-triangle-1-n"
  11905. },
  11906. incremental: true,
  11907. max: null,
  11908. min: null,
  11909. numberFormat: null,
  11910. page: 10,
  11911. step: 1,
  11912. change: null,
  11913. spin: null,
  11914. start: null,
  11915. stop: null
  11916. },
  11917. _create: function() {
  11918. // handle string values that need to be parsed
  11919. this._setOption( "max", this.options.max );
  11920. this._setOption( "min", this.options.min );
  11921. this._setOption( "step", this.options.step );
  11922. // Only format if there is a value, prevents the field from being marked
  11923. // as invalid in Firefox, see #9573.
  11924. if ( this.value() !== "" ) {
  11925. // Format the value, but don't constrain.
  11926. this._value( this.element.val(), true );
  11927. }
  11928. this._draw();
  11929. this._on( this._events );
  11930. this._refresh();
  11931. // Turning off autocomplete prevents the browser from remembering the
  11932. // value when navigating through history, so we re-enable autocomplete
  11933. // if the page is unloaded before the widget is destroyed. #7790
  11934. this._on( this.window, {
  11935. beforeunload: function() {
  11936. this.element.removeAttr( "autocomplete" );
  11937. }
  11938. } );
  11939. },
  11940. _getCreateOptions: function() {
  11941. var options = this._super();
  11942. var element = this.element;
  11943. $.each( [ "min", "max", "step" ], function( i, option ) {
  11944. var value = element.attr( option );
  11945. if ( value != null && value.length ) {
  11946. options[ option ] = value;
  11947. }
  11948. } );
  11949. return options;
  11950. },
  11951. _events: {
  11952. keydown: function( event ) {
  11953. if ( this._start( event ) && this._keydown( event ) ) {
  11954. event.preventDefault();
  11955. }
  11956. },
  11957. keyup: "_stop",
  11958. focus: function() {
  11959. this.previous = this.element.val();
  11960. },
  11961. blur: function( event ) {
  11962. if ( this.cancelBlur ) {
  11963. delete this.cancelBlur;
  11964. return;
  11965. }
  11966. this._stop();
  11967. this._refresh();
  11968. if ( this.previous !== this.element.val() ) {
  11969. this._trigger( "change", event );
  11970. }
  11971. },
  11972. mousewheel: function( event, delta ) {
  11973. if ( !delta ) {
  11974. return;
  11975. }
  11976. if ( !this.spinning && !this._start( event ) ) {
  11977. return false;
  11978. }
  11979. this._spin( ( delta > 0 ? 1 : -1 ) * this.options.step, event );
  11980. clearTimeout( this.mousewheelTimer );
  11981. this.mousewheelTimer = this._delay( function() {
  11982. if ( this.spinning ) {
  11983. this._stop( event );
  11984. }
  11985. }, 100 );
  11986. event.preventDefault();
  11987. },
  11988. "mousedown .ui-spinner-button": function( event ) {
  11989. var previous;
  11990. // We never want the buttons to have focus; whenever the user is
  11991. // interacting with the spinner, the focus should be on the input.
  11992. // If the input is focused then this.previous is properly set from
  11993. // when the input first received focus. If the input is not focused
  11994. // then we need to set this.previous based on the value before spinning.
  11995. previous = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] ) ?
  11996. this.previous : this.element.val();
  11997. function checkFocus() {
  11998. var isActive = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] );
  11999. if ( !isActive ) {
  12000. this.element.trigger( "focus" );
  12001. this.previous = previous;
  12002. // support: IE
  12003. // IE sets focus asynchronously, so we need to check if focus
  12004. // moved off of the input because the user clicked on the button.
  12005. this._delay( function() {
  12006. this.previous = previous;
  12007. } );
  12008. }
  12009. }
  12010. // Ensure focus is on (or stays on) the text field
  12011. event.preventDefault();
  12012. checkFocus.call( this );
  12013. // Support: IE
  12014. // IE doesn't prevent moving focus even with event.preventDefault()
  12015. // so we set a flag to know when we should ignore the blur event
  12016. // and check (again) if focus moved off of the input.
  12017. this.cancelBlur = true;
  12018. this._delay( function() {
  12019. delete this.cancelBlur;
  12020. checkFocus.call( this );
  12021. } );
  12022. if ( this._start( event ) === false ) {
  12023. return;
  12024. }
  12025. this._repeat( null, $( event.currentTarget )
  12026. .hasClass( "ui-spinner-up" ) ? 1 : -1, event );
  12027. },
  12028. "mouseup .ui-spinner-button": "_stop",
  12029. "mouseenter .ui-spinner-button": function( event ) {
  12030. // button will add ui-state-active if mouse was down while mouseleave and kept down
  12031. if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
  12032. return;
  12033. }
  12034. if ( this._start( event ) === false ) {
  12035. return false;
  12036. }
  12037. this._repeat( null, $( event.currentTarget )
  12038. .hasClass( "ui-spinner-up" ) ? 1 : -1, event );
  12039. },
  12040. // TODO: do we really want to consider this a stop?
  12041. // shouldn't we just stop the repeater and wait until mouseup before
  12042. // we trigger the stop event?
  12043. "mouseleave .ui-spinner-button": "_stop"
  12044. },
  12045. // Support mobile enhanced option and make backcompat more sane
  12046. _enhance: function() {
  12047. this.uiSpinner = this.element
  12048. .attr( "autocomplete", "off" )
  12049. .wrap( "<span>" )
  12050. .parent()
  12051. // Add buttons
  12052. .append(
  12053. "<a></a><a></a>"
  12054. );
  12055. },
  12056. _draw: function() {
  12057. this._enhance();
  12058. this._addClass( this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content" );
  12059. this._addClass( "ui-spinner-input" );
  12060. this.element.attr( "role", "spinbutton" );
  12061. // Button bindings
  12062. this.buttons = this.uiSpinner.children( "a" )
  12063. .attr( "tabIndex", -1 )
  12064. .attr( "aria-hidden", true )
  12065. .button( {
  12066. classes: {
  12067. "ui-button": ""
  12068. }
  12069. } );
  12070. // TODO: Right now button does not support classes this is already updated in button PR
  12071. this._removeClass( this.buttons, "ui-corner-all" );
  12072. this._addClass( this.buttons.first(), "ui-spinner-button ui-spinner-up" );
  12073. this._addClass( this.buttons.last(), "ui-spinner-button ui-spinner-down" );
  12074. this.buttons.first().button( {
  12075. "icon": this.options.icons.up,
  12076. "showLabel": false
  12077. } );
  12078. this.buttons.last().button( {
  12079. "icon": this.options.icons.down,
  12080. "showLabel": false
  12081. } );
  12082. // IE 6 doesn't understand height: 50% for the buttons
  12083. // unless the wrapper has an explicit height
  12084. if ( this.buttons.height() > Math.ceil( this.uiSpinner.height() * 0.5 ) &&
  12085. this.uiSpinner.height() > 0 ) {
  12086. this.uiSpinner.height( this.uiSpinner.height() );
  12087. }
  12088. },
  12089. _keydown: function( event ) {
  12090. var options = this.options,
  12091. keyCode = $.ui.keyCode;
  12092. switch ( event.keyCode ) {
  12093. case keyCode.UP:
  12094. this._repeat( null, 1, event );
  12095. return true;
  12096. case keyCode.DOWN:
  12097. this._repeat( null, -1, event );
  12098. return true;
  12099. case keyCode.PAGE_UP:
  12100. this._repeat( null, options.page, event );
  12101. return true;
  12102. case keyCode.PAGE_DOWN:
  12103. this._repeat( null, -options.page, event );
  12104. return true;
  12105. }
  12106. return false;
  12107. },
  12108. _start: function( event ) {
  12109. if ( !this.spinning && this._trigger( "start", event ) === false ) {
  12110. return false;
  12111. }
  12112. if ( !this.counter ) {
  12113. this.counter = 1;
  12114. }
  12115. this.spinning = true;
  12116. return true;
  12117. },
  12118. _repeat: function( i, steps, event ) {
  12119. i = i || 500;
  12120. clearTimeout( this.timer );
  12121. this.timer = this._delay( function() {
  12122. this._repeat( 40, steps, event );
  12123. }, i );
  12124. this._spin( steps * this.options.step, event );
  12125. },
  12126. _spin: function( step, event ) {
  12127. var value = this.value() || 0;
  12128. if ( !this.counter ) {
  12129. this.counter = 1;
  12130. }
  12131. value = this._adjustValue( value + step * this._increment( this.counter ) );
  12132. if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false ) {
  12133. this._value( value );
  12134. this.counter++;
  12135. }
  12136. },
  12137. _increment: function( i ) {
  12138. var incremental = this.options.incremental;
  12139. if ( incremental ) {
  12140. return $.isFunction( incremental ) ?
  12141. incremental( i ) :
  12142. Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 );
  12143. }
  12144. return 1;
  12145. },
  12146. _precision: function() {
  12147. var precision = this._precisionOf( this.options.step );
  12148. if ( this.options.min !== null ) {
  12149. precision = Math.max( precision, this._precisionOf( this.options.min ) );
  12150. }
  12151. return precision;
  12152. },
  12153. _precisionOf: function( num ) {
  12154. var str = num.toString(),
  12155. decimal = str.indexOf( "." );
  12156. return decimal === -1 ? 0 : str.length - decimal - 1;
  12157. },
  12158. _adjustValue: function( value ) {
  12159. var base, aboveMin,
  12160. options = this.options;
  12161. // Make sure we're at a valid step
  12162. // - find out where we are relative to the base (min or 0)
  12163. base = options.min !== null ? options.min : 0;
  12164. aboveMin = value - base;
  12165. // - round to the nearest step
  12166. aboveMin = Math.round( aboveMin / options.step ) * options.step;
  12167. // - rounding is based on 0, so adjust back to our base
  12168. value = base + aboveMin;
  12169. // Fix precision from bad JS floating point math
  12170. value = parseFloat( value.toFixed( this._precision() ) );
  12171. // Clamp the value
  12172. if ( options.max !== null && value > options.max ) {
  12173. return options.max;
  12174. }
  12175. if ( options.min !== null && value < options.min ) {
  12176. return options.min;
  12177. }
  12178. return value;
  12179. },
  12180. _stop: function( event ) {
  12181. if ( !this.spinning ) {
  12182. return;
  12183. }
  12184. clearTimeout( this.timer );
  12185. clearTimeout( this.mousewheelTimer );
  12186. this.counter = 0;
  12187. this.spinning = false;
  12188. this._trigger( "stop", event );
  12189. },
  12190. _setOption: function( key, value ) {
  12191. var prevValue, first, last;
  12192. if ( key === "culture" || key === "numberFormat" ) {
  12193. prevValue = this._parse( this.element.val() );
  12194. this.options[ key ] = value;
  12195. this.element.val( this._format( prevValue ) );
  12196. return;
  12197. }
  12198. if ( key === "max" || key === "min" || key === "step" ) {
  12199. if ( typeof value === "string" ) {
  12200. value = this._parse( value );
  12201. }
  12202. }
  12203. if ( key === "icons" ) {
  12204. first = this.buttons.first().find( ".ui-icon" );
  12205. this._removeClass( first, null, this.options.icons.up );
  12206. this._addClass( first, null, value.up );
  12207. last = this.buttons.last().find( ".ui-icon" );
  12208. this._removeClass( last, null, this.options.icons.down );
  12209. this._addClass( last, null, value.down );
  12210. }
  12211. this._super( key, value );
  12212. },
  12213. _setOptionDisabled: function( value ) {
  12214. this._super( value );
  12215. this._toggleClass( this.uiSpinner, null, "ui-state-disabled", !!value );
  12216. this.element.prop( "disabled", !!value );
  12217. this.buttons.button( value ? "disable" : "enable" );
  12218. },
  12219. _setOptions: spinnerModifer( function( options ) {
  12220. this._super( options );
  12221. } ),
  12222. _parse: function( val ) {
  12223. if ( typeof val === "string" && val !== "" ) {
  12224. val = window.Globalize && this.options.numberFormat ?
  12225. Globalize.parseFloat( val, 10, this.options.culture ) : +val;
  12226. }
  12227. return val === "" || isNaN( val ) ? null : val;
  12228. },
  12229. _format: function( value ) {
  12230. if ( value === "" ) {
  12231. return "";
  12232. }
  12233. return window.Globalize && this.options.numberFormat ?
  12234. Globalize.format( value, this.options.numberFormat, this.options.culture ) :
  12235. value;
  12236. },
  12237. _refresh: function() {
  12238. this.element.attr( {
  12239. "aria-valuemin": this.options.min,
  12240. "aria-valuemax": this.options.max,
  12241. // TODO: what should we do with values that can't be parsed?
  12242. "aria-valuenow": this._parse( this.element.val() )
  12243. } );
  12244. },
  12245. isValid: function() {
  12246. var value = this.value();
  12247. // Null is invalid
  12248. if ( value === null ) {
  12249. return false;
  12250. }
  12251. // If value gets adjusted, it's invalid
  12252. return value === this._adjustValue( value );
  12253. },
  12254. // Update the value without triggering change
  12255. _value: function( value, allowAny ) {
  12256. var parsed;
  12257. if ( value !== "" ) {
  12258. parsed = this._parse( value );
  12259. if ( parsed !== null ) {
  12260. if ( !allowAny ) {
  12261. parsed = this._adjustValue( parsed );
  12262. }
  12263. value = this._format( parsed );
  12264. }
  12265. }
  12266. this.element.val( value );
  12267. this._refresh();
  12268. },
  12269. _destroy: function() {
  12270. this.element
  12271. .prop( "disabled", false )
  12272. .removeAttr( "autocomplete role aria-valuemin aria-valuemax aria-valuenow" );
  12273. this.uiSpinner.replaceWith( this.element );
  12274. },
  12275. stepUp: spinnerModifer( function( steps ) {
  12276. this._stepUp( steps );
  12277. } ),
  12278. _stepUp: function( steps ) {
  12279. if ( this._start() ) {
  12280. this._spin( ( steps || 1 ) * this.options.step );
  12281. this._stop();
  12282. }
  12283. },
  12284. stepDown: spinnerModifer( function( steps ) {
  12285. this._stepDown( steps );
  12286. } ),
  12287. _stepDown: function( steps ) {
  12288. if ( this._start() ) {
  12289. this._spin( ( steps || 1 ) * -this.options.step );
  12290. this._stop();
  12291. }
  12292. },
  12293. pageUp: spinnerModifer( function( pages ) {
  12294. this._stepUp( ( pages || 1 ) * this.options.page );
  12295. } ),
  12296. pageDown: spinnerModifer( function( pages ) {
  12297. this._stepDown( ( pages || 1 ) * this.options.page );
  12298. } ),
  12299. value: function( newVal ) {
  12300. if ( !arguments.length ) {
  12301. return this._parse( this.element.val() );
  12302. }
  12303. spinnerModifer( this._value ).call( this, newVal );
  12304. },
  12305. widget: function() {
  12306. return this.uiSpinner;
  12307. }
  12308. } );
  12309. // DEPRECATED
  12310. // TODO: switch return back to widget declaration at top of file when this is removed
  12311. if ( $.uiBackCompat !== false ) {
  12312. // Backcompat for spinner html extension points
  12313. $.widget( "ui.spinner", $.ui.spinner, {
  12314. _enhance: function() {
  12315. this.uiSpinner = this.element
  12316. .attr( "autocomplete", "off" )
  12317. .wrap( this._uiSpinnerHtml() )
  12318. .parent()
  12319. // Add buttons
  12320. .append( this._buttonHtml() );
  12321. },
  12322. _uiSpinnerHtml: function() {
  12323. return "<span>";
  12324. },
  12325. _buttonHtml: function() {
  12326. return "<a></a><a></a>";
  12327. }
  12328. } );
  12329. }
  12330. var widgetsSpinner = $.ui.spinner;
  12331. /*!
  12332. * jQuery UI Tabs 1.12.1
  12333. * http://jqueryui.com
  12334. *
  12335. * Copyright jQuery Foundation and other contributors
  12336. * Released under the MIT license.
  12337. * http://jquery.org/license
  12338. */
  12339. //>>label: Tabs
  12340. //>>group: Widgets
  12341. //>>description: Transforms a set of container elements into a tab structure.
  12342. //>>docs: http://api.jqueryui.com/tabs/
  12343. //>>demos: http://jqueryui.com/tabs/
  12344. //>>css.structure: ../../themes/base/core.css
  12345. //>>css.structure: ../../themes/base/tabs.css
  12346. //>>css.theme: ../../themes/base/theme.css
  12347. $.widget( "ui.tabs", {
  12348. version: "1.12.1",
  12349. delay: 300,
  12350. options: {
  12351. active: null,
  12352. classes: {
  12353. "ui-tabs": "ui-corner-all",
  12354. "ui-tabs-nav": "ui-corner-all",
  12355. "ui-tabs-panel": "ui-corner-bottom",
  12356. "ui-tabs-tab": "ui-corner-top"
  12357. },
  12358. collapsible: false,
  12359. event: "click",
  12360. heightStyle: "content",
  12361. hide: null,
  12362. show: null,
  12363. // Callbacks
  12364. activate: null,
  12365. beforeActivate: null,
  12366. beforeLoad: null,
  12367. load: null
  12368. },
  12369. _isLocal: ( function() {
  12370. var rhash = /#.*$/;
  12371. return function( anchor ) {
  12372. var anchorUrl, locationUrl;
  12373. anchorUrl = anchor.href.replace( rhash, "" );
  12374. locationUrl = location.href.replace( rhash, "" );
  12375. // Decoding may throw an error if the URL isn't UTF-8 (#9518)
  12376. try {
  12377. anchorUrl = decodeURIComponent( anchorUrl );
  12378. } catch ( error ) {}
  12379. try {
  12380. locationUrl = decodeURIComponent( locationUrl );
  12381. } catch ( error ) {}
  12382. return anchor.hash.length > 1 && anchorUrl === locationUrl;
  12383. };
  12384. } )(),
  12385. _create: function() {
  12386. var that = this,
  12387. options = this.options;
  12388. this.running = false;
  12389. this._addClass( "ui-tabs", "ui-widget ui-widget-content" );
  12390. this._toggleClass( "ui-tabs-collapsible", null, options.collapsible );
  12391. this._processTabs();
  12392. options.active = this._initialActive();
  12393. // Take disabling tabs via class attribute from HTML
  12394. // into account and update option properly.
  12395. if ( $.isArray( options.disabled ) ) {
  12396. options.disabled = $.unique( options.disabled.concat(
  12397. $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
  12398. return that.tabs.index( li );
  12399. } )
  12400. ) ).sort();
  12401. }
  12402. // Check for length avoids error when initializing empty list
  12403. if ( this.options.active !== false && this.anchors.length ) {
  12404. this.active = this._findActive( options.active );
  12405. } else {
  12406. this.active = $();
  12407. }
  12408. this._refresh();
  12409. if ( this.active.length ) {
  12410. this.load( options.active );
  12411. }
  12412. },
  12413. _initialActive: function() {
  12414. var active = this.options.active,
  12415. collapsible = this.options.collapsible,
  12416. locationHash = location.hash.substring( 1 );
  12417. if ( active === null ) {
  12418. // check the fragment identifier in the URL
  12419. if ( locationHash ) {
  12420. this.tabs.each( function( i, tab ) {
  12421. if ( $( tab ).attr( "aria-controls" ) === locationHash ) {
  12422. active = i;
  12423. return false;
  12424. }
  12425. } );
  12426. }
  12427. // Check for a tab marked active via a class
  12428. if ( active === null ) {
  12429. active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );
  12430. }
  12431. // No active tab, set to false
  12432. if ( active === null || active === -1 ) {
  12433. active = this.tabs.length ? 0 : false;
  12434. }
  12435. }
  12436. // Handle numbers: negative, out of range
  12437. if ( active !== false ) {
  12438. active = this.tabs.index( this.tabs.eq( active ) );
  12439. if ( active === -1 ) {
  12440. active = collapsible ? false : 0;
  12441. }
  12442. }
  12443. // Don't allow collapsible: false and active: false
  12444. if ( !collapsible && active === false && this.anchors.length ) {
  12445. active = 0;
  12446. }
  12447. return active;
  12448. },
  12449. _getCreateEventData: function() {
  12450. return {
  12451. tab: this.active,
  12452. panel: !this.active.length ? $() : this._getPanelForTab( this.active )
  12453. };
  12454. },
  12455. _tabKeydown: function( event ) {
  12456. var focusedTab = $( $.ui.safeActiveElement( this.document[ 0 ] ) ).closest( "li" ),
  12457. selectedIndex = this.tabs.index( focusedTab ),
  12458. goingForward = true;
  12459. if ( this._handlePageNav( event ) ) {
  12460. return;
  12461. }
  12462. switch ( event.keyCode ) {
  12463. case $.ui.keyCode.RIGHT:
  12464. case $.ui.keyCode.DOWN:
  12465. selectedIndex++;
  12466. break;
  12467. case $.ui.keyCode.UP:
  12468. case $.ui.keyCode.LEFT:
  12469. goingForward = false;
  12470. selectedIndex--;
  12471. break;
  12472. case $.ui.keyCode.END:
  12473. selectedIndex = this.anchors.length - 1;
  12474. break;
  12475. case $.ui.keyCode.HOME:
  12476. selectedIndex = 0;
  12477. break;
  12478. case $.ui.keyCode.SPACE:
  12479. // Activate only, no collapsing
  12480. event.preventDefault();
  12481. clearTimeout( this.activating );
  12482. this._activate( selectedIndex );
  12483. return;
  12484. case $.ui.keyCode.ENTER:
  12485. // Toggle (cancel delayed activation, allow collapsing)
  12486. event.preventDefault();
  12487. clearTimeout( this.activating );
  12488. // Determine if we should collapse or activate
  12489. this._activate( selectedIndex === this.options.active ? false : selectedIndex );
  12490. return;
  12491. default:
  12492. return;
  12493. }
  12494. // Focus the appropriate tab, based on which key was pressed
  12495. event.preventDefault();
  12496. clearTimeout( this.activating );
  12497. selectedIndex = this._focusNextTab( selectedIndex, goingForward );
  12498. // Navigating with control/command key will prevent automatic activation
  12499. if ( !event.ctrlKey && !event.metaKey ) {
  12500. // Update aria-selected immediately so that AT think the tab is already selected.
  12501. // Otherwise AT may confuse the user by stating that they need to activate the tab,
  12502. // but the tab will already be activated by the time the announcement finishes.
  12503. focusedTab.attr( "aria-selected", "false" );
  12504. this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
  12505. this.activating = this._delay( function() {
  12506. this.option( "active", selectedIndex );
  12507. }, this.delay );
  12508. }
  12509. },
  12510. _panelKeydown: function( event ) {
  12511. if ( this._handlePageNav( event ) ) {
  12512. return;
  12513. }
  12514. // Ctrl+up moves focus to the current tab
  12515. if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
  12516. event.preventDefault();
  12517. this.active.trigger( "focus" );
  12518. }
  12519. },
  12520. // Alt+page up/down moves focus to the previous/next tab (and activates)
  12521. _handlePageNav: function( event ) {
  12522. if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {
  12523. this._activate( this._focusNextTab( this.options.active - 1, false ) );
  12524. return true;
  12525. }
  12526. if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) {
  12527. this._activate( this._focusNextTab( this.options.active + 1, true ) );
  12528. return true;
  12529. }
  12530. },
  12531. _findNextTab: function( index, goingForward ) {
  12532. var lastTabIndex = this.tabs.length - 1;
  12533. function constrain() {
  12534. if ( index > lastTabIndex ) {
  12535. index = 0;
  12536. }
  12537. if ( index < 0 ) {
  12538. index = lastTabIndex;
  12539. }
  12540. return index;
  12541. }
  12542. while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) {
  12543. index = goingForward ? index + 1 : index - 1;
  12544. }
  12545. return index;
  12546. },
  12547. _focusNextTab: function( index, goingForward ) {
  12548. index = this._findNextTab( index, goingForward );
  12549. this.tabs.eq( index ).trigger( "focus" );
  12550. return index;
  12551. },
  12552. _setOption: function( key, value ) {
  12553. if ( key === "active" ) {
  12554. // _activate() will handle invalid values and update this.options
  12555. this._activate( value );
  12556. return;
  12557. }
  12558. this._super( key, value );
  12559. if ( key === "collapsible" ) {
  12560. this._toggleClass( "ui-tabs-collapsible", null, value );
  12561. // Setting collapsible: false while collapsed; open first panel
  12562. if ( !value && this.options.active === false ) {
  12563. this._activate( 0 );
  12564. }
  12565. }
  12566. if ( key === "event" ) {
  12567. this._setupEvents( value );
  12568. }
  12569. if ( key === "heightStyle" ) {
  12570. this._setupHeightStyle( value );
  12571. }
  12572. },
  12573. _sanitizeSelector: function( hash ) {
  12574. return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";
  12575. },
  12576. refresh: function() {
  12577. var options = this.options,
  12578. lis = this.tablist.children( ":has(a[href])" );
  12579. // Get disabled tabs from class attribute from HTML
  12580. // this will get converted to a boolean if needed in _refresh()
  12581. options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) {
  12582. return lis.index( tab );
  12583. } );
  12584. this._processTabs();
  12585. // Was collapsed or no tabs
  12586. if ( options.active === false || !this.anchors.length ) {
  12587. options.active = false;
  12588. this.active = $();
  12589. // was active, but active tab is gone
  12590. } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {
  12591. // all remaining tabs are disabled
  12592. if ( this.tabs.length === options.disabled.length ) {
  12593. options.active = false;
  12594. this.active = $();
  12595. // activate previous tab
  12596. } else {
  12597. this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );
  12598. }
  12599. // was active, active tab still exists
  12600. } else {
  12601. // make sure active index is correct
  12602. options.active = this.tabs.index( this.active );
  12603. }
  12604. this._refresh();
  12605. },
  12606. _refresh: function() {
  12607. this._setOptionDisabled( this.options.disabled );
  12608. this._setupEvents( this.options.event );
  12609. this._setupHeightStyle( this.options.heightStyle );
  12610. this.tabs.not( this.active ).attr( {
  12611. "aria-selected": "false",
  12612. "aria-expanded": "false",
  12613. tabIndex: -1
  12614. } );
  12615. this.panels.not( this._getPanelForTab( this.active ) )
  12616. .hide()
  12617. .attr( {
  12618. "aria-hidden": "true"
  12619. } );
  12620. // Make sure one tab is in the tab order
  12621. if ( !this.active.length ) {
  12622. this.tabs.eq( 0 ).attr( "tabIndex", 0 );
  12623. } else {
  12624. this.active
  12625. .attr( {
  12626. "aria-selected": "true",
  12627. "aria-expanded": "true",
  12628. tabIndex: 0
  12629. } );
  12630. this._addClass( this.active, "ui-tabs-active", "ui-state-active" );
  12631. this._getPanelForTab( this.active )
  12632. .show()
  12633. .attr( {
  12634. "aria-hidden": "false"
  12635. } );
  12636. }
  12637. },
  12638. _processTabs: function() {
  12639. var that = this,
  12640. prevTabs = this.tabs,
  12641. prevAnchors = this.anchors,
  12642. prevPanels = this.panels;
  12643. this.tablist = this._getList().attr( "role", "tablist" );
  12644. this._addClass( this.tablist, "ui-tabs-nav",
  12645. "ui-helper-reset ui-helper-clearfix ui-widget-header" );
  12646. // Prevent users from focusing disabled tabs via click
  12647. this.tablist
  12648. .on( "mousedown" + this.eventNamespace, "> li", function( event ) {
  12649. if ( $( this ).is( ".ui-state-disabled" ) ) {
  12650. event.preventDefault();
  12651. }
  12652. } )
  12653. // Support: IE <9
  12654. // Preventing the default action in mousedown doesn't prevent IE
  12655. // from focusing the element, so if the anchor gets focused, blur.
  12656. // We don't have to worry about focusing the previously focused
  12657. // element since clicking on a non-focusable element should focus
  12658. // the body anyway.
  12659. .on( "focus" + this.eventNamespace, ".ui-tabs-anchor", function() {
  12660. if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
  12661. this.blur();
  12662. }
  12663. } );
  12664. this.tabs = this.tablist.find( "> li:has(a[href])" )
  12665. .attr( {
  12666. role: "tab",
  12667. tabIndex: -1
  12668. } );
  12669. this._addClass( this.tabs, "ui-tabs-tab", "ui-state-default" );
  12670. this.anchors = this.tabs.map( function() {
  12671. return $( "a", this )[ 0 ];
  12672. } )
  12673. .attr( {
  12674. role: "presentation",
  12675. tabIndex: -1
  12676. } );
  12677. this._addClass( this.anchors, "ui-tabs-anchor" );
  12678. this.panels = $();
  12679. this.anchors.each( function( i, anchor ) {
  12680. var selector, panel, panelId,
  12681. anchorId = $( anchor ).uniqueId().attr( "id" ),
  12682. tab = $( anchor ).closest( "li" ),
  12683. originalAriaControls = tab.attr( "aria-controls" );
  12684. // Inline tab
  12685. if ( that._isLocal( anchor ) ) {
  12686. selector = anchor.hash;
  12687. panelId = selector.substring( 1 );
  12688. panel = that.element.find( that._sanitizeSelector( selector ) );
  12689. // remote tab
  12690. } else {
  12691. // If the tab doesn't already have aria-controls,
  12692. // generate an id by using a throw-away element
  12693. panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id;
  12694. selector = "#" + panelId;
  12695. panel = that.element.find( selector );
  12696. if ( !panel.length ) {
  12697. panel = that._createPanel( panelId );
  12698. panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
  12699. }
  12700. panel.attr( "aria-live", "polite" );
  12701. }
  12702. if ( panel.length ) {
  12703. that.panels = that.panels.add( panel );
  12704. }
  12705. if ( originalAriaControls ) {
  12706. tab.data( "ui-tabs-aria-controls", originalAriaControls );
  12707. }
  12708. tab.attr( {
  12709. "aria-controls": panelId,
  12710. "aria-labelledby": anchorId
  12711. } );
  12712. panel.attr( "aria-labelledby", anchorId );
  12713. } );
  12714. this.panels.attr( "role", "tabpanel" );
  12715. this._addClass( this.panels, "ui-tabs-panel", "ui-widget-content" );
  12716. // Avoid memory leaks (#10056)
  12717. if ( prevTabs ) {
  12718. this._off( prevTabs.not( this.tabs ) );
  12719. this._off( prevAnchors.not( this.anchors ) );
  12720. this._off( prevPanels.not( this.panels ) );
  12721. }
  12722. },
  12723. // Allow overriding how to find the list for rare usage scenarios (#7715)
  12724. _getList: function() {
  12725. return this.tablist || this.element.find( "ol, ul" ).eq( 0 );
  12726. },
  12727. _createPanel: function( id ) {
  12728. return $( "<div>" )
  12729. .attr( "id", id )
  12730. .data( "ui-tabs-destroy", true );
  12731. },
  12732. _setOptionDisabled: function( disabled ) {
  12733. var currentItem, li, i;
  12734. if ( $.isArray( disabled ) ) {
  12735. if ( !disabled.length ) {
  12736. disabled = false;
  12737. } else if ( disabled.length === this.anchors.length ) {
  12738. disabled = true;
  12739. }
  12740. }
  12741. // Disable tabs
  12742. for ( i = 0; ( li = this.tabs[ i ] ); i++ ) {
  12743. currentItem = $( li );
  12744. if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {
  12745. currentItem.attr( "aria-disabled", "true" );
  12746. this._addClass( currentItem, null, "ui-state-disabled" );
  12747. } else {
  12748. currentItem.removeAttr( "aria-disabled" );
  12749. this._removeClass( currentItem, null, "ui-state-disabled" );
  12750. }
  12751. }
  12752. this.options.disabled = disabled;
  12753. this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null,
  12754. disabled === true );
  12755. },
  12756. _setupEvents: function( event ) {
  12757. var events = {};
  12758. if ( event ) {
  12759. $.each( event.split( " " ), function( index, eventName ) {
  12760. events[ eventName ] = "_eventHandler";
  12761. } );
  12762. }
  12763. this._off( this.anchors.add( this.tabs ).add( this.panels ) );
  12764. // Always prevent the default action, even when disabled
  12765. this._on( true, this.anchors, {
  12766. click: function( event ) {
  12767. event.preventDefault();
  12768. }
  12769. } );
  12770. this._on( this.anchors, events );
  12771. this._on( this.tabs, { keydown: "_tabKeydown" } );
  12772. this._on( this.panels, { keydown: "_panelKeydown" } );
  12773. this._focusable( this.tabs );
  12774. this._hoverable( this.tabs );
  12775. },
  12776. _setupHeightStyle: function( heightStyle ) {
  12777. var maxHeight,
  12778. parent = this.element.parent();
  12779. if ( heightStyle === "fill" ) {
  12780. maxHeight = parent.height();
  12781. maxHeight -= this.element.outerHeight() - this.element.height();
  12782. this.element.siblings( ":visible" ).each( function() {
  12783. var elem = $( this ),
  12784. position = elem.css( "position" );
  12785. if ( position === "absolute" || position === "fixed" ) {
  12786. return;
  12787. }
  12788. maxHeight -= elem.outerHeight( true );
  12789. } );
  12790. this.element.children().not( this.panels ).each( function() {
  12791. maxHeight -= $( this ).outerHeight( true );
  12792. } );
  12793. this.panels.each( function() {
  12794. $( this ).height( Math.max( 0, maxHeight -
  12795. $( this ).innerHeight() + $( this ).height() ) );
  12796. } )
  12797. .css( "overflow", "auto" );
  12798. } else if ( heightStyle === "auto" ) {
  12799. maxHeight = 0;
  12800. this.panels.each( function() {
  12801. maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
  12802. } ).height( maxHeight );
  12803. }
  12804. },
  12805. _eventHandler: function( event ) {
  12806. var options = this.options,
  12807. active = this.active,
  12808. anchor = $( event.currentTarget ),
  12809. tab = anchor.closest( "li" ),
  12810. clickedIsActive = tab[ 0 ] === active[ 0 ],
  12811. collapsing = clickedIsActive && options.collapsible,
  12812. toShow = collapsing ? $() : this._getPanelForTab( tab ),
  12813. toHide = !active.length ? $() : this._getPanelForTab( active ),
  12814. eventData = {
  12815. oldTab: active,
  12816. oldPanel: toHide,
  12817. newTab: collapsing ? $() : tab,
  12818. newPanel: toShow
  12819. };
  12820. event.preventDefault();
  12821. if ( tab.hasClass( "ui-state-disabled" ) ||
  12822. // tab is already loading
  12823. tab.hasClass( "ui-tabs-loading" ) ||
  12824. // can't switch durning an animation
  12825. this.running ||
  12826. // click on active header, but not collapsible
  12827. ( clickedIsActive && !options.collapsible ) ||
  12828. // allow canceling activation
  12829. ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
  12830. return;
  12831. }
  12832. options.active = collapsing ? false : this.tabs.index( tab );
  12833. this.active = clickedIsActive ? $() : tab;
  12834. if ( this.xhr ) {
  12835. this.xhr.abort();
  12836. }
  12837. if ( !toHide.length && !toShow.length ) {
  12838. $.error( "jQuery UI Tabs: Mismatching fragment identifier." );
  12839. }
  12840. if ( toShow.length ) {
  12841. this.load( this.tabs.index( tab ), event );
  12842. }
  12843. this._toggle( event, eventData );
  12844. },
  12845. // Handles show/hide for selecting tabs
  12846. _toggle: function( event, eventData ) {
  12847. var that = this,
  12848. toShow = eventData.newPanel,
  12849. toHide = eventData.oldPanel;
  12850. this.running = true;
  12851. function complete() {
  12852. that.running = false;
  12853. that._trigger( "activate", event, eventData );
  12854. }
  12855. function show() {
  12856. that._addClass( eventData.newTab.closest( "li" ), "ui-tabs-active", "ui-state-active" );
  12857. if ( toShow.length && that.options.show ) {
  12858. that._show( toShow, that.options.show, complete );
  12859. } else {
  12860. toShow.show();
  12861. complete();
  12862. }
  12863. }
  12864. // Start out by hiding, then showing, then completing
  12865. if ( toHide.length && this.options.hide ) {
  12866. this._hide( toHide, this.options.hide, function() {
  12867. that._removeClass( eventData.oldTab.closest( "li" ),
  12868. "ui-tabs-active", "ui-state-active" );
  12869. show();
  12870. } );
  12871. } else {
  12872. this._removeClass( eventData.oldTab.closest( "li" ),
  12873. "ui-tabs-active", "ui-state-active" );
  12874. toHide.hide();
  12875. show();
  12876. }
  12877. toHide.attr( "aria-hidden", "true" );
  12878. eventData.oldTab.attr( {
  12879. "aria-selected": "false",
  12880. "aria-expanded": "false"
  12881. } );
  12882. // If we're switching tabs, remove the old tab from the tab order.
  12883. // If we're opening from collapsed state, remove the previous tab from the tab order.
  12884. // If we're collapsing, then keep the collapsing tab in the tab order.
  12885. if ( toShow.length && toHide.length ) {
  12886. eventData.oldTab.attr( "tabIndex", -1 );
  12887. } else if ( toShow.length ) {
  12888. this.tabs.filter( function() {
  12889. return $( this ).attr( "tabIndex" ) === 0;
  12890. } )
  12891. .attr( "tabIndex", -1 );
  12892. }
  12893. toShow.attr( "aria-hidden", "false" );
  12894. eventData.newTab.attr( {
  12895. "aria-selected": "true",
  12896. "aria-expanded": "true",
  12897. tabIndex: 0
  12898. } );
  12899. },
  12900. _activate: function( index ) {
  12901. var anchor,
  12902. active = this._findActive( index );
  12903. // Trying to activate the already active panel
  12904. if ( active[ 0 ] === this.active[ 0 ] ) {
  12905. return;
  12906. }
  12907. // Trying to collapse, simulate a click on the current active header
  12908. if ( !active.length ) {
  12909. active = this.active;
  12910. }
  12911. anchor = active.find( ".ui-tabs-anchor" )[ 0 ];
  12912. this._eventHandler( {
  12913. target: anchor,
  12914. currentTarget: anchor,
  12915. preventDefault: $.noop
  12916. } );
  12917. },
  12918. _findActive: function( index ) {
  12919. return index === false ? $() : this.tabs.eq( index );
  12920. },
  12921. _getIndex: function( index ) {
  12922. // meta-function to give users option to provide a href string instead of a numerical index.
  12923. if ( typeof index === "string" ) {
  12924. index = this.anchors.index( this.anchors.filter( "[href$='" +
  12925. $.ui.escapeSelector( index ) + "']" ) );
  12926. }
  12927. return index;
  12928. },
  12929. _destroy: function() {
  12930. if ( this.xhr ) {
  12931. this.xhr.abort();
  12932. }
  12933. this.tablist
  12934. .removeAttr( "role" )
  12935. .off( this.eventNamespace );
  12936. this.anchors
  12937. .removeAttr( "role tabIndex" )
  12938. .removeUniqueId();
  12939. this.tabs.add( this.panels ).each( function() {
  12940. if ( $.data( this, "ui-tabs-destroy" ) ) {
  12941. $( this ).remove();
  12942. } else {
  12943. $( this ).removeAttr( "role tabIndex " +
  12944. "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded" );
  12945. }
  12946. } );
  12947. this.tabs.each( function() {
  12948. var li = $( this ),
  12949. prev = li.data( "ui-tabs-aria-controls" );
  12950. if ( prev ) {
  12951. li
  12952. .attr( "aria-controls", prev )
  12953. .removeData( "ui-tabs-aria-controls" );
  12954. } else {
  12955. li.removeAttr( "aria-controls" );
  12956. }
  12957. } );
  12958. this.panels.show();
  12959. if ( this.options.heightStyle !== "content" ) {
  12960. this.panels.css( "height", "" );
  12961. }
  12962. },
  12963. enable: function( index ) {
  12964. var disabled = this.options.disabled;
  12965. if ( disabled === false ) {
  12966. return;
  12967. }
  12968. if ( index === undefined ) {
  12969. disabled = false;
  12970. } else {
  12971. index = this._getIndex( index );
  12972. if ( $.isArray( disabled ) ) {
  12973. disabled = $.map( disabled, function( num ) {
  12974. return num !== index ? num : null;
  12975. } );
  12976. } else {
  12977. disabled = $.map( this.tabs, function( li, num ) {
  12978. return num !== index ? num : null;
  12979. } );
  12980. }
  12981. }
  12982. this._setOptionDisabled( disabled );
  12983. },
  12984. disable: function( index ) {
  12985. var disabled = this.options.disabled;
  12986. if ( disabled === true ) {
  12987. return;
  12988. }
  12989. if ( index === undefined ) {
  12990. disabled = true;
  12991. } else {
  12992. index = this._getIndex( index );
  12993. if ( $.inArray( index, disabled ) !== -1 ) {
  12994. return;
  12995. }
  12996. if ( $.isArray( disabled ) ) {
  12997. disabled = $.merge( [ index ], disabled ).sort();
  12998. } else {
  12999. disabled = [ index ];
  13000. }
  13001. }
  13002. this._setOptionDisabled( disabled );
  13003. },
  13004. load: function( index, event ) {
  13005. index = this._getIndex( index );
  13006. var that = this,
  13007. tab = this.tabs.eq( index ),
  13008. anchor = tab.find( ".ui-tabs-anchor" ),
  13009. panel = this._getPanelForTab( tab ),
  13010. eventData = {
  13011. tab: tab,
  13012. panel: panel
  13013. },
  13014. complete = function( jqXHR, status ) {
  13015. if ( status === "abort" ) {
  13016. that.panels.stop( false, true );
  13017. }
  13018. that._removeClass( tab, "ui-tabs-loading" );
  13019. panel.removeAttr( "aria-busy" );
  13020. if ( jqXHR === that.xhr ) {
  13021. delete that.xhr;
  13022. }
  13023. };
  13024. // Not remote
  13025. if ( this._isLocal( anchor[ 0 ] ) ) {
  13026. return;
  13027. }
  13028. this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
  13029. // Support: jQuery <1.8
  13030. // jQuery <1.8 returns false if the request is canceled in beforeSend,
  13031. // but as of 1.8, $.ajax() always returns a jqXHR object.
  13032. if ( this.xhr && this.xhr.statusText !== "canceled" ) {
  13033. this._addClass( tab, "ui-tabs-loading" );
  13034. panel.attr( "aria-busy", "true" );
  13035. this.xhr
  13036. .done( function( response, status, jqXHR ) {
  13037. // support: jQuery <1.8
  13038. // http://bugs.jquery.com/ticket/11778
  13039. setTimeout( function() {
  13040. panel.html( response );
  13041. that._trigger( "load", event, eventData );
  13042. complete( jqXHR, status );
  13043. }, 1 );
  13044. } )
  13045. .fail( function( jqXHR, status ) {
  13046. // support: jQuery <1.8
  13047. // http://bugs.jquery.com/ticket/11778
  13048. setTimeout( function() {
  13049. complete( jqXHR, status );
  13050. }, 1 );
  13051. } );
  13052. }
  13053. },
  13054. _ajaxSettings: function( anchor, event, eventData ) {
  13055. var that = this;
  13056. return {
  13057. // Support: IE <11 only
  13058. // Strip any hash that exists to prevent errors with the Ajax request
  13059. url: anchor.attr( "href" ).replace( /#.*$/, "" ),
  13060. beforeSend: function( jqXHR, settings ) {
  13061. return that._trigger( "beforeLoad", event,
  13062. $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) );
  13063. }
  13064. };
  13065. },
  13066. _getPanelForTab: function( tab ) {
  13067. var id = $( tab ).attr( "aria-controls" );
  13068. return this.element.find( this._sanitizeSelector( "#" + id ) );
  13069. }
  13070. } );
  13071. // DEPRECATED
  13072. // TODO: Switch return back to widget declaration at top of file when this is removed
  13073. if ( $.uiBackCompat !== false ) {
  13074. // Backcompat for ui-tab class (now ui-tabs-tab)
  13075. $.widget( "ui.tabs", $.ui.tabs, {
  13076. _processTabs: function() {
  13077. this._superApply( arguments );
  13078. this._addClass( this.tabs, "ui-tab" );
  13079. }
  13080. } );
  13081. }
  13082. var widgetsTabs = $.ui.tabs;
  13083. /*!
  13084. * jQuery UI Tooltip 1.12.1
  13085. * http://jqueryui.com
  13086. *
  13087. * Copyright jQuery Foundation and other contributors
  13088. * Released under the MIT license.
  13089. * http://jquery.org/license
  13090. */
  13091. //>>label: Tooltip
  13092. //>>group: Widgets
  13093. //>>description: Shows additional information for any element on hover or focus.
  13094. //>>docs: http://api.jqueryui.com/tooltip/
  13095. //>>demos: http://jqueryui.com/tooltip/
  13096. //>>css.structure: ../../themes/base/core.css
  13097. //>>css.structure: ../../themes/base/tooltip.css
  13098. //>>css.theme: ../../themes/base/theme.css
  13099. $.widget( "ui.tooltip", {
  13100. version: "1.12.1",
  13101. options: {
  13102. classes: {
  13103. "ui-tooltip": "ui-corner-all ui-widget-shadow"
  13104. },
  13105. content: function() {
  13106. // support: IE<9, Opera in jQuery <1.7
  13107. // .text() can't accept undefined, so coerce to a string
  13108. var title = $( this ).attr( "title" ) || "";
  13109. // Escape title, since we're going from an attribute to raw HTML
  13110. return $( "<a>" ).text( title ).html();
  13111. },
  13112. hide: true,
  13113. // Disabled elements have inconsistent behavior across browsers (#8661)
  13114. items: "[title]:not([disabled])",
  13115. position: {
  13116. my: "left top+15",
  13117. at: "left bottom",
  13118. collision: "flipfit flip"
  13119. },
  13120. show: true,
  13121. track: false,
  13122. // Callbacks
  13123. close: null,
  13124. open: null
  13125. },
  13126. _addDescribedBy: function( elem, id ) {
  13127. var describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ );
  13128. describedby.push( id );
  13129. elem
  13130. .data( "ui-tooltip-id", id )
  13131. .attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
  13132. },
  13133. _removeDescribedBy: function( elem ) {
  13134. var id = elem.data( "ui-tooltip-id" ),
  13135. describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ),
  13136. index = $.inArray( id, describedby );
  13137. if ( index !== -1 ) {
  13138. describedby.splice( index, 1 );
  13139. }
  13140. elem.removeData( "ui-tooltip-id" );
  13141. describedby = $.trim( describedby.join( " " ) );
  13142. if ( describedby ) {
  13143. elem.attr( "aria-describedby", describedby );
  13144. } else {
  13145. elem.removeAttr( "aria-describedby" );
  13146. }
  13147. },
  13148. _create: function() {
  13149. this._on( {
  13150. mouseover: "open",
  13151. focusin: "open"
  13152. } );
  13153. // IDs of generated tooltips, needed for destroy
  13154. this.tooltips = {};
  13155. // IDs of parent tooltips where we removed the title attribute
  13156. this.parents = {};
  13157. // Append the aria-live region so tooltips announce correctly
  13158. this.liveRegion = $( "<div>" )
  13159. .attr( {
  13160. role: "log",
  13161. "aria-live": "assertive",
  13162. "aria-relevant": "additions"
  13163. } )
  13164. .appendTo( this.document[ 0 ].body );
  13165. this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" );
  13166. this.disabledTitles = $( [] );
  13167. },
  13168. _setOption: function( key, value ) {
  13169. var that = this;
  13170. this._super( key, value );
  13171. if ( key === "content" ) {
  13172. $.each( this.tooltips, function( id, tooltipData ) {
  13173. that._updateContent( tooltipData.element );
  13174. } );
  13175. }
  13176. },
  13177. _setOptionDisabled: function( value ) {
  13178. this[ value ? "_disable" : "_enable" ]();
  13179. },
  13180. _disable: function() {
  13181. var that = this;
  13182. // Close open tooltips
  13183. $.each( this.tooltips, function( id, tooltipData ) {
  13184. var event = $.Event( "blur" );
  13185. event.target = event.currentTarget = tooltipData.element[ 0 ];
  13186. that.close( event, true );
  13187. } );
  13188. // Remove title attributes to prevent native tooltips
  13189. this.disabledTitles = this.disabledTitles.add(
  13190. this.element.find( this.options.items ).addBack()
  13191. .filter( function() {
  13192. var element = $( this );
  13193. if ( element.is( "[title]" ) ) {
  13194. return element
  13195. .data( "ui-tooltip-title", element.attr( "title" ) )
  13196. .removeAttr( "title" );
  13197. }
  13198. } )
  13199. );
  13200. },
  13201. _enable: function() {
  13202. // restore title attributes
  13203. this.disabledTitles.each( function() {
  13204. var element = $( this );
  13205. if ( element.data( "ui-tooltip-title" ) ) {
  13206. element.attr( "title", element.data( "ui-tooltip-title" ) );
  13207. }
  13208. } );
  13209. this.disabledTitles = $( [] );
  13210. },
  13211. open: function( event ) {
  13212. var that = this,
  13213. target = $( event ? event.target : this.element )
  13214. // we need closest here due to mouseover bubbling,
  13215. // but always pointing at the same event target
  13216. .closest( this.options.items );
  13217. // No element to show a tooltip for or the tooltip is already open
  13218. if ( !target.length || target.data( "ui-tooltip-id" ) ) {
  13219. return;
  13220. }
  13221. if ( target.attr( "title" ) ) {
  13222. target.data( "ui-tooltip-title", target.attr( "title" ) );
  13223. }
  13224. target.data( "ui-tooltip-open", true );
  13225. // Kill parent tooltips, custom or native, for hover
  13226. if ( event && event.type === "mouseover" ) {
  13227. target.parents().each( function() {
  13228. var parent = $( this ),
  13229. blurEvent;
  13230. if ( parent.data( "ui-tooltip-open" ) ) {
  13231. blurEvent = $.Event( "blur" );
  13232. blurEvent.target = blurEvent.currentTarget = this;
  13233. that.close( blurEvent, true );
  13234. }
  13235. if ( parent.attr( "title" ) ) {
  13236. parent.uniqueId();
  13237. that.parents[ this.id ] = {
  13238. element: this,
  13239. title: parent.attr( "title" )
  13240. };
  13241. parent.attr( "title", "" );
  13242. }
  13243. } );
  13244. }
  13245. this._registerCloseHandlers( event, target );
  13246. this._updateContent( target, event );
  13247. },
  13248. _updateContent: function( target, event ) {
  13249. var content,
  13250. contentOption = this.options.content,
  13251. that = this,
  13252. eventType = event ? event.type : null;
  13253. if ( typeof contentOption === "string" || contentOption.nodeType ||
  13254. contentOption.jquery ) {
  13255. return this._open( event, target, contentOption );
  13256. }
  13257. content = contentOption.call( target[ 0 ], function( response ) {
  13258. // IE may instantly serve a cached response for ajax requests
  13259. // delay this call to _open so the other call to _open runs first
  13260. that._delay( function() {
  13261. // Ignore async response if tooltip was closed already
  13262. if ( !target.data( "ui-tooltip-open" ) ) {
  13263. return;
  13264. }
  13265. // JQuery creates a special event for focusin when it doesn't
  13266. // exist natively. To improve performance, the native event
  13267. // object is reused and the type is changed. Therefore, we can't
  13268. // rely on the type being correct after the event finished
  13269. // bubbling, so we set it back to the previous value. (#8740)
  13270. if ( event ) {
  13271. event.type = eventType;
  13272. }
  13273. this._open( event, target, response );
  13274. } );
  13275. } );
  13276. if ( content ) {
  13277. this._open( event, target, content );
  13278. }
  13279. },
  13280. _open: function( event, target, content ) {
  13281. var tooltipData, tooltip, delayedShow, a11yContent,
  13282. positionOption = $.extend( {}, this.options.position );
  13283. if ( !content ) {
  13284. return;
  13285. }
  13286. // Content can be updated multiple times. If the tooltip already
  13287. // exists, then just update the content and bail.
  13288. tooltipData = this._find( target );
  13289. if ( tooltipData ) {
  13290. tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content );
  13291. return;
  13292. }
  13293. // If we have a title, clear it to prevent the native tooltip
  13294. // we have to check first to avoid defining a title if none exists
  13295. // (we don't want to cause an element to start matching [title])
  13296. //
  13297. // We use removeAttr only for key events, to allow IE to export the correct
  13298. // accessible attributes. For mouse events, set to empty string to avoid
  13299. // native tooltip showing up (happens only when removing inside mouseover).
  13300. if ( target.is( "[title]" ) ) {
  13301. if ( event && event.type === "mouseover" ) {
  13302. target.attr( "title", "" );
  13303. } else {
  13304. target.removeAttr( "title" );
  13305. }
  13306. }
  13307. tooltipData = this._tooltip( target );
  13308. tooltip = tooltipData.tooltip;
  13309. this._addDescribedBy( target, tooltip.attr( "id" ) );
  13310. tooltip.find( ".ui-tooltip-content" ).html( content );
  13311. // Support: Voiceover on OS X, JAWS on IE <= 9
  13312. // JAWS announces deletions even when aria-relevant="additions"
  13313. // Voiceover will sometimes re-read the entire log region's contents from the beginning
  13314. this.liveRegion.children().hide();
  13315. a11yContent = $( "<div>" ).html( tooltip.find( ".ui-tooltip-content" ).html() );
  13316. a11yContent.removeAttr( "name" ).find( "[name]" ).removeAttr( "name" );
  13317. a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" );
  13318. a11yContent.appendTo( this.liveRegion );
  13319. function position( event ) {
  13320. positionOption.of = event;
  13321. if ( tooltip.is( ":hidden" ) ) {
  13322. return;
  13323. }
  13324. tooltip.position( positionOption );
  13325. }
  13326. if ( this.options.track && event && /^mouse/.test( event.type ) ) {
  13327. this._on( this.document, {
  13328. mousemove: position
  13329. } );
  13330. // trigger once to override element-relative positioning
  13331. position( event );
  13332. } else {
  13333. tooltip.position( $.extend( {
  13334. of: target
  13335. }, this.options.position ) );
  13336. }
  13337. tooltip.hide();
  13338. this._show( tooltip, this.options.show );
  13339. // Handle tracking tooltips that are shown with a delay (#8644). As soon
  13340. // as the tooltip is visible, position the tooltip using the most recent
  13341. // event.
  13342. // Adds the check to add the timers only when both delay and track options are set (#14682)
  13343. if ( this.options.track && this.options.show && this.options.show.delay ) {
  13344. delayedShow = this.delayedShow = setInterval( function() {
  13345. if ( tooltip.is( ":visible" ) ) {
  13346. position( positionOption.of );
  13347. clearInterval( delayedShow );
  13348. }
  13349. }, $.fx.interval );
  13350. }
  13351. this._trigger( "open", event, { tooltip: tooltip } );
  13352. },
  13353. _registerCloseHandlers: function( event, target ) {
  13354. var events = {
  13355. keyup: function( event ) {
  13356. if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
  13357. var fakeEvent = $.Event( event );
  13358. fakeEvent.currentTarget = target[ 0 ];
  13359. this.close( fakeEvent, true );
  13360. }
  13361. }
  13362. };
  13363. // Only bind remove handler for delegated targets. Non-delegated
  13364. // tooltips will handle this in destroy.
  13365. if ( target[ 0 ] !== this.element[ 0 ] ) {
  13366. events.remove = function() {
  13367. this._removeTooltip( this._find( target ).tooltip );
  13368. };
  13369. }
  13370. if ( !event || event.type === "mouseover" ) {
  13371. events.mouseleave = "close";
  13372. }
  13373. if ( !event || event.type === "focusin" ) {
  13374. events.focusout = "close";
  13375. }
  13376. this._on( true, target, events );
  13377. },
  13378. close: function( event ) {
  13379. var tooltip,
  13380. that = this,
  13381. target = $( event ? event.currentTarget : this.element ),
  13382. tooltipData = this._find( target );
  13383. // The tooltip may already be closed
  13384. if ( !tooltipData ) {
  13385. // We set ui-tooltip-open immediately upon open (in open()), but only set the
  13386. // additional data once there's actually content to show (in _open()). So even if the
  13387. // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in
  13388. // the period between open() and _open().
  13389. target.removeData( "ui-tooltip-open" );
  13390. return;
  13391. }
  13392. tooltip = tooltipData.tooltip;
  13393. // Disabling closes the tooltip, so we need to track when we're closing
  13394. // to avoid an infinite loop in case the tooltip becomes disabled on close
  13395. if ( tooltipData.closing ) {
  13396. return;
  13397. }
  13398. // Clear the interval for delayed tracking tooltips
  13399. clearInterval( this.delayedShow );
  13400. // Only set title if we had one before (see comment in _open())
  13401. // If the title attribute has changed since open(), don't restore
  13402. if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) {
  13403. target.attr( "title", target.data( "ui-tooltip-title" ) );
  13404. }
  13405. this._removeDescribedBy( target );
  13406. tooltipData.hiding = true;
  13407. tooltip.stop( true );
  13408. this._hide( tooltip, this.options.hide, function() {
  13409. that._removeTooltip( $( this ) );
  13410. } );
  13411. target.removeData( "ui-tooltip-open" );
  13412. this._off( target, "mouseleave focusout keyup" );
  13413. // Remove 'remove' binding only on delegated targets
  13414. if ( target[ 0 ] !== this.element[ 0 ] ) {
  13415. this._off( target, "remove" );
  13416. }
  13417. this._off( this.document, "mousemove" );
  13418. if ( event && event.type === "mouseleave" ) {
  13419. $.each( this.parents, function( id, parent ) {
  13420. $( parent.element ).attr( "title", parent.title );
  13421. delete that.parents[ id ];
  13422. } );
  13423. }
  13424. tooltipData.closing = true;
  13425. this._trigger( "close", event, { tooltip: tooltip } );
  13426. if ( !tooltipData.hiding ) {
  13427. tooltipData.closing = false;
  13428. }
  13429. },
  13430. _tooltip: function( element ) {
  13431. var tooltip = $( "<div>" ).attr( "role", "tooltip" ),
  13432. content = $( "<div>" ).appendTo( tooltip ),
  13433. id = tooltip.uniqueId().attr( "id" );
  13434. this._addClass( content, "ui-tooltip-content" );
  13435. this._addClass( tooltip, "ui-tooltip", "ui-widget ui-widget-content" );
  13436. tooltip.appendTo( this._appendTo( element ) );
  13437. return this.tooltips[ id ] = {
  13438. element: element,
  13439. tooltip: tooltip
  13440. };
  13441. },
  13442. _find: function( target ) {
  13443. var id = target.data( "ui-tooltip-id" );
  13444. return id ? this.tooltips[ id ] : null;
  13445. },
  13446. _removeTooltip: function( tooltip ) {
  13447. tooltip.remove();
  13448. delete this.tooltips[ tooltip.attr( "id" ) ];
  13449. },
  13450. _appendTo: function( target ) {
  13451. var element = target.closest( ".ui-front, dialog" );
  13452. if ( !element.length ) {
  13453. element = this.document[ 0 ].body;
  13454. }
  13455. return element;
  13456. },
  13457. _destroy: function() {
  13458. var that = this;
  13459. // Close open tooltips
  13460. $.each( this.tooltips, function( id, tooltipData ) {
  13461. // Delegate to close method to handle common cleanup
  13462. var event = $.Event( "blur" ),
  13463. element = tooltipData.element;
  13464. event.target = event.currentTarget = element[ 0 ];
  13465. that.close( event, true );
  13466. // Remove immediately; destroying an open tooltip doesn't use the
  13467. // hide animation
  13468. $( "#" + id ).remove();
  13469. // Restore the title
  13470. if ( element.data( "ui-tooltip-title" ) ) {
  13471. // If the title attribute has changed since open(), don't restore
  13472. if ( !element.attr( "title" ) ) {
  13473. element.attr( "title", element.data( "ui-tooltip-title" ) );
  13474. }
  13475. element.removeData( "ui-tooltip-title" );
  13476. }
  13477. } );
  13478. this.liveRegion.remove();
  13479. }
  13480. } );
  13481. // DEPRECATED
  13482. // TODO: Switch return back to widget declaration at top of file when this is removed
  13483. if ( $.uiBackCompat !== false ) {
  13484. // Backcompat for tooltipClass option
  13485. $.widget( "ui.tooltip", $.ui.tooltip, {
  13486. options: {
  13487. tooltipClass: null
  13488. },
  13489. _tooltip: function() {
  13490. var tooltipData = this._superApply( arguments );
  13491. if ( this.options.tooltipClass ) {
  13492. tooltipData.tooltip.addClass( this.options.tooltipClass );
  13493. }
  13494. return tooltipData;
  13495. }
  13496. } );
  13497. }
  13498. var widgetsTooltip = $.ui.tooltip;
  13499. /*!
  13500. * jQuery UI Effects 1.12.1
  13501. * http://jqueryui.com
  13502. *
  13503. * Copyright jQuery Foundation and other contributors
  13504. * Released under the MIT license.
  13505. * http://jquery.org/license
  13506. */
  13507. //>>label: Effects Core
  13508. //>>group: Effects
  13509. // jscs:disable maximumLineLength
  13510. //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects.
  13511. // jscs:enable maximumLineLength
  13512. //>>docs: http://api.jqueryui.com/category/effects-core/
  13513. //>>demos: http://jqueryui.com/effect/
  13514. var dataSpace = "ui-effects-",
  13515. dataSpaceStyle = "ui-effects-style",
  13516. dataSpaceAnimated = "ui-effects-animated",
  13517. // Create a local jQuery because jQuery Color relies on it and the
  13518. // global may not exist with AMD and a custom build (#10199)
  13519. jQuery = $;
  13520. $.effects = {
  13521. effect: {}
  13522. };
  13523. /*!
  13524. * jQuery Color Animations v2.1.2
  13525. * https://github.com/jquery/jquery-color
  13526. *
  13527. * Copyright 2014 jQuery Foundation and other contributors
  13528. * Released under the MIT license.
  13529. * http://jquery.org/license
  13530. *
  13531. * Date: Wed Jan 16 08:47:09 2013 -0600
  13532. */
  13533. ( function( jQuery, undefined ) {
  13534. var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " +
  13535. "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
  13536. // Plusequals test for += 100 -= 100
  13537. rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
  13538. // A set of RE's that can match strings and generate color tuples.
  13539. stringParsers = [ {
  13540. re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  13541. parse: function( execResult ) {
  13542. return [
  13543. execResult[ 1 ],
  13544. execResult[ 2 ],
  13545. execResult[ 3 ],
  13546. execResult[ 4 ]
  13547. ];
  13548. }
  13549. }, {
  13550. re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  13551. parse: function( execResult ) {
  13552. return [
  13553. execResult[ 1 ] * 2.55,
  13554. execResult[ 2 ] * 2.55,
  13555. execResult[ 3 ] * 2.55,
  13556. execResult[ 4 ]
  13557. ];
  13558. }
  13559. }, {
  13560. // This regex ignores A-F because it's compared against an already lowercased string
  13561. re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
  13562. parse: function( execResult ) {
  13563. return [
  13564. parseInt( execResult[ 1 ], 16 ),
  13565. parseInt( execResult[ 2 ], 16 ),
  13566. parseInt( execResult[ 3 ], 16 )
  13567. ];
  13568. }
  13569. }, {
  13570. // This regex ignores A-F because it's compared against an already lowercased string
  13571. re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
  13572. parse: function( execResult ) {
  13573. return [
  13574. parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
  13575. parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
  13576. parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
  13577. ];
  13578. }
  13579. }, {
  13580. re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  13581. space: "hsla",
  13582. parse: function( execResult ) {
  13583. return [
  13584. execResult[ 1 ],
  13585. execResult[ 2 ] / 100,
  13586. execResult[ 3 ] / 100,
  13587. execResult[ 4 ]
  13588. ];
  13589. }
  13590. } ],
  13591. // JQuery.Color( )
  13592. color = jQuery.Color = function( color, green, blue, alpha ) {
  13593. return new jQuery.Color.fn.parse( color, green, blue, alpha );
  13594. },
  13595. spaces = {
  13596. rgba: {
  13597. props: {
  13598. red: {
  13599. idx: 0,
  13600. type: "byte"
  13601. },
  13602. green: {
  13603. idx: 1,
  13604. type: "byte"
  13605. },
  13606. blue: {
  13607. idx: 2,
  13608. type: "byte"
  13609. }
  13610. }
  13611. },
  13612. hsla: {
  13613. props: {
  13614. hue: {
  13615. idx: 0,
  13616. type: "degrees"
  13617. },
  13618. saturation: {
  13619. idx: 1,
  13620. type: "percent"
  13621. },
  13622. lightness: {
  13623. idx: 2,
  13624. type: "percent"
  13625. }
  13626. }
  13627. }
  13628. },
  13629. propTypes = {
  13630. "byte": {
  13631. floor: true,
  13632. max: 255
  13633. },
  13634. "percent": {
  13635. max: 1
  13636. },
  13637. "degrees": {
  13638. mod: 360,
  13639. floor: true
  13640. }
  13641. },
  13642. support = color.support = {},
  13643. // Element for support tests
  13644. supportElem = jQuery( "<p>" )[ 0 ],
  13645. // Colors = jQuery.Color.names
  13646. colors,
  13647. // Local aliases of functions called often
  13648. each = jQuery.each;
  13649. // Determine rgba support immediately
  13650. supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
  13651. support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
  13652. // Define cache name and alpha properties
  13653. // for rgba and hsla spaces
  13654. each( spaces, function( spaceName, space ) {
  13655. space.cache = "_" + spaceName;
  13656. space.props.alpha = {
  13657. idx: 3,
  13658. type: "percent",
  13659. def: 1
  13660. };
  13661. } );
  13662. function clamp( value, prop, allowEmpty ) {
  13663. var type = propTypes[ prop.type ] || {};
  13664. if ( value == null ) {
  13665. return ( allowEmpty || !prop.def ) ? null : prop.def;
  13666. }
  13667. // ~~ is an short way of doing floor for positive numbers
  13668. value = type.floor ? ~~value : parseFloat( value );
  13669. // IE will pass in empty strings as value for alpha,
  13670. // which will hit this case
  13671. if ( isNaN( value ) ) {
  13672. return prop.def;
  13673. }
  13674. if ( type.mod ) {
  13675. // We add mod before modding to make sure that negatives values
  13676. // get converted properly: -10 -> 350
  13677. return ( value + type.mod ) % type.mod;
  13678. }
  13679. // For now all property types without mod have min and max
  13680. return 0 > value ? 0 : type.max < value ? type.max : value;
  13681. }
  13682. function stringParse( string ) {
  13683. var inst = color(),
  13684. rgba = inst._rgba = [];
  13685. string = string.toLowerCase();
  13686. each( stringParsers, function( i, parser ) {
  13687. var parsed,
  13688. match = parser.re.exec( string ),
  13689. values = match && parser.parse( match ),
  13690. spaceName = parser.space || "rgba";
  13691. if ( values ) {
  13692. parsed = inst[ spaceName ]( values );
  13693. // If this was an rgba parse the assignment might happen twice
  13694. // oh well....
  13695. inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
  13696. rgba = inst._rgba = parsed._rgba;
  13697. // Exit each( stringParsers ) here because we matched
  13698. return false;
  13699. }
  13700. } );
  13701. // Found a stringParser that handled it
  13702. if ( rgba.length ) {
  13703. // If this came from a parsed string, force "transparent" when alpha is 0
  13704. // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
  13705. if ( rgba.join() === "0,0,0,0" ) {
  13706. jQuery.extend( rgba, colors.transparent );
  13707. }
  13708. return inst;
  13709. }
  13710. // Named colors
  13711. return colors[ string ];
  13712. }
  13713. color.fn = jQuery.extend( color.prototype, {
  13714. parse: function( red, green, blue, alpha ) {
  13715. if ( red === undefined ) {
  13716. this._rgba = [ null, null, null, null ];
  13717. return this;
  13718. }
  13719. if ( red.jquery || red.nodeType ) {
  13720. red = jQuery( red ).css( green );
  13721. green = undefined;
  13722. }
  13723. var inst = this,
  13724. type = jQuery.type( red ),
  13725. rgba = this._rgba = [];
  13726. // More than 1 argument specified - assume ( red, green, blue, alpha )
  13727. if ( green !== undefined ) {
  13728. red = [ red, green, blue, alpha ];
  13729. type = "array";
  13730. }
  13731. if ( type === "string" ) {
  13732. return this.parse( stringParse( red ) || colors._default );
  13733. }
  13734. if ( type === "array" ) {
  13735. each( spaces.rgba.props, function( key, prop ) {
  13736. rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
  13737. } );
  13738. return this;
  13739. }
  13740. if ( type === "object" ) {
  13741. if ( red instanceof color ) {
  13742. each( spaces, function( spaceName, space ) {
  13743. if ( red[ space.cache ] ) {
  13744. inst[ space.cache ] = red[ space.cache ].slice();
  13745. }
  13746. } );
  13747. } else {
  13748. each( spaces, function( spaceName, space ) {
  13749. var cache = space.cache;
  13750. each( space.props, function( key, prop ) {
  13751. // If the cache doesn't exist, and we know how to convert
  13752. if ( !inst[ cache ] && space.to ) {
  13753. // If the value was null, we don't need to copy it
  13754. // if the key was alpha, we don't need to copy it either
  13755. if ( key === "alpha" || red[ key ] == null ) {
  13756. return;
  13757. }
  13758. inst[ cache ] = space.to( inst._rgba );
  13759. }
  13760. // This is the only case where we allow nulls for ALL properties.
  13761. // call clamp with alwaysAllowEmpty
  13762. inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
  13763. } );
  13764. // Everything defined but alpha?
  13765. if ( inst[ cache ] &&
  13766. jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
  13767. // Use the default of 1
  13768. inst[ cache ][ 3 ] = 1;
  13769. if ( space.from ) {
  13770. inst._rgba = space.from( inst[ cache ] );
  13771. }
  13772. }
  13773. } );
  13774. }
  13775. return this;
  13776. }
  13777. },
  13778. is: function( compare ) {
  13779. var is = color( compare ),
  13780. same = true,
  13781. inst = this;
  13782. each( spaces, function( _, space ) {
  13783. var localCache,
  13784. isCache = is[ space.cache ];
  13785. if ( isCache ) {
  13786. localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
  13787. each( space.props, function( _, prop ) {
  13788. if ( isCache[ prop.idx ] != null ) {
  13789. same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
  13790. return same;
  13791. }
  13792. } );
  13793. }
  13794. return same;
  13795. } );
  13796. return same;
  13797. },
  13798. _space: function() {
  13799. var used = [],
  13800. inst = this;
  13801. each( spaces, function( spaceName, space ) {
  13802. if ( inst[ space.cache ] ) {
  13803. used.push( spaceName );
  13804. }
  13805. } );
  13806. return used.pop();
  13807. },
  13808. transition: function( other, distance ) {
  13809. var end = color( other ),
  13810. spaceName = end._space(),
  13811. space = spaces[ spaceName ],
  13812. startColor = this.alpha() === 0 ? color( "transparent" ) : this,
  13813. start = startColor[ space.cache ] || space.to( startColor._rgba ),
  13814. result = start.slice();
  13815. end = end[ space.cache ];
  13816. each( space.props, function( key, prop ) {
  13817. var index = prop.idx,
  13818. startValue = start[ index ],
  13819. endValue = end[ index ],
  13820. type = propTypes[ prop.type ] || {};
  13821. // If null, don't override start value
  13822. if ( endValue === null ) {
  13823. return;
  13824. }
  13825. // If null - use end
  13826. if ( startValue === null ) {
  13827. result[ index ] = endValue;
  13828. } else {
  13829. if ( type.mod ) {
  13830. if ( endValue - startValue > type.mod / 2 ) {
  13831. startValue += type.mod;
  13832. } else if ( startValue - endValue > type.mod / 2 ) {
  13833. startValue -= type.mod;
  13834. }
  13835. }
  13836. result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
  13837. }
  13838. } );
  13839. return this[ spaceName ]( result );
  13840. },
  13841. blend: function( opaque ) {
  13842. // If we are already opaque - return ourself
  13843. if ( this._rgba[ 3 ] === 1 ) {
  13844. return this;
  13845. }
  13846. var rgb = this._rgba.slice(),
  13847. a = rgb.pop(),
  13848. blend = color( opaque )._rgba;
  13849. return color( jQuery.map( rgb, function( v, i ) {
  13850. return ( 1 - a ) * blend[ i ] + a * v;
  13851. } ) );
  13852. },
  13853. toRgbaString: function() {
  13854. var prefix = "rgba(",
  13855. rgba = jQuery.map( this._rgba, function( v, i ) {
  13856. return v == null ? ( i > 2 ? 1 : 0 ) : v;
  13857. } );
  13858. if ( rgba[ 3 ] === 1 ) {
  13859. rgba.pop();
  13860. prefix = "rgb(";
  13861. }
  13862. return prefix + rgba.join() + ")";
  13863. },
  13864. toHslaString: function() {
  13865. var prefix = "hsla(",
  13866. hsla = jQuery.map( this.hsla(), function( v, i ) {
  13867. if ( v == null ) {
  13868. v = i > 2 ? 1 : 0;
  13869. }
  13870. // Catch 1 and 2
  13871. if ( i && i < 3 ) {
  13872. v = Math.round( v * 100 ) + "%";
  13873. }
  13874. return v;
  13875. } );
  13876. if ( hsla[ 3 ] === 1 ) {
  13877. hsla.pop();
  13878. prefix = "hsl(";
  13879. }
  13880. return prefix + hsla.join() + ")";
  13881. },
  13882. toHexString: function( includeAlpha ) {
  13883. var rgba = this._rgba.slice(),
  13884. alpha = rgba.pop();
  13885. if ( includeAlpha ) {
  13886. rgba.push( ~~( alpha * 255 ) );
  13887. }
  13888. return "#" + jQuery.map( rgba, function( v ) {
  13889. // Default to 0 when nulls exist
  13890. v = ( v || 0 ).toString( 16 );
  13891. return v.length === 1 ? "0" + v : v;
  13892. } ).join( "" );
  13893. },
  13894. toString: function() {
  13895. return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
  13896. }
  13897. } );
  13898. color.fn.parse.prototype = color.fn;
  13899. // Hsla conversions adapted from:
  13900. // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
  13901. function hue2rgb( p, q, h ) {
  13902. h = ( h + 1 ) % 1;
  13903. if ( h * 6 < 1 ) {
  13904. return p + ( q - p ) * h * 6;
  13905. }
  13906. if ( h * 2 < 1 ) {
  13907. return q;
  13908. }
  13909. if ( h * 3 < 2 ) {
  13910. return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
  13911. }
  13912. return p;
  13913. }
  13914. spaces.hsla.to = function( rgba ) {
  13915. if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
  13916. return [ null, null, null, rgba[ 3 ] ];
  13917. }
  13918. var r = rgba[ 0 ] / 255,
  13919. g = rgba[ 1 ] / 255,
  13920. b = rgba[ 2 ] / 255,
  13921. a = rgba[ 3 ],
  13922. max = Math.max( r, g, b ),
  13923. min = Math.min( r, g, b ),
  13924. diff = max - min,
  13925. add = max + min,
  13926. l = add * 0.5,
  13927. h, s;
  13928. if ( min === max ) {
  13929. h = 0;
  13930. } else if ( r === max ) {
  13931. h = ( 60 * ( g - b ) / diff ) + 360;
  13932. } else if ( g === max ) {
  13933. h = ( 60 * ( b - r ) / diff ) + 120;
  13934. } else {
  13935. h = ( 60 * ( r - g ) / diff ) + 240;
  13936. }
  13937. // Chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
  13938. // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
  13939. if ( diff === 0 ) {
  13940. s = 0;
  13941. } else if ( l <= 0.5 ) {
  13942. s = diff / add;
  13943. } else {
  13944. s = diff / ( 2 - add );
  13945. }
  13946. return [ Math.round( h ) % 360, s, l, a == null ? 1 : a ];
  13947. };
  13948. spaces.hsla.from = function( hsla ) {
  13949. if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
  13950. return [ null, null, null, hsla[ 3 ] ];
  13951. }
  13952. var h = hsla[ 0 ] / 360,
  13953. s = hsla[ 1 ],
  13954. l = hsla[ 2 ],
  13955. a = hsla[ 3 ],
  13956. q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
  13957. p = 2 * l - q;
  13958. return [
  13959. Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
  13960. Math.round( hue2rgb( p, q, h ) * 255 ),
  13961. Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
  13962. a
  13963. ];
  13964. };
  13965. each( spaces, function( spaceName, space ) {
  13966. var props = space.props,
  13967. cache = space.cache,
  13968. to = space.to,
  13969. from = space.from;
  13970. // Makes rgba() and hsla()
  13971. color.fn[ spaceName ] = function( value ) {
  13972. // Generate a cache for this space if it doesn't exist
  13973. if ( to && !this[ cache ] ) {
  13974. this[ cache ] = to( this._rgba );
  13975. }
  13976. if ( value === undefined ) {
  13977. return this[ cache ].slice();
  13978. }
  13979. var ret,
  13980. type = jQuery.type( value ),
  13981. arr = ( type === "array" || type === "object" ) ? value : arguments,
  13982. local = this[ cache ].slice();
  13983. each( props, function( key, prop ) {
  13984. var val = arr[ type === "object" ? key : prop.idx ];
  13985. if ( val == null ) {
  13986. val = local[ prop.idx ];
  13987. }
  13988. local[ prop.idx ] = clamp( val, prop );
  13989. } );
  13990. if ( from ) {
  13991. ret = color( from( local ) );
  13992. ret[ cache ] = local;
  13993. return ret;
  13994. } else {
  13995. return color( local );
  13996. }
  13997. };
  13998. // Makes red() green() blue() alpha() hue() saturation() lightness()
  13999. each( props, function( key, prop ) {
  14000. // Alpha is included in more than one space
  14001. if ( color.fn[ key ] ) {
  14002. return;
  14003. }
  14004. color.fn[ key ] = function( value ) {
  14005. var vtype = jQuery.type( value ),
  14006. fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
  14007. local = this[ fn ](),
  14008. cur = local[ prop.idx ],
  14009. match;
  14010. if ( vtype === "undefined" ) {
  14011. return cur;
  14012. }
  14013. if ( vtype === "function" ) {
  14014. value = value.call( this, cur );
  14015. vtype = jQuery.type( value );
  14016. }
  14017. if ( value == null && prop.empty ) {
  14018. return this;
  14019. }
  14020. if ( vtype === "string" ) {
  14021. match = rplusequals.exec( value );
  14022. if ( match ) {
  14023. value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
  14024. }
  14025. }
  14026. local[ prop.idx ] = value;
  14027. return this[ fn ]( local );
  14028. };
  14029. } );
  14030. } );
  14031. // Add cssHook and .fx.step function for each named hook.
  14032. // accept a space separated string of properties
  14033. color.hook = function( hook ) {
  14034. var hooks = hook.split( " " );
  14035. each( hooks, function( i, hook ) {
  14036. jQuery.cssHooks[ hook ] = {
  14037. set: function( elem, value ) {
  14038. var parsed, curElem,
  14039. backgroundColor = "";
  14040. if ( value !== "transparent" && ( jQuery.type( value ) !== "string" ||
  14041. ( parsed = stringParse( value ) ) ) ) {
  14042. value = color( parsed || value );
  14043. if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
  14044. curElem = hook === "backgroundColor" ? elem.parentNode : elem;
  14045. while (
  14046. ( backgroundColor === "" || backgroundColor === "transparent" ) &&
  14047. curElem && curElem.style
  14048. ) {
  14049. try {
  14050. backgroundColor = jQuery.css( curElem, "backgroundColor" );
  14051. curElem = curElem.parentNode;
  14052. } catch ( e ) {
  14053. }
  14054. }
  14055. value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
  14056. backgroundColor :
  14057. "_default" );
  14058. }
  14059. value = value.toRgbaString();
  14060. }
  14061. try {
  14062. elem.style[ hook ] = value;
  14063. } catch ( e ) {
  14064. // Wrapped to prevent IE from throwing errors on "invalid" values like
  14065. // 'auto' or 'inherit'
  14066. }
  14067. }
  14068. };
  14069. jQuery.fx.step[ hook ] = function( fx ) {
  14070. if ( !fx.colorInit ) {
  14071. fx.start = color( fx.elem, hook );
  14072. fx.end = color( fx.end );
  14073. fx.colorInit = true;
  14074. }
  14075. jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
  14076. };
  14077. } );
  14078. };
  14079. color.hook( stepHooks );
  14080. jQuery.cssHooks.borderColor = {
  14081. expand: function( value ) {
  14082. var expanded = {};
  14083. each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
  14084. expanded[ "border" + part + "Color" ] = value;
  14085. } );
  14086. return expanded;
  14087. }
  14088. };
  14089. // Basic color names only.
  14090. // Usage of any of the other color names requires adding yourself or including
  14091. // jquery.color.svg-names.js.
  14092. colors = jQuery.Color.names = {
  14093. // 4.1. Basic color keywords
  14094. aqua: "#00ffff",
  14095. black: "#000000",
  14096. blue: "#0000ff",
  14097. fuchsia: "#ff00ff",
  14098. gray: "#808080",
  14099. green: "#008000",
  14100. lime: "#00ff00",
  14101. maroon: "#800000",
  14102. navy: "#000080",
  14103. olive: "#808000",
  14104. purple: "#800080",
  14105. red: "#ff0000",
  14106. silver: "#c0c0c0",
  14107. teal: "#008080",
  14108. white: "#ffffff",
  14109. yellow: "#ffff00",
  14110. // 4.2.3. "transparent" color keyword
  14111. transparent: [ null, null, null, 0 ],
  14112. _default: "#ffffff"
  14113. };
  14114. } )( jQuery );
  14115. /******************************************************************************/
  14116. /****************************** CLASS ANIMATIONS ******************************/
  14117. /******************************************************************************/
  14118. ( function() {
  14119. var classAnimationActions = [ "add", "remove", "toggle" ],
  14120. shorthandStyles = {
  14121. border: 1,
  14122. borderBottom: 1,
  14123. borderColor: 1,
  14124. borderLeft: 1,
  14125. borderRight: 1,
  14126. borderTop: 1,
  14127. borderWidth: 1,
  14128. margin: 1,
  14129. padding: 1
  14130. };
  14131. $.each(
  14132. [ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ],
  14133. function( _, prop ) {
  14134. $.fx.step[ prop ] = function( fx ) {
  14135. if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
  14136. jQuery.style( fx.elem, prop, fx.end );
  14137. fx.setAttr = true;
  14138. }
  14139. };
  14140. }
  14141. );
  14142. function getElementStyles( elem ) {
  14143. var key, len,
  14144. style = elem.ownerDocument.defaultView ?
  14145. elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
  14146. elem.currentStyle,
  14147. styles = {};
  14148. if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
  14149. len = style.length;
  14150. while ( len-- ) {
  14151. key = style[ len ];
  14152. if ( typeof style[ key ] === "string" ) {
  14153. styles[ $.camelCase( key ) ] = style[ key ];
  14154. }
  14155. }
  14156. // Support: Opera, IE <9
  14157. } else {
  14158. for ( key in style ) {
  14159. if ( typeof style[ key ] === "string" ) {
  14160. styles[ key ] = style[ key ];
  14161. }
  14162. }
  14163. }
  14164. return styles;
  14165. }
  14166. function styleDifference( oldStyle, newStyle ) {
  14167. var diff = {},
  14168. name, value;
  14169. for ( name in newStyle ) {
  14170. value = newStyle[ name ];
  14171. if ( oldStyle[ name ] !== value ) {
  14172. if ( !shorthandStyles[ name ] ) {
  14173. if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
  14174. diff[ name ] = value;
  14175. }
  14176. }
  14177. }
  14178. }
  14179. return diff;
  14180. }
  14181. // Support: jQuery <1.8
  14182. if ( !$.fn.addBack ) {
  14183. $.fn.addBack = function( selector ) {
  14184. return this.add( selector == null ?
  14185. this.prevObject : this.prevObject.filter( selector )
  14186. );
  14187. };
  14188. }
  14189. $.effects.animateClass = function( value, duration, easing, callback ) {
  14190. var o = $.speed( duration, easing, callback );
  14191. return this.queue( function() {
  14192. var animated = $( this ),
  14193. baseClass = animated.attr( "class" ) || "",
  14194. applyClassChange,
  14195. allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
  14196. // Map the animated objects to store the original styles.
  14197. allAnimations = allAnimations.map( function() {
  14198. var el = $( this );
  14199. return {
  14200. el: el,
  14201. start: getElementStyles( this )
  14202. };
  14203. } );
  14204. // Apply class change
  14205. applyClassChange = function() {
  14206. $.each( classAnimationActions, function( i, action ) {
  14207. if ( value[ action ] ) {
  14208. animated[ action + "Class" ]( value[ action ] );
  14209. }
  14210. } );
  14211. };
  14212. applyClassChange();
  14213. // Map all animated objects again - calculate new styles and diff
  14214. allAnimations = allAnimations.map( function() {
  14215. this.end = getElementStyles( this.el[ 0 ] );
  14216. this.diff = styleDifference( this.start, this.end );
  14217. return this;
  14218. } );
  14219. // Apply original class
  14220. animated.attr( "class", baseClass );
  14221. // Map all animated objects again - this time collecting a promise
  14222. allAnimations = allAnimations.map( function() {
  14223. var styleInfo = this,
  14224. dfd = $.Deferred(),
  14225. opts = $.extend( {}, o, {
  14226. queue: false,
  14227. complete: function() {
  14228. dfd.resolve( styleInfo );
  14229. }
  14230. } );
  14231. this.el.animate( this.diff, opts );
  14232. return dfd.promise();
  14233. } );
  14234. // Once all animations have completed:
  14235. $.when.apply( $, allAnimations.get() ).done( function() {
  14236. // Set the final class
  14237. applyClassChange();
  14238. // For each animated element,
  14239. // clear all css properties that were animated
  14240. $.each( arguments, function() {
  14241. var el = this.el;
  14242. $.each( this.diff, function( key ) {
  14243. el.css( key, "" );
  14244. } );
  14245. } );
  14246. // This is guarnteed to be there if you use jQuery.speed()
  14247. // it also handles dequeuing the next anim...
  14248. o.complete.call( animated[ 0 ] );
  14249. } );
  14250. } );
  14251. };
  14252. $.fn.extend( {
  14253. addClass: ( function( orig ) {
  14254. return function( classNames, speed, easing, callback ) {
  14255. return speed ?
  14256. $.effects.animateClass.call( this,
  14257. { add: classNames }, speed, easing, callback ) :
  14258. orig.apply( this, arguments );
  14259. };
  14260. } )( $.fn.addClass ),
  14261. removeClass: ( function( orig ) {
  14262. return function( classNames, speed, easing, callback ) {
  14263. return arguments.length > 1 ?
  14264. $.effects.animateClass.call( this,
  14265. { remove: classNames }, speed, easing, callback ) :
  14266. orig.apply( this, arguments );
  14267. };
  14268. } )( $.fn.removeClass ),
  14269. toggleClass: ( function( orig ) {
  14270. return function( classNames, force, speed, easing, callback ) {
  14271. if ( typeof force === "boolean" || force === undefined ) {
  14272. if ( !speed ) {
  14273. // Without speed parameter
  14274. return orig.apply( this, arguments );
  14275. } else {
  14276. return $.effects.animateClass.call( this,
  14277. ( force ? { add: classNames } : { remove: classNames } ),
  14278. speed, easing, callback );
  14279. }
  14280. } else {
  14281. // Without force parameter
  14282. return $.effects.animateClass.call( this,
  14283. { toggle: classNames }, force, speed, easing );
  14284. }
  14285. };
  14286. } )( $.fn.toggleClass ),
  14287. switchClass: function( remove, add, speed, easing, callback ) {
  14288. return $.effects.animateClass.call( this, {
  14289. add: add,
  14290. remove: remove
  14291. }, speed, easing, callback );
  14292. }
  14293. } );
  14294. } )();
  14295. /******************************************************************************/
  14296. /*********************************** EFFECTS **********************************/
  14297. /******************************************************************************/
  14298. ( function() {
  14299. if ( $.expr && $.expr.filters && $.expr.filters.animated ) {
  14300. $.expr.filters.animated = ( function( orig ) {
  14301. return function( elem ) {
  14302. return !!$( elem ).data( dataSpaceAnimated ) || orig( elem );
  14303. };
  14304. } )( $.expr.filters.animated );
  14305. }
  14306. if ( $.uiBackCompat !== false ) {
  14307. $.extend( $.effects, {
  14308. // Saves a set of properties in a data storage
  14309. save: function( element, set ) {
  14310. var i = 0, length = set.length;
  14311. for ( ; i < length; i++ ) {
  14312. if ( set[ i ] !== null ) {
  14313. element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
  14314. }
  14315. }
  14316. },
  14317. // Restores a set of previously saved properties from a data storage
  14318. restore: function( element, set ) {
  14319. var val, i = 0, length = set.length;
  14320. for ( ; i < length; i++ ) {
  14321. if ( set[ i ] !== null ) {
  14322. val = element.data( dataSpace + set[ i ] );
  14323. element.css( set[ i ], val );
  14324. }
  14325. }
  14326. },
  14327. setMode: function( el, mode ) {
  14328. if ( mode === "toggle" ) {
  14329. mode = el.is( ":hidden" ) ? "show" : "hide";
  14330. }
  14331. return mode;
  14332. },
  14333. // Wraps the element around a wrapper that copies position properties
  14334. createWrapper: function( element ) {
  14335. // If the element is already wrapped, return it
  14336. if ( element.parent().is( ".ui-effects-wrapper" ) ) {
  14337. return element.parent();
  14338. }
  14339. // Wrap the element
  14340. var props = {
  14341. width: element.outerWidth( true ),
  14342. height: element.outerHeight( true ),
  14343. "float": element.css( "float" )
  14344. },
  14345. wrapper = $( "<div></div>" )
  14346. .addClass( "ui-effects-wrapper" )
  14347. .css( {
  14348. fontSize: "100%",
  14349. background: "transparent",
  14350. border: "none",
  14351. margin: 0,
  14352. padding: 0
  14353. } ),
  14354. // Store the size in case width/height are defined in % - Fixes #5245
  14355. size = {
  14356. width: element.width(),
  14357. height: element.height()
  14358. },
  14359. active = document.activeElement;
  14360. // Support: Firefox
  14361. // Firefox incorrectly exposes anonymous content
  14362. // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
  14363. try {
  14364. active.id;
  14365. } catch ( e ) {
  14366. active = document.body;
  14367. }
  14368. element.wrap( wrapper );
  14369. // Fixes #7595 - Elements lose focus when wrapped.
  14370. if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  14371. $( active ).trigger( "focus" );
  14372. }
  14373. // Hotfix for jQuery 1.4 since some change in wrap() seems to actually
  14374. // lose the reference to the wrapped element
  14375. wrapper = element.parent();
  14376. // Transfer positioning properties to the wrapper
  14377. if ( element.css( "position" ) === "static" ) {
  14378. wrapper.css( { position: "relative" } );
  14379. element.css( { position: "relative" } );
  14380. } else {
  14381. $.extend( props, {
  14382. position: element.css( "position" ),
  14383. zIndex: element.css( "z-index" )
  14384. } );
  14385. $.each( [ "top", "left", "bottom", "right" ], function( i, pos ) {
  14386. props[ pos ] = element.css( pos );
  14387. if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
  14388. props[ pos ] = "auto";
  14389. }
  14390. } );
  14391. element.css( {
  14392. position: "relative",
  14393. top: 0,
  14394. left: 0,
  14395. right: "auto",
  14396. bottom: "auto"
  14397. } );
  14398. }
  14399. element.css( size );
  14400. return wrapper.css( props ).show();
  14401. },
  14402. removeWrapper: function( element ) {
  14403. var active = document.activeElement;
  14404. if ( element.parent().is( ".ui-effects-wrapper" ) ) {
  14405. element.parent().replaceWith( element );
  14406. // Fixes #7595 - Elements lose focus when wrapped.
  14407. if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  14408. $( active ).trigger( "focus" );
  14409. }
  14410. }
  14411. return element;
  14412. }
  14413. } );
  14414. }
  14415. $.extend( $.effects, {
  14416. version: "1.12.1",
  14417. define: function( name, mode, effect ) {
  14418. if ( !effect ) {
  14419. effect = mode;
  14420. mode = "effect";
  14421. }
  14422. $.effects.effect[ name ] = effect;
  14423. $.effects.effect[ name ].mode = mode;
  14424. return effect;
  14425. },
  14426. scaledDimensions: function( element, percent, direction ) {
  14427. if ( percent === 0 ) {
  14428. return {
  14429. height: 0,
  14430. width: 0,
  14431. outerHeight: 0,
  14432. outerWidth: 0
  14433. };
  14434. }
  14435. var x = direction !== "horizontal" ? ( ( percent || 100 ) / 100 ) : 1,
  14436. y = direction !== "vertical" ? ( ( percent || 100 ) / 100 ) : 1;
  14437. return {
  14438. height: element.height() * y,
  14439. width: element.width() * x,
  14440. outerHeight: element.outerHeight() * y,
  14441. outerWidth: element.outerWidth() * x
  14442. };
  14443. },
  14444. clipToBox: function( animation ) {
  14445. return {
  14446. width: animation.clip.right - animation.clip.left,
  14447. height: animation.clip.bottom - animation.clip.top,
  14448. left: animation.clip.left,
  14449. top: animation.clip.top
  14450. };
  14451. },
  14452. // Injects recently queued functions to be first in line (after "inprogress")
  14453. unshift: function( element, queueLength, count ) {
  14454. var queue = element.queue();
  14455. if ( queueLength > 1 ) {
  14456. queue.splice.apply( queue,
  14457. [ 1, 0 ].concat( queue.splice( queueLength, count ) ) );
  14458. }
  14459. element.dequeue();
  14460. },
  14461. saveStyle: function( element ) {
  14462. element.data( dataSpaceStyle, element[ 0 ].style.cssText );
  14463. },
  14464. restoreStyle: function( element ) {
  14465. element[ 0 ].style.cssText = element.data( dataSpaceStyle ) || "";
  14466. element.removeData( dataSpaceStyle );
  14467. },
  14468. mode: function( element, mode ) {
  14469. var hidden = element.is( ":hidden" );
  14470. if ( mode === "toggle" ) {
  14471. mode = hidden ? "show" : "hide";
  14472. }
  14473. if ( hidden ? mode === "hide" : mode === "show" ) {
  14474. mode = "none";
  14475. }
  14476. return mode;
  14477. },
  14478. // Translates a [top,left] array into a baseline value
  14479. getBaseline: function( origin, original ) {
  14480. var y, x;
  14481. switch ( origin[ 0 ] ) {
  14482. case "top":
  14483. y = 0;
  14484. break;
  14485. case "middle":
  14486. y = 0.5;
  14487. break;
  14488. case "bottom":
  14489. y = 1;
  14490. break;
  14491. default:
  14492. y = origin[ 0 ] / original.height;
  14493. }
  14494. switch ( origin[ 1 ] ) {
  14495. case "left":
  14496. x = 0;
  14497. break;
  14498. case "center":
  14499. x = 0.5;
  14500. break;
  14501. case "right":
  14502. x = 1;
  14503. break;
  14504. default:
  14505. x = origin[ 1 ] / original.width;
  14506. }
  14507. return {
  14508. x: x,
  14509. y: y
  14510. };
  14511. },
  14512. // Creates a placeholder element so that the original element can be made absolute
  14513. createPlaceholder: function( element ) {
  14514. var placeholder,
  14515. cssPosition = element.css( "position" ),
  14516. position = element.position();
  14517. // Lock in margins first to account for form elements, which
  14518. // will change margin if you explicitly set height
  14519. // see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380
  14520. // Support: Safari
  14521. element.css( {
  14522. marginTop: element.css( "marginTop" ),
  14523. marginBottom: element.css( "marginBottom" ),
  14524. marginLeft: element.css( "marginLeft" ),
  14525. marginRight: element.css( "marginRight" )
  14526. } )
  14527. .outerWidth( element.outerWidth() )
  14528. .outerHeight( element.outerHeight() );
  14529. if ( /^(static|relative)/.test( cssPosition ) ) {
  14530. cssPosition = "absolute";
  14531. placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( {
  14532. // Convert inline to inline block to account for inline elements
  14533. // that turn to inline block based on content (like img)
  14534. display: /^(inline|ruby)/.test( element.css( "display" ) ) ?
  14535. "inline-block" :
  14536. "block",
  14537. visibility: "hidden",
  14538. // Margins need to be set to account for margin collapse
  14539. marginTop: element.css( "marginTop" ),
  14540. marginBottom: element.css( "marginBottom" ),
  14541. marginLeft: element.css( "marginLeft" ),
  14542. marginRight: element.css( "marginRight" ),
  14543. "float": element.css( "float" )
  14544. } )
  14545. .outerWidth( element.outerWidth() )
  14546. .outerHeight( element.outerHeight() )
  14547. .addClass( "ui-effects-placeholder" );
  14548. element.data( dataSpace + "placeholder", placeholder );
  14549. }
  14550. element.css( {
  14551. position: cssPosition,
  14552. left: position.left,
  14553. top: position.top
  14554. } );
  14555. return placeholder;
  14556. },
  14557. removePlaceholder: function( element ) {
  14558. var dataKey = dataSpace + "placeholder",
  14559. placeholder = element.data( dataKey );
  14560. if ( placeholder ) {
  14561. placeholder.remove();
  14562. element.removeData( dataKey );
  14563. }
  14564. },
  14565. // Removes a placeholder if it exists and restores
  14566. // properties that were modified during placeholder creation
  14567. cleanUp: function( element ) {
  14568. $.effects.restoreStyle( element );
  14569. $.effects.removePlaceholder( element );
  14570. },
  14571. setTransition: function( element, list, factor, value ) {
  14572. value = value || {};
  14573. $.each( list, function( i, x ) {
  14574. var unit = element.cssUnit( x );
  14575. if ( unit[ 0 ] > 0 ) {
  14576. value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
  14577. }
  14578. } );
  14579. return value;
  14580. }
  14581. } );
  14582. // Return an effect options object for the given parameters:
  14583. function _normalizeArguments( effect, options, speed, callback ) {
  14584. // Allow passing all options as the first parameter
  14585. if ( $.isPlainObject( effect ) ) {
  14586. options = effect;
  14587. effect = effect.effect;
  14588. }
  14589. // Convert to an object
  14590. effect = { effect: effect };
  14591. // Catch (effect, null, ...)
  14592. if ( options == null ) {
  14593. options = {};
  14594. }
  14595. // Catch (effect, callback)
  14596. if ( $.isFunction( options ) ) {
  14597. callback = options;
  14598. speed = null;
  14599. options = {};
  14600. }
  14601. // Catch (effect, speed, ?)
  14602. if ( typeof options === "number" || $.fx.speeds[ options ] ) {
  14603. callback = speed;
  14604. speed = options;
  14605. options = {};
  14606. }
  14607. // Catch (effect, options, callback)
  14608. if ( $.isFunction( speed ) ) {
  14609. callback = speed;
  14610. speed = null;
  14611. }
  14612. // Add options to effect
  14613. if ( options ) {
  14614. $.extend( effect, options );
  14615. }
  14616. speed = speed || options.duration;
  14617. effect.duration = $.fx.off ? 0 :
  14618. typeof speed === "number" ? speed :
  14619. speed in $.fx.speeds ? $.fx.speeds[ speed ] :
  14620. $.fx.speeds._default;
  14621. effect.complete = callback || options.complete;
  14622. return effect;
  14623. }
  14624. function standardAnimationOption( option ) {
  14625. // Valid standard speeds (nothing, number, named speed)
  14626. if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
  14627. return true;
  14628. }
  14629. // Invalid strings - treat as "normal" speed
  14630. if ( typeof option === "string" && !$.effects.effect[ option ] ) {
  14631. return true;
  14632. }
  14633. // Complete callback
  14634. if ( $.isFunction( option ) ) {
  14635. return true;
  14636. }
  14637. // Options hash (but not naming an effect)
  14638. if ( typeof option === "object" && !option.effect ) {
  14639. return true;
  14640. }
  14641. // Didn't match any standard API
  14642. return false;
  14643. }
  14644. $.fn.extend( {
  14645. effect: function( /* effect, options, speed, callback */ ) {
  14646. var args = _normalizeArguments.apply( this, arguments ),
  14647. effectMethod = $.effects.effect[ args.effect ],
  14648. defaultMode = effectMethod.mode,
  14649. queue = args.queue,
  14650. queueName = queue || "fx",
  14651. complete = args.complete,
  14652. mode = args.mode,
  14653. modes = [],
  14654. prefilter = function( next ) {
  14655. var el = $( this ),
  14656. normalizedMode = $.effects.mode( el, mode ) || defaultMode;
  14657. // Sentinel for duck-punching the :animated psuedo-selector
  14658. el.data( dataSpaceAnimated, true );
  14659. // Save effect mode for later use,
  14660. // we can't just call $.effects.mode again later,
  14661. // as the .show() below destroys the initial state
  14662. modes.push( normalizedMode );
  14663. // See $.uiBackCompat inside of run() for removal of defaultMode in 1.13
  14664. if ( defaultMode && ( normalizedMode === "show" ||
  14665. ( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) {
  14666. el.show();
  14667. }
  14668. if ( !defaultMode || normalizedMode !== "none" ) {
  14669. $.effects.saveStyle( el );
  14670. }
  14671. if ( $.isFunction( next ) ) {
  14672. next();
  14673. }
  14674. };
  14675. if ( $.fx.off || !effectMethod ) {
  14676. // Delegate to the original method (e.g., .show()) if possible
  14677. if ( mode ) {
  14678. return this[ mode ]( args.duration, complete );
  14679. } else {
  14680. return this.each( function() {
  14681. if ( complete ) {
  14682. complete.call( this );
  14683. }
  14684. } );
  14685. }
  14686. }
  14687. function run( next ) {
  14688. var elem = $( this );
  14689. function cleanup() {
  14690. elem.removeData( dataSpaceAnimated );
  14691. $.effects.cleanUp( elem );
  14692. if ( args.mode === "hide" ) {
  14693. elem.hide();
  14694. }
  14695. done();
  14696. }
  14697. function done() {
  14698. if ( $.isFunction( complete ) ) {
  14699. complete.call( elem[ 0 ] );
  14700. }
  14701. if ( $.isFunction( next ) ) {
  14702. next();
  14703. }
  14704. }
  14705. // Override mode option on a per element basis,
  14706. // as toggle can be either show or hide depending on element state
  14707. args.mode = modes.shift();
  14708. if ( $.uiBackCompat !== false && !defaultMode ) {
  14709. if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
  14710. // Call the core method to track "olddisplay" properly
  14711. elem[ mode ]();
  14712. done();
  14713. } else {
  14714. effectMethod.call( elem[ 0 ], args, done );
  14715. }
  14716. } else {
  14717. if ( args.mode === "none" ) {
  14718. // Call the core method to track "olddisplay" properly
  14719. elem[ mode ]();
  14720. done();
  14721. } else {
  14722. effectMethod.call( elem[ 0 ], args, cleanup );
  14723. }
  14724. }
  14725. }
  14726. // Run prefilter on all elements first to ensure that
  14727. // any showing or hiding happens before placeholder creation,
  14728. // which ensures that any layout changes are correctly captured.
  14729. return queue === false ?
  14730. this.each( prefilter ).each( run ) :
  14731. this.queue( queueName, prefilter ).queue( queueName, run );
  14732. },
  14733. show: ( function( orig ) {
  14734. return function( option ) {
  14735. if ( standardAnimationOption( option ) ) {
  14736. return orig.apply( this, arguments );
  14737. } else {
  14738. var args = _normalizeArguments.apply( this, arguments );
  14739. args.mode = "show";
  14740. return this.effect.call( this, args );
  14741. }
  14742. };
  14743. } )( $.fn.show ),
  14744. hide: ( function( orig ) {
  14745. return function( option ) {
  14746. if ( standardAnimationOption( option ) ) {
  14747. return orig.apply( this, arguments );
  14748. } else {
  14749. var args = _normalizeArguments.apply( this, arguments );
  14750. args.mode = "hide";
  14751. return this.effect.call( this, args );
  14752. }
  14753. };
  14754. } )( $.fn.hide ),
  14755. toggle: ( function( orig ) {
  14756. return function( option ) {
  14757. if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
  14758. return orig.apply( this, arguments );
  14759. } else {
  14760. var args = _normalizeArguments.apply( this, arguments );
  14761. args.mode = "toggle";
  14762. return this.effect.call( this, args );
  14763. }
  14764. };
  14765. } )( $.fn.toggle ),
  14766. cssUnit: function( key ) {
  14767. var style = this.css( key ),
  14768. val = [];
  14769. $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
  14770. if ( style.indexOf( unit ) > 0 ) {
  14771. val = [ parseFloat( style ), unit ];
  14772. }
  14773. } );
  14774. return val;
  14775. },
  14776. cssClip: function( clipObj ) {
  14777. if ( clipObj ) {
  14778. return this.css( "clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " +
  14779. clipObj.bottom + "px " + clipObj.left + "px)" );
  14780. }
  14781. return parseClip( this.css( "clip" ), this );
  14782. },
  14783. transfer: function( options, done ) {
  14784. var element = $( this ),
  14785. target = $( options.to ),
  14786. targetFixed = target.css( "position" ) === "fixed",
  14787. body = $( "body" ),
  14788. fixTop = targetFixed ? body.scrollTop() : 0,
  14789. fixLeft = targetFixed ? body.scrollLeft() : 0,
  14790. endPosition = target.offset(),
  14791. animation = {
  14792. top: endPosition.top - fixTop,
  14793. left: endPosition.left - fixLeft,
  14794. height: target.innerHeight(),
  14795. width: target.innerWidth()
  14796. },
  14797. startPosition = element.offset(),
  14798. transfer = $( "<div class='ui-effects-transfer'></div>" )
  14799. .appendTo( "body" )
  14800. .addClass( options.className )
  14801. .css( {
  14802. top: startPosition.top - fixTop,
  14803. left: startPosition.left - fixLeft,
  14804. height: element.innerHeight(),
  14805. width: element.innerWidth(),
  14806. position: targetFixed ? "fixed" : "absolute"
  14807. } )
  14808. .animate( animation, options.duration, options.easing, function() {
  14809. transfer.remove();
  14810. if ( $.isFunction( done ) ) {
  14811. done();
  14812. }
  14813. } );
  14814. }
  14815. } );
  14816. function parseClip( str, element ) {
  14817. var outerWidth = element.outerWidth(),
  14818. outerHeight = element.outerHeight(),
  14819. 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)\)$/,
  14820. values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ];
  14821. return {
  14822. top: parseFloat( values[ 1 ] ) || 0,
  14823. right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ),
  14824. bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ),
  14825. left: parseFloat( values[ 4 ] ) || 0
  14826. };
  14827. }
  14828. $.fx.step.clip = function( fx ) {
  14829. if ( !fx.clipInit ) {
  14830. fx.start = $( fx.elem ).cssClip();
  14831. if ( typeof fx.end === "string" ) {
  14832. fx.end = parseClip( fx.end, fx.elem );
  14833. }
  14834. fx.clipInit = true;
  14835. }
  14836. $( fx.elem ).cssClip( {
  14837. top: fx.pos * ( fx.end.top - fx.start.top ) + fx.start.top,
  14838. right: fx.pos * ( fx.end.right - fx.start.right ) + fx.start.right,
  14839. bottom: fx.pos * ( fx.end.bottom - fx.start.bottom ) + fx.start.bottom,
  14840. left: fx.pos * ( fx.end.left - fx.start.left ) + fx.start.left
  14841. } );
  14842. };
  14843. } )();
  14844. /******************************************************************************/
  14845. /*********************************** EASING ***********************************/
  14846. /******************************************************************************/
  14847. ( function() {
  14848. // Based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
  14849. var baseEasings = {};
  14850. $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
  14851. baseEasings[ name ] = function( p ) {
  14852. return Math.pow( p, i + 2 );
  14853. };
  14854. } );
  14855. $.extend( baseEasings, {
  14856. Sine: function( p ) {
  14857. return 1 - Math.cos( p * Math.PI / 2 );
  14858. },
  14859. Circ: function( p ) {
  14860. return 1 - Math.sqrt( 1 - p * p );
  14861. },
  14862. Elastic: function( p ) {
  14863. return p === 0 || p === 1 ? p :
  14864. -Math.pow( 2, 8 * ( p - 1 ) ) * Math.sin( ( ( p - 1 ) * 80 - 7.5 ) * Math.PI / 15 );
  14865. },
  14866. Back: function( p ) {
  14867. return p * p * ( 3 * p - 2 );
  14868. },
  14869. Bounce: function( p ) {
  14870. var pow2,
  14871. bounce = 4;
  14872. while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
  14873. return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
  14874. }
  14875. } );
  14876. $.each( baseEasings, function( name, easeIn ) {
  14877. $.easing[ "easeIn" + name ] = easeIn;
  14878. $.easing[ "easeOut" + name ] = function( p ) {
  14879. return 1 - easeIn( 1 - p );
  14880. };
  14881. $.easing[ "easeInOut" + name ] = function( p ) {
  14882. return p < 0.5 ?
  14883. easeIn( p * 2 ) / 2 :
  14884. 1 - easeIn( p * -2 + 2 ) / 2;
  14885. };
  14886. } );
  14887. } )();
  14888. var effect = $.effects;
  14889. /*!
  14890. * jQuery UI Effects Blind 1.12.1
  14891. * http://jqueryui.com
  14892. *
  14893. * Copyright jQuery Foundation and other contributors
  14894. * Released under the MIT license.
  14895. * http://jquery.org/license
  14896. */
  14897. //>>label: Blind Effect
  14898. //>>group: Effects
  14899. //>>description: Blinds the element.
  14900. //>>docs: http://api.jqueryui.com/blind-effect/
  14901. //>>demos: http://jqueryui.com/effect/
  14902. var effectsEffectBlind = $.effects.define( "blind", "hide", function( options, done ) {
  14903. var map = {
  14904. up: [ "bottom", "top" ],
  14905. vertical: [ "bottom", "top" ],
  14906. down: [ "top", "bottom" ],
  14907. left: [ "right", "left" ],
  14908. horizontal: [ "right", "left" ],
  14909. right: [ "left", "right" ]
  14910. },
  14911. element = $( this ),
  14912. direction = options.direction || "up",
  14913. start = element.cssClip(),
  14914. animate = { clip: $.extend( {}, start ) },
  14915. placeholder = $.effects.createPlaceholder( element );
  14916. animate.clip[ map[ direction ][ 0 ] ] = animate.clip[ map[ direction ][ 1 ] ];
  14917. if ( options.mode === "show" ) {
  14918. element.cssClip( animate.clip );
  14919. if ( placeholder ) {
  14920. placeholder.css( $.effects.clipToBox( animate ) );
  14921. }
  14922. animate.clip = start;
  14923. }
  14924. if ( placeholder ) {
  14925. placeholder.animate( $.effects.clipToBox( animate ), options.duration, options.easing );
  14926. }
  14927. element.animate( animate, {
  14928. queue: false,
  14929. duration: options.duration,
  14930. easing: options.easing,
  14931. complete: done
  14932. } );
  14933. } );
  14934. /*!
  14935. * jQuery UI Effects Bounce 1.12.1
  14936. * http://jqueryui.com
  14937. *
  14938. * Copyright jQuery Foundation and other contributors
  14939. * Released under the MIT license.
  14940. * http://jquery.org/license
  14941. */
  14942. //>>label: Bounce Effect
  14943. //>>group: Effects
  14944. //>>description: Bounces an element horizontally or vertically n times.
  14945. //>>docs: http://api.jqueryui.com/bounce-effect/
  14946. //>>demos: http://jqueryui.com/effect/
  14947. var effectsEffectBounce = $.effects.define( "bounce", function( options, done ) {
  14948. var upAnim, downAnim, refValue,
  14949. element = $( this ),
  14950. // Defaults:
  14951. mode = options.mode,
  14952. hide = mode === "hide",
  14953. show = mode === "show",
  14954. direction = options.direction || "up",
  14955. distance = options.distance,
  14956. times = options.times || 5,
  14957. // Number of internal animations
  14958. anims = times * 2 + ( show || hide ? 1 : 0 ),
  14959. speed = options.duration / anims,
  14960. easing = options.easing,
  14961. // Utility:
  14962. ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
  14963. motion = ( direction === "up" || direction === "left" ),
  14964. i = 0,
  14965. queuelen = element.queue().length;
  14966. $.effects.createPlaceholder( element );
  14967. refValue = element.css( ref );
  14968. // Default distance for the BIGGEST bounce is the outer Distance / 3
  14969. if ( !distance ) {
  14970. distance = element[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
  14971. }
  14972. if ( show ) {
  14973. downAnim = { opacity: 1 };
  14974. downAnim[ ref ] = refValue;
  14975. // If we are showing, force opacity 0 and set the initial position
  14976. // then do the "first" animation
  14977. element
  14978. .css( "opacity", 0 )
  14979. .css( ref, motion ? -distance * 2 : distance * 2 )
  14980. .animate( downAnim, speed, easing );
  14981. }
  14982. // Start at the smallest distance if we are hiding
  14983. if ( hide ) {
  14984. distance = distance / Math.pow( 2, times - 1 );
  14985. }
  14986. downAnim = {};
  14987. downAnim[ ref ] = refValue;
  14988. // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
  14989. for ( ; i < times; i++ ) {
  14990. upAnim = {};
  14991. upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
  14992. element
  14993. .animate( upAnim, speed, easing )
  14994. .animate( downAnim, speed, easing );
  14995. distance = hide ? distance * 2 : distance / 2;
  14996. }
  14997. // Last Bounce when Hiding
  14998. if ( hide ) {
  14999. upAnim = { opacity: 0 };
  15000. upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
  15001. element.animate( upAnim, speed, easing );
  15002. }
  15003. element.queue( done );
  15004. $.effects.unshift( element, queuelen, anims + 1 );
  15005. } );
  15006. /*!
  15007. * jQuery UI Effects Clip 1.12.1
  15008. * http://jqueryui.com
  15009. *
  15010. * Copyright jQuery Foundation and other contributors
  15011. * Released under the MIT license.
  15012. * http://jquery.org/license
  15013. */
  15014. //>>label: Clip Effect
  15015. //>>group: Effects
  15016. //>>description: Clips the element on and off like an old TV.
  15017. //>>docs: http://api.jqueryui.com/clip-effect/
  15018. //>>demos: http://jqueryui.com/effect/
  15019. var effectsEffectClip = $.effects.define( "clip", "hide", function( options, done ) {
  15020. var start,
  15021. animate = {},
  15022. element = $( this ),
  15023. direction = options.direction || "vertical",
  15024. both = direction === "both",
  15025. horizontal = both || direction === "horizontal",
  15026. vertical = both || direction === "vertical";
  15027. start = element.cssClip();
  15028. animate.clip = {
  15029. top: vertical ? ( start.bottom - start.top ) / 2 : start.top,
  15030. right: horizontal ? ( start.right - start.left ) / 2 : start.right,
  15031. bottom: vertical ? ( start.bottom - start.top ) / 2 : start.bottom,
  15032. left: horizontal ? ( start.right - start.left ) / 2 : start.left
  15033. };
  15034. $.effects.createPlaceholder( element );
  15035. if ( options.mode === "show" ) {
  15036. element.cssClip( animate.clip );
  15037. animate.clip = start;
  15038. }
  15039. element.animate( animate, {
  15040. queue: false,
  15041. duration: options.duration,
  15042. easing: options.easing,
  15043. complete: done
  15044. } );
  15045. } );
  15046. /*!
  15047. * jQuery UI Effects Drop 1.12.1
  15048. * http://jqueryui.com
  15049. *
  15050. * Copyright jQuery Foundation and other contributors
  15051. * Released under the MIT license.
  15052. * http://jquery.org/license
  15053. */
  15054. //>>label: Drop Effect
  15055. //>>group: Effects
  15056. //>>description: Moves an element in one direction and hides it at the same time.
  15057. //>>docs: http://api.jqueryui.com/drop-effect/
  15058. //>>demos: http://jqueryui.com/effect/
  15059. var effectsEffectDrop = $.effects.define( "drop", "hide", function( options, done ) {
  15060. var distance,
  15061. element = $( this ),
  15062. mode = options.mode,
  15063. show = mode === "show",
  15064. direction = options.direction || "left",
  15065. ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
  15066. motion = ( direction === "up" || direction === "left" ) ? "-=" : "+=",
  15067. oppositeMotion = ( motion === "+=" ) ? "-=" : "+=",
  15068. animation = {
  15069. opacity: 0
  15070. };
  15071. $.effects.createPlaceholder( element );
  15072. distance = options.distance ||
  15073. element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2;
  15074. animation[ ref ] = motion + distance;
  15075. if ( show ) {
  15076. element.css( animation );
  15077. animation[ ref ] = oppositeMotion + distance;
  15078. animation.opacity = 1;
  15079. }
  15080. // Animate
  15081. element.animate( animation, {
  15082. queue: false,
  15083. duration: options.duration,
  15084. easing: options.easing,
  15085. complete: done
  15086. } );
  15087. } );
  15088. /*!
  15089. * jQuery UI Effects Explode 1.12.1
  15090. * http://jqueryui.com
  15091. *
  15092. * Copyright jQuery Foundation and other contributors
  15093. * Released under the MIT license.
  15094. * http://jquery.org/license
  15095. */
  15096. //>>label: Explode Effect
  15097. //>>group: Effects
  15098. // jscs:disable maximumLineLength
  15099. //>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness.
  15100. // jscs:enable maximumLineLength
  15101. //>>docs: http://api.jqueryui.com/explode-effect/
  15102. //>>demos: http://jqueryui.com/effect/
  15103. var effectsEffectExplode = $.effects.define( "explode", "hide", function( options, done ) {
  15104. var i, j, left, top, mx, my,
  15105. rows = options.pieces ? Math.round( Math.sqrt( options.pieces ) ) : 3,
  15106. cells = rows,
  15107. element = $( this ),
  15108. mode = options.mode,
  15109. show = mode === "show",
  15110. // Show and then visibility:hidden the element before calculating offset
  15111. offset = element.show().css( "visibility", "hidden" ).offset(),
  15112. // Width and height of a piece
  15113. width = Math.ceil( element.outerWidth() / cells ),
  15114. height = Math.ceil( element.outerHeight() / rows ),
  15115. pieces = [];
  15116. // Children animate complete:
  15117. function childComplete() {
  15118. pieces.push( this );
  15119. if ( pieces.length === rows * cells ) {
  15120. animComplete();
  15121. }
  15122. }
  15123. // Clone the element for each row and cell.
  15124. for ( i = 0; i < rows; i++ ) { // ===>
  15125. top = offset.top + i * height;
  15126. my = i - ( rows - 1 ) / 2;
  15127. for ( j = 0; j < cells; j++ ) { // |||
  15128. left = offset.left + j * width;
  15129. mx = j - ( cells - 1 ) / 2;
  15130. // Create a clone of the now hidden main element that will be absolute positioned
  15131. // within a wrapper div off the -left and -top equal to size of our pieces
  15132. element
  15133. .clone()
  15134. .appendTo( "body" )
  15135. .wrap( "<div></div>" )
  15136. .css( {
  15137. position: "absolute",
  15138. visibility: "visible",
  15139. left: -j * width,
  15140. top: -i * height
  15141. } )
  15142. // Select the wrapper - make it overflow: hidden and absolute positioned based on
  15143. // where the original was located +left and +top equal to the size of pieces
  15144. .parent()
  15145. .addClass( "ui-effects-explode" )
  15146. .css( {
  15147. position: "absolute",
  15148. overflow: "hidden",
  15149. width: width,
  15150. height: height,
  15151. left: left + ( show ? mx * width : 0 ),
  15152. top: top + ( show ? my * height : 0 ),
  15153. opacity: show ? 0 : 1
  15154. } )
  15155. .animate( {
  15156. left: left + ( show ? 0 : mx * width ),
  15157. top: top + ( show ? 0 : my * height ),
  15158. opacity: show ? 1 : 0
  15159. }, options.duration || 500, options.easing, childComplete );
  15160. }
  15161. }
  15162. function animComplete() {
  15163. element.css( {
  15164. visibility: "visible"
  15165. } );
  15166. $( pieces ).remove();
  15167. done();
  15168. }
  15169. } );
  15170. /*!
  15171. * jQuery UI Effects Fade 1.12.1
  15172. * http://jqueryui.com
  15173. *
  15174. * Copyright jQuery Foundation and other contributors
  15175. * Released under the MIT license.
  15176. * http://jquery.org/license
  15177. */
  15178. //>>label: Fade Effect
  15179. //>>group: Effects
  15180. //>>description: Fades the element.
  15181. //>>docs: http://api.jqueryui.com/fade-effect/
  15182. //>>demos: http://jqueryui.com/effect/
  15183. var effectsEffectFade = $.effects.define( "fade", "toggle", function( options, done ) {
  15184. var show = options.mode === "show";
  15185. $( this )
  15186. .css( "opacity", show ? 0 : 1 )
  15187. .animate( {
  15188. opacity: show ? 1 : 0
  15189. }, {
  15190. queue: false,
  15191. duration: options.duration,
  15192. easing: options.easing,
  15193. complete: done
  15194. } );
  15195. } );
  15196. /*!
  15197. * jQuery UI Effects Fold 1.12.1
  15198. * http://jqueryui.com
  15199. *
  15200. * Copyright jQuery Foundation and other contributors
  15201. * Released under the MIT license.
  15202. * http://jquery.org/license
  15203. */
  15204. //>>label: Fold Effect
  15205. //>>group: Effects
  15206. //>>description: Folds an element first horizontally and then vertically.
  15207. //>>docs: http://api.jqueryui.com/fold-effect/
  15208. //>>demos: http://jqueryui.com/effect/
  15209. var effectsEffectFold = $.effects.define( "fold", "hide", function( options, done ) {
  15210. // Create element
  15211. var element = $( this ),
  15212. mode = options.mode,
  15213. show = mode === "show",
  15214. hide = mode === "hide",
  15215. size = options.size || 15,
  15216. percent = /([0-9]+)%/.exec( size ),
  15217. horizFirst = !!options.horizFirst,
  15218. ref = horizFirst ? [ "right", "bottom" ] : [ "bottom", "right" ],
  15219. duration = options.duration / 2,
  15220. placeholder = $.effects.createPlaceholder( element ),
  15221. start = element.cssClip(),
  15222. animation1 = { clip: $.extend( {}, start ) },
  15223. animation2 = { clip: $.extend( {}, start ) },
  15224. distance = [ start[ ref[ 0 ] ], start[ ref[ 1 ] ] ],
  15225. queuelen = element.queue().length;
  15226. if ( percent ) {
  15227. size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
  15228. }
  15229. animation1.clip[ ref[ 0 ] ] = size;
  15230. animation2.clip[ ref[ 0 ] ] = size;
  15231. animation2.clip[ ref[ 1 ] ] = 0;
  15232. if ( show ) {
  15233. element.cssClip( animation2.clip );
  15234. if ( placeholder ) {
  15235. placeholder.css( $.effects.clipToBox( animation2 ) );
  15236. }
  15237. animation2.clip = start;
  15238. }
  15239. // Animate
  15240. element
  15241. .queue( function( next ) {
  15242. if ( placeholder ) {
  15243. placeholder
  15244. .animate( $.effects.clipToBox( animation1 ), duration, options.easing )
  15245. .animate( $.effects.clipToBox( animation2 ), duration, options.easing );
  15246. }
  15247. next();
  15248. } )
  15249. .animate( animation1, duration, options.easing )
  15250. .animate( animation2, duration, options.easing )
  15251. .queue( done );
  15252. $.effects.unshift( element, queuelen, 4 );
  15253. } );
  15254. /*!
  15255. * jQuery UI Effects Highlight 1.12.1
  15256. * http://jqueryui.com
  15257. *
  15258. * Copyright jQuery Foundation and other contributors
  15259. * Released under the MIT license.
  15260. * http://jquery.org/license
  15261. */
  15262. //>>label: Highlight Effect
  15263. //>>group: Effects
  15264. //>>description: Highlights the background of an element in a defined color for a custom duration.
  15265. //>>docs: http://api.jqueryui.com/highlight-effect/
  15266. //>>demos: http://jqueryui.com/effect/
  15267. var effectsEffectHighlight = $.effects.define( "highlight", "show", function( options, done ) {
  15268. var element = $( this ),
  15269. animation = {
  15270. backgroundColor: element.css( "backgroundColor" )
  15271. };
  15272. if ( options.mode === "hide" ) {
  15273. animation.opacity = 0;
  15274. }
  15275. $.effects.saveStyle( element );
  15276. element
  15277. .css( {
  15278. backgroundImage: "none",
  15279. backgroundColor: options.color || "#ffff99"
  15280. } )
  15281. .animate( animation, {
  15282. queue: false,
  15283. duration: options.duration,
  15284. easing: options.easing,
  15285. complete: done
  15286. } );
  15287. } );
  15288. /*!
  15289. * jQuery UI Effects Size 1.12.1
  15290. * http://jqueryui.com
  15291. *
  15292. * Copyright jQuery Foundation and other contributors
  15293. * Released under the MIT license.
  15294. * http://jquery.org/license
  15295. */
  15296. //>>label: Size Effect
  15297. //>>group: Effects
  15298. //>>description: Resize an element to a specified width and height.
  15299. //>>docs: http://api.jqueryui.com/size-effect/
  15300. //>>demos: http://jqueryui.com/effect/
  15301. var effectsEffectSize = $.effects.define( "size", function( options, done ) {
  15302. // Create element
  15303. var baseline, factor, temp,
  15304. element = $( this ),
  15305. // Copy for children
  15306. cProps = [ "fontSize" ],
  15307. vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
  15308. hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
  15309. // Set options
  15310. mode = options.mode,
  15311. restore = mode !== "effect",
  15312. scale = options.scale || "both",
  15313. origin = options.origin || [ "middle", "center" ],
  15314. position = element.css( "position" ),
  15315. pos = element.position(),
  15316. original = $.effects.scaledDimensions( element ),
  15317. from = options.from || original,
  15318. to = options.to || $.effects.scaledDimensions( element, 0 );
  15319. $.effects.createPlaceholder( element );
  15320. if ( mode === "show" ) {
  15321. temp = from;
  15322. from = to;
  15323. to = temp;
  15324. }
  15325. // Set scaling factor
  15326. factor = {
  15327. from: {
  15328. y: from.height / original.height,
  15329. x: from.width / original.width
  15330. },
  15331. to: {
  15332. y: to.height / original.height,
  15333. x: to.width / original.width
  15334. }
  15335. };
  15336. // Scale the css box
  15337. if ( scale === "box" || scale === "both" ) {
  15338. // Vertical props scaling
  15339. if ( factor.from.y !== factor.to.y ) {
  15340. from = $.effects.setTransition( element, vProps, factor.from.y, from );
  15341. to = $.effects.setTransition( element, vProps, factor.to.y, to );
  15342. }
  15343. // Horizontal props scaling
  15344. if ( factor.from.x !== factor.to.x ) {
  15345. from = $.effects.setTransition( element, hProps, factor.from.x, from );
  15346. to = $.effects.setTransition( element, hProps, factor.to.x, to );
  15347. }
  15348. }
  15349. // Scale the content
  15350. if ( scale === "content" || scale === "both" ) {
  15351. // Vertical props scaling
  15352. if ( factor.from.y !== factor.to.y ) {
  15353. from = $.effects.setTransition( element, cProps, factor.from.y, from );
  15354. to = $.effects.setTransition( element, cProps, factor.to.y, to );
  15355. }
  15356. }
  15357. // Adjust the position properties based on the provided origin points
  15358. if ( origin ) {
  15359. baseline = $.effects.getBaseline( origin, original );
  15360. from.top = ( original.outerHeight - from.outerHeight ) * baseline.y + pos.top;
  15361. from.left = ( original.outerWidth - from.outerWidth ) * baseline.x + pos.left;
  15362. to.top = ( original.outerHeight - to.outerHeight ) * baseline.y + pos.top;
  15363. to.left = ( original.outerWidth - to.outerWidth ) * baseline.x + pos.left;
  15364. }
  15365. element.css( from );
  15366. // Animate the children if desired
  15367. if ( scale === "content" || scale === "both" ) {
  15368. vProps = vProps.concat( [ "marginTop", "marginBottom" ] ).concat( cProps );
  15369. hProps = hProps.concat( [ "marginLeft", "marginRight" ] );
  15370. // Only animate children with width attributes specified
  15371. // TODO: is this right? should we include anything with css width specified as well
  15372. element.find( "*[width]" ).each( function() {
  15373. var child = $( this ),
  15374. childOriginal = $.effects.scaledDimensions( child ),
  15375. childFrom = {
  15376. height: childOriginal.height * factor.from.y,
  15377. width: childOriginal.width * factor.from.x,
  15378. outerHeight: childOriginal.outerHeight * factor.from.y,
  15379. outerWidth: childOriginal.outerWidth * factor.from.x
  15380. },
  15381. childTo = {
  15382. height: childOriginal.height * factor.to.y,
  15383. width: childOriginal.width * factor.to.x,
  15384. outerHeight: childOriginal.height * factor.to.y,
  15385. outerWidth: childOriginal.width * factor.to.x
  15386. };
  15387. // Vertical props scaling
  15388. if ( factor.from.y !== factor.to.y ) {
  15389. childFrom = $.effects.setTransition( child, vProps, factor.from.y, childFrom );
  15390. childTo = $.effects.setTransition( child, vProps, factor.to.y, childTo );
  15391. }
  15392. // Horizontal props scaling
  15393. if ( factor.from.x !== factor.to.x ) {
  15394. childFrom = $.effects.setTransition( child, hProps, factor.from.x, childFrom );
  15395. childTo = $.effects.setTransition( child, hProps, factor.to.x, childTo );
  15396. }
  15397. if ( restore ) {
  15398. $.effects.saveStyle( child );
  15399. }
  15400. // Animate children
  15401. child.css( childFrom );
  15402. child.animate( childTo, options.duration, options.easing, function() {
  15403. // Restore children
  15404. if ( restore ) {
  15405. $.effects.restoreStyle( child );
  15406. }
  15407. } );
  15408. } );
  15409. }
  15410. // Animate
  15411. element.animate( to, {
  15412. queue: false,
  15413. duration: options.duration,
  15414. easing: options.easing,
  15415. complete: function() {
  15416. var offset = element.offset();
  15417. if ( to.opacity === 0 ) {
  15418. element.css( "opacity", from.opacity );
  15419. }
  15420. if ( !restore ) {
  15421. element
  15422. .css( "position", position === "static" ? "relative" : position )
  15423. .offset( offset );
  15424. // Need to save style here so that automatic style restoration
  15425. // doesn't restore to the original styles from before the animation.
  15426. $.effects.saveStyle( element );
  15427. }
  15428. done();
  15429. }
  15430. } );
  15431. } );
  15432. /*!
  15433. * jQuery UI Effects Scale 1.12.1
  15434. * http://jqueryui.com
  15435. *
  15436. * Copyright jQuery Foundation and other contributors
  15437. * Released under the MIT license.
  15438. * http://jquery.org/license
  15439. */
  15440. //>>label: Scale Effect
  15441. //>>group: Effects
  15442. //>>description: Grows or shrinks an element and its content.
  15443. //>>docs: http://api.jqueryui.com/scale-effect/
  15444. //>>demos: http://jqueryui.com/effect/
  15445. var effectsEffectScale = $.effects.define( "scale", function( options, done ) {
  15446. // Create element
  15447. var el = $( this ),
  15448. mode = options.mode,
  15449. percent = parseInt( options.percent, 10 ) ||
  15450. ( parseInt( options.percent, 10 ) === 0 ? 0 : ( mode !== "effect" ? 0 : 100 ) ),
  15451. newOptions = $.extend( true, {
  15452. from: $.effects.scaledDimensions( el ),
  15453. to: $.effects.scaledDimensions( el, percent, options.direction || "both" ),
  15454. origin: options.origin || [ "middle", "center" ]
  15455. }, options );
  15456. // Fade option to support puff
  15457. if ( options.fade ) {
  15458. newOptions.from.opacity = 1;
  15459. newOptions.to.opacity = 0;
  15460. }
  15461. $.effects.effect.size.call( this, newOptions, done );
  15462. } );
  15463. /*!
  15464. * jQuery UI Effects Puff 1.12.1
  15465. * http://jqueryui.com
  15466. *
  15467. * Copyright jQuery Foundation and other contributors
  15468. * Released under the MIT license.
  15469. * http://jquery.org/license
  15470. */
  15471. //>>label: Puff Effect
  15472. //>>group: Effects
  15473. //>>description: Creates a puff effect by scaling the element up and hiding it at the same time.
  15474. //>>docs: http://api.jqueryui.com/puff-effect/
  15475. //>>demos: http://jqueryui.com/effect/
  15476. var effectsEffectPuff = $.effects.define( "puff", "hide", function( options, done ) {
  15477. var newOptions = $.extend( true, {}, options, {
  15478. fade: true,
  15479. percent: parseInt( options.percent, 10 ) || 150
  15480. } );
  15481. $.effects.effect.scale.call( this, newOptions, done );
  15482. } );
  15483. /*!
  15484. * jQuery UI Effects Pulsate 1.12.1
  15485. * http://jqueryui.com
  15486. *
  15487. * Copyright jQuery Foundation and other contributors
  15488. * Released under the MIT license.
  15489. * http://jquery.org/license
  15490. */
  15491. //>>label: Pulsate Effect
  15492. //>>group: Effects
  15493. //>>description: Pulsates an element n times by changing the opacity to zero and back.
  15494. //>>docs: http://api.jqueryui.com/pulsate-effect/
  15495. //>>demos: http://jqueryui.com/effect/
  15496. var effectsEffectPulsate = $.effects.define( "pulsate", "show", function( options, done ) {
  15497. var element = $( this ),
  15498. mode = options.mode,
  15499. show = mode === "show",
  15500. hide = mode === "hide",
  15501. showhide = show || hide,
  15502. // Showing or hiding leaves off the "last" animation
  15503. anims = ( ( options.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
  15504. duration = options.duration / anims,
  15505. animateTo = 0,
  15506. i = 1,
  15507. queuelen = element.queue().length;
  15508. if ( show || !element.is( ":visible" ) ) {
  15509. element.css( "opacity", 0 ).show();
  15510. animateTo = 1;
  15511. }
  15512. // Anims - 1 opacity "toggles"
  15513. for ( ; i < anims; i++ ) {
  15514. element.animate( { opacity: animateTo }, duration, options.easing );
  15515. animateTo = 1 - animateTo;
  15516. }
  15517. element.animate( { opacity: animateTo }, duration, options.easing );
  15518. element.queue( done );
  15519. $.effects.unshift( element, queuelen, anims + 1 );
  15520. } );
  15521. /*!
  15522. * jQuery UI Effects Shake 1.12.1
  15523. * http://jqueryui.com
  15524. *
  15525. * Copyright jQuery Foundation and other contributors
  15526. * Released under the MIT license.
  15527. * http://jquery.org/license
  15528. */
  15529. //>>label: Shake Effect
  15530. //>>group: Effects
  15531. //>>description: Shakes an element horizontally or vertically n times.
  15532. //>>docs: http://api.jqueryui.com/shake-effect/
  15533. //>>demos: http://jqueryui.com/effect/
  15534. var effectsEffectShake = $.effects.define( "shake", function( options, done ) {
  15535. var i = 1,
  15536. element = $( this ),
  15537. direction = options.direction || "left",
  15538. distance = options.distance || 20,
  15539. times = options.times || 3,
  15540. anims = times * 2 + 1,
  15541. speed = Math.round( options.duration / anims ),
  15542. ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
  15543. positiveMotion = ( direction === "up" || direction === "left" ),
  15544. animation = {},
  15545. animation1 = {},
  15546. animation2 = {},
  15547. queuelen = element.queue().length;
  15548. $.effects.createPlaceholder( element );
  15549. // Animation
  15550. animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
  15551. animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
  15552. animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
  15553. // Animate
  15554. element.animate( animation, speed, options.easing );
  15555. // Shakes
  15556. for ( ; i < times; i++ ) {
  15557. element
  15558. .animate( animation1, speed, options.easing )
  15559. .animate( animation2, speed, options.easing );
  15560. }
  15561. element
  15562. .animate( animation1, speed, options.easing )
  15563. .animate( animation, speed / 2, options.easing )
  15564. .queue( done );
  15565. $.effects.unshift( element, queuelen, anims + 1 );
  15566. } );
  15567. /*!
  15568. * jQuery UI Effects Slide 1.12.1
  15569. * http://jqueryui.com
  15570. *
  15571. * Copyright jQuery Foundation and other contributors
  15572. * Released under the MIT license.
  15573. * http://jquery.org/license
  15574. */
  15575. //>>label: Slide Effect
  15576. //>>group: Effects
  15577. //>>description: Slides an element in and out of the viewport.
  15578. //>>docs: http://api.jqueryui.com/slide-effect/
  15579. //>>demos: http://jqueryui.com/effect/
  15580. var effectsEffectSlide = $.effects.define( "slide", "show", function( options, done ) {
  15581. var startClip, startRef,
  15582. element = $( this ),
  15583. map = {
  15584. up: [ "bottom", "top" ],
  15585. down: [ "top", "bottom" ],
  15586. left: [ "right", "left" ],
  15587. right: [ "left", "right" ]
  15588. },
  15589. mode = options.mode,
  15590. direction = options.direction || "left",
  15591. ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
  15592. positiveMotion = ( direction === "up" || direction === "left" ),
  15593. distance = options.distance ||
  15594. element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ),
  15595. animation = {};
  15596. $.effects.createPlaceholder( element );
  15597. startClip = element.cssClip();
  15598. startRef = element.position()[ ref ];
  15599. // Define hide animation
  15600. animation[ ref ] = ( positiveMotion ? -1 : 1 ) * distance + startRef;
  15601. animation.clip = element.cssClip();
  15602. animation.clip[ map[ direction ][ 1 ] ] = animation.clip[ map[ direction ][ 0 ] ];
  15603. // Reverse the animation if we're showing
  15604. if ( mode === "show" ) {
  15605. element.cssClip( animation.clip );
  15606. element.css( ref, animation[ ref ] );
  15607. animation.clip = startClip;
  15608. animation[ ref ] = startRef;
  15609. }
  15610. // Actually animate
  15611. element.animate( animation, {
  15612. queue: false,
  15613. duration: options.duration,
  15614. easing: options.easing,
  15615. complete: done
  15616. } );
  15617. } );
  15618. /*!
  15619. * jQuery UI Effects Transfer 1.12.1
  15620. * http://jqueryui.com
  15621. *
  15622. * Copyright jQuery Foundation and other contributors
  15623. * Released under the MIT license.
  15624. * http://jquery.org/license
  15625. */
  15626. //>>label: Transfer Effect
  15627. //>>group: Effects
  15628. //>>description: Displays a transfer effect from one element to another.
  15629. //>>docs: http://api.jqueryui.com/transfer-effect/
  15630. //>>demos: http://jqueryui.com/effect/
  15631. var effect;
  15632. if ( $.uiBackCompat !== false ) {
  15633. effect = $.effects.define( "transfer", function( options, done ) {
  15634. $( this ).transfer( options, done );
  15635. } );
  15636. }
  15637. var effectsEffectTransfer = effect;
  15638. }));