Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

jquery-ui.js 679KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705
  1. /*! jQuery UI - v1.12.1 - 2016-09-14
  2. * http://jqueryui.com
  3. * Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
  4. * Copyright jQuery Foundation and other contributors; Licensed MIT */
  5. (function (factory) {
  6. 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. }
  45. orig(elems);
  46. };
  47. })($.cleanData);
  48. $.widget = function (name, base, prototype) {
  49. var existingConstructor, constructor, basePrototype;
  50. // ProxiedPrototype allows the provided prototype to remain unmodified
  51. // so that it can be used as a mixin for multiple widgets (#8876)
  52. var proxiedPrototype = {};
  53. var namespace = name.split(".")[0];
  54. name = name.split(".")[1];
  55. var fullName = namespace + "-" + name;
  56. if (!prototype) {
  57. prototype = base;
  58. base = $.Widget;
  59. }
  60. if ($.isArray(prototype)) {
  61. prototype = $.extend.apply(null, [{}].concat(prototype));
  62. }
  63. // Create selector for plugin
  64. $.expr[":"][fullName.toLowerCase()] = function (elem) {
  65. return !!$.data(elem, fullName);
  66. };
  67. $[namespace] = $[namespace] || {};
  68. existingConstructor = $[namespace][name];
  69. constructor = $[namespace][name] = function (options, element) {
  70. // Allow instantiation without "new" keyword
  71. if (!this._createWidget) {
  72. return new constructor(options, element);
  73. }
  74. // Allow instantiation without initializing for simple inheritance
  75. // must use "new" keyword (the code above always passes args)
  76. if (arguments.length) {
  77. this._createWidget(options, element);
  78. }
  79. };
  80. // Extend with the existing constructor to carry over any static properties
  81. $.extend(constructor, existingConstructor, {
  82. version: prototype.version,
  83. // Copy the object used to create the prototype in case we need to
  84. // redefine the widget later
  85. _proto: $.extend({}, prototype),
  86. // Track widgets that inherit from this widget in case this widget is
  87. // redefined after a widget inherits from it
  88. _childConstructors: []
  89. });
  90. basePrototype = new base();
  91. // We need to make the options hash a property directly on the new instance
  92. // otherwise we'll modify the options hash on the prototype that we're
  93. // inheriting from
  94. basePrototype.options = $.widget.extend({}, basePrototype.options);
  95. $.each(prototype, function (prop, value) {
  96. if (!$.isFunction(value)) {
  97. proxiedPrototype[prop] = value;
  98. return;
  99. }
  100. proxiedPrototype[prop] = (function () {
  101. function _super() {
  102. return base.prototype[prop].apply(this, arguments);
  103. }
  104. function _superApply(args) {
  105. return base.prototype[prop].apply(this, args);
  106. }
  107. return function () {
  108. var __super = this._super;
  109. var __superApply = this._superApply;
  110. var returnValue;
  111. this._super = _super;
  112. this._superApply = _superApply;
  113. returnValue = value.apply(this, arguments);
  114. this._super = __super;
  115. this._superApply = __superApply;
  116. return returnValue;
  117. };
  118. })();
  119. });
  120. constructor.prototype = $.widget.extend(basePrototype, {
  121. // TODO: remove support for widgetEventPrefix
  122. // always use the name + a colon as the prefix, e.g., draggable:start
  123. // don't prefix for widgets that aren't DOM-based
  124. widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
  125. }, proxiedPrototype, {
  126. constructor: constructor,
  127. namespace: namespace,
  128. widgetName: name,
  129. widgetFullName: fullName
  130. });
  131. // If this widget is being redefined then we need to find all widgets that
  132. // are inheriting from it and redefine all of them so that they inherit from
  133. // the new version of this widget. We're essentially trying to replace one
  134. // level in the prototype chain.
  135. if (existingConstructor) {
  136. $.each(existingConstructor._childConstructors, function (i, child) {
  137. var childPrototype = child.prototype;
  138. // Redefine the child widget using the same prototype that was
  139. // originally used, but inherit from the new version of the base
  140. $.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor,
  141. child._proto);
  142. });
  143. // Remove the list of existing child constructors from the old constructor
  144. // so the old child constructors can be garbage collected
  145. delete existingConstructor._childConstructors;
  146. } else {
  147. base._childConstructors.push(constructor);
  148. }
  149. $.widget.bridge(name, constructor);
  150. return constructor;
  151. };
  152. $.widget.extend = function (target) {
  153. var input = widgetSlice.call(arguments, 1);
  154. var inputIndex = 0;
  155. var inputLength = input.length;
  156. var key;
  157. var value;
  158. for (; inputIndex < inputLength; inputIndex++) {
  159. for (key in input[inputIndex]) {
  160. value = input[inputIndex][key];
  161. if (input[inputIndex].hasOwnProperty(key) && value !== undefined) {
  162. // Clone objects
  163. if ($.isPlainObject(value)) {
  164. target[key] = $.isPlainObject(target[key]) ?
  165. $.widget.extend({}, target[key], value) :
  166. // Don't extend strings, arrays, etc. with objects
  167. $.widget.extend({}, value);
  168. // Copy everything else by reference
  169. } else {
  170. target[key] = value;
  171. }
  172. }
  173. }
  174. }
  175. return target;
  176. };
  177. $.widget.bridge = function (name, object) {
  178. var fullName = object.prototype.widgetFullName || name;
  179. $.fn[name] = function (options) {
  180. var isMethodCall = typeof options === "string";
  181. var args = widgetSlice.call(arguments, 1);
  182. var returnValue = this;
  183. if (isMethodCall) {
  184. // If this is an empty collection, we need to have the instance method
  185. // return undefined instead of the jQuery instance
  186. if (!this.length && options === "instance") {
  187. returnValue = undefined;
  188. } else {
  189. this.each(function () {
  190. var methodValue;
  191. var instance = $.data(this, fullName);
  192. if (options === "instance") {
  193. returnValue = instance;
  194. return false;
  195. }
  196. if (!instance) {
  197. return $.error("cannot call methods on " + name +
  198. " prior to initialization; " +
  199. "attempted to call method '" + options + "'");
  200. }
  201. if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
  202. return $.error("no such method '" + options + "' for " + name +
  203. " widget instance");
  204. }
  205. methodValue = instance[options].apply(instance, args);
  206. if (methodValue !== instance && methodValue !== undefined) {
  207. returnValue = methodValue && methodValue.jquery ?
  208. returnValue.pushStack(methodValue.get()) :
  209. methodValue;
  210. return false;
  211. }
  212. });
  213. }
  214. } else {
  215. // Allow multiple hashes to be passed on init
  216. if (args.length) {
  217. options = $.widget.extend.apply(null, [options].concat(args));
  218. }
  219. this.each(function () {
  220. var instance = $.data(this, fullName);
  221. if (instance) {
  222. instance.option(options || {});
  223. if (instance._init) {
  224. instance._init();
  225. }
  226. } else {
  227. $.data(this, fullName, new object(options, this));
  228. }
  229. });
  230. }
  231. return returnValue;
  232. };
  233. };
  234. $.Widget = function ( /* options, element */) {
  235. };
  236. $.Widget._childConstructors = [];
  237. $.Widget.prototype = {
  238. widgetName: "widget",
  239. widgetEventPrefix: "",
  240. defaultElement: "<div>",
  241. options: {
  242. classes: {},
  243. disabled: false,
  244. // Callbacks
  245. create: null
  246. },
  247. _createWidget: function (options, element) {
  248. element = $(element || this.defaultElement || this)[0];
  249. this.element = $(element);
  250. this.uuid = widgetUuid++;
  251. this.eventNamespace = "." + this.widgetName + this.uuid;
  252. this.bindings = $();
  253. this.hoverable = $();
  254. this.focusable = $();
  255. this.classesElementLookup = {};
  256. if (element !== this) {
  257. $.data(element, this.widgetFullName, this);
  258. this._on(true, this.element, {
  259. remove: function (event) {
  260. if (event.target === element) {
  261. this.destroy();
  262. }
  263. }
  264. });
  265. this.document = $(element.style ?
  266. // Element within the document
  267. element.ownerDocument :
  268. // Element is window or document
  269. element.document || element);
  270. this.window = $(this.document[0].defaultView || this.document[0].parentWindow);
  271. }
  272. this.options = $.widget.extend({},
  273. this.options,
  274. this._getCreateOptions(),
  275. options);
  276. this._create();
  277. if (this.options.disabled) {
  278. this._setOptionDisabled(this.options.disabled);
  279. }
  280. this._trigger("create", null, this._getCreateEventData());
  281. this._init();
  282. },
  283. _getCreateOptions: function () {
  284. return {};
  285. },
  286. _getCreateEventData: $.noop,
  287. _create: $.noop,
  288. _init: $.noop,
  289. destroy: function () {
  290. var that = this;
  291. this._destroy();
  292. $.each(this.classesElementLookup, function (key, value) {
  293. that._removeClass(value, key);
  294. });
  295. // We can probably remove the unbind calls in 2.0
  296. // all event bindings should go through this._on()
  297. this.element
  298. .off(this.eventNamespace)
  299. .removeData(this.widgetFullName);
  300. this.widget()
  301. .off(this.eventNamespace)
  302. .removeAttr("aria-disabled");
  303. // Clean up events and states
  304. this.bindings.off(this.eventNamespace);
  305. },
  306. _destroy: $.noop,
  307. widget: function () {
  308. return this.element;
  309. },
  310. option: function (key, value) {
  311. var options = key;
  312. var parts;
  313. var curOption;
  314. var i;
  315. if (arguments.length === 0) {
  316. // Don't return a reference to the internal hash
  317. return $.widget.extend({}, this.options);
  318. }
  319. if (typeof key === "string") {
  320. // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
  321. options = {};
  322. parts = key.split(".");
  323. key = parts.shift();
  324. if (parts.length) {
  325. curOption = options[key] = $.widget.extend({}, this.options[key]);
  326. for (i = 0; i < parts.length - 1; i++) {
  327. curOption[parts[i]] = curOption[parts[i]] || {};
  328. curOption = curOption[parts[i]];
  329. }
  330. key = parts.pop();
  331. if (arguments.length === 1) {
  332. return curOption[key] === undefined ? null : curOption[key];
  333. }
  334. curOption[key] = value;
  335. } else {
  336. if (arguments.length === 1) {
  337. return this.options[key] === undefined ? null : this.options[key];
  338. }
  339. options[key] = value;
  340. }
  341. }
  342. this._setOptions(options);
  343. return this;
  344. },
  345. _setOptions: function (options) {
  346. var key;
  347. for (key in options) {
  348. this._setOption(key, options[key]);
  349. }
  350. return this;
  351. },
  352. _setOption: function (key, value) {
  353. if (key === "classes") {
  354. this._setOptionClasses(value);
  355. }
  356. this.options[key] = value;
  357. if (key === "disabled") {
  358. this._setOptionDisabled(value);
  359. }
  360. return this;
  361. },
  362. _setOptionClasses: function (value) {
  363. var classKey, elements, currentElements;
  364. for (classKey in value) {
  365. currentElements = this.classesElementLookup[classKey];
  366. if (value[classKey] === this.options.classes[classKey] ||
  367. !currentElements ||
  368. !currentElements.length) {
  369. continue;
  370. }
  371. // We are doing this to create a new jQuery object because the _removeClass() call
  372. // on the next line is going to destroy the reference to the current elements being
  373. // tracked. We need to save a copy of this collection so that we can add the new classes
  374. // below.
  375. elements = $(currentElements.get());
  376. this._removeClass(currentElements, classKey);
  377. // We don't use _addClass() here, because that uses this.options.classes
  378. // for generating the string of classes. We want to use the value passed in from
  379. // _setOption(), this is the new value of the classes option which was passed to
  380. // _setOption(). We pass this value directly to _classes().
  381. elements.addClass(this._classes({
  382. element: elements,
  383. keys: classKey,
  384. classes: value,
  385. add: true
  386. }));
  387. }
  388. },
  389. _setOptionDisabled: function (value) {
  390. this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, !!value);
  391. // If the widget is becoming disabled, then nothing is interactive
  392. if (value) {
  393. this._removeClass(this.hoverable, null, "ui-state-hover");
  394. this._removeClass(this.focusable, null, "ui-state-focus");
  395. }
  396. },
  397. enable: function () {
  398. return this._setOptions({disabled: false});
  399. },
  400. disable: function () {
  401. return this._setOptions({disabled: true});
  402. },
  403. _classes: function (options) {
  404. var full = [];
  405. var that = this;
  406. options = $.extend({
  407. element: this.element,
  408. classes: this.options.classes || {}
  409. }, options);
  410. function processClassString(classes, checkOption) {
  411. var current, i;
  412. for (i = 0; i < classes.length; i++) {
  413. current = that.classesElementLookup[classes[i]] || $();
  414. if (options.add) {
  415. current = $($.unique(current.get().concat(options.element.get())));
  416. } else {
  417. current = $(current.not(options.element).get());
  418. }
  419. that.classesElementLookup[classes[i]] = current;
  420. full.push(classes[i]);
  421. if (checkOption && options.classes[classes[i]]) {
  422. full.push(options.classes[classes[i]]);
  423. }
  424. }
  425. }
  426. this._on(options.element, {
  427. "remove": "_untrackClassesElement"
  428. });
  429. if (options.keys) {
  430. processClassString(options.keys.match(/\S+/g) || [], true);
  431. }
  432. if (options.extra) {
  433. processClassString(options.extra.match(/\S+/g) || []);
  434. }
  435. return full.join(" ");
  436. },
  437. _untrackClassesElement: function (event) {
  438. var that = this;
  439. $.each(that.classesElementLookup, function (key, value) {
  440. if ($.inArray(event.target, value) !== -1) {
  441. that.classesElementLookup[key] = $(value.not(event.target).get());
  442. }
  443. });
  444. },
  445. _removeClass: function (element, keys, extra) {
  446. return this._toggleClass(element, keys, extra, false);
  447. },
  448. _addClass: function (element, keys, extra) {
  449. return this._toggleClass(element, keys, extra, true);
  450. },
  451. _toggleClass: function (element, keys, extra, add) {
  452. add = (typeof add === "boolean") ? add : extra;
  453. var shift = (typeof element === "string" || element === null),
  454. options = {
  455. extra: shift ? keys : extra,
  456. keys: shift ? element : keys,
  457. element: shift ? this.element : element,
  458. add: add
  459. };
  460. options.element.toggleClass(this._classes(options), add);
  461. return this;
  462. },
  463. _on: function (suppressDisabledCheck, element, handlers) {
  464. var delegateElement;
  465. var instance = this;
  466. // No suppressDisabledCheck flag, shuffle arguments
  467. if (typeof suppressDisabledCheck !== "boolean") {
  468. handlers = element;
  469. element = suppressDisabledCheck;
  470. suppressDisabledCheck = false;
  471. }
  472. // No element argument, shuffle and use this.element
  473. if (!handlers) {
  474. handlers = element;
  475. element = this.element;
  476. delegateElement = this.widget();
  477. } else {
  478. element = delegateElement = $(element);
  479. this.bindings = this.bindings.add(element);
  480. }
  481. $.each(handlers, function (event, handler) {
  482. function handlerProxy() {
  483. // Allow widgets to customize the disabled handling
  484. // - disabled as an array instead of boolean
  485. // - disabled class as method for disabling individual parts
  486. if (!suppressDisabledCheck &&
  487. (instance.options.disabled === true ||
  488. $(this).hasClass("ui-state-disabled"))) {
  489. return;
  490. }
  491. return (typeof handler === "string" ? instance[handler] : handler)
  492. .apply(instance, arguments);
  493. }
  494. // Copy the guid so direct unbinding works
  495. if (typeof handler !== "string") {
  496. handlerProxy.guid = handler.guid =
  497. handler.guid || handlerProxy.guid || $.guid++;
  498. }
  499. var match = event.match(/^([\w:-]*)\s*(.*)$/);
  500. var eventName = match[1] + instance.eventNamespace;
  501. var selector = match[2];
  502. if (selector) {
  503. delegateElement.on(eventName, selector, handlerProxy);
  504. } else {
  505. element.on(eventName, handlerProxy);
  506. }
  507. });
  508. },
  509. _off: function (element, eventName) {
  510. eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") +
  511. this.eventNamespace;
  512. element.off(eventName).off(eventName);
  513. // Clear the stack to avoid memory leaks (#10056)
  514. this.bindings = $(this.bindings.not(element).get());
  515. this.focusable = $(this.focusable.not(element).get());
  516. this.hoverable = $(this.hoverable.not(element).get());
  517. },
  518. _delay: function (handler, delay) {
  519. function handlerProxy() {
  520. return (typeof handler === "string" ? instance[handler] : handler)
  521. .apply(instance, arguments);
  522. }
  523. var instance = this;
  524. return setTimeout(handlerProxy, delay || 0);
  525. },
  526. _hoverable: function (element) {
  527. this.hoverable = this.hoverable.add(element);
  528. this._on(element, {
  529. mouseenter: function (event) {
  530. this._addClass($(event.currentTarget), null, "ui-state-hover");
  531. },
  532. mouseleave: function (event) {
  533. this._removeClass($(event.currentTarget), null, "ui-state-hover");
  534. }
  535. });
  536. },
  537. _focusable: function (element) {
  538. this.focusable = this.focusable.add(element);
  539. this._on(element, {
  540. focusin: function (event) {
  541. this._addClass($(event.currentTarget), null, "ui-state-focus");
  542. },
  543. focusout: function (event) {
  544. this._removeClass($(event.currentTarget), null, "ui-state-focus");
  545. }
  546. });
  547. },
  548. _trigger: function (type, event, data) {
  549. var prop, orig;
  550. var callback = this.options[type];
  551. data = data || {};
  552. event = $.Event(event);
  553. event.type = (type === this.widgetEventPrefix ?
  554. type :
  555. this.widgetEventPrefix + type).toLowerCase();
  556. // The original event may come from any element
  557. // so we need to reset the target on the new event
  558. event.target = this.element[0];
  559. // Copy original event properties over to the new event
  560. orig = event.originalEvent;
  561. if (orig) {
  562. for (prop in orig) {
  563. if (!(prop in event)) {
  564. event[prop] = orig[prop];
  565. }
  566. }
  567. }
  568. this.element.trigger(event, data);
  569. return !($.isFunction(callback) &&
  570. callback.apply(this.element[0], [event].concat(data)) === false ||
  571. event.isDefaultPrevented());
  572. }
  573. };
  574. $.each({show: "fadeIn", hide: "fadeOut"}, function (method, defaultEffect) {
  575. $.Widget.prototype["_" + method] = function (element, options, callback) {
  576. if (typeof options === "string") {
  577. options = {effect: options};
  578. }
  579. var hasOptions;
  580. var effectName = !options ?
  581. method :
  582. options === true || typeof options === "number" ?
  583. defaultEffect :
  584. options.effect || defaultEffect;
  585. options = options || {};
  586. if (typeof options === "number") {
  587. options = {duration: options};
  588. }
  589. hasOptions = !$.isEmptyObject(options);
  590. options.complete = callback;
  591. if (options.delay) {
  592. element.delay(options.delay);
  593. }
  594. if (hasOptions && $.effects && $.effects.effect[effectName]) {
  595. element[method](options);
  596. } else if (effectName !== method && element[effectName]) {
  597. element[effectName](options.duration, options.easing, callback);
  598. } else {
  599. element.queue(function (next) {
  600. $(this)[method]();
  601. if (callback) {
  602. callback.call(element[0]);
  603. }
  604. next();
  605. });
  606. }
  607. };
  608. });
  609. var widget = $.widget;
  610. /*!
  611. * jQuery UI Position 1.12.1
  612. * http://jqueryui.com
  613. *
  614. * Copyright jQuery Foundation and other contributors
  615. * Released under the MIT license.
  616. * http://jquery.org/license
  617. *
  618. * http://api.jqueryui.com/position/
  619. */
  620. //>>label: Position
  621. //>>group: Core
  622. //>>description: Positions elements relative to other elements.
  623. //>>docs: http://api.jqueryui.com/position/
  624. //>>demos: http://jqueryui.com/position/
  625. (function () {
  626. var cachedScrollbarWidth,
  627. max = Math.max,
  628. abs = Math.abs,
  629. rhorizontal = /left|center|right/,
  630. rvertical = /top|center|bottom/,
  631. roffset = /[\+\-]\d+(\.[\d]+)?%?/,
  632. rposition = /^\w+/,
  633. rpercent = /%$/,
  634. _position = $.fn.position;
  635. function getOffsets(offsets, width, height) {
  636. return [
  637. parseFloat(offsets[0]) * (rpercent.test(offsets[0]) ? width / 100 : 1),
  638. parseFloat(offsets[1]) * (rpercent.test(offsets[1]) ? height / 100 : 1)
  639. ];
  640. }
  641. function parseCss(element, property) {
  642. return parseInt($.css(element, property), 10) || 0;
  643. }
  644. function getDimensions(elem) {
  645. var raw = elem[0];
  646. if (raw.nodeType === 9) {
  647. return {
  648. width: elem.width(),
  649. height: elem.height(),
  650. offset: {top: 0, left: 0}
  651. };
  652. }
  653. if ($.isWindow(raw)) {
  654. return {
  655. width: elem.width(),
  656. height: elem.height(),
  657. offset: {top: elem.scrollTop(), left: elem.scrollLeft()}
  658. };
  659. }
  660. if (raw.preventDefault) {
  661. return {
  662. width: 0,
  663. height: 0,
  664. offset: {top: raw.pageY, left: raw.pageX}
  665. };
  666. }
  667. return {
  668. width: elem.outerWidth(),
  669. height: elem.outerHeight(),
  670. offset: elem.offset()
  671. };
  672. }
  673. $.position = {
  674. scrollbarWidth: function () {
  675. if (cachedScrollbarWidth !== undefined) {
  676. return cachedScrollbarWidth;
  677. }
  678. var w1, w2,
  679. div = $("<div " +
  680. "style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'>" +
  681. "<div style='height:100px;width:auto;'></div></div>"),
  682. innerDiv = div.children()[0];
  683. $("body").append(div);
  684. w1 = innerDiv.offsetWidth;
  685. div.css("overflow", "scroll");
  686. w2 = innerDiv.offsetWidth;
  687. if (w1 === w2) {
  688. w2 = div[0].clientWidth;
  689. }
  690. div.remove();
  691. return (cachedScrollbarWidth = w1 - w2);
  692. },
  693. getScrollInfo: function (within) {
  694. var overflowX = within.isWindow || within.isDocument ? "" :
  695. within.element.css("overflow-x"),
  696. overflowY = within.isWindow || within.isDocument ? "" :
  697. within.element.css("overflow-y"),
  698. hasOverflowX = overflowX === "scroll" ||
  699. (overflowX === "auto" && within.width < within.element[0].scrollWidth),
  700. hasOverflowY = overflowY === "scroll" ||
  701. (overflowY === "auto" && within.height < within.element[0].scrollHeight);
  702. return {
  703. width: hasOverflowY ? $.position.scrollbarWidth() : 0,
  704. height: hasOverflowX ? $.position.scrollbarWidth() : 0
  705. };
  706. },
  707. getWithinInfo: function (element) {
  708. var withinElement = $(element || window),
  709. isWindow = $.isWindow(withinElement[0]),
  710. isDocument = !!withinElement[0] && withinElement[0].nodeType === 9,
  711. hasOffset = !isWindow && !isDocument;
  712. return {
  713. element: withinElement,
  714. isWindow: isWindow,
  715. isDocument: isDocument,
  716. offset: hasOffset ? $(element).offset() : {left: 0, top: 0},
  717. scrollLeft: withinElement.scrollLeft(),
  718. scrollTop: withinElement.scrollTop(),
  719. width: withinElement.outerWidth(),
  720. height: withinElement.outerHeight()
  721. };
  722. }
  723. };
  724. $.fn.position = function (options) {
  725. if (!options || !options.of) {
  726. return _position.apply(this, arguments);
  727. }
  728. // Make a copy, we don't want to modify arguments
  729. options = $.extend({}, options);
  730. var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
  731. target = $(options.of),
  732. within = $.position.getWithinInfo(options.within),
  733. scrollInfo = $.position.getScrollInfo(within),
  734. collision = (options.collision || "flip").split(" "),
  735. offsets = {};
  736. dimensions = getDimensions(target);
  737. if (target[0].preventDefault) {
  738. // Force left top to allow flipping
  739. options.at = "left top";
  740. }
  741. targetWidth = dimensions.width;
  742. targetHeight = dimensions.height;
  743. targetOffset = dimensions.offset;
  744. // Clone to reuse original targetOffset later
  745. basePosition = $.extend({}, targetOffset);
  746. // Force my and at to have valid horizontal and vertical positions
  747. // if a value is missing or invalid, it will be converted to center
  748. $.each(["my", "at"], function () {
  749. var pos = (options[this] || "").split(" "),
  750. horizontalOffset,
  751. verticalOffset;
  752. if (pos.length === 1) {
  753. pos = rhorizontal.test(pos[0]) ?
  754. pos.concat(["center"]) :
  755. rvertical.test(pos[0]) ?
  756. ["center"].concat(pos) :
  757. ["center", "center"];
  758. }
  759. pos[0] = rhorizontal.test(pos[0]) ? pos[0] : "center";
  760. pos[1] = rvertical.test(pos[1]) ? pos[1] : "center";
  761. // Calculate offsets
  762. horizontalOffset = roffset.exec(pos[0]);
  763. verticalOffset = roffset.exec(pos[1]);
  764. offsets[this] = [
  765. horizontalOffset ? horizontalOffset[0] : 0,
  766. verticalOffset ? verticalOffset[0] : 0
  767. ];
  768. // Reduce to just the positions without the offsets
  769. options[this] = [
  770. rposition.exec(pos[0])[0],
  771. rposition.exec(pos[1])[0]
  772. ];
  773. });
  774. // Normalize collision option
  775. if (collision.length === 1) {
  776. collision[1] = collision[0];
  777. }
  778. if (options.at[0] === "right") {
  779. basePosition.left += targetWidth;
  780. } else if (options.at[0] === "center") {
  781. basePosition.left += targetWidth / 2;
  782. }
  783. if (options.at[1] === "bottom") {
  784. basePosition.top += targetHeight;
  785. } else if (options.at[1] === "center") {
  786. basePosition.top += targetHeight / 2;
  787. }
  788. atOffset = getOffsets(offsets.at, targetWidth, targetHeight);
  789. basePosition.left += atOffset[0];
  790. basePosition.top += atOffset[1];
  791. return this.each(function () {
  792. var collisionPosition, using,
  793. elem = $(this),
  794. elemWidth = elem.outerWidth(),
  795. elemHeight = elem.outerHeight(),
  796. marginLeft = parseCss(this, "marginLeft"),
  797. marginTop = parseCss(this, "marginTop"),
  798. collisionWidth = elemWidth + marginLeft + parseCss(this, "marginRight") +
  799. scrollInfo.width,
  800. collisionHeight = elemHeight + marginTop + parseCss(this, "marginBottom") +
  801. scrollInfo.height,
  802. position = $.extend({}, basePosition),
  803. myOffset = getOffsets(offsets.my, elem.outerWidth(), elem.outerHeight());
  804. if (options.my[0] === "right") {
  805. position.left -= elemWidth;
  806. } else if (options.my[0] === "center") {
  807. position.left -= elemWidth / 2;
  808. }
  809. if (options.my[1] === "bottom") {
  810. position.top -= elemHeight;
  811. } else if (options.my[1] === "center") {
  812. position.top -= elemHeight / 2;
  813. }
  814. position.left += myOffset[0];
  815. position.top += myOffset[1];
  816. collisionPosition = {
  817. marginLeft: marginLeft,
  818. marginTop: marginTop
  819. };
  820. $.each(["left", "top"], function (i, dir) {
  821. if ($.ui.position[collision[i]]) {
  822. $.ui.position[collision[i]][dir](position, {
  823. targetWidth: targetWidth,
  824. targetHeight: targetHeight,
  825. elemWidth: elemWidth,
  826. elemHeight: elemHeight,
  827. collisionPosition: collisionPosition,
  828. collisionWidth: collisionWidth,
  829. collisionHeight: collisionHeight,
  830. offset: [atOffset[0] + myOffset[0], atOffset [1] + myOffset[1]],
  831. my: options.my,
  832. at: options.at,
  833. within: within,
  834. elem: elem
  835. });
  836. }
  837. });
  838. if (options.using) {
  839. // Adds feedback as second argument to using callback, if present
  840. using = function (props) {
  841. var left = targetOffset.left - position.left,
  842. right = left + targetWidth - elemWidth,
  843. top = targetOffset.top - position.top,
  844. bottom = top + targetHeight - elemHeight,
  845. feedback = {
  846. target: {
  847. element: target,
  848. left: targetOffset.left,
  849. top: targetOffset.top,
  850. width: targetWidth,
  851. height: targetHeight
  852. },
  853. element: {
  854. element: elem,
  855. left: position.left,
  856. top: position.top,
  857. width: elemWidth,
  858. height: elemHeight
  859. },
  860. horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
  861. vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
  862. };
  863. if (targetWidth < elemWidth && abs(left + right) < targetWidth) {
  864. feedback.horizontal = "center";
  865. }
  866. if (targetHeight < elemHeight && abs(top + bottom) < targetHeight) {
  867. feedback.vertical = "middle";
  868. }
  869. if (max(abs(left), abs(right)) > max(abs(top), abs(bottom))) {
  870. feedback.important = "horizontal";
  871. } else {
  872. feedback.important = "vertical";
  873. }
  874. options.using.call(this, props, feedback);
  875. };
  876. }
  877. elem.offset($.extend(position, {using: using}));
  878. });
  879. };
  880. $.ui.position = {
  881. fit: {
  882. left: function (position, data) {
  883. var within = data.within,
  884. withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
  885. outerWidth = within.width,
  886. collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  887. overLeft = withinOffset - collisionPosLeft,
  888. overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
  889. newOverRight;
  890. // Element is wider than within
  891. if (data.collisionWidth > outerWidth) {
  892. // Element is initially over the left side of within
  893. if (overLeft > 0 && overRight <= 0) {
  894. newOverRight = position.left + overLeft + data.collisionWidth - outerWidth -
  895. withinOffset;
  896. position.left += overLeft - newOverRight;
  897. // Element is initially over right side of within
  898. } else if (overRight > 0 && overLeft <= 0) {
  899. position.left = withinOffset;
  900. // Element is initially over both left and right sides of within
  901. } else {
  902. if (overLeft > overRight) {
  903. position.left = withinOffset + outerWidth - data.collisionWidth;
  904. } else {
  905. position.left = withinOffset;
  906. }
  907. }
  908. // Too far left -> align with left edge
  909. } else if (overLeft > 0) {
  910. position.left += overLeft;
  911. // Too far right -> align with right edge
  912. } else if (overRight > 0) {
  913. position.left -= overRight;
  914. // Adjust based on position and margin
  915. } else {
  916. position.left = max(position.left - collisionPosLeft, position.left);
  917. }
  918. },
  919. top: function (position, data) {
  920. var within = data.within,
  921. withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
  922. outerHeight = data.within.height,
  923. collisionPosTop = position.top - data.collisionPosition.marginTop,
  924. overTop = withinOffset - collisionPosTop,
  925. overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
  926. newOverBottom;
  927. // Element is taller than within
  928. if (data.collisionHeight > outerHeight) {
  929. // Element is initially over the top of within
  930. if (overTop > 0 && overBottom <= 0) {
  931. newOverBottom = position.top + overTop + data.collisionHeight - outerHeight -
  932. withinOffset;
  933. position.top += overTop - newOverBottom;
  934. // Element is initially over bottom of within
  935. } else if (overBottom > 0 && overTop <= 0) {
  936. position.top = withinOffset;
  937. // Element is initially over both top and bottom of within
  938. } else {
  939. if (overTop > overBottom) {
  940. position.top = withinOffset + outerHeight - data.collisionHeight;
  941. } else {
  942. position.top = withinOffset;
  943. }
  944. }
  945. // Too far up -> align with top
  946. } else if (overTop > 0) {
  947. position.top += overTop;
  948. // Too far down -> align with bottom edge
  949. } else if (overBottom > 0) {
  950. position.top -= overBottom;
  951. // Adjust based on position and margin
  952. } else {
  953. position.top = max(position.top - collisionPosTop, position.top);
  954. }
  955. }
  956. },
  957. flip: {
  958. left: function (position, data) {
  959. var within = data.within,
  960. withinOffset = within.offset.left + within.scrollLeft,
  961. outerWidth = within.width,
  962. offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
  963. collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  964. overLeft = collisionPosLeft - offsetLeft,
  965. overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
  966. myOffset = data.my[0] === "left" ?
  967. -data.elemWidth :
  968. data.my[0] === "right" ?
  969. data.elemWidth :
  970. 0,
  971. atOffset = data.at[0] === "left" ?
  972. data.targetWidth :
  973. data.at[0] === "right" ?
  974. -data.targetWidth :
  975. 0,
  976. offset = -2 * data.offset[0],
  977. newOverRight,
  978. newOverLeft;
  979. if (overLeft < 0) {
  980. newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth -
  981. outerWidth - withinOffset;
  982. if (newOverRight < 0 || newOverRight < abs(overLeft)) {
  983. position.left += myOffset + atOffset + offset;
  984. }
  985. } else if (overRight > 0) {
  986. newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset +
  987. atOffset + offset - offsetLeft;
  988. if (newOverLeft > 0 || abs(newOverLeft) < overRight) {
  989. position.left += myOffset + atOffset + offset;
  990. }
  991. }
  992. },
  993. top: function (position, data) {
  994. var within = data.within,
  995. withinOffset = within.offset.top + within.scrollTop,
  996. outerHeight = within.height,
  997. offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
  998. collisionPosTop = position.top - data.collisionPosition.marginTop,
  999. overTop = collisionPosTop - offsetTop,
  1000. overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
  1001. top = data.my[1] === "top",
  1002. myOffset = top ?
  1003. -data.elemHeight :
  1004. data.my[1] === "bottom" ?
  1005. data.elemHeight :
  1006. 0,
  1007. atOffset = data.at[1] === "top" ?
  1008. data.targetHeight :
  1009. data.at[1] === "bottom" ?
  1010. -data.targetHeight :
  1011. 0,
  1012. offset = -2 * data.offset[1],
  1013. newOverTop,
  1014. newOverBottom;
  1015. if (overTop < 0) {
  1016. newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight -
  1017. outerHeight - withinOffset;
  1018. if (newOverBottom < 0 || newOverBottom < abs(overTop)) {
  1019. position.top += myOffset + atOffset + offset;
  1020. }
  1021. } else if (overBottom > 0) {
  1022. newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset +
  1023. offset - offsetTop;
  1024. if (newOverTop > 0 || abs(newOverTop) < overBottom) {
  1025. position.top += myOffset + atOffset + offset;
  1026. }
  1027. }
  1028. }
  1029. },
  1030. flipfit: {
  1031. left: function () {
  1032. $.ui.position.flip.left.apply(this, arguments);
  1033. $.ui.position.fit.left.apply(this, arguments);
  1034. },
  1035. top: function () {
  1036. $.ui.position.flip.top.apply(this, arguments);
  1037. $.ui.position.fit.top.apply(this, arguments);
  1038. }
  1039. }
  1040. };
  1041. })();
  1042. var position = $.ui.position;
  1043. /*!
  1044. * jQuery UI :data 1.12.1
  1045. * http://jqueryui.com
  1046. *
  1047. * Copyright jQuery Foundation and other contributors
  1048. * Released under the MIT license.
  1049. * http://jquery.org/license
  1050. */
  1051. //>>label: :data Selector
  1052. //>>group: Core
  1053. //>>description: Selects elements which have data stored under the specified key.
  1054. //>>docs: http://api.jqueryui.com/data-selector/
  1055. var data = $.extend($.expr[":"], {
  1056. data: $.expr.createPseudo ?
  1057. $.expr.createPseudo(function (dataName) {
  1058. return function (elem) {
  1059. return !!$.data(elem, dataName);
  1060. };
  1061. }) :
  1062. // Support: jQuery <1.8
  1063. function (elem, i, match) {
  1064. return !!$.data(elem, match[3]);
  1065. }
  1066. });
  1067. /*!
  1068. * jQuery UI Disable Selection 1.12.1
  1069. * http://jqueryui.com
  1070. *
  1071. * Copyright jQuery Foundation and other contributors
  1072. * Released under the MIT license.
  1073. * http://jquery.org/license
  1074. */
  1075. //>>label: disableSelection
  1076. //>>group: Core
  1077. //>>description: Disable selection of text content within the set of matched elements.
  1078. //>>docs: http://api.jqueryui.com/disableSelection/
  1079. // This file is deprecated
  1080. var disableSelection = $.fn.extend({
  1081. disableSelection: (function () {
  1082. var eventType = "onselectstart" in document.createElement("div") ?
  1083. "selectstart" :
  1084. "mousedown";
  1085. return function () {
  1086. return this.on(eventType + ".ui-disableSelection", function (event) {
  1087. event.preventDefault();
  1088. });
  1089. };
  1090. })(),
  1091. enableSelection: function () {
  1092. return this.off(".ui-disableSelection");
  1093. }
  1094. });
  1095. /*!
  1096. * jQuery UI Effects 1.12.1
  1097. * http://jqueryui.com
  1098. *
  1099. * Copyright jQuery Foundation and other contributors
  1100. * Released under the MIT license.
  1101. * http://jquery.org/license
  1102. */
  1103. //>>label: Effects Core
  1104. //>>group: Effects
  1105. // jscs:disable maximumLineLength
  1106. //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects.
  1107. // jscs:enable maximumLineLength
  1108. //>>docs: http://api.jqueryui.com/category/effects-core/
  1109. //>>demos: http://jqueryui.com/effect/
  1110. var dataSpace = "ui-effects-",
  1111. dataSpaceStyle = "ui-effects-style",
  1112. dataSpaceAnimated = "ui-effects-animated",
  1113. // Create a local jQuery because jQuery Color relies on it and the
  1114. // global may not exist with AMD and a custom build (#10199)
  1115. jQuery = $;
  1116. $.effects = {
  1117. effect: {}
  1118. };
  1119. /*!
  1120. * jQuery Color Animations v2.1.2
  1121. * https://github.com/jquery/jquery-color
  1122. *
  1123. * Copyright 2014 jQuery Foundation and other contributors
  1124. * Released under the MIT license.
  1125. * http://jquery.org/license
  1126. *
  1127. * Date: Wed Jan 16 08:47:09 2013 -0600
  1128. */
  1129. (function (jQuery, undefined) {
  1130. var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " +
  1131. "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
  1132. // Plusequals test for += 100 -= 100
  1133. rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
  1134. // A set of RE's that can match strings and generate color tuples.
  1135. stringParsers = [{
  1136. re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  1137. parse: function (execResult) {
  1138. return [
  1139. execResult[1],
  1140. execResult[2],
  1141. execResult[3],
  1142. execResult[4]
  1143. ];
  1144. }
  1145. }, {
  1146. re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  1147. parse: function (execResult) {
  1148. return [
  1149. execResult[1] * 2.55,
  1150. execResult[2] * 2.55,
  1151. execResult[3] * 2.55,
  1152. execResult[4]
  1153. ];
  1154. }
  1155. }, {
  1156. // This regex ignores A-F because it's compared against an already lowercased string
  1157. re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
  1158. parse: function (execResult) {
  1159. return [
  1160. parseInt(execResult[1], 16),
  1161. parseInt(execResult[2], 16),
  1162. parseInt(execResult[3], 16)
  1163. ];
  1164. }
  1165. }, {
  1166. // This regex ignores A-F because it's compared against an already lowercased string
  1167. re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
  1168. parse: function (execResult) {
  1169. return [
  1170. parseInt(execResult[1] + execResult[1], 16),
  1171. parseInt(execResult[2] + execResult[2], 16),
  1172. parseInt(execResult[3] + execResult[3], 16)
  1173. ];
  1174. }
  1175. }, {
  1176. re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  1177. space: "hsla",
  1178. parse: function (execResult) {
  1179. return [
  1180. execResult[1],
  1181. execResult[2] / 100,
  1182. execResult[3] / 100,
  1183. execResult[4]
  1184. ];
  1185. }
  1186. }],
  1187. // JQuery.Color( )
  1188. color = jQuery.Color = function (color, green, blue, alpha) {
  1189. return new jQuery.Color.fn.parse(color, green, blue, alpha);
  1190. },
  1191. spaces = {
  1192. rgba: {
  1193. props: {
  1194. red: {
  1195. idx: 0,
  1196. type: "byte"
  1197. },
  1198. green: {
  1199. idx: 1,
  1200. type: "byte"
  1201. },
  1202. blue: {
  1203. idx: 2,
  1204. type: "byte"
  1205. }
  1206. }
  1207. },
  1208. hsla: {
  1209. props: {
  1210. hue: {
  1211. idx: 0,
  1212. type: "degrees"
  1213. },
  1214. saturation: {
  1215. idx: 1,
  1216. type: "percent"
  1217. },
  1218. lightness: {
  1219. idx: 2,
  1220. type: "percent"
  1221. }
  1222. }
  1223. }
  1224. },
  1225. propTypes = {
  1226. "byte": {
  1227. floor: true,
  1228. max: 255
  1229. },
  1230. "percent": {
  1231. max: 1
  1232. },
  1233. "degrees": {
  1234. mod: 360,
  1235. floor: true
  1236. }
  1237. },
  1238. support = color.support = {},
  1239. // Element for support tests
  1240. supportElem = jQuery("<p>")[0],
  1241. // Colors = jQuery.Color.names
  1242. colors,
  1243. // Local aliases of functions called often
  1244. each = jQuery.each;
  1245. // Determine rgba support immediately
  1246. supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
  1247. support.rgba = supportElem.style.backgroundColor.indexOf("rgba") > -1;
  1248. // Define cache name and alpha properties
  1249. // for rgba and hsla spaces
  1250. each(spaces, function (spaceName, space) {
  1251. space.cache = "_" + spaceName;
  1252. space.props.alpha = {
  1253. idx: 3,
  1254. type: "percent",
  1255. def: 1
  1256. };
  1257. });
  1258. function clamp(value, prop, allowEmpty) {
  1259. var type = propTypes[prop.type] || {};
  1260. if (value == null) {
  1261. return (allowEmpty || !prop.def) ? null : prop.def;
  1262. }
  1263. // ~~ is an short way of doing floor for positive numbers
  1264. value = type.floor ? ~~value : parseFloat(value);
  1265. // IE will pass in empty strings as value for alpha,
  1266. // which will hit this case
  1267. if (isNaN(value)) {
  1268. return prop.def;
  1269. }
  1270. if (type.mod) {
  1271. // We add mod before modding to make sure that negatives values
  1272. // get converted properly: -10 -> 350
  1273. return (value + type.mod) % type.mod;
  1274. }
  1275. // For now all property types without mod have min and max
  1276. return 0 > value ? 0 : type.max < value ? type.max : value;
  1277. }
  1278. function stringParse(string) {
  1279. var inst = color(),
  1280. rgba = inst._rgba = [];
  1281. string = string.toLowerCase();
  1282. each(stringParsers, function (i, parser) {
  1283. var parsed,
  1284. match = parser.re.exec(string),
  1285. values = match && parser.parse(match),
  1286. spaceName = parser.space || "rgba";
  1287. if (values) {
  1288. parsed = inst[spaceName](values);
  1289. // If this was an rgba parse the assignment might happen twice
  1290. // oh well....
  1291. inst[spaces[spaceName].cache] = parsed[spaces[spaceName].cache];
  1292. rgba = inst._rgba = parsed._rgba;
  1293. // Exit each( stringParsers ) here because we matched
  1294. return false;
  1295. }
  1296. });
  1297. // Found a stringParser that handled it
  1298. if (rgba.length) {
  1299. // If this came from a parsed string, force "transparent" when alpha is 0
  1300. // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
  1301. if (rgba.join() === "0,0,0,0") {
  1302. jQuery.extend(rgba, colors.transparent);
  1303. }
  1304. return inst;
  1305. }
  1306. // Named colors
  1307. return colors[string];
  1308. }
  1309. color.fn = jQuery.extend(color.prototype, {
  1310. parse: function (red, green, blue, alpha) {
  1311. if (red === undefined) {
  1312. this._rgba = [null, null, null, null];
  1313. return this;
  1314. }
  1315. if (red.jquery || red.nodeType) {
  1316. red = jQuery(red).css(green);
  1317. green = undefined;
  1318. }
  1319. var inst = this,
  1320. type = jQuery.type(red),
  1321. rgba = this._rgba = [];
  1322. // More than 1 argument specified - assume ( red, green, blue, alpha )
  1323. if (green !== undefined) {
  1324. red = [red, green, blue, alpha];
  1325. type = "array";
  1326. }
  1327. if (type === "string") {
  1328. return this.parse(stringParse(red) || colors._default);
  1329. }
  1330. if (type === "array") {
  1331. each(spaces.rgba.props, function (key, prop) {
  1332. rgba[prop.idx] = clamp(red[prop.idx], prop);
  1333. });
  1334. return this;
  1335. }
  1336. if (type === "object") {
  1337. if (red instanceof color) {
  1338. each(spaces, function (spaceName, space) {
  1339. if (red[space.cache]) {
  1340. inst[space.cache] = red[space.cache].slice();
  1341. }
  1342. });
  1343. } else {
  1344. each(spaces, function (spaceName, space) {
  1345. var cache = space.cache;
  1346. each(space.props, function (key, prop) {
  1347. // If the cache doesn't exist, and we know how to convert
  1348. if (!inst[cache] && space.to) {
  1349. // If the value was null, we don't need to copy it
  1350. // if the key was alpha, we don't need to copy it either
  1351. if (key === "alpha" || red[key] == null) {
  1352. return;
  1353. }
  1354. inst[cache] = space.to(inst._rgba);
  1355. }
  1356. // This is the only case where we allow nulls for ALL properties.
  1357. // call clamp with alwaysAllowEmpty
  1358. inst[cache][prop.idx] = clamp(red[key], prop, true);
  1359. });
  1360. // Everything defined but alpha?
  1361. if (inst[cache] &&
  1362. jQuery.inArray(null, inst[cache].slice(0, 3)) < 0) {
  1363. // Use the default of 1
  1364. inst[cache][3] = 1;
  1365. if (space.from) {
  1366. inst._rgba = space.from(inst[cache]);
  1367. }
  1368. }
  1369. });
  1370. }
  1371. return this;
  1372. }
  1373. },
  1374. is: function (compare) {
  1375. var is = color(compare),
  1376. same = true,
  1377. inst = this;
  1378. each(spaces, function (_, space) {
  1379. var localCache,
  1380. isCache = is[space.cache];
  1381. if (isCache) {
  1382. localCache = inst[space.cache] || space.to && space.to(inst._rgba) || [];
  1383. each(space.props, function (_, prop) {
  1384. if (isCache[prop.idx] != null) {
  1385. same = (isCache[prop.idx] === localCache[prop.idx]);
  1386. return same;
  1387. }
  1388. });
  1389. }
  1390. return same;
  1391. });
  1392. return same;
  1393. },
  1394. _space: function () {
  1395. var used = [],
  1396. inst = this;
  1397. each(spaces, function (spaceName, space) {
  1398. if (inst[space.cache]) {
  1399. used.push(spaceName);
  1400. }
  1401. });
  1402. return used.pop();
  1403. },
  1404. transition: function (other, distance) {
  1405. var end = color(other),
  1406. spaceName = end._space(),
  1407. space = spaces[spaceName],
  1408. startColor = this.alpha() === 0 ? color("transparent") : this,
  1409. start = startColor[space.cache] || space.to(startColor._rgba),
  1410. result = start.slice();
  1411. end = end[space.cache];
  1412. each(space.props, function (key, prop) {
  1413. var index = prop.idx,
  1414. startValue = start[index],
  1415. endValue = end[index],
  1416. type = propTypes[prop.type] || {};
  1417. // If null, don't override start value
  1418. if (endValue === null) {
  1419. return;
  1420. }
  1421. // If null - use end
  1422. if (startValue === null) {
  1423. result[index] = endValue;
  1424. } else {
  1425. if (type.mod) {
  1426. if (endValue - startValue > type.mod / 2) {
  1427. startValue += type.mod;
  1428. } else if (startValue - endValue > type.mod / 2) {
  1429. startValue -= type.mod;
  1430. }
  1431. }
  1432. result[index] = clamp((endValue - startValue) * distance + startValue, prop);
  1433. }
  1434. });
  1435. return this[spaceName](result);
  1436. },
  1437. blend: function (opaque) {
  1438. // If we are already opaque - return ourself
  1439. if (this._rgba[3] === 1) {
  1440. return this;
  1441. }
  1442. var rgb = this._rgba.slice(),
  1443. a = rgb.pop(),
  1444. blend = color(opaque)._rgba;
  1445. return color(jQuery.map(rgb, function (v, i) {
  1446. return (1 - a) * blend[i] + a * v;
  1447. }));
  1448. },
  1449. toRgbaString: function () {
  1450. var prefix = "rgba(",
  1451. rgba = jQuery.map(this._rgba, function (v, i) {
  1452. return v == null ? (i > 2 ? 1 : 0) : v;
  1453. });
  1454. if (rgba[3] === 1) {
  1455. rgba.pop();
  1456. prefix = "rgb(";
  1457. }
  1458. return prefix + rgba.join() + ")";
  1459. },
  1460. toHslaString: function () {
  1461. var prefix = "hsla(",
  1462. hsla = jQuery.map(this.hsla(), function (v, i) {
  1463. if (v == null) {
  1464. v = i > 2 ? 1 : 0;
  1465. }
  1466. // Catch 1 and 2
  1467. if (i && i < 3) {
  1468. v = Math.round(v * 100) + "%";
  1469. }
  1470. return v;
  1471. });
  1472. if (hsla[3] === 1) {
  1473. hsla.pop();
  1474. prefix = "hsl(";
  1475. }
  1476. return prefix + hsla.join() + ")";
  1477. },
  1478. toHexString: function (includeAlpha) {
  1479. var rgba = this._rgba.slice(),
  1480. alpha = rgba.pop();
  1481. if (includeAlpha) {
  1482. rgba.push(~~(alpha * 255));
  1483. }
  1484. return "#" + jQuery.map(rgba, function (v) {
  1485. // Default to 0 when nulls exist
  1486. v = (v || 0).toString(16);
  1487. return v.length === 1 ? "0" + v : v;
  1488. }).join("");
  1489. },
  1490. toString: function () {
  1491. return this._rgba[3] === 0 ? "transparent" : this.toRgbaString();
  1492. }
  1493. });
  1494. color.fn.parse.prototype = color.fn;
  1495. // Hsla conversions adapted from:
  1496. // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
  1497. function hue2rgb(p, q, h) {
  1498. h = (h + 1) % 1;
  1499. if (h * 6 < 1) {
  1500. return p + (q - p) * h * 6;
  1501. }
  1502. if (h * 2 < 1) {
  1503. return q;
  1504. }
  1505. if (h * 3 < 2) {
  1506. return p + (q - p) * ((2 / 3) - h) * 6;
  1507. }
  1508. return p;
  1509. }
  1510. spaces.hsla.to = function (rgba) {
  1511. if (rgba[0] == null || rgba[1] == null || rgba[2] == null) {
  1512. return [null, null, null, rgba[3]];
  1513. }
  1514. var r = rgba[0] / 255,
  1515. g = rgba[1] / 255,
  1516. b = rgba[2] / 255,
  1517. a = rgba[3],
  1518. max = Math.max(r, g, b),
  1519. min = Math.min(r, g, b),
  1520. diff = max - min,
  1521. add = max + min,
  1522. l = add * 0.5,
  1523. h, s;
  1524. if (min === max) {
  1525. h = 0;
  1526. } else if (r === max) {
  1527. h = (60 * (g - b) / diff) + 360;
  1528. } else if (g === max) {
  1529. h = (60 * (b - r) / diff) + 120;
  1530. } else {
  1531. h = (60 * (r - g) / diff) + 240;
  1532. }
  1533. // Chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
  1534. // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
  1535. if (diff === 0) {
  1536. s = 0;
  1537. } else if (l <= 0.5) {
  1538. s = diff / add;
  1539. } else {
  1540. s = diff / (2 - add);
  1541. }
  1542. return [Math.round(h) % 360, s, l, a == null ? 1 : a];
  1543. };
  1544. spaces.hsla.from = function (hsla) {
  1545. if (hsla[0] == null || hsla[1] == null || hsla[2] == null) {
  1546. return [null, null, null, hsla[3]];
  1547. }
  1548. var h = hsla[0] / 360,
  1549. s = hsla[1],
  1550. l = hsla[2],
  1551. a = hsla[3],
  1552. q = l <= 0.5 ? l * (1 + s) : l + s - l * s,
  1553. p = 2 * l - q;
  1554. return [
  1555. Math.round(hue2rgb(p, q, h + (1 / 3)) * 255),
  1556. Math.round(hue2rgb(p, q, h) * 255),
  1557. Math.round(hue2rgb(p, q, h - (1 / 3)) * 255),
  1558. a
  1559. ];
  1560. };
  1561. each(spaces, function (spaceName, space) {
  1562. var props = space.props,
  1563. cache = space.cache,
  1564. to = space.to,
  1565. from = space.from;
  1566. // Makes rgba() and hsla()
  1567. color.fn[spaceName] = function (value) {
  1568. // Generate a cache for this space if it doesn't exist
  1569. if (to && !this[cache]) {
  1570. this[cache] = to(this._rgba);
  1571. }
  1572. if (value === undefined) {
  1573. return this[cache].slice();
  1574. }
  1575. var ret,
  1576. type = jQuery.type(value),
  1577. arr = (type === "array" || type === "object") ? value : arguments,
  1578. local = this[cache].slice();
  1579. each(props, function (key, prop) {
  1580. var val = arr[type === "object" ? key : prop.idx];
  1581. if (val == null) {
  1582. val = local[prop.idx];
  1583. }
  1584. local[prop.idx] = clamp(val, prop);
  1585. });
  1586. if (from) {
  1587. ret = color(from(local));
  1588. ret[cache] = local;
  1589. return ret;
  1590. } else {
  1591. return color(local);
  1592. }
  1593. };
  1594. // Makes red() green() blue() alpha() hue() saturation() lightness()
  1595. each(props, function (key, prop) {
  1596. // Alpha is included in more than one space
  1597. if (color.fn[key]) {
  1598. return;
  1599. }
  1600. color.fn[key] = function (value) {
  1601. var vtype = jQuery.type(value),
  1602. fn = (key === "alpha" ? (this._hsla ? "hsla" : "rgba") : spaceName),
  1603. local = this[fn](),
  1604. cur = local[prop.idx],
  1605. match;
  1606. if (vtype === "undefined") {
  1607. return cur;
  1608. }
  1609. if (vtype === "function") {
  1610. value = value.call(this, cur);
  1611. vtype = jQuery.type(value);
  1612. }
  1613. if (value == null && prop.empty) {
  1614. return this;
  1615. }
  1616. if (vtype === "string") {
  1617. match = rplusequals.exec(value);
  1618. if (match) {
  1619. value = cur + parseFloat(match[2]) * (match[1] === "+" ? 1 : -1);
  1620. }
  1621. }
  1622. local[prop.idx] = value;
  1623. return this[fn](local);
  1624. };
  1625. });
  1626. });
  1627. // Add cssHook and .fx.step function for each named hook.
  1628. // accept a space separated string of properties
  1629. color.hook = function (hook) {
  1630. var hooks = hook.split(" ");
  1631. each(hooks, function (i, hook) {
  1632. jQuery.cssHooks[hook] = {
  1633. set: function (elem, value) {
  1634. var parsed, curElem,
  1635. backgroundColor = "";
  1636. if (value !== "transparent" && (jQuery.type(value) !== "string" ||
  1637. (parsed = stringParse(value)))) {
  1638. value = color(parsed || value);
  1639. if (!support.rgba && value._rgba[3] !== 1) {
  1640. curElem = hook === "backgroundColor" ? elem.parentNode : elem;
  1641. while (
  1642. (backgroundColor === "" || backgroundColor === "transparent") &&
  1643. curElem && curElem.style
  1644. ) {
  1645. try {
  1646. backgroundColor = jQuery.css(curElem, "backgroundColor");
  1647. curElem = curElem.parentNode;
  1648. } catch (e) {
  1649. }
  1650. }
  1651. value = value.blend(backgroundColor && backgroundColor !== "transparent" ?
  1652. backgroundColor :
  1653. "_default");
  1654. }
  1655. value = value.toRgbaString();
  1656. }
  1657. try {
  1658. elem.style[hook] = value;
  1659. } catch (e) {
  1660. // Wrapped to prevent IE from throwing errors on "invalid" values like
  1661. // 'auto' or 'inherit'
  1662. }
  1663. }
  1664. };
  1665. jQuery.fx.step[hook] = function (fx) {
  1666. if (!fx.colorInit) {
  1667. fx.start = color(fx.elem, hook);
  1668. fx.end = color(fx.end);
  1669. fx.colorInit = true;
  1670. }
  1671. jQuery.cssHooks[hook].set(fx.elem, fx.start.transition(fx.end, fx.pos));
  1672. };
  1673. });
  1674. };
  1675. color.hook(stepHooks);
  1676. jQuery.cssHooks.borderColor = {
  1677. expand: function (value) {
  1678. var expanded = {};
  1679. each(["Top", "Right", "Bottom", "Left"], function (i, part) {
  1680. expanded["border" + part + "Color"] = value;
  1681. });
  1682. return expanded;
  1683. }
  1684. };
  1685. // Basic color names only.
  1686. // Usage of any of the other color names requires adding yourself or including
  1687. // jquery.color.svg-names.js.
  1688. colors = jQuery.Color.names = {
  1689. // 4.1. Basic color keywords
  1690. aqua: "#00ffff",
  1691. black: "#000000",
  1692. blue: "#0000ff",
  1693. fuchsia: "#ff00ff",
  1694. gray: "#808080",
  1695. green: "#008000",
  1696. lime: "#00ff00",
  1697. maroon: "#800000",
  1698. navy: "#000080",
  1699. olive: "#808000",
  1700. purple: "#800080",
  1701. red: "#ff0000",
  1702. silver: "#c0c0c0",
  1703. teal: "#008080",
  1704. white: "#ffffff",
  1705. yellow: "#ffff00",
  1706. // 4.2.3. "transparent" color keyword
  1707. transparent: [null, null, null, 0],
  1708. _default: "#ffffff"
  1709. };
  1710. })(jQuery);
  1711. /******************************************************************************/
  1712. /****************************** CLASS ANIMATIONS ******************************/
  1713. /******************************************************************************/
  1714. (function () {
  1715. var classAnimationActions = ["add", "remove", "toggle"],
  1716. shorthandStyles = {
  1717. border: 1,
  1718. borderBottom: 1,
  1719. borderColor: 1,
  1720. borderLeft: 1,
  1721. borderRight: 1,
  1722. borderTop: 1,
  1723. borderWidth: 1,
  1724. margin: 1,
  1725. padding: 1
  1726. };
  1727. $.each(
  1728. ["borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle"],
  1729. function (_, prop) {
  1730. $.fx.step[prop] = function (fx) {
  1731. if (fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr) {
  1732. jQuery.style(fx.elem, prop, fx.end);
  1733. fx.setAttr = true;
  1734. }
  1735. };
  1736. }
  1737. );
  1738. function getElementStyles(elem) {
  1739. var key, len,
  1740. style = elem.ownerDocument.defaultView ?
  1741. elem.ownerDocument.defaultView.getComputedStyle(elem, null) :
  1742. elem.currentStyle,
  1743. styles = {};
  1744. if (style && style.length && style[0] && style[style[0]]) {
  1745. len = style.length;
  1746. while (len--) {
  1747. key = style[len];
  1748. if (typeof style[key] === "string") {
  1749. styles[$.camelCase(key)] = style[key];
  1750. }
  1751. }
  1752. // Support: Opera, IE <9
  1753. } else {
  1754. for (key in style) {
  1755. if (typeof style[key] === "string") {
  1756. styles[key] = style[key];
  1757. }
  1758. }
  1759. }
  1760. return styles;
  1761. }
  1762. function styleDifference(oldStyle, newStyle) {
  1763. var diff = {},
  1764. name, value;
  1765. for (name in newStyle) {
  1766. value = newStyle[name];
  1767. if (oldStyle[name] !== value) {
  1768. if (!shorthandStyles[name]) {
  1769. if ($.fx.step[name] || !isNaN(parseFloat(value))) {
  1770. diff[name] = value;
  1771. }
  1772. }
  1773. }
  1774. }
  1775. return diff;
  1776. }
  1777. // Support: jQuery <1.8
  1778. if (!$.fn.addBack) {
  1779. $.fn.addBack = function (selector) {
  1780. return this.add(selector == null ?
  1781. this.prevObject : this.prevObject.filter(selector)
  1782. );
  1783. };
  1784. }
  1785. $.effects.animateClass = function (value, duration, easing, callback) {
  1786. var o = $.speed(duration, easing, callback);
  1787. return this.queue(function () {
  1788. var animated = $(this),
  1789. baseClass = animated.attr("class") || "",
  1790. applyClassChange,
  1791. allAnimations = o.children ? animated.find("*").addBack() : animated;
  1792. // Map the animated objects to store the original styles.
  1793. allAnimations = allAnimations.map(function () {
  1794. var el = $(this);
  1795. return {
  1796. el: el,
  1797. start: getElementStyles(this)
  1798. };
  1799. });
  1800. // Apply class change
  1801. applyClassChange = function () {
  1802. $.each(classAnimationActions, function (i, action) {
  1803. if (value[action]) {
  1804. animated[action + "Class"](value[action]);
  1805. }
  1806. });
  1807. };
  1808. applyClassChange();
  1809. // Map all animated objects again - calculate new styles and diff
  1810. allAnimations = allAnimations.map(function () {
  1811. this.end = getElementStyles(this.el[0]);
  1812. this.diff = styleDifference(this.start, this.end);
  1813. return this;
  1814. });
  1815. // Apply original class
  1816. animated.attr("class", baseClass);
  1817. // Map all animated objects again - this time collecting a promise
  1818. allAnimations = allAnimations.map(function () {
  1819. var styleInfo = this,
  1820. dfd = $.Deferred(),
  1821. opts = $.extend({}, o, {
  1822. queue: false,
  1823. complete: function () {
  1824. dfd.resolve(styleInfo);
  1825. }
  1826. });
  1827. this.el.animate(this.diff, opts);
  1828. return dfd.promise();
  1829. });
  1830. // Once all animations have completed:
  1831. $.when.apply($, allAnimations.get()).done(function () {
  1832. // Set the final class
  1833. applyClassChange();
  1834. // For each animated element,
  1835. // clear all css properties that were animated
  1836. $.each(arguments, function () {
  1837. var el = this.el;
  1838. $.each(this.diff, function (key) {
  1839. el.css(key, "");
  1840. });
  1841. });
  1842. // This is guarnteed to be there if you use jQuery.speed()
  1843. // it also handles dequeuing the next anim...
  1844. o.complete.call(animated[0]);
  1845. });
  1846. });
  1847. };
  1848. $.fn.extend({
  1849. addClass: (function (orig) {
  1850. return function (classNames, speed, easing, callback) {
  1851. return speed ?
  1852. $.effects.animateClass.call(this,
  1853. {add: classNames}, speed, easing, callback) :
  1854. orig.apply(this, arguments);
  1855. };
  1856. })($.fn.addClass),
  1857. removeClass: (function (orig) {
  1858. return function (classNames, speed, easing, callback) {
  1859. return arguments.length > 1 ?
  1860. $.effects.animateClass.call(this,
  1861. {remove: classNames}, speed, easing, callback) :
  1862. orig.apply(this, arguments);
  1863. };
  1864. })($.fn.removeClass),
  1865. toggleClass: (function (orig) {
  1866. return function (classNames, force, speed, easing, callback) {
  1867. if (typeof force === "boolean" || force === undefined) {
  1868. if (!speed) {
  1869. // Without speed parameter
  1870. return orig.apply(this, arguments);
  1871. } else {
  1872. return $.effects.animateClass.call(this,
  1873. (force ? {add: classNames} : {remove: classNames}),
  1874. speed, easing, callback);
  1875. }
  1876. } else {
  1877. // Without force parameter
  1878. return $.effects.animateClass.call(this,
  1879. {toggle: classNames}, force, speed, easing);
  1880. }
  1881. };
  1882. })($.fn.toggleClass),
  1883. switchClass: function (remove, add, speed, easing, callback) {
  1884. return $.effects.animateClass.call(this, {
  1885. add: add,
  1886. remove: remove
  1887. }, speed, easing, callback);
  1888. }
  1889. });
  1890. })();
  1891. /******************************************************************************/
  1892. /*********************************** EFFECTS **********************************/
  1893. /******************************************************************************/
  1894. (function () {
  1895. if ($.expr && $.expr.filters && $.expr.filters.animated) {
  1896. $.expr.filters.animated = (function (orig) {
  1897. return function (elem) {
  1898. return !!$(elem).data(dataSpaceAnimated) || orig(elem);
  1899. };
  1900. })($.expr.filters.animated);
  1901. }
  1902. if ($.uiBackCompat !== false) {
  1903. $.extend($.effects, {
  1904. // Saves a set of properties in a data storage
  1905. save: function (element, set) {
  1906. var i = 0, length = set.length;
  1907. for (; i < length; i++) {
  1908. if (set[i] !== null) {
  1909. element.data(dataSpace + set[i], element[0].style[set[i]]);
  1910. }
  1911. }
  1912. },
  1913. // Restores a set of previously saved properties from a data storage
  1914. restore: function (element, set) {
  1915. var val, i = 0, length = set.length;
  1916. for (; i < length; i++) {
  1917. if (set[i] !== null) {
  1918. val = element.data(dataSpace + set[i]);
  1919. element.css(set[i], val);
  1920. }
  1921. }
  1922. },
  1923. setMode: function (el, mode) {
  1924. if (mode === "toggle") {
  1925. mode = el.is(":hidden") ? "show" : "hide";
  1926. }
  1927. return mode;
  1928. },
  1929. // Wraps the element around a wrapper that copies position properties
  1930. createWrapper: function (element) {
  1931. // If the element is already wrapped, return it
  1932. if (element.parent().is(".ui-effects-wrapper")) {
  1933. return element.parent();
  1934. }
  1935. // Wrap the element
  1936. var props = {
  1937. width: element.outerWidth(true),
  1938. height: element.outerHeight(true),
  1939. "float": element.css("float")
  1940. },
  1941. wrapper = $("<div></div>")
  1942. .addClass("ui-effects-wrapper")
  1943. .css({
  1944. fontSize: "100%",
  1945. background: "transparent",
  1946. border: "none",
  1947. margin: 0,
  1948. padding: 0
  1949. }),
  1950. // Store the size in case width/height are defined in % - Fixes #5245
  1951. size = {
  1952. width: element.width(),
  1953. height: element.height()
  1954. },
  1955. active = document.activeElement;
  1956. // Support: Firefox
  1957. // Firefox incorrectly exposes anonymous content
  1958. // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
  1959. try {
  1960. active.id;
  1961. } catch (e) {
  1962. active = document.body;
  1963. }
  1964. element.wrap(wrapper);
  1965. // Fixes #7595 - Elements lose focus when wrapped.
  1966. if (element[0] === active || $.contains(element[0], active)) {
  1967. $(active).trigger("focus");
  1968. }
  1969. // Hotfix for jQuery 1.4 since some change in wrap() seems to actually
  1970. // lose the reference to the wrapped element
  1971. wrapper = element.parent();
  1972. // Transfer positioning properties to the wrapper
  1973. if (element.css("position") === "static") {
  1974. wrapper.css({position: "relative"});
  1975. element.css({position: "relative"});
  1976. } else {
  1977. $.extend(props, {
  1978. position: element.css("position"),
  1979. zIndex: element.css("z-index")
  1980. });
  1981. $.each(["top", "left", "bottom", "right"], function (i, pos) {
  1982. props[pos] = element.css(pos);
  1983. if (isNaN(parseInt(props[pos], 10))) {
  1984. props[pos] = "auto";
  1985. }
  1986. });
  1987. element.css({
  1988. position: "relative",
  1989. top: 0,
  1990. left: 0,
  1991. right: "auto",
  1992. bottom: "auto"
  1993. });
  1994. }
  1995. element.css(size);
  1996. return wrapper.css(props).show();
  1997. },
  1998. removeWrapper: function (element) {
  1999. var active = document.activeElement;
  2000. if (element.parent().is(".ui-effects-wrapper")) {
  2001. element.parent().replaceWith(element);
  2002. // Fixes #7595 - Elements lose focus when wrapped.
  2003. if (element[0] === active || $.contains(element[0], active)) {
  2004. $(active).trigger("focus");
  2005. }
  2006. }
  2007. return element;
  2008. }
  2009. });
  2010. }
  2011. $.extend($.effects, {
  2012. version: "1.12.1",
  2013. define: function (name, mode, effect) {
  2014. if (!effect) {
  2015. effect = mode;
  2016. mode = "effect";
  2017. }
  2018. $.effects.effect[name] = effect;
  2019. $.effects.effect[name].mode = mode;
  2020. return effect;
  2021. },
  2022. scaledDimensions: function (element, percent, direction) {
  2023. if (percent === 0) {
  2024. return {
  2025. height: 0,
  2026. width: 0,
  2027. outerHeight: 0,
  2028. outerWidth: 0
  2029. };
  2030. }
  2031. var x = direction !== "horizontal" ? ((percent || 100) / 100) : 1,
  2032. y = direction !== "vertical" ? ((percent || 100) / 100) : 1;
  2033. return {
  2034. height: element.height() * y,
  2035. width: element.width() * x,
  2036. outerHeight: element.outerHeight() * y,
  2037. outerWidth: element.outerWidth() * x
  2038. };
  2039. },
  2040. clipToBox: function (animation) {
  2041. return {
  2042. width: animation.clip.right - animation.clip.left,
  2043. height: animation.clip.bottom - animation.clip.top,
  2044. left: animation.clip.left,
  2045. top: animation.clip.top
  2046. };
  2047. },
  2048. // Injects recently queued functions to be first in line (after "inprogress")
  2049. unshift: function (element, queueLength, count) {
  2050. var queue = element.queue();
  2051. if (queueLength > 1) {
  2052. queue.splice.apply(queue,
  2053. [1, 0].concat(queue.splice(queueLength, count)));
  2054. }
  2055. element.dequeue();
  2056. },
  2057. saveStyle: function (element) {
  2058. element.data(dataSpaceStyle, element[0].style.cssText);
  2059. },
  2060. restoreStyle: function (element) {
  2061. element[0].style.cssText = element.data(dataSpaceStyle) || "";
  2062. element.removeData(dataSpaceStyle);
  2063. },
  2064. mode: function (element, mode) {
  2065. var hidden = element.is(":hidden");
  2066. if (mode === "toggle") {
  2067. mode = hidden ? "show" : "hide";
  2068. }
  2069. if (hidden ? mode === "hide" : mode === "show") {
  2070. mode = "none";
  2071. }
  2072. return mode;
  2073. },
  2074. // Translates a [top,left] array into a baseline value
  2075. getBaseline: function (origin, original) {
  2076. var y, x;
  2077. switch (origin[0]) {
  2078. case "top":
  2079. y = 0;
  2080. break;
  2081. case "middle":
  2082. y = 0.5;
  2083. break;
  2084. case "bottom":
  2085. y = 1;
  2086. break;
  2087. default:
  2088. y = origin[0] / original.height;
  2089. }
  2090. switch (origin[1]) {
  2091. case "left":
  2092. x = 0;
  2093. break;
  2094. case "center":
  2095. x = 0.5;
  2096. break;
  2097. case "right":
  2098. x = 1;
  2099. break;
  2100. default:
  2101. x = origin[1] / original.width;
  2102. }
  2103. return {
  2104. x: x,
  2105. y: y
  2106. };
  2107. },
  2108. // Creates a placeholder element so that the original element can be made absolute
  2109. createPlaceholder: function (element) {
  2110. var placeholder,
  2111. cssPosition = element.css("position"),
  2112. position = element.position();
  2113. // Lock in margins first to account for form elements, which
  2114. // will change margin if you explicitly set height
  2115. // see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380
  2116. // Support: Safari
  2117. element.css({
  2118. marginTop: element.css("marginTop"),
  2119. marginBottom: element.css("marginBottom"),
  2120. marginLeft: element.css("marginLeft"),
  2121. marginRight: element.css("marginRight")
  2122. })
  2123. .outerWidth(element.outerWidth())
  2124. .outerHeight(element.outerHeight());
  2125. if (/^(static|relative)/.test(cssPosition)) {
  2126. cssPosition = "absolute";
  2127. placeholder = $("<" + element[0].nodeName + ">").insertAfter(element).css({
  2128. // Convert inline to inline block to account for inline elements
  2129. // that turn to inline block based on content (like img)
  2130. display: /^(inline|ruby)/.test(element.css("display")) ?
  2131. "inline-block" :
  2132. "block",
  2133. visibility: "hidden",
  2134. // Margins need to be set to account for margin collapse
  2135. marginTop: element.css("marginTop"),
  2136. marginBottom: element.css("marginBottom"),
  2137. marginLeft: element.css("marginLeft"),
  2138. marginRight: element.css("marginRight"),
  2139. "float": element.css("float")
  2140. })
  2141. .outerWidth(element.outerWidth())
  2142. .outerHeight(element.outerHeight())
  2143. .addClass("ui-effects-placeholder");
  2144. element.data(dataSpace + "placeholder", placeholder);
  2145. }
  2146. element.css({
  2147. position: cssPosition,
  2148. left: position.left,
  2149. top: position.top
  2150. });
  2151. return placeholder;
  2152. },
  2153. removePlaceholder: function (element) {
  2154. var dataKey = dataSpace + "placeholder",
  2155. placeholder = element.data(dataKey);
  2156. if (placeholder) {
  2157. placeholder.remove();
  2158. element.removeData(dataKey);
  2159. }
  2160. },
  2161. // Removes a placeholder if it exists and restores
  2162. // properties that were modified during placeholder creation
  2163. cleanUp: function (element) {
  2164. $.effects.restoreStyle(element);
  2165. $.effects.removePlaceholder(element);
  2166. },
  2167. setTransition: function (element, list, factor, value) {
  2168. value = value || {};
  2169. $.each(list, function (i, x) {
  2170. var unit = element.cssUnit(x);
  2171. if (unit[0] > 0) {
  2172. value[x] = unit[0] * factor + unit[1];
  2173. }
  2174. });
  2175. return value;
  2176. }
  2177. });
  2178. // Return an effect options object for the given parameters:
  2179. function _normalizeArguments(effect, options, speed, callback) {
  2180. // Allow passing all options as the first parameter
  2181. if ($.isPlainObject(effect)) {
  2182. options = effect;
  2183. effect = effect.effect;
  2184. }
  2185. // Convert to an object
  2186. effect = {effect: effect};
  2187. // Catch (effect, null, ...)
  2188. if (options == null) {
  2189. options = {};
  2190. }
  2191. // Catch (effect, callback)
  2192. if ($.isFunction(options)) {
  2193. callback = options;
  2194. speed = null;
  2195. options = {};
  2196. }
  2197. // Catch (effect, speed, ?)
  2198. if (typeof options === "number" || $.fx.speeds[options]) {
  2199. callback = speed;
  2200. speed = options;
  2201. options = {};
  2202. }
  2203. // Catch (effect, options, callback)
  2204. if ($.isFunction(speed)) {
  2205. callback = speed;
  2206. speed = null;
  2207. }
  2208. // Add options to effect
  2209. if (options) {
  2210. $.extend(effect, options);
  2211. }
  2212. speed = speed || options.duration;
  2213. effect.duration = $.fx.off ? 0 :
  2214. typeof speed === "number" ? speed :
  2215. speed in $.fx.speeds ? $.fx.speeds[speed] :
  2216. $.fx.speeds._default;
  2217. effect.complete = callback || options.complete;
  2218. return effect;
  2219. }
  2220. function standardAnimationOption(option) {
  2221. // Valid standard speeds (nothing, number, named speed)
  2222. if (!option || typeof option === "number" || $.fx.speeds[option]) {
  2223. return true;
  2224. }
  2225. // Invalid strings - treat as "normal" speed
  2226. if (typeof option === "string" && !$.effects.effect[option]) {
  2227. return true;
  2228. }
  2229. // Complete callback
  2230. if ($.isFunction(option)) {
  2231. return true;
  2232. }
  2233. // Options hash (but not naming an effect)
  2234. if (typeof option === "object" && !option.effect) {
  2235. return true;
  2236. }
  2237. // Didn't match any standard API
  2238. return false;
  2239. }
  2240. $.fn.extend({
  2241. effect: function ( /* effect, options, speed, callback */) {
  2242. var args = _normalizeArguments.apply(this, arguments),
  2243. effectMethod = $.effects.effect[args.effect],
  2244. defaultMode = effectMethod.mode,
  2245. queue = args.queue,
  2246. queueName = queue || "fx",
  2247. complete = args.complete,
  2248. mode = args.mode,
  2249. modes = [],
  2250. prefilter = function (next) {
  2251. var el = $(this),
  2252. normalizedMode = $.effects.mode(el, mode) || defaultMode;
  2253. // Sentinel for duck-punching the :animated psuedo-selector
  2254. el.data(dataSpaceAnimated, true);
  2255. // Save effect mode for later use,
  2256. // we can't just call $.effects.mode again later,
  2257. // as the .show() below destroys the initial state
  2258. modes.push(normalizedMode);
  2259. // See $.uiBackCompat inside of run() for removal of defaultMode in 1.13
  2260. if (defaultMode && (normalizedMode === "show" ||
  2261. (normalizedMode === defaultMode && normalizedMode === "hide"))) {
  2262. el.show();
  2263. }
  2264. if (!defaultMode || normalizedMode !== "none") {
  2265. $.effects.saveStyle(el);
  2266. }
  2267. if ($.isFunction(next)) {
  2268. next();
  2269. }
  2270. };
  2271. if ($.fx.off || !effectMethod) {
  2272. // Delegate to the original method (e.g., .show()) if possible
  2273. if (mode) {
  2274. return this[mode](args.duration, complete);
  2275. } else {
  2276. return this.each(function () {
  2277. if (complete) {
  2278. complete.call(this);
  2279. }
  2280. });
  2281. }
  2282. }
  2283. function run(next) {
  2284. var elem = $(this);
  2285. function cleanup() {
  2286. elem.removeData(dataSpaceAnimated);
  2287. $.effects.cleanUp(elem);
  2288. if (args.mode === "hide") {
  2289. elem.hide();
  2290. }
  2291. done();
  2292. }
  2293. function done() {
  2294. if ($.isFunction(complete)) {
  2295. complete.call(elem[0]);
  2296. }
  2297. if ($.isFunction(next)) {
  2298. next();
  2299. }
  2300. }
  2301. // Override mode option on a per element basis,
  2302. // as toggle can be either show or hide depending on element state
  2303. args.mode = modes.shift();
  2304. if ($.uiBackCompat !== false && !defaultMode) {
  2305. if (elem.is(":hidden") ? mode === "hide" : mode === "show") {
  2306. // Call the core method to track "olddisplay" properly
  2307. elem[mode]();
  2308. done();
  2309. } else {
  2310. effectMethod.call(elem[0], args, done);
  2311. }
  2312. } else {
  2313. if (args.mode === "none") {
  2314. // Call the core method to track "olddisplay" properly
  2315. elem[mode]();
  2316. done();
  2317. } else {
  2318. effectMethod.call(elem[0], args, cleanup);
  2319. }
  2320. }
  2321. }
  2322. // Run prefilter on all elements first to ensure that
  2323. // any showing or hiding happens before placeholder creation,
  2324. // which ensures that any layout changes are correctly captured.
  2325. return queue === false ?
  2326. this.each(prefilter).each(run) :
  2327. this.queue(queueName, prefilter).queue(queueName, run);
  2328. },
  2329. show: (function (orig) {
  2330. return function (option) {
  2331. if (standardAnimationOption(option)) {
  2332. return orig.apply(this, arguments);
  2333. } else {
  2334. var args = _normalizeArguments.apply(this, arguments);
  2335. args.mode = "show";
  2336. return this.effect.call(this, args);
  2337. }
  2338. };
  2339. })($.fn.show),
  2340. hide: (function (orig) {
  2341. return function (option) {
  2342. if (standardAnimationOption(option)) {
  2343. return orig.apply(this, arguments);
  2344. } else {
  2345. var args = _normalizeArguments.apply(this, arguments);
  2346. args.mode = "hide";
  2347. return this.effect.call(this, args);
  2348. }
  2349. };
  2350. })($.fn.hide),
  2351. toggle: (function (orig) {
  2352. return function (option) {
  2353. if (standardAnimationOption(option) || typeof option === "boolean") {
  2354. return orig.apply(this, arguments);
  2355. } else {
  2356. var args = _normalizeArguments.apply(this, arguments);
  2357. args.mode = "toggle";
  2358. return this.effect.call(this, args);
  2359. }
  2360. };
  2361. })($.fn.toggle),
  2362. cssUnit: function (key) {
  2363. var style = this.css(key),
  2364. val = [];
  2365. $.each(["em", "px", "%", "pt"], function (i, unit) {
  2366. if (style.indexOf(unit) > 0) {
  2367. val = [parseFloat(style), unit];
  2368. }
  2369. });
  2370. return val;
  2371. },
  2372. cssClip: function (clipObj) {
  2373. if (clipObj) {
  2374. return this.css("clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " +
  2375. clipObj.bottom + "px " + clipObj.left + "px)");
  2376. }
  2377. return parseClip(this.css("clip"), this);
  2378. },
  2379. transfer: function (options, done) {
  2380. var element = $(this),
  2381. target = $(options.to),
  2382. targetFixed = target.css("position") === "fixed",
  2383. body = $("body"),
  2384. fixTop = targetFixed ? body.scrollTop() : 0,
  2385. fixLeft = targetFixed ? body.scrollLeft() : 0,
  2386. endPosition = target.offset(),
  2387. animation = {
  2388. top: endPosition.top - fixTop,
  2389. left: endPosition.left - fixLeft,
  2390. height: target.innerHeight(),
  2391. width: target.innerWidth()
  2392. },
  2393. startPosition = element.offset(),
  2394. transfer = $("<div class='ui-effects-transfer'></div>")
  2395. .appendTo("body")
  2396. .addClass(options.className)
  2397. .css({
  2398. top: startPosition.top - fixTop,
  2399. left: startPosition.left - fixLeft,
  2400. height: element.innerHeight(),
  2401. width: element.innerWidth(),
  2402. position: targetFixed ? "fixed" : "absolute"
  2403. })
  2404. .animate(animation, options.duration, options.easing, function () {
  2405. transfer.remove();
  2406. if ($.isFunction(done)) {
  2407. done();
  2408. }
  2409. });
  2410. }
  2411. });
  2412. function parseClip(str, element) {
  2413. var outerWidth = element.outerWidth(),
  2414. outerHeight = element.outerHeight(),
  2415. 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)\)$/,
  2416. values = clipRegex.exec(str) || ["", 0, outerWidth, outerHeight, 0];
  2417. return {
  2418. top: parseFloat(values[1]) || 0,
  2419. right: values[2] === "auto" ? outerWidth : parseFloat(values[2]),
  2420. bottom: values[3] === "auto" ? outerHeight : parseFloat(values[3]),
  2421. left: parseFloat(values[4]) || 0
  2422. };
  2423. }
  2424. $.fx.step.clip = function (fx) {
  2425. if (!fx.clipInit) {
  2426. fx.start = $(fx.elem).cssClip();
  2427. if (typeof fx.end === "string") {
  2428. fx.end = parseClip(fx.end, fx.elem);
  2429. }
  2430. fx.clipInit = true;
  2431. }
  2432. $(fx.elem).cssClip({
  2433. top: fx.pos * (fx.end.top - fx.start.top) + fx.start.top,
  2434. right: fx.pos * (fx.end.right - fx.start.right) + fx.start.right,
  2435. bottom: fx.pos * (fx.end.bottom - fx.start.bottom) + fx.start.bottom,
  2436. left: fx.pos * (fx.end.left - fx.start.left) + fx.start.left
  2437. });
  2438. };
  2439. })();
  2440. /******************************************************************************/
  2441. /*********************************** EASING ***********************************/
  2442. /******************************************************************************/
  2443. (function () {
  2444. // Based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
  2445. var baseEasings = {};
  2446. $.each(["Quad", "Cubic", "Quart", "Quint", "Expo"], function (i, name) {
  2447. baseEasings[name] = function (p) {
  2448. return Math.pow(p, i + 2);
  2449. };
  2450. });
  2451. $.extend(baseEasings, {
  2452. Sine: function (p) {
  2453. return 1 - Math.cos(p * Math.PI / 2);
  2454. },
  2455. Circ: function (p) {
  2456. return 1 - Math.sqrt(1 - p * p);
  2457. },
  2458. Elastic: function (p) {
  2459. return p === 0 || p === 1 ? p :
  2460. -Math.pow(2, 8 * (p - 1)) * Math.sin(((p - 1) * 80 - 7.5) * Math.PI / 15);
  2461. },
  2462. Back: function (p) {
  2463. return p * p * (3 * p - 2);
  2464. },
  2465. Bounce: function (p) {
  2466. var pow2,
  2467. bounce = 4;
  2468. while (p < ((pow2 = Math.pow(2, --bounce)) - 1) / 11) {
  2469. }
  2470. return 1 / Math.pow(4, 3 - bounce) - 7.5625 * Math.pow((pow2 * 3 - 2) / 22 - p, 2);
  2471. }
  2472. });
  2473. $.each(baseEasings, function (name, easeIn) {
  2474. $.easing["easeIn" + name] = easeIn;
  2475. $.easing["easeOut" + name] = function (p) {
  2476. return 1 - easeIn(1 - p);
  2477. };
  2478. $.easing["easeInOut" + name] = function (p) {
  2479. return p < 0.5 ?
  2480. easeIn(p * 2) / 2 :
  2481. 1 - easeIn(p * -2 + 2) / 2;
  2482. };
  2483. });
  2484. })();
  2485. var effect = $.effects;
  2486. /*!
  2487. * jQuery UI Effects Blind 1.12.1
  2488. * http://jqueryui.com
  2489. *
  2490. * Copyright jQuery Foundation and other contributors
  2491. * Released under the MIT license.
  2492. * http://jquery.org/license
  2493. */
  2494. //>>label: Blind Effect
  2495. //>>group: Effects
  2496. //>>description: Blinds the element.
  2497. //>>docs: http://api.jqueryui.com/blind-effect/
  2498. //>>demos: http://jqueryui.com/effect/
  2499. var effectsEffectBlind = $.effects.define("blind", "hide", function (options, done) {
  2500. var map = {
  2501. up: ["bottom", "top"],
  2502. vertical: ["bottom", "top"],
  2503. down: ["top", "bottom"],
  2504. left: ["right", "left"],
  2505. horizontal: ["right", "left"],
  2506. right: ["left", "right"]
  2507. },
  2508. element = $(this),
  2509. direction = options.direction || "up",
  2510. start = element.cssClip(),
  2511. animate = {clip: $.extend({}, start)},
  2512. placeholder = $.effects.createPlaceholder(element);
  2513. animate.clip[map[direction][0]] = animate.clip[map[direction][1]];
  2514. if (options.mode === "show") {
  2515. element.cssClip(animate.clip);
  2516. if (placeholder) {
  2517. placeholder.css($.effects.clipToBox(animate));
  2518. }
  2519. animate.clip = start;
  2520. }
  2521. if (placeholder) {
  2522. placeholder.animate($.effects.clipToBox(animate), options.duration, options.easing);
  2523. }
  2524. element.animate(animate, {
  2525. queue: false,
  2526. duration: options.duration,
  2527. easing: options.easing,
  2528. complete: done
  2529. });
  2530. });
  2531. /*!
  2532. * jQuery UI Effects Bounce 1.12.1
  2533. * http://jqueryui.com
  2534. *
  2535. * Copyright jQuery Foundation and other contributors
  2536. * Released under the MIT license.
  2537. * http://jquery.org/license
  2538. */
  2539. //>>label: Bounce Effect
  2540. //>>group: Effects
  2541. //>>description: Bounces an element horizontally or vertically n times.
  2542. //>>docs: http://api.jqueryui.com/bounce-effect/
  2543. //>>demos: http://jqueryui.com/effect/
  2544. var effectsEffectBounce = $.effects.define("bounce", function (options, done) {
  2545. var upAnim, downAnim, refValue,
  2546. element = $(this),
  2547. // Defaults:
  2548. mode = options.mode,
  2549. hide = mode === "hide",
  2550. show = mode === "show",
  2551. direction = options.direction || "up",
  2552. distance = options.distance,
  2553. times = options.times || 5,
  2554. // Number of internal animations
  2555. anims = times * 2 + (show || hide ? 1 : 0),
  2556. speed = options.duration / anims,
  2557. easing = options.easing,
  2558. // Utility:
  2559. ref = (direction === "up" || direction === "down") ? "top" : "left",
  2560. motion = (direction === "up" || direction === "left"),
  2561. i = 0,
  2562. queuelen = element.queue().length;
  2563. $.effects.createPlaceholder(element);
  2564. refValue = element.css(ref);
  2565. // Default distance for the BIGGEST bounce is the outer Distance / 3
  2566. if (!distance) {
  2567. distance = element[ref === "top" ? "outerHeight" : "outerWidth"]() / 3;
  2568. }
  2569. if (show) {
  2570. downAnim = {opacity: 1};
  2571. downAnim[ref] = refValue;
  2572. // If we are showing, force opacity 0 and set the initial position
  2573. // then do the "first" animation
  2574. element
  2575. .css("opacity", 0)
  2576. .css(ref, motion ? -distance * 2 : distance * 2)
  2577. .animate(downAnim, speed, easing);
  2578. }
  2579. // Start at the smallest distance if we are hiding
  2580. if (hide) {
  2581. distance = distance / Math.pow(2, times - 1);
  2582. }
  2583. downAnim = {};
  2584. downAnim[ref] = refValue;
  2585. // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
  2586. for (; i < times; i++) {
  2587. upAnim = {};
  2588. upAnim[ref] = (motion ? "-=" : "+=") + distance;
  2589. element
  2590. .animate(upAnim, speed, easing)
  2591. .animate(downAnim, speed, easing);
  2592. distance = hide ? distance * 2 : distance / 2;
  2593. }
  2594. // Last Bounce when Hiding
  2595. if (hide) {
  2596. upAnim = {opacity: 0};
  2597. upAnim[ref] = (motion ? "-=" : "+=") + distance;
  2598. element.animate(upAnim, speed, easing);
  2599. }
  2600. element.queue(done);
  2601. $.effects.unshift(element, queuelen, anims + 1);
  2602. });
  2603. /*!
  2604. * jQuery UI Effects Clip 1.12.1
  2605. * http://jqueryui.com
  2606. *
  2607. * Copyright jQuery Foundation and other contributors
  2608. * Released under the MIT license.
  2609. * http://jquery.org/license
  2610. */
  2611. //>>label: Clip Effect
  2612. //>>group: Effects
  2613. //>>description: Clips the element on and off like an old TV.
  2614. //>>docs: http://api.jqueryui.com/clip-effect/
  2615. //>>demos: http://jqueryui.com/effect/
  2616. var effectsEffectClip = $.effects.define("clip", "hide", function (options, done) {
  2617. var start,
  2618. animate = {},
  2619. element = $(this),
  2620. direction = options.direction || "vertical",
  2621. both = direction === "both",
  2622. horizontal = both || direction === "horizontal",
  2623. vertical = both || direction === "vertical";
  2624. start = element.cssClip();
  2625. animate.clip = {
  2626. top: vertical ? (start.bottom - start.top) / 2 : start.top,
  2627. right: horizontal ? (start.right - start.left) / 2 : start.right,
  2628. bottom: vertical ? (start.bottom - start.top) / 2 : start.bottom,
  2629. left: horizontal ? (start.right - start.left) / 2 : start.left
  2630. };
  2631. $.effects.createPlaceholder(element);
  2632. if (options.mode === "show") {
  2633. element.cssClip(animate.clip);
  2634. animate.clip = start;
  2635. }
  2636. element.animate(animate, {
  2637. queue: false,
  2638. duration: options.duration,
  2639. easing: options.easing,
  2640. complete: done
  2641. });
  2642. });
  2643. /*!
  2644. * jQuery UI Effects Drop 1.12.1
  2645. * http://jqueryui.com
  2646. *
  2647. * Copyright jQuery Foundation and other contributors
  2648. * Released under the MIT license.
  2649. * http://jquery.org/license
  2650. */
  2651. //>>label: Drop Effect
  2652. //>>group: Effects
  2653. //>>description: Moves an element in one direction and hides it at the same time.
  2654. //>>docs: http://api.jqueryui.com/drop-effect/
  2655. //>>demos: http://jqueryui.com/effect/
  2656. var effectsEffectDrop = $.effects.define("drop", "hide", function (options, done) {
  2657. var distance,
  2658. element = $(this),
  2659. mode = options.mode,
  2660. show = mode === "show",
  2661. direction = options.direction || "left",
  2662. ref = (direction === "up" || direction === "down") ? "top" : "left",
  2663. motion = (direction === "up" || direction === "left") ? "-=" : "+=",
  2664. oppositeMotion = (motion === "+=") ? "-=" : "+=",
  2665. animation = {
  2666. opacity: 0
  2667. };
  2668. $.effects.createPlaceholder(element);
  2669. distance = options.distance ||
  2670. element[ref === "top" ? "outerHeight" : "outerWidth"](true) / 2;
  2671. animation[ref] = motion + distance;
  2672. if (show) {
  2673. element.css(animation);
  2674. animation[ref] = oppositeMotion + distance;
  2675. animation.opacity = 1;
  2676. }
  2677. // Animate
  2678. element.animate(animation, {
  2679. queue: false,
  2680. duration: options.duration,
  2681. easing: options.easing,
  2682. complete: done
  2683. });
  2684. });
  2685. /*!
  2686. * jQuery UI Effects Explode 1.12.1
  2687. * http://jqueryui.com
  2688. *
  2689. * Copyright jQuery Foundation and other contributors
  2690. * Released under the MIT license.
  2691. * http://jquery.org/license
  2692. */
  2693. //>>label: Explode Effect
  2694. //>>group: Effects
  2695. // jscs:disable maximumLineLength
  2696. //>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness.
  2697. // jscs:enable maximumLineLength
  2698. //>>docs: http://api.jqueryui.com/explode-effect/
  2699. //>>demos: http://jqueryui.com/effect/
  2700. var effectsEffectExplode = $.effects.define("explode", "hide", function (options, done) {
  2701. var i, j, left, top, mx, my,
  2702. rows = options.pieces ? Math.round(Math.sqrt(options.pieces)) : 3,
  2703. cells = rows,
  2704. element = $(this),
  2705. mode = options.mode,
  2706. show = mode === "show",
  2707. // Show and then visibility:hidden the element before calculating offset
  2708. offset = element.show().css("visibility", "hidden").offset(),
  2709. // Width and height of a piece
  2710. width = Math.ceil(element.outerWidth() / cells),
  2711. height = Math.ceil(element.outerHeight() / rows),
  2712. pieces = [];
  2713. // Children animate complete:
  2714. function childComplete() {
  2715. pieces.push(this);
  2716. if (pieces.length === rows * cells) {
  2717. animComplete();
  2718. }
  2719. }
  2720. // Clone the element for each row and cell.
  2721. for (i = 0; i < rows; i++) { // ===>
  2722. top = offset.top + i * height;
  2723. my = i - (rows - 1) / 2;
  2724. for (j = 0; j < cells; j++) { // |||
  2725. left = offset.left + j * width;
  2726. mx = j - (cells - 1) / 2;
  2727. // Create a clone of the now hidden main element that will be absolute positioned
  2728. // within a wrapper div off the -left and -top equal to size of our pieces
  2729. element
  2730. .clone()
  2731. .appendTo("body")
  2732. .wrap("<div></div>")
  2733. .css({
  2734. position: "absolute",
  2735. visibility: "visible",
  2736. left: -j * width,
  2737. top: -i * height
  2738. })
  2739. // Select the wrapper - make it overflow: hidden and absolute positioned based on
  2740. // where the original was located +left and +top equal to the size of pieces
  2741. .parent()
  2742. .addClass("ui-effects-explode")
  2743. .css({
  2744. position: "absolute",
  2745. overflow: "hidden",
  2746. width: width,
  2747. height: height,
  2748. left: left + (show ? mx * width : 0),
  2749. top: top + (show ? my * height : 0),
  2750. opacity: show ? 0 : 1
  2751. })
  2752. .animate({
  2753. left: left + (show ? 0 : mx * width),
  2754. top: top + (show ? 0 : my * height),
  2755. opacity: show ? 1 : 0
  2756. }, options.duration || 500, options.easing, childComplete);
  2757. }
  2758. }
  2759. function animComplete() {
  2760. element.css({
  2761. visibility: "visible"
  2762. });
  2763. $(pieces).remove();
  2764. done();
  2765. }
  2766. });
  2767. /*!
  2768. * jQuery UI Effects Fade 1.12.1
  2769. * http://jqueryui.com
  2770. *
  2771. * Copyright jQuery Foundation and other contributors
  2772. * Released under the MIT license.
  2773. * http://jquery.org/license
  2774. */
  2775. //>>label: Fade Effect
  2776. //>>group: Effects
  2777. //>>description: Fades the element.
  2778. //>>docs: http://api.jqueryui.com/fade-effect/
  2779. //>>demos: http://jqueryui.com/effect/
  2780. var effectsEffectFade = $.effects.define("fade", "toggle", function (options, done) {
  2781. var show = options.mode === "show";
  2782. $(this)
  2783. .css("opacity", show ? 0 : 1)
  2784. .animate({
  2785. opacity: show ? 1 : 0
  2786. }, {
  2787. queue: false,
  2788. duration: options.duration,
  2789. easing: options.easing,
  2790. complete: done
  2791. });
  2792. });
  2793. /*!
  2794. * jQuery UI Effects Fold 1.12.1
  2795. * http://jqueryui.com
  2796. *
  2797. * Copyright jQuery Foundation and other contributors
  2798. * Released under the MIT license.
  2799. * http://jquery.org/license
  2800. */
  2801. //>>label: Fold Effect
  2802. //>>group: Effects
  2803. //>>description: Folds an element first horizontally and then vertically.
  2804. //>>docs: http://api.jqueryui.com/fold-effect/
  2805. //>>demos: http://jqueryui.com/effect/
  2806. var effectsEffectFold = $.effects.define("fold", "hide", function (options, done) {
  2807. // Create element
  2808. var element = $(this),
  2809. mode = options.mode,
  2810. show = mode === "show",
  2811. hide = mode === "hide",
  2812. size = options.size || 15,
  2813. percent = /([0-9]+)%/.exec(size),
  2814. horizFirst = !!options.horizFirst,
  2815. ref = horizFirst ? ["right", "bottom"] : ["bottom", "right"],
  2816. duration = options.duration / 2,
  2817. placeholder = $.effects.createPlaceholder(element),
  2818. start = element.cssClip(),
  2819. animation1 = {clip: $.extend({}, start)},
  2820. animation2 = {clip: $.extend({}, start)},
  2821. distance = [start[ref[0]], start[ref[1]]],
  2822. queuelen = element.queue().length;
  2823. if (percent) {
  2824. size = parseInt(percent[1], 10) / 100 * distance[hide ? 0 : 1];
  2825. }
  2826. animation1.clip[ref[0]] = size;
  2827. animation2.clip[ref[0]] = size;
  2828. animation2.clip[ref[1]] = 0;
  2829. if (show) {
  2830. element.cssClip(animation2.clip);
  2831. if (placeholder) {
  2832. placeholder.css($.effects.clipToBox(animation2));
  2833. }
  2834. animation2.clip = start;
  2835. }
  2836. // Animate
  2837. element
  2838. .queue(function (next) {
  2839. if (placeholder) {
  2840. placeholder
  2841. .animate($.effects.clipToBox(animation1), duration, options.easing)
  2842. .animate($.effects.clipToBox(animation2), duration, options.easing);
  2843. }
  2844. next();
  2845. })
  2846. .animate(animation1, duration, options.easing)
  2847. .animate(animation2, duration, options.easing)
  2848. .queue(done);
  2849. $.effects.unshift(element, queuelen, 4);
  2850. });
  2851. /*!
  2852. * jQuery UI Effects Highlight 1.12.1
  2853. * http://jqueryui.com
  2854. *
  2855. * Copyright jQuery Foundation and other contributors
  2856. * Released under the MIT license.
  2857. * http://jquery.org/license
  2858. */
  2859. //>>label: Highlight Effect
  2860. //>>group: Effects
  2861. //>>description: Highlights the background of an element in a defined color for a custom duration.
  2862. //>>docs: http://api.jqueryui.com/highlight-effect/
  2863. //>>demos: http://jqueryui.com/effect/
  2864. var effectsEffectHighlight = $.effects.define("highlight", "show", function (options, done) {
  2865. var element = $(this),
  2866. animation = {
  2867. backgroundColor: element.css("backgroundColor")
  2868. };
  2869. if (options.mode === "hide") {
  2870. animation.opacity = 0;
  2871. }
  2872. $.effects.saveStyle(element);
  2873. element
  2874. .css({
  2875. backgroundImage: "none",
  2876. backgroundColor: options.color || "#ffff99"
  2877. })
  2878. .animate(animation, {
  2879. queue: false,
  2880. duration: options.duration,
  2881. easing: options.easing,
  2882. complete: done
  2883. });
  2884. });
  2885. /*!
  2886. * jQuery UI Effects Size 1.12.1
  2887. * http://jqueryui.com
  2888. *
  2889. * Copyright jQuery Foundation and other contributors
  2890. * Released under the MIT license.
  2891. * http://jquery.org/license
  2892. */
  2893. //>>label: Size Effect
  2894. //>>group: Effects
  2895. //>>description: Resize an element to a specified width and height.
  2896. //>>docs: http://api.jqueryui.com/size-effect/
  2897. //>>demos: http://jqueryui.com/effect/
  2898. var effectsEffectSize = $.effects.define("size", function (options, done) {
  2899. // Create element
  2900. var baseline, factor, temp,
  2901. element = $(this),
  2902. // Copy for children
  2903. cProps = ["fontSize"],
  2904. vProps = ["borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"],
  2905. hProps = ["borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight"],
  2906. // Set options
  2907. mode = options.mode,
  2908. restore = mode !== "effect",
  2909. scale = options.scale || "both",
  2910. origin = options.origin || ["middle", "center"],
  2911. position = element.css("position"),
  2912. pos = element.position(),
  2913. original = $.effects.scaledDimensions(element),
  2914. from = options.from || original,
  2915. to = options.to || $.effects.scaledDimensions(element, 0);
  2916. $.effects.createPlaceholder(element);
  2917. if (mode === "show") {
  2918. temp = from;
  2919. from = to;
  2920. to = temp;
  2921. }
  2922. // Set scaling factor
  2923. factor = {
  2924. from: {
  2925. y: from.height / original.height,
  2926. x: from.width / original.width
  2927. },
  2928. to: {
  2929. y: to.height / original.height,
  2930. x: to.width / original.width
  2931. }
  2932. };
  2933. // Scale the css box
  2934. if (scale === "box" || scale === "both") {
  2935. // Vertical props scaling
  2936. if (factor.from.y !== factor.to.y) {
  2937. from = $.effects.setTransition(element, vProps, factor.from.y, from);
  2938. to = $.effects.setTransition(element, vProps, factor.to.y, to);
  2939. }
  2940. // Horizontal props scaling
  2941. if (factor.from.x !== factor.to.x) {
  2942. from = $.effects.setTransition(element, hProps, factor.from.x, from);
  2943. to = $.effects.setTransition(element, hProps, factor.to.x, to);
  2944. }
  2945. }
  2946. // Scale the content
  2947. if (scale === "content" || scale === "both") {
  2948. // Vertical props scaling
  2949. if (factor.from.y !== factor.to.y) {
  2950. from = $.effects.setTransition(element, cProps, factor.from.y, from);
  2951. to = $.effects.setTransition(element, cProps, factor.to.y, to);
  2952. }
  2953. }
  2954. // Adjust the position properties based on the provided origin points
  2955. if (origin) {
  2956. baseline = $.effects.getBaseline(origin, original);
  2957. from.top = (original.outerHeight - from.outerHeight) * baseline.y + pos.top;
  2958. from.left = (original.outerWidth - from.outerWidth) * baseline.x + pos.left;
  2959. to.top = (original.outerHeight - to.outerHeight) * baseline.y + pos.top;
  2960. to.left = (original.outerWidth - to.outerWidth) * baseline.x + pos.left;
  2961. }
  2962. element.css(from);
  2963. // Animate the children if desired
  2964. if (scale === "content" || scale === "both") {
  2965. vProps = vProps.concat(["marginTop", "marginBottom"]).concat(cProps);
  2966. hProps = hProps.concat(["marginLeft", "marginRight"]);
  2967. // Only animate children with width attributes specified
  2968. // TODO: is this right? should we include anything with css width specified as well
  2969. element.find("*[width]").each(function () {
  2970. var child = $(this),
  2971. childOriginal = $.effects.scaledDimensions(child),
  2972. childFrom = {
  2973. height: childOriginal.height * factor.from.y,
  2974. width: childOriginal.width * factor.from.x,
  2975. outerHeight: childOriginal.outerHeight * factor.from.y,
  2976. outerWidth: childOriginal.outerWidth * factor.from.x
  2977. },
  2978. childTo = {
  2979. height: childOriginal.height * factor.to.y,
  2980. width: childOriginal.width * factor.to.x,
  2981. outerHeight: childOriginal.height * factor.to.y,
  2982. outerWidth: childOriginal.width * factor.to.x
  2983. };
  2984. // Vertical props scaling
  2985. if (factor.from.y !== factor.to.y) {
  2986. childFrom = $.effects.setTransition(child, vProps, factor.from.y, childFrom);
  2987. childTo = $.effects.setTransition(child, vProps, factor.to.y, childTo);
  2988. }
  2989. // Horizontal props scaling
  2990. if (factor.from.x !== factor.to.x) {
  2991. childFrom = $.effects.setTransition(child, hProps, factor.from.x, childFrom);
  2992. childTo = $.effects.setTransition(child, hProps, factor.to.x, childTo);
  2993. }
  2994. if (restore) {
  2995. $.effects.saveStyle(child);
  2996. }
  2997. // Animate children
  2998. child.css(childFrom);
  2999. child.animate(childTo, options.duration, options.easing, function () {
  3000. // Restore children
  3001. if (restore) {
  3002. $.effects.restoreStyle(child);
  3003. }
  3004. });
  3005. });
  3006. }
  3007. // Animate
  3008. element.animate(to, {
  3009. queue: false,
  3010. duration: options.duration,
  3011. easing: options.easing,
  3012. complete: function () {
  3013. var offset = element.offset();
  3014. if (to.opacity === 0) {
  3015. element.css("opacity", from.opacity);
  3016. }
  3017. if (!restore) {
  3018. element
  3019. .css("position", position === "static" ? "relative" : position)
  3020. .offset(offset);
  3021. // Need to save style here so that automatic style restoration
  3022. // doesn't restore to the original styles from before the animation.
  3023. $.effects.saveStyle(element);
  3024. }
  3025. done();
  3026. }
  3027. });
  3028. });
  3029. /*!
  3030. * jQuery UI Effects Scale 1.12.1
  3031. * http://jqueryui.com
  3032. *
  3033. * Copyright jQuery Foundation and other contributors
  3034. * Released under the MIT license.
  3035. * http://jquery.org/license
  3036. */
  3037. //>>label: Scale Effect
  3038. //>>group: Effects
  3039. //>>description: Grows or shrinks an element and its content.
  3040. //>>docs: http://api.jqueryui.com/scale-effect/
  3041. //>>demos: http://jqueryui.com/effect/
  3042. var effectsEffectScale = $.effects.define("scale", function (options, done) {
  3043. // Create element
  3044. var el = $(this),
  3045. mode = options.mode,
  3046. percent = parseInt(options.percent, 10) ||
  3047. (parseInt(options.percent, 10) === 0 ? 0 : (mode !== "effect" ? 0 : 100)),
  3048. newOptions = $.extend(true, {
  3049. from: $.effects.scaledDimensions(el),
  3050. to: $.effects.scaledDimensions(el, percent, options.direction || "both"),
  3051. origin: options.origin || ["middle", "center"]
  3052. }, options);
  3053. // Fade option to support puff
  3054. if (options.fade) {
  3055. newOptions.from.opacity = 1;
  3056. newOptions.to.opacity = 0;
  3057. }
  3058. $.effects.effect.size.call(this, newOptions, done);
  3059. });
  3060. /*!
  3061. * jQuery UI Effects Puff 1.12.1
  3062. * http://jqueryui.com
  3063. *
  3064. * Copyright jQuery Foundation and other contributors
  3065. * Released under the MIT license.
  3066. * http://jquery.org/license
  3067. */
  3068. //>>label: Puff Effect
  3069. //>>group: Effects
  3070. //>>description: Creates a puff effect by scaling the element up and hiding it at the same time.
  3071. //>>docs: http://api.jqueryui.com/puff-effect/
  3072. //>>demos: http://jqueryui.com/effect/
  3073. var effectsEffectPuff = $.effects.define("puff", "hide", function (options, done) {
  3074. var newOptions = $.extend(true, {}, options, {
  3075. fade: true,
  3076. percent: parseInt(options.percent, 10) || 150
  3077. });
  3078. $.effects.effect.scale.call(this, newOptions, done);
  3079. });
  3080. /*!
  3081. * jQuery UI Effects Pulsate 1.12.1
  3082. * http://jqueryui.com
  3083. *
  3084. * Copyright jQuery Foundation and other contributors
  3085. * Released under the MIT license.
  3086. * http://jquery.org/license
  3087. */
  3088. //>>label: Pulsate Effect
  3089. //>>group: Effects
  3090. //>>description: Pulsates an element n times by changing the opacity to zero and back.
  3091. //>>docs: http://api.jqueryui.com/pulsate-effect/
  3092. //>>demos: http://jqueryui.com/effect/
  3093. var effectsEffectPulsate = $.effects.define("pulsate", "show", function (options, done) {
  3094. var element = $(this),
  3095. mode = options.mode,
  3096. show = mode === "show",
  3097. hide = mode === "hide",
  3098. showhide = show || hide,
  3099. // Showing or hiding leaves off the "last" animation
  3100. anims = ((options.times || 5) * 2) + (showhide ? 1 : 0),
  3101. duration = options.duration / anims,
  3102. animateTo = 0,
  3103. i = 1,
  3104. queuelen = element.queue().length;
  3105. if (show || !element.is(":visible")) {
  3106. element.css("opacity", 0).show();
  3107. animateTo = 1;
  3108. }
  3109. // Anims - 1 opacity "toggles"
  3110. for (; i < anims; i++) {
  3111. element.animate({opacity: animateTo}, duration, options.easing);
  3112. animateTo = 1 - animateTo;
  3113. }
  3114. element.animate({opacity: animateTo}, duration, options.easing);
  3115. element.queue(done);
  3116. $.effects.unshift(element, queuelen, anims + 1);
  3117. });
  3118. /*!
  3119. * jQuery UI Effects Shake 1.12.1
  3120. * http://jqueryui.com
  3121. *
  3122. * Copyright jQuery Foundation and other contributors
  3123. * Released under the MIT license.
  3124. * http://jquery.org/license
  3125. */
  3126. //>>label: Shake Effect
  3127. //>>group: Effects
  3128. //>>description: Shakes an element horizontally or vertically n times.
  3129. //>>docs: http://api.jqueryui.com/shake-effect/
  3130. //>>demos: http://jqueryui.com/effect/
  3131. var effectsEffectShake = $.effects.define("shake", function (options, done) {
  3132. var i = 1,
  3133. element = $(this),
  3134. direction = options.direction || "left",
  3135. distance = options.distance || 20,
  3136. times = options.times || 3,
  3137. anims = times * 2 + 1,
  3138. speed = Math.round(options.duration / anims),
  3139. ref = (direction === "up" || direction === "down") ? "top" : "left",
  3140. positiveMotion = (direction === "up" || direction === "left"),
  3141. animation = {},
  3142. animation1 = {},
  3143. animation2 = {},
  3144. queuelen = element.queue().length;
  3145. $.effects.createPlaceholder(element);
  3146. // Animation
  3147. animation[ref] = (positiveMotion ? "-=" : "+=") + distance;
  3148. animation1[ref] = (positiveMotion ? "+=" : "-=") + distance * 2;
  3149. animation2[ref] = (positiveMotion ? "-=" : "+=") + distance * 2;
  3150. // Animate
  3151. element.animate(animation, speed, options.easing);
  3152. // Shakes
  3153. for (; i < times; i++) {
  3154. element
  3155. .animate(animation1, speed, options.easing)
  3156. .animate(animation2, speed, options.easing);
  3157. }
  3158. element
  3159. .animate(animation1, speed, options.easing)
  3160. .animate(animation, speed / 2, options.easing)
  3161. .queue(done);
  3162. $.effects.unshift(element, queuelen, anims + 1);
  3163. });
  3164. /*!
  3165. * jQuery UI Effects Slide 1.12.1
  3166. * http://jqueryui.com
  3167. *
  3168. * Copyright jQuery Foundation and other contributors
  3169. * Released under the MIT license.
  3170. * http://jquery.org/license
  3171. */
  3172. //>>label: Slide Effect
  3173. //>>group: Effects
  3174. //>>description: Slides an element in and out of the viewport.
  3175. //>>docs: http://api.jqueryui.com/slide-effect/
  3176. //>>demos: http://jqueryui.com/effect/
  3177. var effectsEffectSlide = $.effects.define("slide", "show", function (options, done) {
  3178. var startClip, startRef,
  3179. element = $(this),
  3180. map = {
  3181. up: ["bottom", "top"],
  3182. down: ["top", "bottom"],
  3183. left: ["right", "left"],
  3184. right: ["left", "right"]
  3185. },
  3186. mode = options.mode,
  3187. direction = options.direction || "left",
  3188. ref = (direction === "up" || direction === "down") ? "top" : "left",
  3189. positiveMotion = (direction === "up" || direction === "left"),
  3190. distance = options.distance ||
  3191. element[ref === "top" ? "outerHeight" : "outerWidth"](true),
  3192. animation = {};
  3193. $.effects.createPlaceholder(element);
  3194. startClip = element.cssClip();
  3195. startRef = element.position()[ref];
  3196. // Define hide animation
  3197. animation[ref] = (positiveMotion ? -1 : 1) * distance + startRef;
  3198. animation.clip = element.cssClip();
  3199. animation.clip[map[direction][1]] = animation.clip[map[direction][0]];
  3200. // Reverse the animation if we're showing
  3201. if (mode === "show") {
  3202. element.cssClip(animation.clip);
  3203. element.css(ref, animation[ref]);
  3204. animation.clip = startClip;
  3205. animation[ref] = startRef;
  3206. }
  3207. // Actually animate
  3208. element.animate(animation, {
  3209. queue: false,
  3210. duration: options.duration,
  3211. easing: options.easing,
  3212. complete: done
  3213. });
  3214. });
  3215. /*!
  3216. * jQuery UI Effects Transfer 1.12.1
  3217. * http://jqueryui.com
  3218. *
  3219. * Copyright jQuery Foundation and other contributors
  3220. * Released under the MIT license.
  3221. * http://jquery.org/license
  3222. */
  3223. //>>label: Transfer Effect
  3224. //>>group: Effects
  3225. //>>description: Displays a transfer effect from one element to another.
  3226. //>>docs: http://api.jqueryui.com/transfer-effect/
  3227. //>>demos: http://jqueryui.com/effect/
  3228. var effect;
  3229. if ($.uiBackCompat !== false) {
  3230. effect = $.effects.define("transfer", function (options, done) {
  3231. $(this).transfer(options, done);
  3232. });
  3233. }
  3234. var effectsEffectTransfer = effect;
  3235. /*!
  3236. * jQuery UI Focusable 1.12.1
  3237. * http://jqueryui.com
  3238. *
  3239. * Copyright jQuery Foundation and other contributors
  3240. * Released under the MIT license.
  3241. * http://jquery.org/license
  3242. */
  3243. //>>label: :focusable Selector
  3244. //>>group: Core
  3245. //>>description: Selects elements which can be focused.
  3246. //>>docs: http://api.jqueryui.com/focusable-selector/
  3247. // Selectors
  3248. $.ui.focusable = function (element, hasTabindex) {
  3249. var map, mapName, img, focusableIfVisible, fieldset,
  3250. nodeName = element.nodeName.toLowerCase();
  3251. if ("area" === nodeName) {
  3252. map = element.parentNode;
  3253. mapName = map.name;
  3254. if (!element.href || !mapName || map.nodeName.toLowerCase() !== "map") {
  3255. return false;
  3256. }
  3257. img = $("img[usemap='#" + mapName + "']");
  3258. return img.length > 0 && img.is(":visible");
  3259. }
  3260. if (/^(input|select|textarea|button|object)$/.test(nodeName)) {
  3261. focusableIfVisible = !element.disabled;
  3262. if (focusableIfVisible) {
  3263. // Form controls within a disabled fieldset are disabled.
  3264. // However, controls within the fieldset's legend do not get disabled.
  3265. // Since controls generally aren't placed inside legends, we skip
  3266. // this portion of the check.
  3267. fieldset = $(element).closest("fieldset")[0];
  3268. if (fieldset) {
  3269. focusableIfVisible = !fieldset.disabled;
  3270. }
  3271. }
  3272. } else if ("a" === nodeName) {
  3273. focusableIfVisible = element.href || hasTabindex;
  3274. } else {
  3275. focusableIfVisible = hasTabindex;
  3276. }
  3277. return focusableIfVisible && $(element).is(":visible") && visible($(element));
  3278. };
  3279. // Support: IE 8 only
  3280. // IE 8 doesn't resolve inherit to visible/hidden for computed values
  3281. function visible(element) {
  3282. var visibility = element.css("visibility");
  3283. while (visibility === "inherit") {
  3284. element = element.parent();
  3285. visibility = element.css("visibility");
  3286. }
  3287. return visibility !== "hidden";
  3288. }
  3289. $.extend($.expr[":"], {
  3290. focusable: function (element) {
  3291. return $.ui.focusable(element, $.attr(element, "tabindex") != null);
  3292. }
  3293. });
  3294. var focusable = $.ui.focusable;
  3295. // Support: IE8 Only
  3296. // IE8 does not support the form attribute and when it is supplied. It overwrites the form prop
  3297. // with a string, so we need to find the proper form.
  3298. var form = $.fn.form = function () {
  3299. return typeof this[0].form === "string" ? this.closest("form") : $(this[0].form);
  3300. };
  3301. /*!
  3302. * jQuery UI Form Reset Mixin 1.12.1
  3303. * http://jqueryui.com
  3304. *
  3305. * Copyright jQuery Foundation and other contributors
  3306. * Released under the MIT license.
  3307. * http://jquery.org/license
  3308. */
  3309. //>>label: Form Reset Mixin
  3310. //>>group: Core
  3311. //>>description: Refresh input widgets when their form is reset
  3312. //>>docs: http://api.jqueryui.com/form-reset-mixin/
  3313. var formResetMixin = $.ui.formResetMixin = {
  3314. _formResetHandler: function () {
  3315. var form = $(this);
  3316. // Wait for the form reset to actually happen before refreshing
  3317. setTimeout(function () {
  3318. var instances = form.data("ui-form-reset-instances");
  3319. $.each(instances, function () {
  3320. this.refresh();
  3321. });
  3322. });
  3323. },
  3324. _bindFormResetHandler: function () {
  3325. this.form = this.element.form();
  3326. if (!this.form.length) {
  3327. return;
  3328. }
  3329. var instances = this.form.data("ui-form-reset-instances") || [];
  3330. if (!instances.length) {
  3331. // We don't use _on() here because we use a single event handler per form
  3332. this.form.on("reset.ui-form-reset", this._formResetHandler);
  3333. }
  3334. instances.push(this);
  3335. this.form.data("ui-form-reset-instances", instances);
  3336. },
  3337. _unbindFormResetHandler: function () {
  3338. if (!this.form.length) {
  3339. return;
  3340. }
  3341. var instances = this.form.data("ui-form-reset-instances");
  3342. instances.splice($.inArray(this, instances), 1);
  3343. if (instances.length) {
  3344. this.form.data("ui-form-reset-instances", instances);
  3345. } else {
  3346. this.form
  3347. .removeData("ui-form-reset-instances")
  3348. .off("reset.ui-form-reset");
  3349. }
  3350. }
  3351. };
  3352. /*!
  3353. * jQuery UI Support for jQuery core 1.7.x 1.12.1
  3354. * http://jqueryui.com
  3355. *
  3356. * Copyright jQuery Foundation and other contributors
  3357. * Released under the MIT license.
  3358. * http://jquery.org/license
  3359. *
  3360. */
  3361. //>>label: jQuery 1.7 Support
  3362. //>>group: Core
  3363. //>>description: Support version 1.7.x of jQuery core
  3364. // Support: jQuery 1.7 only
  3365. // Not a great way to check versions, but since we only support 1.7+ and only
  3366. // need to detect <1.8, this is a simple check that should suffice. Checking
  3367. // for "1.7." would be a bit safer, but the version string is 1.7, not 1.7.0
  3368. // and we'll never reach 1.70.0 (if we do, we certainly won't be supporting
  3369. // 1.7 anymore). See #11197 for why we're not using feature detection.
  3370. if ($.fn.jquery.substring(0, 3) === "1.7") {
  3371. // Setters for .innerWidth(), .innerHeight(), .outerWidth(), .outerHeight()
  3372. // Unlike jQuery Core 1.8+, these only support numeric values to set the
  3373. // dimensions in pixels
  3374. $.each(["Width", "Height"], function (i, name) {
  3375. var side = name === "Width" ? ["Left", "Right"] : ["Top", "Bottom"],
  3376. type = name.toLowerCase(),
  3377. orig = {
  3378. innerWidth: $.fn.innerWidth,
  3379. innerHeight: $.fn.innerHeight,
  3380. outerWidth: $.fn.outerWidth,
  3381. outerHeight: $.fn.outerHeight
  3382. };
  3383. function reduce(elem, size, border, margin) {
  3384. $.each(side, function () {
  3385. size -= parseFloat($.css(elem, "padding" + this)) || 0;
  3386. if (border) {
  3387. size -= parseFloat($.css(elem, "border" + this + "Width")) || 0;
  3388. }
  3389. if (margin) {
  3390. size -= parseFloat($.css(elem, "margin" + this)) || 0;
  3391. }
  3392. });
  3393. return size;
  3394. }
  3395. $.fn["inner" + name] = function (size) {
  3396. if (size === undefined) {
  3397. return orig["inner" + name].call(this);
  3398. }
  3399. return this.each(function () {
  3400. $(this).css(type, reduce(this, size) + "px");
  3401. });
  3402. };
  3403. $.fn["outer" + name] = function (size, margin) {
  3404. if (typeof size !== "number") {
  3405. return orig["outer" + name].call(this, size);
  3406. }
  3407. return this.each(function () {
  3408. $(this).css(type, reduce(this, size, true, margin) + "px");
  3409. });
  3410. };
  3411. });
  3412. $.fn.addBack = function (selector) {
  3413. return this.add(selector == null ?
  3414. this.prevObject : this.prevObject.filter(selector)
  3415. );
  3416. };
  3417. }
  3418. /*!
  3419. * jQuery UI Keycode 1.12.1
  3420. * http://jqueryui.com
  3421. *
  3422. * Copyright jQuery Foundation and other contributors
  3423. * Released under the MIT license.
  3424. * http://jquery.org/license
  3425. */
  3426. //>>label: Keycode
  3427. //>>group: Core
  3428. //>>description: Provide keycodes as keynames
  3429. //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
  3430. var keycode = $.ui.keyCode = {
  3431. BACKSPACE: 8,
  3432. COMMA: 188,
  3433. DELETE: 46,
  3434. DOWN: 40,
  3435. END: 35,
  3436. ENTER: 13,
  3437. ESCAPE: 27,
  3438. HOME: 36,
  3439. LEFT: 37,
  3440. PAGE_DOWN: 34,
  3441. PAGE_UP: 33,
  3442. PERIOD: 190,
  3443. RIGHT: 39,
  3444. SPACE: 32,
  3445. TAB: 9,
  3446. UP: 38
  3447. };
  3448. // Internal use only
  3449. var escapeSelector = $.ui.escapeSelector = (function () {
  3450. var selectorEscape = /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;
  3451. return function (selector) {
  3452. return selector.replace(selectorEscape, "\\$1");
  3453. };
  3454. })();
  3455. /*!
  3456. * jQuery UI Labels 1.12.1
  3457. * http://jqueryui.com
  3458. *
  3459. * Copyright jQuery Foundation and other contributors
  3460. * Released under the MIT license.
  3461. * http://jquery.org/license
  3462. */
  3463. //>>label: labels
  3464. //>>group: Core
  3465. //>>description: Find all the labels associated with a given input
  3466. //>>docs: http://api.jqueryui.com/labels/
  3467. var labels = $.fn.labels = function () {
  3468. var ancestor, selector, id, labels, ancestors;
  3469. // Check control.labels first
  3470. if (this[0].labels && this[0].labels.length) {
  3471. return this.pushStack(this[0].labels);
  3472. }
  3473. // Support: IE <= 11, FF <= 37, Android <= 2.3 only
  3474. // Above browsers do not support control.labels. Everything below is to support them
  3475. // as well as document fragments. control.labels does not work on document fragments
  3476. labels = this.eq(0).parents("label");
  3477. // Look for the label based on the id
  3478. id = this.attr("id");
  3479. if (id) {
  3480. // We don't search against the document in case the element
  3481. // is disconnected from the DOM
  3482. ancestor = this.eq(0).parents().last();
  3483. // Get a full set of top level ancestors
  3484. ancestors = ancestor.add(ancestor.length ? ancestor.siblings() : this.siblings());
  3485. // Create a selector for the label based on the id
  3486. selector = "label[for='" + $.ui.escapeSelector(id) + "']";
  3487. labels = labels.add(ancestors.find(selector).addBack(selector));
  3488. }
  3489. // Return whatever we have found for labels
  3490. return this.pushStack(labels);
  3491. };
  3492. /*!
  3493. * jQuery UI Scroll Parent 1.12.1
  3494. * http://jqueryui.com
  3495. *
  3496. * Copyright jQuery Foundation and other contributors
  3497. * Released under the MIT license.
  3498. * http://jquery.org/license
  3499. */
  3500. //>>label: scrollParent
  3501. //>>group: Core
  3502. //>>description: Get the closest ancestor element that is scrollable.
  3503. //>>docs: http://api.jqueryui.com/scrollParent/
  3504. var scrollParent = $.fn.scrollParent = function (includeHidden) {
  3505. var position = this.css("position"),
  3506. excludeStaticParent = position === "absolute",
  3507. overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
  3508. scrollParent = this.parents().filter(function () {
  3509. var parent = $(this);
  3510. if (excludeStaticParent && parent.css("position") === "static") {
  3511. return false;
  3512. }
  3513. return overflowRegex.test(parent.css("overflow") + parent.css("overflow-y") +
  3514. parent.css("overflow-x"));
  3515. }).eq(0);
  3516. return position === "fixed" || !scrollParent.length ?
  3517. $(this[0].ownerDocument || document) :
  3518. scrollParent;
  3519. };
  3520. /*!
  3521. * jQuery UI Tabbable 1.12.1
  3522. * http://jqueryui.com
  3523. *
  3524. * Copyright jQuery Foundation and other contributors
  3525. * Released under the MIT license.
  3526. * http://jquery.org/license
  3527. */
  3528. //>>label: :tabbable Selector
  3529. //>>group: Core
  3530. //>>description: Selects elements which can be tabbed to.
  3531. //>>docs: http://api.jqueryui.com/tabbable-selector/
  3532. var tabbable = $.extend($.expr[":"], {
  3533. tabbable: function (element) {
  3534. var tabIndex = $.attr(element, "tabindex"),
  3535. hasTabindex = tabIndex != null;
  3536. return (!hasTabindex || tabIndex >= 0) && $.ui.focusable(element, hasTabindex);
  3537. }
  3538. });
  3539. /*!
  3540. * jQuery UI Unique ID 1.12.1
  3541. * http://jqueryui.com
  3542. *
  3543. * Copyright jQuery Foundation and other contributors
  3544. * Released under the MIT license.
  3545. * http://jquery.org/license
  3546. */
  3547. //>>label: uniqueId
  3548. //>>group: Core
  3549. //>>description: Functions to generate and remove uniqueId's
  3550. //>>docs: http://api.jqueryui.com/uniqueId/
  3551. var uniqueId = $.fn.extend({
  3552. uniqueId: (function () {
  3553. var uuid = 0;
  3554. return function () {
  3555. return this.each(function () {
  3556. if (!this.id) {
  3557. this.id = "ui-id-" + (++uuid);
  3558. }
  3559. });
  3560. };
  3561. })(),
  3562. removeUniqueId: function () {
  3563. return this.each(function () {
  3564. if (/^ui-id-\d+$/.test(this.id)) {
  3565. $(this).removeAttr("id");
  3566. }
  3567. });
  3568. }
  3569. });
  3570. /*!
  3571. * jQuery UI Accordion 1.12.1
  3572. * http://jqueryui.com
  3573. *
  3574. * Copyright jQuery Foundation and other contributors
  3575. * Released under the MIT license.
  3576. * http://jquery.org/license
  3577. */
  3578. //>>label: Accordion
  3579. //>>group: Widgets
  3580. // jscs:disable maximumLineLength
  3581. //>>description: Displays collapsible content panels for presenting information in a limited amount of space.
  3582. // jscs:enable maximumLineLength
  3583. //>>docs: http://api.jqueryui.com/accordion/
  3584. //>>demos: http://jqueryui.com/accordion/
  3585. //>>css.structure: ../../themes/base/core.css
  3586. //>>css.structure: ../../themes/base/accordion.css
  3587. //>>css.theme: ../../themes/base/theme.css
  3588. var widgetsAccordion = $.widget("ui.accordion", {
  3589. version: "1.12.1",
  3590. options: {
  3591. active: 0,
  3592. animate: {},
  3593. classes: {
  3594. "ui-accordion-header": "ui-corner-top",
  3595. "ui-accordion-header-collapsed": "ui-corner-all",
  3596. "ui-accordion-content": "ui-corner-bottom"
  3597. },
  3598. collapsible: false,
  3599. event: "click",
  3600. header: "> li > :first-child, > :not(li):even",
  3601. heightStyle: "auto",
  3602. icons: {
  3603. activeHeader: "ui-icon-triangle-1-s",
  3604. header: "ui-icon-triangle-1-e"
  3605. },
  3606. // Callbacks
  3607. activate: null,
  3608. beforeActivate: null
  3609. },
  3610. hideProps: {
  3611. borderTopWidth: "hide",
  3612. borderBottomWidth: "hide",
  3613. paddingTop: "hide",
  3614. paddingBottom: "hide",
  3615. height: "hide"
  3616. },
  3617. showProps: {
  3618. borderTopWidth: "show",
  3619. borderBottomWidth: "show",
  3620. paddingTop: "show",
  3621. paddingBottom: "show",
  3622. height: "show"
  3623. },
  3624. _create: function () {
  3625. var options = this.options;
  3626. this.prevShow = this.prevHide = $();
  3627. this._addClass("ui-accordion", "ui-widget ui-helper-reset");
  3628. this.element.attr("role", "tablist");
  3629. // Don't allow collapsible: false and active: false / null
  3630. if (!options.collapsible && (options.active === false || options.active == null)) {
  3631. options.active = 0;
  3632. }
  3633. this._processPanels();
  3634. // handle negative values
  3635. if (options.active < 0) {
  3636. options.active += this.headers.length;
  3637. }
  3638. this._refresh();
  3639. },
  3640. _getCreateEventData: function () {
  3641. return {
  3642. header: this.active,
  3643. panel: !this.active.length ? $() : this.active.next()
  3644. };
  3645. },
  3646. _createIcons: function () {
  3647. var icon, children,
  3648. icons = this.options.icons;
  3649. if (icons) {
  3650. icon = $("<span>");
  3651. this._addClass(icon, "ui-accordion-header-icon", "ui-icon " + icons.header);
  3652. icon.prependTo(this.headers);
  3653. children = this.active.children(".ui-accordion-header-icon");
  3654. this._removeClass(children, icons.header)
  3655. ._addClass(children, null, icons.activeHeader)
  3656. ._addClass(this.headers, "ui-accordion-icons");
  3657. }
  3658. },
  3659. _destroyIcons: function () {
  3660. this._removeClass(this.headers, "ui-accordion-icons");
  3661. this.headers.children(".ui-accordion-header-icon").remove();
  3662. },
  3663. _destroy: function () {
  3664. var contents;
  3665. // Clean up main element
  3666. this.element.removeAttr("role");
  3667. // Clean up headers
  3668. this.headers
  3669. .removeAttr("role aria-expanded aria-selected aria-controls tabIndex")
  3670. .removeUniqueId();
  3671. this._destroyIcons();
  3672. // Clean up content panels
  3673. contents = this.headers.next()
  3674. .css("display", "")
  3675. .removeAttr("role aria-hidden aria-labelledby")
  3676. .removeUniqueId();
  3677. if (this.options.heightStyle !== "content") {
  3678. contents.css("height", "");
  3679. }
  3680. },
  3681. _setOption: function (key, value) {
  3682. if (key === "active") {
  3683. // _activate() will handle invalid values and update this.options
  3684. this._activate(value);
  3685. return;
  3686. }
  3687. if (key === "event") {
  3688. if (this.options.event) {
  3689. this._off(this.headers, this.options.event);
  3690. }
  3691. this._setupEvents(value);
  3692. }
  3693. this._super(key, value);
  3694. // Setting collapsible: false while collapsed; open first panel
  3695. if (key === "collapsible" && !value && this.options.active === false) {
  3696. this._activate(0);
  3697. }
  3698. if (key === "icons") {
  3699. this._destroyIcons();
  3700. if (value) {
  3701. this._createIcons();
  3702. }
  3703. }
  3704. },
  3705. _setOptionDisabled: function (value) {
  3706. this._super(value);
  3707. this.element.attr("aria-disabled", value);
  3708. // Support: IE8 Only
  3709. // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE
  3710. // so we need to add the disabled class to the headers and panels
  3711. this._toggleClass(null, "ui-state-disabled", !!value);
  3712. this._toggleClass(this.headers.add(this.headers.next()), null, "ui-state-disabled",
  3713. !!value);
  3714. },
  3715. _keydown: function (event) {
  3716. if (event.altKey || event.ctrlKey) {
  3717. return;
  3718. }
  3719. var keyCode = $.ui.keyCode,
  3720. length = this.headers.length,
  3721. currentIndex = this.headers.index(event.target),
  3722. toFocus = false;
  3723. switch (event.keyCode) {
  3724. case keyCode.RIGHT:
  3725. case keyCode.DOWN:
  3726. toFocus = this.headers[(currentIndex + 1) % length];
  3727. break;
  3728. case keyCode.LEFT:
  3729. case keyCode.UP:
  3730. toFocus = this.headers[(currentIndex - 1 + length) % length];
  3731. break;
  3732. case keyCode.SPACE:
  3733. case keyCode.ENTER:
  3734. this._eventHandler(event);
  3735. break;
  3736. case keyCode.HOME:
  3737. toFocus = this.headers[0];
  3738. break;
  3739. case keyCode.END:
  3740. toFocus = this.headers[length - 1];
  3741. break;
  3742. }
  3743. if (toFocus) {
  3744. $(event.target).attr("tabIndex", -1);
  3745. $(toFocus).attr("tabIndex", 0);
  3746. $(toFocus).trigger("focus");
  3747. event.preventDefault();
  3748. }
  3749. },
  3750. _panelKeyDown: function (event) {
  3751. if (event.keyCode === $.ui.keyCode.UP && event.ctrlKey) {
  3752. $(event.currentTarget).prev().trigger("focus");
  3753. }
  3754. },
  3755. refresh: function () {
  3756. var options = this.options;
  3757. this._processPanels();
  3758. // Was collapsed or no panel
  3759. if ((options.active === false && options.collapsible === true) ||
  3760. !this.headers.length) {
  3761. options.active = false;
  3762. this.active = $();
  3763. // active false only when collapsible is true
  3764. } else if (options.active === false) {
  3765. this._activate(0);
  3766. // was active, but active panel is gone
  3767. } else if (this.active.length && !$.contains(this.element[0], this.active[0])) {
  3768. // all remaining panel are disabled
  3769. if (this.headers.length === this.headers.find(".ui-state-disabled").length) {
  3770. options.active = false;
  3771. this.active = $();
  3772. // activate previous panel
  3773. } else {
  3774. this._activate(Math.max(0, options.active - 1));
  3775. }
  3776. // was active, active panel still exists
  3777. } else {
  3778. // make sure active index is correct
  3779. options.active = this.headers.index(this.active);
  3780. }
  3781. this._destroyIcons();
  3782. this._refresh();
  3783. },
  3784. _processPanels: function () {
  3785. var prevHeaders = this.headers,
  3786. prevPanels = this.panels;
  3787. this.headers = this.element.find(this.options.header);
  3788. this._addClass(this.headers, "ui-accordion-header ui-accordion-header-collapsed",
  3789. "ui-state-default");
  3790. this.panels = this.headers.next().filter(":not(.ui-accordion-content-active)").hide();
  3791. this._addClass(this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content");
  3792. // Avoid memory leaks (#10056)
  3793. if (prevPanels) {
  3794. this._off(prevHeaders.not(this.headers));
  3795. this._off(prevPanels.not(this.panels));
  3796. }
  3797. },
  3798. _refresh: function () {
  3799. var maxHeight,
  3800. options = this.options,
  3801. heightStyle = options.heightStyle,
  3802. parent = this.element.parent();
  3803. this.active = this._findActive(options.active);
  3804. this._addClass(this.active, "ui-accordion-header-active", "ui-state-active")
  3805. ._removeClass(this.active, "ui-accordion-header-collapsed");
  3806. this._addClass(this.active.next(), "ui-accordion-content-active");
  3807. this.active.next().show();
  3808. this.headers
  3809. .attr("role", "tab")
  3810. .each(function () {
  3811. var header = $(this),
  3812. headerId = header.uniqueId().attr("id"),
  3813. panel = header.next(),
  3814. panelId = panel.uniqueId().attr("id");
  3815. header.attr("aria-controls", panelId);
  3816. panel.attr("aria-labelledby", headerId);
  3817. })
  3818. .next()
  3819. .attr("role", "tabpanel");
  3820. this.headers
  3821. .not(this.active)
  3822. .attr({
  3823. "aria-selected": "false",
  3824. "aria-expanded": "false",
  3825. tabIndex: -1
  3826. })
  3827. .next()
  3828. .attr({
  3829. "aria-hidden": "true"
  3830. })
  3831. .hide();
  3832. // Make sure at least one header is in the tab order
  3833. if (!this.active.length) {
  3834. this.headers.eq(0).attr("tabIndex", 0);
  3835. } else {
  3836. this.active.attr({
  3837. "aria-selected": "true",
  3838. "aria-expanded": "true",
  3839. tabIndex: 0
  3840. })
  3841. .next()
  3842. .attr({
  3843. "aria-hidden": "false"
  3844. });
  3845. }
  3846. this._createIcons();
  3847. this._setupEvents(options.event);
  3848. if (heightStyle === "fill") {
  3849. maxHeight = parent.height();
  3850. this.element.siblings(":visible").each(function () {
  3851. var elem = $(this),
  3852. position = elem.css("position");
  3853. if (position === "absolute" || position === "fixed") {
  3854. return;
  3855. }
  3856. maxHeight -= elem.outerHeight(true);
  3857. });
  3858. this.headers.each(function () {
  3859. maxHeight -= $(this).outerHeight(true);
  3860. });
  3861. this.headers.next()
  3862. .each(function () {
  3863. $(this).height(Math.max(0, maxHeight -
  3864. $(this).innerHeight() + $(this).height()));
  3865. })
  3866. .css("overflow", "auto");
  3867. } else if (heightStyle === "auto") {
  3868. maxHeight = 0;
  3869. this.headers.next()
  3870. .each(function () {
  3871. var isVisible = $(this).is(":visible");
  3872. if (!isVisible) {
  3873. $(this).show();
  3874. }
  3875. maxHeight = Math.max(maxHeight, $(this).css("height", "").height());
  3876. if (!isVisible) {
  3877. $(this).hide();
  3878. }
  3879. })
  3880. .height(maxHeight);
  3881. }
  3882. },
  3883. _activate: function (index) {
  3884. var active = this._findActive(index)[0];
  3885. // Trying to activate the already active panel
  3886. if (active === this.active[0]) {
  3887. return;
  3888. }
  3889. // Trying to collapse, simulate a click on the currently active header
  3890. active = active || this.active[0];
  3891. this._eventHandler({
  3892. target: active,
  3893. currentTarget: active,
  3894. preventDefault: $.noop
  3895. });
  3896. },
  3897. _findActive: function (selector) {
  3898. return typeof selector === "number" ? this.headers.eq(selector) : $();
  3899. },
  3900. _setupEvents: function (event) {
  3901. var events = {
  3902. keydown: "_keydown"
  3903. };
  3904. if (event) {
  3905. $.each(event.split(" "), function (index, eventName) {
  3906. events[eventName] = "_eventHandler";
  3907. });
  3908. }
  3909. this._off(this.headers.add(this.headers.next()));
  3910. this._on(this.headers, events);
  3911. this._on(this.headers.next(), {keydown: "_panelKeyDown"});
  3912. this._hoverable(this.headers);
  3913. this._focusable(this.headers);
  3914. },
  3915. _eventHandler: function (event) {
  3916. var activeChildren, clickedChildren,
  3917. options = this.options,
  3918. active = this.active,
  3919. clicked = $(event.currentTarget),
  3920. clickedIsActive = clicked[0] === active[0],
  3921. collapsing = clickedIsActive && options.collapsible,
  3922. toShow = collapsing ? $() : clicked.next(),
  3923. toHide = active.next(),
  3924. eventData = {
  3925. oldHeader: active,
  3926. oldPanel: toHide,
  3927. newHeader: collapsing ? $() : clicked,
  3928. newPanel: toShow
  3929. };
  3930. event.preventDefault();
  3931. if (
  3932. // click on active header, but not collapsible
  3933. (clickedIsActive && !options.collapsible) ||
  3934. // allow canceling activation
  3935. (this._trigger("beforeActivate", event, eventData) === false)) {
  3936. return;
  3937. }
  3938. options.active = collapsing ? false : this.headers.index(clicked);
  3939. // When the call to ._toggle() comes after the class changes
  3940. // it causes a very odd bug in IE 8 (see #6720)
  3941. this.active = clickedIsActive ? $() : clicked;
  3942. this._toggle(eventData);
  3943. // Switch classes
  3944. // corner classes on the previously active header stay after the animation
  3945. this._removeClass(active, "ui-accordion-header-active", "ui-state-active");
  3946. if (options.icons) {
  3947. activeChildren = active.children(".ui-accordion-header-icon");
  3948. this._removeClass(activeChildren, null, options.icons.activeHeader)
  3949. ._addClass(activeChildren, null, options.icons.header);
  3950. }
  3951. if (!clickedIsActive) {
  3952. this._removeClass(clicked, "ui-accordion-header-collapsed")
  3953. ._addClass(clicked, "ui-accordion-header-active", "ui-state-active");
  3954. if (options.icons) {
  3955. clickedChildren = clicked.children(".ui-accordion-header-icon");
  3956. this._removeClass(clickedChildren, null, options.icons.header)
  3957. ._addClass(clickedChildren, null, options.icons.activeHeader);
  3958. }
  3959. this._addClass(clicked.next(), "ui-accordion-content-active");
  3960. }
  3961. },
  3962. _toggle: function (data) {
  3963. var toShow = data.newPanel,
  3964. toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
  3965. // Handle activating a panel during the animation for another activation
  3966. this.prevShow.add(this.prevHide).stop(true, true);
  3967. this.prevShow = toShow;
  3968. this.prevHide = toHide;
  3969. if (this.options.animate) {
  3970. this._animate(toShow, toHide, data);
  3971. } else {
  3972. toHide.hide();
  3973. toShow.show();
  3974. this._toggleComplete(data);
  3975. }
  3976. toHide.attr({
  3977. "aria-hidden": "true"
  3978. });
  3979. toHide.prev().attr({
  3980. "aria-selected": "false",
  3981. "aria-expanded": "false"
  3982. });
  3983. // if we're switching panels, remove the old header from the tab order
  3984. // if we're opening from collapsed state, remove the previous header from the tab order
  3985. // if we're collapsing, then keep the collapsing header in the tab order
  3986. if (toShow.length && toHide.length) {
  3987. toHide.prev().attr({
  3988. "tabIndex": -1,
  3989. "aria-expanded": "false"
  3990. });
  3991. } else if (toShow.length) {
  3992. this.headers.filter(function () {
  3993. return parseInt($(this).attr("tabIndex"), 10) === 0;
  3994. })
  3995. .attr("tabIndex", -1);
  3996. }
  3997. toShow
  3998. .attr("aria-hidden", "false")
  3999. .prev()
  4000. .attr({
  4001. "aria-selected": "true",
  4002. "aria-expanded": "true",
  4003. tabIndex: 0
  4004. });
  4005. },
  4006. _animate: function (toShow, toHide, data) {
  4007. var total, easing, duration,
  4008. that = this,
  4009. adjust = 0,
  4010. boxSizing = toShow.css("box-sizing"),
  4011. down = toShow.length &&
  4012. (!toHide.length || (toShow.index() < toHide.index())),
  4013. animate = this.options.animate || {},
  4014. options = down && animate.down || animate,
  4015. complete = function () {
  4016. that._toggleComplete(data);
  4017. };
  4018. if (typeof options === "number") {
  4019. duration = options;
  4020. }
  4021. if (typeof options === "string") {
  4022. easing = options;
  4023. }
  4024. // fall back from options to animation in case of partial down settings
  4025. easing = easing || options.easing || animate.easing;
  4026. duration = duration || options.duration || animate.duration;
  4027. if (!toHide.length) {
  4028. return toShow.animate(this.showProps, duration, easing, complete);
  4029. }
  4030. if (!toShow.length) {
  4031. return toHide.animate(this.hideProps, duration, easing, complete);
  4032. }
  4033. total = toShow.show().outerHeight();
  4034. toHide.animate(this.hideProps, {
  4035. duration: duration,
  4036. easing: easing,
  4037. step: function (now, fx) {
  4038. fx.now = Math.round(now);
  4039. }
  4040. });
  4041. toShow
  4042. .hide()
  4043. .animate(this.showProps, {
  4044. duration: duration,
  4045. easing: easing,
  4046. complete: complete,
  4047. step: function (now, fx) {
  4048. fx.now = Math.round(now);
  4049. if (fx.prop !== "height") {
  4050. if (boxSizing === "content-box") {
  4051. adjust += fx.now;
  4052. }
  4053. } else if (that.options.heightStyle !== "content") {
  4054. fx.now = Math.round(total - toHide.outerHeight() - adjust);
  4055. adjust = 0;
  4056. }
  4057. }
  4058. });
  4059. },
  4060. _toggleComplete: function (data) {
  4061. var toHide = data.oldPanel,
  4062. prev = toHide.prev();
  4063. this._removeClass(toHide, "ui-accordion-content-active");
  4064. this._removeClass(prev, "ui-accordion-header-active")
  4065. ._addClass(prev, "ui-accordion-header-collapsed");
  4066. // Work around for rendering bug in IE (#5421)
  4067. if (toHide.length) {
  4068. toHide.parent()[0].className = toHide.parent()[0].className;
  4069. }
  4070. this._trigger("activate", null, data);
  4071. }
  4072. });
  4073. var safeActiveElement = $.ui.safeActiveElement = function (document) {
  4074. var activeElement;
  4075. // Support: IE 9 only
  4076. // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
  4077. try {
  4078. activeElement = document.activeElement;
  4079. } catch (error) {
  4080. activeElement = document.body;
  4081. }
  4082. // Support: IE 9 - 11 only
  4083. // IE may return null instead of an element
  4084. // Interestingly, this only seems to occur when NOT in an iframe
  4085. if (!activeElement) {
  4086. activeElement = document.body;
  4087. }
  4088. // Support: IE 11 only
  4089. // IE11 returns a seemingly empty object in some cases when accessing
  4090. // document.activeElement from an <iframe>
  4091. if (!activeElement.nodeName) {
  4092. activeElement = document.body;
  4093. }
  4094. return activeElement;
  4095. };
  4096. /*!
  4097. * jQuery UI Menu 1.12.1
  4098. * http://jqueryui.com
  4099. *
  4100. * Copyright jQuery Foundation and other contributors
  4101. * Released under the MIT license.
  4102. * http://jquery.org/license
  4103. */
  4104. //>>label: Menu
  4105. //>>group: Widgets
  4106. //>>description: Creates nestable menus.
  4107. //>>docs: http://api.jqueryui.com/menu/
  4108. //>>demos: http://jqueryui.com/menu/
  4109. //>>css.structure: ../../themes/base/core.css
  4110. //>>css.structure: ../../themes/base/menu.css
  4111. //>>css.theme: ../../themes/base/theme.css
  4112. var widgetsMenu = $.widget("ui.menu", {
  4113. version: "1.12.1",
  4114. defaultElement: "<ul>",
  4115. delay: 300,
  4116. options: {
  4117. icons: {
  4118. submenu: "ui-icon-caret-1-e"
  4119. },
  4120. items: "> *",
  4121. menus: "ul",
  4122. position: {
  4123. my: "left top",
  4124. at: "right top"
  4125. },
  4126. role: "menu",
  4127. // Callbacks
  4128. blur: null,
  4129. focus: null,
  4130. select: null
  4131. },
  4132. _create: function () {
  4133. this.activeMenu = this.element;
  4134. // Flag used to prevent firing of the click handler
  4135. // as the event bubbles up through nested menus
  4136. this.mouseHandled = false;
  4137. this.element
  4138. .uniqueId()
  4139. .attr({
  4140. role: this.options.role,
  4141. tabIndex: 0
  4142. });
  4143. this._addClass("ui-menu", "ui-widget ui-widget-content");
  4144. this._on({
  4145. // Prevent focus from sticking to links inside menu after clicking
  4146. // them (focus should always stay on UL during navigation).
  4147. "mousedown .ui-menu-item": function (event) {
  4148. event.preventDefault();
  4149. },
  4150. "click .ui-menu-item": function (event) {
  4151. var target = $(event.target);
  4152. var active = $($.ui.safeActiveElement(this.document[0]));
  4153. if (!this.mouseHandled && target.not(".ui-state-disabled").length) {
  4154. this.select(event);
  4155. // Only set the mouseHandled flag if the event will bubble, see #9469.
  4156. if (!event.isPropagationStopped()) {
  4157. this.mouseHandled = true;
  4158. }
  4159. // Open submenu on click
  4160. if (target.has(".ui-menu").length) {
  4161. this.expand(event);
  4162. } else if (!this.element.is(":focus") &&
  4163. active.closest(".ui-menu").length) {
  4164. // Redirect focus to the menu
  4165. this.element.trigger("focus", [true]);
  4166. // If the active item is on the top level, let it stay active.
  4167. // Otherwise, blur the active item since it is no longer visible.
  4168. if (this.active && this.active.parents(".ui-menu").length === 1) {
  4169. clearTimeout(this.timer);
  4170. }
  4171. }
  4172. }
  4173. },
  4174. "mouseenter .ui-menu-item": function (event) {
  4175. // Ignore mouse events while typeahead is active, see #10458.
  4176. // Prevents focusing the wrong item when typeahead causes a scroll while the mouse
  4177. // is over an item in the menu
  4178. if (this.previousFilter) {
  4179. return;
  4180. }
  4181. var actualTarget = $(event.target).closest(".ui-menu-item"),
  4182. target = $(event.currentTarget);
  4183. // Ignore bubbled events on parent items, see #11641
  4184. if (actualTarget[0] !== target[0]) {
  4185. return;
  4186. }
  4187. // Remove ui-state-active class from siblings of the newly focused menu item
  4188. // to avoid a jump caused by adjacent elements both having a class with a border
  4189. this._removeClass(target.siblings().children(".ui-state-active"),
  4190. null, "ui-state-active");
  4191. this.focus(event, target);
  4192. },
  4193. mouseleave: "collapseAll",
  4194. "mouseleave .ui-menu": "collapseAll",
  4195. focus: function (event, keepActiveItem) {
  4196. // If there's already an active item, keep it active
  4197. // If not, activate the first item
  4198. var item = this.active || this.element.find(this.options.items).eq(0);
  4199. if (!keepActiveItem) {
  4200. this.focus(event, item);
  4201. }
  4202. },
  4203. blur: function (event) {
  4204. this._delay(function () {
  4205. var notContained = !$.contains(
  4206. this.element[0],
  4207. $.ui.safeActiveElement(this.document[0])
  4208. );
  4209. if (notContained) {
  4210. this.collapseAll(event);
  4211. }
  4212. });
  4213. },
  4214. keydown: "_keydown"
  4215. });
  4216. this.refresh();
  4217. // Clicks outside of a menu collapse any open menus
  4218. this._on(this.document, {
  4219. click: function (event) {
  4220. if (this._closeOnDocumentClick(event)) {
  4221. this.collapseAll(event);
  4222. }
  4223. // Reset the mouseHandled flag
  4224. this.mouseHandled = false;
  4225. }
  4226. });
  4227. },
  4228. _destroy: function () {
  4229. var items = this.element.find(".ui-menu-item")
  4230. .removeAttr("role aria-disabled"),
  4231. submenus = items.children(".ui-menu-item-wrapper")
  4232. .removeUniqueId()
  4233. .removeAttr("tabIndex role aria-haspopup");
  4234. // Destroy (sub)menus
  4235. this.element
  4236. .removeAttr("aria-activedescendant")
  4237. .find(".ui-menu").addBack()
  4238. .removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled " +
  4239. "tabIndex")
  4240. .removeUniqueId()
  4241. .show();
  4242. submenus.children().each(function () {
  4243. var elem = $(this);
  4244. if (elem.data("ui-menu-submenu-caret")) {
  4245. elem.remove();
  4246. }
  4247. });
  4248. },
  4249. _keydown: function (event) {
  4250. var match, prev, character, skip,
  4251. preventDefault = true;
  4252. switch (event.keyCode) {
  4253. case $.ui.keyCode.PAGE_UP:
  4254. this.previousPage(event);
  4255. break;
  4256. case $.ui.keyCode.PAGE_DOWN:
  4257. this.nextPage(event);
  4258. break;
  4259. case $.ui.keyCode.HOME:
  4260. this._move("first", "first", event);
  4261. break;
  4262. case $.ui.keyCode.END:
  4263. this._move("last", "last", event);
  4264. break;
  4265. case $.ui.keyCode.UP:
  4266. this.previous(event);
  4267. break;
  4268. case $.ui.keyCode.DOWN:
  4269. this.next(event);
  4270. break;
  4271. case $.ui.keyCode.LEFT:
  4272. this.collapse(event);
  4273. break;
  4274. case $.ui.keyCode.RIGHT:
  4275. if (this.active && !this.active.is(".ui-state-disabled")) {
  4276. this.expand(event);
  4277. }
  4278. break;
  4279. case $.ui.keyCode.ENTER:
  4280. case $.ui.keyCode.SPACE:
  4281. this._activate(event);
  4282. break;
  4283. case $.ui.keyCode.ESCAPE:
  4284. this.collapse(event);
  4285. break;
  4286. default:
  4287. preventDefault = false;
  4288. prev = this.previousFilter || "";
  4289. skip = false;
  4290. // Support number pad values
  4291. character = event.keyCode >= 96 && event.keyCode <= 105 ?
  4292. (event.keyCode - 96).toString() : String.fromCharCode(event.keyCode);
  4293. clearTimeout(this.filterTimer);
  4294. if (character === prev) {
  4295. skip = true;
  4296. } else {
  4297. character = prev + character;
  4298. }
  4299. match = this._filterMenuItems(character);
  4300. match = skip && match.index(this.active.next()) !== -1 ?
  4301. this.active.nextAll(".ui-menu-item") :
  4302. match;
  4303. // If no matches on the current filter, reset to the last character pressed
  4304. // to move down the menu to the first item that starts with that character
  4305. if (!match.length) {
  4306. character = String.fromCharCode(event.keyCode);
  4307. match = this._filterMenuItems(character);
  4308. }
  4309. if (match.length) {
  4310. this.focus(event, match);
  4311. this.previousFilter = character;
  4312. this.filterTimer = this._delay(function () {
  4313. delete this.previousFilter;
  4314. }, 1000);
  4315. } else {
  4316. delete this.previousFilter;
  4317. }
  4318. }
  4319. if (preventDefault) {
  4320. event.preventDefault();
  4321. }
  4322. },
  4323. _activate: function (event) {
  4324. if (this.active && !this.active.is(".ui-state-disabled")) {
  4325. if (this.active.children("[aria-haspopup='true']").length) {
  4326. this.expand(event);
  4327. } else {
  4328. this.select(event);
  4329. }
  4330. }
  4331. },
  4332. refresh: function () {
  4333. var menus, items, newSubmenus, newItems, newWrappers,
  4334. that = this,
  4335. icon = this.options.icons.submenu,
  4336. submenus = this.element.find(this.options.menus);
  4337. this._toggleClass("ui-menu-icons", null, !!this.element.find(".ui-icon").length);
  4338. // Initialize nested menus
  4339. newSubmenus = submenus.filter(":not(.ui-menu)")
  4340. .hide()
  4341. .attr({
  4342. role: this.options.role,
  4343. "aria-hidden": "true",
  4344. "aria-expanded": "false"
  4345. })
  4346. .each(function () {
  4347. var menu = $(this),
  4348. item = menu.prev(),
  4349. submenuCaret = $("<span>").data("ui-menu-submenu-caret", true);
  4350. that._addClass(submenuCaret, "ui-menu-icon", "ui-icon " + icon);
  4351. item
  4352. .attr("aria-haspopup", "true")
  4353. .prepend(submenuCaret);
  4354. menu.attr("aria-labelledby", item.attr("id"));
  4355. });
  4356. this._addClass(newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front");
  4357. menus = submenus.add(this.element);
  4358. items = menus.find(this.options.items);
  4359. // Initialize menu-items containing spaces and/or dashes only as dividers
  4360. items.not(".ui-menu-item").each(function () {
  4361. var item = $(this);
  4362. if (that._isDivider(item)) {
  4363. that._addClass(item, "ui-menu-divider", "ui-widget-content");
  4364. }
  4365. });
  4366. // Don't refresh list items that are already adapted
  4367. newItems = items.not(".ui-menu-item, .ui-menu-divider");
  4368. newWrappers = newItems.children()
  4369. .not(".ui-menu")
  4370. .uniqueId()
  4371. .attr({
  4372. tabIndex: -1,
  4373. role: this._itemRole()
  4374. });
  4375. this._addClass(newItems, "ui-menu-item")
  4376. ._addClass(newWrappers, "ui-menu-item-wrapper");
  4377. // Add aria-disabled attribute to any disabled menu item
  4378. items.filter(".ui-state-disabled").attr("aria-disabled", "true");
  4379. // If the active item has been removed, blur the menu
  4380. if (this.active && !$.contains(this.element[0], this.active[0])) {
  4381. this.blur();
  4382. }
  4383. },
  4384. _itemRole: function () {
  4385. return {
  4386. menu: "menuitem",
  4387. listbox: "option"
  4388. }[this.options.role];
  4389. },
  4390. _setOption: function (key, value) {
  4391. if (key === "icons") {
  4392. var icons = this.element.find(".ui-menu-icon");
  4393. this._removeClass(icons, null, this.options.icons.submenu)
  4394. ._addClass(icons, null, value.submenu);
  4395. }
  4396. this._super(key, value);
  4397. },
  4398. _setOptionDisabled: function (value) {
  4399. this._super(value);
  4400. this.element.attr("aria-disabled", String(value));
  4401. this._toggleClass(null, "ui-state-disabled", !!value);
  4402. },
  4403. focus: function (event, item) {
  4404. var nested, focused, activeParent;
  4405. this.blur(event, event && event.type === "focus");
  4406. this._scrollIntoView(item);
  4407. this.active = item.first();
  4408. focused = this.active.children(".ui-menu-item-wrapper");
  4409. this._addClass(focused, null, "ui-state-active");
  4410. // Only update aria-activedescendant if there's a role
  4411. // otherwise we assume focus is managed elsewhere
  4412. if (this.options.role) {
  4413. this.element.attr("aria-activedescendant", focused.attr("id"));
  4414. }
  4415. // Highlight active parent menu item, if any
  4416. activeParent = this.active
  4417. .parent()
  4418. .closest(".ui-menu-item")
  4419. .children(".ui-menu-item-wrapper");
  4420. this._addClass(activeParent, null, "ui-state-active");
  4421. if (event && event.type === "keydown") {
  4422. this._close();
  4423. } else {
  4424. this.timer = this._delay(function () {
  4425. this._close();
  4426. }, this.delay);
  4427. }
  4428. nested = item.children(".ui-menu");
  4429. if (nested.length && event && (/^mouse/.test(event.type))) {
  4430. this._startOpening(nested);
  4431. }
  4432. this.activeMenu = item.parent();
  4433. this._trigger("focus", event, {item: item});
  4434. },
  4435. _scrollIntoView: function (item) {
  4436. var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
  4437. if (this._hasScroll()) {
  4438. borderTop = parseFloat($.css(this.activeMenu[0], "borderTopWidth")) || 0;
  4439. paddingTop = parseFloat($.css(this.activeMenu[0], "paddingTop")) || 0;
  4440. offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
  4441. scroll = this.activeMenu.scrollTop();
  4442. elementHeight = this.activeMenu.height();
  4443. itemHeight = item.outerHeight();
  4444. if (offset < 0) {
  4445. this.activeMenu.scrollTop(scroll + offset);
  4446. } else if (offset + itemHeight > elementHeight) {
  4447. this.activeMenu.scrollTop(scroll + offset - elementHeight + itemHeight);
  4448. }
  4449. }
  4450. },
  4451. blur: function (event, fromFocus) {
  4452. if (!fromFocus) {
  4453. clearTimeout(this.timer);
  4454. }
  4455. if (!this.active) {
  4456. return;
  4457. }
  4458. this._removeClass(this.active.children(".ui-menu-item-wrapper"),
  4459. null, "ui-state-active");
  4460. this._trigger("blur", event, {item: this.active});
  4461. this.active = null;
  4462. },
  4463. _startOpening: function (submenu) {
  4464. clearTimeout(this.timer);
  4465. // Don't open if already open fixes a Firefox bug that caused a .5 pixel
  4466. // shift in the submenu position when mousing over the caret icon
  4467. if (submenu.attr("aria-hidden") !== "true") {
  4468. return;
  4469. }
  4470. this.timer = this._delay(function () {
  4471. this._close();
  4472. this._open(submenu);
  4473. }, this.delay);
  4474. },
  4475. _open: function (submenu) {
  4476. var position = $.extend({
  4477. of: this.active
  4478. }, this.options.position);
  4479. clearTimeout(this.timer);
  4480. this.element.find(".ui-menu").not(submenu.parents(".ui-menu"))
  4481. .hide()
  4482. .attr("aria-hidden", "true");
  4483. submenu
  4484. .show()
  4485. .removeAttr("aria-hidden")
  4486. .attr("aria-expanded", "true")
  4487. .position(position);
  4488. },
  4489. collapseAll: function (event, all) {
  4490. clearTimeout(this.timer);
  4491. this.timer = this._delay(function () {
  4492. // If we were passed an event, look for the submenu that contains the event
  4493. var currentMenu = all ? this.element :
  4494. $(event && event.target).closest(this.element.find(".ui-menu"));
  4495. // If we found no valid submenu ancestor, use the main menu to close all
  4496. // sub menus anyway
  4497. if (!currentMenu.length) {
  4498. currentMenu = this.element;
  4499. }
  4500. this._close(currentMenu);
  4501. this.blur(event);
  4502. // Work around active item staying active after menu is blurred
  4503. this._removeClass(currentMenu.find(".ui-state-active"), null, "ui-state-active");
  4504. this.activeMenu = currentMenu;
  4505. }, this.delay);
  4506. },
  4507. // With no arguments, closes the currently active menu - if nothing is active
  4508. // it closes all menus. If passed an argument, it will search for menus BELOW
  4509. _close: function (startMenu) {
  4510. if (!startMenu) {
  4511. startMenu = this.active ? this.active.parent() : this.element;
  4512. }
  4513. startMenu.find(".ui-menu")
  4514. .hide()
  4515. .attr("aria-hidden", "true")
  4516. .attr("aria-expanded", "false");
  4517. },
  4518. _closeOnDocumentClick: function (event) {
  4519. return !$(event.target).closest(".ui-menu").length;
  4520. },
  4521. _isDivider: function (item) {
  4522. // Match hyphen, em dash, en dash
  4523. return !/[^\-\u2014\u2013\s]/.test(item.text());
  4524. },
  4525. collapse: function (event) {
  4526. var newItem = this.active &&
  4527. this.active.parent().closest(".ui-menu-item", this.element);
  4528. if (newItem && newItem.length) {
  4529. this._close();
  4530. this.focus(event, newItem);
  4531. }
  4532. },
  4533. expand: function (event) {
  4534. var newItem = this.active &&
  4535. this.active
  4536. .children(".ui-menu ")
  4537. .find(this.options.items)
  4538. .first();
  4539. if (newItem && newItem.length) {
  4540. this._open(newItem.parent());
  4541. // Delay so Firefox will not hide activedescendant change in expanding submenu from AT
  4542. this._delay(function () {
  4543. this.focus(event, newItem);
  4544. });
  4545. }
  4546. },
  4547. next: function (event) {
  4548. this._move("next", "first", event);
  4549. },
  4550. previous: function (event) {
  4551. this._move("prev", "last", event);
  4552. },
  4553. isFirstItem: function () {
  4554. return this.active && !this.active.prevAll(".ui-menu-item").length;
  4555. },
  4556. isLastItem: function () {
  4557. return this.active && !this.active.nextAll(".ui-menu-item").length;
  4558. },
  4559. _move: function (direction, filter, event) {
  4560. var next;
  4561. if (this.active) {
  4562. if (direction === "first" || direction === "last") {
  4563. next = this.active
  4564. [direction === "first" ? "prevAll" : "nextAll"](".ui-menu-item")
  4565. .eq(-1);
  4566. } else {
  4567. next = this.active
  4568. [direction + "All"](".ui-menu-item")
  4569. .eq(0);
  4570. }
  4571. }
  4572. if (!next || !next.length || !this.active) {
  4573. next = this.activeMenu.find(this.options.items)[filter]();
  4574. }
  4575. this.focus(event, next);
  4576. },
  4577. nextPage: function (event) {
  4578. var item, base, height;
  4579. if (!this.active) {
  4580. this.next(event);
  4581. return;
  4582. }
  4583. if (this.isLastItem()) {
  4584. return;
  4585. }
  4586. if (this._hasScroll()) {
  4587. base = this.active.offset().top;
  4588. height = this.element.height();
  4589. this.active.nextAll(".ui-menu-item").each(function () {
  4590. item = $(this);
  4591. return item.offset().top - base - height < 0;
  4592. });
  4593. this.focus(event, item);
  4594. } else {
  4595. this.focus(event, this.activeMenu.find(this.options.items)
  4596. [!this.active ? "first" : "last"]());
  4597. }
  4598. },
  4599. previousPage: function (event) {
  4600. var item, base, height;
  4601. if (!this.active) {
  4602. this.next(event);
  4603. return;
  4604. }
  4605. if (this.isFirstItem()) {
  4606. return;
  4607. }
  4608. if (this._hasScroll()) {
  4609. base = this.active.offset().top;
  4610. height = this.element.height();
  4611. this.active.prevAll(".ui-menu-item").each(function () {
  4612. item = $(this);
  4613. return item.offset().top - base + height > 0;
  4614. });
  4615. this.focus(event, item);
  4616. } else {
  4617. this.focus(event, this.activeMenu.find(this.options.items).first());
  4618. }
  4619. },
  4620. _hasScroll: function () {
  4621. return this.element.outerHeight() < this.element.prop("scrollHeight");
  4622. },
  4623. select: function (event) {
  4624. // TODO: It should never be possible to not have an active item at this
  4625. // point, but the tests don't trigger mouseenter before click.
  4626. this.active = this.active || $(event.target).closest(".ui-menu-item");
  4627. var ui = {item: this.active};
  4628. if (!this.active.has(".ui-menu").length) {
  4629. this.collapseAll(event, true);
  4630. }
  4631. this._trigger("select", event, ui);
  4632. },
  4633. _filterMenuItems: function (character) {
  4634. var escapedCharacter = character.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"),
  4635. regex = new RegExp("^" + escapedCharacter, "i");
  4636. return this.activeMenu
  4637. .find(this.options.items)
  4638. // Only match on items, not dividers or other content (#10571)
  4639. .filter(".ui-menu-item")
  4640. .filter(function () {
  4641. return regex.test(
  4642. $.trim($(this).children(".ui-menu-item-wrapper").text()));
  4643. });
  4644. }
  4645. });
  4646. /*!
  4647. * jQuery UI Autocomplete 1.12.1
  4648. * http://jqueryui.com
  4649. *
  4650. * Copyright jQuery Foundation and other contributors
  4651. * Released under the MIT license.
  4652. * http://jquery.org/license
  4653. */
  4654. //>>label: Autocomplete
  4655. //>>group: Widgets
  4656. //>>description: Lists suggested words as the user is typing.
  4657. //>>docs: http://api.jqueryui.com/autocomplete/
  4658. //>>demos: http://jqueryui.com/autocomplete/
  4659. //>>css.structure: ../../themes/base/core.css
  4660. //>>css.structure: ../../themes/base/autocomplete.css
  4661. //>>css.theme: ../../themes/base/theme.css
  4662. $.widget("ui.autocomplete", {
  4663. version: "1.12.1",
  4664. defaultElement: "<input>",
  4665. options: {
  4666. appendTo: null,
  4667. autoFocus: false,
  4668. delay: 300,
  4669. minLength: 1,
  4670. position: {
  4671. my: "left top",
  4672. at: "left bottom",
  4673. collision: "none"
  4674. },
  4675. source: null,
  4676. // Callbacks
  4677. change: null,
  4678. close: null,
  4679. focus: null,
  4680. open: null,
  4681. response: null,
  4682. search: null,
  4683. select: null
  4684. },
  4685. requestIndex: 0,
  4686. pending: 0,
  4687. _create: function () {
  4688. // Some browsers only repeat keydown events, not keypress events,
  4689. // so we use the suppressKeyPress flag to determine if we've already
  4690. // handled the keydown event. #7269
  4691. // Unfortunately the code for & in keypress is the same as the up arrow,
  4692. // so we use the suppressKeyPressRepeat flag to avoid handling keypress
  4693. // events when we know the keydown event was used to modify the
  4694. // search term. #7799
  4695. var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
  4696. nodeName = this.element[0].nodeName.toLowerCase(),
  4697. isTextarea = nodeName === "textarea",
  4698. isInput = nodeName === "input";
  4699. // Textareas are always multi-line
  4700. // Inputs are always single-line, even if inside a contentEditable element
  4701. // IE also treats inputs as contentEditable
  4702. // All other element types are determined by whether or not they're contentEditable
  4703. this.isMultiLine = isTextarea || !isInput && this._isContentEditable(this.element);
  4704. this.valueMethod = this.element[isTextarea || isInput ? "val" : "text"];
  4705. this.isNewMenu = true;
  4706. this._addClass("ui-autocomplete-input");
  4707. this.element.attr("autocomplete", "off");
  4708. this._on(this.element, {
  4709. keydown: function (event) {
  4710. if (this.element.prop("readOnly")) {
  4711. suppressKeyPress = true;
  4712. suppressInput = true;
  4713. suppressKeyPressRepeat = true;
  4714. return;
  4715. }
  4716. suppressKeyPress = false;
  4717. suppressInput = false;
  4718. suppressKeyPressRepeat = false;
  4719. var keyCode = $.ui.keyCode;
  4720. switch (event.keyCode) {
  4721. case keyCode.PAGE_UP:
  4722. suppressKeyPress = true;
  4723. this._move("previousPage", event);
  4724. break;
  4725. case keyCode.PAGE_DOWN:
  4726. suppressKeyPress = true;
  4727. this._move("nextPage", event);
  4728. break;
  4729. case keyCode.UP:
  4730. suppressKeyPress = true;
  4731. this._keyEvent("previous", event);
  4732. break;
  4733. case keyCode.DOWN:
  4734. suppressKeyPress = true;
  4735. this._keyEvent("next", event);
  4736. break;
  4737. case keyCode.ENTER:
  4738. // when menu is open and has focus
  4739. if (this.menu.active) {
  4740. // #6055 - Opera still allows the keypress to occur
  4741. // which causes forms to submit
  4742. suppressKeyPress = true;
  4743. event.preventDefault();
  4744. this.menu.select(event);
  4745. }
  4746. break;
  4747. case keyCode.TAB:
  4748. if (this.menu.active) {
  4749. this.menu.select(event);
  4750. }
  4751. break;
  4752. case keyCode.ESCAPE:
  4753. if (this.menu.element.is(":visible")) {
  4754. if (!this.isMultiLine) {
  4755. this._value(this.term);
  4756. }
  4757. this.close(event);
  4758. // Different browsers have different default behavior for escape
  4759. // Single press can mean undo or clear
  4760. // Double press in IE means clear the whole form
  4761. event.preventDefault();
  4762. }
  4763. break;
  4764. default:
  4765. suppressKeyPressRepeat = true;
  4766. // search timeout should be triggered before the input value is changed
  4767. this._searchTimeout(event);
  4768. break;
  4769. }
  4770. },
  4771. keypress: function (event) {
  4772. if (suppressKeyPress) {
  4773. suppressKeyPress = false;
  4774. if (!this.isMultiLine || this.menu.element.is(":visible")) {
  4775. event.preventDefault();
  4776. }
  4777. return;
  4778. }
  4779. if (suppressKeyPressRepeat) {
  4780. return;
  4781. }
  4782. // Replicate some key handlers to allow them to repeat in Firefox and Opera
  4783. var keyCode = $.ui.keyCode;
  4784. switch (event.keyCode) {
  4785. case keyCode.PAGE_UP:
  4786. this._move("previousPage", event);
  4787. break;
  4788. case keyCode.PAGE_DOWN:
  4789. this._move("nextPage", event);
  4790. break;
  4791. case keyCode.UP:
  4792. this._keyEvent("previous", event);
  4793. break;
  4794. case keyCode.DOWN:
  4795. this._keyEvent("next", event);
  4796. break;
  4797. }
  4798. },
  4799. input: function (event) {
  4800. if (suppressInput) {
  4801. suppressInput = false;
  4802. event.preventDefault();
  4803. return;
  4804. }
  4805. this._searchTimeout(event);
  4806. },
  4807. focus: function () {
  4808. this.selectedItem = null;
  4809. this.previous = this._value();
  4810. },
  4811. blur: function (event) {
  4812. if (this.cancelBlur) {
  4813. delete this.cancelBlur;
  4814. return;
  4815. }
  4816. clearTimeout(this.searching);
  4817. this.close(event);
  4818. this._change(event);
  4819. }
  4820. });
  4821. this._initSource();
  4822. this.menu = $("<ul>")
  4823. .appendTo(this._appendTo())
  4824. .menu({
  4825. // disable ARIA support, the live region takes care of that
  4826. role: null
  4827. })
  4828. .hide()
  4829. .menu("instance");
  4830. this._addClass(this.menu.element, "ui-autocomplete", "ui-front");
  4831. this._on(this.menu.element, {
  4832. mousedown: function (event) {
  4833. // prevent moving focus out of the text field
  4834. event.preventDefault();
  4835. // IE doesn't prevent moving focus even with event.preventDefault()
  4836. // so we set a flag to know when we should ignore the blur event
  4837. this.cancelBlur = true;
  4838. this._delay(function () {
  4839. delete this.cancelBlur;
  4840. // Support: IE 8 only
  4841. // Right clicking a menu item or selecting text from the menu items will
  4842. // result in focus moving out of the input. However, we've already received
  4843. // and ignored the blur event because of the cancelBlur flag set above. So
  4844. // we restore focus to ensure that the menu closes properly based on the user's
  4845. // next actions.
  4846. if (this.element[0] !== $.ui.safeActiveElement(this.document[0])) {
  4847. this.element.trigger("focus");
  4848. }
  4849. });
  4850. },
  4851. menufocus: function (event, ui) {
  4852. var label, item;
  4853. // support: Firefox
  4854. // Prevent accidental activation of menu items in Firefox (#7024 #9118)
  4855. if (this.isNewMenu) {
  4856. this.isNewMenu = false;
  4857. if (event.originalEvent && /^mouse/.test(event.originalEvent.type)) {
  4858. this.menu.blur();
  4859. this.document.one("mousemove", function () {
  4860. $(event.target).trigger(event.originalEvent);
  4861. });
  4862. return;
  4863. }
  4864. }
  4865. item = ui.item.data("ui-autocomplete-item");
  4866. if (false !== this._trigger("focus", event, {item: item})) {
  4867. // use value to match what will end up in the input, if it was a key event
  4868. if (event.originalEvent && /^key/.test(event.originalEvent.type)) {
  4869. this._value(item.value);
  4870. }
  4871. }
  4872. // Announce the value in the liveRegion
  4873. label = ui.item.attr("aria-label") || item.value;
  4874. if (label && $.trim(label).length) {
  4875. this.liveRegion.children().hide();
  4876. $("<div>").text(label).appendTo(this.liveRegion);
  4877. }
  4878. },
  4879. menuselect: function (event, ui) {
  4880. var item = ui.item.data("ui-autocomplete-item"),
  4881. previous = this.previous;
  4882. // Only trigger when focus was lost (click on menu)
  4883. if (this.element[0] !== $.ui.safeActiveElement(this.document[0])) {
  4884. this.element.trigger("focus");
  4885. this.previous = previous;
  4886. // #6109 - IE triggers two focus events and the second
  4887. // is asynchronous, so we need to reset the previous
  4888. // term synchronously and asynchronously :-(
  4889. this._delay(function () {
  4890. this.previous = previous;
  4891. this.selectedItem = item;
  4892. });
  4893. }
  4894. if (false !== this._trigger("select", event, {item: item})) {
  4895. this._value(item.value);
  4896. }
  4897. // reset the term after the select event
  4898. // this allows custom select handling to work properly
  4899. this.term = this._value();
  4900. this.close(event);
  4901. this.selectedItem = item;
  4902. }
  4903. });
  4904. this.liveRegion = $("<div>", {
  4905. role: "status",
  4906. "aria-live": "assertive",
  4907. "aria-relevant": "additions"
  4908. })
  4909. .appendTo(this.document[0].body);
  4910. this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible");
  4911. // Turning off autocomplete prevents the browser from remembering the
  4912. // value when navigating through history, so we re-enable autocomplete
  4913. // if the page is unloaded before the widget is destroyed. #7790
  4914. this._on(this.window, {
  4915. beforeunload: function () {
  4916. this.element.removeAttr("autocomplete");
  4917. }
  4918. });
  4919. },
  4920. _destroy: function () {
  4921. clearTimeout(this.searching);
  4922. this.element.removeAttr("autocomplete");
  4923. this.menu.element.remove();
  4924. this.liveRegion.remove();
  4925. },
  4926. _setOption: function (key, value) {
  4927. this._super(key, value);
  4928. if (key === "source") {
  4929. this._initSource();
  4930. }
  4931. if (key === "appendTo") {
  4932. this.menu.element.appendTo(this._appendTo());
  4933. }
  4934. if (key === "disabled" && value && this.xhr) {
  4935. this.xhr.abort();
  4936. }
  4937. },
  4938. _isEventTargetInWidget: function (event) {
  4939. var menuElement = this.menu.element[0];
  4940. return event.target === this.element[0] ||
  4941. event.target === menuElement ||
  4942. $.contains(menuElement, event.target);
  4943. },
  4944. _closeOnClickOutside: function (event) {
  4945. if (!this._isEventTargetInWidget(event)) {
  4946. this.close();
  4947. }
  4948. },
  4949. _appendTo: function () {
  4950. var element = this.options.appendTo;
  4951. if (element) {
  4952. element = element.jquery || element.nodeType ?
  4953. $(element) :
  4954. this.document.find(element).eq(0);
  4955. }
  4956. if (!element || !element[0]) {
  4957. element = this.element.closest(".ui-front, dialog");
  4958. }
  4959. if (!element.length) {
  4960. element = this.document[0].body;
  4961. }
  4962. return element;
  4963. },
  4964. _initSource: function () {
  4965. var array, url,
  4966. that = this;
  4967. if ($.isArray(this.options.source)) {
  4968. array = this.options.source;
  4969. this.source = function (request, response) {
  4970. response($.ui.autocomplete.filter(array, request.term));
  4971. };
  4972. } else if (typeof this.options.source === "string") {
  4973. url = this.options.source;
  4974. this.source = function (request, response) {
  4975. if (that.xhr) {
  4976. that.xhr.abort();
  4977. }
  4978. that.xhr = $.ajax({
  4979. url: url,
  4980. data: request,
  4981. dataType: "json",
  4982. success: function (data) {
  4983. response(data);
  4984. },
  4985. error: function () {
  4986. response([]);
  4987. }
  4988. });
  4989. };
  4990. } else {
  4991. this.source = this.options.source;
  4992. }
  4993. },
  4994. _searchTimeout: function (event) {
  4995. clearTimeout(this.searching);
  4996. this.searching = this._delay(function () {
  4997. // Search if the value has changed, or if the user retypes the same value (see #7434)
  4998. var equalValues = this.term === this._value(),
  4999. menuVisible = this.menu.element.is(":visible"),
  5000. modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
  5001. if (!equalValues || (equalValues && !menuVisible && !modifierKey)) {
  5002. this.selectedItem = null;
  5003. this.search(null, event);
  5004. }
  5005. }, this.options.delay);
  5006. },
  5007. search: function (value, event) {
  5008. value = value != null ? value : this._value();
  5009. // Always save the actual value, not the one passed as an argument
  5010. this.term = this._value();
  5011. if (value.length < this.options.minLength) {
  5012. return this.close(event);
  5013. }
  5014. if (this._trigger("search", event) === false) {
  5015. return;
  5016. }
  5017. return this._search(value);
  5018. },
  5019. _search: function (value) {
  5020. this.pending++;
  5021. this._addClass("ui-autocomplete-loading");
  5022. this.cancelSearch = false;
  5023. this.source({term: value}, this._response());
  5024. },
  5025. _response: function () {
  5026. var index = ++this.requestIndex;
  5027. return $.proxy(function (content) {
  5028. if (index === this.requestIndex) {
  5029. this.__response(content);
  5030. }
  5031. this.pending--;
  5032. if (!this.pending) {
  5033. this._removeClass("ui-autocomplete-loading");
  5034. }
  5035. }, this);
  5036. },
  5037. __response: function (content) {
  5038. if (content) {
  5039. content = this._normalize(content);
  5040. }
  5041. this._trigger("response", null, {content: content});
  5042. if (!this.options.disabled && content && content.length && !this.cancelSearch) {
  5043. this._suggest(content);
  5044. this._trigger("open");
  5045. } else {
  5046. // use ._close() instead of .close() so we don't cancel future searches
  5047. this._close();
  5048. }
  5049. },
  5050. close: function (event) {
  5051. this.cancelSearch = true;
  5052. this._close(event);
  5053. },
  5054. _close: function (event) {
  5055. // Remove the handler that closes the menu on outside clicks
  5056. this._off(this.document, "mousedown");
  5057. if (this.menu.element.is(":visible")) {
  5058. this.menu.element.hide();
  5059. this.menu.blur();
  5060. this.isNewMenu = true;
  5061. this._trigger("close", event);
  5062. }
  5063. },
  5064. _change: function (event) {
  5065. if (this.previous !== this._value()) {
  5066. this._trigger("change", event, {item: this.selectedItem});
  5067. }
  5068. },
  5069. _normalize: function (items) {
  5070. // assume all items have the right format when the first item is complete
  5071. if (items.length && items[0].label && items[0].value) {
  5072. return items;
  5073. }
  5074. return $.map(items, function (item) {
  5075. if (typeof item === "string") {
  5076. return {
  5077. label: item,
  5078. value: item
  5079. };
  5080. }
  5081. return $.extend({}, item, {
  5082. label: item.label || item.value,
  5083. value: item.value || item.label
  5084. });
  5085. });
  5086. },
  5087. _suggest: function (items) {
  5088. var ul = this.menu.element.empty();
  5089. this._renderMenu(ul, items);
  5090. this.isNewMenu = true;
  5091. this.menu.refresh();
  5092. // Size and position menu
  5093. ul.show();
  5094. this._resizeMenu();
  5095. ul.position($.extend({
  5096. of: this.element
  5097. }, this.options.position));
  5098. if (this.options.autoFocus) {
  5099. this.menu.next();
  5100. }
  5101. // Listen for interactions outside of the widget (#6642)
  5102. this._on(this.document, {
  5103. mousedown: "_closeOnClickOutside"
  5104. });
  5105. },
  5106. _resizeMenu: function () {
  5107. var ul = this.menu.element;
  5108. ul.outerWidth(Math.max(
  5109. // Firefox wraps long text (possibly a rounding bug)
  5110. // so we add 1px to avoid the wrapping (#7513)
  5111. ul.width("").outerWidth() + 1,
  5112. this.element.outerWidth()
  5113. ));
  5114. },
  5115. _renderMenu: function (ul, items) {
  5116. var that = this;
  5117. $.each(items, function (index, item) {
  5118. that._renderItemData(ul, item);
  5119. });
  5120. },
  5121. _renderItemData: function (ul, item) {
  5122. return this._renderItem(ul, item).data("ui-autocomplete-item", item);
  5123. },
  5124. _renderItem: function (ul, item) {
  5125. return $("<li>")
  5126. .append($("<div>").text(item.label))
  5127. .appendTo(ul);
  5128. },
  5129. _move: function (direction, event) {
  5130. if (!this.menu.element.is(":visible")) {
  5131. this.search(null, event);
  5132. return;
  5133. }
  5134. if (this.menu.isFirstItem() && /^previous/.test(direction) ||
  5135. this.menu.isLastItem() && /^next/.test(direction)) {
  5136. if (!this.isMultiLine) {
  5137. this._value(this.term);
  5138. }
  5139. this.menu.blur();
  5140. return;
  5141. }
  5142. this.menu[direction](event);
  5143. },
  5144. widget: function () {
  5145. return this.menu.element;
  5146. },
  5147. _value: function () {
  5148. return this.valueMethod.apply(this.element, arguments);
  5149. },
  5150. _keyEvent: function (keyEvent, event) {
  5151. if (!this.isMultiLine || this.menu.element.is(":visible")) {
  5152. this._move(keyEvent, event);
  5153. // Prevents moving cursor to beginning/end of the text field in some browsers
  5154. event.preventDefault();
  5155. }
  5156. },
  5157. // Support: Chrome <=50
  5158. // We should be able to just use this.element.prop( "isContentEditable" )
  5159. // but hidden elements always report false in Chrome.
  5160. // https://code.google.com/p/chromium/issues/detail?id=313082
  5161. _isContentEditable: function (element) {
  5162. if (!element.length) {
  5163. return false;
  5164. }
  5165. var editable = element.prop("contentEditable");
  5166. if (editable === "inherit") {
  5167. return this._isContentEditable(element.parent());
  5168. }
  5169. return editable === "true";
  5170. }
  5171. });
  5172. $.extend($.ui.autocomplete, {
  5173. escapeRegex: function (value) {
  5174. return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
  5175. },
  5176. filter: function (array, term) {
  5177. var matcher = new RegExp($.ui.autocomplete.escapeRegex(term), "i");
  5178. return $.grep(array, function (value) {
  5179. return matcher.test(value.label || value.value || value);
  5180. });
  5181. }
  5182. });
  5183. // Live region extension, adding a `messages` option
  5184. // NOTE: This is an experimental API. We are still investigating
  5185. // a full solution for string manipulation and internationalization.
  5186. $.widget("ui.autocomplete", $.ui.autocomplete, {
  5187. options: {
  5188. messages: {
  5189. noResults: "No search results.",
  5190. results: function (amount) {
  5191. return amount + (amount > 1 ? " results are" : " result is") +
  5192. " available, use up and down arrow keys to navigate.";
  5193. }
  5194. }
  5195. },
  5196. __response: function (content) {
  5197. var message;
  5198. this._superApply(arguments);
  5199. if (this.options.disabled || this.cancelSearch) {
  5200. return;
  5201. }
  5202. if (content && content.length) {
  5203. message = this.options.messages.results(content.length);
  5204. } else {
  5205. message = this.options.messages.noResults;
  5206. }
  5207. this.liveRegion.children().hide();
  5208. $("<div>").text(message).appendTo(this.liveRegion);
  5209. }
  5210. });
  5211. var widgetsAutocomplete = $.ui.autocomplete;
  5212. /*!
  5213. * jQuery UI Controlgroup 1.12.1
  5214. * http://jqueryui.com
  5215. *
  5216. * Copyright jQuery Foundation and other contributors
  5217. * Released under the MIT license.
  5218. * http://jquery.org/license
  5219. */
  5220. //>>label: Controlgroup
  5221. //>>group: Widgets
  5222. //>>description: Visually groups form control widgets
  5223. //>>docs: http://api.jqueryui.com/controlgroup/
  5224. //>>demos: http://jqueryui.com/controlgroup/
  5225. //>>css.structure: ../../themes/base/core.css
  5226. //>>css.structure: ../../themes/base/controlgroup.css
  5227. //>>css.theme: ../../themes/base/theme.css
  5228. var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g;
  5229. var widgetsControlgroup = $.widget("ui.controlgroup", {
  5230. version: "1.12.1",
  5231. defaultElement: "<div>",
  5232. options: {
  5233. direction: "horizontal",
  5234. disabled: null,
  5235. onlyVisible: true,
  5236. items: {
  5237. "button": "input[type=button], input[type=submit], input[type=reset], button, a",
  5238. "controlgroupLabel": ".ui-controlgroup-label",
  5239. "checkboxradio": "input[type='checkbox'], input[type='radio']",
  5240. "selectmenu": "select",
  5241. "spinner": ".ui-spinner-input"
  5242. }
  5243. },
  5244. _create: function () {
  5245. this._enhance();
  5246. },
  5247. // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation
  5248. _enhance: function () {
  5249. this.element.attr("role", "toolbar");
  5250. this.refresh();
  5251. },
  5252. _destroy: function () {
  5253. this._callChildMethod("destroy");
  5254. this.childWidgets.removeData("ui-controlgroup-data");
  5255. this.element.removeAttr("role");
  5256. if (this.options.items.controlgroupLabel) {
  5257. this.element
  5258. .find(this.options.items.controlgroupLabel)
  5259. .find(".ui-controlgroup-label-contents")
  5260. .contents().unwrap();
  5261. }
  5262. },
  5263. _initWidgets: function () {
  5264. var that = this,
  5265. childWidgets = [];
  5266. // First we iterate over each of the items options
  5267. $.each(this.options.items, function (widget, selector) {
  5268. var labels;
  5269. var options = {};
  5270. // Make sure the widget has a selector set
  5271. if (!selector) {
  5272. return;
  5273. }
  5274. if (widget === "controlgroupLabel") {
  5275. labels = that.element.find(selector);
  5276. labels.each(function () {
  5277. var element = $(this);
  5278. if (element.children(".ui-controlgroup-label-contents").length) {
  5279. return;
  5280. }
  5281. element.contents()
  5282. .wrapAll("<span class='ui-controlgroup-label-contents'></span>");
  5283. });
  5284. that._addClass(labels, null, "ui-widget ui-widget-content ui-state-default");
  5285. childWidgets = childWidgets.concat(labels.get());
  5286. return;
  5287. }
  5288. // Make sure the widget actually exists
  5289. if (!$.fn[widget]) {
  5290. return;
  5291. }
  5292. // We assume everything is in the middle to start because we can't determine
  5293. // first / last elements until all enhancments are done.
  5294. if (that["_" + widget + "Options"]) {
  5295. options = that["_" + widget + "Options"]("middle");
  5296. } else {
  5297. options = {classes: {}};
  5298. }
  5299. // Find instances of this widget inside controlgroup and init them
  5300. that.element
  5301. .find(selector)
  5302. .each(function () {
  5303. var element = $(this);
  5304. var instance = element[widget]("instance");
  5305. // We need to clone the default options for this type of widget to avoid
  5306. // polluting the variable options which has a wider scope than a single widget.
  5307. var instanceOptions = $.widget.extend({}, options);
  5308. // If the button is the child of a spinner ignore it
  5309. // TODO: Find a more generic solution
  5310. if (widget === "button" && element.parent(".ui-spinner").length) {
  5311. return;
  5312. }
  5313. // Create the widget if it doesn't exist
  5314. if (!instance) {
  5315. instance = element[widget]()[widget]("instance");
  5316. }
  5317. if (instance) {
  5318. instanceOptions.classes =
  5319. that._resolveClassesValues(instanceOptions.classes, instance);
  5320. }
  5321. element[widget](instanceOptions);
  5322. // Store an instance of the controlgroup to be able to reference
  5323. // from the outermost element for changing options and refresh
  5324. var widgetElement = element[widget]("widget");
  5325. $.data(widgetElement[0], "ui-controlgroup-data",
  5326. instance ? instance : element[widget]("instance"));
  5327. childWidgets.push(widgetElement[0]);
  5328. });
  5329. });
  5330. this.childWidgets = $($.unique(childWidgets));
  5331. this._addClass(this.childWidgets, "ui-controlgroup-item");
  5332. },
  5333. _callChildMethod: function (method) {
  5334. this.childWidgets.each(function () {
  5335. var element = $(this),
  5336. data = element.data("ui-controlgroup-data");
  5337. if (data && data[method]) {
  5338. data[method]();
  5339. }
  5340. });
  5341. },
  5342. _updateCornerClass: function (element, position) {
  5343. var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all";
  5344. var add = this._buildSimpleOptions(position, "label").classes.label;
  5345. this._removeClass(element, null, remove);
  5346. this._addClass(element, null, add);
  5347. },
  5348. _buildSimpleOptions: function (position, key) {
  5349. var direction = this.options.direction === "vertical";
  5350. var result = {
  5351. classes: {}
  5352. };
  5353. result.classes[key] = {
  5354. "middle": "",
  5355. "first": "ui-corner-" + (direction ? "top" : "left"),
  5356. "last": "ui-corner-" + (direction ? "bottom" : "right"),
  5357. "only": "ui-corner-all"
  5358. }[position];
  5359. return result;
  5360. },
  5361. _spinnerOptions: function (position) {
  5362. var options = this._buildSimpleOptions(position, "ui-spinner");
  5363. options.classes["ui-spinner-up"] = "";
  5364. options.classes["ui-spinner-down"] = "";
  5365. return options;
  5366. },
  5367. _buttonOptions: function (position) {
  5368. return this._buildSimpleOptions(position, "ui-button");
  5369. },
  5370. _checkboxradioOptions: function (position) {
  5371. return this._buildSimpleOptions(position, "ui-checkboxradio-label");
  5372. },
  5373. _selectmenuOptions: function (position) {
  5374. var direction = this.options.direction === "vertical";
  5375. return {
  5376. width: direction ? "auto" : false,
  5377. classes: {
  5378. middle: {
  5379. "ui-selectmenu-button-open": "",
  5380. "ui-selectmenu-button-closed": ""
  5381. },
  5382. first: {
  5383. "ui-selectmenu-button-open": "ui-corner-" + (direction ? "top" : "tl"),
  5384. "ui-selectmenu-button-closed": "ui-corner-" + (direction ? "top" : "left")
  5385. },
  5386. last: {
  5387. "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr",
  5388. "ui-selectmenu-button-closed": "ui-corner-" + (direction ? "bottom" : "right")
  5389. },
  5390. only: {
  5391. "ui-selectmenu-button-open": "ui-corner-top",
  5392. "ui-selectmenu-button-closed": "ui-corner-all"
  5393. }
  5394. }[position]
  5395. };
  5396. },
  5397. _resolveClassesValues: function (classes, instance) {
  5398. var result = {};
  5399. $.each(classes, function (key) {
  5400. var current = instance.options.classes[key] || "";
  5401. current = $.trim(current.replace(controlgroupCornerRegex, ""));
  5402. result[key] = (current + " " + classes[key]).replace(/\s+/g, " ");
  5403. });
  5404. return result;
  5405. },
  5406. _setOption: function (key, value) {
  5407. if (key === "direction") {
  5408. this._removeClass("ui-controlgroup-" + this.options.direction);
  5409. }
  5410. this._super(key, value);
  5411. if (key === "disabled") {
  5412. this._callChildMethod(value ? "disable" : "enable");
  5413. return;
  5414. }
  5415. this.refresh();
  5416. },
  5417. refresh: function () {
  5418. var children,
  5419. that = this;
  5420. this._addClass("ui-controlgroup ui-controlgroup-" + this.options.direction);
  5421. if (this.options.direction === "horizontal") {
  5422. this._addClass(null, "ui-helper-clearfix");
  5423. }
  5424. this._initWidgets();
  5425. children = this.childWidgets;
  5426. // We filter here because we need to track all childWidgets not just the visible ones
  5427. if (this.options.onlyVisible) {
  5428. children = children.filter(":visible");
  5429. }
  5430. if (children.length) {
  5431. // We do this last because we need to make sure all enhancment is done
  5432. // before determining first and last
  5433. $.each(["first", "last"], function (index, value) {
  5434. var instance = children[value]().data("ui-controlgroup-data");
  5435. if (instance && that["_" + instance.widgetName + "Options"]) {
  5436. var options = that["_" + instance.widgetName + "Options"](
  5437. children.length === 1 ? "only" : value
  5438. );
  5439. options.classes = that._resolveClassesValues(options.classes, instance);
  5440. instance.element[instance.widgetName](options);
  5441. } else {
  5442. that._updateCornerClass(children[value](), value);
  5443. }
  5444. });
  5445. // Finally call the refresh method on each of the child widgets.
  5446. this._callChildMethod("refresh");
  5447. }
  5448. }
  5449. });
  5450. /*!
  5451. * jQuery UI Checkboxradio 1.12.1
  5452. * http://jqueryui.com
  5453. *
  5454. * Copyright jQuery Foundation and other contributors
  5455. * Released under the MIT license.
  5456. * http://jquery.org/license
  5457. */
  5458. //>>label: Checkboxradio
  5459. //>>group: Widgets
  5460. //>>description: Enhances a form with multiple themeable checkboxes or radio buttons.
  5461. //>>docs: http://api.jqueryui.com/checkboxradio/
  5462. //>>demos: http://jqueryui.com/checkboxradio/
  5463. //>>css.structure: ../../themes/base/core.css
  5464. //>>css.structure: ../../themes/base/button.css
  5465. //>>css.structure: ../../themes/base/checkboxradio.css
  5466. //>>css.theme: ../../themes/base/theme.css
  5467. $.widget("ui.checkboxradio", [$.ui.formResetMixin, {
  5468. version: "1.12.1",
  5469. options: {
  5470. disabled: null,
  5471. label: null,
  5472. icon: true,
  5473. classes: {
  5474. "ui-checkboxradio-label": "ui-corner-all",
  5475. "ui-checkboxradio-icon": "ui-corner-all"
  5476. }
  5477. },
  5478. _getCreateOptions: function () {
  5479. var disabled, labels;
  5480. var that = this;
  5481. var options = this._super() || {};
  5482. // We read the type here, because it makes more sense to throw a element type error first,
  5483. // rather then the error for lack of a label. Often if its the wrong type, it
  5484. // won't have a label (e.g. calling on a div, btn, etc)
  5485. this._readType();
  5486. labels = this.element.labels();
  5487. // If there are multiple labels, use the last one
  5488. this.label = $(labels[labels.length - 1]);
  5489. if (!this.label.length) {
  5490. $.error("No label found for checkboxradio widget");
  5491. }
  5492. this.originalLabel = "";
  5493. // We need to get the label text but this may also need to make sure it does not contain the
  5494. // input itself.
  5495. this.label.contents().not(this.element[0]).each(function () {
  5496. // The label contents could be text, html, or a mix. We concat each element to get a
  5497. // string representation of the label, without the input as part of it.
  5498. that.originalLabel += this.nodeType === 3 ? $(this).text() : this.outerHTML;
  5499. });
  5500. // Set the label option if we found label text
  5501. if (this.originalLabel) {
  5502. options.label = this.originalLabel;
  5503. }
  5504. disabled = this.element[0].disabled;
  5505. if (disabled != null) {
  5506. options.disabled = disabled;
  5507. }
  5508. return options;
  5509. },
  5510. _create: function () {
  5511. var checked = this.element[0].checked;
  5512. this._bindFormResetHandler();
  5513. if (this.options.disabled == null) {
  5514. this.options.disabled = this.element[0].disabled;
  5515. }
  5516. this._setOption("disabled", this.options.disabled);
  5517. this._addClass("ui-checkboxradio", "ui-helper-hidden-accessible");
  5518. this._addClass(this.label, "ui-checkboxradio-label", "ui-button ui-widget");
  5519. if (this.type === "radio") {
  5520. this._addClass(this.label, "ui-checkboxradio-radio-label");
  5521. }
  5522. if (this.options.label && this.options.label !== this.originalLabel) {
  5523. this._updateLabel();
  5524. } else if (this.originalLabel) {
  5525. this.options.label = this.originalLabel;
  5526. }
  5527. this._enhance();
  5528. if (checked) {
  5529. this._addClass(this.label, "ui-checkboxradio-checked", "ui-state-active");
  5530. if (this.icon) {
  5531. this._addClass(this.icon, null, "ui-state-hover");
  5532. }
  5533. }
  5534. this._on({
  5535. change: "_toggleClasses",
  5536. focus: function () {
  5537. this._addClass(this.label, null, "ui-state-focus ui-visual-focus");
  5538. },
  5539. blur: function () {
  5540. this._removeClass(this.label, null, "ui-state-focus ui-visual-focus");
  5541. }
  5542. });
  5543. },
  5544. _readType: function () {
  5545. var nodeName = this.element[0].nodeName.toLowerCase();
  5546. this.type = this.element[0].type;
  5547. if (nodeName !== "input" || !/radio|checkbox/.test(this.type)) {
  5548. $.error("Can't create checkboxradio on element.nodeName=" + nodeName +
  5549. " and element.type=" + this.type);
  5550. }
  5551. },
  5552. // Support jQuery Mobile enhanced option
  5553. _enhance: function () {
  5554. this._updateIcon(this.element[0].checked);
  5555. },
  5556. widget: function () {
  5557. return this.label;
  5558. },
  5559. _getRadioGroup: function () {
  5560. var group;
  5561. var name = this.element[0].name;
  5562. var nameSelector = "input[name='" + $.ui.escapeSelector(name) + "']";
  5563. if (!name) {
  5564. return $([]);
  5565. }
  5566. if (this.form.length) {
  5567. group = $(this.form[0].elements).filter(nameSelector);
  5568. } else {
  5569. // Not inside a form, check all inputs that also are not inside a form
  5570. group = $(nameSelector).filter(function () {
  5571. return $(this).form().length === 0;
  5572. });
  5573. }
  5574. return group.not(this.element);
  5575. },
  5576. _toggleClasses: function () {
  5577. var checked = this.element[0].checked;
  5578. this._toggleClass(this.label, "ui-checkboxradio-checked", "ui-state-active", checked);
  5579. if (this.options.icon && this.type === "checkbox") {
  5580. this._toggleClass(this.icon, null, "ui-icon-check ui-state-checked", checked)
  5581. ._toggleClass(this.icon, null, "ui-icon-blank", !checked);
  5582. }
  5583. if (this.type === "radio") {
  5584. this._getRadioGroup()
  5585. .each(function () {
  5586. var instance = $(this).checkboxradio("instance");
  5587. if (instance) {
  5588. instance._removeClass(instance.label,
  5589. "ui-checkboxradio-checked", "ui-state-active");
  5590. }
  5591. });
  5592. }
  5593. },
  5594. _destroy: function () {
  5595. this._unbindFormResetHandler();
  5596. if (this.icon) {
  5597. this.icon.remove();
  5598. this.iconSpace.remove();
  5599. }
  5600. },
  5601. _setOption: function (key, value) {
  5602. // We don't allow the value to be set to nothing
  5603. if (key === "label" && !value) {
  5604. return;
  5605. }
  5606. this._super(key, value);
  5607. if (key === "disabled") {
  5608. this._toggleClass(this.label, null, "ui-state-disabled", value);
  5609. this.element[0].disabled = value;
  5610. // Don't refresh when setting disabled
  5611. return;
  5612. }
  5613. this.refresh();
  5614. },
  5615. _updateIcon: function (checked) {
  5616. var toAdd = "ui-icon ui-icon-background ";
  5617. if (this.options.icon) {
  5618. if (!this.icon) {
  5619. this.icon = $("<span>");
  5620. this.iconSpace = $("<span> </span>");
  5621. this._addClass(this.iconSpace, "ui-checkboxradio-icon-space");
  5622. }
  5623. if (this.type === "checkbox") {
  5624. toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank";
  5625. this._removeClass(this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check");
  5626. } else {
  5627. toAdd += "ui-icon-blank";
  5628. }
  5629. this._addClass(this.icon, "ui-checkboxradio-icon", toAdd);
  5630. if (!checked) {
  5631. this._removeClass(this.icon, null, "ui-icon-check ui-state-checked");
  5632. }
  5633. this.icon.prependTo(this.label).after(this.iconSpace);
  5634. } else if (this.icon !== undefined) {
  5635. this.icon.remove();
  5636. this.iconSpace.remove();
  5637. delete this.icon;
  5638. }
  5639. },
  5640. _updateLabel: function () {
  5641. // Remove the contents of the label ( minus the icon, icon space, and input )
  5642. var contents = this.label.contents().not(this.element[0]);
  5643. if (this.icon) {
  5644. contents = contents.not(this.icon[0]);
  5645. }
  5646. if (this.iconSpace) {
  5647. contents = contents.not(this.iconSpace[0]);
  5648. }
  5649. contents.remove();
  5650. this.label.append(this.options.label);
  5651. },
  5652. refresh: function () {
  5653. var checked = this.element[0].checked,
  5654. isDisabled = this.element[0].disabled;
  5655. this._updateIcon(checked);
  5656. this._toggleClass(this.label, "ui-checkboxradio-checked", "ui-state-active", checked);
  5657. if (this.options.label !== null) {
  5658. this._updateLabel();
  5659. }
  5660. if (isDisabled !== this.options.disabled) {
  5661. this._setOptions({"disabled": isDisabled});
  5662. }
  5663. }
  5664. }]);
  5665. var widgetsCheckboxradio = $.ui.checkboxradio;
  5666. /*!
  5667. * jQuery UI Button 1.12.1
  5668. * http://jqueryui.com
  5669. *
  5670. * Copyright jQuery Foundation and other contributors
  5671. * Released under the MIT license.
  5672. * http://jquery.org/license
  5673. */
  5674. //>>label: Button
  5675. //>>group: Widgets
  5676. //>>description: Enhances a form with themeable buttons.
  5677. //>>docs: http://api.jqueryui.com/button/
  5678. //>>demos: http://jqueryui.com/button/
  5679. //>>css.structure: ../../themes/base/core.css
  5680. //>>css.structure: ../../themes/base/button.css
  5681. //>>css.theme: ../../themes/base/theme.css
  5682. $.widget("ui.button", {
  5683. version: "1.12.1",
  5684. defaultElement: "<button>",
  5685. options: {
  5686. classes: {
  5687. "ui-button": "ui-corner-all"
  5688. },
  5689. disabled: null,
  5690. icon: null,
  5691. iconPosition: "beginning",
  5692. label: null,
  5693. showLabel: true
  5694. },
  5695. _getCreateOptions: function () {
  5696. var disabled,
  5697. // This is to support cases like in jQuery Mobile where the base widget does have
  5698. // an implementation of _getCreateOptions
  5699. options = this._super() || {};
  5700. this.isInput = this.element.is("input");
  5701. disabled = this.element[0].disabled;
  5702. if (disabled != null) {
  5703. options.disabled = disabled;
  5704. }
  5705. this.originalLabel = this.isInput ? this.element.val() : this.element.html();
  5706. if (this.originalLabel) {
  5707. options.label = this.originalLabel;
  5708. }
  5709. return options;
  5710. },
  5711. _create: function () {
  5712. if (!this.option.showLabel & !this.options.icon) {
  5713. this.options.showLabel = true;
  5714. }
  5715. // We have to check the option again here even though we did in _getCreateOptions,
  5716. // because null may have been passed on init which would override what was set in
  5717. // _getCreateOptions
  5718. if (this.options.disabled == null) {
  5719. this.options.disabled = this.element[0].disabled || false;
  5720. }
  5721. this.hasTitle = !!this.element.attr("title");
  5722. // Check to see if the label needs to be set or if its already correct
  5723. if (this.options.label && this.options.label !== this.originalLabel) {
  5724. if (this.isInput) {
  5725. this.element.val(this.options.label);
  5726. } else {
  5727. this.element.html(this.options.label);
  5728. }
  5729. }
  5730. this._addClass("ui-button", "ui-widget");
  5731. this._setOption("disabled", this.options.disabled);
  5732. this._enhance();
  5733. if (this.element.is("a")) {
  5734. this._on({
  5735. "keyup": function (event) {
  5736. if (event.keyCode === $.ui.keyCode.SPACE) {
  5737. event.preventDefault();
  5738. // Support: PhantomJS <= 1.9, IE 8 Only
  5739. // If a native click is available use it so we actually cause navigation
  5740. // otherwise just trigger a click event
  5741. if (this.element[0].click) {
  5742. this.element[0].click();
  5743. } else {
  5744. this.element.trigger("click");
  5745. }
  5746. }
  5747. }
  5748. });
  5749. }
  5750. },
  5751. _enhance: function () {
  5752. if (!this.element.is("button")) {
  5753. this.element.attr("role", "button");
  5754. }
  5755. if (this.options.icon) {
  5756. this._updateIcon("icon", this.options.icon);
  5757. this._updateTooltip();
  5758. }
  5759. },
  5760. _updateTooltip: function () {
  5761. this.title = this.element.attr("title");
  5762. if (!this.options.showLabel && !this.title) {
  5763. this.element.attr("title", this.options.label);
  5764. }
  5765. },
  5766. _updateIcon: function (option, value) {
  5767. var icon = option !== "iconPosition",
  5768. position = icon ? this.options.iconPosition : value,
  5769. displayBlock = position === "top" || position === "bottom";
  5770. // Create icon
  5771. if (!this.icon) {
  5772. this.icon = $("<span>");
  5773. this._addClass(this.icon, "ui-button-icon", "ui-icon");
  5774. if (!this.options.showLabel) {
  5775. this._addClass("ui-button-icon-only");
  5776. }
  5777. } else if (icon) {
  5778. // If we are updating the icon remove the old icon class
  5779. this._removeClass(this.icon, null, this.options.icon);
  5780. }
  5781. // If we are updating the icon add the new icon class
  5782. if (icon) {
  5783. this._addClass(this.icon, null, value);
  5784. }
  5785. this._attachIcon(position);
  5786. // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove
  5787. // the iconSpace if there is one.
  5788. if (displayBlock) {
  5789. this._addClass(this.icon, null, "ui-widget-icon-block");
  5790. if (this.iconSpace) {
  5791. this.iconSpace.remove();
  5792. }
  5793. } else {
  5794. // Position is beginning or end so remove the ui-widget-icon-block class and add the
  5795. // space if it does not exist
  5796. if (!this.iconSpace) {
  5797. this.iconSpace = $("<span> </span>");
  5798. this._addClass(this.iconSpace, "ui-button-icon-space");
  5799. }
  5800. this._removeClass(this.icon, null, "ui-wiget-icon-block");
  5801. this._attachIconSpace(position);
  5802. }
  5803. },
  5804. _destroy: function () {
  5805. this.element.removeAttr("role");
  5806. if (this.icon) {
  5807. this.icon.remove();
  5808. }
  5809. if (this.iconSpace) {
  5810. this.iconSpace.remove();
  5811. }
  5812. if (!this.hasTitle) {
  5813. this.element.removeAttr("title");
  5814. }
  5815. },
  5816. _attachIconSpace: function (iconPosition) {
  5817. this.icon[/^(?:end|bottom)/.test(iconPosition) ? "before" : "after"](this.iconSpace);
  5818. },
  5819. _attachIcon: function (iconPosition) {
  5820. this.element[/^(?:end|bottom)/.test(iconPosition) ? "append" : "prepend"](this.icon);
  5821. },
  5822. _setOptions: function (options) {
  5823. var newShowLabel = options.showLabel === undefined ?
  5824. this.options.showLabel :
  5825. options.showLabel,
  5826. newIcon = options.icon === undefined ? this.options.icon : options.icon;
  5827. if (!newShowLabel && !newIcon) {
  5828. options.showLabel = true;
  5829. }
  5830. this._super(options);
  5831. },
  5832. _setOption: function (key, value) {
  5833. if (key === "icon") {
  5834. if (value) {
  5835. this._updateIcon(key, value);
  5836. } else if (this.icon) {
  5837. this.icon.remove();
  5838. if (this.iconSpace) {
  5839. this.iconSpace.remove();
  5840. }
  5841. }
  5842. }
  5843. if (key === "iconPosition") {
  5844. this._updateIcon(key, value);
  5845. }
  5846. // Make sure we can't end up with a button that has neither text nor icon
  5847. if (key === "showLabel") {
  5848. this._toggleClass("ui-button-icon-only", null, !value);
  5849. this._updateTooltip();
  5850. }
  5851. if (key === "label") {
  5852. if (this.isInput) {
  5853. this.element.val(value);
  5854. } else {
  5855. // If there is an icon, append it, else nothing then append the value
  5856. // this avoids removal of the icon when setting label text
  5857. this.element.html(value);
  5858. if (this.icon) {
  5859. this._attachIcon(this.options.iconPosition);
  5860. this._attachIconSpace(this.options.iconPosition);
  5861. }
  5862. }
  5863. }
  5864. this._super(key, value);
  5865. if (key === "disabled") {
  5866. this._toggleClass(null, "ui-state-disabled", value);
  5867. this.element[0].disabled = value;
  5868. if (value) {
  5869. this.element.blur();
  5870. }
  5871. }
  5872. },
  5873. refresh: function () {
  5874. // Make sure to only check disabled if its an element that supports this otherwise
  5875. // check for the disabled class to determine state
  5876. var isDisabled = this.element.is("input, button") ?
  5877. this.element[0].disabled : this.element.hasClass("ui-button-disabled");
  5878. if (isDisabled !== this.options.disabled) {
  5879. this._setOptions({disabled: isDisabled});
  5880. }
  5881. this._updateTooltip();
  5882. }
  5883. });
  5884. // DEPRECATED
  5885. if ($.uiBackCompat !== false) {
  5886. // Text and Icons options
  5887. $.widget("ui.button", $.ui.button, {
  5888. options: {
  5889. text: true,
  5890. icons: {
  5891. primary: null,
  5892. secondary: null
  5893. }
  5894. },
  5895. _create: function () {
  5896. if (this.options.showLabel && !this.options.text) {
  5897. this.options.showLabel = this.options.text;
  5898. }
  5899. if (!this.options.showLabel && this.options.text) {
  5900. this.options.text = this.options.showLabel;
  5901. }
  5902. if (!this.options.icon && (this.options.icons.primary ||
  5903. this.options.icons.secondary)) {
  5904. if (this.options.icons.primary) {
  5905. this.options.icon = this.options.icons.primary;
  5906. } else {
  5907. this.options.icon = this.options.icons.secondary;
  5908. this.options.iconPosition = "end";
  5909. }
  5910. } else if (this.options.icon) {
  5911. this.options.icons.primary = this.options.icon;
  5912. }
  5913. this._super();
  5914. },
  5915. _setOption: function (key, value) {
  5916. if (key === "text") {
  5917. this._super("showLabel", value);
  5918. return;
  5919. }
  5920. if (key === "showLabel") {
  5921. this.options.text = value;
  5922. }
  5923. if (key === "icon") {
  5924. this.options.icons.primary = value;
  5925. }
  5926. if (key === "icons") {
  5927. if (value.primary) {
  5928. this._super("icon", value.primary);
  5929. this._super("iconPosition", "beginning");
  5930. } else if (value.secondary) {
  5931. this._super("icon", value.secondary);
  5932. this._super("iconPosition", "end");
  5933. }
  5934. }
  5935. this._superApply(arguments);
  5936. }
  5937. });
  5938. $.fn.button = (function (orig) {
  5939. return function () {
  5940. if (!this.length || (this.length && this[0].tagName !== "INPUT") ||
  5941. (this.length && this[0].tagName === "INPUT" && (
  5942. this.attr("type") !== "checkbox" && this.attr("type") !== "radio"
  5943. ))) {
  5944. return orig.apply(this, arguments);
  5945. }
  5946. if (!$.ui.checkboxradio) {
  5947. $.error("Checkboxradio widget missing");
  5948. }
  5949. if (arguments.length === 0) {
  5950. return this.checkboxradio({
  5951. "icon": false
  5952. });
  5953. }
  5954. return this.checkboxradio.apply(this, arguments);
  5955. };
  5956. })($.fn.button);
  5957. $.fn.buttonset = function () {
  5958. if (!$.ui.controlgroup) {
  5959. $.error("Controlgroup widget missing");
  5960. }
  5961. if (arguments[0] === "option" && arguments[1] === "items" && arguments[2]) {
  5962. return this.controlgroup.apply(this,
  5963. [arguments[0], "items.button", arguments[2]]);
  5964. }
  5965. if (arguments[0] === "option" && arguments[1] === "items") {
  5966. return this.controlgroup.apply(this, [arguments[0], "items.button"]);
  5967. }
  5968. if (typeof arguments[0] === "object" && arguments[0].items) {
  5969. arguments[0].items = {
  5970. button: arguments[0].items
  5971. };
  5972. }
  5973. return this.controlgroup.apply(this, arguments);
  5974. };
  5975. }
  5976. var widgetsButton = $.ui.button;
  5977. // jscs:disable maximumLineLength
  5978. /* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
  5979. /*!
  5980. * jQuery UI Datepicker 1.12.1
  5981. * http://jqueryui.com
  5982. *
  5983. * Copyright jQuery Foundation and other contributors
  5984. * Released under the MIT license.
  5985. * http://jquery.org/license
  5986. */
  5987. //>>label: Datepicker
  5988. //>>group: Widgets
  5989. //>>description: Displays a calendar from an input or inline for selecting dates.
  5990. //>>docs: http://api.jqueryui.com/datepicker/
  5991. //>>demos: http://jqueryui.com/datepicker/
  5992. //>>css.structure: ../../themes/base/core.css
  5993. //>>css.structure: ../../themes/base/datepicker.css
  5994. //>>css.theme: ../../themes/base/theme.css
  5995. $.extend($.ui, {datepicker: {version: "1.12.1"}});
  5996. var datepicker_instActive;
  5997. function datepicker_getZindex(elem) {
  5998. var position, value;
  5999. while (elem.length && elem[0] !== document) {
  6000. // Ignore z-index if position is set to a value where z-index is ignored by the browser
  6001. // This makes behavior of this function consistent across browsers
  6002. // WebKit always returns auto if the element is positioned
  6003. position = elem.css("position");
  6004. if (position === "absolute" || position === "relative" || position === "fixed") {
  6005. // IE returns 0 when zIndex is not specified
  6006. // other browsers return a string
  6007. // we ignore the case of nested elements with an explicit value of 0
  6008. // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
  6009. value = parseInt(elem.css("zIndex"), 10);
  6010. if (!isNaN(value) && value !== 0) {
  6011. return value;
  6012. }
  6013. }
  6014. elem = elem.parent();
  6015. }
  6016. return 0;
  6017. }
  6018. /* Date picker manager.
  6019. Use the singleton instance of this class, $.datepicker, to interact with the date picker.
  6020. Settings for (groups of) date pickers are maintained in an instance object,
  6021. allowing multiple different settings on the same page. */
  6022. function Datepicker() {
  6023. this._curInst = null; // The current instance in use
  6024. this._keyEvent = false; // If the last event was a key event
  6025. this._disabledInputs = []; // List of date picker inputs that have been disabled
  6026. this._datepickerShowing = false; // True if the popup picker is showing , false if not
  6027. this._inDialog = false; // True if showing within a "dialog", false if not
  6028. this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division
  6029. this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class
  6030. this._appendClass = "ui-datepicker-append"; // The name of the append marker class
  6031. this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class
  6032. this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class
  6033. this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class
  6034. this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class
  6035. this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class
  6036. this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class
  6037. this.regional = []; // Available regional settings, indexed by language code
  6038. this.regional[""] = { // Default regional settings
  6039. closeText: "Done", // Display text for close link
  6040. prevText: "Prev", // Display text for previous month link
  6041. nextText: "Next", // Display text for next month link
  6042. currentText: "Today", // Display text for current month link
  6043. monthNames: ["January", "February", "March", "April", "May", "June",
  6044. "July", "August", "September", "October", "November", "December"], // Names of months for drop-down and formatting
  6045. monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting
  6046. dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting
  6047. dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting
  6048. dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], // Column headings for days starting at Sunday
  6049. weekHeader: "Wk", // Column header for week of the year
  6050. dateFormat: "mm/dd/yy", // See format options on parseDate
  6051. firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
  6052. isRTL: false, // True if right-to-left language, false if left-to-right
  6053. showMonthAfterYear: false, // True if the year select precedes month, false for month then year
  6054. yearSuffix: "" // Additional text to append to the year in the month headers
  6055. };
  6056. this._defaults = { // Global defaults for all the date picker instances
  6057. showOn: "focus", // "focus" for popup on focus,
  6058. // "button" for trigger button, or "both" for either
  6059. showAnim: "fadeIn", // Name of jQuery animation for popup
  6060. showOptions: {}, // Options for enhanced animations
  6061. defaultDate: null, // Used when field is blank: actual date,
  6062. // +/-number for offset from today, null for today
  6063. appendText: "", // Display text following the input box, e.g. showing the format
  6064. buttonText: "...", // Text for trigger button
  6065. buttonImage: "", // URL for trigger button image
  6066. buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
  6067. hideIfNoPrevNext: false, // True to hide next/previous month links
  6068. // if not applicable, false to just disable them
  6069. navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
  6070. gotoCurrent: false, // True if today link goes back to current selection instead
  6071. changeMonth: false, // True if month can be selected directly, false if only prev/next
  6072. changeYear: false, // True if year can be selected directly, false if only prev/next
  6073. yearRange: "c-10:c+10", // Range of years to display in drop-down,
  6074. // either relative to today's year (-nn:+nn), relative to currently displayed year
  6075. // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
  6076. showOtherMonths: false, // True to show dates in other months, false to leave blank
  6077. selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
  6078. showWeek: false, // True to show week of the year, false to not show it
  6079. calculateWeek: this.iso8601Week, // How to calculate the week of the year,
  6080. // takes a Date and returns the number of the week for it
  6081. shortYearCutoff: "+10", // Short year values < this are in the current century,
  6082. // > this are in the previous century,
  6083. // string value starting with "+" for current year + value
  6084. minDate: null, // The earliest selectable date, or null for no limit
  6085. maxDate: null, // The latest selectable date, or null for no limit
  6086. duration: "fast", // Duration of display/closure
  6087. beforeShowDay: null, // Function that takes a date and returns an array with
  6088. // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
  6089. // [2] = cell title (optional), e.g. $.datepicker.noWeekends
  6090. beforeShow: null, // Function that takes an input field and
  6091. // returns a set of custom settings for the date picker
  6092. onSelect: null, // Define a callback function when a date is selected
  6093. onChangeMonthYear: null, // Define a callback function when the month or year is changed
  6094. onClose: null, // Define a callback function when the datepicker is closed
  6095. numberOfMonths: 1, // Number of months to show at a time
  6096. showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
  6097. stepMonths: 1, // Number of months to step back/forward
  6098. stepBigMonths: 12, // Number of months to step back/forward for the big links
  6099. altField: "", // Selector for an alternate field to store selected dates into
  6100. altFormat: "", // The date format to use for the alternate field
  6101. constrainInput: true, // The input is constrained by the current date format
  6102. showButtonPanel: false, // True to show button panel, false to not show it
  6103. autoSize: false, // True to size the input for the date format, false to leave as is
  6104. disabled: false // The initial disabled state
  6105. };
  6106. $.extend(this._defaults, this.regional[""]);
  6107. this.regional.en = $.extend(true, {}, this.regional[""]);
  6108. this.regional["en-US"] = $.extend(true, {}, this.regional.en);
  6109. this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"));
  6110. }
  6111. $.extend(Datepicker.prototype, {
  6112. /* Class name added to elements to indicate already configured with a date picker. */
  6113. markerClassName: "hasDatepicker",
  6114. //Keep track of the maximum number of rows displayed (see #7043)
  6115. maxRows: 4,
  6116. // TODO rename to "widget" when switching to widget factory
  6117. _widgetDatepicker: function () {
  6118. return this.dpDiv;
  6119. },
  6120. /* Override the default settings for all instances of the date picker.
  6121. * @param settings object - the new settings to use as defaults (anonymous object)
  6122. * @return the manager object
  6123. */
  6124. setDefaults: function (settings) {
  6125. datepicker_extendRemove(this._defaults, settings || {});
  6126. return this;
  6127. },
  6128. /* Attach the date picker to a jQuery selection.
  6129. * @param target element - the target input field or division or span
  6130. * @param settings object - the new settings to use for this date picker instance (anonymous)
  6131. */
  6132. _attachDatepicker: function (target, settings) {
  6133. var nodeName, inline, inst;
  6134. nodeName = target.nodeName.toLowerCase();
  6135. inline = (nodeName === "div" || nodeName === "span");
  6136. if (!target.id) {
  6137. this.uuid += 1;
  6138. target.id = "dp" + this.uuid;
  6139. }
  6140. inst = this._newInst($(target), inline);
  6141. inst.settings = $.extend({}, settings || {});
  6142. if (nodeName === "input") {
  6143. this._connectDatepicker(target, inst);
  6144. } else if (inline) {
  6145. this._inlineDatepicker(target, inst);
  6146. }
  6147. },
  6148. /* Create a new instance object. */
  6149. _newInst: function (target, inline) {
  6150. var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars
  6151. return {
  6152. id: id, input: target, // associated target
  6153. selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
  6154. drawMonth: 0, drawYear: 0, // month being drawn
  6155. inline: inline, // is datepicker inline or not
  6156. dpDiv: (!inline ? this.dpDiv : // presentation div
  6157. datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")))
  6158. };
  6159. },
  6160. /* Attach the date picker to an input field. */
  6161. _connectDatepicker: function (target, inst) {
  6162. var input = $(target);
  6163. inst.append = $([]);
  6164. inst.trigger = $([]);
  6165. if (input.hasClass(this.markerClassName)) {
  6166. return;
  6167. }
  6168. this._attachments(input, inst);
  6169. input.addClass(this.markerClassName).on("keydown", this._doKeyDown).on("keypress", this._doKeyPress).on("keyup", this._doKeyUp);
  6170. this._autoSize(inst);
  6171. $.data(target, "datepicker", inst);
  6172. //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
  6173. if (inst.settings.disabled) {
  6174. this._disableDatepicker(target);
  6175. }
  6176. },
  6177. /* Make attachments based on settings. */
  6178. _attachments: function (input, inst) {
  6179. var showOn, buttonText, buttonImage,
  6180. appendText = this._get(inst, "appendText"),
  6181. isRTL = this._get(inst, "isRTL");
  6182. if (inst.append) {
  6183. inst.append.remove();
  6184. }
  6185. if (appendText) {
  6186. inst.append = $("<span class='" + this._appendClass + "'>" + appendText + "</span>");
  6187. input[isRTL ? "before" : "after"](inst.append);
  6188. }
  6189. input.off("focus", this._showDatepicker);
  6190. if (inst.trigger) {
  6191. inst.trigger.remove();
  6192. }
  6193. showOn = this._get(inst, "showOn");
  6194. if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field
  6195. input.on("focus", this._showDatepicker);
  6196. }
  6197. if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked
  6198. buttonText = this._get(inst, "buttonText");
  6199. buttonImage = this._get(inst, "buttonImage");
  6200. inst.trigger = $(this._get(inst, "buttonImageOnly") ?
  6201. $("<img/>").addClass(this._triggerClass).attr({
  6202. src: buttonImage,
  6203. alt: buttonText,
  6204. title: buttonText
  6205. }) :
  6206. $("<button type='button'></button>").addClass(this._triggerClass).html(!buttonImage ? buttonText : $("<img/>").attr(
  6207. {src: buttonImage, alt: buttonText, title: buttonText})));
  6208. input[isRTL ? "before" : "after"](inst.trigger);
  6209. inst.trigger.on("click", function () {
  6210. if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) {
  6211. $.datepicker._hideDatepicker();
  6212. } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) {
  6213. $.datepicker._hideDatepicker();
  6214. $.datepicker._showDatepicker(input[0]);
  6215. } else {
  6216. $.datepicker._showDatepicker(input[0]);
  6217. }
  6218. return false;
  6219. });
  6220. }
  6221. },
  6222. /* Apply the maximum length for the date format. */
  6223. _autoSize: function (inst) {
  6224. if (this._get(inst, "autoSize") && !inst.inline) {
  6225. var findMax, max, maxI, i,
  6226. date = new Date(2009, 12 - 1, 20), // Ensure double digits
  6227. dateFormat = this._get(inst, "dateFormat");
  6228. if (dateFormat.match(/[DM]/)) {
  6229. findMax = function (names) {
  6230. max = 0;
  6231. maxI = 0;
  6232. for (i = 0; i < names.length; i++) {
  6233. if (names[i].length > max) {
  6234. max = names[i].length;
  6235. maxI = i;
  6236. }
  6237. }
  6238. return maxI;
  6239. };
  6240. date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
  6241. "monthNames" : "monthNamesShort"))));
  6242. date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
  6243. "dayNames" : "dayNamesShort"))) + 20 - date.getDay());
  6244. }
  6245. inst.input.attr("size", this._formatDate(inst, date).length);
  6246. }
  6247. },
  6248. /* Attach an inline date picker to a div. */
  6249. _inlineDatepicker: function (target, inst) {
  6250. var divSpan = $(target);
  6251. if (divSpan.hasClass(this.markerClassName)) {
  6252. return;
  6253. }
  6254. divSpan.addClass(this.markerClassName).append(inst.dpDiv);
  6255. $.data(target, "datepicker", inst);
  6256. this._setDate(inst, this._getDefaultDate(inst), true);
  6257. this._updateDatepicker(inst);
  6258. this._updateAlternate(inst);
  6259. //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
  6260. if (inst.settings.disabled) {
  6261. this._disableDatepicker(target);
  6262. }
  6263. // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
  6264. // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
  6265. inst.dpDiv.css("display", "block");
  6266. },
  6267. /* Pop-up the date picker in a "dialog" box.
  6268. * @param input element - ignored
  6269. * @param date string or Date - the initial date to display
  6270. * @param onSelect function - the function to call when a date is selected
  6271. * @param settings object - update the dialog date picker instance's settings (anonymous object)
  6272. * @param pos int[2] - coordinates for the dialog's position within the screen or
  6273. * event - with x/y coordinates or
  6274. * leave empty for default (screen centre)
  6275. * @return the manager object
  6276. */
  6277. _dialogDatepicker: function (input, date, onSelect, settings, pos) {
  6278. var id, browserWidth, browserHeight, scrollX, scrollY,
  6279. inst = this._dialogInst; // internal instance
  6280. if (!inst) {
  6281. this.uuid += 1;
  6282. id = "dp" + this.uuid;
  6283. this._dialogInput = $("<input type='text' id='" + id +
  6284. "' style='position: absolute; top: -100px; width: 0px;'/>");
  6285. this._dialogInput.on("keydown", this._doKeyDown);
  6286. $("body").append(this._dialogInput);
  6287. inst = this._dialogInst = this._newInst(this._dialogInput, false);
  6288. inst.settings = {};
  6289. $.data(this._dialogInput[0], "datepicker", inst);
  6290. }
  6291. datepicker_extendRemove(inst.settings, settings || {});
  6292. date = (date && date.constructor === Date ? this._formatDate(inst, date) : date);
  6293. this._dialogInput.val(date);
  6294. this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
  6295. if (!this._pos) {
  6296. browserWidth = document.documentElement.clientWidth;
  6297. browserHeight = document.documentElement.clientHeight;
  6298. scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
  6299. scrollY = document.documentElement.scrollTop || document.body.scrollTop;
  6300. this._pos = // should use actual width/height below
  6301. [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
  6302. }
  6303. // Move input on screen for focus, but hidden behind dialog
  6304. this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px");
  6305. inst.settings.onSelect = onSelect;
  6306. this._inDialog = true;
  6307. this.dpDiv.addClass(this._dialogClass);
  6308. this._showDatepicker(this._dialogInput[0]);
  6309. if ($.blockUI) {
  6310. $.blockUI(this.dpDiv);
  6311. }
  6312. $.data(this._dialogInput[0], "datepicker", inst);
  6313. return this;
  6314. },
  6315. /* Detach a datepicker from its control.
  6316. * @param target element - the target input field or division or span
  6317. */
  6318. _destroyDatepicker: function (target) {
  6319. var nodeName,
  6320. $target = $(target),
  6321. inst = $.data(target, "datepicker");
  6322. if (!$target.hasClass(this.markerClassName)) {
  6323. return;
  6324. }
  6325. nodeName = target.nodeName.toLowerCase();
  6326. $.removeData(target, "datepicker");
  6327. if (nodeName === "input") {
  6328. inst.append.remove();
  6329. inst.trigger.remove();
  6330. $target.removeClass(this.markerClassName).off("focus", this._showDatepicker).off("keydown", this._doKeyDown).off("keypress", this._doKeyPress).off("keyup", this._doKeyUp);
  6331. } else if (nodeName === "div" || nodeName === "span") {
  6332. $target.removeClass(this.markerClassName).empty();
  6333. }
  6334. if (datepicker_instActive === inst) {
  6335. datepicker_instActive = null;
  6336. }
  6337. },
  6338. /* Enable the date picker to a jQuery selection.
  6339. * @param target element - the target input field or division or span
  6340. */
  6341. _enableDatepicker: function (target) {
  6342. var nodeName, inline,
  6343. $target = $(target),
  6344. inst = $.data(target, "datepicker");
  6345. if (!$target.hasClass(this.markerClassName)) {
  6346. return;
  6347. }
  6348. nodeName = target.nodeName.toLowerCase();
  6349. if (nodeName === "input") {
  6350. target.disabled = false;
  6351. inst.trigger.filter("button").each(function () {
  6352. this.disabled = false;
  6353. }).end().filter("img").css({opacity: "1.0", cursor: ""});
  6354. } else if (nodeName === "div" || nodeName === "span") {
  6355. inline = $target.children("." + this._inlineClass);
  6356. inline.children().removeClass("ui-state-disabled");
  6357. inline.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled", false);
  6358. }
  6359. this._disabledInputs = $.map(this._disabledInputs,
  6360. function (value) {
  6361. return (value === target ? null : value);
  6362. }); // delete entry
  6363. },
  6364. /* Disable the date picker to a jQuery selection.
  6365. * @param target element - the target input field or division or span
  6366. */
  6367. _disableDatepicker: function (target) {
  6368. var nodeName, inline,
  6369. $target = $(target),
  6370. inst = $.data(target, "datepicker");
  6371. if (!$target.hasClass(this.markerClassName)) {
  6372. return;
  6373. }
  6374. nodeName = target.nodeName.toLowerCase();
  6375. if (nodeName === "input") {
  6376. target.disabled = true;
  6377. inst.trigger.filter("button").each(function () {
  6378. this.disabled = true;
  6379. }).end().filter("img").css({opacity: "0.5", cursor: "default"});
  6380. } else if (nodeName === "div" || nodeName === "span") {
  6381. inline = $target.children("." + this._inlineClass);
  6382. inline.children().addClass("ui-state-disabled");
  6383. inline.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled", true);
  6384. }
  6385. this._disabledInputs = $.map(this._disabledInputs,
  6386. function (value) {
  6387. return (value === target ? null : value);
  6388. }); // delete entry
  6389. this._disabledInputs[this._disabledInputs.length] = target;
  6390. },
  6391. /* Is the first field in a jQuery collection disabled as a datepicker?
  6392. * @param target element - the target input field or division or span
  6393. * @return boolean - true if disabled, false if enabled
  6394. */
  6395. _isDisabledDatepicker: function (target) {
  6396. if (!target) {
  6397. return false;
  6398. }
  6399. for (var i = 0; i < this._disabledInputs.length; i++) {
  6400. if (this._disabledInputs[i] === target) {
  6401. return true;
  6402. }
  6403. }
  6404. return false;
  6405. },
  6406. /* Retrieve the instance data for the target control.
  6407. * @param target element - the target input field or division or span
  6408. * @return object - the associated instance data
  6409. * @throws error if a jQuery problem getting data
  6410. */
  6411. _getInst: function (target) {
  6412. try {
  6413. return $.data(target, "datepicker");
  6414. } catch (err) {
  6415. throw "Missing instance data for this datepicker";
  6416. }
  6417. },
  6418. /* Update or retrieve the settings for a date picker attached to an input field or division.
  6419. * @param target element - the target input field or division or span
  6420. * @param name object - the new settings to update or
  6421. * string - the name of the setting to change or retrieve,
  6422. * when retrieving also "all" for all instance settings or
  6423. * "defaults" for all global defaults
  6424. * @param value any - the new value for the setting
  6425. * (omit if above is an object or to retrieve a value)
  6426. */
  6427. _optionDatepicker: function (target, name, value) {
  6428. var settings, date, minDate, maxDate,
  6429. inst = this._getInst(target);
  6430. if (arguments.length === 2 && typeof name === "string") {
  6431. return (name === "defaults" ? $.extend({}, $.datepicker._defaults) :
  6432. (inst ? (name === "all" ? $.extend({}, inst.settings) :
  6433. this._get(inst, name)) : null));
  6434. }
  6435. settings = name || {};
  6436. if (typeof name === "string") {
  6437. settings = {};
  6438. settings[name] = value;
  6439. }
  6440. if (inst) {
  6441. if (this._curInst === inst) {
  6442. this._hideDatepicker();
  6443. }
  6444. date = this._getDateDatepicker(target, true);
  6445. minDate = this._getMinMaxDate(inst, "min");
  6446. maxDate = this._getMinMaxDate(inst, "max");
  6447. datepicker_extendRemove(inst.settings, settings);
  6448. // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
  6449. if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) {
  6450. inst.settings.minDate = this._formatDate(inst, minDate);
  6451. }
  6452. if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) {
  6453. inst.settings.maxDate = this._formatDate(inst, maxDate);
  6454. }
  6455. if ("disabled" in settings) {
  6456. if (settings.disabled) {
  6457. this._disableDatepicker(target);
  6458. } else {
  6459. this._enableDatepicker(target);
  6460. }
  6461. }
  6462. this._attachments($(target), inst);
  6463. this._autoSize(inst);
  6464. this._setDate(inst, date);
  6465. this._updateAlternate(inst);
  6466. this._updateDatepicker(inst);
  6467. }
  6468. },
  6469. // Change method deprecated
  6470. _changeDatepicker: function (target, name, value) {
  6471. this._optionDatepicker(target, name, value);
  6472. },
  6473. /* Redraw the date picker attached to an input field or division.
  6474. * @param target element - the target input field or division or span
  6475. */
  6476. _refreshDatepicker: function (target) {
  6477. var inst = this._getInst(target);
  6478. if (inst) {
  6479. this._updateDatepicker(inst);
  6480. }
  6481. },
  6482. /* Set the dates for a jQuery selection.
  6483. * @param target element - the target input field or division or span
  6484. * @param date Date - the new date
  6485. */
  6486. _setDateDatepicker: function (target, date) {
  6487. var inst = this._getInst(target);
  6488. if (inst) {
  6489. this._setDate(inst, date);
  6490. this._updateDatepicker(inst);
  6491. this._updateAlternate(inst);
  6492. }
  6493. },
  6494. /* Get the date(s) for the first entry in a jQuery selection.
  6495. * @param target element - the target input field or division or span
  6496. * @param noDefault boolean - true if no default date is to be used
  6497. * @return Date - the current date
  6498. */
  6499. _getDateDatepicker: function (target, noDefault) {
  6500. var inst = this._getInst(target);
  6501. if (inst && !inst.inline) {
  6502. this._setDateFromField(inst, noDefault);
  6503. }
  6504. return (inst ? this._getDate(inst) : null);
  6505. },
  6506. /* Handle keystrokes. */
  6507. _doKeyDown: function (event) {
  6508. var onSelect, dateStr, sel,
  6509. inst = $.datepicker._getInst(event.target),
  6510. handled = true,
  6511. isRTL = inst.dpDiv.is(".ui-datepicker-rtl");
  6512. inst._keyEvent = true;
  6513. if ($.datepicker._datepickerShowing) {
  6514. switch (event.keyCode) {
  6515. case 9:
  6516. $.datepicker._hideDatepicker();
  6517. handled = false;
  6518. break; // hide on tab out
  6519. case 13:
  6520. sel = $("td." + $.datepicker._dayOverClass + ":not(." +
  6521. $.datepicker._currentClass + ")", inst.dpDiv);
  6522. if (sel[0]) {
  6523. $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
  6524. }
  6525. onSelect = $.datepicker._get(inst, "onSelect");
  6526. if (onSelect) {
  6527. dateStr = $.datepicker._formatDate(inst);
  6528. // Trigger custom callback
  6529. onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
  6530. } else {
  6531. $.datepicker._hideDatepicker();
  6532. }
  6533. return false; // don't submit the form
  6534. case 27:
  6535. $.datepicker._hideDatepicker();
  6536. break; // hide on escape
  6537. case 33:
  6538. $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  6539. -$.datepicker._get(inst, "stepBigMonths") :
  6540. -$.datepicker._get(inst, "stepMonths")), "M");
  6541. break; // previous month/year on page up/+ ctrl
  6542. case 34:
  6543. $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  6544. +$.datepicker._get(inst, "stepBigMonths") :
  6545. +$.datepicker._get(inst, "stepMonths")), "M");
  6546. break; // next month/year on page down/+ ctrl
  6547. case 35:
  6548. if (event.ctrlKey || event.metaKey) {
  6549. $.datepicker._clearDate(event.target);
  6550. }
  6551. handled = event.ctrlKey || event.metaKey;
  6552. break; // clear on ctrl or command +end
  6553. case 36:
  6554. if (event.ctrlKey || event.metaKey) {
  6555. $.datepicker._gotoToday(event.target);
  6556. }
  6557. handled = event.ctrlKey || event.metaKey;
  6558. break; // current on ctrl or command +home
  6559. case 37:
  6560. if (event.ctrlKey || event.metaKey) {
  6561. $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D");
  6562. }
  6563. handled = event.ctrlKey || event.metaKey;
  6564. // -1 day on ctrl or command +left
  6565. if (event.originalEvent.altKey) {
  6566. $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  6567. -$.datepicker._get(inst, "stepBigMonths") :
  6568. -$.datepicker._get(inst, "stepMonths")), "M");
  6569. }
  6570. // next month/year on alt +left on Mac
  6571. break;
  6572. case 38:
  6573. if (event.ctrlKey || event.metaKey) {
  6574. $.datepicker._adjustDate(event.target, -7, "D");
  6575. }
  6576. handled = event.ctrlKey || event.metaKey;
  6577. break; // -1 week on ctrl or command +up
  6578. case 39:
  6579. if (event.ctrlKey || event.metaKey) {
  6580. $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D");
  6581. }
  6582. handled = event.ctrlKey || event.metaKey;
  6583. // +1 day on ctrl or command +right
  6584. if (event.originalEvent.altKey) {
  6585. $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  6586. +$.datepicker._get(inst, "stepBigMonths") :
  6587. +$.datepicker._get(inst, "stepMonths")), "M");
  6588. }
  6589. // next month/year on alt +right
  6590. break;
  6591. case 40:
  6592. if (event.ctrlKey || event.metaKey) {
  6593. $.datepicker._adjustDate(event.target, +7, "D");
  6594. }
  6595. handled = event.ctrlKey || event.metaKey;
  6596. break; // +1 week on ctrl or command +down
  6597. default:
  6598. handled = false;
  6599. }
  6600. } else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home
  6601. $.datepicker._showDatepicker(this);
  6602. } else {
  6603. handled = false;
  6604. }
  6605. if (handled) {
  6606. event.preventDefault();
  6607. event.stopPropagation();
  6608. }
  6609. },
  6610. /* Filter entered characters - based on date format. */
  6611. _doKeyPress: function (event) {
  6612. var chars, chr,
  6613. inst = $.datepicker._getInst(event.target);
  6614. if ($.datepicker._get(inst, "constrainInput")) {
  6615. chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat"));
  6616. chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode);
  6617. return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1);
  6618. }
  6619. },
  6620. /* Synchronise manual entry and field/alternate field. */
  6621. _doKeyUp: function (event) {
  6622. var date,
  6623. inst = $.datepicker._getInst(event.target);
  6624. if (inst.input.val() !== inst.lastVal) {
  6625. try {
  6626. date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
  6627. (inst.input ? inst.input.val() : null),
  6628. $.datepicker._getFormatConfig(inst));
  6629. if (date) { // only if valid
  6630. $.datepicker._setDateFromField(inst);
  6631. $.datepicker._updateAlternate(inst);
  6632. $.datepicker._updateDatepicker(inst);
  6633. }
  6634. } catch (err) {
  6635. }
  6636. }
  6637. return true;
  6638. },
  6639. /* Pop-up the date picker for a given input field.
  6640. * If false returned from beforeShow event handler do not show.
  6641. * @param input element - the input field attached to the date picker or
  6642. * event - if triggered by focus
  6643. */
  6644. _showDatepicker: function (input) {
  6645. input = input.target || input;
  6646. if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger
  6647. input = $("input", input.parentNode)[0];
  6648. }
  6649. if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here
  6650. return;
  6651. }
  6652. var inst, beforeShow, beforeShowSettings, isFixed,
  6653. offset, showAnim, duration;
  6654. inst = $.datepicker._getInst(input);
  6655. if ($.datepicker._curInst && $.datepicker._curInst !== inst) {
  6656. $.datepicker._curInst.dpDiv.stop(true, true);
  6657. if (inst && $.datepicker._datepickerShowing) {
  6658. $.datepicker._hideDatepicker($.datepicker._curInst.input[0]);
  6659. }
  6660. }
  6661. beforeShow = $.datepicker._get(inst, "beforeShow");
  6662. beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
  6663. if (beforeShowSettings === false) {
  6664. return;
  6665. }
  6666. datepicker_extendRemove(inst.settings, beforeShowSettings);
  6667. inst.lastVal = null;
  6668. $.datepicker._lastInput = input;
  6669. $.datepicker._setDateFromField(inst);
  6670. if ($.datepicker._inDialog) { // hide cursor
  6671. input.value = "";
  6672. }
  6673. if (!$.datepicker._pos) { // position below input
  6674. $.datepicker._pos = $.datepicker._findPos(input);
  6675. $.datepicker._pos[1] += input.offsetHeight; // add the height
  6676. }
  6677. isFixed = false;
  6678. $(input).parents().each(function () {
  6679. isFixed |= $(this).css("position") === "fixed";
  6680. return !isFixed;
  6681. });
  6682. offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
  6683. $.datepicker._pos = null;
  6684. //to avoid flashes on Firefox
  6685. inst.dpDiv.empty();
  6686. // determine sizing offscreen
  6687. inst.dpDiv.css({position: "absolute", display: "block", top: "-1000px"});
  6688. $.datepicker._updateDatepicker(inst);
  6689. // fix width for dynamic number of date pickers
  6690. // and adjust position before showing
  6691. offset = $.datepicker._checkOffset(inst, offset, isFixed);
  6692. inst.dpDiv.css({
  6693. position: ($.datepicker._inDialog && $.blockUI ?
  6694. "static" : (isFixed ? "fixed" : "absolute")), display: "none",
  6695. left: offset.left + "px", top: offset.top + "px"
  6696. });
  6697. if (!inst.inline) {
  6698. showAnim = $.datepicker._get(inst, "showAnim");
  6699. duration = $.datepicker._get(inst, "duration");
  6700. inst.dpDiv.css("z-index", datepicker_getZindex($(input)) + 1);
  6701. $.datepicker._datepickerShowing = true;
  6702. if ($.effects && $.effects.effect[showAnim]) {
  6703. inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration);
  6704. } else {
  6705. inst.dpDiv[showAnim || "show"](showAnim ? duration : null);
  6706. }
  6707. if ($.datepicker._shouldFocusInput(inst)) {
  6708. inst.input.trigger("focus");
  6709. }
  6710. $.datepicker._curInst = inst;
  6711. }
  6712. },
  6713. /* Generate the date picker content. */
  6714. _updateDatepicker: function (inst) {
  6715. this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
  6716. datepicker_instActive = inst; // for delegate hover events
  6717. inst.dpDiv.empty().append(this._generateHTML(inst));
  6718. this._attachHandlers(inst);
  6719. var origyearshtml,
  6720. numMonths = this._getNumberOfMonths(inst),
  6721. cols = numMonths[1],
  6722. width = 17,
  6723. activeCell = inst.dpDiv.find("." + this._dayOverClass + " a");
  6724. if (activeCell.length > 0) {
  6725. datepicker_handleMouseover.apply(activeCell.get(0));
  6726. }
  6727. inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");
  6728. if (cols > 1) {
  6729. inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em");
  6730. }
  6731. inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") +
  6732. "Class"]("ui-datepicker-multi");
  6733. inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") +
  6734. "Class"]("ui-datepicker-rtl");
  6735. if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput(inst)) {
  6736. inst.input.trigger("focus");
  6737. }
  6738. // Deffered render of the years select (to avoid flashes on Firefox)
  6739. if (inst.yearshtml) {
  6740. origyearshtml = inst.yearshtml;
  6741. setTimeout(function () {
  6742. //assure that inst.yearshtml didn't change.
  6743. if (origyearshtml === inst.yearshtml && inst.yearshtml) {
  6744. inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml);
  6745. }
  6746. origyearshtml = inst.yearshtml = null;
  6747. }, 0);
  6748. }
  6749. },
  6750. // #6694 - don't focus the input if it's already focused
  6751. // this breaks the change event in IE
  6752. // Support: IE and jQuery <1.9
  6753. _shouldFocusInput: function (inst) {
  6754. return inst.input && inst.input.is(":visible") && !inst.input.is(":disabled") && !inst.input.is(":focus");
  6755. },
  6756. /* Check positioning to remain on screen. */
  6757. _checkOffset: function (inst, offset, isFixed) {
  6758. var dpWidth = inst.dpDiv.outerWidth(),
  6759. dpHeight = inst.dpDiv.outerHeight(),
  6760. inputWidth = inst.input ? inst.input.outerWidth() : 0,
  6761. inputHeight = inst.input ? inst.input.outerHeight() : 0,
  6762. viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()),
  6763. viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop());
  6764. offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0);
  6765. offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0;
  6766. offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
  6767. // Now check if datepicker is showing outside window viewport - move to a better place if so.
  6768. offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
  6769. Math.abs(offset.left + dpWidth - viewWidth) : 0);
  6770. offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
  6771. Math.abs(dpHeight + inputHeight) : 0);
  6772. return offset;
  6773. },
  6774. /* Find an object's position on the screen. */
  6775. _findPos: function (obj) {
  6776. var position,
  6777. inst = this._getInst(obj),
  6778. isRTL = this._get(inst, "isRTL");
  6779. while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) {
  6780. obj = obj[isRTL ? "previousSibling" : "nextSibling"];
  6781. }
  6782. position = $(obj).offset();
  6783. return [position.left, position.top];
  6784. },
  6785. /* Hide the date picker from view.
  6786. * @param input element - the input field attached to the date picker
  6787. */
  6788. _hideDatepicker: function (input) {
  6789. var showAnim, duration, postProcess, onClose,
  6790. inst = this._curInst;
  6791. if (!inst || (input && inst !== $.data(input, "datepicker"))) {
  6792. return;
  6793. }
  6794. if (this._datepickerShowing) {
  6795. showAnim = this._get(inst, "showAnim");
  6796. duration = this._get(inst, "duration");
  6797. postProcess = function () {
  6798. $.datepicker._tidyDialog(inst);
  6799. };
  6800. // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
  6801. if ($.effects && ($.effects.effect[showAnim] || $.effects[showAnim])) {
  6802. inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess);
  6803. } else {
  6804. inst.dpDiv[(showAnim === "slideDown" ? "slideUp" :
  6805. (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess);
  6806. }
  6807. if (!showAnim) {
  6808. postProcess();
  6809. }
  6810. this._datepickerShowing = false;
  6811. onClose = this._get(inst, "onClose");
  6812. if (onClose) {
  6813. onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]);
  6814. }
  6815. this._lastInput = null;
  6816. if (this._inDialog) {
  6817. this._dialogInput.css({position: "absolute", left: "0", top: "-100px"});
  6818. if ($.blockUI) {
  6819. $.unblockUI();
  6820. $("body").append(this.dpDiv);
  6821. }
  6822. }
  6823. this._inDialog = false;
  6824. }
  6825. },
  6826. /* Tidy up after a dialog display. */
  6827. _tidyDialog: function (inst) {
  6828. inst.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar");
  6829. },
  6830. /* Close date picker if clicked elsewhere. */
  6831. _checkExternalClick: function (event) {
  6832. if (!$.datepicker._curInst) {
  6833. return;
  6834. }
  6835. var $target = $(event.target),
  6836. inst = $.datepicker._getInst($target[0]);
  6837. if ((($target[0].id !== $.datepicker._mainDivId &&
  6838. $target.parents("#" + $.datepicker._mainDivId).length === 0 &&
  6839. !$target.hasClass($.datepicker.markerClassName) &&
  6840. !$target.closest("." + $.datepicker._triggerClass).length &&
  6841. $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))) ||
  6842. ($target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst)) {
  6843. $.datepicker._hideDatepicker();
  6844. }
  6845. },
  6846. /* Adjust one of the date sub-fields. */
  6847. _adjustDate: function (id, offset, period) {
  6848. var target = $(id),
  6849. inst = this._getInst(target[0]);
  6850. if (this._isDisabledDatepicker(target[0])) {
  6851. return;
  6852. }
  6853. this._adjustInstDate(inst, offset +
  6854. (period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning
  6855. period);
  6856. this._updateDatepicker(inst);
  6857. },
  6858. /* Action for current link. */
  6859. _gotoToday: function (id) {
  6860. var date,
  6861. target = $(id),
  6862. inst = this._getInst(target[0]);
  6863. if (this._get(inst, "gotoCurrent") && inst.currentDay) {
  6864. inst.selectedDay = inst.currentDay;
  6865. inst.drawMonth = inst.selectedMonth = inst.currentMonth;
  6866. inst.drawYear = inst.selectedYear = inst.currentYear;
  6867. } else {
  6868. date = new Date();
  6869. inst.selectedDay = date.getDate();
  6870. inst.drawMonth = inst.selectedMonth = date.getMonth();
  6871. inst.drawYear = inst.selectedYear = date.getFullYear();
  6872. }
  6873. this._notifyChange(inst);
  6874. this._adjustDate(target);
  6875. },
  6876. /* Action for selecting a new month/year. */
  6877. _selectMonthYear: function (id, select, period) {
  6878. var target = $(id),
  6879. inst = this._getInst(target[0]);
  6880. inst["selected" + (period === "M" ? "Month" : "Year")] =
  6881. inst["draw" + (period === "M" ? "Month" : "Year")] =
  6882. parseInt(select.options[select.selectedIndex].value, 10);
  6883. this._notifyChange(inst);
  6884. this._adjustDate(target);
  6885. },
  6886. /* Action for selecting a day. */
  6887. _selectDay: function (id, month, year, td) {
  6888. var inst,
  6889. target = $(id);
  6890. if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
  6891. return;
  6892. }
  6893. inst = this._getInst(target[0]);
  6894. inst.selectedDay = inst.currentDay = $("a", td).html();
  6895. inst.selectedMonth = inst.currentMonth = month;
  6896. inst.selectedYear = inst.currentYear = year;
  6897. this._selectDate(id, this._formatDate(inst,
  6898. inst.currentDay, inst.currentMonth, inst.currentYear));
  6899. },
  6900. /* Erase the input field and hide the date picker. */
  6901. _clearDate: function (id) {
  6902. var target = $(id);
  6903. this._selectDate(target, "");
  6904. },
  6905. /* Update the input field with the selected date. */
  6906. _selectDate: function (id, dateStr) {
  6907. var onSelect,
  6908. target = $(id),
  6909. inst = this._getInst(target[0]);
  6910. dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
  6911. if (inst.input) {
  6912. inst.input.val(dateStr);
  6913. }
  6914. this._updateAlternate(inst);
  6915. onSelect = this._get(inst, "onSelect");
  6916. if (onSelect) {
  6917. onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
  6918. } else if (inst.input) {
  6919. inst.input.trigger("change"); // fire the change event
  6920. }
  6921. if (inst.inline) {
  6922. this._updateDatepicker(inst);
  6923. } else {
  6924. this._hideDatepicker();
  6925. this._lastInput = inst.input[0];
  6926. if (typeof (inst.input[0]) !== "object") {
  6927. inst.input.trigger("focus"); // restore focus
  6928. }
  6929. this._lastInput = null;
  6930. }
  6931. },
  6932. /* Update any alternate field to synchronise with the main field. */
  6933. _updateAlternate: function (inst) {
  6934. var altFormat, date, dateStr,
  6935. altField = this._get(inst, "altField");
  6936. if (altField) { // update alternate field too
  6937. altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat");
  6938. date = this._getDate(inst);
  6939. dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
  6940. $(altField).val(dateStr);
  6941. }
  6942. },
  6943. /* Set as beforeShowDay function to prevent selection of weekends.
  6944. * @param date Date - the date to customise
  6945. * @return [boolean, string] - is this date selectable?, what is its CSS class?
  6946. */
  6947. noWeekends: function (date) {
  6948. var day = date.getDay();
  6949. return [(day > 0 && day < 6), ""];
  6950. },
  6951. /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
  6952. * @param date Date - the date to get the week for
  6953. * @return number - the number of the week within the year that contains this date
  6954. */
  6955. iso8601Week: function (date) {
  6956. var time,
  6957. checkDate = new Date(date.getTime());
  6958. // Find Thursday of this week starting on Monday
  6959. checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
  6960. time = checkDate.getTime();
  6961. checkDate.setMonth(0); // Compare with Jan 1
  6962. checkDate.setDate(1);
  6963. return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
  6964. },
  6965. /* Parse a string value into a date object.
  6966. * See formatDate below for the possible formats.
  6967. *
  6968. * @param format string - the expected format of the date
  6969. * @param value string - the date in the above format
  6970. * @param settings Object - attributes include:
  6971. * shortYearCutoff number - the cutoff year for determining the century (optional)
  6972. * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
  6973. * dayNames string[7] - names of the days from Sunday (optional)
  6974. * monthNamesShort string[12] - abbreviated names of the months (optional)
  6975. * monthNames string[12] - names of the months (optional)
  6976. * @return Date - the extracted date value or null if value is blank
  6977. */
  6978. parseDate: function (format, value, settings) {
  6979. if (format == null || value == null) {
  6980. throw "Invalid arguments";
  6981. }
  6982. value = (typeof value === "object" ? value.toString() : value + "");
  6983. if (value === "") {
  6984. return null;
  6985. }
  6986. var iFormat, dim, extra,
  6987. iValue = 0,
  6988. shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff,
  6989. shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp :
  6990. new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)),
  6991. dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
  6992. dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
  6993. monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
  6994. monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,
  6995. year = -1,
  6996. month = -1,
  6997. day = -1,
  6998. doy = -1,
  6999. literal = false,
  7000. date,
  7001. // Check whether a format character is doubled
  7002. lookAhead = function (match) {
  7003. var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
  7004. if (matches) {
  7005. iFormat++;
  7006. }
  7007. return matches;
  7008. },
  7009. // Extract a number from the string value
  7010. getNumber = function (match) {
  7011. var isDoubled = lookAhead(match),
  7012. size = (match === "@" ? 14 : (match === "!" ? 20 :
  7013. (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))),
  7014. minSize = (match === "y" ? size : 1),
  7015. digits = new RegExp("^\\d{" + minSize + "," + size + "}"),
  7016. num = value.substring(iValue).match(digits);
  7017. if (!num) {
  7018. throw "Missing number at position " + iValue;
  7019. }
  7020. iValue += num[0].length;
  7021. return parseInt(num[0], 10);
  7022. },
  7023. // Extract a name from the string value and convert to an index
  7024. getName = function (match, shortNames, longNames) {
  7025. var index = -1,
  7026. names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
  7027. return [[k, v]];
  7028. }).sort(function (a, b) {
  7029. return -(a[1].length - b[1].length);
  7030. });
  7031. $.each(names, function (i, pair) {
  7032. var name = pair[1];
  7033. if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) {
  7034. index = pair[0];
  7035. iValue += name.length;
  7036. return false;
  7037. }
  7038. });
  7039. if (index !== -1) {
  7040. return index + 1;
  7041. } else {
  7042. throw "Unknown name at position " + iValue;
  7043. }
  7044. },
  7045. // Confirm that a literal character matches the string value
  7046. checkLiteral = function () {
  7047. if (value.charAt(iValue) !== format.charAt(iFormat)) {
  7048. throw "Unexpected literal at position " + iValue;
  7049. }
  7050. iValue++;
  7051. };
  7052. for (iFormat = 0; iFormat < format.length; iFormat++) {
  7053. if (literal) {
  7054. if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
  7055. literal = false;
  7056. } else {
  7057. checkLiteral();
  7058. }
  7059. } else {
  7060. switch (format.charAt(iFormat)) {
  7061. case "d":
  7062. day = getNumber("d");
  7063. break;
  7064. case "D":
  7065. getName("D", dayNamesShort, dayNames);
  7066. break;
  7067. case "o":
  7068. doy = getNumber("o");
  7069. break;
  7070. case "m":
  7071. month = getNumber("m");
  7072. break;
  7073. case "M":
  7074. month = getName("M", monthNamesShort, monthNames);
  7075. break;
  7076. case "y":
  7077. year = getNumber("y");
  7078. break;
  7079. case "@":
  7080. date = new Date(getNumber("@"));
  7081. year = date.getFullYear();
  7082. month = date.getMonth() + 1;
  7083. day = date.getDate();
  7084. break;
  7085. case "!":
  7086. date = new Date((getNumber("!") - this._ticksTo1970) / 10000);
  7087. year = date.getFullYear();
  7088. month = date.getMonth() + 1;
  7089. day = date.getDate();
  7090. break;
  7091. case "'":
  7092. if (lookAhead("'")) {
  7093. checkLiteral();
  7094. } else {
  7095. literal = true;
  7096. }
  7097. break;
  7098. default:
  7099. checkLiteral();
  7100. }
  7101. }
  7102. }
  7103. if (iValue < value.length) {
  7104. extra = value.substr(iValue);
  7105. if (!/^\s+/.test(extra)) {
  7106. throw "Extra/unparsed characters found in date: " + extra;
  7107. }
  7108. }
  7109. if (year === -1) {
  7110. year = new Date().getFullYear();
  7111. } else if (year < 100) {
  7112. year += new Date().getFullYear() - new Date().getFullYear() % 100 +
  7113. (year <= shortYearCutoff ? 0 : -100);
  7114. }
  7115. if (doy > -1) {
  7116. month = 1;
  7117. day = doy;
  7118. do {
  7119. dim = this._getDaysInMonth(year, month - 1);
  7120. if (day <= dim) {
  7121. break;
  7122. }
  7123. month++;
  7124. day -= dim;
  7125. } while (true);
  7126. }
  7127. date = this._daylightSavingAdjust(new Date(year, month - 1, day));
  7128. if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) {
  7129. throw "Invalid date"; // E.g. 31/02/00
  7130. }
  7131. return date;
  7132. },
  7133. /* Standard date formats. */
  7134. ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)
  7135. COOKIE: "D, dd M yy",
  7136. ISO_8601: "yy-mm-dd",
  7137. RFC_822: "D, d M y",
  7138. RFC_850: "DD, dd-M-y",
  7139. RFC_1036: "D, d M y",
  7140. RFC_1123: "D, d M yy",
  7141. RFC_2822: "D, d M yy",
  7142. RSS: "D, d M y", // RFC 822
  7143. TICKS: "!",
  7144. TIMESTAMP: "@",
  7145. W3C: "yy-mm-dd", // ISO 8601
  7146. _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
  7147. Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
  7148. /* Format a date object into a string value.
  7149. * The format can be combinations of the following:
  7150. * d - day of month (no leading zero)
  7151. * dd - day of month (two digit)
  7152. * o - day of year (no leading zeros)
  7153. * oo - day of year (three digit)
  7154. * D - day name short
  7155. * DD - day name long
  7156. * m - month of year (no leading zero)
  7157. * mm - month of year (two digit)
  7158. * M - month name short
  7159. * MM - month name long
  7160. * y - year (two digit)
  7161. * yy - year (four digit)
  7162. * @ - Unix timestamp (ms since 01/01/1970)
  7163. * ! - Windows ticks (100ns since 01/01/0001)
  7164. * "..." - literal text
  7165. * '' - single quote
  7166. *
  7167. * @param format string - the desired format of the date
  7168. * @param date Date - the date value to format
  7169. * @param settings Object - attributes include:
  7170. * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
  7171. * dayNames string[7] - names of the days from Sunday (optional)
  7172. * monthNamesShort string[12] - abbreviated names of the months (optional)
  7173. * monthNames string[12] - names of the months (optional)
  7174. * @return string - the date in the above format
  7175. */
  7176. formatDate: function (format, date, settings) {
  7177. if (!date) {
  7178. return "";
  7179. }
  7180. var iFormat,
  7181. dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
  7182. dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
  7183. monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
  7184. monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,
  7185. // Check whether a format character is doubled
  7186. lookAhead = function (match) {
  7187. var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
  7188. if (matches) {
  7189. iFormat++;
  7190. }
  7191. return matches;
  7192. },
  7193. // Format a number, with leading zero if necessary
  7194. formatNumber = function (match, value, len) {
  7195. var num = "" + value;
  7196. if (lookAhead(match)) {
  7197. while (num.length < len) {
  7198. num = "0" + num;
  7199. }
  7200. }
  7201. return num;
  7202. },
  7203. // Format a name, short or long as requested
  7204. formatName = function (match, value, shortNames, longNames) {
  7205. return (lookAhead(match) ? longNames[value] : shortNames[value]);
  7206. },
  7207. output = "",
  7208. literal = false;
  7209. if (date) {
  7210. for (iFormat = 0; iFormat < format.length; iFormat++) {
  7211. if (literal) {
  7212. if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
  7213. literal = false;
  7214. } else {
  7215. output += format.charAt(iFormat);
  7216. }
  7217. } else {
  7218. switch (format.charAt(iFormat)) {
  7219. case "d":
  7220. output += formatNumber("d", date.getDate(), 2);
  7221. break;
  7222. case "D":
  7223. output += formatName("D", date.getDay(), dayNamesShort, dayNames);
  7224. break;
  7225. case "o":
  7226. output += formatNumber("o",
  7227. Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
  7228. break;
  7229. case "m":
  7230. output += formatNumber("m", date.getMonth() + 1, 2);
  7231. break;
  7232. case "M":
  7233. output += formatName("M", date.getMonth(), monthNamesShort, monthNames);
  7234. break;
  7235. case "y":
  7236. output += (lookAhead("y") ? date.getFullYear() :
  7237. (date.getFullYear() % 100 < 10 ? "0" : "") + date.getFullYear() % 100);
  7238. break;
  7239. case "@":
  7240. output += date.getTime();
  7241. break;
  7242. case "!":
  7243. output += date.getTime() * 10000 + this._ticksTo1970;
  7244. break;
  7245. case "'":
  7246. if (lookAhead("'")) {
  7247. output += "'";
  7248. } else {
  7249. literal = true;
  7250. }
  7251. break;
  7252. default:
  7253. output += format.charAt(iFormat);
  7254. }
  7255. }
  7256. }
  7257. }
  7258. return output;
  7259. },
  7260. /* Extract all possible characters from the date format. */
  7261. _possibleChars: function (format) {
  7262. var iFormat,
  7263. chars = "",
  7264. literal = false,
  7265. // Check whether a format character is doubled
  7266. lookAhead = function (match) {
  7267. var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
  7268. if (matches) {
  7269. iFormat++;
  7270. }
  7271. return matches;
  7272. };
  7273. for (iFormat = 0; iFormat < format.length; iFormat++) {
  7274. if (literal) {
  7275. if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
  7276. literal = false;
  7277. } else {
  7278. chars += format.charAt(iFormat);
  7279. }
  7280. } else {
  7281. switch (format.charAt(iFormat)) {
  7282. case "d":
  7283. case "m":
  7284. case "y":
  7285. case "@":
  7286. chars += "0123456789";
  7287. break;
  7288. case "D":
  7289. case "M":
  7290. return null; // Accept anything
  7291. case "'":
  7292. if (lookAhead("'")) {
  7293. chars += "'";
  7294. } else {
  7295. literal = true;
  7296. }
  7297. break;
  7298. default:
  7299. chars += format.charAt(iFormat);
  7300. }
  7301. }
  7302. }
  7303. return chars;
  7304. },
  7305. /* Get a setting value, defaulting if necessary. */
  7306. _get: function (inst, name) {
  7307. return inst.settings[name] !== undefined ?
  7308. inst.settings[name] : this._defaults[name];
  7309. },
  7310. /* Parse existing date and initialise date picker. */
  7311. _setDateFromField: function (inst, noDefault) {
  7312. if (inst.input.val() === inst.lastVal) {
  7313. return;
  7314. }
  7315. var dateFormat = this._get(inst, "dateFormat"),
  7316. dates = inst.lastVal = inst.input ? inst.input.val() : null,
  7317. defaultDate = this._getDefaultDate(inst),
  7318. date = defaultDate,
  7319. settings = this._getFormatConfig(inst);
  7320. try {
  7321. date = this.parseDate(dateFormat, dates, settings) || defaultDate;
  7322. } catch (event) {
  7323. dates = (noDefault ? "" : dates);
  7324. }
  7325. inst.selectedDay = date.getDate();
  7326. inst.drawMonth = inst.selectedMonth = date.getMonth();
  7327. inst.drawYear = inst.selectedYear = date.getFullYear();
  7328. inst.currentDay = (dates ? date.getDate() : 0);
  7329. inst.currentMonth = (dates ? date.getMonth() : 0);
  7330. inst.currentYear = (dates ? date.getFullYear() : 0);
  7331. this._adjustInstDate(inst);
  7332. },
  7333. /* Retrieve the default date shown on opening. */
  7334. _getDefaultDate: function (inst) {
  7335. return this._restrictMinMax(inst,
  7336. this._determineDate(inst, this._get(inst, "defaultDate"), new Date()));
  7337. },
  7338. /* A date may be specified as an exact value or a relative one. */
  7339. _determineDate: function (inst, date, defaultDate) {
  7340. var offsetNumeric = function (offset) {
  7341. var date = new Date();
  7342. date.setDate(date.getDate() + offset);
  7343. return date;
  7344. },
  7345. offsetString = function (offset) {
  7346. try {
  7347. return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
  7348. offset, $.datepicker._getFormatConfig(inst));
  7349. } catch (e) {
  7350. // Ignore
  7351. }
  7352. var date = (offset.toLowerCase().match(/^c/) ?
  7353. $.datepicker._getDate(inst) : null) || new Date(),
  7354. year = date.getFullYear(),
  7355. month = date.getMonth(),
  7356. day = date.getDate(),
  7357. pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
  7358. matches = pattern.exec(offset);
  7359. while (matches) {
  7360. switch (matches[2] || "d") {
  7361. case "d" :
  7362. case "D" :
  7363. day += parseInt(matches[1], 10);
  7364. break;
  7365. case "w" :
  7366. case "W" :
  7367. day += parseInt(matches[1], 10) * 7;
  7368. break;
  7369. case "m" :
  7370. case "M" :
  7371. month += parseInt(matches[1], 10);
  7372. day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
  7373. break;
  7374. case "y":
  7375. case "Y" :
  7376. year += parseInt(matches[1], 10);
  7377. day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
  7378. break;
  7379. }
  7380. matches = pattern.exec(offset);
  7381. }
  7382. return new Date(year, month, day);
  7383. },
  7384. newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) :
  7385. (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
  7386. newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate);
  7387. if (newDate) {
  7388. newDate.setHours(0);
  7389. newDate.setMinutes(0);
  7390. newDate.setSeconds(0);
  7391. newDate.setMilliseconds(0);
  7392. }
  7393. return this._daylightSavingAdjust(newDate);
  7394. },
  7395. /* Handle switch to/from daylight saving.
  7396. * Hours may be non-zero on daylight saving cut-over:
  7397. * > 12 when midnight changeover, but then cannot generate
  7398. * midnight datetime, so jump to 1AM, otherwise reset.
  7399. * @param date (Date) the date to check
  7400. * @return (Date) the corrected date
  7401. */
  7402. _daylightSavingAdjust: function (date) {
  7403. if (!date) {
  7404. return null;
  7405. }
  7406. date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
  7407. return date;
  7408. },
  7409. /* Set the date(s) directly. */
  7410. _setDate: function (inst, date, noChange) {
  7411. var clear = !date,
  7412. origMonth = inst.selectedMonth,
  7413. origYear = inst.selectedYear,
  7414. newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
  7415. inst.selectedDay = inst.currentDay = newDate.getDate();
  7416. inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
  7417. inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
  7418. if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) {
  7419. this._notifyChange(inst);
  7420. }
  7421. this._adjustInstDate(inst);
  7422. if (inst.input) {
  7423. inst.input.val(clear ? "" : this._formatDate(inst));
  7424. }
  7425. },
  7426. /* Retrieve the date(s) directly. */
  7427. _getDate: function (inst) {
  7428. var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null :
  7429. this._daylightSavingAdjust(new Date(
  7430. inst.currentYear, inst.currentMonth, inst.currentDay)));
  7431. return startDate;
  7432. },
  7433. /* Attach the onxxx handlers. These are declared statically so
  7434. * they work with static code transformers like Caja.
  7435. */
  7436. _attachHandlers: function (inst) {
  7437. var stepMonths = this._get(inst, "stepMonths"),
  7438. id = "#" + inst.id.replace(/\\\\/g, "\\");
  7439. inst.dpDiv.find("[data-handler]").map(function () {
  7440. var handler = {
  7441. prev: function () {
  7442. $.datepicker._adjustDate(id, -stepMonths, "M");
  7443. },
  7444. next: function () {
  7445. $.datepicker._adjustDate(id, +stepMonths, "M");
  7446. },
  7447. hide: function () {
  7448. $.datepicker._hideDatepicker();
  7449. },
  7450. today: function () {
  7451. $.datepicker._gotoToday(id);
  7452. },
  7453. selectDay: function () {
  7454. $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this);
  7455. return false;
  7456. },
  7457. selectMonth: function () {
  7458. $.datepicker._selectMonthYear(id, this, "M");
  7459. return false;
  7460. },
  7461. selectYear: function () {
  7462. $.datepicker._selectMonthYear(id, this, "Y");
  7463. return false;
  7464. }
  7465. };
  7466. $(this).on(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]);
  7467. });
  7468. },
  7469. /* Generate the HTML for the current state of the date picker. */
  7470. _generateHTML: function (inst) {
  7471. var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
  7472. controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
  7473. monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
  7474. selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
  7475. cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,
  7476. printDate, dRow, tbody, daySettings, otherMonth, unselectable,
  7477. tempDate = new Date(),
  7478. today = this._daylightSavingAdjust(
  7479. new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time
  7480. isRTL = this._get(inst, "isRTL"),
  7481. showButtonPanel = this._get(inst, "showButtonPanel"),
  7482. hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"),
  7483. navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"),
  7484. numMonths = this._getNumberOfMonths(inst),
  7485. showCurrentAtPos = this._get(inst, "showCurrentAtPos"),
  7486. stepMonths = this._get(inst, "stepMonths"),
  7487. isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1),
  7488. currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
  7489. new Date(inst.currentYear, inst.currentMonth, inst.currentDay))),
  7490. minDate = this._getMinMaxDate(inst, "min"),
  7491. maxDate = this._getMinMaxDate(inst, "max"),
  7492. drawMonth = inst.drawMonth - showCurrentAtPos,
  7493. drawYear = inst.drawYear;
  7494. if (drawMonth < 0) {
  7495. drawMonth += 12;
  7496. drawYear--;
  7497. }
  7498. if (maxDate) {
  7499. maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
  7500. maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
  7501. maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
  7502. while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
  7503. drawMonth--;
  7504. if (drawMonth < 0) {
  7505. drawMonth = 11;
  7506. drawYear--;
  7507. }
  7508. }
  7509. }
  7510. inst.drawMonth = drawMonth;
  7511. inst.drawYear = drawYear;
  7512. prevText = this._get(inst, "prevText");
  7513. prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
  7514. this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
  7515. this._getFormatConfig(inst)));
  7516. prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
  7517. "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" +
  7518. " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + (isRTL ? "e" : "w") + "'>" + prevText + "</span></a>" :
  7519. (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>"));
  7520. nextText = this._get(inst, "nextText");
  7521. nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
  7522. this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
  7523. this._getFormatConfig(inst)));
  7524. next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
  7525. "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" +
  7526. " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + (isRTL ? "w" : "e") + "'>" + nextText + "</span></a>" :
  7527. (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>"));
  7528. currentText = this._get(inst, "currentText");
  7529. gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today);
  7530. currentText = (!navigationAsDateFormat ? currentText :
  7531. this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
  7532. 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'>" +
  7533. this._get(inst, "closeText") + "</button>" : "");
  7534. buttonPanel = (showButtonPanel) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + (isRTL ? controls : "") +
  7535. (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'" +
  7536. ">" + currentText + "</button>" : "") + (isRTL ? "" : controls) + "</div>" : "";
  7537. firstDay = parseInt(this._get(inst, "firstDay"), 10);
  7538. firstDay = (isNaN(firstDay) ? 0 : firstDay);
  7539. showWeek = this._get(inst, "showWeek");
  7540. dayNames = this._get(inst, "dayNames");
  7541. dayNamesMin = this._get(inst, "dayNamesMin");
  7542. monthNames = this._get(inst, "monthNames");
  7543. monthNamesShort = this._get(inst, "monthNamesShort");
  7544. beforeShowDay = this._get(inst, "beforeShowDay");
  7545. showOtherMonths = this._get(inst, "showOtherMonths");
  7546. selectOtherMonths = this._get(inst, "selectOtherMonths");
  7547. defaultDate = this._getDefaultDate(inst);
  7548. html = "";
  7549. for (row = 0; row < numMonths[0]; row++) {
  7550. group = "";
  7551. this.maxRows = 4;
  7552. for (col = 0; col < numMonths[1]; col++) {
  7553. selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
  7554. cornerClass = " ui-corner-all";
  7555. calender = "";
  7556. if (isMultiMonth) {
  7557. calender += "<div class='ui-datepicker-group";
  7558. if (numMonths[1] > 1) {
  7559. switch (col) {
  7560. case 0:
  7561. calender += " ui-datepicker-group-first";
  7562. cornerClass = " ui-corner-" + (isRTL ? "right" : "left");
  7563. break;
  7564. case numMonths[1] - 1:
  7565. calender += " ui-datepicker-group-last";
  7566. cornerClass = " ui-corner-" + (isRTL ? "left" : "right");
  7567. break;
  7568. default:
  7569. calender += " ui-datepicker-group-middle";
  7570. cornerClass = "";
  7571. break;
  7572. }
  7573. }
  7574. calender += "'>";
  7575. }
  7576. calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" +
  7577. (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") +
  7578. (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") +
  7579. this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
  7580. row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
  7581. "</div><table class='ui-datepicker-calendar'><thead>" +
  7582. "<tr>";
  7583. thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : "");
  7584. for (dow = 0; dow < 7; dow++) { // days of the week
  7585. day = (dow + firstDay) % 7;
  7586. thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" +
  7587. "<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>";
  7588. }
  7589. calender += thead + "</tr></thead><tbody>";
  7590. daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
  7591. if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) {
  7592. inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
  7593. }
  7594. leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
  7595. curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
  7596. numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043)
  7597. this.maxRows = numRows;
  7598. printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
  7599. for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows
  7600. calender += "<tr>";
  7601. tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" +
  7602. this._get(inst, "calculateWeek")(printDate) + "</td>");
  7603. for (dow = 0; dow < 7; dow++) { // create date picker days
  7604. daySettings = (beforeShowDay ?
  7605. beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]);
  7606. otherMonth = (printDate.getMonth() !== drawMonth);
  7607. unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
  7608. (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
  7609. tbody += "<td class='" +
  7610. ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends
  7611. (otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months
  7612. ((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key
  7613. (defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ?
  7614. // or defaultDate is current printedDate and defaultDate is selectedDate
  7615. " " + this._dayOverClass : "") + // highlight selected day
  7616. (unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "") + // highlight unselectable days
  7617. (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates
  7618. (printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day
  7619. (printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different)
  7620. ((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "&#39;") + "'" : "") + // cell title
  7621. (unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions
  7622. (otherMonth && !showOtherMonths ? "&#xa0;" : // display for other months
  7623. (unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" +
  7624. (printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") +
  7625. (printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day
  7626. (otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months
  7627. "' href='#'>" + printDate.getDate() + "</a>")) + "</td>"; // display selectable date
  7628. printDate.setDate(printDate.getDate() + 1);
  7629. printDate = this._daylightSavingAdjust(printDate);
  7630. }
  7631. calender += tbody + "</tr>";
  7632. }
  7633. drawMonth++;
  7634. if (drawMonth > 11) {
  7635. drawMonth = 0;
  7636. drawYear++;
  7637. }
  7638. calender += "</tbody></table>" + (isMultiMonth ? "</div>" +
  7639. ((numMonths[0] > 0 && col === numMonths[1] - 1) ? "<div class='ui-datepicker-row-break'></div>" : "") : "");
  7640. group += calender;
  7641. }
  7642. html += group;
  7643. }
  7644. html += buttonPanel;
  7645. inst._keyEvent = false;
  7646. return html;
  7647. },
  7648. /* Generate the month and year header. */
  7649. _generateMonthYearHeader: function (inst, drawMonth, drawYear, minDate, maxDate,
  7650. secondary, monthNames, monthNamesShort) {
  7651. var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
  7652. changeMonth = this._get(inst, "changeMonth"),
  7653. changeYear = this._get(inst, "changeYear"),
  7654. showMonthAfterYear = this._get(inst, "showMonthAfterYear"),
  7655. html = "<div class='ui-datepicker-title'>",
  7656. monthHtml = "";
  7657. // Month selection
  7658. if (secondary || !changeMonth) {
  7659. monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>";
  7660. } else {
  7661. inMinYear = (minDate && minDate.getFullYear() === drawYear);
  7662. inMaxYear = (maxDate && maxDate.getFullYear() === drawYear);
  7663. monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";
  7664. for (month = 0; month < 12; month++) {
  7665. if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) {
  7666. monthHtml += "<option value='" + month + "'" +
  7667. (month === drawMonth ? " selected='selected'" : "") +
  7668. ">" + monthNamesShort[month] + "</option>";
  7669. }
  7670. }
  7671. monthHtml += "</select>";
  7672. }
  7673. if (!showMonthAfterYear) {
  7674. html += monthHtml + (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "");
  7675. }
  7676. // Year selection
  7677. if (!inst.yearshtml) {
  7678. inst.yearshtml = "";
  7679. if (secondary || !changeYear) {
  7680. html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";
  7681. } else {
  7682. // determine range of years to display
  7683. years = this._get(inst, "yearRange").split(":");
  7684. thisYear = new Date().getFullYear();
  7685. determineYear = function (value) {
  7686. var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) :
  7687. (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) :
  7688. parseInt(value, 10)));
  7689. return (isNaN(year) ? thisYear : year);
  7690. };
  7691. year = determineYear(years[0]);
  7692. endYear = Math.max(year, determineYear(years[1] || ""));
  7693. year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
  7694. endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
  7695. inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";
  7696. for (; year <= endYear; year++) {
  7697. inst.yearshtml += "<option value='" + year + "'" +
  7698. (year === drawYear ? " selected='selected'" : "") +
  7699. ">" + year + "</option>";
  7700. }
  7701. inst.yearshtml += "</select>";
  7702. html += inst.yearshtml;
  7703. inst.yearshtml = null;
  7704. }
  7705. }
  7706. html += this._get(inst, "yearSuffix");
  7707. if (showMonthAfterYear) {
  7708. html += (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "") + monthHtml;
  7709. }
  7710. html += "</div>"; // Close datepicker_header
  7711. return html;
  7712. },
  7713. /* Adjust one of the date sub-fields. */
  7714. _adjustInstDate: function (inst, offset, period) {
  7715. var year = inst.selectedYear + (period === "Y" ? offset : 0),
  7716. month = inst.selectedMonth + (period === "M" ? offset : 0),
  7717. day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0),
  7718. date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day)));
  7719. inst.selectedDay = date.getDate();
  7720. inst.drawMonth = inst.selectedMonth = date.getMonth();
  7721. inst.drawYear = inst.selectedYear = date.getFullYear();
  7722. if (period === "M" || period === "Y") {
  7723. this._notifyChange(inst);
  7724. }
  7725. },
  7726. /* Ensure a date is within any min/max bounds. */
  7727. _restrictMinMax: function (inst, date) {
  7728. var minDate = this._getMinMaxDate(inst, "min"),
  7729. maxDate = this._getMinMaxDate(inst, "max"),
  7730. newDate = (minDate && date < minDate ? minDate : date);
  7731. return (maxDate && newDate > maxDate ? maxDate : newDate);
  7732. },
  7733. /* Notify change of month/year. */
  7734. _notifyChange: function (inst) {
  7735. var onChange = this._get(inst, "onChangeMonthYear");
  7736. if (onChange) {
  7737. onChange.apply((inst.input ? inst.input[0] : null),
  7738. [inst.selectedYear, inst.selectedMonth + 1, inst]);
  7739. }
  7740. },
  7741. /* Determine the number of months to show. */
  7742. _getNumberOfMonths: function (inst) {
  7743. var numMonths = this._get(inst, "numberOfMonths");
  7744. return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths));
  7745. },
  7746. /* Determine the current maximum date - ensure no time components are set. */
  7747. _getMinMaxDate: function (inst, minMax) {
  7748. return this._determineDate(inst, this._get(inst, minMax + "Date"), null);
  7749. },
  7750. /* Find the number of days in a given month. */
  7751. _getDaysInMonth: function (year, month) {
  7752. return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
  7753. },
  7754. /* Find the day of the week of the first of a month. */
  7755. _getFirstDayOfMonth: function (year, month) {
  7756. return new Date(year, month, 1).getDay();
  7757. },
  7758. /* Determines if we should allow a "next/prev" month display change. */
  7759. _canAdjustMonth: function (inst, offset, curYear, curMonth) {
  7760. var numMonths = this._getNumberOfMonths(inst),
  7761. date = this._daylightSavingAdjust(new Date(curYear,
  7762. curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
  7763. if (offset < 0) {
  7764. date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
  7765. }
  7766. return this._isInRange(inst, date);
  7767. },
  7768. /* Is the given date in the accepted range? */
  7769. _isInRange: function (inst, date) {
  7770. var yearSplit, currentYear,
  7771. minDate = this._getMinMaxDate(inst, "min"),
  7772. maxDate = this._getMinMaxDate(inst, "max"),
  7773. minYear = null,
  7774. maxYear = null,
  7775. years = this._get(inst, "yearRange");
  7776. if (years) {
  7777. yearSplit = years.split(":");
  7778. currentYear = new Date().getFullYear();
  7779. minYear = parseInt(yearSplit[0], 10);
  7780. maxYear = parseInt(yearSplit[1], 10);
  7781. if (yearSplit[0].match(/[+\-].*/)) {
  7782. minYear += currentYear;
  7783. }
  7784. if (yearSplit[1].match(/[+\-].*/)) {
  7785. maxYear += currentYear;
  7786. }
  7787. }
  7788. return ((!minDate || date.getTime() >= minDate.getTime()) &&
  7789. (!maxDate || date.getTime() <= maxDate.getTime()) &&
  7790. (!minYear || date.getFullYear() >= minYear) &&
  7791. (!maxYear || date.getFullYear() <= maxYear));
  7792. },
  7793. /* Provide the configuration settings for formatting/parsing. */
  7794. _getFormatConfig: function (inst) {
  7795. var shortYearCutoff = this._get(inst, "shortYearCutoff");
  7796. shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff :
  7797. new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
  7798. return {
  7799. shortYearCutoff: shortYearCutoff,
  7800. dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"),
  7801. monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames")
  7802. };
  7803. },
  7804. /* Format the given date for display. */
  7805. _formatDate: function (inst, day, month, year) {
  7806. if (!day) {
  7807. inst.currentDay = inst.selectedDay;
  7808. inst.currentMonth = inst.selectedMonth;
  7809. inst.currentYear = inst.selectedYear;
  7810. }
  7811. var date = (day ? (typeof day === "object" ? day :
  7812. this._daylightSavingAdjust(new Date(year, month, day))) :
  7813. this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
  7814. return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst));
  7815. }
  7816. });
  7817. /*
  7818. * Bind hover events for datepicker elements.
  7819. * Done via delegate so the binding only occurs once in the lifetime of the parent div.
  7820. * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
  7821. */
  7822. function datepicker_bindHover(dpDiv) {
  7823. var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
  7824. return dpDiv.on("mouseout", selector, function () {
  7825. $(this).removeClass("ui-state-hover");
  7826. if (this.className.indexOf("ui-datepicker-prev") !== -1) {
  7827. $(this).removeClass("ui-datepicker-prev-hover");
  7828. }
  7829. if (this.className.indexOf("ui-datepicker-next") !== -1) {
  7830. $(this).removeClass("ui-datepicker-next-hover");
  7831. }
  7832. })
  7833. .on("mouseover", selector, datepicker_handleMouseover);
  7834. }
  7835. function datepicker_handleMouseover() {
  7836. if (!$.datepicker._isDisabledDatepicker(datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) {
  7837. $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
  7838. $(this).addClass("ui-state-hover");
  7839. if (this.className.indexOf("ui-datepicker-prev") !== -1) {
  7840. $(this).addClass("ui-datepicker-prev-hover");
  7841. }
  7842. if (this.className.indexOf("ui-datepicker-next") !== -1) {
  7843. $(this).addClass("ui-datepicker-next-hover");
  7844. }
  7845. }
  7846. }
  7847. /* jQuery extend now ignores nulls! */
  7848. function datepicker_extendRemove(target, props) {
  7849. $.extend(target, props);
  7850. for (var name in props) {
  7851. if (props[name] == null) {
  7852. target[name] = props[name];
  7853. }
  7854. }
  7855. return target;
  7856. }
  7857. /* Invoke the datepicker functionality.
  7858. @param options string - a command, optionally followed by additional parameters or
  7859. Object - settings for attaching new datepicker functionality
  7860. @return jQuery object */
  7861. $.fn.datepicker = function (options) {
  7862. /* Verify an empty collection wasn't passed - Fixes #6976 */
  7863. if (!this.length) {
  7864. return this;
  7865. }
  7866. /* Initialise the date picker. */
  7867. if (!$.datepicker.initialized) {
  7868. $(document).on("mousedown", $.datepicker._checkExternalClick);
  7869. $.datepicker.initialized = true;
  7870. }
  7871. /* Append datepicker main container to body if not exist. */
  7872. if ($("#" + $.datepicker._mainDivId).length === 0) {
  7873. $("body").append($.datepicker.dpDiv);
  7874. }
  7875. var otherArgs = Array.prototype.slice.call(arguments, 1);
  7876. if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) {
  7877. return $.datepicker["_" + options + "Datepicker"].apply($.datepicker, [this[0]].concat(otherArgs));
  7878. }
  7879. if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") {
  7880. return $.datepicker["_" + options + "Datepicker"].apply($.datepicker, [this[0]].concat(otherArgs));
  7881. }
  7882. return this.each(function () {
  7883. typeof options === "string" ?
  7884. $.datepicker["_" + options + "Datepicker"].apply($.datepicker, [this].concat(otherArgs)) :
  7885. $.datepicker._attachDatepicker(this, options);
  7886. });
  7887. };
  7888. $.datepicker = new Datepicker(); // singleton instance
  7889. $.datepicker.initialized = false;
  7890. $.datepicker.uuid = new Date().getTime();
  7891. $.datepicker.version = "1.12.1";
  7892. var widgetsDatepicker = $.datepicker;
  7893. // This file is deprecated
  7894. var ie = $.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());
  7895. /*!
  7896. * jQuery UI Mouse 1.12.1
  7897. * http://jqueryui.com
  7898. *
  7899. * Copyright jQuery Foundation and other contributors
  7900. * Released under the MIT license.
  7901. * http://jquery.org/license
  7902. */
  7903. //>>label: Mouse
  7904. //>>group: Widgets
  7905. //>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
  7906. //>>docs: http://api.jqueryui.com/mouse/
  7907. var mouseHandled = false;
  7908. $(document).on("mouseup", function () {
  7909. mouseHandled = false;
  7910. });
  7911. var widgetsMouse = $.widget("ui.mouse", {
  7912. version: "1.12.1",
  7913. options: {
  7914. cancel: "input, textarea, button, select, option",
  7915. distance: 1,
  7916. delay: 0
  7917. },
  7918. _mouseInit: function () {
  7919. var that = this;
  7920. this.element
  7921. .on("mousedown." + this.widgetName, function (event) {
  7922. return that._mouseDown(event);
  7923. })
  7924. .on("click." + this.widgetName, function (event) {
  7925. if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
  7926. $.removeData(event.target, that.widgetName + ".preventClickEvent");
  7927. event.stopImmediatePropagation();
  7928. return false;
  7929. }
  7930. });
  7931. this.started = false;
  7932. },
  7933. // TODO: make sure destroying one instance of mouse doesn't mess with
  7934. // other instances of mouse
  7935. _mouseDestroy: function () {
  7936. this.element.off("." + this.widgetName);
  7937. if (this._mouseMoveDelegate) {
  7938. this.document
  7939. .off("mousemove." + this.widgetName, this._mouseMoveDelegate)
  7940. .off("mouseup." + this.widgetName, this._mouseUpDelegate);
  7941. }
  7942. },
  7943. _mouseDown: function (event) {
  7944. // don't let more than one widget handle mouseStart
  7945. if (mouseHandled) {
  7946. return;
  7947. }
  7948. this._mouseMoved = false;
  7949. // We may have missed mouseup (out of window)
  7950. (this._mouseStarted && this._mouseUp(event));
  7951. this._mouseDownEvent = event;
  7952. var that = this,
  7953. btnIsLeft = (event.which === 1),
  7954. // event.target.nodeName works around a bug in IE 8 with
  7955. // disabled inputs (#7620)
  7956. elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ?
  7957. $(event.target).closest(this.options.cancel).length : false);
  7958. if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
  7959. return true;
  7960. }
  7961. this.mouseDelayMet = !this.options.delay;
  7962. if (!this.mouseDelayMet) {
  7963. this._mouseDelayTimer = setTimeout(function () {
  7964. that.mouseDelayMet = true;
  7965. }, this.options.delay);
  7966. }
  7967. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  7968. this._mouseStarted = (this._mouseStart(event) !== false);
  7969. if (!this._mouseStarted) {
  7970. event.preventDefault();
  7971. return true;
  7972. }
  7973. }
  7974. // Click event may never have fired (Gecko & Opera)
  7975. if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
  7976. $.removeData(event.target, this.widgetName + ".preventClickEvent");
  7977. }
  7978. // These delegates are required to keep context
  7979. this._mouseMoveDelegate = function (event) {
  7980. return that._mouseMove(event);
  7981. };
  7982. this._mouseUpDelegate = function (event) {
  7983. return that._mouseUp(event);
  7984. };
  7985. this.document
  7986. .on("mousemove." + this.widgetName, this._mouseMoveDelegate)
  7987. .on("mouseup." + this.widgetName, this._mouseUpDelegate);
  7988. event.preventDefault();
  7989. mouseHandled = true;
  7990. return true;
  7991. },
  7992. _mouseMove: function (event) {
  7993. // Only check for mouseups outside the document if you've moved inside the document
  7994. // at least once. This prevents the firing of mouseup in the case of IE<9, which will
  7995. // fire a mousemove event if content is placed under the cursor. See #7778
  7996. // Support: IE <9
  7997. if (this._mouseMoved) {
  7998. // IE mouseup check - mouseup happened when mouse was out of window
  7999. if ($.ui.ie && (!document.documentMode || document.documentMode < 9) &&
  8000. !event.button) {
  8001. return this._mouseUp(event);
  8002. // Iframe mouseup check - mouseup occurred in another document
  8003. } else if (!event.which) {
  8004. // Support: Safari <=8 - 9
  8005. // Safari sets which to 0 if you press any of the following keys
  8006. // during a drag (#14461)
  8007. if (event.originalEvent.altKey || event.originalEvent.ctrlKey ||
  8008. event.originalEvent.metaKey || event.originalEvent.shiftKey) {
  8009. this.ignoreMissingWhich = true;
  8010. } else if (!this.ignoreMissingWhich) {
  8011. return this._mouseUp(event);
  8012. }
  8013. }
  8014. }
  8015. if (event.which || event.button) {
  8016. this._mouseMoved = true;
  8017. }
  8018. if (this._mouseStarted) {
  8019. this._mouseDrag(event);
  8020. return event.preventDefault();
  8021. }
  8022. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  8023. this._mouseStarted =
  8024. (this._mouseStart(this._mouseDownEvent, event) !== false);
  8025. (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
  8026. }
  8027. return !this._mouseStarted;
  8028. },
  8029. _mouseUp: function (event) {
  8030. this.document
  8031. .off("mousemove." + this.widgetName, this._mouseMoveDelegate)
  8032. .off("mouseup." + this.widgetName, this._mouseUpDelegate);
  8033. if (this._mouseStarted) {
  8034. this._mouseStarted = false;
  8035. if (event.target === this._mouseDownEvent.target) {
  8036. $.data(event.target, this.widgetName + ".preventClickEvent", true);
  8037. }
  8038. this._mouseStop(event);
  8039. }
  8040. if (this._mouseDelayTimer) {
  8041. clearTimeout(this._mouseDelayTimer);
  8042. delete this._mouseDelayTimer;
  8043. }
  8044. this.ignoreMissingWhich = false;
  8045. mouseHandled = false;
  8046. event.preventDefault();
  8047. },
  8048. _mouseDistanceMet: function (event) {
  8049. return (Math.max(
  8050. Math.abs(this._mouseDownEvent.pageX - event.pageX),
  8051. Math.abs(this._mouseDownEvent.pageY - event.pageY)
  8052. ) >= this.options.distance
  8053. );
  8054. },
  8055. _mouseDelayMet: function ( /* event */) {
  8056. return this.mouseDelayMet;
  8057. },
  8058. // These are placeholder methods, to be overriden by extending plugin
  8059. _mouseStart: function ( /* event */) {
  8060. },
  8061. _mouseDrag: function ( /* event */) {
  8062. },
  8063. _mouseStop: function ( /* event */) {
  8064. },
  8065. _mouseCapture: function ( /* event */) {
  8066. return true;
  8067. }
  8068. });
  8069. // $.ui.plugin is deprecated. Use $.widget() extensions instead.
  8070. var plugin = $.ui.plugin = {
  8071. add: function (module, option, set) {
  8072. var i,
  8073. proto = $.ui[module].prototype;
  8074. for (i in set) {
  8075. proto.plugins[i] = proto.plugins[i] || [];
  8076. proto.plugins[i].push([option, set[i]]);
  8077. }
  8078. },
  8079. call: function (instance, name, args, allowDisconnected) {
  8080. var i,
  8081. set = instance.plugins[name];
  8082. if (!set) {
  8083. return;
  8084. }
  8085. if (!allowDisconnected && (!instance.element[0].parentNode ||
  8086. instance.element[0].parentNode.nodeType === 11)) {
  8087. return;
  8088. }
  8089. for (i = 0; i < set.length; i++) {
  8090. if (instance.options[set[i][0]]) {
  8091. set[i][1].apply(instance.element, args);
  8092. }
  8093. }
  8094. }
  8095. };
  8096. var safeBlur = $.ui.safeBlur = function (element) {
  8097. // Support: IE9 - 10 only
  8098. // If the <body> is blurred, IE will switch windows, see #9420
  8099. if (element && element.nodeName.toLowerCase() !== "body") {
  8100. $(element).trigger("blur");
  8101. }
  8102. };
  8103. /*!
  8104. * jQuery UI Draggable 1.12.1
  8105. * http://jqueryui.com
  8106. *
  8107. * Copyright jQuery Foundation and other contributors
  8108. * Released under the MIT license.
  8109. * http://jquery.org/license
  8110. */
  8111. //>>label: Draggable
  8112. //>>group: Interactions
  8113. //>>description: Enables dragging functionality for any element.
  8114. //>>docs: http://api.jqueryui.com/draggable/
  8115. //>>demos: http://jqueryui.com/draggable/
  8116. //>>css.structure: ../../themes/base/draggable.css
  8117. $.widget("ui.draggable", $.ui.mouse, {
  8118. version: "1.12.1",
  8119. widgetEventPrefix: "drag",
  8120. options: {
  8121. addClasses: true,
  8122. appendTo: "parent",
  8123. axis: false,
  8124. connectToSortable: false,
  8125. containment: false,
  8126. cursor: "auto",
  8127. cursorAt: false,
  8128. grid: false,
  8129. handle: false,
  8130. helper: "original",
  8131. iframeFix: false,
  8132. opacity: false,
  8133. refreshPositions: false,
  8134. revert: false,
  8135. revertDuration: 500,
  8136. scope: "default",
  8137. scroll: true,
  8138. scrollSensitivity: 20,
  8139. scrollSpeed: 20,
  8140. snap: false,
  8141. snapMode: "both",
  8142. snapTolerance: 20,
  8143. stack: false,
  8144. zIndex: false,
  8145. // Callbacks
  8146. drag: null,
  8147. start: null,
  8148. stop: null
  8149. },
  8150. _create: function () {
  8151. if (this.options.helper === "original") {
  8152. this._setPositionRelative();
  8153. }
  8154. if (this.options.addClasses) {
  8155. this._addClass("ui-draggable");
  8156. }
  8157. this._setHandleClassName();
  8158. this._mouseInit();
  8159. },
  8160. _setOption: function (key, value) {
  8161. this._super(key, value);
  8162. if (key === "handle") {
  8163. this._removeHandleClassName();
  8164. this._setHandleClassName();
  8165. }
  8166. },
  8167. _destroy: function () {
  8168. if ((this.helper || this.element).is(".ui-draggable-dragging")) {
  8169. this.destroyOnClear = true;
  8170. return;
  8171. }
  8172. this._removeHandleClassName();
  8173. this._mouseDestroy();
  8174. },
  8175. _mouseCapture: function (event) {
  8176. var o = this.options;
  8177. // Among others, prevent a drag on a resizable-handle
  8178. if (this.helper || o.disabled ||
  8179. $(event.target).closest(".ui-resizable-handle").length > 0) {
  8180. return false;
  8181. }
  8182. //Quit if we're not on a valid handle
  8183. this.handle = this._getHandle(event);
  8184. if (!this.handle) {
  8185. return false;
  8186. }
  8187. this._blurActiveElement(event);
  8188. this._blockFrames(o.iframeFix === true ? "iframe" : o.iframeFix);
  8189. return true;
  8190. },
  8191. _blockFrames: function (selector) {
  8192. this.iframeBlocks = this.document.find(selector).map(function () {
  8193. var iframe = $(this);
  8194. return $("<div>")
  8195. .css("position", "absolute")
  8196. .appendTo(iframe.parent())
  8197. .outerWidth(iframe.outerWidth())
  8198. .outerHeight(iframe.outerHeight())
  8199. .offset(iframe.offset())[0];
  8200. });
  8201. },
  8202. _unblockFrames: function () {
  8203. if (this.iframeBlocks) {
  8204. this.iframeBlocks.remove();
  8205. delete this.iframeBlocks;
  8206. }
  8207. },
  8208. _blurActiveElement: function (event) {
  8209. var activeElement = $.ui.safeActiveElement(this.document[0]),
  8210. target = $(event.target);
  8211. // Don't blur if the event occurred on an element that is within
  8212. // the currently focused element
  8213. // See #10527, #12472
  8214. if (target.closest(activeElement).length) {
  8215. return;
  8216. }
  8217. // Blur any element that currently has focus, see #4261
  8218. $.ui.safeBlur(activeElement);
  8219. },
  8220. _mouseStart: function (event) {
  8221. var o = this.options;
  8222. //Create and append the visible helper
  8223. this.helper = this._createHelper(event);
  8224. this._addClass(this.helper, "ui-draggable-dragging");
  8225. //Cache the helper size
  8226. this._cacheHelperProportions();
  8227. //If ddmanager is used for droppables, set the global draggable
  8228. if ($.ui.ddmanager) {
  8229. $.ui.ddmanager.current = this;
  8230. }
  8231. /*
  8232. * - Position generation -
  8233. * This block generates everything position related - it's the core of draggables.
  8234. */
  8235. //Cache the margins of the original element
  8236. this._cacheMargins();
  8237. //Store the helper's css position
  8238. this.cssPosition = this.helper.css("position");
  8239. this.scrollParent = this.helper.scrollParent(true);
  8240. this.offsetParent = this.helper.offsetParent();
  8241. this.hasFixedAncestor = this.helper.parents().filter(function () {
  8242. return $(this).css("position") === "fixed";
  8243. }).length > 0;
  8244. //The element's absolute position on the page minus margins
  8245. this.positionAbs = this.element.offset();
  8246. this._refreshOffsets(event);
  8247. //Generate the original position
  8248. this.originalPosition = this.position = this._generatePosition(event, false);
  8249. this.originalPageX = event.pageX;
  8250. this.originalPageY = event.pageY;
  8251. //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
  8252. (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
  8253. //Set a containment if given in the options
  8254. this._setContainment();
  8255. //Trigger event + callbacks
  8256. if (this._trigger("start", event) === false) {
  8257. this._clear();
  8258. return false;
  8259. }
  8260. //Recache the helper size
  8261. this._cacheHelperProportions();
  8262. //Prepare the droppable offsets
  8263. if ($.ui.ddmanager && !o.dropBehaviour) {
  8264. $.ui.ddmanager.prepareOffsets(this, event);
  8265. }
  8266. // Execute the drag once - this causes the helper not to be visible before getting its
  8267. // correct position
  8268. this._mouseDrag(event, true);
  8269. // If the ddmanager is used for droppables, inform the manager that dragging has started
  8270. // (see #5003)
  8271. if ($.ui.ddmanager) {
  8272. $.ui.ddmanager.dragStart(this, event);
  8273. }
  8274. return true;
  8275. },
  8276. _refreshOffsets: function (event) {
  8277. this.offset = {
  8278. top: this.positionAbs.top - this.margins.top,
  8279. left: this.positionAbs.left - this.margins.left,
  8280. scroll: false,
  8281. parent: this._getParentOffset(),
  8282. relative: this._getRelativeOffset()
  8283. };
  8284. this.offset.click = {
  8285. left: event.pageX - this.offset.left,
  8286. top: event.pageY - this.offset.top
  8287. };
  8288. },
  8289. _mouseDrag: function (event, noPropagation) {
  8290. // reset any necessary cached properties (see #5009)
  8291. if (this.hasFixedAncestor) {
  8292. this.offset.parent = this._getParentOffset();
  8293. }
  8294. //Compute the helpers position
  8295. this.position = this._generatePosition(event, true);
  8296. this.positionAbs = this._convertPositionTo("absolute");
  8297. //Call plugins and callbacks and use the resulting position if something is returned
  8298. if (!noPropagation) {
  8299. var ui = this._uiHash();
  8300. if (this._trigger("drag", event, ui) === false) {
  8301. this._mouseUp(new $.Event("mouseup", event));
  8302. return false;
  8303. }
  8304. this.position = ui.position;
  8305. }
  8306. this.helper[0].style.left = this.position.left + "px";
  8307. this.helper[0].style.top = this.position.top + "px";
  8308. if ($.ui.ddmanager) {
  8309. $.ui.ddmanager.drag(this, event);
  8310. }
  8311. return false;
  8312. },
  8313. _mouseStop: function (event) {
  8314. //If we are using droppables, inform the manager about the drop
  8315. var that = this,
  8316. dropped = false;
  8317. if ($.ui.ddmanager && !this.options.dropBehaviour) {
  8318. dropped = $.ui.ddmanager.drop(this, event);
  8319. }
  8320. //if a drop comes from outside (a sortable)
  8321. if (this.dropped) {
  8322. dropped = this.dropped;
  8323. this.dropped = false;
  8324. }
  8325. if ((this.options.revert === "invalid" && !dropped) ||
  8326. (this.options.revert === "valid" && dropped) ||
  8327. this.options.revert === true || ($.isFunction(this.options.revert) &&
  8328. this.options.revert.call(this.element, dropped))
  8329. ) {
  8330. $(this.helper).animate(
  8331. this.originalPosition,
  8332. parseInt(this.options.revertDuration, 10),
  8333. function () {
  8334. if (that._trigger("stop", event) !== false) {
  8335. that._clear();
  8336. }
  8337. }
  8338. );
  8339. } else {
  8340. if (this._trigger("stop", event) !== false) {
  8341. this._clear();
  8342. }
  8343. }
  8344. return false;
  8345. },
  8346. _mouseUp: function (event) {
  8347. this._unblockFrames();
  8348. // If the ddmanager is used for droppables, inform the manager that dragging has stopped
  8349. // (see #5003)
  8350. if ($.ui.ddmanager) {
  8351. $.ui.ddmanager.dragStop(this, event);
  8352. }
  8353. // Only need to focus if the event occurred on the draggable itself, see #10527
  8354. if (this.handleElement.is(event.target)) {
  8355. // The interaction is over; whether or not the click resulted in a drag,
  8356. // focus the element
  8357. this.element.trigger("focus");
  8358. }
  8359. return $.ui.mouse.prototype._mouseUp.call(this, event);
  8360. },
  8361. cancel: function () {
  8362. if (this.helper.is(".ui-draggable-dragging")) {
  8363. this._mouseUp(new $.Event("mouseup", {target: this.element[0]}));
  8364. } else {
  8365. this._clear();
  8366. }
  8367. return this;
  8368. },
  8369. _getHandle: function (event) {
  8370. return this.options.handle ?
  8371. !!$(event.target).closest(this.element.find(this.options.handle)).length :
  8372. true;
  8373. },
  8374. _setHandleClassName: function () {
  8375. this.handleElement = this.options.handle ?
  8376. this.element.find(this.options.handle) : this.element;
  8377. this._addClass(this.handleElement, "ui-draggable-handle");
  8378. },
  8379. _removeHandleClassName: function () {
  8380. this._removeClass(this.handleElement, "ui-draggable-handle");
  8381. },
  8382. _createHelper: function (event) {
  8383. var o = this.options,
  8384. helperIsFunction = $.isFunction(o.helper),
  8385. helper = helperIsFunction ?
  8386. $(o.helper.apply(this.element[0], [event])) :
  8387. (o.helper === "clone" ?
  8388. this.element.clone().removeAttr("id") :
  8389. this.element);
  8390. if (!helper.parents("body").length) {
  8391. helper.appendTo((o.appendTo === "parent" ?
  8392. this.element[0].parentNode :
  8393. o.appendTo));
  8394. }
  8395. // Http://bugs.jqueryui.com/ticket/9446
  8396. // a helper function can return the original element
  8397. // which wouldn't have been set to relative in _create
  8398. if (helperIsFunction && helper[0] === this.element[0]) {
  8399. this._setPositionRelative();
  8400. }
  8401. if (helper[0] !== this.element[0] &&
  8402. !(/(fixed|absolute)/).test(helper.css("position"))) {
  8403. helper.css("position", "absolute");
  8404. }
  8405. return helper;
  8406. },
  8407. _setPositionRelative: function () {
  8408. if (!(/^(?:r|a|f)/).test(this.element.css("position"))) {
  8409. this.element[0].style.position = "relative";
  8410. }
  8411. },
  8412. _adjustOffsetFromHelper: function (obj) {
  8413. if (typeof obj === "string") {
  8414. obj = obj.split(" ");
  8415. }
  8416. if ($.isArray(obj)) {
  8417. obj = {left: +obj[0], top: +obj[1] || 0};
  8418. }
  8419. if ("left" in obj) {
  8420. this.offset.click.left = obj.left + this.margins.left;
  8421. }
  8422. if ("right" in obj) {
  8423. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  8424. }
  8425. if ("top" in obj) {
  8426. this.offset.click.top = obj.top + this.margins.top;
  8427. }
  8428. if ("bottom" in obj) {
  8429. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  8430. }
  8431. },
  8432. _isRootNode: function (element) {
  8433. return (/(html|body)/i).test(element.tagName) || element === this.document[0];
  8434. },
  8435. _getParentOffset: function () {
  8436. //Get the offsetParent and cache its position
  8437. var po = this.offsetParent.offset(),
  8438. document = this.document[0];
  8439. // This is a special case where we need to modify a offset calculated on start, since the
  8440. // following happened:
  8441. // 1. The position of the helper is absolute, so it's position is calculated based on the
  8442. // next positioned parent
  8443. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
  8444. // the document, which means that the scroll is included in the initial calculation of the
  8445. // offset of the parent, and never recalculated upon drag
  8446. if (this.cssPosition === "absolute" && this.scrollParent[0] !== document &&
  8447. $.contains(this.scrollParent[0], this.offsetParent[0])) {
  8448. po.left += this.scrollParent.scrollLeft();
  8449. po.top += this.scrollParent.scrollTop();
  8450. }
  8451. if (this._isRootNode(this.offsetParent[0])) {
  8452. po = {top: 0, left: 0};
  8453. }
  8454. return {
  8455. top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
  8456. left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
  8457. };
  8458. },
  8459. _getRelativeOffset: function () {
  8460. if (this.cssPosition !== "relative") {
  8461. return {top: 0, left: 0};
  8462. }
  8463. var p = this.element.position(),
  8464. scrollIsRootNode = this._isRootNode(this.scrollParent[0]);
  8465. return {
  8466. top: p.top - (parseInt(this.helper.css("top"), 10) || 0) +
  8467. (!scrollIsRootNode ? this.scrollParent.scrollTop() : 0),
  8468. left: p.left - (parseInt(this.helper.css("left"), 10) || 0) +
  8469. (!scrollIsRootNode ? this.scrollParent.scrollLeft() : 0)
  8470. };
  8471. },
  8472. _cacheMargins: function () {
  8473. this.margins = {
  8474. left: (parseInt(this.element.css("marginLeft"), 10) || 0),
  8475. top: (parseInt(this.element.css("marginTop"), 10) || 0),
  8476. right: (parseInt(this.element.css("marginRight"), 10) || 0),
  8477. bottom: (parseInt(this.element.css("marginBottom"), 10) || 0)
  8478. };
  8479. },
  8480. _cacheHelperProportions: function () {
  8481. this.helperProportions = {
  8482. width: this.helper.outerWidth(),
  8483. height: this.helper.outerHeight()
  8484. };
  8485. },
  8486. _setContainment: function () {
  8487. var isUserScrollable, c, ce,
  8488. o = this.options,
  8489. document = this.document[0];
  8490. this.relativeContainer = null;
  8491. if (!o.containment) {
  8492. this.containment = null;
  8493. return;
  8494. }
  8495. if (o.containment === "window") {
  8496. this.containment = [
  8497. $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
  8498. $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top,
  8499. $(window).scrollLeft() + $(window).width() -
  8500. this.helperProportions.width - this.margins.left,
  8501. $(window).scrollTop() +
  8502. ($(window).height() || document.body.parentNode.scrollHeight) -
  8503. this.helperProportions.height - this.margins.top
  8504. ];
  8505. return;
  8506. }
  8507. if (o.containment === "document") {
  8508. this.containment = [
  8509. 0,
  8510. 0,
  8511. $(document).width() - this.helperProportions.width - this.margins.left,
  8512. ($(document).height() || document.body.parentNode.scrollHeight) -
  8513. this.helperProportions.height - this.margins.top
  8514. ];
  8515. return;
  8516. }
  8517. if (o.containment.constructor === Array) {
  8518. this.containment = o.containment;
  8519. return;
  8520. }
  8521. if (o.containment === "parent") {
  8522. o.containment = this.helper[0].parentNode;
  8523. }
  8524. c = $(o.containment);
  8525. ce = c[0];
  8526. if (!ce) {
  8527. return;
  8528. }
  8529. isUserScrollable = /(scroll|auto)/.test(c.css("overflow"));
  8530. this.containment = [
  8531. (parseInt(c.css("borderLeftWidth"), 10) || 0) +
  8532. (parseInt(c.css("paddingLeft"), 10) || 0),
  8533. (parseInt(c.css("borderTopWidth"), 10) || 0) +
  8534. (parseInt(c.css("paddingTop"), 10) || 0),
  8535. (isUserScrollable ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) -
  8536. (parseInt(c.css("borderRightWidth"), 10) || 0) -
  8537. (parseInt(c.css("paddingRight"), 10) || 0) -
  8538. this.helperProportions.width -
  8539. this.margins.left -
  8540. this.margins.right,
  8541. (isUserScrollable ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) -
  8542. (parseInt(c.css("borderBottomWidth"), 10) || 0) -
  8543. (parseInt(c.css("paddingBottom"), 10) || 0) -
  8544. this.helperProportions.height -
  8545. this.margins.top -
  8546. this.margins.bottom
  8547. ];
  8548. this.relativeContainer = c;
  8549. },
  8550. _convertPositionTo: function (d, pos) {
  8551. if (!pos) {
  8552. pos = this.position;
  8553. }
  8554. var mod = d === "absolute" ? 1 : -1,
  8555. scrollIsRootNode = this._isRootNode(this.scrollParent[0]);
  8556. return {
  8557. top: (
  8558. // The absolute mouse position
  8559. pos.top +
  8560. // Only for relative positioned nodes: Relative offset from element to offset parent
  8561. this.offset.relative.top * mod +
  8562. // The offsetParent's offset without borders (offset + border)
  8563. this.offset.parent.top * mod -
  8564. ((this.cssPosition === "fixed" ?
  8565. -this.offset.scroll.top :
  8566. (scrollIsRootNode ? 0 : this.offset.scroll.top)) * mod)
  8567. ),
  8568. left: (
  8569. // The absolute mouse position
  8570. pos.left +
  8571. // Only for relative positioned nodes: Relative offset from element to offset parent
  8572. this.offset.relative.left * mod +
  8573. // The offsetParent's offset without borders (offset + border)
  8574. this.offset.parent.left * mod -
  8575. ((this.cssPosition === "fixed" ?
  8576. -this.offset.scroll.left :
  8577. (scrollIsRootNode ? 0 : this.offset.scroll.left)) * mod)
  8578. )
  8579. };
  8580. },
  8581. _generatePosition: function (event, constrainPosition) {
  8582. var containment, co, top, left,
  8583. o = this.options,
  8584. scrollIsRootNode = this._isRootNode(this.scrollParent[0]),
  8585. pageX = event.pageX,
  8586. pageY = event.pageY;
  8587. // Cache the scroll
  8588. if (!scrollIsRootNode || !this.offset.scroll) {
  8589. this.offset.scroll = {
  8590. top: this.scrollParent.scrollTop(),
  8591. left: this.scrollParent.scrollLeft()
  8592. };
  8593. }
  8594. /*
  8595. * - Position constraining -
  8596. * Constrain the position to a mix of grid, containment.
  8597. */
  8598. // If we are not dragging yet, we won't check for options
  8599. if (constrainPosition) {
  8600. if (this.containment) {
  8601. if (this.relativeContainer) {
  8602. co = this.relativeContainer.offset();
  8603. containment = [
  8604. this.containment[0] + co.left,
  8605. this.containment[1] + co.top,
  8606. this.containment[2] + co.left,
  8607. this.containment[3] + co.top
  8608. ];
  8609. } else {
  8610. containment = this.containment;
  8611. }
  8612. if (event.pageX - this.offset.click.left < containment[0]) {
  8613. pageX = containment[0] + this.offset.click.left;
  8614. }
  8615. if (event.pageY - this.offset.click.top < containment[1]) {
  8616. pageY = containment[1] + this.offset.click.top;
  8617. }
  8618. if (event.pageX - this.offset.click.left > containment[2]) {
  8619. pageX = containment[2] + this.offset.click.left;
  8620. }
  8621. if (event.pageY - this.offset.click.top > containment[3]) {
  8622. pageY = containment[3] + this.offset.click.top;
  8623. }
  8624. }
  8625. if (o.grid) {
  8626. //Check for grid elements set to 0 to prevent divide by 0 error causing invalid
  8627. // argument errors in IE (see ticket #6950)
  8628. top = o.grid[1] ? this.originalPageY + Math.round((pageY -
  8629. this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
  8630. pageY = containment ? ((top - this.offset.click.top >= containment[1] ||
  8631. top - this.offset.click.top > containment[3]) ?
  8632. top :
  8633. ((top - this.offset.click.top >= containment[1]) ?
  8634. top - o.grid[1] : top + o.grid[1])) : top;
  8635. left = o.grid[0] ? this.originalPageX +
  8636. Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] :
  8637. this.originalPageX;
  8638. pageX = containment ? ((left - this.offset.click.left >= containment[0] ||
  8639. left - this.offset.click.left > containment[2]) ?
  8640. left :
  8641. ((left - this.offset.click.left >= containment[0]) ?
  8642. left - o.grid[0] : left + o.grid[0])) : left;
  8643. }
  8644. if (o.axis === "y") {
  8645. pageX = this.originalPageX;
  8646. }
  8647. if (o.axis === "x") {
  8648. pageY = this.originalPageY;
  8649. }
  8650. }
  8651. return {
  8652. top: (
  8653. // The absolute mouse position
  8654. pageY -
  8655. // Click offset (relative to the element)
  8656. this.offset.click.top -
  8657. // Only for relative positioned nodes: Relative offset from element to offset parent
  8658. this.offset.relative.top -
  8659. // The offsetParent's offset without borders (offset + border)
  8660. this.offset.parent.top +
  8661. (this.cssPosition === "fixed" ?
  8662. -this.offset.scroll.top :
  8663. (scrollIsRootNode ? 0 : this.offset.scroll.top))
  8664. ),
  8665. left: (
  8666. // The absolute mouse position
  8667. pageX -
  8668. // Click offset (relative to the element)
  8669. this.offset.click.left -
  8670. // Only for relative positioned nodes: Relative offset from element to offset parent
  8671. this.offset.relative.left -
  8672. // The offsetParent's offset without borders (offset + border)
  8673. this.offset.parent.left +
  8674. (this.cssPosition === "fixed" ?
  8675. -this.offset.scroll.left :
  8676. (scrollIsRootNode ? 0 : this.offset.scroll.left))
  8677. )
  8678. };
  8679. },
  8680. _clear: function () {
  8681. this._removeClass(this.helper, "ui-draggable-dragging");
  8682. if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
  8683. this.helper.remove();
  8684. }
  8685. this.helper = null;
  8686. this.cancelHelperRemoval = false;
  8687. if (this.destroyOnClear) {
  8688. this.destroy();
  8689. }
  8690. },
  8691. // From now on bulk stuff - mainly helpers
  8692. _trigger: function (type, event, ui) {
  8693. ui = ui || this._uiHash();
  8694. $.ui.plugin.call(this, type, [event, ui, this], true);
  8695. // Absolute position and offset (see #6884 ) have to be recalculated after plugins
  8696. if (/^(drag|start|stop)/.test(type)) {
  8697. this.positionAbs = this._convertPositionTo("absolute");
  8698. ui.offset = this.positionAbs;
  8699. }
  8700. return $.Widget.prototype._trigger.call(this, type, event, ui);
  8701. },
  8702. plugins: {},
  8703. _uiHash: function () {
  8704. return {
  8705. helper: this.helper,
  8706. position: this.position,
  8707. originalPosition: this.originalPosition,
  8708. offset: this.positionAbs
  8709. };
  8710. }
  8711. });
  8712. $.ui.plugin.add("draggable", "connectToSortable", {
  8713. start: function (event, ui, draggable) {
  8714. var uiSortable = $.extend({}, ui, {
  8715. item: draggable.element
  8716. });
  8717. draggable.sortables = [];
  8718. $(draggable.options.connectToSortable).each(function () {
  8719. var sortable = $(this).sortable("instance");
  8720. if (sortable && !sortable.options.disabled) {
  8721. draggable.sortables.push(sortable);
  8722. // RefreshPositions is called at drag start to refresh the containerCache
  8723. // which is used in drag. This ensures it's initialized and synchronized
  8724. // with any changes that might have happened on the page since initialization.
  8725. sortable.refreshPositions();
  8726. sortable._trigger("activate", event, uiSortable);
  8727. }
  8728. });
  8729. },
  8730. stop: function (event, ui, draggable) {
  8731. var uiSortable = $.extend({}, ui, {
  8732. item: draggable.element
  8733. });
  8734. draggable.cancelHelperRemoval = false;
  8735. $.each(draggable.sortables, function () {
  8736. var sortable = this;
  8737. if (sortable.isOver) {
  8738. sortable.isOver = 0;
  8739. // Allow this sortable to handle removing the helper
  8740. draggable.cancelHelperRemoval = true;
  8741. sortable.cancelHelperRemoval = false;
  8742. // Use _storedCSS To restore properties in the sortable,
  8743. // as this also handles revert (#9675) since the draggable
  8744. // may have modified them in unexpected ways (#8809)
  8745. sortable._storedCSS = {
  8746. position: sortable.placeholder.css("position"),
  8747. top: sortable.placeholder.css("top"),
  8748. left: sortable.placeholder.css("left")
  8749. };
  8750. sortable._mouseStop(event);
  8751. // Once drag has ended, the sortable should return to using
  8752. // its original helper, not the shared helper from draggable
  8753. sortable.options.helper = sortable.options._helper;
  8754. } else {
  8755. // Prevent this Sortable from removing the helper.
  8756. // However, don't set the draggable to remove the helper
  8757. // either as another connected Sortable may yet handle the removal.
  8758. sortable.cancelHelperRemoval = true;
  8759. sortable._trigger("deactivate", event, uiSortable);
  8760. }
  8761. });
  8762. },
  8763. drag: function (event, ui, draggable) {
  8764. $.each(draggable.sortables, function () {
  8765. var innermostIntersecting = false,
  8766. sortable = this;
  8767. // Copy over variables that sortable's _intersectsWith uses
  8768. sortable.positionAbs = draggable.positionAbs;
  8769. sortable.helperProportions = draggable.helperProportions;
  8770. sortable.offset.click = draggable.offset.click;
  8771. if (sortable._intersectsWith(sortable.containerCache)) {
  8772. innermostIntersecting = true;
  8773. $.each(draggable.sortables, function () {
  8774. // Copy over variables that sortable's _intersectsWith uses
  8775. this.positionAbs = draggable.positionAbs;
  8776. this.helperProportions = draggable.helperProportions;
  8777. this.offset.click = draggable.offset.click;
  8778. if (this !== sortable &&
  8779. this._intersectsWith(this.containerCache) &&
  8780. $.contains(sortable.element[0], this.element[0])) {
  8781. innermostIntersecting = false;
  8782. }
  8783. return innermostIntersecting;
  8784. });
  8785. }
  8786. if (innermostIntersecting) {
  8787. // If it intersects, we use a little isOver variable and set it once,
  8788. // so that the move-in stuff gets fired only once.
  8789. if (!sortable.isOver) {
  8790. sortable.isOver = 1;
  8791. // Store draggable's parent in case we need to reappend to it later.
  8792. draggable._parent = ui.helper.parent();
  8793. sortable.currentItem = ui.helper
  8794. .appendTo(sortable.element)
  8795. .data("ui-sortable-item", true);
  8796. // Store helper option to later restore it
  8797. sortable.options._helper = sortable.options.helper;
  8798. sortable.options.helper = function () {
  8799. return ui.helper[0];
  8800. };
  8801. // Fire the start events of the sortable with our passed browser event,
  8802. // and our own helper (so it doesn't create a new one)
  8803. event.target = sortable.currentItem[0];
  8804. sortable._mouseCapture(event, true);
  8805. sortable._mouseStart(event, true, true);
  8806. // Because the browser event is way off the new appended portlet,
  8807. // modify necessary variables to reflect the changes
  8808. sortable.offset.click.top = draggable.offset.click.top;
  8809. sortable.offset.click.left = draggable.offset.click.left;
  8810. sortable.offset.parent.left -= draggable.offset.parent.left -
  8811. sortable.offset.parent.left;
  8812. sortable.offset.parent.top -= draggable.offset.parent.top -
  8813. sortable.offset.parent.top;
  8814. draggable._trigger("toSortable", event);
  8815. // Inform draggable that the helper is in a valid drop zone,
  8816. // used solely in the revert option to handle "valid/invalid".
  8817. draggable.dropped = sortable.element;
  8818. // Need to refreshPositions of all sortables in the case that
  8819. // adding to one sortable changes the location of the other sortables (#9675)
  8820. $.each(draggable.sortables, function () {
  8821. this.refreshPositions();
  8822. });
  8823. // Hack so receive/update callbacks work (mostly)
  8824. draggable.currentItem = draggable.element;
  8825. sortable.fromOutside = draggable;
  8826. }
  8827. if (sortable.currentItem) {
  8828. sortable._mouseDrag(event);
  8829. // Copy the sortable's position because the draggable's can potentially reflect
  8830. // a relative position, while sortable is always absolute, which the dragged
  8831. // element has now become. (#8809)
  8832. ui.position = sortable.position;
  8833. }
  8834. } else {
  8835. // If it doesn't intersect with the sortable, and it intersected before,
  8836. // we fake the drag stop of the sortable, but make sure it doesn't remove
  8837. // the helper by using cancelHelperRemoval.
  8838. if (sortable.isOver) {
  8839. sortable.isOver = 0;
  8840. sortable.cancelHelperRemoval = true;
  8841. // Calling sortable's mouseStop would trigger a revert,
  8842. // so revert must be temporarily false until after mouseStop is called.
  8843. sortable.options._revert = sortable.options.revert;
  8844. sortable.options.revert = false;
  8845. sortable._trigger("out", event, sortable._uiHash(sortable));
  8846. sortable._mouseStop(event, true);
  8847. // Restore sortable behaviors that were modfied
  8848. // when the draggable entered the sortable area (#9481)
  8849. sortable.options.revert = sortable.options._revert;
  8850. sortable.options.helper = sortable.options._helper;
  8851. if (sortable.placeholder) {
  8852. sortable.placeholder.remove();
  8853. }
  8854. // Restore and recalculate the draggable's offset considering the sortable
  8855. // may have modified them in unexpected ways. (#8809, #10669)
  8856. ui.helper.appendTo(draggable._parent);
  8857. draggable._refreshOffsets(event);
  8858. ui.position = draggable._generatePosition(event, true);
  8859. draggable._trigger("fromSortable", event);
  8860. // Inform draggable that the helper is no longer in a valid drop zone
  8861. draggable.dropped = false;
  8862. // Need to refreshPositions of all sortables just in case removing
  8863. // from one sortable changes the location of other sortables (#9675)
  8864. $.each(draggable.sortables, function () {
  8865. this.refreshPositions();
  8866. });
  8867. }
  8868. }
  8869. });
  8870. }
  8871. });
  8872. $.ui.plugin.add("draggable", "cursor", {
  8873. start: function (event, ui, instance) {
  8874. var t = $("body"),
  8875. o = instance.options;
  8876. if (t.css("cursor")) {
  8877. o._cursor = t.css("cursor");
  8878. }
  8879. t.css("cursor", o.cursor);
  8880. },
  8881. stop: function (event, ui, instance) {
  8882. var o = instance.options;
  8883. if (o._cursor) {
  8884. $("body").css("cursor", o._cursor);
  8885. }
  8886. }
  8887. });
  8888. $.ui.plugin.add("draggable", "opacity", {
  8889. start: function (event, ui, instance) {
  8890. var t = $(ui.helper),
  8891. o = instance.options;
  8892. if (t.css("opacity")) {
  8893. o._opacity = t.css("opacity");
  8894. }
  8895. t.css("opacity", o.opacity);
  8896. },
  8897. stop: function (event, ui, instance) {
  8898. var o = instance.options;
  8899. if (o._opacity) {
  8900. $(ui.helper).css("opacity", o._opacity);
  8901. }
  8902. }
  8903. });
  8904. $.ui.plugin.add("draggable", "scroll", {
  8905. start: function (event, ui, i) {
  8906. if (!i.scrollParentNotHidden) {
  8907. i.scrollParentNotHidden = i.helper.scrollParent(false);
  8908. }
  8909. if (i.scrollParentNotHidden[0] !== i.document[0] &&
  8910. i.scrollParentNotHidden[0].tagName !== "HTML") {
  8911. i.overflowOffset = i.scrollParentNotHidden.offset();
  8912. }
  8913. },
  8914. drag: function (event, ui, i) {
  8915. var o = i.options,
  8916. scrolled = false,
  8917. scrollParent = i.scrollParentNotHidden[0],
  8918. document = i.document[0];
  8919. if (scrollParent !== document && scrollParent.tagName !== "HTML") {
  8920. if (!o.axis || o.axis !== "x") {
  8921. if ((i.overflowOffset.top + scrollParent.offsetHeight) - event.pageY <
  8922. o.scrollSensitivity) {
  8923. scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
  8924. } else if (event.pageY - i.overflowOffset.top < o.scrollSensitivity) {
  8925. scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
  8926. }
  8927. }
  8928. if (!o.axis || o.axis !== "y") {
  8929. if ((i.overflowOffset.left + scrollParent.offsetWidth) - event.pageX <
  8930. o.scrollSensitivity) {
  8931. scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
  8932. } else if (event.pageX - i.overflowOffset.left < o.scrollSensitivity) {
  8933. scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
  8934. }
  8935. }
  8936. } else {
  8937. if (!o.axis || o.axis !== "x") {
  8938. if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
  8939. scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
  8940. } else if ($(window).height() - (event.pageY - $(document).scrollTop()) <
  8941. o.scrollSensitivity) {
  8942. scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
  8943. }
  8944. }
  8945. if (!o.axis || o.axis !== "y") {
  8946. if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
  8947. scrolled = $(document).scrollLeft(
  8948. $(document).scrollLeft() - o.scrollSpeed
  8949. );
  8950. } else if ($(window).width() - (event.pageX - $(document).scrollLeft()) <
  8951. o.scrollSensitivity) {
  8952. scrolled = $(document).scrollLeft(
  8953. $(document).scrollLeft() + o.scrollSpeed
  8954. );
  8955. }
  8956. }
  8957. }
  8958. if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
  8959. $.ui.ddmanager.prepareOffsets(i, event);
  8960. }
  8961. }
  8962. });
  8963. $.ui.plugin.add("draggable", "snap", {
  8964. start: function (event, ui, i) {
  8965. var o = i.options;
  8966. i.snapElements = [];
  8967. $(o.snap.constructor !== String ? (o.snap.items || ":data(ui-draggable)") : o.snap)
  8968. .each(function () {
  8969. var $t = $(this),
  8970. $o = $t.offset();
  8971. if (this !== i.element[0]) {
  8972. i.snapElements.push({
  8973. item: this,
  8974. width: $t.outerWidth(), height: $t.outerHeight(),
  8975. top: $o.top, left: $o.left
  8976. });
  8977. }
  8978. });
  8979. },
  8980. drag: function (event, ui, inst) {
  8981. var ts, bs, ls, rs, l, r, t, b, i, first,
  8982. o = inst.options,
  8983. d = o.snapTolerance,
  8984. x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
  8985. y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
  8986. for (i = inst.snapElements.length - 1; i >= 0; i--) {
  8987. l = inst.snapElements[i].left - inst.margins.left;
  8988. r = l + inst.snapElements[i].width;
  8989. t = inst.snapElements[i].top - inst.margins.top;
  8990. b = t + inst.snapElements[i].height;
  8991. if (x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d ||
  8992. !$.contains(inst.snapElements[i].item.ownerDocument,
  8993. inst.snapElements[i].item)) {
  8994. if (inst.snapElements[i].snapping) {
  8995. (inst.options.snap.release &&
  8996. inst.options.snap.release.call(
  8997. inst.element,
  8998. event,
  8999. $.extend(inst._uiHash(), {snapItem: inst.snapElements[i].item})
  9000. ));
  9001. }
  9002. inst.snapElements[i].snapping = false;
  9003. continue;
  9004. }
  9005. if (o.snapMode !== "inner") {
  9006. ts = Math.abs(t - y2) <= d;
  9007. bs = Math.abs(b - y1) <= d;
  9008. ls = Math.abs(l - x2) <= d;
  9009. rs = Math.abs(r - x1) <= d;
  9010. if (ts) {
  9011. ui.position.top = inst._convertPositionTo("relative", {
  9012. top: t - inst.helperProportions.height,
  9013. left: 0
  9014. }).top;
  9015. }
  9016. if (bs) {
  9017. ui.position.top = inst._convertPositionTo("relative", {
  9018. top: b,
  9019. left: 0
  9020. }).top;
  9021. }
  9022. if (ls) {
  9023. ui.position.left = inst._convertPositionTo("relative", {
  9024. top: 0,
  9025. left: l - inst.helperProportions.width
  9026. }).left;
  9027. }
  9028. if (rs) {
  9029. ui.position.left = inst._convertPositionTo("relative", {
  9030. top: 0,
  9031. left: r
  9032. }).left;
  9033. }
  9034. }
  9035. first = (ts || bs || ls || rs);
  9036. if (o.snapMode !== "outer") {
  9037. ts = Math.abs(t - y1) <= d;
  9038. bs = Math.abs(b - y2) <= d;
  9039. ls = Math.abs(l - x1) <= d;
  9040. rs = Math.abs(r - x2) <= d;
  9041. if (ts) {
  9042. ui.position.top = inst._convertPositionTo("relative", {
  9043. top: t,
  9044. left: 0
  9045. }).top;
  9046. }
  9047. if (bs) {
  9048. ui.position.top = inst._convertPositionTo("relative", {
  9049. top: b - inst.helperProportions.height,
  9050. left: 0
  9051. }).top;
  9052. }
  9053. if (ls) {
  9054. ui.position.left = inst._convertPositionTo("relative", {
  9055. top: 0,
  9056. left: l
  9057. }).left;
  9058. }
  9059. if (rs) {
  9060. ui.position.left = inst._convertPositionTo("relative", {
  9061. top: 0,
  9062. left: r - inst.helperProportions.width
  9063. }).left;
  9064. }
  9065. }
  9066. if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
  9067. (inst.options.snap.snap &&
  9068. inst.options.snap.snap.call(
  9069. inst.element,
  9070. event,
  9071. $.extend(inst._uiHash(), {
  9072. snapItem: inst.snapElements[i].item
  9073. })));
  9074. }
  9075. inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
  9076. }
  9077. }
  9078. });
  9079. $.ui.plugin.add("draggable", "stack", {
  9080. start: function (event, ui, instance) {
  9081. var min,
  9082. o = instance.options,
  9083. group = $.makeArray($(o.stack)).sort(function (a, b) {
  9084. return (parseInt($(a).css("zIndex"), 10) || 0) -
  9085. (parseInt($(b).css("zIndex"), 10) || 0);
  9086. });
  9087. if (!group.length) {
  9088. return;
  9089. }
  9090. min = parseInt($(group[0]).css("zIndex"), 10) || 0;
  9091. $(group).each(function (i) {
  9092. $(this).css("zIndex", min + i);
  9093. });
  9094. this.css("zIndex", (min + group.length));
  9095. }
  9096. });
  9097. $.ui.plugin.add("draggable", "zIndex", {
  9098. start: function (event, ui, instance) {
  9099. var t = $(ui.helper),
  9100. o = instance.options;
  9101. if (t.css("zIndex")) {
  9102. o._zIndex = t.css("zIndex");
  9103. }
  9104. t.css("zIndex", o.zIndex);
  9105. },
  9106. stop: function (event, ui, instance) {
  9107. var o = instance.options;
  9108. if (o._zIndex) {
  9109. $(ui.helper).css("zIndex", o._zIndex);
  9110. }
  9111. }
  9112. });
  9113. var widgetsDraggable = $.ui.draggable;
  9114. /*!
  9115. * jQuery UI Resizable 1.12.1
  9116. * http://jqueryui.com
  9117. *
  9118. * Copyright jQuery Foundation and other contributors
  9119. * Released under the MIT license.
  9120. * http://jquery.org/license
  9121. */
  9122. //>>label: Resizable
  9123. //>>group: Interactions
  9124. //>>description: Enables resize functionality for any element.
  9125. //>>docs: http://api.jqueryui.com/resizable/
  9126. //>>demos: http://jqueryui.com/resizable/
  9127. //>>css.structure: ../../themes/base/core.css
  9128. //>>css.structure: ../../themes/base/resizable.css
  9129. //>>css.theme: ../../themes/base/theme.css
  9130. $.widget("ui.resizable", $.ui.mouse, {
  9131. version: "1.12.1",
  9132. widgetEventPrefix: "resize",
  9133. options: {
  9134. alsoResize: false,
  9135. animate: false,
  9136. animateDuration: "slow",
  9137. animateEasing: "swing",
  9138. aspectRatio: false,
  9139. autoHide: false,
  9140. classes: {
  9141. "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se"
  9142. },
  9143. containment: false,
  9144. ghost: false,
  9145. grid: false,
  9146. handles: "e,s,se",
  9147. helper: false,
  9148. maxHeight: null,
  9149. maxWidth: null,
  9150. minHeight: 10,
  9151. minWidth: 10,
  9152. // See #7960
  9153. zIndex: 90,
  9154. // Callbacks
  9155. resize: null,
  9156. start: null,
  9157. stop: null
  9158. },
  9159. _num: function (value) {
  9160. return parseFloat(value) || 0;
  9161. },
  9162. _isNumber: function (value) {
  9163. return !isNaN(parseFloat(value));
  9164. },
  9165. _hasScroll: function (el, a) {
  9166. if ($(el).css("overflow") === "hidden") {
  9167. return false;
  9168. }
  9169. var scroll = (a && a === "left") ? "scrollLeft" : "scrollTop",
  9170. has = false;
  9171. if (el[scroll] > 0) {
  9172. return true;
  9173. }
  9174. // TODO: determine which cases actually cause this to happen
  9175. // if the element doesn't have the scroll set, see if it's possible to
  9176. // set the scroll
  9177. el[scroll] = 1;
  9178. has = (el[scroll] > 0);
  9179. el[scroll] = 0;
  9180. return has;
  9181. },
  9182. _create: function () {
  9183. var margins,
  9184. o = this.options,
  9185. that = this;
  9186. this._addClass("ui-resizable");
  9187. $.extend(this, {
  9188. _aspectRatio: !!(o.aspectRatio),
  9189. aspectRatio: o.aspectRatio,
  9190. originalElement: this.element,
  9191. _proportionallyResizeElements: [],
  9192. _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
  9193. });
  9194. // Wrap the element if it cannot hold child nodes
  9195. if (this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)) {
  9196. this.element.wrap(
  9197. $("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({
  9198. position: this.element.css("position"),
  9199. width: this.element.outerWidth(),
  9200. height: this.element.outerHeight(),
  9201. top: this.element.css("top"),
  9202. left: this.element.css("left")
  9203. })
  9204. );
  9205. this.element = this.element.parent().data(
  9206. "ui-resizable", this.element.resizable("instance")
  9207. );
  9208. this.elementIsWrapper = true;
  9209. margins = {
  9210. marginTop: this.originalElement.css("marginTop"),
  9211. marginRight: this.originalElement.css("marginRight"),
  9212. marginBottom: this.originalElement.css("marginBottom"),
  9213. marginLeft: this.originalElement.css("marginLeft")
  9214. };
  9215. this.element.css(margins);
  9216. this.originalElement.css("margin", 0);
  9217. // support: Safari
  9218. // Prevent Safari textarea resize
  9219. this.originalResizeStyle = this.originalElement.css("resize");
  9220. this.originalElement.css("resize", "none");
  9221. this._proportionallyResizeElements.push(this.originalElement.css({
  9222. position: "static",
  9223. zoom: 1,
  9224. display: "block"
  9225. }));
  9226. // Support: IE9
  9227. // avoid IE jump (hard set the margin)
  9228. this.originalElement.css(margins);
  9229. this._proportionallyResize();
  9230. }
  9231. this._setupHandles();
  9232. if (o.autoHide) {
  9233. $(this.element)
  9234. .on("mouseenter", function () {
  9235. if (o.disabled) {
  9236. return;
  9237. }
  9238. that._removeClass("ui-resizable-autohide");
  9239. that._handles.show();
  9240. })
  9241. .on("mouseleave", function () {
  9242. if (o.disabled) {
  9243. return;
  9244. }
  9245. if (!that.resizing) {
  9246. that._addClass("ui-resizable-autohide");
  9247. that._handles.hide();
  9248. }
  9249. });
  9250. }
  9251. this._mouseInit();
  9252. },
  9253. _destroy: function () {
  9254. this._mouseDestroy();
  9255. var wrapper,
  9256. _destroy = function (exp) {
  9257. $(exp)
  9258. .removeData("resizable")
  9259. .removeData("ui-resizable")
  9260. .off(".resizable")
  9261. .find(".ui-resizable-handle")
  9262. .remove();
  9263. };
  9264. // TODO: Unwrap at same DOM position
  9265. if (this.elementIsWrapper) {
  9266. _destroy(this.element);
  9267. wrapper = this.element;
  9268. this.originalElement.css({
  9269. position: wrapper.css("position"),
  9270. width: wrapper.outerWidth(),
  9271. height: wrapper.outerHeight(),
  9272. top: wrapper.css("top"),
  9273. left: wrapper.css("left")
  9274. }).insertAfter(wrapper);
  9275. wrapper.remove();
  9276. }
  9277. this.originalElement.css("resize", this.originalResizeStyle);
  9278. _destroy(this.originalElement);
  9279. return this;
  9280. },
  9281. _setOption: function (key, value) {
  9282. this._super(key, value);
  9283. switch (key) {
  9284. case "handles":
  9285. this._removeHandles();
  9286. this._setupHandles();
  9287. break;
  9288. default:
  9289. break;
  9290. }
  9291. },
  9292. _setupHandles: function () {
  9293. var o = this.options, handle, i, n, hname, axis, that = this;
  9294. this.handles = o.handles ||
  9295. (!$(".ui-resizable-handle", this.element).length ?
  9296. "e,s,se" : {
  9297. n: ".ui-resizable-n",
  9298. e: ".ui-resizable-e",
  9299. s: ".ui-resizable-s",
  9300. w: ".ui-resizable-w",
  9301. se: ".ui-resizable-se",
  9302. sw: ".ui-resizable-sw",
  9303. ne: ".ui-resizable-ne",
  9304. nw: ".ui-resizable-nw"
  9305. });
  9306. this._handles = $();
  9307. if (this.handles.constructor === String) {
  9308. if (this.handles === "all") {
  9309. this.handles = "n,e,s,w,se,sw,ne,nw";
  9310. }
  9311. n = this.handles.split(",");
  9312. this.handles = {};
  9313. for (i = 0; i < n.length; i++) {
  9314. handle = $.trim(n[i]);
  9315. hname = "ui-resizable-" + handle;
  9316. axis = $("<div>");
  9317. this._addClass(axis, "ui-resizable-handle " + hname);
  9318. axis.css({zIndex: o.zIndex});
  9319. this.handles[handle] = ".ui-resizable-" + handle;
  9320. this.element.append(axis);
  9321. }
  9322. }
  9323. this._renderAxis = function (target) {
  9324. var i, axis, padPos, padWrapper;
  9325. target = target || this.element;
  9326. for (i in this.handles) {
  9327. if (this.handles[i].constructor === String) {
  9328. this.handles[i] = this.element.children(this.handles[i]).first().show();
  9329. } else if (this.handles[i].jquery || this.handles[i].nodeType) {
  9330. this.handles[i] = $(this.handles[i]);
  9331. this._on(this.handles[i], {"mousedown": that._mouseDown});
  9332. }
  9333. if (this.elementIsWrapper &&
  9334. this.originalElement[0]
  9335. .nodeName
  9336. .match(/^(textarea|input|select|button)$/i)) {
  9337. axis = $(this.handles[i], this.element);
  9338. padWrapper = /sw|ne|nw|se|n|s/.test(i) ?
  9339. axis.outerHeight() :
  9340. axis.outerWidth();
  9341. padPos = ["padding",
  9342. /ne|nw|n/.test(i) ? "Top" :
  9343. /se|sw|s/.test(i) ? "Bottom" :
  9344. /^e$/.test(i) ? "Right" : "Left"].join("");
  9345. target.css(padPos, padWrapper);
  9346. this._proportionallyResize();
  9347. }
  9348. this._handles = this._handles.add(this.handles[i]);
  9349. }
  9350. };
  9351. // TODO: make renderAxis a prototype function
  9352. this._renderAxis(this.element);
  9353. this._handles = this._handles.add(this.element.find(".ui-resizable-handle"));
  9354. this._handles.disableSelection();
  9355. this._handles.on("mouseover", function () {
  9356. if (!that.resizing) {
  9357. if (this.className) {
  9358. axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
  9359. }
  9360. that.axis = axis && axis[1] ? axis[1] : "se";
  9361. }
  9362. });
  9363. if (o.autoHide) {
  9364. this._handles.hide();
  9365. this._addClass("ui-resizable-autohide");
  9366. }
  9367. },
  9368. _removeHandles: function () {
  9369. this._handles.remove();
  9370. },
  9371. _mouseCapture: function (event) {
  9372. var i, handle,
  9373. capture = false;
  9374. for (i in this.handles) {
  9375. handle = $(this.handles[i])[0];
  9376. if (handle === event.target || $.contains(handle, event.target)) {
  9377. capture = true;
  9378. }
  9379. }
  9380. return !this.options.disabled && capture;
  9381. },
  9382. _mouseStart: function (event) {
  9383. var curleft, curtop, cursor,
  9384. o = this.options,
  9385. el = this.element;
  9386. this.resizing = true;
  9387. this._renderProxy();
  9388. curleft = this._num(this.helper.css("left"));
  9389. curtop = this._num(this.helper.css("top"));
  9390. if (o.containment) {
  9391. curleft += $(o.containment).scrollLeft() || 0;
  9392. curtop += $(o.containment).scrollTop() || 0;
  9393. }
  9394. this.offset = this.helper.offset();
  9395. this.position = {left: curleft, top: curtop};
  9396. this.size = this._helper ? {
  9397. width: this.helper.width(),
  9398. height: this.helper.height()
  9399. } : {
  9400. width: el.width(),
  9401. height: el.height()
  9402. };
  9403. this.originalSize = this._helper ? {
  9404. width: el.outerWidth(),
  9405. height: el.outerHeight()
  9406. } : {
  9407. width: el.width(),
  9408. height: el.height()
  9409. };
  9410. this.sizeDiff = {
  9411. width: el.outerWidth() - el.width(),
  9412. height: el.outerHeight() - el.height()
  9413. };
  9414. this.originalPosition = {left: curleft, top: curtop};
  9415. this.originalMousePosition = {left: event.pageX, top: event.pageY};
  9416. this.aspectRatio = (typeof o.aspectRatio === "number") ?
  9417. o.aspectRatio :
  9418. ((this.originalSize.width / this.originalSize.height) || 1);
  9419. cursor = $(".ui-resizable-" + this.axis).css("cursor");
  9420. $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor);
  9421. this._addClass("ui-resizable-resizing");
  9422. this._propagate("start", event);
  9423. return true;
  9424. },
  9425. _mouseDrag: function (event) {
  9426. var data, props,
  9427. smp = this.originalMousePosition,
  9428. a = this.axis,
  9429. dx = (event.pageX - smp.left) || 0,
  9430. dy = (event.pageY - smp.top) || 0,
  9431. trigger = this._change[a];
  9432. this._updatePrevProperties();
  9433. if (!trigger) {
  9434. return false;
  9435. }
  9436. data = trigger.apply(this, [event, dx, dy]);
  9437. this._updateVirtualBoundaries(event.shiftKey);
  9438. if (this._aspectRatio || event.shiftKey) {
  9439. data = this._updateRatio(data, event);
  9440. }
  9441. data = this._respectSize(data, event);
  9442. this._updateCache(data);
  9443. this._propagate("resize", event);
  9444. props = this._applyChanges();
  9445. if (!this._helper && this._proportionallyResizeElements.length) {
  9446. this._proportionallyResize();
  9447. }
  9448. if (!$.isEmptyObject(props)) {
  9449. this._updatePrevProperties();
  9450. this._trigger("resize", event, this.ui());
  9451. this._applyChanges();
  9452. }
  9453. return false;
  9454. },
  9455. _mouseStop: function (event) {
  9456. this.resizing = false;
  9457. var pr, ista, soffseth, soffsetw, s, left, top,
  9458. o = this.options, that = this;
  9459. if (this._helper) {
  9460. pr = this._proportionallyResizeElements;
  9461. ista = pr.length && (/textarea/i).test(pr[0].nodeName);
  9462. soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height;
  9463. soffsetw = ista ? 0 : that.sizeDiff.width;
  9464. s = {
  9465. width: (that.helper.width() - soffsetw),
  9466. height: (that.helper.height() - soffseth)
  9467. };
  9468. left = (parseFloat(that.element.css("left")) +
  9469. (that.position.left - that.originalPosition.left)) || null;
  9470. top = (parseFloat(that.element.css("top")) +
  9471. (that.position.top - that.originalPosition.top)) || null;
  9472. if (!o.animate) {
  9473. this.element.css($.extend(s, {top: top, left: left}));
  9474. }
  9475. that.helper.height(that.size.height);
  9476. that.helper.width(that.size.width);
  9477. if (this._helper && !o.animate) {
  9478. this._proportionallyResize();
  9479. }
  9480. }
  9481. $("body").css("cursor", "auto");
  9482. this._removeClass("ui-resizable-resizing");
  9483. this._propagate("stop", event);
  9484. if (this._helper) {
  9485. this.helper.remove();
  9486. }
  9487. return false;
  9488. },
  9489. _updatePrevProperties: function () {
  9490. this.prevPosition = {
  9491. top: this.position.top,
  9492. left: this.position.left
  9493. };
  9494. this.prevSize = {
  9495. width: this.size.width,
  9496. height: this.size.height
  9497. };
  9498. },
  9499. _applyChanges: function () {
  9500. var props = {};
  9501. if (this.position.top !== this.prevPosition.top) {
  9502. props.top = this.position.top + "px";
  9503. }
  9504. if (this.position.left !== this.prevPosition.left) {
  9505. props.left = this.position.left + "px";
  9506. }
  9507. if (this.size.width !== this.prevSize.width) {
  9508. props.width = this.size.width + "px";
  9509. }
  9510. if (this.size.height !== this.prevSize.height) {
  9511. props.height = this.size.height + "px";
  9512. }
  9513. this.helper.css(props);
  9514. return props;
  9515. },
  9516. _updateVirtualBoundaries: function (forceAspectRatio) {
  9517. var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
  9518. o = this.options;
  9519. b = {
  9520. minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0,
  9521. maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity,
  9522. minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0,
  9523. maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity
  9524. };
  9525. if (this._aspectRatio || forceAspectRatio) {
  9526. pMinWidth = b.minHeight * this.aspectRatio;
  9527. pMinHeight = b.minWidth / this.aspectRatio;
  9528. pMaxWidth = b.maxHeight * this.aspectRatio;
  9529. pMaxHeight = b.maxWidth / this.aspectRatio;
  9530. if (pMinWidth > b.minWidth) {
  9531. b.minWidth = pMinWidth;
  9532. }
  9533. if (pMinHeight > b.minHeight) {
  9534. b.minHeight = pMinHeight;
  9535. }
  9536. if (pMaxWidth < b.maxWidth) {
  9537. b.maxWidth = pMaxWidth;
  9538. }
  9539. if (pMaxHeight < b.maxHeight) {
  9540. b.maxHeight = pMaxHeight;
  9541. }
  9542. }
  9543. this._vBoundaries = b;
  9544. },
  9545. _updateCache: function (data) {
  9546. this.offset = this.helper.offset();
  9547. if (this._isNumber(data.left)) {
  9548. this.position.left = data.left;
  9549. }
  9550. if (this._isNumber(data.top)) {
  9551. this.position.top = data.top;
  9552. }
  9553. if (this._isNumber(data.height)) {
  9554. this.size.height = data.height;
  9555. }
  9556. if (this._isNumber(data.width)) {
  9557. this.size.width = data.width;
  9558. }
  9559. },
  9560. _updateRatio: function (data) {
  9561. var cpos = this.position,
  9562. csize = this.size,
  9563. a = this.axis;
  9564. if (this._isNumber(data.height)) {
  9565. data.width = (data.height * this.aspectRatio);
  9566. } else if (this._isNumber(data.width)) {
  9567. data.height = (data.width / this.aspectRatio);
  9568. }
  9569. if (a === "sw") {
  9570. data.left = cpos.left + (csize.width - data.width);
  9571. data.top = null;
  9572. }
  9573. if (a === "nw") {
  9574. data.top = cpos.top + (csize.height - data.height);
  9575. data.left = cpos.left + (csize.width - data.width);
  9576. }
  9577. return data;
  9578. },
  9579. _respectSize: function (data) {
  9580. var o = this._vBoundaries,
  9581. a = this.axis,
  9582. ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width),
  9583. ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
  9584. isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width),
  9585. isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height),
  9586. dw = this.originalPosition.left + this.originalSize.width,
  9587. dh = this.originalPosition.top + this.originalSize.height,
  9588. cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
  9589. if (isminw) {
  9590. data.width = o.minWidth;
  9591. }
  9592. if (isminh) {
  9593. data.height = o.minHeight;
  9594. }
  9595. if (ismaxw) {
  9596. data.width = o.maxWidth;
  9597. }
  9598. if (ismaxh) {
  9599. data.height = o.maxHeight;
  9600. }
  9601. if (isminw && cw) {
  9602. data.left = dw - o.minWidth;
  9603. }
  9604. if (ismaxw && cw) {
  9605. data.left = dw - o.maxWidth;
  9606. }
  9607. if (isminh && ch) {
  9608. data.top = dh - o.minHeight;
  9609. }
  9610. if (ismaxh && ch) {
  9611. data.top = dh - o.maxHeight;
  9612. }
  9613. // Fixing jump error on top/left - bug #2330
  9614. if (!data.width && !data.height && !data.left && data.top) {
  9615. data.top = null;
  9616. } else if (!data.width && !data.height && !data.top && data.left) {
  9617. data.left = null;
  9618. }
  9619. return data;
  9620. },
  9621. _getPaddingPlusBorderDimensions: function (element) {
  9622. var i = 0,
  9623. widths = [],
  9624. borders = [
  9625. element.css("borderTopWidth"),
  9626. element.css("borderRightWidth"),
  9627. element.css("borderBottomWidth"),
  9628. element.css("borderLeftWidth")
  9629. ],
  9630. paddings = [
  9631. element.css("paddingTop"),
  9632. element.css("paddingRight"),
  9633. element.css("paddingBottom"),
  9634. element.css("paddingLeft")
  9635. ];
  9636. for (; i < 4; i++) {
  9637. widths[i] = (parseFloat(borders[i]) || 0);
  9638. widths[i] += (parseFloat(paddings[i]) || 0);
  9639. }
  9640. return {
  9641. height: widths[0] + widths[2],
  9642. width: widths[1] + widths[3]
  9643. };
  9644. },
  9645. _proportionallyResize: function () {
  9646. if (!this._proportionallyResizeElements.length) {
  9647. return;
  9648. }
  9649. var prel,
  9650. i = 0,
  9651. element = this.helper || this.element;
  9652. for (; i < this._proportionallyResizeElements.length; i++) {
  9653. prel = this._proportionallyResizeElements[i];
  9654. // TODO: Seems like a bug to cache this.outerDimensions
  9655. // considering that we are in a loop.
  9656. if (!this.outerDimensions) {
  9657. this.outerDimensions = this._getPaddingPlusBorderDimensions(prel);
  9658. }
  9659. prel.css({
  9660. height: (element.height() - this.outerDimensions.height) || 0,
  9661. width: (element.width() - this.outerDimensions.width) || 0
  9662. });
  9663. }
  9664. },
  9665. _renderProxy: function () {
  9666. var el = this.element, o = this.options;
  9667. this.elementOffset = el.offset();
  9668. if (this._helper) {
  9669. this.helper = this.helper || $("<div style='overflow:hidden;'></div>");
  9670. this._addClass(this.helper, this._helper);
  9671. this.helper.css({
  9672. width: this.element.outerWidth(),
  9673. height: this.element.outerHeight(),
  9674. position: "absolute",
  9675. left: this.elementOffset.left + "px",
  9676. top: this.elementOffset.top + "px",
  9677. zIndex: ++o.zIndex //TODO: Don't modify option
  9678. });
  9679. this.helper
  9680. .appendTo("body")
  9681. .disableSelection();
  9682. } else {
  9683. this.helper = this.element;
  9684. }
  9685. },
  9686. _change: {
  9687. e: function (event, dx) {
  9688. return {width: this.originalSize.width + dx};
  9689. },
  9690. w: function (event, dx) {
  9691. var cs = this.originalSize, sp = this.originalPosition;
  9692. return {left: sp.left + dx, width: cs.width - dx};
  9693. },
  9694. n: function (event, dx, dy) {
  9695. var cs = this.originalSize, sp = this.originalPosition;
  9696. return {top: sp.top + dy, height: cs.height - dy};
  9697. },
  9698. s: function (event, dx, dy) {
  9699. return {height: this.originalSize.height + dy};
  9700. },
  9701. se: function (event, dx, dy) {
  9702. return $.extend(this._change.s.apply(this, arguments),
  9703. this._change.e.apply(this, [event, dx, dy]));
  9704. },
  9705. sw: function (event, dx, dy) {
  9706. return $.extend(this._change.s.apply(this, arguments),
  9707. this._change.w.apply(this, [event, dx, dy]));
  9708. },
  9709. ne: function (event, dx, dy) {
  9710. return $.extend(this._change.n.apply(this, arguments),
  9711. this._change.e.apply(this, [event, dx, dy]));
  9712. },
  9713. nw: function (event, dx, dy) {
  9714. return $.extend(this._change.n.apply(this, arguments),
  9715. this._change.w.apply(this, [event, dx, dy]));
  9716. }
  9717. },
  9718. _propagate: function (n, event) {
  9719. $.ui.plugin.call(this, n, [event, this.ui()]);
  9720. (n !== "resize" && this._trigger(n, event, this.ui()));
  9721. },
  9722. plugins: {},
  9723. ui: function () {
  9724. return {
  9725. originalElement: this.originalElement,
  9726. element: this.element,
  9727. helper: this.helper,
  9728. position: this.position,
  9729. size: this.size,
  9730. originalSize: this.originalSize,
  9731. originalPosition: this.originalPosition
  9732. };
  9733. }
  9734. });
  9735. /*
  9736. * Resizable Extensions
  9737. */
  9738. $.ui.plugin.add("resizable", "animate", {
  9739. stop: function (event) {
  9740. var that = $(this).resizable("instance"),
  9741. o = that.options,
  9742. pr = that._proportionallyResizeElements,
  9743. ista = pr.length && (/textarea/i).test(pr[0].nodeName),
  9744. soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height,
  9745. soffsetw = ista ? 0 : that.sizeDiff.width,
  9746. style = {
  9747. width: (that.size.width - soffsetw),
  9748. height: (that.size.height - soffseth)
  9749. },
  9750. left = (parseFloat(that.element.css("left")) +
  9751. (that.position.left - that.originalPosition.left)) || null,
  9752. top = (parseFloat(that.element.css("top")) +
  9753. (that.position.top - that.originalPosition.top)) || null;
  9754. that.element.animate(
  9755. $.extend(style, top && left ? {top: top, left: left} : {}), {
  9756. duration: o.animateDuration,
  9757. easing: o.animateEasing,
  9758. step: function () {
  9759. var data = {
  9760. width: parseFloat(that.element.css("width")),
  9761. height: parseFloat(that.element.css("height")),
  9762. top: parseFloat(that.element.css("top")),
  9763. left: parseFloat(that.element.css("left"))
  9764. };
  9765. if (pr && pr.length) {
  9766. $(pr[0]).css({width: data.width, height: data.height});
  9767. }
  9768. // Propagating resize, and updating values for each animation step
  9769. that._updateCache(data);
  9770. that._propagate("resize", event);
  9771. }
  9772. }
  9773. );
  9774. }
  9775. });
  9776. $.ui.plugin.add("resizable", "containment", {
  9777. start: function () {
  9778. var element, p, co, ch, cw, width, height,
  9779. that = $(this).resizable("instance"),
  9780. o = that.options,
  9781. el = that.element,
  9782. oc = o.containment,
  9783. ce = (oc instanceof $) ?
  9784. oc.get(0) :
  9785. (/parent/.test(oc)) ? el.parent().get(0) : oc;
  9786. if (!ce) {
  9787. return;
  9788. }
  9789. that.containerElement = $(ce);
  9790. if (/document/.test(oc) || oc === document) {
  9791. that.containerOffset = {
  9792. left: 0,
  9793. top: 0
  9794. };
  9795. that.containerPosition = {
  9796. left: 0,
  9797. top: 0
  9798. };
  9799. that.parentData = {
  9800. element: $(document),
  9801. left: 0,
  9802. top: 0,
  9803. width: $(document).width(),
  9804. height: $(document).height() || document.body.parentNode.scrollHeight
  9805. };
  9806. } else {
  9807. element = $(ce);
  9808. p = [];
  9809. $(["Top", "Right", "Left", "Bottom"]).each(function (i, name) {
  9810. p[i] = that._num(element.css("padding" + name));
  9811. });
  9812. that.containerOffset = element.offset();
  9813. that.containerPosition = element.position();
  9814. that.containerSize = {
  9815. height: (element.innerHeight() - p[3]),
  9816. width: (element.innerWidth() - p[1])
  9817. };
  9818. co = that.containerOffset;
  9819. ch = that.containerSize.height;
  9820. cw = that.containerSize.width;
  9821. width = (that._hasScroll(ce, "left") ? ce.scrollWidth : cw);
  9822. height = (that._hasScroll(ce) ? ce.scrollHeight : ch);
  9823. that.parentData = {
  9824. element: ce,
  9825. left: co.left,
  9826. top: co.top,
  9827. width: width,
  9828. height: height
  9829. };
  9830. }
  9831. },
  9832. resize: function (event) {
  9833. var woset, hoset, isParent, isOffsetRelative,
  9834. that = $(this).resizable("instance"),
  9835. o = that.options,
  9836. co = that.containerOffset,
  9837. cp = that.position,
  9838. pRatio = that._aspectRatio || event.shiftKey,
  9839. cop = {
  9840. top: 0,
  9841. left: 0
  9842. },
  9843. ce = that.containerElement,
  9844. continueResize = true;
  9845. if (ce[0] !== document && (/static/).test(ce.css("position"))) {
  9846. cop = co;
  9847. }
  9848. if (cp.left < (that._helper ? co.left : 0)) {
  9849. that.size.width = that.size.width +
  9850. (that._helper ?
  9851. (that.position.left - co.left) :
  9852. (that.position.left - cop.left));
  9853. if (pRatio) {
  9854. that.size.height = that.size.width / that.aspectRatio;
  9855. continueResize = false;
  9856. }
  9857. that.position.left = o.helper ? co.left : 0;
  9858. }
  9859. if (cp.top < (that._helper ? co.top : 0)) {
  9860. that.size.height = that.size.height +
  9861. (that._helper ?
  9862. (that.position.top - co.top) :
  9863. that.position.top);
  9864. if (pRatio) {
  9865. that.size.width = that.size.height * that.aspectRatio;
  9866. continueResize = false;
  9867. }
  9868. that.position.top = that._helper ? co.top : 0;
  9869. }
  9870. isParent = that.containerElement.get(0) === that.element.parent().get(0);
  9871. isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position"));
  9872. if (isParent && isOffsetRelative) {
  9873. that.offset.left = that.parentData.left + that.position.left;
  9874. that.offset.top = that.parentData.top + that.position.top;
  9875. } else {
  9876. that.offset.left = that.element.offset().left;
  9877. that.offset.top = that.element.offset().top;
  9878. }
  9879. woset = Math.abs(that.sizeDiff.width +
  9880. (that._helper ?
  9881. that.offset.left - cop.left :
  9882. (that.offset.left - co.left)));
  9883. hoset = Math.abs(that.sizeDiff.height +
  9884. (that._helper ?
  9885. that.offset.top - cop.top :
  9886. (that.offset.top - co.top)));
  9887. if (woset + that.size.width >= that.parentData.width) {
  9888. that.size.width = that.parentData.width - woset;
  9889. if (pRatio) {
  9890. that.size.height = that.size.width / that.aspectRatio;
  9891. continueResize = false;
  9892. }
  9893. }
  9894. if (hoset + that.size.height >= that.parentData.height) {
  9895. that.size.height = that.parentData.height - hoset;
  9896. if (pRatio) {
  9897. that.size.width = that.size.height * that.aspectRatio;
  9898. continueResize = false;
  9899. }
  9900. }
  9901. if (!continueResize) {
  9902. that.position.left = that.prevPosition.left;
  9903. that.position.top = that.prevPosition.top;
  9904. that.size.width = that.prevSize.width;
  9905. that.size.height = that.prevSize.height;
  9906. }
  9907. },
  9908. stop: function () {
  9909. var that = $(this).resizable("instance"),
  9910. o = that.options,
  9911. co = that.containerOffset,
  9912. cop = that.containerPosition,
  9913. ce = that.containerElement,
  9914. helper = $(that.helper),
  9915. ho = helper.offset(),
  9916. w = helper.outerWidth() - that.sizeDiff.width,
  9917. h = helper.outerHeight() - that.sizeDiff.height;
  9918. if (that._helper && !o.animate && (/relative/).test(ce.css("position"))) {
  9919. $(this).css({
  9920. left: ho.left - cop.left - co.left,
  9921. width: w,
  9922. height: h
  9923. });
  9924. }
  9925. if (that._helper && !o.animate && (/static/).test(ce.css("position"))) {
  9926. $(this).css({
  9927. left: ho.left - cop.left - co.left,
  9928. width: w,
  9929. height: h
  9930. });
  9931. }
  9932. }
  9933. });
  9934. $.ui.plugin.add("resizable", "alsoResize", {
  9935. start: function () {
  9936. var that = $(this).resizable("instance"),
  9937. o = that.options;
  9938. $(o.alsoResize).each(function () {
  9939. var el = $(this);
  9940. el.data("ui-resizable-alsoresize", {
  9941. width: parseFloat(el.width()), height: parseFloat(el.height()),
  9942. left: parseFloat(el.css("left")), top: parseFloat(el.css("top"))
  9943. });
  9944. });
  9945. },
  9946. resize: function (event, ui) {
  9947. var that = $(this).resizable("instance"),
  9948. o = that.options,
  9949. os = that.originalSize,
  9950. op = that.originalPosition,
  9951. delta = {
  9952. height: (that.size.height - os.height) || 0,
  9953. width: (that.size.width - os.width) || 0,
  9954. top: (that.position.top - op.top) || 0,
  9955. left: (that.position.left - op.left) || 0
  9956. };
  9957. $(o.alsoResize).each(function () {
  9958. var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {},
  9959. css = el.parents(ui.originalElement[0]).length ?
  9960. ["width", "height"] :
  9961. ["width", "height", "top", "left"];
  9962. $.each(css, function (i, prop) {
  9963. var sum = (start[prop] || 0) + (delta[prop] || 0);
  9964. if (sum && sum >= 0) {
  9965. style[prop] = sum || null;
  9966. }
  9967. });
  9968. el.css(style);
  9969. });
  9970. },
  9971. stop: function () {
  9972. $(this).removeData("ui-resizable-alsoresize");
  9973. }
  9974. });
  9975. $.ui.plugin.add("resizable", "ghost", {
  9976. start: function () {
  9977. var that = $(this).resizable("instance"), cs = that.size;
  9978. that.ghost = that.originalElement.clone();
  9979. that.ghost.css({
  9980. opacity: 0.25,
  9981. display: "block",
  9982. position: "relative",
  9983. height: cs.height,
  9984. width: cs.width,
  9985. margin: 0,
  9986. left: 0,
  9987. top: 0
  9988. });
  9989. that._addClass(that.ghost, "ui-resizable-ghost");
  9990. // DEPRECATED
  9991. // TODO: remove after 1.12
  9992. if ($.uiBackCompat !== false && typeof that.options.ghost === "string") {
  9993. // Ghost option
  9994. that.ghost.addClass(this.options.ghost);
  9995. }
  9996. that.ghost.appendTo(that.helper);
  9997. },
  9998. resize: function () {
  9999. var that = $(this).resizable("instance");
  10000. if (that.ghost) {
  10001. that.ghost.css({
  10002. position: "relative",
  10003. height: that.size.height,
  10004. width: that.size.width
  10005. });
  10006. }
  10007. },
  10008. stop: function () {
  10009. var that = $(this).resizable("instance");
  10010. if (that.ghost && that.helper) {
  10011. that.helper.get(0).removeChild(that.ghost.get(0));
  10012. }
  10013. }
  10014. });
  10015. $.ui.plugin.add("resizable", "grid", {
  10016. resize: function () {
  10017. var outerDimensions,
  10018. that = $(this).resizable("instance"),
  10019. o = that.options,
  10020. cs = that.size,
  10021. os = that.originalSize,
  10022. op = that.originalPosition,
  10023. a = that.axis,
  10024. grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid,
  10025. gridX = (grid[0] || 1),
  10026. gridY = (grid[1] || 1),
  10027. ox = Math.round((cs.width - os.width) / gridX) * gridX,
  10028. oy = Math.round((cs.height - os.height) / gridY) * gridY,
  10029. newWidth = os.width + ox,
  10030. newHeight = os.height + oy,
  10031. isMaxWidth = o.maxWidth && (o.maxWidth < newWidth),
  10032. isMaxHeight = o.maxHeight && (o.maxHeight < newHeight),
  10033. isMinWidth = o.minWidth && (o.minWidth > newWidth),
  10034. isMinHeight = o.minHeight && (o.minHeight > newHeight);
  10035. o.grid = grid;
  10036. if (isMinWidth) {
  10037. newWidth += gridX;
  10038. }
  10039. if (isMinHeight) {
  10040. newHeight += gridY;
  10041. }
  10042. if (isMaxWidth) {
  10043. newWidth -= gridX;
  10044. }
  10045. if (isMaxHeight) {
  10046. newHeight -= gridY;
  10047. }
  10048. if (/^(se|s|e)$/.test(a)) {
  10049. that.size.width = newWidth;
  10050. that.size.height = newHeight;
  10051. } else if (/^(ne)$/.test(a)) {
  10052. that.size.width = newWidth;
  10053. that.size.height = newHeight;
  10054. that.position.top = op.top - oy;
  10055. } else if (/^(sw)$/.test(a)) {
  10056. that.size.width = newWidth;
  10057. that.size.height = newHeight;
  10058. that.position.left = op.left - ox;
  10059. } else {
  10060. if (newHeight - gridY <= 0 || newWidth - gridX <= 0) {
  10061. outerDimensions = that._getPaddingPlusBorderDimensions(this);
  10062. }
  10063. if (newHeight - gridY > 0) {
  10064. that.size.height = newHeight;
  10065. that.position.top = op.top - oy;
  10066. } else {
  10067. newHeight = gridY - outerDimensions.height;
  10068. that.size.height = newHeight;
  10069. that.position.top = op.top + os.height - newHeight;
  10070. }
  10071. if (newWidth - gridX > 0) {
  10072. that.size.width = newWidth;
  10073. that.position.left = op.left - ox;
  10074. } else {
  10075. newWidth = gridX - outerDimensions.width;
  10076. that.size.width = newWidth;
  10077. that.position.left = op.left + os.width - newWidth;
  10078. }
  10079. }
  10080. }
  10081. });
  10082. var widgetsResizable = $.ui.resizable;
  10083. /*!
  10084. * jQuery UI Dialog 1.12.1
  10085. * http://jqueryui.com
  10086. *
  10087. * Copyright jQuery Foundation and other contributors
  10088. * Released under the MIT license.
  10089. * http://jquery.org/license
  10090. */
  10091. //>>label: Dialog
  10092. //>>group: Widgets
  10093. //>>description: Displays customizable dialog windows.
  10094. //>>docs: http://api.jqueryui.com/dialog/
  10095. //>>demos: http://jqueryui.com/dialog/
  10096. //>>css.structure: ../../themes/base/core.css
  10097. //>>css.structure: ../../themes/base/dialog.css
  10098. //>>css.theme: ../../themes/base/theme.css
  10099. $.widget("ui.dialog", {
  10100. version: "1.12.1",
  10101. options: {
  10102. appendTo: "body",
  10103. autoOpen: true,
  10104. buttons: [],
  10105. classes: {
  10106. "ui-dialog": "ui-corner-all",
  10107. "ui-dialog-titlebar": "ui-corner-all"
  10108. },
  10109. closeOnEscape: true,
  10110. closeText: "Close",
  10111. draggable: true,
  10112. hide: null,
  10113. height: "auto",
  10114. maxHeight: null,
  10115. maxWidth: null,
  10116. minHeight: 150,
  10117. minWidth: 150,
  10118. modal: false,
  10119. position: {
  10120. my: "center",
  10121. at: "center",
  10122. of: window,
  10123. collision: "fit",
  10124. // Ensure the titlebar is always visible
  10125. using: function (pos) {
  10126. var topOffset = $(this).css(pos).offset().top;
  10127. if (topOffset < 0) {
  10128. $(this).css("top", pos.top - topOffset);
  10129. }
  10130. }
  10131. },
  10132. resizable: true,
  10133. show: null,
  10134. title: null,
  10135. width: 300,
  10136. // Callbacks
  10137. beforeClose: null,
  10138. close: null,
  10139. drag: null,
  10140. dragStart: null,
  10141. dragStop: null,
  10142. focus: null,
  10143. open: null,
  10144. resize: null,
  10145. resizeStart: null,
  10146. resizeStop: null
  10147. },
  10148. sizeRelatedOptions: {
  10149. buttons: true,
  10150. height: true,
  10151. maxHeight: true,
  10152. maxWidth: true,
  10153. minHeight: true,
  10154. minWidth: true,
  10155. width: true
  10156. },
  10157. resizableRelatedOptions: {
  10158. maxHeight: true,
  10159. maxWidth: true,
  10160. minHeight: true,
  10161. minWidth: true
  10162. },
  10163. _create: function () {
  10164. this.originalCss = {
  10165. display: this.element[0].style.display,
  10166. width: this.element[0].style.width,
  10167. minHeight: this.element[0].style.minHeight,
  10168. maxHeight: this.element[0].style.maxHeight,
  10169. height: this.element[0].style.height
  10170. };
  10171. this.originalPosition = {
  10172. parent: this.element.parent(),
  10173. index: this.element.parent().children().index(this.element)
  10174. };
  10175. this.originalTitle = this.element.attr("title");
  10176. if (this.options.title == null && this.originalTitle != null) {
  10177. this.options.title = this.originalTitle;
  10178. }
  10179. // Dialogs can't be disabled
  10180. if (this.options.disabled) {
  10181. this.options.disabled = false;
  10182. }
  10183. this._createWrapper();
  10184. this.element
  10185. .show()
  10186. .removeAttr("title")
  10187. .appendTo(this.uiDialog);
  10188. this._addClass("ui-dialog-content", "ui-widget-content");
  10189. this._createTitlebar();
  10190. this._createButtonPane();
  10191. if (this.options.draggable && $.fn.draggable) {
  10192. this._makeDraggable();
  10193. }
  10194. if (this.options.resizable && $.fn.resizable) {
  10195. this._makeResizable();
  10196. }
  10197. this._isOpen = false;
  10198. this._trackFocus();
  10199. },
  10200. _init: function () {
  10201. if (this.options.autoOpen) {
  10202. this.open();
  10203. }
  10204. },
  10205. _appendTo: function () {
  10206. var element = this.options.appendTo;
  10207. if (element && (element.jquery || element.nodeType)) {
  10208. return $(element);
  10209. }
  10210. return this.document.find(element || "body").eq(0);
  10211. },
  10212. _destroy: function () {
  10213. var next,
  10214. originalPosition = this.originalPosition;
  10215. this._untrackInstance();
  10216. this._destroyOverlay();
  10217. this.element
  10218. .removeUniqueId()
  10219. .css(this.originalCss)
  10220. // Without detaching first, the following becomes really slow
  10221. .detach();
  10222. this.uiDialog.remove();
  10223. if (this.originalTitle) {
  10224. this.element.attr("title", this.originalTitle);
  10225. }
  10226. next = originalPosition.parent.children().eq(originalPosition.index);
  10227. // Don't try to place the dialog next to itself (#8613)
  10228. if (next.length && next[0] !== this.element[0]) {
  10229. next.before(this.element);
  10230. } else {
  10231. originalPosition.parent.append(this.element);
  10232. }
  10233. },
  10234. widget: function () {
  10235. return this.uiDialog;
  10236. },
  10237. disable: $.noop,
  10238. enable: $.noop,
  10239. close: function (event) {
  10240. var that = this;
  10241. if (!this._isOpen || this._trigger("beforeClose", event) === false) {
  10242. return;
  10243. }
  10244. this._isOpen = false;
  10245. this._focusedElement = null;
  10246. this._destroyOverlay();
  10247. this._untrackInstance();
  10248. if (!this.opener.filter(":focusable").trigger("focus").length) {
  10249. // Hiding a focused element doesn't trigger blur in WebKit
  10250. // so in case we have nothing to focus on, explicitly blur the active element
  10251. // https://bugs.webkit.org/show_bug.cgi?id=47182
  10252. $.ui.safeBlur($.ui.safeActiveElement(this.document[0]));
  10253. }
  10254. this._hide(this.uiDialog, this.options.hide, function () {
  10255. that._trigger("close", event);
  10256. });
  10257. },
  10258. isOpen: function () {
  10259. return this._isOpen;
  10260. },
  10261. moveToTop: function () {
  10262. this._moveToTop();
  10263. },
  10264. _moveToTop: function (event, silent) {
  10265. var moved = false,
  10266. zIndices = this.uiDialog.siblings(".ui-front:visible").map(function () {
  10267. return +$(this).css("z-index");
  10268. }).get(),
  10269. zIndexMax = Math.max.apply(null, zIndices);
  10270. if (zIndexMax >= +this.uiDialog.css("z-index")) {
  10271. this.uiDialog.css("z-index", zIndexMax + 1);
  10272. moved = true;
  10273. }
  10274. if (moved && !silent) {
  10275. this._trigger("focus", event);
  10276. }
  10277. return moved;
  10278. },
  10279. open: function () {
  10280. var that = this;
  10281. if (this._isOpen) {
  10282. if (this._moveToTop()) {
  10283. this._focusTabbable();
  10284. }
  10285. return;
  10286. }
  10287. this._isOpen = true;
  10288. this.opener = $($.ui.safeActiveElement(this.document[0]));
  10289. this._size();
  10290. this._position();
  10291. this._createOverlay();
  10292. this._moveToTop(null, true);
  10293. // Ensure the overlay is moved to the top with the dialog, but only when
  10294. // opening. The overlay shouldn't move after the dialog is open so that
  10295. // modeless dialogs opened after the modal dialog stack properly.
  10296. if (this.overlay) {
  10297. this.overlay.css("z-index", this.uiDialog.css("z-index") - 1);
  10298. }
  10299. this._show(this.uiDialog, this.options.show, function () {
  10300. that._focusTabbable();
  10301. that._trigger("focus");
  10302. });
  10303. // Track the dialog immediately upon openening in case a focus event
  10304. // somehow occurs outside of the dialog before an element inside the
  10305. // dialog is focused (#10152)
  10306. this._makeFocusTarget();
  10307. this._trigger("open");
  10308. },
  10309. _focusTabbable: function () {
  10310. // Set focus to the first match:
  10311. // 1. An element that was focused previously
  10312. // 2. First element inside the dialog matching [autofocus]
  10313. // 3. Tabbable element inside the content element
  10314. // 4. Tabbable element inside the buttonpane
  10315. // 5. The close button
  10316. // 6. The dialog itself
  10317. var hasFocus = this._focusedElement;
  10318. if (!hasFocus) {
  10319. hasFocus = this.element.find("[autofocus]");
  10320. }
  10321. if (!hasFocus.length) {
  10322. hasFocus = this.element.find(":tabbable");
  10323. }
  10324. if (!hasFocus.length) {
  10325. hasFocus = this.uiDialogButtonPane.find(":tabbable");
  10326. }
  10327. if (!hasFocus.length) {
  10328. hasFocus = this.uiDialogTitlebarClose.filter(":tabbable");
  10329. }
  10330. if (!hasFocus.length) {
  10331. hasFocus = this.uiDialog;
  10332. }
  10333. hasFocus.eq(0).trigger("focus");
  10334. },
  10335. _keepFocus: function (event) {
  10336. function checkFocus() {
  10337. var activeElement = $.ui.safeActiveElement(this.document[0]),
  10338. isActive = this.uiDialog[0] === activeElement ||
  10339. $.contains(this.uiDialog[0], activeElement);
  10340. if (!isActive) {
  10341. this._focusTabbable();
  10342. }
  10343. }
  10344. event.preventDefault();
  10345. checkFocus.call(this);
  10346. // support: IE
  10347. // IE <= 8 doesn't prevent moving focus even with event.preventDefault()
  10348. // so we check again later
  10349. this._delay(checkFocus);
  10350. },
  10351. _createWrapper: function () {
  10352. this.uiDialog = $("<div>")
  10353. .hide()
  10354. .attr({
  10355. // Setting tabIndex makes the div focusable
  10356. tabIndex: -1,
  10357. role: "dialog"
  10358. })
  10359. .appendTo(this._appendTo());
  10360. this._addClass(this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front");
  10361. this._on(this.uiDialog, {
  10362. keydown: function (event) {
  10363. if (this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
  10364. event.keyCode === $.ui.keyCode.ESCAPE) {
  10365. event.preventDefault();
  10366. this.close(event);
  10367. return;
  10368. }
  10369. // Prevent tabbing out of dialogs
  10370. if (event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented()) {
  10371. return;
  10372. }
  10373. var tabbables = this.uiDialog.find(":tabbable"),
  10374. first = tabbables.filter(":first"),
  10375. last = tabbables.filter(":last");
  10376. if ((event.target === last[0] || event.target === this.uiDialog[0]) &&
  10377. !event.shiftKey) {
  10378. this._delay(function () {
  10379. first.trigger("focus");
  10380. });
  10381. event.preventDefault();
  10382. } else if ((event.target === first[0] ||
  10383. event.target === this.uiDialog[0]) && event.shiftKey) {
  10384. this._delay(function () {
  10385. last.trigger("focus");
  10386. });
  10387. event.preventDefault();
  10388. }
  10389. },
  10390. mousedown: function (event) {
  10391. if (this._moveToTop(event)) {
  10392. this._focusTabbable();
  10393. }
  10394. }
  10395. });
  10396. // We assume that any existing aria-describedby attribute means
  10397. // that the dialog content is marked up properly
  10398. // otherwise we brute force the content as the description
  10399. if (!this.element.find("[aria-describedby]").length) {
  10400. this.uiDialog.attr({
  10401. "aria-describedby": this.element.uniqueId().attr("id")
  10402. });
  10403. }
  10404. },
  10405. _createTitlebar: function () {
  10406. var uiDialogTitle;
  10407. this.uiDialogTitlebar = $("<div>");
  10408. this._addClass(this.uiDialogTitlebar,
  10409. "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix");
  10410. this._on(this.uiDialogTitlebar, {
  10411. mousedown: function (event) {
  10412. // Don't prevent click on close button (#8838)
  10413. // Focusing a dialog that is partially scrolled out of view
  10414. // causes the browser to scroll it into view, preventing the click event
  10415. if (!$(event.target).closest(".ui-dialog-titlebar-close")) {
  10416. // Dialog isn't getting focus when dragging (#8063)
  10417. this.uiDialog.trigger("focus");
  10418. }
  10419. }
  10420. });
  10421. // Support: IE
  10422. // Use type="button" to prevent enter keypresses in textboxes from closing the
  10423. // dialog in IE (#9312)
  10424. this.uiDialogTitlebarClose = $("<button type='button'></button>")
  10425. .button({
  10426. label: $("<a>").text(this.options.closeText).html(),
  10427. icon: "ui-icon-closethick",
  10428. showLabel: false
  10429. })
  10430. .appendTo(this.uiDialogTitlebar);
  10431. this._addClass(this.uiDialogTitlebarClose, "ui-dialog-titlebar-close");
  10432. this._on(this.uiDialogTitlebarClose, {
  10433. click: function (event) {
  10434. event.preventDefault();
  10435. this.close(event);
  10436. }
  10437. });
  10438. uiDialogTitle = $("<span>").uniqueId().prependTo(this.uiDialogTitlebar);
  10439. this._addClass(uiDialogTitle, "ui-dialog-title");
  10440. this._title(uiDialogTitle);
  10441. this.uiDialogTitlebar.prependTo(this.uiDialog);
  10442. this.uiDialog.attr({
  10443. "aria-labelledby": uiDialogTitle.attr("id")
  10444. });
  10445. },
  10446. _title: function (title) {
  10447. if (this.options.title) {
  10448. title.text(this.options.title);
  10449. } else {
  10450. title.html("&#160;");
  10451. }
  10452. },
  10453. _createButtonPane: function () {
  10454. this.uiDialogButtonPane = $("<div>");
  10455. this._addClass(this.uiDialogButtonPane, "ui-dialog-buttonpane",
  10456. "ui-widget-content ui-helper-clearfix");
  10457. this.uiButtonSet = $("<div>")
  10458. .appendTo(this.uiDialogButtonPane);
  10459. this._addClass(this.uiButtonSet, "ui-dialog-buttonset");
  10460. this._createButtons();
  10461. },
  10462. _createButtons: function () {
  10463. var that = this,
  10464. buttons = this.options.buttons;
  10465. // If we already have a button pane, remove it
  10466. this.uiDialogButtonPane.remove();
  10467. this.uiButtonSet.empty();
  10468. if ($.isEmptyObject(buttons) || ($.isArray(buttons) && !buttons.length)) {
  10469. this._removeClass(this.uiDialog, "ui-dialog-buttons");
  10470. return;
  10471. }
  10472. $.each(buttons, function (name, props) {
  10473. var click, buttonOptions;
  10474. props = $.isFunction(props) ?
  10475. {click: props, text: name} :
  10476. props;
  10477. // Default to a non-submitting button
  10478. props = $.extend({type: "button"}, props);
  10479. // Change the context for the click callback to be the main element
  10480. click = props.click;
  10481. buttonOptions = {
  10482. icon: props.icon,
  10483. iconPosition: props.iconPosition,
  10484. showLabel: props.showLabel,
  10485. // Deprecated options
  10486. icons: props.icons,
  10487. text: props.text
  10488. };
  10489. delete props.click;
  10490. delete props.icon;
  10491. delete props.iconPosition;
  10492. delete props.showLabel;
  10493. // Deprecated options
  10494. delete props.icons;
  10495. if (typeof props.text === "boolean") {
  10496. delete props.text;
  10497. }
  10498. $("<button></button>", props)
  10499. .button(buttonOptions)
  10500. .appendTo(that.uiButtonSet)
  10501. .on("click", function () {
  10502. click.apply(that.element[0], arguments);
  10503. });
  10504. });
  10505. this._addClass(this.uiDialog, "ui-dialog-buttons");
  10506. this.uiDialogButtonPane.appendTo(this.uiDialog);
  10507. },
  10508. _makeDraggable: function () {
  10509. var that = this,
  10510. options = this.options;
  10511. function filteredUi(ui) {
  10512. return {
  10513. position: ui.position,
  10514. offset: ui.offset
  10515. };
  10516. }
  10517. this.uiDialog.draggable({
  10518. cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
  10519. handle: ".ui-dialog-titlebar",
  10520. containment: "document",
  10521. start: function (event, ui) {
  10522. that._addClass($(this), "ui-dialog-dragging");
  10523. that._blockFrames();
  10524. that._trigger("dragStart", event, filteredUi(ui));
  10525. },
  10526. drag: function (event, ui) {
  10527. that._trigger("drag", event, filteredUi(ui));
  10528. },
  10529. stop: function (event, ui) {
  10530. var left = ui.offset.left - that.document.scrollLeft(),
  10531. top = ui.offset.top - that.document.scrollTop();
  10532. options.position = {
  10533. my: "left top",
  10534. at: "left" + (left >= 0 ? "+" : "") + left + " " +
  10535. "top" + (top >= 0 ? "+" : "") + top,
  10536. of: that.window
  10537. };
  10538. that._removeClass($(this), "ui-dialog-dragging");
  10539. that._unblockFrames();
  10540. that._trigger("dragStop", event, filteredUi(ui));
  10541. }
  10542. });
  10543. },
  10544. _makeResizable: function () {
  10545. var that = this,
  10546. options = this.options,
  10547. handles = options.resizable,
  10548. // .ui-resizable has position: relative defined in the stylesheet
  10549. // but dialogs have to use absolute or fixed positioning
  10550. position = this.uiDialog.css("position"),
  10551. resizeHandles = typeof handles === "string" ?
  10552. handles :
  10553. "n,e,s,w,se,sw,ne,nw";
  10554. function filteredUi(ui) {
  10555. return {
  10556. originalPosition: ui.originalPosition,
  10557. originalSize: ui.originalSize,
  10558. position: ui.position,
  10559. size: ui.size
  10560. };
  10561. }
  10562. this.uiDialog.resizable({
  10563. cancel: ".ui-dialog-content",
  10564. containment: "document",
  10565. alsoResize: this.element,
  10566. maxWidth: options.maxWidth,
  10567. maxHeight: options.maxHeight,
  10568. minWidth: options.minWidth,
  10569. minHeight: this._minHeight(),
  10570. handles: resizeHandles,
  10571. start: function (event, ui) {
  10572. that._addClass($(this), "ui-dialog-resizing");
  10573. that._blockFrames();
  10574. that._trigger("resizeStart", event, filteredUi(ui));
  10575. },
  10576. resize: function (event, ui) {
  10577. that._trigger("resize", event, filteredUi(ui));
  10578. },
  10579. stop: function (event, ui) {
  10580. var offset = that.uiDialog.offset(),
  10581. left = offset.left - that.document.scrollLeft(),
  10582. top = offset.top - that.document.scrollTop();
  10583. options.height = that.uiDialog.height();
  10584. options.width = that.uiDialog.width();
  10585. options.position = {
  10586. my: "left top",
  10587. at: "left" + (left >= 0 ? "+" : "") + left + " " +
  10588. "top" + (top >= 0 ? "+" : "") + top,
  10589. of: that.window
  10590. };
  10591. that._removeClass($(this), "ui-dialog-resizing");
  10592. that._unblockFrames();
  10593. that._trigger("resizeStop", event, filteredUi(ui));
  10594. }
  10595. })
  10596. .css("position", position);
  10597. },
  10598. _trackFocus: function () {
  10599. this._on(this.widget(), {
  10600. focusin: function (event) {
  10601. this._makeFocusTarget();
  10602. this._focusedElement = $(event.target);
  10603. }
  10604. });
  10605. },
  10606. _makeFocusTarget: function () {
  10607. this._untrackInstance();
  10608. this._trackingInstances().unshift(this);
  10609. },
  10610. _untrackInstance: function () {
  10611. var instances = this._trackingInstances(),
  10612. exists = $.inArray(this, instances);
  10613. if (exists !== -1) {
  10614. instances.splice(exists, 1);
  10615. }
  10616. },
  10617. _trackingInstances: function () {
  10618. var instances = this.document.data("ui-dialog-instances");
  10619. if (!instances) {
  10620. instances = [];
  10621. this.document.data("ui-dialog-instances", instances);
  10622. }
  10623. return instances;
  10624. },
  10625. _minHeight: function () {
  10626. var options = this.options;
  10627. return options.height === "auto" ?
  10628. options.minHeight :
  10629. Math.min(options.minHeight, options.height);
  10630. },
  10631. _position: function () {
  10632. // Need to show the dialog to get the actual offset in the position plugin
  10633. var isVisible = this.uiDialog.is(":visible");
  10634. if (!isVisible) {
  10635. this.uiDialog.show();
  10636. }
  10637. this.uiDialog.position(this.options.position);
  10638. if (!isVisible) {
  10639. this.uiDialog.hide();
  10640. }
  10641. },
  10642. _setOptions: function (options) {
  10643. var that = this,
  10644. resize = false,
  10645. resizableOptions = {};
  10646. $.each(options, function (key, value) {
  10647. that._setOption(key, value);
  10648. if (key in that.sizeRelatedOptions) {
  10649. resize = true;
  10650. }
  10651. if (key in that.resizableRelatedOptions) {
  10652. resizableOptions[key] = value;
  10653. }
  10654. });
  10655. if (resize) {
  10656. this._size();
  10657. this._position();
  10658. }
  10659. if (this.uiDialog.is(":data(ui-resizable)")) {
  10660. this.uiDialog.resizable("option", resizableOptions);
  10661. }
  10662. },
  10663. _setOption: function (key, value) {
  10664. var isDraggable, isResizable,
  10665. uiDialog = this.uiDialog;
  10666. if (key === "disabled") {
  10667. return;
  10668. }
  10669. this._super(key, value);
  10670. if (key === "appendTo") {
  10671. this.uiDialog.appendTo(this._appendTo());
  10672. }
  10673. if (key === "buttons") {
  10674. this._createButtons();
  10675. }
  10676. if (key === "closeText") {
  10677. this.uiDialogTitlebarClose.button({
  10678. // Ensure that we always pass a string
  10679. label: $("<a>").text("" + this.options.closeText).html()
  10680. });
  10681. }
  10682. if (key === "draggable") {
  10683. isDraggable = uiDialog.is(":data(ui-draggable)");
  10684. if (isDraggable && !value) {
  10685. uiDialog.draggable("destroy");
  10686. }
  10687. if (!isDraggable && value) {
  10688. this._makeDraggable();
  10689. }
  10690. }
  10691. if (key === "position") {
  10692. this._position();
  10693. }
  10694. if (key === "resizable") {
  10695. // currently resizable, becoming non-resizable
  10696. isResizable = uiDialog.is(":data(ui-resizable)");
  10697. if (isResizable && !value) {
  10698. uiDialog.resizable("destroy");
  10699. }
  10700. // Currently resizable, changing handles
  10701. if (isResizable && typeof value === "string") {
  10702. uiDialog.resizable("option", "handles", value);
  10703. }
  10704. // Currently non-resizable, becoming resizable
  10705. if (!isResizable && value !== false) {
  10706. this._makeResizable();
  10707. }
  10708. }
  10709. if (key === "title") {
  10710. this._title(this.uiDialogTitlebar.find(".ui-dialog-title"));
  10711. }
  10712. },
  10713. _size: function () {
  10714. // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
  10715. // divs will both have width and height set, so we need to reset them
  10716. var nonContentHeight, minContentHeight, maxContentHeight,
  10717. options = this.options;
  10718. // Reset content sizing
  10719. this.element.show().css({
  10720. width: "auto",
  10721. minHeight: 0,
  10722. maxHeight: "none",
  10723. height: 0
  10724. });
  10725. if (options.minWidth > options.width) {
  10726. options.width = options.minWidth;
  10727. }
  10728. // Reset wrapper sizing
  10729. // determine the height of all the non-content elements
  10730. nonContentHeight = this.uiDialog.css({
  10731. height: "auto",
  10732. width: options.width
  10733. })
  10734. .outerHeight();
  10735. minContentHeight = Math.max(0, options.minHeight - nonContentHeight);
  10736. maxContentHeight = typeof options.maxHeight === "number" ?
  10737. Math.max(0, options.maxHeight - nonContentHeight) :
  10738. "none";
  10739. if (options.height === "auto") {
  10740. this.element.css({
  10741. minHeight: minContentHeight,
  10742. maxHeight: maxContentHeight,
  10743. height: "auto"
  10744. });
  10745. } else {
  10746. this.element.height(Math.max(0, options.height - nonContentHeight));
  10747. }
  10748. if (this.uiDialog.is(":data(ui-resizable)")) {
  10749. this.uiDialog.resizable("option", "minHeight", this._minHeight());
  10750. }
  10751. },
  10752. _blockFrames: function () {
  10753. this.iframeBlocks = this.document.find("iframe").map(function () {
  10754. var iframe = $(this);
  10755. return $("<div>")
  10756. .css({
  10757. position: "absolute",
  10758. width: iframe.outerWidth(),
  10759. height: iframe.outerHeight()
  10760. })
  10761. .appendTo(iframe.parent())
  10762. .offset(iframe.offset())[0];
  10763. });
  10764. },
  10765. _unblockFrames: function () {
  10766. if (this.iframeBlocks) {
  10767. this.iframeBlocks.remove();
  10768. delete this.iframeBlocks;
  10769. }
  10770. },
  10771. _allowInteraction: function (event) {
  10772. if ($(event.target).closest(".ui-dialog").length) {
  10773. return true;
  10774. }
  10775. // TODO: Remove hack when datepicker implements
  10776. // the .ui-front logic (#8989)
  10777. return !!$(event.target).closest(".ui-datepicker").length;
  10778. },
  10779. _createOverlay: function () {
  10780. if (!this.options.modal) {
  10781. return;
  10782. }
  10783. // We use a delay in case the overlay is created from an
  10784. // event that we're going to be cancelling (#2804)
  10785. var isOpening = true;
  10786. this._delay(function () {
  10787. isOpening = false;
  10788. });
  10789. if (!this.document.data("ui-dialog-overlays")) {
  10790. // Prevent use of anchors and inputs
  10791. // Using _on() for an event handler shared across many instances is
  10792. // safe because the dialogs stack and must be closed in reverse order
  10793. this._on(this.document, {
  10794. focusin: function (event) {
  10795. if (isOpening) {
  10796. return;
  10797. }
  10798. if (!this._allowInteraction(event)) {
  10799. event.preventDefault();
  10800. this._trackingInstances()[0]._focusTabbable();
  10801. }
  10802. }
  10803. });
  10804. }
  10805. this.overlay = $("<div>")
  10806. .appendTo(this._appendTo());
  10807. this._addClass(this.overlay, null, "ui-widget-overlay ui-front");
  10808. this._on(this.overlay, {
  10809. mousedown: "_keepFocus"
  10810. });
  10811. this.document.data("ui-dialog-overlays",
  10812. (this.document.data("ui-dialog-overlays") || 0) + 1);
  10813. },
  10814. _destroyOverlay: function () {
  10815. if (!this.options.modal) {
  10816. return;
  10817. }
  10818. if (this.overlay) {
  10819. var overlays = this.document.data("ui-dialog-overlays") - 1;
  10820. if (!overlays) {
  10821. this._off(this.document, "focusin");
  10822. this.document.removeData("ui-dialog-overlays");
  10823. } else {
  10824. this.document.data("ui-dialog-overlays", overlays);
  10825. }
  10826. this.overlay.remove();
  10827. this.overlay = null;
  10828. }
  10829. }
  10830. });
  10831. // DEPRECATED
  10832. // TODO: switch return back to widget declaration at top of file when this is removed
  10833. if ($.uiBackCompat !== false) {
  10834. // Backcompat for dialogClass option
  10835. $.widget("ui.dialog", $.ui.dialog, {
  10836. options: {
  10837. dialogClass: ""
  10838. },
  10839. _createWrapper: function () {
  10840. this._super();
  10841. this.uiDialog.addClass(this.options.dialogClass);
  10842. },
  10843. _setOption: function (key, value) {
  10844. if (key === "dialogClass") {
  10845. this.uiDialog
  10846. .removeClass(this.options.dialogClass)
  10847. .addClass(value);
  10848. }
  10849. this._superApply(arguments);
  10850. }
  10851. });
  10852. }
  10853. var widgetsDialog = $.ui.dialog;
  10854. /*!
  10855. * jQuery UI Droppable 1.12.1
  10856. * http://jqueryui.com
  10857. *
  10858. * Copyright jQuery Foundation and other contributors
  10859. * Released under the MIT license.
  10860. * http://jquery.org/license
  10861. */
  10862. //>>label: Droppable
  10863. //>>group: Interactions
  10864. //>>description: Enables drop targets for draggable elements.
  10865. //>>docs: http://api.jqueryui.com/droppable/
  10866. //>>demos: http://jqueryui.com/droppable/
  10867. $.widget("ui.droppable", {
  10868. version: "1.12.1",
  10869. widgetEventPrefix: "drop",
  10870. options: {
  10871. accept: "*",
  10872. addClasses: true,
  10873. greedy: false,
  10874. scope: "default",
  10875. tolerance: "intersect",
  10876. // Callbacks
  10877. activate: null,
  10878. deactivate: null,
  10879. drop: null,
  10880. out: null,
  10881. over: null
  10882. },
  10883. _create: function () {
  10884. var proportions,
  10885. o = this.options,
  10886. accept = o.accept;
  10887. this.isover = false;
  10888. this.isout = true;
  10889. this.accept = $.isFunction(accept) ? accept : function (d) {
  10890. return d.is(accept);
  10891. };
  10892. this.proportions = function ( /* valueToWrite */) {
  10893. if (arguments.length) {
  10894. // Store the droppable's proportions
  10895. proportions = arguments[0];
  10896. } else {
  10897. // Retrieve or derive the droppable's proportions
  10898. return proportions ?
  10899. proportions :
  10900. proportions = {
  10901. width: this.element[0].offsetWidth,
  10902. height: this.element[0].offsetHeight
  10903. };
  10904. }
  10905. };
  10906. this._addToManager(o.scope);
  10907. o.addClasses && this._addClass("ui-droppable");
  10908. },
  10909. _addToManager: function (scope) {
  10910. // Add the reference and positions to the manager
  10911. $.ui.ddmanager.droppables[scope] = $.ui.ddmanager.droppables[scope] || [];
  10912. $.ui.ddmanager.droppables[scope].push(this);
  10913. },
  10914. _splice: function (drop) {
  10915. var i = 0;
  10916. for (; i < drop.length; i++) {
  10917. if (drop[i] === this) {
  10918. drop.splice(i, 1);
  10919. }
  10920. }
  10921. },
  10922. _destroy: function () {
  10923. var drop = $.ui.ddmanager.droppables[this.options.scope];
  10924. this._splice(drop);
  10925. },
  10926. _setOption: function (key, value) {
  10927. if (key === "accept") {
  10928. this.accept = $.isFunction(value) ? value : function (d) {
  10929. return d.is(value);
  10930. };
  10931. } else if (key === "scope") {
  10932. var drop = $.ui.ddmanager.droppables[this.options.scope];
  10933. this._splice(drop);
  10934. this._addToManager(value);
  10935. }
  10936. this._super(key, value);
  10937. },
  10938. _activate: function (event) {
  10939. var draggable = $.ui.ddmanager.current;
  10940. this._addActiveClass();
  10941. if (draggable) {
  10942. this._trigger("activate", event, this.ui(draggable));
  10943. }
  10944. },
  10945. _deactivate: function (event) {
  10946. var draggable = $.ui.ddmanager.current;
  10947. this._removeActiveClass();
  10948. if (draggable) {
  10949. this._trigger("deactivate", event, this.ui(draggable));
  10950. }
  10951. },
  10952. _over: function (event) {
  10953. var draggable = $.ui.ddmanager.current;
  10954. // Bail if draggable and droppable are same element
  10955. if (!draggable || (draggable.currentItem ||
  10956. draggable.element)[0] === this.element[0]) {
  10957. return;
  10958. }
  10959. if (this.accept.call(this.element[0], (draggable.currentItem ||
  10960. draggable.element))) {
  10961. this._addHoverClass();
  10962. this._trigger("over", event, this.ui(draggable));
  10963. }
  10964. },
  10965. _out: function (event) {
  10966. var draggable = $.ui.ddmanager.current;
  10967. // Bail if draggable and droppable are same element
  10968. if (!draggable || (draggable.currentItem ||
  10969. draggable.element)[0] === this.element[0]) {
  10970. return;
  10971. }
  10972. if (this.accept.call(this.element[0], (draggable.currentItem ||
  10973. draggable.element))) {
  10974. this._removeHoverClass();
  10975. this._trigger("out", event, this.ui(draggable));
  10976. }
  10977. },
  10978. _drop: function (event, custom) {
  10979. var draggable = custom || $.ui.ddmanager.current,
  10980. childrenIntersection = false;
  10981. // Bail if draggable and droppable are same element
  10982. if (!draggable || (draggable.currentItem ||
  10983. draggable.element)[0] === this.element[0]) {
  10984. return false;
  10985. }
  10986. this.element
  10987. .find(":data(ui-droppable)")
  10988. .not(".ui-draggable-dragging")
  10989. .each(function () {
  10990. var inst = $(this).droppable("instance");
  10991. if (
  10992. inst.options.greedy &&
  10993. !inst.options.disabled &&
  10994. inst.options.scope === draggable.options.scope &&
  10995. inst.accept.call(
  10996. inst.element[0], (draggable.currentItem || draggable.element)
  10997. ) &&
  10998. intersect(
  10999. draggable,
  11000. $.extend(inst, {offset: inst.element.offset()}),
  11001. inst.options.tolerance, event
  11002. )
  11003. ) {
  11004. childrenIntersection = true;
  11005. return false;
  11006. }
  11007. });
  11008. if (childrenIntersection) {
  11009. return false;
  11010. }
  11011. if (this.accept.call(this.element[0],
  11012. (draggable.currentItem || draggable.element))) {
  11013. this._removeActiveClass();
  11014. this._removeHoverClass();
  11015. this._trigger("drop", event, this.ui(draggable));
  11016. return this.element;
  11017. }
  11018. return false;
  11019. },
  11020. ui: function (c) {
  11021. return {
  11022. draggable: (c.currentItem || c.element),
  11023. helper: c.helper,
  11024. position: c.position,
  11025. offset: c.positionAbs
  11026. };
  11027. },
  11028. // Extension points just to make backcompat sane and avoid duplicating logic
  11029. // TODO: Remove in 1.13 along with call to it below
  11030. _addHoverClass: function () {
  11031. this._addClass("ui-droppable-hover");
  11032. },
  11033. _removeHoverClass: function () {
  11034. this._removeClass("ui-droppable-hover");
  11035. },
  11036. _addActiveClass: function () {
  11037. this._addClass("ui-droppable-active");
  11038. },
  11039. _removeActiveClass: function () {
  11040. this._removeClass("ui-droppable-active");
  11041. }
  11042. });
  11043. var intersect = $.ui.intersect = (function () {
  11044. function isOverAxis(x, reference, size) {
  11045. return (x >= reference) && (x < (reference + size));
  11046. }
  11047. return function (draggable, droppable, toleranceMode, event) {
  11048. if (!droppable.offset) {
  11049. return false;
  11050. }
  11051. var x1 = (draggable.positionAbs ||
  11052. draggable.position.absolute).left + draggable.margins.left,
  11053. y1 = (draggable.positionAbs ||
  11054. draggable.position.absolute).top + draggable.margins.top,
  11055. x2 = x1 + draggable.helperProportions.width,
  11056. y2 = y1 + draggable.helperProportions.height,
  11057. l = droppable.offset.left,
  11058. t = droppable.offset.top,
  11059. r = l + droppable.proportions().width,
  11060. b = t + droppable.proportions().height;
  11061. switch (toleranceMode) {
  11062. case "fit":
  11063. return (l <= x1 && x2 <= r && t <= y1 && y2 <= b);
  11064. case "intersect":
  11065. return (l < x1 + (draggable.helperProportions.width / 2) && // Right Half
  11066. x2 - (draggable.helperProportions.width / 2) < r && // Left Half
  11067. t < y1 + (draggable.helperProportions.height / 2) && // Bottom Half
  11068. y2 - (draggable.helperProportions.height / 2) < b); // Top Half
  11069. case "pointer":
  11070. return isOverAxis(event.pageY, t, droppable.proportions().height) &&
  11071. isOverAxis(event.pageX, l, droppable.proportions().width);
  11072. case "touch":
  11073. return (
  11074. (y1 >= t && y1 <= b) || // Top edge touching
  11075. (y2 >= t && y2 <= b) || // Bottom edge touching
  11076. (y1 < t && y2 > b) // Surrounded vertically
  11077. ) && (
  11078. (x1 >= l && x1 <= r) || // Left edge touching
  11079. (x2 >= l && x2 <= r) || // Right edge touching
  11080. (x1 < l && x2 > r) // Surrounded horizontally
  11081. );
  11082. default:
  11083. return false;
  11084. }
  11085. };
  11086. })();
  11087. /*
  11088. This manager tracks offsets of draggables and droppables
  11089. */
  11090. $.ui.ddmanager = {
  11091. current: null,
  11092. droppables: {"default": []},
  11093. prepareOffsets: function (t, event) {
  11094. var i, j,
  11095. m = $.ui.ddmanager.droppables[t.options.scope] || [],
  11096. type = event ? event.type : null, // workaround for #2317
  11097. list = (t.currentItem || t.element).find(":data(ui-droppable)").addBack();
  11098. droppablesLoop: for (i = 0; i < m.length; i++) {
  11099. // No disabled and non-accepted
  11100. if (m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],
  11101. (t.currentItem || t.element)))) {
  11102. continue;
  11103. }
  11104. // Filter out elements in the current dragged item
  11105. for (j = 0; j < list.length; j++) {
  11106. if (list[j] === m[i].element[0]) {
  11107. m[i].proportions().height = 0;
  11108. continue droppablesLoop;
  11109. }
  11110. }
  11111. m[i].visible = m[i].element.css("display") !== "none";
  11112. if (!m[i].visible) {
  11113. continue;
  11114. }
  11115. // Activate the droppable if used directly from draggables
  11116. if (type === "mousedown") {
  11117. m[i]._activate.call(m[i], event);
  11118. }
  11119. m[i].offset = m[i].element.offset();
  11120. m[i].proportions({
  11121. width: m[i].element[0].offsetWidth,
  11122. height: m[i].element[0].offsetHeight
  11123. });
  11124. }
  11125. },
  11126. drop: function (draggable, event) {
  11127. var dropped = false;
  11128. // Create a copy of the droppables in case the list changes during the drop (#9116)
  11129. $.each(($.ui.ddmanager.droppables[draggable.options.scope] || []).slice(), function () {
  11130. if (!this.options) {
  11131. return;
  11132. }
  11133. if (!this.options.disabled && this.visible &&
  11134. intersect(draggable, this, this.options.tolerance, event)) {
  11135. dropped = this._drop.call(this, event) || dropped;
  11136. }
  11137. if (!this.options.disabled && this.visible && this.accept.call(this.element[0],
  11138. (draggable.currentItem || draggable.element))) {
  11139. this.isout = true;
  11140. this.isover = false;
  11141. this._deactivate.call(this, event);
  11142. }
  11143. });
  11144. return dropped;
  11145. },
  11146. dragStart: function (draggable, event) {
  11147. // Listen for scrolling so that if the dragging causes scrolling the position of the
  11148. // droppables can be recalculated (see #5003)
  11149. draggable.element.parentsUntil("body").on("scroll.droppable", function () {
  11150. if (!draggable.options.refreshPositions) {
  11151. $.ui.ddmanager.prepareOffsets(draggable, event);
  11152. }
  11153. });
  11154. },
  11155. drag: function (draggable, event) {
  11156. // If you have a highly dynamic page, you might try this option. It renders positions
  11157. // every time you move the mouse.
  11158. if (draggable.options.refreshPositions) {
  11159. $.ui.ddmanager.prepareOffsets(draggable, event);
  11160. }
  11161. // Run through all droppables and check their positions based on specific tolerance options
  11162. $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function () {
  11163. if (this.options.disabled || this.greedyChild || !this.visible) {
  11164. return;
  11165. }
  11166. var parentInstance, scope, parent,
  11167. intersects = intersect(draggable, this, this.options.tolerance, event),
  11168. c = !intersects && this.isover ?
  11169. "isout" :
  11170. (intersects && !this.isover ? "isover" : null);
  11171. if (!c) {
  11172. return;
  11173. }
  11174. if (this.options.greedy) {
  11175. // find droppable parents with same scope
  11176. scope = this.options.scope;
  11177. parent = this.element.parents(":data(ui-droppable)").filter(function () {
  11178. return $(this).droppable("instance").options.scope === scope;
  11179. });
  11180. if (parent.length) {
  11181. parentInstance = $(parent[0]).droppable("instance");
  11182. parentInstance.greedyChild = (c === "isover");
  11183. }
  11184. }
  11185. // We just moved into a greedy child
  11186. if (parentInstance && c === "isover") {
  11187. parentInstance.isover = false;
  11188. parentInstance.isout = true;
  11189. parentInstance._out.call(parentInstance, event);
  11190. }
  11191. this[c] = true;
  11192. this[c === "isout" ? "isover" : "isout"] = false;
  11193. this[c === "isover" ? "_over" : "_out"].call(this, event);
  11194. // We just moved out of a greedy child
  11195. if (parentInstance && c === "isout") {
  11196. parentInstance.isout = false;
  11197. parentInstance.isover = true;
  11198. parentInstance._over.call(parentInstance, event);
  11199. }
  11200. });
  11201. },
  11202. dragStop: function (draggable, event) {
  11203. draggable.element.parentsUntil("body").off("scroll.droppable");
  11204. // Call prepareOffsets one final time since IE does not fire return scroll events when
  11205. // overflow was caused by drag (see #5003)
  11206. if (!draggable.options.refreshPositions) {
  11207. $.ui.ddmanager.prepareOffsets(draggable, event);
  11208. }
  11209. }
  11210. };
  11211. // DEPRECATED
  11212. // TODO: switch return back to widget declaration at top of file when this is removed
  11213. if ($.uiBackCompat !== false) {
  11214. // Backcompat for activeClass and hoverClass options
  11215. $.widget("ui.droppable", $.ui.droppable, {
  11216. options: {
  11217. hoverClass: false,
  11218. activeClass: false
  11219. },
  11220. _addActiveClass: function () {
  11221. this._super();
  11222. if (this.options.activeClass) {
  11223. this.element.addClass(this.options.activeClass);
  11224. }
  11225. },
  11226. _removeActiveClass: function () {
  11227. this._super();
  11228. if (this.options.activeClass) {
  11229. this.element.removeClass(this.options.activeClass);
  11230. }
  11231. },
  11232. _addHoverClass: function () {
  11233. this._super();
  11234. if (this.options.hoverClass) {
  11235. this.element.addClass(this.options.hoverClass);
  11236. }
  11237. },
  11238. _removeHoverClass: function () {
  11239. this._super();
  11240. if (this.options.hoverClass) {
  11241. this.element.removeClass(this.options.hoverClass);
  11242. }
  11243. }
  11244. });
  11245. }
  11246. var widgetsDroppable = $.ui.droppable;
  11247. /*!
  11248. * jQuery UI Progressbar 1.12.1
  11249. * http://jqueryui.com
  11250. *
  11251. * Copyright jQuery Foundation and other contributors
  11252. * Released under the MIT license.
  11253. * http://jquery.org/license
  11254. */
  11255. //>>label: Progressbar
  11256. //>>group: Widgets
  11257. // jscs:disable maximumLineLength
  11258. //>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators.
  11259. // jscs:enable maximumLineLength
  11260. //>>docs: http://api.jqueryui.com/progressbar/
  11261. //>>demos: http://jqueryui.com/progressbar/
  11262. //>>css.structure: ../../themes/base/core.css
  11263. //>>css.structure: ../../themes/base/progressbar.css
  11264. //>>css.theme: ../../themes/base/theme.css
  11265. var widgetsProgressbar = $.widget("ui.progressbar", {
  11266. version: "1.12.1",
  11267. options: {
  11268. classes: {
  11269. "ui-progressbar": "ui-corner-all",
  11270. "ui-progressbar-value": "ui-corner-left",
  11271. "ui-progressbar-complete": "ui-corner-right"
  11272. },
  11273. max: 100,
  11274. value: 0,
  11275. change: null,
  11276. complete: null
  11277. },
  11278. min: 0,
  11279. _create: function () {
  11280. // Constrain initial value
  11281. this.oldValue = this.options.value = this._constrainedValue();
  11282. this.element.attr({
  11283. // Only set static values; aria-valuenow and aria-valuemax are
  11284. // set inside _refreshValue()
  11285. role: "progressbar",
  11286. "aria-valuemin": this.min
  11287. });
  11288. this._addClass("ui-progressbar", "ui-widget ui-widget-content");
  11289. this.valueDiv = $("<div>").appendTo(this.element);
  11290. this._addClass(this.valueDiv, "ui-progressbar-value", "ui-widget-header");
  11291. this._refreshValue();
  11292. },
  11293. _destroy: function () {
  11294. this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow");
  11295. this.valueDiv.remove();
  11296. },
  11297. value: function (newValue) {
  11298. if (newValue === undefined) {
  11299. return this.options.value;
  11300. }
  11301. this.options.value = this._constrainedValue(newValue);
  11302. this._refreshValue();
  11303. },
  11304. _constrainedValue: function (newValue) {
  11305. if (newValue === undefined) {
  11306. newValue = this.options.value;
  11307. }
  11308. this.indeterminate = newValue === false;
  11309. // Sanitize value
  11310. if (typeof newValue !== "number") {
  11311. newValue = 0;
  11312. }
  11313. return this.indeterminate ? false :
  11314. Math.min(this.options.max, Math.max(this.min, newValue));
  11315. },
  11316. _setOptions: function (options) {
  11317. // Ensure "value" option is set after other values (like max)
  11318. var value = options.value;
  11319. delete options.value;
  11320. this._super(options);
  11321. this.options.value = this._constrainedValue(value);
  11322. this._refreshValue();
  11323. },
  11324. _setOption: function (key, value) {
  11325. if (key === "max") {
  11326. // Don't allow a max less than min
  11327. value = Math.max(this.min, value);
  11328. }
  11329. this._super(key, value);
  11330. },
  11331. _setOptionDisabled: function (value) {
  11332. this._super(value);
  11333. this.element.attr("aria-disabled", value);
  11334. this._toggleClass(null, "ui-state-disabled", !!value);
  11335. },
  11336. _percentage: function () {
  11337. return this.indeterminate ?
  11338. 100 :
  11339. 100 * (this.options.value - this.min) / (this.options.max - this.min);
  11340. },
  11341. _refreshValue: function () {
  11342. var value = this.options.value,
  11343. percentage = this._percentage();
  11344. this.valueDiv
  11345. .toggle(this.indeterminate || value > this.min)
  11346. .width(percentage.toFixed(0) + "%");
  11347. this
  11348. ._toggleClass(this.valueDiv, "ui-progressbar-complete", null,
  11349. value === this.options.max)
  11350. ._toggleClass("ui-progressbar-indeterminate", null, this.indeterminate);
  11351. if (this.indeterminate) {
  11352. this.element.removeAttr("aria-valuenow");
  11353. if (!this.overlayDiv) {
  11354. this.overlayDiv = $("<div>").appendTo(this.valueDiv);
  11355. this._addClass(this.overlayDiv, "ui-progressbar-overlay");
  11356. }
  11357. } else {
  11358. this.element.attr({
  11359. "aria-valuemax": this.options.max,
  11360. "aria-valuenow": value
  11361. });
  11362. if (this.overlayDiv) {
  11363. this.overlayDiv.remove();
  11364. this.overlayDiv = null;
  11365. }
  11366. }
  11367. if (this.oldValue !== value) {
  11368. this.oldValue = value;
  11369. this._trigger("change");
  11370. }
  11371. if (value === this.options.max) {
  11372. this._trigger("complete");
  11373. }
  11374. }
  11375. });
  11376. /*!
  11377. * jQuery UI Selectable 1.12.1
  11378. * http://jqueryui.com
  11379. *
  11380. * Copyright jQuery Foundation and other contributors
  11381. * Released under the MIT license.
  11382. * http://jquery.org/license
  11383. */
  11384. //>>label: Selectable
  11385. //>>group: Interactions
  11386. //>>description: Allows groups of elements to be selected with the mouse.
  11387. //>>docs: http://api.jqueryui.com/selectable/
  11388. //>>demos: http://jqueryui.com/selectable/
  11389. //>>css.structure: ../../themes/base/selectable.css
  11390. var widgetsSelectable = $.widget("ui.selectable", $.ui.mouse, {
  11391. version: "1.12.1",
  11392. options: {
  11393. appendTo: "body",
  11394. autoRefresh: true,
  11395. distance: 0,
  11396. filter: "*",
  11397. tolerance: "touch",
  11398. // Callbacks
  11399. selected: null,
  11400. selecting: null,
  11401. start: null,
  11402. stop: null,
  11403. unselected: null,
  11404. unselecting: null
  11405. },
  11406. _create: function () {
  11407. var that = this;
  11408. this._addClass("ui-selectable");
  11409. this.dragged = false;
  11410. // Cache selectee children based on filter
  11411. this.refresh = function () {
  11412. that.elementPos = $(that.element[0]).offset();
  11413. that.selectees = $(that.options.filter, that.element[0]);
  11414. that._addClass(that.selectees, "ui-selectee");
  11415. that.selectees.each(function () {
  11416. var $this = $(this),
  11417. selecteeOffset = $this.offset(),
  11418. pos = {
  11419. left: selecteeOffset.left - that.elementPos.left,
  11420. top: selecteeOffset.top - that.elementPos.top
  11421. };
  11422. $.data(this, "selectable-item", {
  11423. element: this,
  11424. $element: $this,
  11425. left: pos.left,
  11426. top: pos.top,
  11427. right: pos.left + $this.outerWidth(),
  11428. bottom: pos.top + $this.outerHeight(),
  11429. startselected: false,
  11430. selected: $this.hasClass("ui-selected"),
  11431. selecting: $this.hasClass("ui-selecting"),
  11432. unselecting: $this.hasClass("ui-unselecting")
  11433. });
  11434. });
  11435. };
  11436. this.refresh();
  11437. this._mouseInit();
  11438. this.helper = $("<div>");
  11439. this._addClass(this.helper, "ui-selectable-helper");
  11440. },
  11441. _destroy: function () {
  11442. this.selectees.removeData("selectable-item");
  11443. this._mouseDestroy();
  11444. },
  11445. _mouseStart: function (event) {
  11446. var that = this,
  11447. options = this.options;
  11448. this.opos = [event.pageX, event.pageY];
  11449. this.elementPos = $(this.element[0]).offset();
  11450. if (this.options.disabled) {
  11451. return;
  11452. }
  11453. this.selectees = $(options.filter, this.element[0]);
  11454. this._trigger("start", event);
  11455. $(options.appendTo).append(this.helper);
  11456. // position helper (lasso)
  11457. this.helper.css({
  11458. "left": event.pageX,
  11459. "top": event.pageY,
  11460. "width": 0,
  11461. "height": 0
  11462. });
  11463. if (options.autoRefresh) {
  11464. this.refresh();
  11465. }
  11466. this.selectees.filter(".ui-selected").each(function () {
  11467. var selectee = $.data(this, "selectable-item");
  11468. selectee.startselected = true;
  11469. if (!event.metaKey && !event.ctrlKey) {
  11470. that._removeClass(selectee.$element, "ui-selected");
  11471. selectee.selected = false;
  11472. that._addClass(selectee.$element, "ui-unselecting");
  11473. selectee.unselecting = true;
  11474. // selectable UNSELECTING callback
  11475. that._trigger("unselecting", event, {
  11476. unselecting: selectee.element
  11477. });
  11478. }
  11479. });
  11480. $(event.target).parents().addBack().each(function () {
  11481. var doSelect,
  11482. selectee = $.data(this, "selectable-item");
  11483. if (selectee) {
  11484. doSelect = (!event.metaKey && !event.ctrlKey) ||
  11485. !selectee.$element.hasClass("ui-selected");
  11486. that._removeClass(selectee.$element, doSelect ? "ui-unselecting" : "ui-selected")
  11487. ._addClass(selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting");
  11488. selectee.unselecting = !doSelect;
  11489. selectee.selecting = doSelect;
  11490. selectee.selected = doSelect;
  11491. // selectable (UN)SELECTING callback
  11492. if (doSelect) {
  11493. that._trigger("selecting", event, {
  11494. selecting: selectee.element
  11495. });
  11496. } else {
  11497. that._trigger("unselecting", event, {
  11498. unselecting: selectee.element
  11499. });
  11500. }
  11501. return false;
  11502. }
  11503. });
  11504. },
  11505. _mouseDrag: function (event) {
  11506. this.dragged = true;
  11507. if (this.options.disabled) {
  11508. return;
  11509. }
  11510. var tmp,
  11511. that = this,
  11512. options = this.options,
  11513. x1 = this.opos[0],
  11514. y1 = this.opos[1],
  11515. x2 = event.pageX,
  11516. y2 = event.pageY;
  11517. if (x1 > x2) {
  11518. tmp = x2;
  11519. x2 = x1;
  11520. x1 = tmp;
  11521. }
  11522. if (y1 > y2) {
  11523. tmp = y2;
  11524. y2 = y1;
  11525. y1 = tmp;
  11526. }
  11527. this.helper.css({left: x1, top: y1, width: x2 - x1, height: y2 - y1});
  11528. this.selectees.each(function () {
  11529. var selectee = $.data(this, "selectable-item"),
  11530. hit = false,
  11531. offset = {};
  11532. //prevent helper from being selected if appendTo: selectable
  11533. if (!selectee || selectee.element === that.element[0]) {
  11534. return;
  11535. }
  11536. offset.left = selectee.left + that.elementPos.left;
  11537. offset.right = selectee.right + that.elementPos.left;
  11538. offset.top = selectee.top + that.elementPos.top;
  11539. offset.bottom = selectee.bottom + that.elementPos.top;
  11540. if (options.tolerance === "touch") {
  11541. hit = (!(offset.left > x2 || offset.right < x1 || offset.top > y2 ||
  11542. offset.bottom < y1));
  11543. } else if (options.tolerance === "fit") {
  11544. hit = (offset.left > x1 && offset.right < x2 && offset.top > y1 &&
  11545. offset.bottom < y2);
  11546. }
  11547. if (hit) {
  11548. // SELECT
  11549. if (selectee.selected) {
  11550. that._removeClass(selectee.$element, "ui-selected");
  11551. selectee.selected = false;
  11552. }
  11553. if (selectee.unselecting) {
  11554. that._removeClass(selectee.$element, "ui-unselecting");
  11555. selectee.unselecting = false;
  11556. }
  11557. if (!selectee.selecting) {
  11558. that._addClass(selectee.$element, "ui-selecting");
  11559. selectee.selecting = true;
  11560. // selectable SELECTING callback
  11561. that._trigger("selecting", event, {
  11562. selecting: selectee.element
  11563. });
  11564. }
  11565. } else {
  11566. // UNSELECT
  11567. if (selectee.selecting) {
  11568. if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
  11569. that._removeClass(selectee.$element, "ui-selecting");
  11570. selectee.selecting = false;
  11571. that._addClass(selectee.$element, "ui-selected");
  11572. selectee.selected = true;
  11573. } else {
  11574. that._removeClass(selectee.$element, "ui-selecting");
  11575. selectee.selecting = false;
  11576. if (selectee.startselected) {
  11577. that._addClass(selectee.$element, "ui-unselecting");
  11578. selectee.unselecting = true;
  11579. }
  11580. // selectable UNSELECTING callback
  11581. that._trigger("unselecting", event, {
  11582. unselecting: selectee.element
  11583. });
  11584. }
  11585. }
  11586. if (selectee.selected) {
  11587. if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
  11588. that._removeClass(selectee.$element, "ui-selected");
  11589. selectee.selected = false;
  11590. that._addClass(selectee.$element, "ui-unselecting");
  11591. selectee.unselecting = true;
  11592. // selectable UNSELECTING callback
  11593. that._trigger("unselecting", event, {
  11594. unselecting: selectee.element
  11595. });
  11596. }
  11597. }
  11598. }
  11599. });
  11600. return false;
  11601. },
  11602. _mouseStop: function (event) {
  11603. var that = this;
  11604. this.dragged = false;
  11605. $(".ui-unselecting", this.element[0]).each(function () {
  11606. var selectee = $.data(this, "selectable-item");
  11607. that._removeClass(selectee.$element, "ui-unselecting");
  11608. selectee.unselecting = false;
  11609. selectee.startselected = false;
  11610. that._trigger("unselected", event, {
  11611. unselected: selectee.element
  11612. });
  11613. });
  11614. $(".ui-selecting", this.element[0]).each(function () {
  11615. var selectee = $.data(this, "selectable-item");
  11616. that._removeClass(selectee.$element, "ui-selecting")
  11617. ._addClass(selectee.$element, "ui-selected");
  11618. selectee.selecting = false;
  11619. selectee.selected = true;
  11620. selectee.startselected = true;
  11621. that._trigger("selected", event, {
  11622. selected: selectee.element
  11623. });
  11624. });
  11625. this._trigger("stop", event);
  11626. this.helper.remove();
  11627. return false;
  11628. }
  11629. });
  11630. /*!
  11631. * jQuery UI Selectmenu 1.12.1
  11632. * http://jqueryui.com
  11633. *
  11634. * Copyright jQuery Foundation and other contributors
  11635. * Released under the MIT license.
  11636. * http://jquery.org/license
  11637. */
  11638. //>>label: Selectmenu
  11639. //>>group: Widgets
  11640. // jscs:disable maximumLineLength
  11641. //>>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.
  11642. // jscs:enable maximumLineLength
  11643. //>>docs: http://api.jqueryui.com/selectmenu/
  11644. //>>demos: http://jqueryui.com/selectmenu/
  11645. //>>css.structure: ../../themes/base/core.css
  11646. //>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css
  11647. //>>css.theme: ../../themes/base/theme.css
  11648. var widgetsSelectmenu = $.widget("ui.selectmenu", [$.ui.formResetMixin, {
  11649. version: "1.12.1",
  11650. defaultElement: "<select>",
  11651. options: {
  11652. appendTo: null,
  11653. classes: {
  11654. "ui-selectmenu-button-open": "ui-corner-top",
  11655. "ui-selectmenu-button-closed": "ui-corner-all"
  11656. },
  11657. disabled: null,
  11658. icons: {
  11659. button: "ui-icon-triangle-1-s"
  11660. },
  11661. position: {
  11662. my: "left top",
  11663. at: "left bottom",
  11664. collision: "none"
  11665. },
  11666. width: false,
  11667. // Callbacks
  11668. change: null,
  11669. close: null,
  11670. focus: null,
  11671. open: null,
  11672. select: null
  11673. },
  11674. _create: function () {
  11675. var selectmenuId = this.element.uniqueId().attr("id");
  11676. this.ids = {
  11677. element: selectmenuId,
  11678. button: selectmenuId + "-button",
  11679. menu: selectmenuId + "-menu"
  11680. };
  11681. this._drawButton();
  11682. this._drawMenu();
  11683. this._bindFormResetHandler();
  11684. this._rendered = false;
  11685. this.menuItems = $();
  11686. },
  11687. _drawButton: function () {
  11688. var icon,
  11689. that = this,
  11690. item = this._parseOption(
  11691. this.element.find("option:selected"),
  11692. this.element[0].selectedIndex
  11693. );
  11694. // Associate existing label with the new button
  11695. this.labels = this.element.labels().attr("for", this.ids.button);
  11696. this._on(this.labels, {
  11697. click: function (event) {
  11698. this.button.focus();
  11699. event.preventDefault();
  11700. }
  11701. });
  11702. // Hide original select element
  11703. this.element.hide();
  11704. // Create button
  11705. this.button = $("<span>", {
  11706. tabindex: this.options.disabled ? -1 : 0,
  11707. id: this.ids.button,
  11708. role: "combobox",
  11709. "aria-expanded": "false",
  11710. "aria-autocomplete": "list",
  11711. "aria-owns": this.ids.menu,
  11712. "aria-haspopup": "true",
  11713. title: this.element.attr("title")
  11714. })
  11715. .insertAfter(this.element);
  11716. this._addClass(this.button, "ui-selectmenu-button ui-selectmenu-button-closed",
  11717. "ui-button ui-widget");
  11718. icon = $("<span>").appendTo(this.button);
  11719. this._addClass(icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button);
  11720. this.buttonItem = this._renderButtonItem(item)
  11721. .appendTo(this.button);
  11722. if (this.options.width !== false) {
  11723. this._resizeButton();
  11724. }
  11725. this._on(this.button, this._buttonEvents);
  11726. this.button.one("focusin", function () {
  11727. // Delay rendering the menu items until the button receives focus.
  11728. // The menu may have already been rendered via a programmatic open.
  11729. if (!that._rendered) {
  11730. that._refreshMenu();
  11731. }
  11732. });
  11733. },
  11734. _drawMenu: function () {
  11735. var that = this;
  11736. // Create menu
  11737. this.menu = $("<ul>", {
  11738. "aria-hidden": "true",
  11739. "aria-labelledby": this.ids.button,
  11740. id: this.ids.menu
  11741. });
  11742. // Wrap menu
  11743. this.menuWrap = $("<div>").append(this.menu);
  11744. this._addClass(this.menuWrap, "ui-selectmenu-menu", "ui-front");
  11745. this.menuWrap.appendTo(this._appendTo());
  11746. // Initialize menu widget
  11747. this.menuInstance = this.menu
  11748. .menu({
  11749. classes: {
  11750. "ui-menu": "ui-corner-bottom"
  11751. },
  11752. role: "listbox",
  11753. select: function (event, ui) {
  11754. event.preventDefault();
  11755. // Support: IE8
  11756. // If the item was selected via a click, the text selection
  11757. // will be destroyed in IE
  11758. that._setSelection();
  11759. that._select(ui.item.data("ui-selectmenu-item"), event);
  11760. },
  11761. focus: function (event, ui) {
  11762. var item = ui.item.data("ui-selectmenu-item");
  11763. // Prevent inital focus from firing and check if its a newly focused item
  11764. if (that.focusIndex != null && item.index !== that.focusIndex) {
  11765. that._trigger("focus", event, {item: item});
  11766. if (!that.isOpen) {
  11767. that._select(item, event);
  11768. }
  11769. }
  11770. that.focusIndex = item.index;
  11771. that.button.attr("aria-activedescendant",
  11772. that.menuItems.eq(item.index).attr("id"));
  11773. }
  11774. })
  11775. .menu("instance");
  11776. // Don't close the menu on mouseleave
  11777. this.menuInstance._off(this.menu, "mouseleave");
  11778. // Cancel the menu's collapseAll on document click
  11779. this.menuInstance._closeOnDocumentClick = function () {
  11780. return false;
  11781. };
  11782. // Selects often contain empty items, but never contain dividers
  11783. this.menuInstance._isDivider = function () {
  11784. return false;
  11785. };
  11786. },
  11787. refresh: function () {
  11788. this._refreshMenu();
  11789. this.buttonItem.replaceWith(
  11790. this.buttonItem = this._renderButtonItem(
  11791. // Fall back to an empty object in case there are no options
  11792. this._getSelectedItem().data("ui-selectmenu-item") || {}
  11793. )
  11794. );
  11795. if (this.options.width === null) {
  11796. this._resizeButton();
  11797. }
  11798. },
  11799. _refreshMenu: function () {
  11800. var item,
  11801. options = this.element.find("option");
  11802. this.menu.empty();
  11803. this._parseOptions(options);
  11804. this._renderMenu(this.menu, this.items);
  11805. this.menuInstance.refresh();
  11806. this.menuItems = this.menu.find("li")
  11807. .not(".ui-selectmenu-optgroup")
  11808. .find(".ui-menu-item-wrapper");
  11809. this._rendered = true;
  11810. if (!options.length) {
  11811. return;
  11812. }
  11813. item = this._getSelectedItem();
  11814. // Update the menu to have the correct item focused
  11815. this.menuInstance.focus(null, item);
  11816. this._setAria(item.data("ui-selectmenu-item"));
  11817. // Set disabled state
  11818. this._setOption("disabled", this.element.prop("disabled"));
  11819. },
  11820. open: function (event) {
  11821. if (this.options.disabled) {
  11822. return;
  11823. }
  11824. // If this is the first time the menu is being opened, render the items
  11825. if (!this._rendered) {
  11826. this._refreshMenu();
  11827. } else {
  11828. // Menu clears focus on close, reset focus to selected item
  11829. this._removeClass(this.menu.find(".ui-state-active"), null, "ui-state-active");
  11830. this.menuInstance.focus(null, this._getSelectedItem());
  11831. }
  11832. // If there are no options, don't open the menu
  11833. if (!this.menuItems.length) {
  11834. return;
  11835. }
  11836. this.isOpen = true;
  11837. this._toggleAttr();
  11838. this._resizeMenu();
  11839. this._position();
  11840. this._on(this.document, this._documentClick);
  11841. this._trigger("open", event);
  11842. },
  11843. _position: function () {
  11844. this.menuWrap.position($.extend({of: this.button}, this.options.position));
  11845. },
  11846. close: function (event) {
  11847. if (!this.isOpen) {
  11848. return;
  11849. }
  11850. this.isOpen = false;
  11851. this._toggleAttr();
  11852. this.range = null;
  11853. this._off(this.document);
  11854. this._trigger("close", event);
  11855. },
  11856. widget: function () {
  11857. return this.button;
  11858. },
  11859. menuWidget: function () {
  11860. return this.menu;
  11861. },
  11862. _renderButtonItem: function (item) {
  11863. var buttonItem = $("<span>");
  11864. this._setText(buttonItem, item.label);
  11865. this._addClass(buttonItem, "ui-selectmenu-text");
  11866. return buttonItem;
  11867. },
  11868. _renderMenu: function (ul, items) {
  11869. var that = this,
  11870. currentOptgroup = "";
  11871. $.each(items, function (index, item) {
  11872. var li;
  11873. if (item.optgroup !== currentOptgroup) {
  11874. li = $("<li>", {
  11875. text: item.optgroup
  11876. });
  11877. that._addClass(li, "ui-selectmenu-optgroup", "ui-menu-divider" +
  11878. (item.element.parent("optgroup").prop("disabled") ?
  11879. " ui-state-disabled" :
  11880. ""));
  11881. li.appendTo(ul);
  11882. currentOptgroup = item.optgroup;
  11883. }
  11884. that._renderItemData(ul, item);
  11885. });
  11886. },
  11887. _renderItemData: function (ul, item) {
  11888. return this._renderItem(ul, item).data("ui-selectmenu-item", item);
  11889. },
  11890. _renderItem: function (ul, item) {
  11891. var li = $("<li>"),
  11892. wrapper = $("<div>", {
  11893. title: item.element.attr("title")
  11894. });
  11895. if (item.disabled) {
  11896. this._addClass(li, null, "ui-state-disabled");
  11897. }
  11898. this._setText(wrapper, item.label);
  11899. return li.append(wrapper).appendTo(ul);
  11900. },
  11901. _setText: function (element, value) {
  11902. if (value) {
  11903. element.text(value);
  11904. } else {
  11905. element.html("&#160;");
  11906. }
  11907. },
  11908. _move: function (direction, event) {
  11909. var item, next,
  11910. filter = ".ui-menu-item";
  11911. if (this.isOpen) {
  11912. item = this.menuItems.eq(this.focusIndex).parent("li");
  11913. } else {
  11914. item = this.menuItems.eq(this.element[0].selectedIndex).parent("li");
  11915. filter += ":not(.ui-state-disabled)";
  11916. }
  11917. if (direction === "first" || direction === "last") {
  11918. next = item[direction === "first" ? "prevAll" : "nextAll"](filter).eq(-1);
  11919. } else {
  11920. next = item[direction + "All"](filter).eq(0);
  11921. }
  11922. if (next.length) {
  11923. this.menuInstance.focus(event, next);
  11924. }
  11925. },
  11926. _getSelectedItem: function () {
  11927. return this.menuItems.eq(this.element[0].selectedIndex).parent("li");
  11928. },
  11929. _toggle: function (event) {
  11930. this[this.isOpen ? "close" : "open"](event);
  11931. },
  11932. _setSelection: function () {
  11933. var selection;
  11934. if (!this.range) {
  11935. return;
  11936. }
  11937. if (window.getSelection) {
  11938. selection = window.getSelection();
  11939. selection.removeAllRanges();
  11940. selection.addRange(this.range);
  11941. // Support: IE8
  11942. } else {
  11943. this.range.select();
  11944. }
  11945. // Support: IE
  11946. // Setting the text selection kills the button focus in IE, but
  11947. // restoring the focus doesn't kill the selection.
  11948. this.button.focus();
  11949. },
  11950. _documentClick: {
  11951. mousedown: function (event) {
  11952. if (!this.isOpen) {
  11953. return;
  11954. }
  11955. if (!$(event.target).closest(".ui-selectmenu-menu, #" +
  11956. $.ui.escapeSelector(this.ids.button)).length) {
  11957. this.close(event);
  11958. }
  11959. }
  11960. },
  11961. _buttonEvents: {
  11962. // Prevent text selection from being reset when interacting with the selectmenu (#10144)
  11963. mousedown: function () {
  11964. var selection;
  11965. if (window.getSelection) {
  11966. selection = window.getSelection();
  11967. if (selection.rangeCount) {
  11968. this.range = selection.getRangeAt(0);
  11969. }
  11970. // Support: IE8
  11971. } else {
  11972. this.range = document.selection.createRange();
  11973. }
  11974. },
  11975. click: function (event) {
  11976. this._setSelection();
  11977. this._toggle(event);
  11978. },
  11979. keydown: function (event) {
  11980. var preventDefault = true;
  11981. switch (event.keyCode) {
  11982. case $.ui.keyCode.TAB:
  11983. case $.ui.keyCode.ESCAPE:
  11984. this.close(event);
  11985. preventDefault = false;
  11986. break;
  11987. case $.ui.keyCode.ENTER:
  11988. if (this.isOpen) {
  11989. this._selectFocusedItem(event);
  11990. }
  11991. break;
  11992. case $.ui.keyCode.UP:
  11993. if (event.altKey) {
  11994. this._toggle(event);
  11995. } else {
  11996. this._move("prev", event);
  11997. }
  11998. break;
  11999. case $.ui.keyCode.DOWN:
  12000. if (event.altKey) {
  12001. this._toggle(event);
  12002. } else {
  12003. this._move("next", event);
  12004. }
  12005. break;
  12006. case $.ui.keyCode.SPACE:
  12007. if (this.isOpen) {
  12008. this._selectFocusedItem(event);
  12009. } else {
  12010. this._toggle(event);
  12011. }
  12012. break;
  12013. case $.ui.keyCode.LEFT:
  12014. this._move("prev", event);
  12015. break;
  12016. case $.ui.keyCode.RIGHT:
  12017. this._move("next", event);
  12018. break;
  12019. case $.ui.keyCode.HOME:
  12020. case $.ui.keyCode.PAGE_UP:
  12021. this._move("first", event);
  12022. break;
  12023. case $.ui.keyCode.END:
  12024. case $.ui.keyCode.PAGE_DOWN:
  12025. this._move("last", event);
  12026. break;
  12027. default:
  12028. this.menu.trigger(event);
  12029. preventDefault = false;
  12030. }
  12031. if (preventDefault) {
  12032. event.preventDefault();
  12033. }
  12034. }
  12035. },
  12036. _selectFocusedItem: function (event) {
  12037. var item = this.menuItems.eq(this.focusIndex).parent("li");
  12038. if (!item.hasClass("ui-state-disabled")) {
  12039. this._select(item.data("ui-selectmenu-item"), event);
  12040. }
  12041. },
  12042. _select: function (item, event) {
  12043. var oldIndex = this.element[0].selectedIndex;
  12044. // Change native select element
  12045. this.element[0].selectedIndex = item.index;
  12046. this.buttonItem.replaceWith(this.buttonItem = this._renderButtonItem(item));
  12047. this._setAria(item);
  12048. this._trigger("select", event, {item: item});
  12049. if (item.index !== oldIndex) {
  12050. this._trigger("change", event, {item: item});
  12051. }
  12052. this.close(event);
  12053. },
  12054. _setAria: function (item) {
  12055. var id = this.menuItems.eq(item.index).attr("id");
  12056. this.button.attr({
  12057. "aria-labelledby": id,
  12058. "aria-activedescendant": id
  12059. });
  12060. this.menu.attr("aria-activedescendant", id);
  12061. },
  12062. _setOption: function (key, value) {
  12063. if (key === "icons") {
  12064. var icon = this.button.find("span.ui-icon");
  12065. this._removeClass(icon, null, this.options.icons.button)
  12066. ._addClass(icon, null, value.button);
  12067. }
  12068. this._super(key, value);
  12069. if (key === "appendTo") {
  12070. this.menuWrap.appendTo(this._appendTo());
  12071. }
  12072. if (key === "width") {
  12073. this._resizeButton();
  12074. }
  12075. },
  12076. _setOptionDisabled: function (value) {
  12077. this._super(value);
  12078. this.menuInstance.option("disabled", value);
  12079. this.button.attr("aria-disabled", value);
  12080. this._toggleClass(this.button, null, "ui-state-disabled", value);
  12081. this.element.prop("disabled", value);
  12082. if (value) {
  12083. this.button.attr("tabindex", -1);
  12084. this.close();
  12085. } else {
  12086. this.button.attr("tabindex", 0);
  12087. }
  12088. },
  12089. _appendTo: function () {
  12090. var element = this.options.appendTo;
  12091. if (element) {
  12092. element = element.jquery || element.nodeType ?
  12093. $(element) :
  12094. this.document.find(element).eq(0);
  12095. }
  12096. if (!element || !element[0]) {
  12097. element = this.element.closest(".ui-front, dialog");
  12098. }
  12099. if (!element.length) {
  12100. element = this.document[0].body;
  12101. }
  12102. return element;
  12103. },
  12104. _toggleAttr: function () {
  12105. this.button.attr("aria-expanded", this.isOpen);
  12106. // We can't use two _toggleClass() calls here, because we need to make sure
  12107. // we always remove classes first and add them second, otherwise if both classes have the
  12108. // same theme class, it will be removed after we add it.
  12109. this._removeClass(this.button, "ui-selectmenu-button-" +
  12110. (this.isOpen ? "closed" : "open"))
  12111. ._addClass(this.button, "ui-selectmenu-button-" +
  12112. (this.isOpen ? "open" : "closed"))
  12113. ._toggleClass(this.menuWrap, "ui-selectmenu-open", null, this.isOpen);
  12114. this.menu.attr("aria-hidden", !this.isOpen);
  12115. },
  12116. _resizeButton: function () {
  12117. var width = this.options.width;
  12118. // For `width: false`, just remove inline style and stop
  12119. if (width === false) {
  12120. this.button.css("width", "");
  12121. return;
  12122. }
  12123. // For `width: null`, match the width of the original element
  12124. if (width === null) {
  12125. width = this.element.show().outerWidth();
  12126. this.element.hide();
  12127. }
  12128. this.button.outerWidth(width);
  12129. },
  12130. _resizeMenu: function () {
  12131. this.menu.outerWidth(Math.max(
  12132. this.button.outerWidth(),
  12133. // Support: IE10
  12134. // IE10 wraps long text (possibly a rounding bug)
  12135. // so we add 1px to avoid the wrapping
  12136. this.menu.width("").outerWidth() + 1
  12137. ));
  12138. },
  12139. _getCreateOptions: function () {
  12140. var options = this._super();
  12141. options.disabled = this.element.prop("disabled");
  12142. return options;
  12143. },
  12144. _parseOptions: function (options) {
  12145. var that = this,
  12146. data = [];
  12147. options.each(function (index, item) {
  12148. data.push(that._parseOption($(item), index));
  12149. });
  12150. this.items = data;
  12151. },
  12152. _parseOption: function (option, index) {
  12153. var optgroup = option.parent("optgroup");
  12154. return {
  12155. element: option,
  12156. index: index,
  12157. value: option.val(),
  12158. label: option.text(),
  12159. optgroup: optgroup.attr("label") || "",
  12160. disabled: optgroup.prop("disabled") || option.prop("disabled")
  12161. };
  12162. },
  12163. _destroy: function () {
  12164. this._unbindFormResetHandler();
  12165. this.menuWrap.remove();
  12166. this.button.remove();
  12167. this.element.show();
  12168. this.element.removeUniqueId();
  12169. this.labels.attr("for", this.ids.element);
  12170. }
  12171. }]);
  12172. /*!
  12173. * jQuery UI Slider 1.12.1
  12174. * http://jqueryui.com
  12175. *
  12176. * Copyright jQuery Foundation and other contributors
  12177. * Released under the MIT license.
  12178. * http://jquery.org/license
  12179. */
  12180. //>>label: Slider
  12181. //>>group: Widgets
  12182. //>>description: Displays a flexible slider with ranges and accessibility via keyboard.
  12183. //>>docs: http://api.jqueryui.com/slider/
  12184. //>>demos: http://jqueryui.com/slider/
  12185. //>>css.structure: ../../themes/base/core.css
  12186. //>>css.structure: ../../themes/base/slider.css
  12187. //>>css.theme: ../../themes/base/theme.css
  12188. var widgetsSlider = $.widget("ui.slider", $.ui.mouse, {
  12189. version: "1.12.1",
  12190. widgetEventPrefix: "slide",
  12191. options: {
  12192. animate: false,
  12193. classes: {
  12194. "ui-slider": "ui-corner-all",
  12195. "ui-slider-handle": "ui-corner-all",
  12196. // Note: ui-widget-header isn't the most fittingly semantic framework class for this
  12197. // element, but worked best visually with a variety of themes
  12198. "ui-slider-range": "ui-corner-all ui-widget-header"
  12199. },
  12200. distance: 0,
  12201. max: 100,
  12202. min: 0,
  12203. orientation: "horizontal",
  12204. range: false,
  12205. step: 1,
  12206. value: 0,
  12207. values: null,
  12208. // Callbacks
  12209. change: null,
  12210. slide: null,
  12211. start: null,
  12212. stop: null
  12213. },
  12214. // Number of pages in a slider
  12215. // (how many times can you page up/down to go through the whole range)
  12216. numPages: 5,
  12217. _create: function () {
  12218. this._keySliding = false;
  12219. this._mouseSliding = false;
  12220. this._animateOff = true;
  12221. this._handleIndex = null;
  12222. this._detectOrientation();
  12223. this._mouseInit();
  12224. this._calculateNewMax();
  12225. this._addClass("ui-slider ui-slider-" + this.orientation,
  12226. "ui-widget ui-widget-content");
  12227. this._refresh();
  12228. this._animateOff = false;
  12229. },
  12230. _refresh: function () {
  12231. this._createRange();
  12232. this._createHandles();
  12233. this._setupEvents();
  12234. this._refreshValue();
  12235. },
  12236. _createHandles: function () {
  12237. var i, handleCount,
  12238. options = this.options,
  12239. existingHandles = this.element.find(".ui-slider-handle"),
  12240. handle = "<span tabindex='0'></span>",
  12241. handles = [];
  12242. handleCount = (options.values && options.values.length) || 1;
  12243. if (existingHandles.length > handleCount) {
  12244. existingHandles.slice(handleCount).remove();
  12245. existingHandles = existingHandles.slice(0, handleCount);
  12246. }
  12247. for (i = existingHandles.length; i < handleCount; i++) {
  12248. handles.push(handle);
  12249. }
  12250. this.handles = existingHandles.add($(handles.join("")).appendTo(this.element));
  12251. this._addClass(this.handles, "ui-slider-handle", "ui-state-default");
  12252. this.handle = this.handles.eq(0);
  12253. this.handles.each(function (i) {
  12254. $(this)
  12255. .data("ui-slider-handle-index", i)
  12256. .attr("tabIndex", 0);
  12257. });
  12258. },
  12259. _createRange: function () {
  12260. var options = this.options;
  12261. if (options.range) {
  12262. if (options.range === true) {
  12263. if (!options.values) {
  12264. options.values = [this._valueMin(), this._valueMin()];
  12265. } else if (options.values.length && options.values.length !== 2) {
  12266. options.values = [options.values[0], options.values[0]];
  12267. } else if ($.isArray(options.values)) {
  12268. options.values = options.values.slice(0);
  12269. }
  12270. }
  12271. if (!this.range || !this.range.length) {
  12272. this.range = $("<div>")
  12273. .appendTo(this.element);
  12274. this._addClass(this.range, "ui-slider-range");
  12275. } else {
  12276. this._removeClass(this.range, "ui-slider-range-min ui-slider-range-max");
  12277. // Handle range switching from true to min/max
  12278. this.range.css({
  12279. "left": "",
  12280. "bottom": ""
  12281. });
  12282. }
  12283. if (options.range === "min" || options.range === "max") {
  12284. this._addClass(this.range, "ui-slider-range-" + options.range);
  12285. }
  12286. } else {
  12287. if (this.range) {
  12288. this.range.remove();
  12289. }
  12290. this.range = null;
  12291. }
  12292. },
  12293. _setupEvents: function () {
  12294. this._off(this.handles);
  12295. this._on(this.handles, this._handleEvents);
  12296. this._hoverable(this.handles);
  12297. this._focusable(this.handles);
  12298. },
  12299. _destroy: function () {
  12300. this.handles.remove();
  12301. if (this.range) {
  12302. this.range.remove();
  12303. }
  12304. this._mouseDestroy();
  12305. },
  12306. _mouseCapture: function (event) {
  12307. var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
  12308. that = this,
  12309. o = this.options;
  12310. if (o.disabled) {
  12311. return false;
  12312. }
  12313. this.elementSize = {
  12314. width: this.element.outerWidth(),
  12315. height: this.element.outerHeight()
  12316. };
  12317. this.elementOffset = this.element.offset();
  12318. position = {x: event.pageX, y: event.pageY};
  12319. normValue = this._normValueFromMouse(position);
  12320. distance = this._valueMax() - this._valueMin() + 1;
  12321. this.handles.each(function (i) {
  12322. var thisDistance = Math.abs(normValue - that.values(i));
  12323. if ((distance > thisDistance) ||
  12324. (distance === thisDistance &&
  12325. (i === that._lastChangedValue || that.values(i) === o.min))) {
  12326. distance = thisDistance;
  12327. closestHandle = $(this);
  12328. index = i;
  12329. }
  12330. });
  12331. allowed = this._start(event, index);
  12332. if (allowed === false) {
  12333. return false;
  12334. }
  12335. this._mouseSliding = true;
  12336. this._handleIndex = index;
  12337. this._addClass(closestHandle, null, "ui-state-active");
  12338. closestHandle.trigger("focus");
  12339. offset = closestHandle.offset();
  12340. mouseOverHandle = !$(event.target).parents().addBack().is(".ui-slider-handle");
  12341. this._clickOffset = mouseOverHandle ? {left: 0, top: 0} : {
  12342. left: event.pageX - offset.left - (closestHandle.width() / 2),
  12343. top: event.pageY - offset.top -
  12344. (closestHandle.height() / 2) -
  12345. (parseInt(closestHandle.css("borderTopWidth"), 10) || 0) -
  12346. (parseInt(closestHandle.css("borderBottomWidth"), 10) || 0) +
  12347. (parseInt(closestHandle.css("marginTop"), 10) || 0)
  12348. };
  12349. if (!this.handles.hasClass("ui-state-hover")) {
  12350. this._slide(event, index, normValue);
  12351. }
  12352. this._animateOff = true;
  12353. return true;
  12354. },
  12355. _mouseStart: function () {
  12356. return true;
  12357. },
  12358. _mouseDrag: function (event) {
  12359. var position = {x: event.pageX, y: event.pageY},
  12360. normValue = this._normValueFromMouse(position);
  12361. this._slide(event, this._handleIndex, normValue);
  12362. return false;
  12363. },
  12364. _mouseStop: function (event) {
  12365. this._removeClass(this.handles, null, "ui-state-active");
  12366. this._mouseSliding = false;
  12367. this._stop(event, this._handleIndex);
  12368. this._change(event, this._handleIndex);
  12369. this._handleIndex = null;
  12370. this._clickOffset = null;
  12371. this._animateOff = false;
  12372. return false;
  12373. },
  12374. _detectOrientation: function () {
  12375. this.orientation = (this.options.orientation === "vertical") ? "vertical" : "horizontal";
  12376. },
  12377. _normValueFromMouse: function (position) {
  12378. var pixelTotal,
  12379. pixelMouse,
  12380. percentMouse,
  12381. valueTotal,
  12382. valueMouse;
  12383. if (this.orientation === "horizontal") {
  12384. pixelTotal = this.elementSize.width;
  12385. pixelMouse = position.x - this.elementOffset.left -
  12386. (this._clickOffset ? this._clickOffset.left : 0);
  12387. } else {
  12388. pixelTotal = this.elementSize.height;
  12389. pixelMouse = position.y - this.elementOffset.top -
  12390. (this._clickOffset ? this._clickOffset.top : 0);
  12391. }
  12392. percentMouse = (pixelMouse / pixelTotal);
  12393. if (percentMouse > 1) {
  12394. percentMouse = 1;
  12395. }
  12396. if (percentMouse < 0) {
  12397. percentMouse = 0;
  12398. }
  12399. if (this.orientation === "vertical") {
  12400. percentMouse = 1 - percentMouse;
  12401. }
  12402. valueTotal = this._valueMax() - this._valueMin();
  12403. valueMouse = this._valueMin() + percentMouse * valueTotal;
  12404. return this._trimAlignValue(valueMouse);
  12405. },
  12406. _uiHash: function (index, value, values) {
  12407. var uiHash = {
  12408. handle: this.handles[index],
  12409. handleIndex: index,
  12410. value: value !== undefined ? value : this.value()
  12411. };
  12412. if (this._hasMultipleValues()) {
  12413. uiHash.value = value !== undefined ? value : this.values(index);
  12414. uiHash.values = values || this.values();
  12415. }
  12416. return uiHash;
  12417. },
  12418. _hasMultipleValues: function () {
  12419. return this.options.values && this.options.values.length;
  12420. },
  12421. _start: function (event, index) {
  12422. return this._trigger("start", event, this._uiHash(index));
  12423. },
  12424. _slide: function (event, index, newVal) {
  12425. var allowed, otherVal,
  12426. currentValue = this.value(),
  12427. newValues = this.values();
  12428. if (this._hasMultipleValues()) {
  12429. otherVal = this.values(index ? 0 : 1);
  12430. currentValue = this.values(index);
  12431. if (this.options.values.length === 2 && this.options.range === true) {
  12432. newVal = index === 0 ? Math.min(otherVal, newVal) : Math.max(otherVal, newVal);
  12433. }
  12434. newValues[index] = newVal;
  12435. }
  12436. if (newVal === currentValue) {
  12437. return;
  12438. }
  12439. allowed = this._trigger("slide", event, this._uiHash(index, newVal, newValues));
  12440. // A slide can be canceled by returning false from the slide callback
  12441. if (allowed === false) {
  12442. return;
  12443. }
  12444. if (this._hasMultipleValues()) {
  12445. this.values(index, newVal);
  12446. } else {
  12447. this.value(newVal);
  12448. }
  12449. },
  12450. _stop: function (event, index) {
  12451. this._trigger("stop", event, this._uiHash(index));
  12452. },
  12453. _change: function (event, index) {
  12454. if (!this._keySliding && !this._mouseSliding) {
  12455. //store the last changed value index for reference when handles overlap
  12456. this._lastChangedValue = index;
  12457. this._trigger("change", event, this._uiHash(index));
  12458. }
  12459. },
  12460. value: function (newValue) {
  12461. if (arguments.length) {
  12462. this.options.value = this._trimAlignValue(newValue);
  12463. this._refreshValue();
  12464. this._change(null, 0);
  12465. return;
  12466. }
  12467. return this._value();
  12468. },
  12469. values: function (index, newValue) {
  12470. var vals,
  12471. newValues,
  12472. i;
  12473. if (arguments.length > 1) {
  12474. this.options.values[index] = this._trimAlignValue(newValue);
  12475. this._refreshValue();
  12476. this._change(null, index);
  12477. return;
  12478. }
  12479. if (arguments.length) {
  12480. if ($.isArray(arguments[0])) {
  12481. vals = this.options.values;
  12482. newValues = arguments[0];
  12483. for (i = 0; i < vals.length; i += 1) {
  12484. vals[i] = this._trimAlignValue(newValues[i]);
  12485. this._change(null, i);
  12486. }
  12487. this._refreshValue();
  12488. } else {
  12489. if (this._hasMultipleValues()) {
  12490. return this._values(index);
  12491. } else {
  12492. return this.value();
  12493. }
  12494. }
  12495. } else {
  12496. return this._values();
  12497. }
  12498. },
  12499. _setOption: function (key, value) {
  12500. var i,
  12501. valsLength = 0;
  12502. if (key === "range" && this.options.range === true) {
  12503. if (value === "min") {
  12504. this.options.value = this._values(0);
  12505. this.options.values = null;
  12506. } else if (value === "max") {
  12507. this.options.value = this._values(this.options.values.length - 1);
  12508. this.options.values = null;
  12509. }
  12510. }
  12511. if ($.isArray(this.options.values)) {
  12512. valsLength = this.options.values.length;
  12513. }
  12514. this._super(key, value);
  12515. switch (key) {
  12516. case "orientation":
  12517. this._detectOrientation();
  12518. this._removeClass("ui-slider-horizontal ui-slider-vertical")
  12519. ._addClass("ui-slider-" + this.orientation);
  12520. this._refreshValue();
  12521. if (this.options.range) {
  12522. this._refreshRange(value);
  12523. }
  12524. // Reset positioning from previous orientation
  12525. this.handles.css(value === "horizontal" ? "bottom" : "left", "");
  12526. break;
  12527. case "value":
  12528. this._animateOff = true;
  12529. this._refreshValue();
  12530. this._change(null, 0);
  12531. this._animateOff = false;
  12532. break;
  12533. case "values":
  12534. this._animateOff = true;
  12535. this._refreshValue();
  12536. // Start from the last handle to prevent unreachable handles (#9046)
  12537. for (i = valsLength - 1; i >= 0; i--) {
  12538. this._change(null, i);
  12539. }
  12540. this._animateOff = false;
  12541. break;
  12542. case "step":
  12543. case "min":
  12544. case "max":
  12545. this._animateOff = true;
  12546. this._calculateNewMax();
  12547. this._refreshValue();
  12548. this._animateOff = false;
  12549. break;
  12550. case "range":
  12551. this._animateOff = true;
  12552. this._refresh();
  12553. this._animateOff = false;
  12554. break;
  12555. }
  12556. },
  12557. _setOptionDisabled: function (value) {
  12558. this._super(value);
  12559. this._toggleClass(null, "ui-state-disabled", !!value);
  12560. },
  12561. //internal value getter
  12562. // _value() returns value trimmed by min and max, aligned by step
  12563. _value: function () {
  12564. var val = this.options.value;
  12565. val = this._trimAlignValue(val);
  12566. return val;
  12567. },
  12568. //internal values getter
  12569. // _values() returns array of values trimmed by min and max, aligned by step
  12570. // _values( index ) returns single value trimmed by min and max, aligned by step
  12571. _values: function (index) {
  12572. var val,
  12573. vals,
  12574. i;
  12575. if (arguments.length) {
  12576. val = this.options.values[index];
  12577. val = this._trimAlignValue(val);
  12578. return val;
  12579. } else if (this._hasMultipleValues()) {
  12580. // .slice() creates a copy of the array
  12581. // this copy gets trimmed by min and max and then returned
  12582. vals = this.options.values.slice();
  12583. for (i = 0; i < vals.length; i += 1) {
  12584. vals[i] = this._trimAlignValue(vals[i]);
  12585. }
  12586. return vals;
  12587. } else {
  12588. return [];
  12589. }
  12590. },
  12591. // Returns the step-aligned value that val is closest to, between (inclusive) min and max
  12592. _trimAlignValue: function (val) {
  12593. if (val <= this._valueMin()) {
  12594. return this._valueMin();
  12595. }
  12596. if (val >= this._valueMax()) {
  12597. return this._valueMax();
  12598. }
  12599. var step = (this.options.step > 0) ? this.options.step : 1,
  12600. valModStep = (val - this._valueMin()) % step,
  12601. alignValue = val - valModStep;
  12602. if (Math.abs(valModStep) * 2 >= step) {
  12603. alignValue += (valModStep > 0) ? step : (-step);
  12604. }
  12605. // Since JavaScript has problems with large floats, round
  12606. // the final value to 5 digits after the decimal point (see #4124)
  12607. return parseFloat(alignValue.toFixed(5));
  12608. },
  12609. _calculateNewMax: function () {
  12610. var max = this.options.max,
  12611. min = this._valueMin(),
  12612. step = this.options.step,
  12613. aboveMin = Math.round((max - min) / step) * step;
  12614. max = aboveMin + min;
  12615. if (max > this.options.max) {
  12616. //If max is not divisible by step, rounding off may increase its value
  12617. max -= step;
  12618. }
  12619. this.max = parseFloat(max.toFixed(this._precision()));
  12620. },
  12621. _precision: function () {
  12622. var precision = this._precisionOf(this.options.step);
  12623. if (this.options.min !== null) {
  12624. precision = Math.max(precision, this._precisionOf(this.options.min));
  12625. }
  12626. return precision;
  12627. },
  12628. _precisionOf: function (num) {
  12629. var str = num.toString(),
  12630. decimal = str.indexOf(".");
  12631. return decimal === -1 ? 0 : str.length - decimal - 1;
  12632. },
  12633. _valueMin: function () {
  12634. return this.options.min;
  12635. },
  12636. _valueMax: function () {
  12637. return this.max;
  12638. },
  12639. _refreshRange: function (orientation) {
  12640. if (orientation === "vertical") {
  12641. this.range.css({"width": "", "left": ""});
  12642. }
  12643. if (orientation === "horizontal") {
  12644. this.range.css({"height": "", "bottom": ""});
  12645. }
  12646. },
  12647. _refreshValue: function () {
  12648. var lastValPercent, valPercent, value, valueMin, valueMax,
  12649. oRange = this.options.range,
  12650. o = this.options,
  12651. that = this,
  12652. animate = (!this._animateOff) ? o.animate : false,
  12653. _set = {};
  12654. if (this._hasMultipleValues()) {
  12655. this.handles.each(function (i) {
  12656. valPercent = (that.values(i) - that._valueMin()) / (that._valueMax() -
  12657. that._valueMin()) * 100;
  12658. _set[that.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%";
  12659. $(this).stop(1, 1)[animate ? "animate" : "css"](_set, o.animate);
  12660. if (that.options.range === true) {
  12661. if (that.orientation === "horizontal") {
  12662. if (i === 0) {
  12663. that.range.stop(1, 1)[animate ? "animate" : "css"]({
  12664. left: valPercent + "%"
  12665. }, o.animate);
  12666. }
  12667. if (i === 1) {
  12668. that.range[animate ? "animate" : "css"]({
  12669. width: (valPercent - lastValPercent) + "%"
  12670. }, {
  12671. queue: false,
  12672. duration: o.animate
  12673. });
  12674. }
  12675. } else {
  12676. if (i === 0) {
  12677. that.range.stop(1, 1)[animate ? "animate" : "css"]({
  12678. bottom: (valPercent) + "%"
  12679. }, o.animate);
  12680. }
  12681. if (i === 1) {
  12682. that.range[animate ? "animate" : "css"]({
  12683. height: (valPercent - lastValPercent) + "%"
  12684. }, {
  12685. queue: false,
  12686. duration: o.animate
  12687. });
  12688. }
  12689. }
  12690. }
  12691. lastValPercent = valPercent;
  12692. });
  12693. } else {
  12694. value = this.value();
  12695. valueMin = this._valueMin();
  12696. valueMax = this._valueMax();
  12697. valPercent = (valueMax !== valueMin) ?
  12698. (value - valueMin) / (valueMax - valueMin) * 100 :
  12699. 0;
  12700. _set[this.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%";
  12701. this.handle.stop(1, 1)[animate ? "animate" : "css"](_set, o.animate);
  12702. if (oRange === "min" && this.orientation === "horizontal") {
  12703. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  12704. width: valPercent + "%"
  12705. }, o.animate);
  12706. }
  12707. if (oRange === "max" && this.orientation === "horizontal") {
  12708. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  12709. width: (100 - valPercent) + "%"
  12710. }, o.animate);
  12711. }
  12712. if (oRange === "min" && this.orientation === "vertical") {
  12713. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  12714. height: valPercent + "%"
  12715. }, o.animate);
  12716. }
  12717. if (oRange === "max" && this.orientation === "vertical") {
  12718. this.range.stop(1, 1)[animate ? "animate" : "css"]({
  12719. height: (100 - valPercent) + "%"
  12720. }, o.animate);
  12721. }
  12722. }
  12723. },
  12724. _handleEvents: {
  12725. keydown: function (event) {
  12726. var allowed, curVal, newVal, step,
  12727. index = $(event.target).data("ui-slider-handle-index");
  12728. switch (event.keyCode) {
  12729. case $.ui.keyCode.HOME:
  12730. case $.ui.keyCode.END:
  12731. case $.ui.keyCode.PAGE_UP:
  12732. case $.ui.keyCode.PAGE_DOWN:
  12733. case $.ui.keyCode.UP:
  12734. case $.ui.keyCode.RIGHT:
  12735. case $.ui.keyCode.DOWN:
  12736. case $.ui.keyCode.LEFT:
  12737. event.preventDefault();
  12738. if (!this._keySliding) {
  12739. this._keySliding = true;
  12740. this._addClass($(event.target), null, "ui-state-active");
  12741. allowed = this._start(event, index);
  12742. if (allowed === false) {
  12743. return;
  12744. }
  12745. }
  12746. break;
  12747. }
  12748. step = this.options.step;
  12749. if (this._hasMultipleValues()) {
  12750. curVal = newVal = this.values(index);
  12751. } else {
  12752. curVal = newVal = this.value();
  12753. }
  12754. switch (event.keyCode) {
  12755. case $.ui.keyCode.HOME:
  12756. newVal = this._valueMin();
  12757. break;
  12758. case $.ui.keyCode.END:
  12759. newVal = this._valueMax();
  12760. break;
  12761. case $.ui.keyCode.PAGE_UP:
  12762. newVal = this._trimAlignValue(
  12763. curVal + ((this._valueMax() - this._valueMin()) / this.numPages)
  12764. );
  12765. break;
  12766. case $.ui.keyCode.PAGE_DOWN:
  12767. newVal = this._trimAlignValue(
  12768. curVal - ((this._valueMax() - this._valueMin()) / this.numPages));
  12769. break;
  12770. case $.ui.keyCode.UP:
  12771. case $.ui.keyCode.RIGHT:
  12772. if (curVal === this._valueMax()) {
  12773. return;
  12774. }
  12775. newVal = this._trimAlignValue(curVal + step);
  12776. break;
  12777. case $.ui.keyCode.DOWN:
  12778. case $.ui.keyCode.LEFT:
  12779. if (curVal === this._valueMin()) {
  12780. return;
  12781. }
  12782. newVal = this._trimAlignValue(curVal - step);
  12783. break;
  12784. }
  12785. this._slide(event, index, newVal);
  12786. },
  12787. keyup: function (event) {
  12788. var index = $(event.target).data("ui-slider-handle-index");
  12789. if (this._keySliding) {
  12790. this._keySliding = false;
  12791. this._stop(event, index);
  12792. this._change(event, index);
  12793. this._removeClass($(event.target), null, "ui-state-active");
  12794. }
  12795. }
  12796. }
  12797. });
  12798. /*!
  12799. * jQuery UI Sortable 1.12.1
  12800. * http://jqueryui.com
  12801. *
  12802. * Copyright jQuery Foundation and other contributors
  12803. * Released under the MIT license.
  12804. * http://jquery.org/license
  12805. */
  12806. //>>label: Sortable
  12807. //>>group: Interactions
  12808. //>>description: Enables items in a list to be sorted using the mouse.
  12809. //>>docs: http://api.jqueryui.com/sortable/
  12810. //>>demos: http://jqueryui.com/sortable/
  12811. //>>css.structure: ../../themes/base/sortable.css
  12812. var widgetsSortable = $.widget("ui.sortable", $.ui.mouse, {
  12813. version: "1.12.1",
  12814. widgetEventPrefix: "sort",
  12815. ready: false,
  12816. options: {
  12817. appendTo: "parent",
  12818. axis: false,
  12819. connectWith: false,
  12820. containment: false,
  12821. cursor: "auto",
  12822. cursorAt: false,
  12823. dropOnEmpty: true,
  12824. forcePlaceholderSize: false,
  12825. forceHelperSize: false,
  12826. grid: false,
  12827. handle: false,
  12828. helper: "original",
  12829. items: "> *",
  12830. opacity: false,
  12831. placeholder: false,
  12832. revert: false,
  12833. scroll: true,
  12834. scrollSensitivity: 20,
  12835. scrollSpeed: 20,
  12836. scope: "default",
  12837. tolerance: "intersect",
  12838. zIndex: 1000,
  12839. // Callbacks
  12840. activate: null,
  12841. beforeStop: null,
  12842. change: null,
  12843. deactivate: null,
  12844. out: null,
  12845. over: null,
  12846. receive: null,
  12847. remove: null,
  12848. sort: null,
  12849. start: null,
  12850. stop: null,
  12851. update: null
  12852. },
  12853. _isOverAxis: function (x, reference, size) {
  12854. return (x >= reference) && (x < (reference + size));
  12855. },
  12856. _isFloating: function (item) {
  12857. return (/left|right/).test(item.css("float")) ||
  12858. (/inline|table-cell/).test(item.css("display"));
  12859. },
  12860. _create: function () {
  12861. this.containerCache = {};
  12862. this._addClass("ui-sortable");
  12863. //Get the items
  12864. this.refresh();
  12865. //Let's determine the parent's offset
  12866. this.offset = this.element.offset();
  12867. //Initialize mouse events for interaction
  12868. this._mouseInit();
  12869. this._setHandleClassName();
  12870. //We're ready to go
  12871. this.ready = true;
  12872. },
  12873. _setOption: function (key, value) {
  12874. this._super(key, value);
  12875. if (key === "handle") {
  12876. this._setHandleClassName();
  12877. }
  12878. },
  12879. _setHandleClassName: function () {
  12880. var that = this;
  12881. this._removeClass(this.element.find(".ui-sortable-handle"), "ui-sortable-handle");
  12882. $.each(this.items, function () {
  12883. that._addClass(
  12884. this.instance.options.handle ?
  12885. this.item.find(this.instance.options.handle) :
  12886. this.item,
  12887. "ui-sortable-handle"
  12888. );
  12889. });
  12890. },
  12891. _destroy: function () {
  12892. this._mouseDestroy();
  12893. for (var i = this.items.length - 1; i >= 0; i--) {
  12894. this.items[i].item.removeData(this.widgetName + "-item");
  12895. }
  12896. return this;
  12897. },
  12898. _mouseCapture: function (event, overrideHandle) {
  12899. var currentItem = null,
  12900. validHandle = false,
  12901. that = this;
  12902. if (this.reverting) {
  12903. return false;
  12904. }
  12905. if (this.options.disabled || this.options.type === "static") {
  12906. return false;
  12907. }
  12908. //We have to refresh the items data once first
  12909. this._refreshItems(event);
  12910. //Find out if the clicked node (or one of its parents) is a actual item in this.items
  12911. $(event.target).parents().each(function () {
  12912. if ($.data(this, that.widgetName + "-item") === that) {
  12913. currentItem = $(this);
  12914. return false;
  12915. }
  12916. });
  12917. if ($.data(event.target, that.widgetName + "-item") === that) {
  12918. currentItem = $(event.target);
  12919. }
  12920. if (!currentItem) {
  12921. return false;
  12922. }
  12923. if (this.options.handle && !overrideHandle) {
  12924. $(this.options.handle, currentItem).find("*").addBack().each(function () {
  12925. if (this === event.target) {
  12926. validHandle = true;
  12927. }
  12928. });
  12929. if (!validHandle) {
  12930. return false;
  12931. }
  12932. }
  12933. this.currentItem = currentItem;
  12934. this._removeCurrentsFromItems();
  12935. return true;
  12936. },
  12937. _mouseStart: function (event, overrideHandle, noActivation) {
  12938. var i, body,
  12939. o = this.options;
  12940. this.currentContainer = this;
  12941. //We only need to call refreshPositions, because the refreshItems call has been moved to
  12942. // mouseCapture
  12943. this.refreshPositions();
  12944. //Create and append the visible helper
  12945. this.helper = this._createHelper(event);
  12946. //Cache the helper size
  12947. this._cacheHelperProportions();
  12948. /*
  12949. * - Position generation -
  12950. * This block generates everything position related - it's the core of draggables.
  12951. */
  12952. //Cache the margins of the original element
  12953. this._cacheMargins();
  12954. //Get the next scrolling parent
  12955. this.scrollParent = this.helper.scrollParent();
  12956. //The element's absolute position on the page minus margins
  12957. this.offset = this.currentItem.offset();
  12958. this.offset = {
  12959. top: this.offset.top - this.margins.top,
  12960. left: this.offset.left - this.margins.left
  12961. };
  12962. $.extend(this.offset, {
  12963. click: { //Where the click happened, relative to the element
  12964. left: event.pageX - this.offset.left,
  12965. top: event.pageY - this.offset.top
  12966. },
  12967. parent: this._getParentOffset(),
  12968. // This is a relative to absolute position minus the actual position calculation -
  12969. // only used for relative positioned helper
  12970. relative: this._getRelativeOffset()
  12971. });
  12972. // Only after we got the offset, we can change the helper's position to absolute
  12973. // TODO: Still need to figure out a way to make relative sorting possible
  12974. this.helper.css("position", "absolute");
  12975. this.cssPosition = this.helper.css("position");
  12976. //Generate the original position
  12977. this.originalPosition = this._generatePosition(event);
  12978. this.originalPageX = event.pageX;
  12979. this.originalPageY = event.pageY;
  12980. //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
  12981. (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
  12982. //Cache the former DOM position
  12983. this.domPosition = {
  12984. prev: this.currentItem.prev()[0],
  12985. parent: this.currentItem.parent()[0]
  12986. };
  12987. // If the helper is not the original, hide the original so it's not playing any role during
  12988. // the drag, won't cause anything bad this way
  12989. if (this.helper[0] !== this.currentItem[0]) {
  12990. this.currentItem.hide();
  12991. }
  12992. //Create the placeholder
  12993. this._createPlaceholder();
  12994. //Set a containment if given in the options
  12995. if (o.containment) {
  12996. this._setContainment();
  12997. }
  12998. if (o.cursor && o.cursor !== "auto") { // cursor option
  12999. body = this.document.find("body");
  13000. // Support: IE
  13001. this.storedCursor = body.css("cursor");
  13002. body.css("cursor", o.cursor);
  13003. this.storedStylesheet =
  13004. $("<style>*{ cursor: " + o.cursor + " !important; }</style>").appendTo(body);
  13005. }
  13006. if (o.opacity) { // opacity option
  13007. if (this.helper.css("opacity")) {
  13008. this._storedOpacity = this.helper.css("opacity");
  13009. }
  13010. this.helper.css("opacity", o.opacity);
  13011. }
  13012. if (o.zIndex) { // zIndex option
  13013. if (this.helper.css("zIndex")) {
  13014. this._storedZIndex = this.helper.css("zIndex");
  13015. }
  13016. this.helper.css("zIndex", o.zIndex);
  13017. }
  13018. //Prepare scrolling
  13019. if (this.scrollParent[0] !== this.document[0] &&
  13020. this.scrollParent[0].tagName !== "HTML") {
  13021. this.overflowOffset = this.scrollParent.offset();
  13022. }
  13023. //Call callbacks
  13024. this._trigger("start", event, this._uiHash());
  13025. //Recache the helper size
  13026. if (!this._preserveHelperProportions) {
  13027. this._cacheHelperProportions();
  13028. }
  13029. //Post "activate" events to possible containers
  13030. if (!noActivation) {
  13031. for (i = this.containers.length - 1; i >= 0; i--) {
  13032. this.containers[i]._trigger("activate", event, this._uiHash(this));
  13033. }
  13034. }
  13035. //Prepare possible droppables
  13036. if ($.ui.ddmanager) {
  13037. $.ui.ddmanager.current = this;
  13038. }
  13039. if ($.ui.ddmanager && !o.dropBehaviour) {
  13040. $.ui.ddmanager.prepareOffsets(this, event);
  13041. }
  13042. this.dragging = true;
  13043. this._addClass(this.helper, "ui-sortable-helper");
  13044. // Execute the drag once - this causes the helper not to be visiblebefore getting its
  13045. // correct position
  13046. this._mouseDrag(event);
  13047. return true;
  13048. },
  13049. _mouseDrag: function (event) {
  13050. var i, item, itemElement, intersection,
  13051. o = this.options,
  13052. scrolled = false;
  13053. //Compute the helpers position
  13054. this.position = this._generatePosition(event);
  13055. this.positionAbs = this._convertPositionTo("absolute");
  13056. if (!this.lastPositionAbs) {
  13057. this.lastPositionAbs = this.positionAbs;
  13058. }
  13059. //Do scrolling
  13060. if (this.options.scroll) {
  13061. if (this.scrollParent[0] !== this.document[0] &&
  13062. this.scrollParent[0].tagName !== "HTML") {
  13063. if ((this.overflowOffset.top + this.scrollParent[0].offsetHeight) -
  13064. event.pageY < o.scrollSensitivity) {
  13065. this.scrollParent[0].scrollTop =
  13066. scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
  13067. } else if (event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
  13068. this.scrollParent[0].scrollTop =
  13069. scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
  13070. }
  13071. if ((this.overflowOffset.left + this.scrollParent[0].offsetWidth) -
  13072. event.pageX < o.scrollSensitivity) {
  13073. this.scrollParent[0].scrollLeft = scrolled =
  13074. this.scrollParent[0].scrollLeft + o.scrollSpeed;
  13075. } else if (event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
  13076. this.scrollParent[0].scrollLeft = scrolled =
  13077. this.scrollParent[0].scrollLeft - o.scrollSpeed;
  13078. }
  13079. } else {
  13080. if (event.pageY - this.document.scrollTop() < o.scrollSensitivity) {
  13081. scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed);
  13082. } else if (this.window.height() - (event.pageY - this.document.scrollTop()) <
  13083. o.scrollSensitivity) {
  13084. scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed);
  13085. }
  13086. if (event.pageX - this.document.scrollLeft() < o.scrollSensitivity) {
  13087. scrolled = this.document.scrollLeft(
  13088. this.document.scrollLeft() - o.scrollSpeed
  13089. );
  13090. } else if (this.window.width() - (event.pageX - this.document.scrollLeft()) <
  13091. o.scrollSensitivity) {
  13092. scrolled = this.document.scrollLeft(
  13093. this.document.scrollLeft() + o.scrollSpeed
  13094. );
  13095. }
  13096. }
  13097. if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
  13098. $.ui.ddmanager.prepareOffsets(this, event);
  13099. }
  13100. }
  13101. //Regenerate the absolute position used for position checks
  13102. this.positionAbs = this._convertPositionTo("absolute");
  13103. //Set the helper position
  13104. if (!this.options.axis || this.options.axis !== "y") {
  13105. this.helper[0].style.left = this.position.left + "px";
  13106. }
  13107. if (!this.options.axis || this.options.axis !== "x") {
  13108. this.helper[0].style.top = this.position.top + "px";
  13109. }
  13110. //Rearrange
  13111. for (i = this.items.length - 1; i >= 0; i--) {
  13112. //Cache variables and intersection, continue if no intersection
  13113. item = this.items[i];
  13114. itemElement = item.item[0];
  13115. intersection = this._intersectsWithPointer(item);
  13116. if (!intersection) {
  13117. continue;
  13118. }
  13119. // Only put the placeholder inside the current Container, skip all
  13120. // items from other containers. This works because when moving
  13121. // an item from one container to another the
  13122. // currentContainer is switched before the placeholder is moved.
  13123. //
  13124. // Without this, moving items in "sub-sortables" can cause
  13125. // the placeholder to jitter between the outer and inner container.
  13126. if (item.instance !== this.currentContainer) {
  13127. continue;
  13128. }
  13129. // Cannot intersect with itself
  13130. // no useless actions that have been done before
  13131. // no action if the item moved is the parent of the item checked
  13132. if (itemElement !== this.currentItem[0] &&
  13133. this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement &&
  13134. !$.contains(this.placeholder[0], itemElement) &&
  13135. (this.options.type === "semi-dynamic" ?
  13136. !$.contains(this.element[0], itemElement) :
  13137. true
  13138. )
  13139. ) {
  13140. this.direction = intersection === 1 ? "down" : "up";
  13141. if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) {
  13142. this._rearrange(event, item);
  13143. } else {
  13144. break;
  13145. }
  13146. this._trigger("change", event, this._uiHash());
  13147. break;
  13148. }
  13149. }
  13150. //Post events to containers
  13151. this._contactContainers(event);
  13152. //Interconnect with droppables
  13153. if ($.ui.ddmanager) {
  13154. $.ui.ddmanager.drag(this, event);
  13155. }
  13156. //Call callbacks
  13157. this._trigger("sort", event, this._uiHash());
  13158. this.lastPositionAbs = this.positionAbs;
  13159. return false;
  13160. },
  13161. _mouseStop: function (event, noPropagation) {
  13162. if (!event) {
  13163. return;
  13164. }
  13165. //If we are using droppables, inform the manager about the drop
  13166. if ($.ui.ddmanager && !this.options.dropBehaviour) {
  13167. $.ui.ddmanager.drop(this, event);
  13168. }
  13169. if (this.options.revert) {
  13170. var that = this,
  13171. cur = this.placeholder.offset(),
  13172. axis = this.options.axis,
  13173. animation = {};
  13174. if (!axis || axis === "x") {
  13175. animation.left = cur.left - this.offset.parent.left - this.margins.left +
  13176. (this.offsetParent[0] === this.document[0].body ?
  13177. 0 :
  13178. this.offsetParent[0].scrollLeft
  13179. );
  13180. }
  13181. if (!axis || axis === "y") {
  13182. animation.top = cur.top - this.offset.parent.top - this.margins.top +
  13183. (this.offsetParent[0] === this.document[0].body ?
  13184. 0 :
  13185. this.offsetParent[0].scrollTop
  13186. );
  13187. }
  13188. this.reverting = true;
  13189. $(this.helper).animate(
  13190. animation,
  13191. parseInt(this.options.revert, 10) || 500,
  13192. function () {
  13193. that._clear(event);
  13194. }
  13195. );
  13196. } else {
  13197. this._clear(event, noPropagation);
  13198. }
  13199. return false;
  13200. },
  13201. cancel: function () {
  13202. if (this.dragging) {
  13203. this._mouseUp(new $.Event("mouseup", {target: null}));
  13204. if (this.options.helper === "original") {
  13205. this.currentItem.css(this._storedCSS);
  13206. this._removeClass(this.currentItem, "ui-sortable-helper");
  13207. } else {
  13208. this.currentItem.show();
  13209. }
  13210. //Post deactivating events to containers
  13211. for (var i = this.containers.length - 1; i >= 0; i--) {
  13212. this.containers[i]._trigger("deactivate", null, this._uiHash(this));
  13213. if (this.containers[i].containerCache.over) {
  13214. this.containers[i]._trigger("out", null, this._uiHash(this));
  13215. this.containers[i].containerCache.over = 0;
  13216. }
  13217. }
  13218. }
  13219. if (this.placeholder) {
  13220. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
  13221. // it unbinds ALL events from the original node!
  13222. if (this.placeholder[0].parentNode) {
  13223. this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  13224. }
  13225. if (this.options.helper !== "original" && this.helper &&
  13226. this.helper[0].parentNode) {
  13227. this.helper.remove();
  13228. }
  13229. $.extend(this, {
  13230. helper: null,
  13231. dragging: false,
  13232. reverting: false,
  13233. _noFinalSort: null
  13234. });
  13235. if (this.domPosition.prev) {
  13236. $(this.domPosition.prev).after(this.currentItem);
  13237. } else {
  13238. $(this.domPosition.parent).prepend(this.currentItem);
  13239. }
  13240. }
  13241. return this;
  13242. },
  13243. serialize: function (o) {
  13244. var items = this._getItemsAsjQuery(o && o.connected),
  13245. str = [];
  13246. o = o || {};
  13247. $(items).each(function () {
  13248. var res = ($(o.item || this).attr(o.attribute || "id") || "")
  13249. .match(o.expression || (/(.+)[\-=_](.+)/));
  13250. if (res) {
  13251. str.push(
  13252. (o.key || res[1] + "[]") +
  13253. "=" + (o.key && o.expression ? res[1] : res[2]));
  13254. }
  13255. });
  13256. if (!str.length && o.key) {
  13257. str.push(o.key + "=");
  13258. }
  13259. return str.join("&");
  13260. },
  13261. toArray: function (o) {
  13262. var items = this._getItemsAsjQuery(o && o.connected),
  13263. ret = [];
  13264. o = o || {};
  13265. items.each(function () {
  13266. ret.push($(o.item || this).attr(o.attribute || "id") || "");
  13267. });
  13268. return ret;
  13269. },
  13270. /* Be careful with the following core functions */
  13271. _intersectsWith: function (item) {
  13272. var x1 = this.positionAbs.left,
  13273. x2 = x1 + this.helperProportions.width,
  13274. y1 = this.positionAbs.top,
  13275. y2 = y1 + this.helperProportions.height,
  13276. l = item.left,
  13277. r = l + item.width,
  13278. t = item.top,
  13279. b = t + item.height,
  13280. dyClick = this.offset.click.top,
  13281. dxClick = this.offset.click.left,
  13282. isOverElementHeight = (this.options.axis === "x") || ((y1 + dyClick) > t &&
  13283. (y1 + dyClick) < b),
  13284. isOverElementWidth = (this.options.axis === "y") || ((x1 + dxClick) > l &&
  13285. (x1 + dxClick) < r),
  13286. isOverElement = isOverElementHeight && isOverElementWidth;
  13287. if (this.options.tolerance === "pointer" ||
  13288. this.options.forcePointerForContainers ||
  13289. (this.options.tolerance !== "pointer" &&
  13290. this.helperProportions[this.floating ? "width" : "height"] >
  13291. item[this.floating ? "width" : "height"])
  13292. ) {
  13293. return isOverElement;
  13294. } else {
  13295. return (l < x1 + (this.helperProportions.width / 2) && // Right Half
  13296. x2 - (this.helperProportions.width / 2) < r && // Left Half
  13297. t < y1 + (this.helperProportions.height / 2) && // Bottom Half
  13298. y2 - (this.helperProportions.height / 2) < b); // Top Half
  13299. }
  13300. },
  13301. _intersectsWithPointer: function (item) {
  13302. var verticalDirection, horizontalDirection,
  13303. isOverElementHeight = (this.options.axis === "x") ||
  13304. this._isOverAxis(
  13305. this.positionAbs.top + this.offset.click.top, item.top, item.height),
  13306. isOverElementWidth = (this.options.axis === "y") ||
  13307. this._isOverAxis(
  13308. this.positionAbs.left + this.offset.click.left, item.left, item.width),
  13309. isOverElement = isOverElementHeight && isOverElementWidth;
  13310. if (!isOverElement) {
  13311. return false;
  13312. }
  13313. verticalDirection = this._getDragVerticalDirection();
  13314. horizontalDirection = this._getDragHorizontalDirection();
  13315. return this.floating ?
  13316. ((horizontalDirection === "right" || verticalDirection === "down") ? 2 : 1)
  13317. : (verticalDirection && (verticalDirection === "down" ? 2 : 1));
  13318. },
  13319. _intersectsWithSides: function (item) {
  13320. var isOverBottomHalf = this._isOverAxis(this.positionAbs.top +
  13321. this.offset.click.top, item.top + (item.height / 2), item.height),
  13322. isOverRightHalf = this._isOverAxis(this.positionAbs.left +
  13323. this.offset.click.left, item.left + (item.width / 2), item.width),
  13324. verticalDirection = this._getDragVerticalDirection(),
  13325. horizontalDirection = this._getDragHorizontalDirection();
  13326. if (this.floating && horizontalDirection) {
  13327. return ((horizontalDirection === "right" && isOverRightHalf) ||
  13328. (horizontalDirection === "left" && !isOverRightHalf));
  13329. } else {
  13330. return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) ||
  13331. (verticalDirection === "up" && !isOverBottomHalf));
  13332. }
  13333. },
  13334. _getDragVerticalDirection: function () {
  13335. var delta = this.positionAbs.top - this.lastPositionAbs.top;
  13336. return delta !== 0 && (delta > 0 ? "down" : "up");
  13337. },
  13338. _getDragHorizontalDirection: function () {
  13339. var delta = this.positionAbs.left - this.lastPositionAbs.left;
  13340. return delta !== 0 && (delta > 0 ? "right" : "left");
  13341. },
  13342. refresh: function (event) {
  13343. this._refreshItems(event);
  13344. this._setHandleClassName();
  13345. this.refreshPositions();
  13346. return this;
  13347. },
  13348. _connectWith: function () {
  13349. var options = this.options;
  13350. return options.connectWith.constructor === String ?
  13351. [options.connectWith] :
  13352. options.connectWith;
  13353. },
  13354. _getItemsAsjQuery: function (connected) {
  13355. var i, j, cur, inst,
  13356. items = [],
  13357. queries = [],
  13358. connectWith = this._connectWith();
  13359. if (connectWith && connected) {
  13360. for (i = connectWith.length - 1; i >= 0; i--) {
  13361. cur = $(connectWith[i], this.document[0]);
  13362. for (j = cur.length - 1; j >= 0; j--) {
  13363. inst = $.data(cur[j], this.widgetFullName);
  13364. if (inst && inst !== this && !inst.options.disabled) {
  13365. queries.push([$.isFunction(inst.options.items) ?
  13366. inst.options.items.call(inst.element) :
  13367. $(inst.options.items, inst.element)
  13368. .not(".ui-sortable-helper")
  13369. .not(".ui-sortable-placeholder"), inst]);
  13370. }
  13371. }
  13372. }
  13373. }
  13374. queries.push([$.isFunction(this.options.items) ?
  13375. this.options.items
  13376. .call(this.element, null, {options: this.options, item: this.currentItem}) :
  13377. $(this.options.items, this.element)
  13378. .not(".ui-sortable-helper")
  13379. .not(".ui-sortable-placeholder"), this]);
  13380. function addItems() {
  13381. items.push(this);
  13382. }
  13383. for (i = queries.length - 1; i >= 0; i--) {
  13384. queries[i][0].each(addItems);
  13385. }
  13386. return $(items);
  13387. },
  13388. _removeCurrentsFromItems: function () {
  13389. var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
  13390. this.items = $.grep(this.items, function (item) {
  13391. for (var j = 0; j < list.length; j++) {
  13392. if (list[j] === item.item[0]) {
  13393. return false;
  13394. }
  13395. }
  13396. return true;
  13397. });
  13398. },
  13399. _refreshItems: function (event) {
  13400. this.items = [];
  13401. this.containers = [this];
  13402. var i, j, cur, inst, targetData, _queries, item, queriesLength,
  13403. items = this.items,
  13404. queries = [[$.isFunction(this.options.items) ?
  13405. this.options.items.call(this.element[0], event, {item: this.currentItem}) :
  13406. $(this.options.items, this.element), this]],
  13407. connectWith = this._connectWith();
  13408. //Shouldn't be run the first time through due to massive slow-down
  13409. if (connectWith && this.ready) {
  13410. for (i = connectWith.length - 1; i >= 0; i--) {
  13411. cur = $(connectWith[i], this.document[0]);
  13412. for (j = cur.length - 1; j >= 0; j--) {
  13413. inst = $.data(cur[j], this.widgetFullName);
  13414. if (inst && inst !== this && !inst.options.disabled) {
  13415. queries.push([$.isFunction(inst.options.items) ?
  13416. inst.options.items
  13417. .call(inst.element[0], event, {item: this.currentItem}) :
  13418. $(inst.options.items, inst.element), inst]);
  13419. this.containers.push(inst);
  13420. }
  13421. }
  13422. }
  13423. }
  13424. for (i = queries.length - 1; i >= 0; i--) {
  13425. targetData = queries[i][1];
  13426. _queries = queries[i][0];
  13427. for (j = 0, queriesLength = _queries.length; j < queriesLength; j++) {
  13428. item = $(_queries[j]);
  13429. // Data for target checking (mouse manager)
  13430. item.data(this.widgetName + "-item", targetData);
  13431. items.push({
  13432. item: item,
  13433. instance: targetData,
  13434. width: 0, height: 0,
  13435. left: 0, top: 0
  13436. });
  13437. }
  13438. }
  13439. },
  13440. refreshPositions: function (fast) {
  13441. // Determine whether items are being displayed horizontally
  13442. this.floating = this.items.length ?
  13443. this.options.axis === "x" || this._isFloating(this.items[0].item) :
  13444. false;
  13445. //This has to be redone because due to the item being moved out/into the offsetParent,
  13446. // the offsetParent's position will change
  13447. if (this.offsetParent && this.helper) {
  13448. this.offset.parent = this._getParentOffset();
  13449. }
  13450. var i, item, t, p;
  13451. for (i = this.items.length - 1; i >= 0; i--) {
  13452. item = this.items[i];
  13453. //We ignore calculating positions of all connected containers when we're not over them
  13454. if (item.instance !== this.currentContainer && this.currentContainer &&
  13455. item.item[0] !== this.currentItem[0]) {
  13456. continue;
  13457. }
  13458. t = this.options.toleranceElement ?
  13459. $(this.options.toleranceElement, item.item) :
  13460. item.item;
  13461. if (!fast) {
  13462. item.width = t.outerWidth();
  13463. item.height = t.outerHeight();
  13464. }
  13465. p = t.offset();
  13466. item.left = p.left;
  13467. item.top = p.top;
  13468. }
  13469. if (this.options.custom && this.options.custom.refreshContainers) {
  13470. this.options.custom.refreshContainers.call(this);
  13471. } else {
  13472. for (i = this.containers.length - 1; i >= 0; i--) {
  13473. p = this.containers[i].element.offset();
  13474. this.containers[i].containerCache.left = p.left;
  13475. this.containers[i].containerCache.top = p.top;
  13476. this.containers[i].containerCache.width =
  13477. this.containers[i].element.outerWidth();
  13478. this.containers[i].containerCache.height =
  13479. this.containers[i].element.outerHeight();
  13480. }
  13481. }
  13482. return this;
  13483. },
  13484. _createPlaceholder: function (that) {
  13485. that = that || this;
  13486. var className,
  13487. o = that.options;
  13488. if (!o.placeholder || o.placeholder.constructor === String) {
  13489. className = o.placeholder;
  13490. o.placeholder = {
  13491. element: function () {
  13492. var nodeName = that.currentItem[0].nodeName.toLowerCase(),
  13493. element = $("<" + nodeName + ">", that.document[0]);
  13494. that._addClass(element, "ui-sortable-placeholder",
  13495. className || that.currentItem[0].className)
  13496. ._removeClass(element, "ui-sortable-helper");
  13497. if (nodeName === "tbody") {
  13498. that._createTrPlaceholder(
  13499. that.currentItem.find("tr").eq(0),
  13500. $("<tr>", that.document[0]).appendTo(element)
  13501. );
  13502. } else if (nodeName === "tr") {
  13503. that._createTrPlaceholder(that.currentItem, element);
  13504. } else if (nodeName === "img") {
  13505. element.attr("src", that.currentItem.attr("src"));
  13506. }
  13507. if (!className) {
  13508. element.css("visibility", "hidden");
  13509. }
  13510. return element;
  13511. },
  13512. update: function (container, p) {
  13513. // 1. If a className is set as 'placeholder option, we don't force sizes -
  13514. // the class is responsible for that
  13515. // 2. The option 'forcePlaceholderSize can be enabled to force it even if a
  13516. // class name is specified
  13517. if (className && !o.forcePlaceholderSize) {
  13518. return;
  13519. }
  13520. //If the element doesn't have a actual height by itself (without styles coming
  13521. // from a stylesheet), it receives the inline height from the dragged item
  13522. if (!p.height()) {
  13523. p.height(
  13524. that.currentItem.innerHeight() -
  13525. parseInt(that.currentItem.css("paddingTop") || 0, 10) -
  13526. parseInt(that.currentItem.css("paddingBottom") || 0, 10));
  13527. }
  13528. if (!p.width()) {
  13529. p.width(
  13530. that.currentItem.innerWidth() -
  13531. parseInt(that.currentItem.css("paddingLeft") || 0, 10) -
  13532. parseInt(that.currentItem.css("paddingRight") || 0, 10));
  13533. }
  13534. }
  13535. };
  13536. }
  13537. //Create the placeholder
  13538. that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
  13539. //Append it after the actual current item
  13540. that.currentItem.after(that.placeholder);
  13541. //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
  13542. o.placeholder.update(that, that.placeholder);
  13543. },
  13544. _createTrPlaceholder: function (sourceTr, targetTr) {
  13545. var that = this;
  13546. sourceTr.children().each(function () {
  13547. $("<td>&#160;</td>", that.document[0])
  13548. .attr("colspan", $(this).attr("colspan") || 1)
  13549. .appendTo(targetTr);
  13550. });
  13551. },
  13552. _contactContainers: function (event) {
  13553. var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom,
  13554. floating, axis,
  13555. innermostContainer = null,
  13556. innermostIndex = null;
  13557. // Get innermost container that intersects with item
  13558. for (i = this.containers.length - 1; i >= 0; i--) {
  13559. // Never consider a container that's located within the item itself
  13560. if ($.contains(this.currentItem[0], this.containers[i].element[0])) {
  13561. continue;
  13562. }
  13563. if (this._intersectsWith(this.containers[i].containerCache)) {
  13564. // If we've already found a container and it's more "inner" than this, then continue
  13565. if (innermostContainer &&
  13566. $.contains(
  13567. this.containers[i].element[0],
  13568. innermostContainer.element[0])) {
  13569. continue;
  13570. }
  13571. innermostContainer = this.containers[i];
  13572. innermostIndex = i;
  13573. } else {
  13574. // container doesn't intersect. trigger "out" event if necessary
  13575. if (this.containers[i].containerCache.over) {
  13576. this.containers[i]._trigger("out", event, this._uiHash(this));
  13577. this.containers[i].containerCache.over = 0;
  13578. }
  13579. }
  13580. }
  13581. // If no intersecting containers found, return
  13582. if (!innermostContainer) {
  13583. return;
  13584. }
  13585. // Move the item into the container if it's not there already
  13586. if (this.containers.length === 1) {
  13587. if (!this.containers[innermostIndex].containerCache.over) {
  13588. this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
  13589. this.containers[innermostIndex].containerCache.over = 1;
  13590. }
  13591. } else {
  13592. // When entering a new container, we will find the item with the least distance and
  13593. // append our item near it
  13594. dist = 10000;
  13595. itemWithLeastDistance = null;
  13596. floating = innermostContainer.floating || this._isFloating(this.currentItem);
  13597. posProperty = floating ? "left" : "top";
  13598. sizeProperty = floating ? "width" : "height";
  13599. axis = floating ? "pageX" : "pageY";
  13600. for (j = this.items.length - 1; j >= 0; j--) {
  13601. if (!$.contains(
  13602. this.containers[innermostIndex].element[0], this.items[j].item[0])
  13603. ) {
  13604. continue;
  13605. }
  13606. if (this.items[j].item[0] === this.currentItem[0]) {
  13607. continue;
  13608. }
  13609. cur = this.items[j].item.offset()[posProperty];
  13610. nearBottom = false;
  13611. if (event[axis] - cur > this.items[j][sizeProperty] / 2) {
  13612. nearBottom = true;
  13613. }
  13614. if (Math.abs(event[axis] - cur) < dist) {
  13615. dist = Math.abs(event[axis] - cur);
  13616. itemWithLeastDistance = this.items[j];
  13617. this.direction = nearBottom ? "up" : "down";
  13618. }
  13619. }
  13620. //Check if dropOnEmpty is enabled
  13621. if (!itemWithLeastDistance && !this.options.dropOnEmpty) {
  13622. return;
  13623. }
  13624. if (this.currentContainer === this.containers[innermostIndex]) {
  13625. if (!this.currentContainer.containerCache.over) {
  13626. this.containers[innermostIndex]._trigger("over", event, this._uiHash());
  13627. this.currentContainer.containerCache.over = 1;
  13628. }
  13629. return;
  13630. }
  13631. itemWithLeastDistance ?
  13632. this._rearrange(event, itemWithLeastDistance, null, true) :
  13633. this._rearrange(event, null, this.containers[innermostIndex].element, true);
  13634. this._trigger("change", event, this._uiHash());
  13635. this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
  13636. this.currentContainer = this.containers[innermostIndex];
  13637. //Update the placeholder
  13638. this.options.placeholder.update(this.currentContainer, this.placeholder);
  13639. this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
  13640. this.containers[innermostIndex].containerCache.over = 1;
  13641. }
  13642. },
  13643. _createHelper: function (event) {
  13644. var o = this.options,
  13645. helper = $.isFunction(o.helper) ?
  13646. $(o.helper.apply(this.element[0], [event, this.currentItem])) :
  13647. (o.helper === "clone" ? this.currentItem.clone() : this.currentItem);
  13648. //Add the helper to the DOM if that didn't happen already
  13649. if (!helper.parents("body").length) {
  13650. $(o.appendTo !== "parent" ?
  13651. o.appendTo :
  13652. this.currentItem[0].parentNode)[0].appendChild(helper[0]);
  13653. }
  13654. if (helper[0] === this.currentItem[0]) {
  13655. this._storedCSS = {
  13656. width: this.currentItem[0].style.width,
  13657. height: this.currentItem[0].style.height,
  13658. position: this.currentItem.css("position"),
  13659. top: this.currentItem.css("top"),
  13660. left: this.currentItem.css("left")
  13661. };
  13662. }
  13663. if (!helper[0].style.width || o.forceHelperSize) {
  13664. helper.width(this.currentItem.width());
  13665. }
  13666. if (!helper[0].style.height || o.forceHelperSize) {
  13667. helper.height(this.currentItem.height());
  13668. }
  13669. return helper;
  13670. },
  13671. _adjustOffsetFromHelper: function (obj) {
  13672. if (typeof obj === "string") {
  13673. obj = obj.split(" ");
  13674. }
  13675. if ($.isArray(obj)) {
  13676. obj = {left: +obj[0], top: +obj[1] || 0};
  13677. }
  13678. if ("left" in obj) {
  13679. this.offset.click.left = obj.left + this.margins.left;
  13680. }
  13681. if ("right" in obj) {
  13682. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  13683. }
  13684. if ("top" in obj) {
  13685. this.offset.click.top = obj.top + this.margins.top;
  13686. }
  13687. if ("bottom" in obj) {
  13688. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  13689. }
  13690. },
  13691. _getParentOffset: function () {
  13692. //Get the offsetParent and cache its position
  13693. this.offsetParent = this.helper.offsetParent();
  13694. var po = this.offsetParent.offset();
  13695. // This is a special case where we need to modify a offset calculated on start, since the
  13696. // following happened:
  13697. // 1. The position of the helper is absolute, so it's position is calculated based on the
  13698. // next positioned parent
  13699. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
  13700. // the document, which means that the scroll is included in the initial calculation of the
  13701. // offset of the parent, and never recalculated upon drag
  13702. if (this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] &&
  13703. $.contains(this.scrollParent[0], this.offsetParent[0])) {
  13704. po.left += this.scrollParent.scrollLeft();
  13705. po.top += this.scrollParent.scrollTop();
  13706. }
  13707. // This needs to be actually done for all browsers, since pageX/pageY includes this
  13708. // information with an ugly IE fix
  13709. if (this.offsetParent[0] === this.document[0].body ||
  13710. (this.offsetParent[0].tagName &&
  13711. this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
  13712. po = {top: 0, left: 0};
  13713. }
  13714. return {
  13715. top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
  13716. left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
  13717. };
  13718. },
  13719. _getRelativeOffset: function () {
  13720. if (this.cssPosition === "relative") {
  13721. var p = this.currentItem.position();
  13722. return {
  13723. top: p.top - (parseInt(this.helper.css("top"), 10) || 0) +
  13724. this.scrollParent.scrollTop(),
  13725. left: p.left - (parseInt(this.helper.css("left"), 10) || 0) +
  13726. this.scrollParent.scrollLeft()
  13727. };
  13728. } else {
  13729. return {top: 0, left: 0};
  13730. }
  13731. },
  13732. _cacheMargins: function () {
  13733. this.margins = {
  13734. left: (parseInt(this.currentItem.css("marginLeft"), 10) || 0),
  13735. top: (parseInt(this.currentItem.css("marginTop"), 10) || 0)
  13736. };
  13737. },
  13738. _cacheHelperProportions: function () {
  13739. this.helperProportions = {
  13740. width: this.helper.outerWidth(),
  13741. height: this.helper.outerHeight()
  13742. };
  13743. },
  13744. _setContainment: function () {
  13745. var ce, co, over,
  13746. o = this.options;
  13747. if (o.containment === "parent") {
  13748. o.containment = this.helper[0].parentNode;
  13749. }
  13750. if (o.containment === "document" || o.containment === "window") {
  13751. this.containment = [
  13752. 0 - this.offset.relative.left - this.offset.parent.left,
  13753. 0 - this.offset.relative.top - this.offset.parent.top,
  13754. o.containment === "document" ?
  13755. this.document.width() :
  13756. this.window.width() - this.helperProportions.width - this.margins.left,
  13757. (o.containment === "document" ?
  13758. (this.document.height() || document.body.parentNode.scrollHeight) :
  13759. this.window.height() || this.document[0].body.parentNode.scrollHeight
  13760. ) - this.helperProportions.height - this.margins.top
  13761. ];
  13762. }
  13763. if (!(/^(document|window|parent)$/).test(o.containment)) {
  13764. ce = $(o.containment)[0];
  13765. co = $(o.containment).offset();
  13766. over = ($(ce).css("overflow") !== "hidden");
  13767. this.containment = [
  13768. co.left + (parseInt($(ce).css("borderLeftWidth"), 10) || 0) +
  13769. (parseInt($(ce).css("paddingLeft"), 10) || 0) - this.margins.left,
  13770. co.top + (parseInt($(ce).css("borderTopWidth"), 10) || 0) +
  13771. (parseInt($(ce).css("paddingTop"), 10) || 0) - this.margins.top,
  13772. co.left + (over ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) -
  13773. (parseInt($(ce).css("borderLeftWidth"), 10) || 0) -
  13774. (parseInt($(ce).css("paddingRight"), 10) || 0) -
  13775. this.helperProportions.width - this.margins.left,
  13776. co.top + (over ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) -
  13777. (parseInt($(ce).css("borderTopWidth"), 10) || 0) -
  13778. (parseInt($(ce).css("paddingBottom"), 10) || 0) -
  13779. this.helperProportions.height - this.margins.top
  13780. ];
  13781. }
  13782. },
  13783. _convertPositionTo: function (d, pos) {
  13784. if (!pos) {
  13785. pos = this.position;
  13786. }
  13787. var mod = d === "absolute" ? 1 : -1,
  13788. scroll = this.cssPosition === "absolute" &&
  13789. !(this.scrollParent[0] !== this.document[0] &&
  13790. $.contains(this.scrollParent[0], this.offsetParent[0])) ?
  13791. this.offsetParent :
  13792. this.scrollParent,
  13793. scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
  13794. return {
  13795. top: (
  13796. // The absolute mouse position
  13797. pos.top +
  13798. // Only for relative positioned nodes: Relative offset from element to offset parent
  13799. this.offset.relative.top * mod +
  13800. // The offsetParent's offset without borders (offset + border)
  13801. this.offset.parent.top * mod -
  13802. ((this.cssPosition === "fixed" ?
  13803. -this.scrollParent.scrollTop() :
  13804. (scrollIsRootNode ? 0 : scroll.scrollTop())) * mod)
  13805. ),
  13806. left: (
  13807. // The absolute mouse position
  13808. pos.left +
  13809. // Only for relative positioned nodes: Relative offset from element to offset parent
  13810. this.offset.relative.left * mod +
  13811. // The offsetParent's offset without borders (offset + border)
  13812. this.offset.parent.left * mod -
  13813. ((this.cssPosition === "fixed" ?
  13814. -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
  13815. scroll.scrollLeft()) * mod)
  13816. )
  13817. };
  13818. },
  13819. _generatePosition: function (event) {
  13820. var top, left,
  13821. o = this.options,
  13822. pageX = event.pageX,
  13823. pageY = event.pageY,
  13824. scroll = this.cssPosition === "absolute" &&
  13825. !(this.scrollParent[0] !== this.document[0] &&
  13826. $.contains(this.scrollParent[0], this.offsetParent[0])) ?
  13827. this.offsetParent :
  13828. this.scrollParent,
  13829. scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
  13830. // This is another very weird special case that only happens for relative elements:
  13831. // 1. If the css position is relative
  13832. // 2. and the scroll parent is the document or similar to the offset parent
  13833. // we have to refresh the relative offset during the scroll so there are no jumps
  13834. if (this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] &&
  13835. this.scrollParent[0] !== this.offsetParent[0])) {
  13836. this.offset.relative = this._getRelativeOffset();
  13837. }
  13838. /*
  13839. * - Position constraining -
  13840. * Constrain the position to a mix of grid, containment.
  13841. */
  13842. if (this.originalPosition) { //If we are not dragging yet, we won't check for options
  13843. if (this.containment) {
  13844. if (event.pageX - this.offset.click.left < this.containment[0]) {
  13845. pageX = this.containment[0] + this.offset.click.left;
  13846. }
  13847. if (event.pageY - this.offset.click.top < this.containment[1]) {
  13848. pageY = this.containment[1] + this.offset.click.top;
  13849. }
  13850. if (event.pageX - this.offset.click.left > this.containment[2]) {
  13851. pageX = this.containment[2] + this.offset.click.left;
  13852. }
  13853. if (event.pageY - this.offset.click.top > this.containment[3]) {
  13854. pageY = this.containment[3] + this.offset.click.top;
  13855. }
  13856. }
  13857. if (o.grid) {
  13858. top = this.originalPageY + Math.round((pageY - this.originalPageY) /
  13859. o.grid[1]) * o.grid[1];
  13860. pageY = this.containment ?
  13861. ((top - this.offset.click.top >= this.containment[1] &&
  13862. top - this.offset.click.top <= this.containment[3]) ?
  13863. top :
  13864. ((top - this.offset.click.top >= this.containment[1]) ?
  13865. top - o.grid[1] : top + o.grid[1])) :
  13866. top;
  13867. left = this.originalPageX + Math.round((pageX - this.originalPageX) /
  13868. o.grid[0]) * o.grid[0];
  13869. pageX = this.containment ?
  13870. ((left - this.offset.click.left >= this.containment[0] &&
  13871. left - this.offset.click.left <= this.containment[2]) ?
  13872. left :
  13873. ((left - this.offset.click.left >= this.containment[0]) ?
  13874. left - o.grid[0] : left + o.grid[0])) :
  13875. left;
  13876. }
  13877. }
  13878. return {
  13879. top: (
  13880. // The absolute mouse position
  13881. pageY -
  13882. // Click offset (relative to the element)
  13883. this.offset.click.top -
  13884. // Only for relative positioned nodes: Relative offset from element to offset parent
  13885. this.offset.relative.top -
  13886. // The offsetParent's offset without borders (offset + border)
  13887. this.offset.parent.top +
  13888. ((this.cssPosition === "fixed" ?
  13889. -this.scrollParent.scrollTop() :
  13890. (scrollIsRootNode ? 0 : scroll.scrollTop())))
  13891. ),
  13892. left: (
  13893. // The absolute mouse position
  13894. pageX -
  13895. // Click offset (relative to the element)
  13896. this.offset.click.left -
  13897. // Only for relative positioned nodes: Relative offset from element to offset parent
  13898. this.offset.relative.left -
  13899. // The offsetParent's offset without borders (offset + border)
  13900. this.offset.parent.left +
  13901. ((this.cssPosition === "fixed" ?
  13902. -this.scrollParent.scrollLeft() :
  13903. scrollIsRootNode ? 0 : scroll.scrollLeft()))
  13904. )
  13905. };
  13906. },
  13907. _rearrange: function (event, i, a, hardRefresh) {
  13908. a ? a[0].appendChild(this.placeholder[0]) :
  13909. i.item[0].parentNode.insertBefore(this.placeholder[0],
  13910. (this.direction === "down" ? i.item[0] : i.item[0].nextSibling));
  13911. //Various things done here to improve the performance:
  13912. // 1. we create a setTimeout, that calls refreshPositions
  13913. // 2. on the instance, we have a counter variable, that get's higher after every append
  13914. // 3. on the local scope, we copy the counter variable, and check in the timeout,
  13915. // if it's still the same
  13916. // 4. this lets only the last addition to the timeout stack through
  13917. this.counter = this.counter ? ++this.counter : 1;
  13918. var counter = this.counter;
  13919. this._delay(function () {
  13920. if (counter === this.counter) {
  13921. //Precompute after each DOM insertion, NOT on mousemove
  13922. this.refreshPositions(!hardRefresh);
  13923. }
  13924. });
  13925. },
  13926. _clear: function (event, noPropagation) {
  13927. this.reverting = false;
  13928. // We delay all events that have to be triggered to after the point where the placeholder
  13929. // has been removed and everything else normalized again
  13930. var i,
  13931. delayedTriggers = [];
  13932. // We first have to update the dom position of the actual currentItem
  13933. // Note: don't do it if the current item is already removed (by a user), or it gets
  13934. // reappended (see #4088)
  13935. if (!this._noFinalSort && this.currentItem.parent().length) {
  13936. this.placeholder.before(this.currentItem);
  13937. }
  13938. this._noFinalSort = null;
  13939. if (this.helper[0] === this.currentItem[0]) {
  13940. for (i in this._storedCSS) {
  13941. if (this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") {
  13942. this._storedCSS[i] = "";
  13943. }
  13944. }
  13945. this.currentItem.css(this._storedCSS);
  13946. this._removeClass(this.currentItem, "ui-sortable-helper");
  13947. } else {
  13948. this.currentItem.show();
  13949. }
  13950. if (this.fromOutside && !noPropagation) {
  13951. delayedTriggers.push(function (event) {
  13952. this._trigger("receive", event, this._uiHash(this.fromOutside));
  13953. });
  13954. }
  13955. if ((this.fromOutside ||
  13956. this.domPosition.prev !==
  13957. this.currentItem.prev().not(".ui-sortable-helper")[0] ||
  13958. this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) {
  13959. // Trigger update callback if the DOM position has changed
  13960. delayedTriggers.push(function (event) {
  13961. this._trigger("update", event, this._uiHash());
  13962. });
  13963. }
  13964. // Check if the items Container has Changed and trigger appropriate
  13965. // events.
  13966. if (this !== this.currentContainer) {
  13967. if (!noPropagation) {
  13968. delayedTriggers.push(function (event) {
  13969. this._trigger("remove", event, this._uiHash());
  13970. });
  13971. delayedTriggers.push((function (c) {
  13972. return function (event) {
  13973. c._trigger("receive", event, this._uiHash(this));
  13974. };
  13975. }).call(this, this.currentContainer));
  13976. delayedTriggers.push((function (c) {
  13977. return function (event) {
  13978. c._trigger("update", event, this._uiHash(this));
  13979. };
  13980. }).call(this, this.currentContainer));
  13981. }
  13982. }
  13983. //Post events to containers
  13984. function delayEvent(type, instance, container) {
  13985. return function (event) {
  13986. container._trigger(type, event, instance._uiHash(instance));
  13987. };
  13988. }
  13989. for (i = this.containers.length - 1; i >= 0; i--) {
  13990. if (!noPropagation) {
  13991. delayedTriggers.push(delayEvent("deactivate", this, this.containers[i]));
  13992. }
  13993. if (this.containers[i].containerCache.over) {
  13994. delayedTriggers.push(delayEvent("out", this, this.containers[i]));
  13995. this.containers[i].containerCache.over = 0;
  13996. }
  13997. }
  13998. //Do what was originally in plugins
  13999. if (this.storedCursor) {
  14000. this.document.find("body").css("cursor", this.storedCursor);
  14001. this.storedStylesheet.remove();
  14002. }
  14003. if (this._storedOpacity) {
  14004. this.helper.css("opacity", this._storedOpacity);
  14005. }
  14006. if (this._storedZIndex) {
  14007. this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex);
  14008. }
  14009. this.dragging = false;
  14010. if (!noPropagation) {
  14011. this._trigger("beforeStop", event, this._uiHash());
  14012. }
  14013. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
  14014. // it unbinds ALL events from the original node!
  14015. this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  14016. if (!this.cancelHelperRemoval) {
  14017. if (this.helper[0] !== this.currentItem[0]) {
  14018. this.helper.remove();
  14019. }
  14020. this.helper = null;
  14021. }
  14022. if (!noPropagation) {
  14023. for (i = 0; i < delayedTriggers.length; i++) {
  14024. // Trigger all delayed events
  14025. delayedTriggers[i].call(this, event);
  14026. }
  14027. this._trigger("stop", event, this._uiHash());
  14028. }
  14029. this.fromOutside = false;
  14030. return !this.cancelHelperRemoval;
  14031. },
  14032. _trigger: function () {
  14033. if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
  14034. this.cancel();
  14035. }
  14036. },
  14037. _uiHash: function (_inst) {
  14038. var inst = _inst || this;
  14039. return {
  14040. helper: inst.helper,
  14041. placeholder: inst.placeholder || $([]),
  14042. position: inst.position,
  14043. originalPosition: inst.originalPosition,
  14044. offset: inst.positionAbs,
  14045. item: inst.currentItem,
  14046. sender: _inst ? _inst.element : null
  14047. };
  14048. }
  14049. });
  14050. /*!
  14051. * jQuery UI Spinner 1.12.1
  14052. * http://jqueryui.com
  14053. *
  14054. * Copyright jQuery Foundation and other contributors
  14055. * Released under the MIT license.
  14056. * http://jquery.org/license
  14057. */
  14058. //>>label: Spinner
  14059. //>>group: Widgets
  14060. //>>description: Displays buttons to easily input numbers via the keyboard or mouse.
  14061. //>>docs: http://api.jqueryui.com/spinner/
  14062. //>>demos: http://jqueryui.com/spinner/
  14063. //>>css.structure: ../../themes/base/core.css
  14064. //>>css.structure: ../../themes/base/spinner.css
  14065. //>>css.theme: ../../themes/base/theme.css
  14066. function spinnerModifer(fn) {
  14067. return function () {
  14068. var previous = this.element.val();
  14069. fn.apply(this, arguments);
  14070. this._refresh();
  14071. if (previous !== this.element.val()) {
  14072. this._trigger("change");
  14073. }
  14074. };
  14075. }
  14076. $.widget("ui.spinner", {
  14077. version: "1.12.1",
  14078. defaultElement: "<input>",
  14079. widgetEventPrefix: "spin",
  14080. options: {
  14081. classes: {
  14082. "ui-spinner": "ui-corner-all",
  14083. "ui-spinner-down": "ui-corner-br",
  14084. "ui-spinner-up": "ui-corner-tr"
  14085. },
  14086. culture: null,
  14087. icons: {
  14088. down: "ui-icon-triangle-1-s",
  14089. up: "ui-icon-triangle-1-n"
  14090. },
  14091. incremental: true,
  14092. max: null,
  14093. min: null,
  14094. numberFormat: null,
  14095. page: 10,
  14096. step: 1,
  14097. change: null,
  14098. spin: null,
  14099. start: null,
  14100. stop: null
  14101. },
  14102. _create: function () {
  14103. // handle string values that need to be parsed
  14104. this._setOption("max", this.options.max);
  14105. this._setOption("min", this.options.min);
  14106. this._setOption("step", this.options.step);
  14107. // Only format if there is a value, prevents the field from being marked
  14108. // as invalid in Firefox, see #9573.
  14109. if (this.value() !== "") {
  14110. // Format the value, but don't constrain.
  14111. this._value(this.element.val(), true);
  14112. }
  14113. this._draw();
  14114. this._on(this._events);
  14115. this._refresh();
  14116. // Turning off autocomplete prevents the browser from remembering the
  14117. // value when navigating through history, so we re-enable autocomplete
  14118. // if the page is unloaded before the widget is destroyed. #7790
  14119. this._on(this.window, {
  14120. beforeunload: function () {
  14121. this.element.removeAttr("autocomplete");
  14122. }
  14123. });
  14124. },
  14125. _getCreateOptions: function () {
  14126. var options = this._super();
  14127. var element = this.element;
  14128. $.each(["min", "max", "step"], function (i, option) {
  14129. var value = element.attr(option);
  14130. if (value != null && value.length) {
  14131. options[option] = value;
  14132. }
  14133. });
  14134. return options;
  14135. },
  14136. _events: {
  14137. keydown: function (event) {
  14138. if (this._start(event) && this._keydown(event)) {
  14139. event.preventDefault();
  14140. }
  14141. },
  14142. keyup: "_stop",
  14143. focus: function () {
  14144. this.previous = this.element.val();
  14145. },
  14146. blur: function (event) {
  14147. if (this.cancelBlur) {
  14148. delete this.cancelBlur;
  14149. return;
  14150. }
  14151. this._stop();
  14152. this._refresh();
  14153. if (this.previous !== this.element.val()) {
  14154. this._trigger("change", event);
  14155. }
  14156. },
  14157. mousewheel: function (event, delta) {
  14158. if (!delta) {
  14159. return;
  14160. }
  14161. if (!this.spinning && !this._start(event)) {
  14162. return false;
  14163. }
  14164. this._spin((delta > 0 ? 1 : -1) * this.options.step, event);
  14165. clearTimeout(this.mousewheelTimer);
  14166. this.mousewheelTimer = this._delay(function () {
  14167. if (this.spinning) {
  14168. this._stop(event);
  14169. }
  14170. }, 100);
  14171. event.preventDefault();
  14172. },
  14173. "mousedown .ui-spinner-button": function (event) {
  14174. var previous;
  14175. // We never want the buttons to have focus; whenever the user is
  14176. // interacting with the spinner, the focus should be on the input.
  14177. // If the input is focused then this.previous is properly set from
  14178. // when the input first received focus. If the input is not focused
  14179. // then we need to set this.previous based on the value before spinning.
  14180. previous = this.element[0] === $.ui.safeActiveElement(this.document[0]) ?
  14181. this.previous : this.element.val();
  14182. function checkFocus() {
  14183. var isActive = this.element[0] === $.ui.safeActiveElement(this.document[0]);
  14184. if (!isActive) {
  14185. this.element.trigger("focus");
  14186. this.previous = previous;
  14187. // support: IE
  14188. // IE sets focus asynchronously, so we need to check if focus
  14189. // moved off of the input because the user clicked on the button.
  14190. this._delay(function () {
  14191. this.previous = previous;
  14192. });
  14193. }
  14194. }
  14195. // Ensure focus is on (or stays on) the text field
  14196. event.preventDefault();
  14197. checkFocus.call(this);
  14198. // Support: IE
  14199. // IE doesn't prevent moving focus even with event.preventDefault()
  14200. // so we set a flag to know when we should ignore the blur event
  14201. // and check (again) if focus moved off of the input.
  14202. this.cancelBlur = true;
  14203. this._delay(function () {
  14204. delete this.cancelBlur;
  14205. checkFocus.call(this);
  14206. });
  14207. if (this._start(event) === false) {
  14208. return;
  14209. }
  14210. this._repeat(null, $(event.currentTarget)
  14211. .hasClass("ui-spinner-up") ? 1 : -1, event);
  14212. },
  14213. "mouseup .ui-spinner-button": "_stop",
  14214. "mouseenter .ui-spinner-button": function (event) {
  14215. // button will add ui-state-active if mouse was down while mouseleave and kept down
  14216. if (!$(event.currentTarget).hasClass("ui-state-active")) {
  14217. return;
  14218. }
  14219. if (this._start(event) === false) {
  14220. return false;
  14221. }
  14222. this._repeat(null, $(event.currentTarget)
  14223. .hasClass("ui-spinner-up") ? 1 : -1, event);
  14224. },
  14225. // TODO: do we really want to consider this a stop?
  14226. // shouldn't we just stop the repeater and wait until mouseup before
  14227. // we trigger the stop event?
  14228. "mouseleave .ui-spinner-button": "_stop"
  14229. },
  14230. // Support mobile enhanced option and make backcompat more sane
  14231. _enhance: function () {
  14232. this.uiSpinner = this.element
  14233. .attr("autocomplete", "off")
  14234. .wrap("<span>")
  14235. .parent()
  14236. // Add buttons
  14237. .append(
  14238. "<a></a><a></a>"
  14239. );
  14240. },
  14241. _draw: function () {
  14242. this._enhance();
  14243. this._addClass(this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content");
  14244. this._addClass("ui-spinner-input");
  14245. this.element.attr("role", "spinbutton");
  14246. // Button bindings
  14247. this.buttons = this.uiSpinner.children("a")
  14248. .attr("tabIndex", -1)
  14249. .attr("aria-hidden", true)
  14250. .button({
  14251. classes: {
  14252. "ui-button": ""
  14253. }
  14254. });
  14255. // TODO: Right now button does not support classes this is already updated in button PR
  14256. this._removeClass(this.buttons, "ui-corner-all");
  14257. this._addClass(this.buttons.first(), "ui-spinner-button ui-spinner-up");
  14258. this._addClass(this.buttons.last(), "ui-spinner-button ui-spinner-down");
  14259. this.buttons.first().button({
  14260. "icon": this.options.icons.up,
  14261. "showLabel": false
  14262. });
  14263. this.buttons.last().button({
  14264. "icon": this.options.icons.down,
  14265. "showLabel": false
  14266. });
  14267. // IE 6 doesn't understand height: 50% for the buttons
  14268. // unless the wrapper has an explicit height
  14269. if (this.buttons.height() > Math.ceil(this.uiSpinner.height() * 0.5) &&
  14270. this.uiSpinner.height() > 0) {
  14271. this.uiSpinner.height(this.uiSpinner.height());
  14272. }
  14273. },
  14274. _keydown: function (event) {
  14275. var options = this.options,
  14276. keyCode = $.ui.keyCode;
  14277. switch (event.keyCode) {
  14278. case keyCode.UP:
  14279. this._repeat(null, 1, event);
  14280. return true;
  14281. case keyCode.DOWN:
  14282. this._repeat(null, -1, event);
  14283. return true;
  14284. case keyCode.PAGE_UP:
  14285. this._repeat(null, options.page, event);
  14286. return true;
  14287. case keyCode.PAGE_DOWN:
  14288. this._repeat(null, -options.page, event);
  14289. return true;
  14290. }
  14291. return false;
  14292. },
  14293. _start: function (event) {
  14294. if (!this.spinning && this._trigger("start", event) === false) {
  14295. return false;
  14296. }
  14297. if (!this.counter) {
  14298. this.counter = 1;
  14299. }
  14300. this.spinning = true;
  14301. return true;
  14302. },
  14303. _repeat: function (i, steps, event) {
  14304. i = i || 500;
  14305. clearTimeout(this.timer);
  14306. this.timer = this._delay(function () {
  14307. this._repeat(40, steps, event);
  14308. }, i);
  14309. this._spin(steps * this.options.step, event);
  14310. },
  14311. _spin: function (step, event) {
  14312. var value = this.value() || 0;
  14313. if (!this.counter) {
  14314. this.counter = 1;
  14315. }
  14316. value = this._adjustValue(value + step * this._increment(this.counter));
  14317. if (!this.spinning || this._trigger("spin", event, {value: value}) !== false) {
  14318. this._value(value);
  14319. this.counter++;
  14320. }
  14321. },
  14322. _increment: function (i) {
  14323. var incremental = this.options.incremental;
  14324. if (incremental) {
  14325. return $.isFunction(incremental) ?
  14326. incremental(i) :
  14327. Math.floor(i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1);
  14328. }
  14329. return 1;
  14330. },
  14331. _precision: function () {
  14332. var precision = this._precisionOf(this.options.step);
  14333. if (this.options.min !== null) {
  14334. precision = Math.max(precision, this._precisionOf(this.options.min));
  14335. }
  14336. return precision;
  14337. },
  14338. _precisionOf: function (num) {
  14339. var str = num.toString(),
  14340. decimal = str.indexOf(".");
  14341. return decimal === -1 ? 0 : str.length - decimal - 1;
  14342. },
  14343. _adjustValue: function (value) {
  14344. var base, aboveMin,
  14345. options = this.options;
  14346. // Make sure we're at a valid step
  14347. // - find out where we are relative to the base (min or 0)
  14348. base = options.min !== null ? options.min : 0;
  14349. aboveMin = value - base;
  14350. // - round to the nearest step
  14351. aboveMin = Math.round(aboveMin / options.step) * options.step;
  14352. // - rounding is based on 0, so adjust back to our base
  14353. value = base + aboveMin;
  14354. // Fix precision from bad JS floating point math
  14355. value = parseFloat(value.toFixed(this._precision()));
  14356. // Clamp the value
  14357. if (options.max !== null && value > options.max) {
  14358. return options.max;
  14359. }
  14360. if (options.min !== null && value < options.min) {
  14361. return options.min;
  14362. }
  14363. return value;
  14364. },
  14365. _stop: function (event) {
  14366. if (!this.spinning) {
  14367. return;
  14368. }
  14369. clearTimeout(this.timer);
  14370. clearTimeout(this.mousewheelTimer);
  14371. this.counter = 0;
  14372. this.spinning = false;
  14373. this._trigger("stop", event);
  14374. },
  14375. _setOption: function (key, value) {
  14376. var prevValue, first, last;
  14377. if (key === "culture" || key === "numberFormat") {
  14378. prevValue = this._parse(this.element.val());
  14379. this.options[key] = value;
  14380. this.element.val(this._format(prevValue));
  14381. return;
  14382. }
  14383. if (key === "max" || key === "min" || key === "step") {
  14384. if (typeof value === "string") {
  14385. value = this._parse(value);
  14386. }
  14387. }
  14388. if (key === "icons") {
  14389. first = this.buttons.first().find(".ui-icon");
  14390. this._removeClass(first, null, this.options.icons.up);
  14391. this._addClass(first, null, value.up);
  14392. last = this.buttons.last().find(".ui-icon");
  14393. this._removeClass(last, null, this.options.icons.down);
  14394. this._addClass(last, null, value.down);
  14395. }
  14396. this._super(key, value);
  14397. },
  14398. _setOptionDisabled: function (value) {
  14399. this._super(value);
  14400. this._toggleClass(this.uiSpinner, null, "ui-state-disabled", !!value);
  14401. this.element.prop("disabled", !!value);
  14402. this.buttons.button(value ? "disable" : "enable");
  14403. },
  14404. _setOptions: spinnerModifer(function (options) {
  14405. this._super(options);
  14406. }),
  14407. _parse: function (val) {
  14408. if (typeof val === "string" && val !== "") {
  14409. val = window.Globalize && this.options.numberFormat ?
  14410. Globalize.parseFloat(val, 10, this.options.culture) : +val;
  14411. }
  14412. return val === "" || isNaN(val) ? null : val;
  14413. },
  14414. _format: function (value) {
  14415. if (value === "") {
  14416. return "";
  14417. }
  14418. return window.Globalize && this.options.numberFormat ?
  14419. Globalize.format(value, this.options.numberFormat, this.options.culture) :
  14420. value;
  14421. },
  14422. _refresh: function () {
  14423. this.element.attr({
  14424. "aria-valuemin": this.options.min,
  14425. "aria-valuemax": this.options.max,
  14426. // TODO: what should we do with values that can't be parsed?
  14427. "aria-valuenow": this._parse(this.element.val())
  14428. });
  14429. },
  14430. isValid: function () {
  14431. var value = this.value();
  14432. // Null is invalid
  14433. if (value === null) {
  14434. return false;
  14435. }
  14436. // If value gets adjusted, it's invalid
  14437. return value === this._adjustValue(value);
  14438. },
  14439. // Update the value without triggering change
  14440. _value: function (value, allowAny) {
  14441. var parsed;
  14442. if (value !== "") {
  14443. parsed = this._parse(value);
  14444. if (parsed !== null) {
  14445. if (!allowAny) {
  14446. parsed = this._adjustValue(parsed);
  14447. }
  14448. value = this._format(parsed);
  14449. }
  14450. }
  14451. this.element.val(value);
  14452. this._refresh();
  14453. },
  14454. _destroy: function () {
  14455. this.element
  14456. .prop("disabled", false)
  14457. .removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow");
  14458. this.uiSpinner.replaceWith(this.element);
  14459. },
  14460. stepUp: spinnerModifer(function (steps) {
  14461. this._stepUp(steps);
  14462. }),
  14463. _stepUp: function (steps) {
  14464. if (this._start()) {
  14465. this._spin((steps || 1) * this.options.step);
  14466. this._stop();
  14467. }
  14468. },
  14469. stepDown: spinnerModifer(function (steps) {
  14470. this._stepDown(steps);
  14471. }),
  14472. _stepDown: function (steps) {
  14473. if (this._start()) {
  14474. this._spin((steps || 1) * -this.options.step);
  14475. this._stop();
  14476. }
  14477. },
  14478. pageUp: spinnerModifer(function (pages) {
  14479. this._stepUp((pages || 1) * this.options.page);
  14480. }),
  14481. pageDown: spinnerModifer(function (pages) {
  14482. this._stepDown((pages || 1) * this.options.page);
  14483. }),
  14484. value: function (newVal) {
  14485. if (!arguments.length) {
  14486. return this._parse(this.element.val());
  14487. }
  14488. spinnerModifer(this._value).call(this, newVal);
  14489. },
  14490. widget: function () {
  14491. return this.uiSpinner;
  14492. }
  14493. });
  14494. // DEPRECATED
  14495. // TODO: switch return back to widget declaration at top of file when this is removed
  14496. if ($.uiBackCompat !== false) {
  14497. // Backcompat for spinner html extension points
  14498. $.widget("ui.spinner", $.ui.spinner, {
  14499. _enhance: function () {
  14500. this.uiSpinner = this.element
  14501. .attr("autocomplete", "off")
  14502. .wrap(this._uiSpinnerHtml())
  14503. .parent()
  14504. // Add buttons
  14505. .append(this._buttonHtml());
  14506. },
  14507. _uiSpinnerHtml: function () {
  14508. return "<span>";
  14509. },
  14510. _buttonHtml: function () {
  14511. return "<a></a><a></a>";
  14512. }
  14513. });
  14514. }
  14515. var widgetsSpinner = $.ui.spinner;
  14516. /*!
  14517. * jQuery UI Tabs 1.12.1
  14518. * http://jqueryui.com
  14519. *
  14520. * Copyright jQuery Foundation and other contributors
  14521. * Released under the MIT license.
  14522. * http://jquery.org/license
  14523. */
  14524. //>>label: Tabs
  14525. //>>group: Widgets
  14526. //>>description: Transforms a set of container elements into a tab structure.
  14527. //>>docs: http://api.jqueryui.com/tabs/
  14528. //>>demos: http://jqueryui.com/tabs/
  14529. //>>css.structure: ../../themes/base/core.css
  14530. //>>css.structure: ../../themes/base/tabs.css
  14531. //>>css.theme: ../../themes/base/theme.css
  14532. $.widget("ui.tabs", {
  14533. version: "1.12.1",
  14534. delay: 300,
  14535. options: {
  14536. active: null,
  14537. classes: {
  14538. "ui-tabs": "ui-corner-all",
  14539. "ui-tabs-nav": "ui-corner-all",
  14540. "ui-tabs-panel": "ui-corner-bottom",
  14541. "ui-tabs-tab": "ui-corner-top"
  14542. },
  14543. collapsible: false,
  14544. event: "click",
  14545. heightStyle: "content",
  14546. hide: null,
  14547. show: null,
  14548. // Callbacks
  14549. activate: null,
  14550. beforeActivate: null,
  14551. beforeLoad: null,
  14552. load: null
  14553. },
  14554. _isLocal: (function () {
  14555. var rhash = /#.*$/;
  14556. return function (anchor) {
  14557. var anchorUrl, locationUrl;
  14558. anchorUrl = anchor.href.replace(rhash, "");
  14559. locationUrl = location.href.replace(rhash, "");
  14560. // Decoding may throw an error if the URL isn't UTF-8 (#9518)
  14561. try {
  14562. anchorUrl = decodeURIComponent(anchorUrl);
  14563. } catch (error) {
  14564. }
  14565. try {
  14566. locationUrl = decodeURIComponent(locationUrl);
  14567. } catch (error) {
  14568. }
  14569. return anchor.hash.length > 1 && anchorUrl === locationUrl;
  14570. };
  14571. })(),
  14572. _create: function () {
  14573. var that = this,
  14574. options = this.options;
  14575. this.running = false;
  14576. this._addClass("ui-tabs", "ui-widget ui-widget-content");
  14577. this._toggleClass("ui-tabs-collapsible", null, options.collapsible);
  14578. this._processTabs();
  14579. options.active = this._initialActive();
  14580. // Take disabling tabs via class attribute from HTML
  14581. // into account and update option properly.
  14582. if ($.isArray(options.disabled)) {
  14583. options.disabled = $.unique(options.disabled.concat(
  14584. $.map(this.tabs.filter(".ui-state-disabled"), function (li) {
  14585. return that.tabs.index(li);
  14586. })
  14587. )).sort();
  14588. }
  14589. // Check for length avoids error when initializing empty list
  14590. if (this.options.active !== false && this.anchors.length) {
  14591. this.active = this._findActive(options.active);
  14592. } else {
  14593. this.active = $();
  14594. }
  14595. this._refresh();
  14596. if (this.active.length) {
  14597. this.load(options.active);
  14598. }
  14599. },
  14600. _initialActive: function () {
  14601. var active = this.options.active,
  14602. collapsible = this.options.collapsible,
  14603. locationHash = location.hash.substring(1);
  14604. if (active === null) {
  14605. // check the fragment identifier in the URL
  14606. if (locationHash) {
  14607. this.tabs.each(function (i, tab) {
  14608. if ($(tab).attr("aria-controls") === locationHash) {
  14609. active = i;
  14610. return false;
  14611. }
  14612. });
  14613. }
  14614. // Check for a tab marked active via a class
  14615. if (active === null) {
  14616. active = this.tabs.index(this.tabs.filter(".ui-tabs-active"));
  14617. }
  14618. // No active tab, set to false
  14619. if (active === null || active === -1) {
  14620. active = this.tabs.length ? 0 : false;
  14621. }
  14622. }
  14623. // Handle numbers: negative, out of range
  14624. if (active !== false) {
  14625. active = this.tabs.index(this.tabs.eq(active));
  14626. if (active === -1) {
  14627. active = collapsible ? false : 0;
  14628. }
  14629. }
  14630. // Don't allow collapsible: false and active: false
  14631. if (!collapsible && active === false && this.anchors.length) {
  14632. active = 0;
  14633. }
  14634. return active;
  14635. },
  14636. _getCreateEventData: function () {
  14637. return {
  14638. tab: this.active,
  14639. panel: !this.active.length ? $() : this._getPanelForTab(this.active)
  14640. };
  14641. },
  14642. _tabKeydown: function (event) {
  14643. var focusedTab = $($.ui.safeActiveElement(this.document[0])).closest("li"),
  14644. selectedIndex = this.tabs.index(focusedTab),
  14645. goingForward = true;
  14646. if (this._handlePageNav(event)) {
  14647. return;
  14648. }
  14649. switch (event.keyCode) {
  14650. case $.ui.keyCode.RIGHT:
  14651. case $.ui.keyCode.DOWN:
  14652. selectedIndex++;
  14653. break;
  14654. case $.ui.keyCode.UP:
  14655. case $.ui.keyCode.LEFT:
  14656. goingForward = false;
  14657. selectedIndex--;
  14658. break;
  14659. case $.ui.keyCode.END:
  14660. selectedIndex = this.anchors.length - 1;
  14661. break;
  14662. case $.ui.keyCode.HOME:
  14663. selectedIndex = 0;
  14664. break;
  14665. case $.ui.keyCode.SPACE:
  14666. // Activate only, no collapsing
  14667. event.preventDefault();
  14668. clearTimeout(this.activating);
  14669. this._activate(selectedIndex);
  14670. return;
  14671. case $.ui.keyCode.ENTER:
  14672. // Toggle (cancel delayed activation, allow collapsing)
  14673. event.preventDefault();
  14674. clearTimeout(this.activating);
  14675. // Determine if we should collapse or activate
  14676. this._activate(selectedIndex === this.options.active ? false : selectedIndex);
  14677. return;
  14678. default:
  14679. return;
  14680. }
  14681. // Focus the appropriate tab, based on which key was pressed
  14682. event.preventDefault();
  14683. clearTimeout(this.activating);
  14684. selectedIndex = this._focusNextTab(selectedIndex, goingForward);
  14685. // Navigating with control/command key will prevent automatic activation
  14686. if (!event.ctrlKey && !event.metaKey) {
  14687. // Update aria-selected immediately so that AT think the tab is already selected.
  14688. // Otherwise AT may confuse the user by stating that they need to activate the tab,
  14689. // but the tab will already be activated by the time the announcement finishes.
  14690. focusedTab.attr("aria-selected", "false");
  14691. this.tabs.eq(selectedIndex).attr("aria-selected", "true");
  14692. this.activating = this._delay(function () {
  14693. this.option("active", selectedIndex);
  14694. }, this.delay);
  14695. }
  14696. },
  14697. _panelKeydown: function (event) {
  14698. if (this._handlePageNav(event)) {
  14699. return;
  14700. }
  14701. // Ctrl+up moves focus to the current tab
  14702. if (event.ctrlKey && event.keyCode === $.ui.keyCode.UP) {
  14703. event.preventDefault();
  14704. this.active.trigger("focus");
  14705. }
  14706. },
  14707. // Alt+page up/down moves focus to the previous/next tab (and activates)
  14708. _handlePageNav: function (event) {
  14709. if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP) {
  14710. this._activate(this._focusNextTab(this.options.active - 1, false));
  14711. return true;
  14712. }
  14713. if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN) {
  14714. this._activate(this._focusNextTab(this.options.active + 1, true));
  14715. return true;
  14716. }
  14717. },
  14718. _findNextTab: function (index, goingForward) {
  14719. var lastTabIndex = this.tabs.length - 1;
  14720. function constrain() {
  14721. if (index > lastTabIndex) {
  14722. index = 0;
  14723. }
  14724. if (index < 0) {
  14725. index = lastTabIndex;
  14726. }
  14727. return index;
  14728. }
  14729. while ($.inArray(constrain(), this.options.disabled) !== -1) {
  14730. index = goingForward ? index + 1 : index - 1;
  14731. }
  14732. return index;
  14733. },
  14734. _focusNextTab: function (index, goingForward) {
  14735. index = this._findNextTab(index, goingForward);
  14736. this.tabs.eq(index).trigger("focus");
  14737. return index;
  14738. },
  14739. _setOption: function (key, value) {
  14740. if (key === "active") {
  14741. // _activate() will handle invalid values and update this.options
  14742. this._activate(value);
  14743. return;
  14744. }
  14745. this._super(key, value);
  14746. if (key === "collapsible") {
  14747. this._toggleClass("ui-tabs-collapsible", null, value);
  14748. // Setting collapsible: false while collapsed; open first panel
  14749. if (!value && this.options.active === false) {
  14750. this._activate(0);
  14751. }
  14752. }
  14753. if (key === "event") {
  14754. this._setupEvents(value);
  14755. }
  14756. if (key === "heightStyle") {
  14757. this._setupHeightStyle(value);
  14758. }
  14759. },
  14760. _sanitizeSelector: function (hash) {
  14761. return hash ? hash.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&") : "";
  14762. },
  14763. refresh: function () {
  14764. var options = this.options,
  14765. lis = this.tablist.children(":has(a[href])");
  14766. // Get disabled tabs from class attribute from HTML
  14767. // this will get converted to a boolean if needed in _refresh()
  14768. options.disabled = $.map(lis.filter(".ui-state-disabled"), function (tab) {
  14769. return lis.index(tab);
  14770. });
  14771. this._processTabs();
  14772. // Was collapsed or no tabs
  14773. if (options.active === false || !this.anchors.length) {
  14774. options.active = false;
  14775. this.active = $();
  14776. // was active, but active tab is gone
  14777. } else if (this.active.length && !$.contains(this.tablist[0], this.active[0])) {
  14778. // all remaining tabs are disabled
  14779. if (this.tabs.length === options.disabled.length) {
  14780. options.active = false;
  14781. this.active = $();
  14782. // activate previous tab
  14783. } else {
  14784. this._activate(this._findNextTab(Math.max(0, options.active - 1), false));
  14785. }
  14786. // was active, active tab still exists
  14787. } else {
  14788. // make sure active index is correct
  14789. options.active = this.tabs.index(this.active);
  14790. }
  14791. this._refresh();
  14792. },
  14793. _refresh: function () {
  14794. this._setOptionDisabled(this.options.disabled);
  14795. this._setupEvents(this.options.event);
  14796. this._setupHeightStyle(this.options.heightStyle);
  14797. this.tabs.not(this.active).attr({
  14798. "aria-selected": "false",
  14799. "aria-expanded": "false",
  14800. tabIndex: -1
  14801. });
  14802. this.panels.not(this._getPanelForTab(this.active))
  14803. .hide()
  14804. .attr({
  14805. "aria-hidden": "true"
  14806. });
  14807. // Make sure one tab is in the tab order
  14808. if (!this.active.length) {
  14809. this.tabs.eq(0).attr("tabIndex", 0);
  14810. } else {
  14811. this.active
  14812. .attr({
  14813. "aria-selected": "true",
  14814. "aria-expanded": "true",
  14815. tabIndex: 0
  14816. });
  14817. this._addClass(this.active, "ui-tabs-active", "ui-state-active");
  14818. this._getPanelForTab(this.active)
  14819. .show()
  14820. .attr({
  14821. "aria-hidden": "false"
  14822. });
  14823. }
  14824. },
  14825. _processTabs: function () {
  14826. var that = this,
  14827. prevTabs = this.tabs,
  14828. prevAnchors = this.anchors,
  14829. prevPanels = this.panels;
  14830. this.tablist = this._getList().attr("role", "tablist");
  14831. this._addClass(this.tablist, "ui-tabs-nav",
  14832. "ui-helper-reset ui-helper-clearfix ui-widget-header");
  14833. // Prevent users from focusing disabled tabs via click
  14834. this.tablist
  14835. .on("mousedown" + this.eventNamespace, "> li", function (event) {
  14836. if ($(this).is(".ui-state-disabled")) {
  14837. event.preventDefault();
  14838. }
  14839. })
  14840. // Support: IE <9
  14841. // Preventing the default action in mousedown doesn't prevent IE
  14842. // from focusing the element, so if the anchor gets focused, blur.
  14843. // We don't have to worry about focusing the previously focused
  14844. // element since clicking on a non-focusable element should focus
  14845. // the body anyway.
  14846. .on("focus" + this.eventNamespace, ".ui-tabs-anchor", function () {
  14847. if ($(this).closest("li").is(".ui-state-disabled")) {
  14848. this.blur();
  14849. }
  14850. });
  14851. this.tabs = this.tablist.find("> li:has(a[href])")
  14852. .attr({
  14853. role: "tab",
  14854. tabIndex: -1
  14855. });
  14856. this._addClass(this.tabs, "ui-tabs-tab", "ui-state-default");
  14857. this.anchors = this.tabs.map(function () {
  14858. return $("a", this)[0];
  14859. })
  14860. .attr({
  14861. role: "presentation",
  14862. tabIndex: -1
  14863. });
  14864. this._addClass(this.anchors, "ui-tabs-anchor");
  14865. this.panels = $();
  14866. this.anchors.each(function (i, anchor) {
  14867. var selector, panel, panelId,
  14868. anchorId = $(anchor).uniqueId().attr("id"),
  14869. tab = $(anchor).closest("li"),
  14870. originalAriaControls = tab.attr("aria-controls");
  14871. // Inline tab
  14872. if (that._isLocal(anchor)) {
  14873. selector = anchor.hash;
  14874. panelId = selector.substring(1);
  14875. panel = that.element.find(that._sanitizeSelector(selector));
  14876. // remote tab
  14877. } else {
  14878. // If the tab doesn't already have aria-controls,
  14879. // generate an id by using a throw-away element
  14880. panelId = tab.attr("aria-controls") || $({}).uniqueId()[0].id;
  14881. selector = "#" + panelId;
  14882. panel = that.element.find(selector);
  14883. if (!panel.length) {
  14884. panel = that._createPanel(panelId);
  14885. panel.insertAfter(that.panels[i - 1] || that.tablist);
  14886. }
  14887. panel.attr("aria-live", "polite");
  14888. }
  14889. if (panel.length) {
  14890. that.panels = that.panels.add(panel);
  14891. }
  14892. if (originalAriaControls) {
  14893. tab.data("ui-tabs-aria-controls", originalAriaControls);
  14894. }
  14895. tab.attr({
  14896. "aria-controls": panelId,
  14897. "aria-labelledby": anchorId
  14898. });
  14899. panel.attr("aria-labelledby", anchorId);
  14900. });
  14901. this.panels.attr("role", "tabpanel");
  14902. this._addClass(this.panels, "ui-tabs-panel", "ui-widget-content");
  14903. // Avoid memory leaks (#10056)
  14904. if (prevTabs) {
  14905. this._off(prevTabs.not(this.tabs));
  14906. this._off(prevAnchors.not(this.anchors));
  14907. this._off(prevPanels.not(this.panels));
  14908. }
  14909. },
  14910. // Allow overriding how to find the list for rare usage scenarios (#7715)
  14911. _getList: function () {
  14912. return this.tablist || this.element.find("ol, ul").eq(0);
  14913. },
  14914. _createPanel: function (id) {
  14915. return $("<div>")
  14916. .attr("id", id)
  14917. .data("ui-tabs-destroy", true);
  14918. },
  14919. _setOptionDisabled: function (disabled) {
  14920. var currentItem, li, i;
  14921. if ($.isArray(disabled)) {
  14922. if (!disabled.length) {
  14923. disabled = false;
  14924. } else if (disabled.length === this.anchors.length) {
  14925. disabled = true;
  14926. }
  14927. }
  14928. // Disable tabs
  14929. for (i = 0; (li = this.tabs[i]); i++) {
  14930. currentItem = $(li);
  14931. if (disabled === true || $.inArray(i, disabled) !== -1) {
  14932. currentItem.attr("aria-disabled", "true");
  14933. this._addClass(currentItem, null, "ui-state-disabled");
  14934. } else {
  14935. currentItem.removeAttr("aria-disabled");
  14936. this._removeClass(currentItem, null, "ui-state-disabled");
  14937. }
  14938. }
  14939. this.options.disabled = disabled;
  14940. this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null,
  14941. disabled === true);
  14942. },
  14943. _setupEvents: function (event) {
  14944. var events = {};
  14945. if (event) {
  14946. $.each(event.split(" "), function (index, eventName) {
  14947. events[eventName] = "_eventHandler";
  14948. });
  14949. }
  14950. this._off(this.anchors.add(this.tabs).add(this.panels));
  14951. // Always prevent the default action, even when disabled
  14952. this._on(true, this.anchors, {
  14953. click: function (event) {
  14954. event.preventDefault();
  14955. }
  14956. });
  14957. this._on(this.anchors, events);
  14958. this._on(this.tabs, {keydown: "_tabKeydown"});
  14959. this._on(this.panels, {keydown: "_panelKeydown"});
  14960. this._focusable(this.tabs);
  14961. this._hoverable(this.tabs);
  14962. },
  14963. _setupHeightStyle: function (heightStyle) {
  14964. var maxHeight,
  14965. parent = this.element.parent();
  14966. if (heightStyle === "fill") {
  14967. maxHeight = parent.height();
  14968. maxHeight -= this.element.outerHeight() - this.element.height();
  14969. this.element.siblings(":visible").each(function () {
  14970. var elem = $(this),
  14971. position = elem.css("position");
  14972. if (position === "absolute" || position === "fixed") {
  14973. return;
  14974. }
  14975. maxHeight -= elem.outerHeight(true);
  14976. });
  14977. this.element.children().not(this.panels).each(function () {
  14978. maxHeight -= $(this).outerHeight(true);
  14979. });
  14980. this.panels.each(function () {
  14981. $(this).height(Math.max(0, maxHeight -
  14982. $(this).innerHeight() + $(this).height()));
  14983. })
  14984. .css("overflow", "auto");
  14985. } else if (heightStyle === "auto") {
  14986. maxHeight = 0;
  14987. this.panels.each(function () {
  14988. maxHeight = Math.max(maxHeight, $(this).height("").height());
  14989. }).height(maxHeight);
  14990. }
  14991. },
  14992. _eventHandler: function (event) {
  14993. var options = this.options,
  14994. active = this.active,
  14995. anchor = $(event.currentTarget),
  14996. tab = anchor.closest("li"),
  14997. clickedIsActive = tab[0] === active[0],
  14998. collapsing = clickedIsActive && options.collapsible,
  14999. toShow = collapsing ? $() : this._getPanelForTab(tab),
  15000. toHide = !active.length ? $() : this._getPanelForTab(active),
  15001. eventData = {
  15002. oldTab: active,
  15003. oldPanel: toHide,
  15004. newTab: collapsing ? $() : tab,
  15005. newPanel: toShow
  15006. };
  15007. event.preventDefault();
  15008. if (tab.hasClass("ui-state-disabled") ||
  15009. // tab is already loading
  15010. tab.hasClass("ui-tabs-loading") ||
  15011. // can't switch durning an animation
  15012. this.running ||
  15013. // click on active header, but not collapsible
  15014. (clickedIsActive && !options.collapsible) ||
  15015. // allow canceling activation
  15016. (this._trigger("beforeActivate", event, eventData) === false)) {
  15017. return;
  15018. }
  15019. options.active = collapsing ? false : this.tabs.index(tab);
  15020. this.active = clickedIsActive ? $() : tab;
  15021. if (this.xhr) {
  15022. this.xhr.abort();
  15023. }
  15024. if (!toHide.length && !toShow.length) {
  15025. $.error("jQuery UI Tabs: Mismatching fragment identifier.");
  15026. }
  15027. if (toShow.length) {
  15028. this.load(this.tabs.index(tab), event);
  15029. }
  15030. this._toggle(event, eventData);
  15031. },
  15032. // Handles show/hide for selecting tabs
  15033. _toggle: function (event, eventData) {
  15034. var that = this,
  15035. toShow = eventData.newPanel,
  15036. toHide = eventData.oldPanel;
  15037. this.running = true;
  15038. function complete() {
  15039. that.running = false;
  15040. that._trigger("activate", event, eventData);
  15041. }
  15042. function show() {
  15043. that._addClass(eventData.newTab.closest("li"), "ui-tabs-active", "ui-state-active");
  15044. if (toShow.length && that.options.show) {
  15045. that._show(toShow, that.options.show, complete);
  15046. } else {
  15047. toShow.show();
  15048. complete();
  15049. }
  15050. }
  15051. // Start out by hiding, then showing, then completing
  15052. if (toHide.length && this.options.hide) {
  15053. this._hide(toHide, this.options.hide, function () {
  15054. that._removeClass(eventData.oldTab.closest("li"),
  15055. "ui-tabs-active", "ui-state-active");
  15056. show();
  15057. });
  15058. } else {
  15059. this._removeClass(eventData.oldTab.closest("li"),
  15060. "ui-tabs-active", "ui-state-active");
  15061. toHide.hide();
  15062. show();
  15063. }
  15064. toHide.attr("aria-hidden", "true");
  15065. eventData.oldTab.attr({
  15066. "aria-selected": "false",
  15067. "aria-expanded": "false"
  15068. });
  15069. // If we're switching tabs, remove the old tab from the tab order.
  15070. // If we're opening from collapsed state, remove the previous tab from the tab order.
  15071. // If we're collapsing, then keep the collapsing tab in the tab order.
  15072. if (toShow.length && toHide.length) {
  15073. eventData.oldTab.attr("tabIndex", -1);
  15074. } else if (toShow.length) {
  15075. this.tabs.filter(function () {
  15076. return $(this).attr("tabIndex") === 0;
  15077. })
  15078. .attr("tabIndex", -1);
  15079. }
  15080. toShow.attr("aria-hidden", "false");
  15081. eventData.newTab.attr({
  15082. "aria-selected": "true",
  15083. "aria-expanded": "true",
  15084. tabIndex: 0
  15085. });
  15086. },
  15087. _activate: function (index) {
  15088. var anchor,
  15089. active = this._findActive(index);
  15090. // Trying to activate the already active panel
  15091. if (active[0] === this.active[0]) {
  15092. return;
  15093. }
  15094. // Trying to collapse, simulate a click on the current active header
  15095. if (!active.length) {
  15096. active = this.active;
  15097. }
  15098. anchor = active.find(".ui-tabs-anchor")[0];
  15099. this._eventHandler({
  15100. target: anchor,
  15101. currentTarget: anchor,
  15102. preventDefault: $.noop
  15103. });
  15104. },
  15105. _findActive: function (index) {
  15106. return index === false ? $() : this.tabs.eq(index);
  15107. },
  15108. _getIndex: function (index) {
  15109. // meta-function to give users option to provide a href string instead of a numerical index.
  15110. if (typeof index === "string") {
  15111. index = this.anchors.index(this.anchors.filter("[href$='" +
  15112. $.ui.escapeSelector(index) + "']"));
  15113. }
  15114. return index;
  15115. },
  15116. _destroy: function () {
  15117. if (this.xhr) {
  15118. this.xhr.abort();
  15119. }
  15120. this.tablist
  15121. .removeAttr("role")
  15122. .off(this.eventNamespace);
  15123. this.anchors
  15124. .removeAttr("role tabIndex")
  15125. .removeUniqueId();
  15126. this.tabs.add(this.panels).each(function () {
  15127. if ($.data(this, "ui-tabs-destroy")) {
  15128. $(this).remove();
  15129. } else {
  15130. $(this).removeAttr("role tabIndex " +
  15131. "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded");
  15132. }
  15133. });
  15134. this.tabs.each(function () {
  15135. var li = $(this),
  15136. prev = li.data("ui-tabs-aria-controls");
  15137. if (prev) {
  15138. li
  15139. .attr("aria-controls", prev)
  15140. .removeData("ui-tabs-aria-controls");
  15141. } else {
  15142. li.removeAttr("aria-controls");
  15143. }
  15144. });
  15145. this.panels.show();
  15146. if (this.options.heightStyle !== "content") {
  15147. this.panels.css("height", "");
  15148. }
  15149. },
  15150. enable: function (index) {
  15151. var disabled = this.options.disabled;
  15152. if (disabled === false) {
  15153. return;
  15154. }
  15155. if (index === undefined) {
  15156. disabled = false;
  15157. } else {
  15158. index = this._getIndex(index);
  15159. if ($.isArray(disabled)) {
  15160. disabled = $.map(disabled, function (num) {
  15161. return num !== index ? num : null;
  15162. });
  15163. } else {
  15164. disabled = $.map(this.tabs, function (li, num) {
  15165. return num !== index ? num : null;
  15166. });
  15167. }
  15168. }
  15169. this._setOptionDisabled(disabled);
  15170. },
  15171. disable: function (index) {
  15172. var disabled = this.options.disabled;
  15173. if (disabled === true) {
  15174. return;
  15175. }
  15176. if (index === undefined) {
  15177. disabled = true;
  15178. } else {
  15179. index = this._getIndex(index);
  15180. if ($.inArray(index, disabled) !== -1) {
  15181. return;
  15182. }
  15183. if ($.isArray(disabled)) {
  15184. disabled = $.merge([index], disabled).sort();
  15185. } else {
  15186. disabled = [index];
  15187. }
  15188. }
  15189. this._setOptionDisabled(disabled);
  15190. },
  15191. load: function (index, event) {
  15192. index = this._getIndex(index);
  15193. var that = this,
  15194. tab = this.tabs.eq(index),
  15195. anchor = tab.find(".ui-tabs-anchor"),
  15196. panel = this._getPanelForTab(tab),
  15197. eventData = {
  15198. tab: tab,
  15199. panel: panel
  15200. },
  15201. complete = function (jqXHR, status) {
  15202. if (status === "abort") {
  15203. that.panels.stop(false, true);
  15204. }
  15205. that._removeClass(tab, "ui-tabs-loading");
  15206. panel.removeAttr("aria-busy");
  15207. if (jqXHR === that.xhr) {
  15208. delete that.xhr;
  15209. }
  15210. };
  15211. // Not remote
  15212. if (this._isLocal(anchor[0])) {
  15213. return;
  15214. }
  15215. this.xhr = $.ajax(this._ajaxSettings(anchor, event, eventData));
  15216. // Support: jQuery <1.8
  15217. // jQuery <1.8 returns false if the request is canceled in beforeSend,
  15218. // but as of 1.8, $.ajax() always returns a jqXHR object.
  15219. if (this.xhr && this.xhr.statusText !== "canceled") {
  15220. this._addClass(tab, "ui-tabs-loading");
  15221. panel.attr("aria-busy", "true");
  15222. this.xhr
  15223. .done(function (response, status, jqXHR) {
  15224. // support: jQuery <1.8
  15225. // http://bugs.jquery.com/ticket/11778
  15226. setTimeout(function () {
  15227. panel.html(response);
  15228. that._trigger("load", event, eventData);
  15229. complete(jqXHR, status);
  15230. }, 1);
  15231. })
  15232. .fail(function (jqXHR, status) {
  15233. // support: jQuery <1.8
  15234. // http://bugs.jquery.com/ticket/11778
  15235. setTimeout(function () {
  15236. complete(jqXHR, status);
  15237. }, 1);
  15238. });
  15239. }
  15240. },
  15241. _ajaxSettings: function (anchor, event, eventData) {
  15242. var that = this;
  15243. return {
  15244. // Support: IE <11 only
  15245. // Strip any hash that exists to prevent errors with the Ajax request
  15246. url: anchor.attr("href").replace(/#.*$/, ""),
  15247. beforeSend: function (jqXHR, settings) {
  15248. return that._trigger("beforeLoad", event,
  15249. $.extend({jqXHR: jqXHR, ajaxSettings: settings}, eventData));
  15250. }
  15251. };
  15252. },
  15253. _getPanelForTab: function (tab) {
  15254. var id = $(tab).attr("aria-controls");
  15255. return this.element.find(this._sanitizeSelector("#" + id));
  15256. }
  15257. });
  15258. // DEPRECATED
  15259. // TODO: Switch return back to widget declaration at top of file when this is removed
  15260. if ($.uiBackCompat !== false) {
  15261. // Backcompat for ui-tab class (now ui-tabs-tab)
  15262. $.widget("ui.tabs", $.ui.tabs, {
  15263. _processTabs: function () {
  15264. this._superApply(arguments);
  15265. this._addClass(this.tabs, "ui-tab");
  15266. }
  15267. });
  15268. }
  15269. var widgetsTabs = $.ui.tabs;
  15270. /*!
  15271. * jQuery UI Tooltip 1.12.1
  15272. * http://jqueryui.com
  15273. *
  15274. * Copyright jQuery Foundation and other contributors
  15275. * Released under the MIT license.
  15276. * http://jquery.org/license
  15277. */
  15278. //>>label: Tooltip
  15279. //>>group: Widgets
  15280. //>>description: Shows additional information for any element on hover or focus.
  15281. //>>docs: http://api.jqueryui.com/tooltip/
  15282. //>>demos: http://jqueryui.com/tooltip/
  15283. //>>css.structure: ../../themes/base/core.css
  15284. //>>css.structure: ../../themes/base/tooltip.css
  15285. //>>css.theme: ../../themes/base/theme.css
  15286. $.widget("ui.tooltip", {
  15287. version: "1.12.1",
  15288. options: {
  15289. classes: {
  15290. "ui-tooltip": "ui-corner-all ui-widget-shadow"
  15291. },
  15292. content: function () {
  15293. // support: IE<9, Opera in jQuery <1.7
  15294. // .text() can't accept undefined, so coerce to a string
  15295. var title = $(this).attr("title") || "";
  15296. // Escape title, since we're going from an attribute to raw HTML
  15297. return $("<a>").text(title).html();
  15298. },
  15299. hide: true,
  15300. // Disabled elements have inconsistent behavior across browsers (#8661)
  15301. items: "[title]:not([disabled])",
  15302. position: {
  15303. my: "left top+15",
  15304. at: "left bottom",
  15305. collision: "flipfit flip"
  15306. },
  15307. show: true,
  15308. track: false,
  15309. // Callbacks
  15310. close: null,
  15311. open: null
  15312. },
  15313. _addDescribedBy: function (elem, id) {
  15314. var describedby = (elem.attr("aria-describedby") || "").split(/\s+/);
  15315. describedby.push(id);
  15316. elem
  15317. .data("ui-tooltip-id", id)
  15318. .attr("aria-describedby", $.trim(describedby.join(" ")));
  15319. },
  15320. _removeDescribedBy: function (elem) {
  15321. var id = elem.data("ui-tooltip-id"),
  15322. describedby = (elem.attr("aria-describedby") || "").split(/\s+/),
  15323. index = $.inArray(id, describedby);
  15324. if (index !== -1) {
  15325. describedby.splice(index, 1);
  15326. }
  15327. elem.removeData("ui-tooltip-id");
  15328. describedby = $.trim(describedby.join(" "));
  15329. if (describedby) {
  15330. elem.attr("aria-describedby", describedby);
  15331. } else {
  15332. elem.removeAttr("aria-describedby");
  15333. }
  15334. },
  15335. _create: function () {
  15336. this._on({
  15337. mouseover: "open",
  15338. focusin: "open"
  15339. });
  15340. // IDs of generated tooltips, needed for destroy
  15341. this.tooltips = {};
  15342. // IDs of parent tooltips where we removed the title attribute
  15343. this.parents = {};
  15344. // Append the aria-live region so tooltips announce correctly
  15345. this.liveRegion = $("<div>")
  15346. .attr({
  15347. role: "log",
  15348. "aria-live": "assertive",
  15349. "aria-relevant": "additions"
  15350. })
  15351. .appendTo(this.document[0].body);
  15352. this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible");
  15353. this.disabledTitles = $([]);
  15354. },
  15355. _setOption: function (key, value) {
  15356. var that = this;
  15357. this._super(key, value);
  15358. if (key === "content") {
  15359. $.each(this.tooltips, function (id, tooltipData) {
  15360. that._updateContent(tooltipData.element);
  15361. });
  15362. }
  15363. },
  15364. _setOptionDisabled: function (value) {
  15365. this[value ? "_disable" : "_enable"]();
  15366. },
  15367. _disable: function () {
  15368. var that = this;
  15369. // Close open tooltips
  15370. $.each(this.tooltips, function (id, tooltipData) {
  15371. var event = $.Event("blur");
  15372. event.target = event.currentTarget = tooltipData.element[0];
  15373. that.close(event, true);
  15374. });
  15375. // Remove title attributes to prevent native tooltips
  15376. this.disabledTitles = this.disabledTitles.add(
  15377. this.element.find(this.options.items).addBack()
  15378. .filter(function () {
  15379. var element = $(this);
  15380. if (element.is("[title]")) {
  15381. return element
  15382. .data("ui-tooltip-title", element.attr("title"))
  15383. .removeAttr("title");
  15384. }
  15385. })
  15386. );
  15387. },
  15388. _enable: function () {
  15389. // restore title attributes
  15390. this.disabledTitles.each(function () {
  15391. var element = $(this);
  15392. if (element.data("ui-tooltip-title")) {
  15393. element.attr("title", element.data("ui-tooltip-title"));
  15394. }
  15395. });
  15396. this.disabledTitles = $([]);
  15397. },
  15398. open: function (event) {
  15399. var that = this,
  15400. target = $(event ? event.target : this.element)
  15401. // we need closest here due to mouseover bubbling,
  15402. // but always pointing at the same event target
  15403. .closest(this.options.items);
  15404. // No element to show a tooltip for or the tooltip is already open
  15405. if (!target.length || target.data("ui-tooltip-id")) {
  15406. return;
  15407. }
  15408. if (target.attr("title")) {
  15409. target.data("ui-tooltip-title", target.attr("title"));
  15410. }
  15411. target.data("ui-tooltip-open", true);
  15412. // Kill parent tooltips, custom or native, for hover
  15413. if (event && event.type === "mouseover") {
  15414. target.parents().each(function () {
  15415. var parent = $(this),
  15416. blurEvent;
  15417. if (parent.data("ui-tooltip-open")) {
  15418. blurEvent = $.Event("blur");
  15419. blurEvent.target = blurEvent.currentTarget = this;
  15420. that.close(blurEvent, true);
  15421. }
  15422. if (parent.attr("title")) {
  15423. parent.uniqueId();
  15424. that.parents[this.id] = {
  15425. element: this,
  15426. title: parent.attr("title")
  15427. };
  15428. parent.attr("title", "");
  15429. }
  15430. });
  15431. }
  15432. this._registerCloseHandlers(event, target);
  15433. this._updateContent(target, event);
  15434. },
  15435. _updateContent: function (target, event) {
  15436. var content,
  15437. contentOption = this.options.content,
  15438. that = this,
  15439. eventType = event ? event.type : null;
  15440. if (typeof contentOption === "string" || contentOption.nodeType ||
  15441. contentOption.jquery) {
  15442. return this._open(event, target, contentOption);
  15443. }
  15444. content = contentOption.call(target[0], function (response) {
  15445. // IE may instantly serve a cached response for ajax requests
  15446. // delay this call to _open so the other call to _open runs first
  15447. that._delay(function () {
  15448. // Ignore async response if tooltip was closed already
  15449. if (!target.data("ui-tooltip-open")) {
  15450. return;
  15451. }
  15452. // JQuery creates a special event for focusin when it doesn't
  15453. // exist natively. To improve performance, the native event
  15454. // object is reused and the type is changed. Therefore, we can't
  15455. // rely on the type being correct after the event finished
  15456. // bubbling, so we set it back to the previous value. (#8740)
  15457. if (event) {
  15458. event.type = eventType;
  15459. }
  15460. this._open(event, target, response);
  15461. });
  15462. });
  15463. if (content) {
  15464. this._open(event, target, content);
  15465. }
  15466. },
  15467. _open: function (event, target, content) {
  15468. var tooltipData, tooltip, delayedShow, a11yContent,
  15469. positionOption = $.extend({}, this.options.position);
  15470. if (!content) {
  15471. return;
  15472. }
  15473. // Content can be updated multiple times. If the tooltip already
  15474. // exists, then just update the content and bail.
  15475. tooltipData = this._find(target);
  15476. if (tooltipData) {
  15477. tooltipData.tooltip.find(".ui-tooltip-content").html(content);
  15478. return;
  15479. }
  15480. // If we have a title, clear it to prevent the native tooltip
  15481. // we have to check first to avoid defining a title if none exists
  15482. // (we don't want to cause an element to start matching [title])
  15483. //
  15484. // We use removeAttr only for key events, to allow IE to export the correct
  15485. // accessible attributes. For mouse events, set to empty string to avoid
  15486. // native tooltip showing up (happens only when removing inside mouseover).
  15487. if (target.is("[title]")) {
  15488. if (event && event.type === "mouseover") {
  15489. target.attr("title", "");
  15490. } else {
  15491. target.removeAttr("title");
  15492. }
  15493. }
  15494. tooltipData = this._tooltip(target);
  15495. tooltip = tooltipData.tooltip;
  15496. this._addDescribedBy(target, tooltip.attr("id"));
  15497. tooltip.find(".ui-tooltip-content").html(content);
  15498. // Support: Voiceover on OS X, JAWS on IE <= 9
  15499. // JAWS announces deletions even when aria-relevant="additions"
  15500. // Voiceover will sometimes re-read the entire log region's contents from the beginning
  15501. this.liveRegion.children().hide();
  15502. a11yContent = $("<div>").html(tooltip.find(".ui-tooltip-content").html());
  15503. a11yContent.removeAttr("name").find("[name]").removeAttr("name");
  15504. a11yContent.removeAttr("id").find("[id]").removeAttr("id");
  15505. a11yContent.appendTo(this.liveRegion);
  15506. function position(event) {
  15507. positionOption.of = event;
  15508. if (tooltip.is(":hidden")) {
  15509. return;
  15510. }
  15511. tooltip.position(positionOption);
  15512. }
  15513. if (this.options.track && event && /^mouse/.test(event.type)) {
  15514. this._on(this.document, {
  15515. mousemove: position
  15516. });
  15517. // trigger once to override element-relative positioning
  15518. position(event);
  15519. } else {
  15520. tooltip.position($.extend({
  15521. of: target
  15522. }, this.options.position));
  15523. }
  15524. tooltip.hide();
  15525. this._show(tooltip, this.options.show);
  15526. // Handle tracking tooltips that are shown with a delay (#8644). As soon
  15527. // as the tooltip is visible, position the tooltip using the most recent
  15528. // event.
  15529. // Adds the check to add the timers only when both delay and track options are set (#14682)
  15530. if (this.options.track && this.options.show && this.options.show.delay) {
  15531. delayedShow = this.delayedShow = setInterval(function () {
  15532. if (tooltip.is(":visible")) {
  15533. position(positionOption.of);
  15534. clearInterval(delayedShow);
  15535. }
  15536. }, $.fx.interval);
  15537. }
  15538. this._trigger("open", event, {tooltip: tooltip});
  15539. },
  15540. _registerCloseHandlers: function (event, target) {
  15541. var events = {
  15542. keyup: function (event) {
  15543. if (event.keyCode === $.ui.keyCode.ESCAPE) {
  15544. var fakeEvent = $.Event(event);
  15545. fakeEvent.currentTarget = target[0];
  15546. this.close(fakeEvent, true);
  15547. }
  15548. }
  15549. };
  15550. // Only bind remove handler for delegated targets. Non-delegated
  15551. // tooltips will handle this in destroy.
  15552. if (target[0] !== this.element[0]) {
  15553. events.remove = function () {
  15554. this._removeTooltip(this._find(target).tooltip);
  15555. };
  15556. }
  15557. if (!event || event.type === "mouseover") {
  15558. events.mouseleave = "close";
  15559. }
  15560. if (!event || event.type === "focusin") {
  15561. events.focusout = "close";
  15562. }
  15563. this._on(true, target, events);
  15564. },
  15565. close: function (event) {
  15566. var tooltip,
  15567. that = this,
  15568. target = $(event ? event.currentTarget : this.element),
  15569. tooltipData = this._find(target);
  15570. // The tooltip may already be closed
  15571. if (!tooltipData) {
  15572. // We set ui-tooltip-open immediately upon open (in open()), but only set the
  15573. // additional data once there's actually content to show (in _open()). So even if the
  15574. // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in
  15575. // the period between open() and _open().
  15576. target.removeData("ui-tooltip-open");
  15577. return;
  15578. }
  15579. tooltip = tooltipData.tooltip;
  15580. // Disabling closes the tooltip, so we need to track when we're closing
  15581. // to avoid an infinite loop in case the tooltip becomes disabled on close
  15582. if (tooltipData.closing) {
  15583. return;
  15584. }
  15585. // Clear the interval for delayed tracking tooltips
  15586. clearInterval(this.delayedShow);
  15587. // Only set title if we had one before (see comment in _open())
  15588. // If the title attribute has changed since open(), don't restore
  15589. if (target.data("ui-tooltip-title") && !target.attr("title")) {
  15590. target.attr("title", target.data("ui-tooltip-title"));
  15591. }
  15592. this._removeDescribedBy(target);
  15593. tooltipData.hiding = true;
  15594. tooltip.stop(true);
  15595. this._hide(tooltip, this.options.hide, function () {
  15596. that._removeTooltip($(this));
  15597. });
  15598. target.removeData("ui-tooltip-open");
  15599. this._off(target, "mouseleave focusout keyup");
  15600. // Remove 'remove' binding only on delegated targets
  15601. if (target[0] !== this.element[0]) {
  15602. this._off(target, "remove");
  15603. }
  15604. this._off(this.document, "mousemove");
  15605. if (event && event.type === "mouseleave") {
  15606. $.each(this.parents, function (id, parent) {
  15607. $(parent.element).attr("title", parent.title);
  15608. delete that.parents[id];
  15609. });
  15610. }
  15611. tooltipData.closing = true;
  15612. this._trigger("close", event, {tooltip: tooltip});
  15613. if (!tooltipData.hiding) {
  15614. tooltipData.closing = false;
  15615. }
  15616. },
  15617. _tooltip: function (element) {
  15618. var tooltip = $("<div>").attr("role", "tooltip"),
  15619. content = $("<div>").appendTo(tooltip),
  15620. id = tooltip.uniqueId().attr("id");
  15621. this._addClass(content, "ui-tooltip-content");
  15622. this._addClass(tooltip, "ui-tooltip", "ui-widget ui-widget-content");
  15623. tooltip.appendTo(this._appendTo(element));
  15624. return this.tooltips[id] = {
  15625. element: element,
  15626. tooltip: tooltip
  15627. };
  15628. },
  15629. _find: function (target) {
  15630. var id = target.data("ui-tooltip-id");
  15631. return id ? this.tooltips[id] : null;
  15632. },
  15633. _removeTooltip: function (tooltip) {
  15634. tooltip.remove();
  15635. delete this.tooltips[tooltip.attr("id")];
  15636. },
  15637. _appendTo: function (target) {
  15638. var element = target.closest(".ui-front, dialog");
  15639. if (!element.length) {
  15640. element = this.document[0].body;
  15641. }
  15642. return element;
  15643. },
  15644. _destroy: function () {
  15645. var that = this;
  15646. // Close open tooltips
  15647. $.each(this.tooltips, function (id, tooltipData) {
  15648. // Delegate to close method to handle common cleanup
  15649. var event = $.Event("blur"),
  15650. element = tooltipData.element;
  15651. event.target = event.currentTarget = element[0];
  15652. that.close(event, true);
  15653. // Remove immediately; destroying an open tooltip doesn't use the
  15654. // hide animation
  15655. $("#" + id).remove();
  15656. // Restore the title
  15657. if (element.data("ui-tooltip-title")) {
  15658. // If the title attribute has changed since open(), don't restore
  15659. if (!element.attr("title")) {
  15660. element.attr("title", element.data("ui-tooltip-title"));
  15661. }
  15662. element.removeData("ui-tooltip-title");
  15663. }
  15664. });
  15665. this.liveRegion.remove();
  15666. }
  15667. });
  15668. // DEPRECATED
  15669. // TODO: Switch return back to widget declaration at top of file when this is removed
  15670. if ($.uiBackCompat !== false) {
  15671. // Backcompat for tooltipClass option
  15672. $.widget("ui.tooltip", $.ui.tooltip, {
  15673. options: {
  15674. tooltipClass: null
  15675. },
  15676. _tooltip: function () {
  15677. var tooltipData = this._superApply(arguments);
  15678. if (this.options.tooltipClass) {
  15679. tooltipData.tooltip.addClass(this.options.tooltipClass);
  15680. }
  15681. return tooltipData;
  15682. }
  15683. });
  15684. }
  15685. var widgetsTooltip = $.ui.tooltip;
  15686. }));