jquery-ui-1.8.6.custom.js 355KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438
  1. /*!
  2. * jQuery UI 1.8.6
  3. *
  4. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  5. * Dual licensed under the MIT or GPL Version 2 licenses.
  6. * http://jquery.org/license
  7. *
  8. * http://docs.jquery.com/UI
  9. */
  10. (function( $, undefined ) {
  11. // prevent duplicate loading
  12. // this is only a problem because we proxy existing functions
  13. // and we don't want to double proxy them
  14. $.ui = $.ui || {};
  15. if ( $.ui.version ) {
  16. return;
  17. }
  18. $.extend( $.ui, {
  19. version: "1.8.6",
  20. keyCode: {
  21. ALT: 18,
  22. BACKSPACE: 8,
  23. CAPS_LOCK: 20,
  24. COMMA: 188,
  25. COMMAND: 91,
  26. COMMAND_LEFT: 91, // COMMAND
  27. COMMAND_RIGHT: 93,
  28. CONTROL: 17,
  29. DELETE: 46,
  30. DOWN: 40,
  31. END: 35,
  32. ENTER: 13,
  33. ESCAPE: 27,
  34. HOME: 36,
  35. INSERT: 45,
  36. LEFT: 37,
  37. MENU: 93, // COMMAND_RIGHT
  38. NUMPAD_ADD: 107,
  39. NUMPAD_DECIMAL: 110,
  40. NUMPAD_DIVIDE: 111,
  41. NUMPAD_ENTER: 108,
  42. NUMPAD_MULTIPLY: 106,
  43. NUMPAD_SUBTRACT: 109,
  44. PAGE_DOWN: 34,
  45. PAGE_UP: 33,
  46. PERIOD: 190,
  47. RIGHT: 39,
  48. SHIFT: 16,
  49. SPACE: 32,
  50. TAB: 9,
  51. UP: 38,
  52. WINDOWS: 91 // COMMAND
  53. }
  54. });
  55. // plugins
  56. $.fn.extend({
  57. _focus: $.fn.focus,
  58. focus: function( delay, fn ) {
  59. return typeof delay === "number" ?
  60. this.each(function() {
  61. var elem = this;
  62. setTimeout(function() {
  63. $( elem ).focus();
  64. if ( fn ) {
  65. fn.call( elem );
  66. }
  67. }, delay );
  68. }) :
  69. this._focus.apply( this, arguments );
  70. },
  71. scrollParent: function() {
  72. var scrollParent;
  73. if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
  74. scrollParent = this.parents().filter(function() {
  75. return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
  76. }).eq(0);
  77. } else {
  78. scrollParent = this.parents().filter(function() {
  79. return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
  80. }).eq(0);
  81. }
  82. return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
  83. },
  84. zIndex: function( zIndex ) {
  85. if ( zIndex !== undefined ) {
  86. return this.css( "zIndex", zIndex );
  87. }
  88. if ( this.length ) {
  89. var elem = $( this[ 0 ] ), position, value;
  90. while ( elem.length && elem[ 0 ] !== document ) {
  91. // Ignore z-index if position is set to a value where z-index is ignored by the browser
  92. // This makes behavior of this function consistent across browsers
  93. // WebKit always returns auto if the element is positioned
  94. position = elem.css( "position" );
  95. if ( position === "absolute" || position === "relative" || position === "fixed" ) {
  96. // IE returns 0 when zIndex is not specified
  97. // other browsers return a string
  98. // we ignore the case of nested elements with an explicit value of 0
  99. // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
  100. value = parseInt( elem.css( "zIndex" ), 10 );
  101. if ( !isNaN( value ) && value !== 0 ) {
  102. return value;
  103. }
  104. }
  105. elem = elem.parent();
  106. }
  107. }
  108. return 0;
  109. },
  110. disableSelection: function() {
  111. return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
  112. ".ui-disableSelection", function( event ) {
  113. event.preventDefault();
  114. });
  115. },
  116. enableSelection: function() {
  117. return this.unbind( ".ui-disableSelection" );
  118. }
  119. });
  120. $.each( [ "Width", "Height" ], function( i, name ) {
  121. var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
  122. type = name.toLowerCase(),
  123. orig = {
  124. innerWidth: $.fn.innerWidth,
  125. innerHeight: $.fn.innerHeight,
  126. outerWidth: $.fn.outerWidth,
  127. outerHeight: $.fn.outerHeight
  128. };
  129. function reduce( elem, size, border, margin ) {
  130. $.each( side, function() {
  131. size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
  132. if ( border ) {
  133. size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
  134. }
  135. if ( margin ) {
  136. size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
  137. }
  138. });
  139. return size;
  140. }
  141. $.fn[ "inner" + name ] = function( size ) {
  142. if ( size === undefined ) {
  143. return orig[ "inner" + name ].call( this );
  144. }
  145. return this.each(function() {
  146. $( this ).css( type, reduce( this, size ) + "px" );
  147. });
  148. };
  149. $.fn[ "outer" + name] = function( size, margin ) {
  150. if ( typeof size !== "number" ) {
  151. return orig[ "outer" + name ].call( this, size );
  152. }
  153. return this.each(function() {
  154. $( this).css( type, reduce( this, size, true, margin ) + "px" );
  155. });
  156. };
  157. });
  158. // selectors
  159. function visible( element ) {
  160. return !$( element ).parents().andSelf().filter(function() {
  161. return $.curCSS( this, "visibility" ) === "hidden" ||
  162. $.expr.filters.hidden( this );
  163. }).length;
  164. }
  165. $.extend( $.expr[ ":" ], {
  166. data: function( elem, i, match ) {
  167. return !!$.data( elem, match[ 3 ] );
  168. },
  169. focusable: function( element ) {
  170. var nodeName = element.nodeName.toLowerCase(),
  171. tabIndex = $.attr( element, "tabindex" );
  172. if ( "area" === nodeName ) {
  173. var map = element.parentNode,
  174. mapName = map.name,
  175. img;
  176. if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
  177. return false;
  178. }
  179. img = $( "img[usemap=#" + mapName + "]" )[0];
  180. return !!img && visible( img );
  181. }
  182. return ( /input|select|textarea|button|object/.test( nodeName )
  183. ? !element.disabled
  184. : "a" == nodeName
  185. ? element.href || !isNaN( tabIndex )
  186. : !isNaN( tabIndex ))
  187. // the element and all of its ancestors must be visible
  188. && visible( element );
  189. },
  190. tabbable: function( element ) {
  191. var tabIndex = $.attr( element, "tabindex" );
  192. return ( isNaN( tabIndex ) || tabIndex >= 0 ) && $( element ).is( ":focusable" );
  193. }
  194. });
  195. // support
  196. $(function() {
  197. var body = document.body,
  198. div = body.appendChild( div = document.createElement( "div" ) );
  199. $.extend( div.style, {
  200. minHeight: "100px",
  201. height: "auto",
  202. padding: 0,
  203. borderWidth: 0
  204. });
  205. $.support.minHeight = div.offsetHeight === 100;
  206. $.support.selectstart = "onselectstart" in div;
  207. // set display to none to avoid a layout bug in IE
  208. // http://dev.jquery.com/ticket/4014
  209. body.removeChild( div ).style.display = "none";
  210. });
  211. // deprecated
  212. $.extend( $.ui, {
  213. // $.ui.plugin is deprecated. Use the proxy pattern instead.
  214. plugin: {
  215. add: function( module, option, set ) {
  216. var proto = $.ui[ module ].prototype;
  217. for ( var i in set ) {
  218. proto.plugins[ i ] = proto.plugins[ i ] || [];
  219. proto.plugins[ i ].push( [ option, set[ i ] ] );
  220. }
  221. },
  222. call: function( instance, name, args ) {
  223. var set = instance.plugins[ name ];
  224. if ( !set || !instance.element[ 0 ].parentNode ) {
  225. return;
  226. }
  227. for ( var i = 0; i < set.length; i++ ) {
  228. if ( instance.options[ set[ i ][ 0 ] ] ) {
  229. set[ i ][ 1 ].apply( instance.element, args );
  230. }
  231. }
  232. }
  233. },
  234. // will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
  235. contains: function( a, b ) {
  236. return document.compareDocumentPosition ?
  237. a.compareDocumentPosition( b ) & 16 :
  238. a !== b && a.contains( b );
  239. },
  240. // only used by resizable
  241. hasScroll: function( el, a ) {
  242. //If overflow is hidden, the element might have extra content, but the user wants to hide it
  243. if ( $( el ).css( "overflow" ) === "hidden") {
  244. return false;
  245. }
  246. var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
  247. has = false;
  248. if ( el[ scroll ] > 0 ) {
  249. return true;
  250. }
  251. // TODO: determine which cases actually cause this to happen
  252. // if the element doesn't have the scroll set, see if it's possible to
  253. // set the scroll
  254. el[ scroll ] = 1;
  255. has = ( el[ scroll ] > 0 );
  256. el[ scroll ] = 0;
  257. return has;
  258. },
  259. // these are odd functions, fix the API or move into individual plugins
  260. isOverAxis: function( x, reference, size ) {
  261. //Determines when x coordinate is over "b" element axis
  262. return ( x > reference ) && ( x < ( reference + size ) );
  263. },
  264. isOver: function( y, x, top, left, height, width ) {
  265. //Determines when x, y coordinates is over "b" element
  266. return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
  267. }
  268. });
  269. })( jQuery );
  270. /*!
  271. * jQuery UI Widget 1.8.6
  272. *
  273. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  274. * Dual licensed under the MIT or GPL Version 2 licenses.
  275. * http://jquery.org/license
  276. *
  277. * http://docs.jquery.com/UI/Widget
  278. */
  279. (function( $, undefined ) {
  280. // jQuery 1.4+
  281. if ( $.cleanData ) {
  282. var _cleanData = $.cleanData;
  283. $.cleanData = function( elems ) {
  284. for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
  285. $( elem ).triggerHandler( "remove" );
  286. }
  287. _cleanData( elems );
  288. };
  289. } else {
  290. var _remove = $.fn.remove;
  291. $.fn.remove = function( selector, keepData ) {
  292. return this.each(function() {
  293. if ( !keepData ) {
  294. if ( !selector || $.filter( selector, [ this ] ).length ) {
  295. $( "*", this ).add( [ this ] ).each(function() {
  296. $( this ).triggerHandler( "remove" );
  297. });
  298. }
  299. }
  300. return _remove.call( $(this), selector, keepData );
  301. });
  302. };
  303. }
  304. $.widget = function( name, base, prototype ) {
  305. var namespace = name.split( "." )[ 0 ],
  306. fullName;
  307. name = name.split( "." )[ 1 ];
  308. fullName = namespace + "-" + name;
  309. if ( !prototype ) {
  310. prototype = base;
  311. base = $.Widget;
  312. }
  313. // create selector for plugin
  314. $.expr[ ":" ][ fullName ] = function( elem ) {
  315. return !!$.data( elem, name );
  316. };
  317. $[ namespace ] = $[ namespace ] || {};
  318. $[ namespace ][ name ] = function( options, element ) {
  319. // allow instantiation without initializing for simple inheritance
  320. if ( arguments.length ) {
  321. this._createWidget( options, element );
  322. }
  323. };
  324. var basePrototype = new base();
  325. // we need to make the options hash a property directly on the new instance
  326. // otherwise we'll modify the options hash on the prototype that we're
  327. // inheriting from
  328. // $.each( basePrototype, function( key, val ) {
  329. // if ( $.isPlainObject(val) ) {
  330. // basePrototype[ key ] = $.extend( {}, val );
  331. // }
  332. // });
  333. basePrototype.options = $.extend( true, {}, basePrototype.options );
  334. $[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
  335. namespace: namespace,
  336. widgetName: name,
  337. widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
  338. widgetBaseClass: fullName
  339. }, prototype );
  340. $.widget.bridge( name, $[ namespace ][ name ] );
  341. };
  342. $.widget.bridge = function( name, object ) {
  343. $.fn[ name ] = function( options ) {
  344. var isMethodCall = typeof options === "string",
  345. args = Array.prototype.slice.call( arguments, 1 ),
  346. returnValue = this;
  347. // allow multiple hashes to be passed on init
  348. options = !isMethodCall && args.length ?
  349. $.extend.apply( null, [ true, options ].concat(args) ) :
  350. options;
  351. // prevent calls to internal methods
  352. if ( isMethodCall && options.charAt( 0 ) === "_" ) {
  353. return returnValue;
  354. }
  355. if ( isMethodCall ) {
  356. this.each(function() {
  357. var instance = $.data( this, name ),
  358. methodValue = instance && $.isFunction( instance[options] ) ?
  359. instance[ options ].apply( instance, args ) :
  360. instance;
  361. // TODO: add this back in 1.9 and use $.error() (see #5972)
  362. // if ( !instance ) {
  363. // throw "cannot call methods on " + name + " prior to initialization; " +
  364. // "attempted to call method '" + options + "'";
  365. // }
  366. // if ( !$.isFunction( instance[options] ) ) {
  367. // throw "no such method '" + options + "' for " + name + " widget instance";
  368. // }
  369. // var methodValue = instance[ options ].apply( instance, args );
  370. if ( methodValue !== instance && methodValue !== undefined ) {
  371. returnValue = methodValue;
  372. return false;
  373. }
  374. });
  375. } else {
  376. this.each(function() {
  377. var instance = $.data( this, name );
  378. if ( instance ) {
  379. instance.option( options || {} )._init();
  380. } else {
  381. $.data( this, name, new object( options, this ) );
  382. }
  383. });
  384. }
  385. return returnValue;
  386. };
  387. };
  388. $.Widget = function( options, element ) {
  389. // allow instantiation without initializing for simple inheritance
  390. if ( arguments.length ) {
  391. this._createWidget( options, element );
  392. }
  393. };
  394. $.Widget.prototype = {
  395. widgetName: "widget",
  396. widgetEventPrefix: "",
  397. options: {
  398. disabled: false
  399. },
  400. _createWidget: function( options, element ) {
  401. // $.widget.bridge stores the plugin instance, but we do it anyway
  402. // so that it's stored even before the _create function runs
  403. $.data( element, this.widgetName, this );
  404. this.element = $( element );
  405. this.options = $.extend( true, {},
  406. this.options,
  407. this._getCreateOptions(),
  408. options );
  409. var self = this;
  410. this.element.bind( "remove." + this.widgetName, function() {
  411. self.destroy();
  412. });
  413. this._create();
  414. this._trigger( "create" );
  415. this._init();
  416. },
  417. _getCreateOptions: function() {
  418. return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
  419. },
  420. _create: function() {},
  421. _init: function() {},
  422. destroy: function() {
  423. this.element
  424. .unbind( "." + this.widgetName )
  425. .removeData( this.widgetName );
  426. this.widget()
  427. .unbind( "." + this.widgetName )
  428. .removeAttr( "aria-disabled" )
  429. .removeClass(
  430. this.widgetBaseClass + "-disabled " +
  431. "ui-state-disabled" );
  432. },
  433. widget: function() {
  434. return this.element;
  435. },
  436. option: function( key, value ) {
  437. var options = key;
  438. if ( arguments.length === 0 ) {
  439. // don't return a reference to the internal hash
  440. return $.extend( {}, this.options );
  441. }
  442. if (typeof key === "string" ) {
  443. if ( value === undefined ) {
  444. return this.options[ key ];
  445. }
  446. options = {};
  447. options[ key ] = value;
  448. }
  449. this._setOptions( options );
  450. return this;
  451. },
  452. _setOptions: function( options ) {
  453. var self = this;
  454. $.each( options, function( key, value ) {
  455. self._setOption( key, value );
  456. });
  457. return this;
  458. },
  459. _setOption: function( key, value ) {
  460. this.options[ key ] = value;
  461. if ( key === "disabled" ) {
  462. this.widget()
  463. [ value ? "addClass" : "removeClass"](
  464. this.widgetBaseClass + "-disabled" + " " +
  465. "ui-state-disabled" )
  466. .attr( "aria-disabled", value );
  467. }
  468. return this;
  469. },
  470. enable: function() {
  471. return this._setOption( "disabled", false );
  472. },
  473. disable: function() {
  474. return this._setOption( "disabled", true );
  475. },
  476. _trigger: function( type, event, data ) {
  477. var callback = this.options[ type ];
  478. event = $.Event( event );
  479. event.type = ( type === this.widgetEventPrefix ?
  480. type :
  481. this.widgetEventPrefix + type ).toLowerCase();
  482. data = data || {};
  483. // copy original event properties over to the new event
  484. // this would happen if we could call $.event.fix instead of $.Event
  485. // but we don't have a way to force an event to be fixed multiple times
  486. if ( event.originalEvent ) {
  487. for ( var i = $.event.props.length, prop; i; ) {
  488. prop = $.event.props[ --i ];
  489. event[ prop ] = event.originalEvent[ prop ];
  490. }
  491. }
  492. this.element.trigger( event, data );
  493. return !( $.isFunction(callback) &&
  494. callback.call( this.element[0], event, data ) === false ||
  495. event.isDefaultPrevented() );
  496. }
  497. };
  498. })( jQuery );
  499. /*!
  500. * jQuery UI Mouse 1.8.6
  501. *
  502. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  503. * Dual licensed under the MIT or GPL Version 2 licenses.
  504. * http://jquery.org/license
  505. *
  506. * http://docs.jquery.com/UI/Mouse
  507. *
  508. * Depends:
  509. * jquery.ui.widget.js
  510. */
  511. (function( $, undefined ) {
  512. $.widget("ui.mouse", {
  513. options: {
  514. cancel: ':input,option',
  515. distance: 1,
  516. delay: 0
  517. },
  518. _mouseInit: function() {
  519. var self = this;
  520. this.element
  521. .bind('mousedown.'+this.widgetName, function(event) {
  522. return self._mouseDown(event);
  523. })
  524. .bind('click.'+this.widgetName, function(event) {
  525. if(self._preventClickEvent) {
  526. self._preventClickEvent = false;
  527. event.stopImmediatePropagation();
  528. return false;
  529. }
  530. });
  531. this.started = false;
  532. },
  533. // TODO: make sure destroying one instance of mouse doesn't mess with
  534. // other instances of mouse
  535. _mouseDestroy: function() {
  536. this.element.unbind('.'+this.widgetName);
  537. },
  538. _mouseDown: function(event) {
  539. // don't let more than one widget handle mouseStart
  540. // TODO: figure out why we have to use originalEvent
  541. event.originalEvent = event.originalEvent || {};
  542. if (event.originalEvent.mouseHandled) { return; }
  543. // we may have missed mouseup (out of window)
  544. (this._mouseStarted && this._mouseUp(event));
  545. this._mouseDownEvent = event;
  546. var self = this,
  547. btnIsLeft = (event.which == 1),
  548. elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
  549. if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
  550. return true;
  551. }
  552. this.mouseDelayMet = !this.options.delay;
  553. if (!this.mouseDelayMet) {
  554. this._mouseDelayTimer = setTimeout(function() {
  555. self.mouseDelayMet = true;
  556. }, this.options.delay);
  557. }
  558. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  559. this._mouseStarted = (this._mouseStart(event) !== false);
  560. if (!this._mouseStarted) {
  561. event.preventDefault();
  562. return true;
  563. }
  564. }
  565. // these delegates are required to keep context
  566. this._mouseMoveDelegate = function(event) {
  567. return self._mouseMove(event);
  568. };
  569. this._mouseUpDelegate = function(event) {
  570. return self._mouseUp(event);
  571. };
  572. $(document)
  573. .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
  574. .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
  575. event.preventDefault();
  576. event.originalEvent.mouseHandled = true;
  577. return true;
  578. },
  579. _mouseMove: function(event) {
  580. // IE mouseup check - mouseup happened when mouse was out of window
  581. if ($.browser.msie && !(document.documentMode >= 9) && !event.button) {
  582. return this._mouseUp(event);
  583. }
  584. if (this._mouseStarted) {
  585. this._mouseDrag(event);
  586. return event.preventDefault();
  587. }
  588. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  589. this._mouseStarted =
  590. (this._mouseStart(this._mouseDownEvent, event) !== false);
  591. (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
  592. }
  593. return !this._mouseStarted;
  594. },
  595. _mouseUp: function(event) {
  596. $(document)
  597. .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
  598. .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
  599. if (this._mouseStarted) {
  600. this._mouseStarted = false;
  601. this._preventClickEvent = (event.target == this._mouseDownEvent.target);
  602. this._mouseStop(event);
  603. }
  604. return false;
  605. },
  606. _mouseDistanceMet: function(event) {
  607. return (Math.max(
  608. Math.abs(this._mouseDownEvent.pageX - event.pageX),
  609. Math.abs(this._mouseDownEvent.pageY - event.pageY)
  610. ) >= this.options.distance
  611. );
  612. },
  613. _mouseDelayMet: function(event) {
  614. return this.mouseDelayMet;
  615. },
  616. // These are placeholder methods, to be overriden by extending plugin
  617. _mouseStart: function(event) {},
  618. _mouseDrag: function(event) {},
  619. _mouseStop: function(event) {},
  620. _mouseCapture: function(event) { return true; }
  621. });
  622. })(jQuery);
  623. /*
  624. * jQuery UI Position 1.8.6
  625. *
  626. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  627. * Dual licensed under the MIT or GPL Version 2 licenses.
  628. * http://jquery.org/license
  629. *
  630. * http://docs.jquery.com/UI/Position
  631. */
  632. (function( $, undefined ) {
  633. $.ui = $.ui || {};
  634. var horizontalPositions = /left|center|right/,
  635. verticalPositions = /top|center|bottom/,
  636. center = "center",
  637. _position = $.fn.position,
  638. _offset = $.fn.offset;
  639. $.fn.position = function( options ) {
  640. if ( !options || !options.of ) {
  641. return _position.apply( this, arguments );
  642. }
  643. // make a copy, we don't want to modify arguments
  644. options = $.extend( {}, options );
  645. var target = $( options.of ),
  646. targetElem = target[0],
  647. collision = ( options.collision || "flip" ).split( " " ),
  648. offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
  649. targetWidth,
  650. targetHeight,
  651. basePosition;
  652. if ( targetElem.nodeType === 9 ) {
  653. targetWidth = target.width();
  654. targetHeight = target.height();
  655. basePosition = { top: 0, left: 0 };
  656. // TODO: use $.isWindow() in 1.9
  657. } else if ( targetElem.setTimeout ) {
  658. targetWidth = target.width();
  659. targetHeight = target.height();
  660. basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
  661. } else if ( targetElem.preventDefault ) {
  662. // force left top to allow flipping
  663. options.at = "left top";
  664. targetWidth = targetHeight = 0;
  665. basePosition = { top: options.of.pageY, left: options.of.pageX };
  666. } else {
  667. targetWidth = target.outerWidth();
  668. targetHeight = target.outerHeight();
  669. basePosition = target.offset();
  670. }
  671. // force my and at to have valid horizontal and veritcal positions
  672. // if a value is missing or invalid, it will be converted to center
  673. $.each( [ "my", "at" ], function() {
  674. var pos = ( options[this] || "" ).split( " " );
  675. if ( pos.length === 1) {
  676. pos = horizontalPositions.test( pos[0] ) ?
  677. pos.concat( [center] ) :
  678. verticalPositions.test( pos[0] ) ?
  679. [ center ].concat( pos ) :
  680. [ center, center ];
  681. }
  682. pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center;
  683. pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center;
  684. options[ this ] = pos;
  685. });
  686. // normalize collision option
  687. if ( collision.length === 1 ) {
  688. collision[ 1 ] = collision[ 0 ];
  689. }
  690. // normalize offset option
  691. offset[ 0 ] = parseInt( offset[0], 10 ) || 0;
  692. if ( offset.length === 1 ) {
  693. offset[ 1 ] = offset[ 0 ];
  694. }
  695. offset[ 1 ] = parseInt( offset[1], 10 ) || 0;
  696. if ( options.at[0] === "right" ) {
  697. basePosition.left += targetWidth;
  698. } else if (options.at[0] === center ) {
  699. basePosition.left += targetWidth / 2;
  700. }
  701. if ( options.at[1] === "bottom" ) {
  702. basePosition.top += targetHeight;
  703. } else if ( options.at[1] === center ) {
  704. basePosition.top += targetHeight / 2;
  705. }
  706. basePosition.left += offset[ 0 ];
  707. basePosition.top += offset[ 1 ];
  708. return this.each(function() {
  709. var elem = $( this ),
  710. elemWidth = elem.outerWidth(),
  711. elemHeight = elem.outerHeight(),
  712. marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0,
  713. marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0,
  714. collisionWidth = elemWidth + marginLeft +
  715. parseInt( $.curCSS( this, "marginRight", true ) ) || 0,
  716. collisionHeight = elemHeight + marginTop +
  717. parseInt( $.curCSS( this, "marginBottom", true ) ) || 0,
  718. position = $.extend( {}, basePosition ),
  719. collisionPosition;
  720. if ( options.my[0] === "right" ) {
  721. position.left -= elemWidth;
  722. } else if ( options.my[0] === center ) {
  723. position.left -= elemWidth / 2;
  724. }
  725. if ( options.my[1] === "bottom" ) {
  726. position.top -= elemHeight;
  727. } else if ( options.my[1] === center ) {
  728. position.top -= elemHeight / 2;
  729. }
  730. // prevent fractions (see #5280)
  731. position.left = parseInt( position.left );
  732. position.top = parseInt( position.top );
  733. collisionPosition = {
  734. left: position.left - marginLeft,
  735. top: position.top - marginTop
  736. };
  737. $.each( [ "left", "top" ], function( i, dir ) {
  738. if ( $.ui.position[ collision[i] ] ) {
  739. $.ui.position[ collision[i] ][ dir ]( position, {
  740. targetWidth: targetWidth,
  741. targetHeight: targetHeight,
  742. elemWidth: elemWidth,
  743. elemHeight: elemHeight,
  744. collisionPosition: collisionPosition,
  745. collisionWidth: collisionWidth,
  746. collisionHeight: collisionHeight,
  747. offset: offset,
  748. my: options.my,
  749. at: options.at
  750. });
  751. }
  752. });
  753. if ( $.fn.bgiframe ) {
  754. elem.bgiframe();
  755. }
  756. elem.offset( $.extend( position, { using: options.using } ) );
  757. });
  758. };
  759. $.ui.position = {
  760. fit: {
  761. left: function( position, data ) {
  762. var win = $( window ),
  763. over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft();
  764. position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left );
  765. },
  766. top: function( position, data ) {
  767. var win = $( window ),
  768. over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop();
  769. position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top );
  770. }
  771. },
  772. flip: {
  773. left: function( position, data ) {
  774. if ( data.at[0] === center ) {
  775. return;
  776. }
  777. var win = $( window ),
  778. over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(),
  779. myOffset = data.my[ 0 ] === "left" ?
  780. -data.elemWidth :
  781. data.my[ 0 ] === "right" ?
  782. data.elemWidth :
  783. 0,
  784. atOffset = data.at[ 0 ] === "left" ?
  785. data.targetWidth :
  786. -data.targetWidth,
  787. offset = -2 * data.offset[ 0 ];
  788. position.left += data.collisionPosition.left < 0 ?
  789. myOffset + atOffset + offset :
  790. over > 0 ?
  791. myOffset + atOffset + offset :
  792. 0;
  793. },
  794. top: function( position, data ) {
  795. if ( data.at[1] === center ) {
  796. return;
  797. }
  798. var win = $( window ),
  799. over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(),
  800. myOffset = data.my[ 1 ] === "top" ?
  801. -data.elemHeight :
  802. data.my[ 1 ] === "bottom" ?
  803. data.elemHeight :
  804. 0,
  805. atOffset = data.at[ 1 ] === "top" ?
  806. data.targetHeight :
  807. -data.targetHeight,
  808. offset = -2 * data.offset[ 1 ];
  809. position.top += data.collisionPosition.top < 0 ?
  810. myOffset + atOffset + offset :
  811. over > 0 ?
  812. myOffset + atOffset + offset :
  813. 0;
  814. }
  815. }
  816. };
  817. // offset setter from jQuery 1.4
  818. if ( !$.offset.setOffset ) {
  819. $.offset.setOffset = function( elem, options ) {
  820. // set position first, in-case top/left are set even on static elem
  821. if ( /static/.test( $.curCSS( elem, "position" ) ) ) {
  822. elem.style.position = "relative";
  823. }
  824. var curElem = $( elem ),
  825. curOffset = curElem.offset(),
  826. curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0,
  827. curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0,
  828. props = {
  829. top: (options.top - curOffset.top) + curTop,
  830. left: (options.left - curOffset.left) + curLeft
  831. };
  832. if ( 'using' in options ) {
  833. options.using.call( elem, props );
  834. } else {
  835. curElem.css( props );
  836. }
  837. };
  838. $.fn.offset = function( options ) {
  839. var elem = this[ 0 ];
  840. if ( !elem || !elem.ownerDocument ) { return null; }
  841. if ( options ) {
  842. return this.each(function() {
  843. $.offset.setOffset( this, options );
  844. });
  845. }
  846. return _offset.call( this );
  847. };
  848. }
  849. }( jQuery ));
  850. /*
  851. * jQuery UI Draggable 1.8.6
  852. *
  853. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  854. * Dual licensed under the MIT or GPL Version 2 licenses.
  855. * http://jquery.org/license
  856. *
  857. * http://docs.jquery.com/UI/Draggables
  858. *
  859. * Depends:
  860. * jquery.ui.core.js
  861. * jquery.ui.mouse.js
  862. * jquery.ui.widget.js
  863. */
  864. (function( $, undefined ) {
  865. $.widget("ui.draggable", $.ui.mouse, {
  866. widgetEventPrefix: "drag",
  867. options: {
  868. addClasses: true,
  869. appendTo: "parent",
  870. axis: false,
  871. connectToSortable: false,
  872. containment: false,
  873. cursor: "auto",
  874. cursorAt: false,
  875. grid: false,
  876. handle: false,
  877. helper: "original",
  878. iframeFix: false,
  879. opacity: false,
  880. refreshPositions: false,
  881. revert: false,
  882. revertDuration: 500,
  883. scope: "default",
  884. scroll: true,
  885. scrollSensitivity: 20,
  886. scrollSpeed: 20,
  887. snap: false,
  888. snapMode: "both",
  889. snapTolerance: 20,
  890. stack: false,
  891. zIndex: false
  892. },
  893. _create: function() {
  894. if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
  895. this.element[0].style.position = 'relative';
  896. (this.options.addClasses && this.element.addClass("ui-draggable"));
  897. (this.options.disabled && this.element.addClass("ui-draggable-disabled"));
  898. this._mouseInit();
  899. },
  900. destroy: function() {
  901. if(!this.element.data('draggable')) return;
  902. this.element
  903. .removeData("draggable")
  904. .unbind(".draggable")
  905. .removeClass("ui-draggable"
  906. + " ui-draggable-dragging"
  907. + " ui-draggable-disabled");
  908. this._mouseDestroy();
  909. return this;
  910. },
  911. _mouseCapture: function(event) {
  912. var o = this.options;
  913. // among others, prevent a drag on a resizable-handle
  914. if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
  915. return false;
  916. //Quit if we're not on a valid handle
  917. this.handle = this._getHandle(event);
  918. if (!this.handle)
  919. return false;
  920. return true;
  921. },
  922. _mouseStart: function(event) {
  923. var o = this.options;
  924. //Create and append the visible helper
  925. this.helper = this._createHelper(event);
  926. //Cache the helper size
  927. this._cacheHelperProportions();
  928. //If ddmanager is used for droppables, set the global draggable
  929. if($.ui.ddmanager)
  930. $.ui.ddmanager.current = this;
  931. /*
  932. * - Position generation -
  933. * This block generates everything position related - it's the core of draggables.
  934. */
  935. //Cache the margins of the original element
  936. this._cacheMargins();
  937. //Store the helper's css position
  938. this.cssPosition = this.helper.css("position");
  939. this.scrollParent = this.helper.scrollParent();
  940. //The element's absolute position on the page minus margins
  941. this.offset = this.positionAbs = this.element.offset();
  942. this.offset = {
  943. top: this.offset.top - this.margins.top,
  944. left: this.offset.left - this.margins.left
  945. };
  946. $.extend(this.offset, {
  947. click: { //Where the click happened, relative to the element
  948. left: event.pageX - this.offset.left,
  949. top: event.pageY - this.offset.top
  950. },
  951. parent: this._getParentOffset(),
  952. relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
  953. });
  954. //Generate the original position
  955. this.originalPosition = this.position = this._generatePosition(event);
  956. this.originalPageX = event.pageX;
  957. this.originalPageY = event.pageY;
  958. //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
  959. (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
  960. //Set a containment if given in the options
  961. if(o.containment)
  962. this._setContainment();
  963. //Trigger event + callbacks
  964. if(this._trigger("start", event) === false) {
  965. this._clear();
  966. return false;
  967. }
  968. //Recache the helper size
  969. this._cacheHelperProportions();
  970. //Prepare the droppable offsets
  971. if ($.ui.ddmanager && !o.dropBehaviour)
  972. $.ui.ddmanager.prepareOffsets(this, event);
  973. this.helper.addClass("ui-draggable-dragging");
  974. this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
  975. return true;
  976. },
  977. _mouseDrag: function(event, noPropagation) {
  978. //Compute the helpers position
  979. this.position = this._generatePosition(event);
  980. this.positionAbs = this._convertPositionTo("absolute");
  981. //Call plugins and callbacks and use the resulting position if something is returned
  982. if (!noPropagation) {
  983. var ui = this._uiHash();
  984. if(this._trigger('drag', event, ui) === false) {
  985. this._mouseUp({});
  986. return false;
  987. }
  988. this.position = ui.position;
  989. }
  990. if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
  991. if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
  992. if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
  993. return false;
  994. },
  995. _mouseStop: function(event) {
  996. //If we are using droppables, inform the manager about the drop
  997. var dropped = false;
  998. if ($.ui.ddmanager && !this.options.dropBehaviour)
  999. dropped = $.ui.ddmanager.drop(this, event);
  1000. //if a drop comes from outside (a sortable)
  1001. if(this.dropped) {
  1002. dropped = this.dropped;
  1003. this.dropped = false;
  1004. }
  1005. //if the original element is removed, don't bother to continue
  1006. if(!this.element[0] || !this.element[0].parentNode)
  1007. return false;
  1008. if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
  1009. var self = this;
  1010. $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
  1011. if(self._trigger("stop", event) !== false) {
  1012. self._clear();
  1013. }
  1014. });
  1015. } else {
  1016. if(this._trigger("stop", event) !== false) {
  1017. this._clear();
  1018. }
  1019. }
  1020. return false;
  1021. },
  1022. cancel: function() {
  1023. if(this.helper.is(".ui-draggable-dragging")) {
  1024. this._mouseUp({});
  1025. } else {
  1026. this._clear();
  1027. }
  1028. return this;
  1029. },
  1030. _getHandle: function(event) {
  1031. var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
  1032. $(this.options.handle, this.element)
  1033. .find("*")
  1034. .andSelf()
  1035. .each(function() {
  1036. if(this == event.target) handle = true;
  1037. });
  1038. return handle;
  1039. },
  1040. _createHelper: function(event) {
  1041. var o = this.options;
  1042. var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone() : this.element);
  1043. if(!helper.parents('body').length)
  1044. helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
  1045. if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
  1046. helper.css("position", "absolute");
  1047. return helper;
  1048. },
  1049. _adjustOffsetFromHelper: function(obj) {
  1050. if (typeof obj == 'string') {
  1051. obj = obj.split(' ');
  1052. }
  1053. if ($.isArray(obj)) {
  1054. obj = {left: +obj[0], top: +obj[1] || 0};
  1055. }
  1056. if ('left' in obj) {
  1057. this.offset.click.left = obj.left + this.margins.left;
  1058. }
  1059. if ('right' in obj) {
  1060. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  1061. }
  1062. if ('top' in obj) {
  1063. this.offset.click.top = obj.top + this.margins.top;
  1064. }
  1065. if ('bottom' in obj) {
  1066. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  1067. }
  1068. },
  1069. _getParentOffset: function() {
  1070. //Get the offsetParent and cache its position
  1071. this.offsetParent = this.helper.offsetParent();
  1072. var po = this.offsetParent.offset();
  1073. // This is a special case where we need to modify a offset calculated on start, since the following happened:
  1074. // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
  1075. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
  1076. // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
  1077. if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
  1078. po.left += this.scrollParent.scrollLeft();
  1079. po.top += this.scrollParent.scrollTop();
  1080. }
  1081. if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
  1082. || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
  1083. po = { top: 0, left: 0 };
  1084. return {
  1085. top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
  1086. left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
  1087. };
  1088. },
  1089. _getRelativeOffset: function() {
  1090. if(this.cssPosition == "relative") {
  1091. var p = this.element.position();
  1092. return {
  1093. top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
  1094. left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
  1095. };
  1096. } else {
  1097. return { top: 0, left: 0 };
  1098. }
  1099. },
  1100. _cacheMargins: function() {
  1101. this.margins = {
  1102. left: (parseInt(this.element.css("marginLeft"),10) || 0),
  1103. top: (parseInt(this.element.css("marginTop"),10) || 0)
  1104. };
  1105. },
  1106. _cacheHelperProportions: function() {
  1107. this.helperProportions = {
  1108. width: this.helper.outerWidth(),
  1109. height: this.helper.outerHeight()
  1110. };
  1111. },
  1112. _setContainment: function() {
  1113. var o = this.options;
  1114. if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
  1115. if(o.containment == 'document' || o.containment == 'window') this.containment = [
  1116. 0 - this.offset.relative.left - this.offset.parent.left,
  1117. 0 - this.offset.relative.top - this.offset.parent.top,
  1118. $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
  1119. ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
  1120. ];
  1121. if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
  1122. var ce = $(o.containment)[0]; if(!ce) return;
  1123. var co = $(o.containment).offset();
  1124. var over = ($(ce).css("overflow") != 'hidden');
  1125. this.containment = [
  1126. co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
  1127. co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
  1128. co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
  1129. co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
  1130. ];
  1131. } else if(o.containment.constructor == Array) {
  1132. this.containment = o.containment;
  1133. }
  1134. },
  1135. _convertPositionTo: function(d, pos) {
  1136. if(!pos) pos = this.position;
  1137. var mod = d == "absolute" ? 1 : -1;
  1138. var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
  1139. return {
  1140. top: (
  1141. pos.top // The absolute mouse position
  1142. + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
  1143. + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
  1144. - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
  1145. ),
  1146. left: (
  1147. pos.left // The absolute mouse position
  1148. + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
  1149. + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
  1150. - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
  1151. )
  1152. };
  1153. },
  1154. _generatePosition: function(event) {
  1155. var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
  1156. var pageX = event.pageX;
  1157. var pageY = event.pageY;
  1158. /*
  1159. * - Position constraining -
  1160. * Constrain the position to a mix of grid, containment.
  1161. */
  1162. if(this.originalPosition) { //If we are not dragging yet, we won't check for options
  1163. if(this.containment) {
  1164. if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
  1165. if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
  1166. if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
  1167. if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
  1168. }
  1169. if(o.grid) {
  1170. var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
  1171. pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
  1172. var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
  1173. pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
  1174. }
  1175. }
  1176. return {
  1177. top: (
  1178. pageY // The absolute mouse position
  1179. - this.offset.click.top // Click offset (relative to the element)
  1180. - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
  1181. - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
  1182. + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
  1183. ),
  1184. left: (
  1185. pageX // The absolute mouse position
  1186. - this.offset.click.left // Click offset (relative to the element)
  1187. - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
  1188. - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
  1189. + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
  1190. )
  1191. };
  1192. },
  1193. _clear: function() {
  1194. this.helper.removeClass("ui-draggable-dragging");
  1195. if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove();
  1196. //if($.ui.ddmanager) $.ui.ddmanager.current = null;
  1197. this.helper = null;
  1198. this.cancelHelperRemoval = false;
  1199. },
  1200. // From now on bulk stuff - mainly helpers
  1201. _trigger: function(type, event, ui) {
  1202. ui = ui || this._uiHash();
  1203. $.ui.plugin.call(this, type, [event, ui]);
  1204. if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
  1205. return $.Widget.prototype._trigger.call(this, type, event, ui);
  1206. },
  1207. plugins: {},
  1208. _uiHash: function(event) {
  1209. return {
  1210. helper: this.helper,
  1211. position: this.position,
  1212. originalPosition: this.originalPosition,
  1213. offset: this.positionAbs
  1214. };
  1215. }
  1216. });
  1217. $.extend($.ui.draggable, {
  1218. version: "1.8.6"
  1219. });
  1220. $.ui.plugin.add("draggable", "connectToSortable", {
  1221. start: function(event, ui) {
  1222. var inst = $(this).data("draggable"), o = inst.options,
  1223. uiSortable = $.extend({}, ui, { item: inst.element });
  1224. inst.sortables = [];
  1225. $(o.connectToSortable).each(function() {
  1226. var sortable = $.data(this, 'sortable');
  1227. if (sortable && !sortable.options.disabled) {
  1228. inst.sortables.push({
  1229. instance: sortable,
  1230. shouldRevert: sortable.options.revert
  1231. });
  1232. sortable._refreshItems(); //Do a one-time refresh at start to refresh the containerCache
  1233. sortable._trigger("activate", event, uiSortable);
  1234. }
  1235. });
  1236. },
  1237. stop: function(event, ui) {
  1238. //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
  1239. var inst = $(this).data("draggable"),
  1240. uiSortable = $.extend({}, ui, { item: inst.element });
  1241. $.each(inst.sortables, function() {
  1242. if(this.instance.isOver) {
  1243. this.instance.isOver = 0;
  1244. inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
  1245. this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
  1246. //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
  1247. if(this.shouldRevert) this.instance.options.revert = true;
  1248. //Trigger the stop of the sortable
  1249. this.instance._mouseStop(event);
  1250. this.instance.options.helper = this.instance.options._helper;
  1251. //If the helper has been the original item, restore properties in the sortable
  1252. if(inst.options.helper == 'original')
  1253. this.instance.currentItem.css({ top: 'auto', left: 'auto' });
  1254. } else {
  1255. this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
  1256. this.instance._trigger("deactivate", event, uiSortable);
  1257. }
  1258. });
  1259. },
  1260. drag: function(event, ui) {
  1261. var inst = $(this).data("draggable"), self = this;
  1262. var checkPos = function(o) {
  1263. var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
  1264. var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
  1265. var itemHeight = o.height, itemWidth = o.width;
  1266. var itemTop = o.top, itemLeft = o.left;
  1267. return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);
  1268. };
  1269. $.each(inst.sortables, function(i) {
  1270. //Copy over some variables to allow calling the sortable's native _intersectsWith
  1271. this.instance.positionAbs = inst.positionAbs;
  1272. this.instance.helperProportions = inst.helperProportions;
  1273. this.instance.offset.click = inst.offset.click;
  1274. if(this.instance._intersectsWith(this.instance.containerCache)) {
  1275. //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
  1276. if(!this.instance.isOver) {
  1277. this.instance.isOver = 1;
  1278. //Now we fake the start of dragging for the sortable instance,
  1279. //by cloning the list group item, appending it to the sortable and using it as inst.currentItem
  1280. //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
  1281. this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true);
  1282. this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
  1283. this.instance.options.helper = function() { return ui.helper[0]; };
  1284. event.target = this.instance.currentItem[0];
  1285. this.instance._mouseCapture(event, true);
  1286. this.instance._mouseStart(event, true, true);
  1287. //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
  1288. this.instance.offset.click.top = inst.offset.click.top;
  1289. this.instance.offset.click.left = inst.offset.click.left;
  1290. this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
  1291. this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
  1292. inst._trigger("toSortable", event);
  1293. inst.dropped = this.instance.element; //draggable revert needs that
  1294. //hack so receive/update callbacks work (mostly)
  1295. inst.currentItem = inst.element;
  1296. this.instance.fromOutside = inst;
  1297. }
  1298. //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
  1299. if(this.instance.currentItem) this.instance._mouseDrag(event);
  1300. } else {
  1301. //If it doesn't intersect with the sortable, and it intersected before,
  1302. //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
  1303. if(this.instance.isOver) {
  1304. this.instance.isOver = 0;
  1305. this.instance.cancelHelperRemoval = true;
  1306. //Prevent reverting on this forced stop
  1307. this.instance.options.revert = false;
  1308. // The out event needs to be triggered independently
  1309. this.instance._trigger('out', event, this.instance._uiHash(this.instance));
  1310. this.instance._mouseStop(event, true);
  1311. this.instance.options.helper = this.instance.options._helper;
  1312. //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
  1313. this.instance.currentItem.remove();
  1314. if(this.instance.placeholder) this.instance.placeholder.remove();
  1315. inst._trigger("fromSortable", event);
  1316. inst.dropped = false; //draggable revert needs that
  1317. }
  1318. };
  1319. });
  1320. }
  1321. });
  1322. $.ui.plugin.add("draggable", "cursor", {
  1323. start: function(event, ui) {
  1324. var t = $('body'), o = $(this).data('draggable').options;
  1325. if (t.css("cursor")) o._cursor = t.css("cursor");
  1326. t.css("cursor", o.cursor);
  1327. },
  1328. stop: function(event, ui) {
  1329. var o = $(this).data('draggable').options;
  1330. if (o._cursor) $('body').css("cursor", o._cursor);
  1331. }
  1332. });
  1333. $.ui.plugin.add("draggable", "iframeFix", {
  1334. start: function(event, ui) {
  1335. var o = $(this).data('draggable').options;
  1336. $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
  1337. $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
  1338. .css({
  1339. width: this.offsetWidth+"px", height: this.offsetHeight+"px",
  1340. position: "absolute", opacity: "0.001", zIndex: 1000
  1341. })
  1342. .css($(this).offset())
  1343. .appendTo("body");
  1344. });
  1345. },
  1346. stop: function(event, ui) {
  1347. $("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers
  1348. }
  1349. });
  1350. $.ui.plugin.add("draggable", "opacity", {
  1351. start: function(event, ui) {
  1352. var t = $(ui.helper), o = $(this).data('draggable').options;
  1353. if(t.css("opacity")) o._opacity = t.css("opacity");
  1354. t.css('opacity', o.opacity);
  1355. },
  1356. stop: function(event, ui) {
  1357. var o = $(this).data('draggable').options;
  1358. if(o._opacity) $(ui.helper).css('opacity', o._opacity);
  1359. }
  1360. });
  1361. $.ui.plugin.add("draggable", "scroll", {
  1362. start: function(event, ui) {
  1363. var i = $(this).data("draggable");
  1364. if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
  1365. },
  1366. drag: function(event, ui) {
  1367. var i = $(this).data("draggable"), o = i.options, scrolled = false;
  1368. if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
  1369. if(!o.axis || o.axis != 'x') {
  1370. if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
  1371. i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
  1372. else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
  1373. i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
  1374. }
  1375. if(!o.axis || o.axis != 'y') {
  1376. if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
  1377. i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
  1378. else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)
  1379. i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
  1380. }
  1381. } else {
  1382. if(!o.axis || o.axis != 'x') {
  1383. if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
  1384. scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
  1385. else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
  1386. scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
  1387. }
  1388. if(!o.axis || o.axis != 'y') {
  1389. if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
  1390. scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
  1391. else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
  1392. scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
  1393. }
  1394. }
  1395. if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
  1396. $.ui.ddmanager.prepareOffsets(i, event);
  1397. }
  1398. });
  1399. $.ui.plugin.add("draggable", "snap", {
  1400. start: function(event, ui) {
  1401. var i = $(this).data("draggable"), o = i.options;
  1402. i.snapElements = [];
  1403. $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
  1404. var $t = $(this); var $o = $t.offset();
  1405. if(this != i.element[0]) i.snapElements.push({
  1406. item: this,
  1407. width: $t.outerWidth(), height: $t.outerHeight(),
  1408. top: $o.top, left: $o.left
  1409. });
  1410. });
  1411. },
  1412. drag: function(event, ui) {
  1413. var inst = $(this).data("draggable"), o = inst.options;
  1414. var d = o.snapTolerance;
  1415. var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
  1416. y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
  1417. for (var i = inst.snapElements.length - 1; i >= 0; i--){
  1418. var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
  1419. t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
  1420. //Yes, I know, this is insane ;)
  1421. if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
  1422. if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
  1423. inst.snapElements[i].snapping = false;
  1424. continue;
  1425. }
  1426. if(o.snapMode != 'inner') {
  1427. var ts = Math.abs(t - y2) <= d;
  1428. var bs = Math.abs(b - y1) <= d;
  1429. var ls = Math.abs(l - x2) <= d;
  1430. var rs = Math.abs(r - x1) <= d;
  1431. if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
  1432. if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
  1433. if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
  1434. if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
  1435. }
  1436. var first = (ts || bs || ls || rs);
  1437. if(o.snapMode != 'outer') {
  1438. var ts = Math.abs(t - y1) <= d;
  1439. var bs = Math.abs(b - y2) <= d;
  1440. var ls = Math.abs(l - x1) <= d;
  1441. var rs = Math.abs(r - x2) <= d;
  1442. if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
  1443. if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
  1444. if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
  1445. if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
  1446. }
  1447. if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
  1448. (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
  1449. inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
  1450. };
  1451. }
  1452. });
  1453. $.ui.plugin.add("draggable", "stack", {
  1454. start: function(event, ui) {
  1455. var o = $(this).data("draggable").options;
  1456. var group = $.makeArray($(o.stack)).sort(function(a,b) {
  1457. return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
  1458. });
  1459. if (!group.length) { return; }
  1460. var min = parseInt(group[0].style.zIndex) || 0;
  1461. $(group).each(function(i) {
  1462. this.style.zIndex = min + i;
  1463. });
  1464. this[0].style.zIndex = min + group.length;
  1465. }
  1466. });
  1467. $.ui.plugin.add("draggable", "zIndex", {
  1468. start: function(event, ui) {
  1469. var t = $(ui.helper), o = $(this).data("draggable").options;
  1470. if(t.css("zIndex")) o._zIndex = t.css("zIndex");
  1471. t.css('zIndex', o.zIndex);
  1472. },
  1473. stop: function(event, ui) {
  1474. var o = $(this).data("draggable").options;
  1475. if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
  1476. }
  1477. });
  1478. })(jQuery);
  1479. /*
  1480. * jQuery UI Droppable 1.8.6
  1481. *
  1482. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  1483. * Dual licensed under the MIT or GPL Version 2 licenses.
  1484. * http://jquery.org/license
  1485. *
  1486. * http://docs.jquery.com/UI/Droppables
  1487. *
  1488. * Depends:
  1489. * jquery.ui.core.js
  1490. * jquery.ui.widget.js
  1491. * jquery.ui.mouse.js
  1492. * jquery.ui.draggable.js
  1493. */
  1494. (function( $, undefined ) {
  1495. $.widget("ui.droppable", {
  1496. widgetEventPrefix: "drop",
  1497. options: {
  1498. accept: '*',
  1499. activeClass: false,
  1500. addClasses: true,
  1501. greedy: false,
  1502. hoverClass: false,
  1503. scope: 'default',
  1504. tolerance: 'intersect'
  1505. },
  1506. _create: function() {
  1507. var o = this.options, accept = o.accept;
  1508. this.isover = 0; this.isout = 1;
  1509. this.accept = $.isFunction(accept) ? accept : function(d) {
  1510. return d.is(accept);
  1511. };
  1512. //Store the droppable's proportions
  1513. this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
  1514. // Add the reference and positions to the manager
  1515. $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || [];
  1516. $.ui.ddmanager.droppables[o.scope].push(this);
  1517. (o.addClasses && this.element.addClass("ui-droppable"));
  1518. },
  1519. destroy: function() {
  1520. var drop = $.ui.ddmanager.droppables[this.options.scope];
  1521. for ( var i = 0; i < drop.length; i++ )
  1522. if ( drop[i] == this )
  1523. drop.splice(i, 1);
  1524. this.element
  1525. .removeClass("ui-droppable ui-droppable-disabled")
  1526. .removeData("droppable")
  1527. .unbind(".droppable");
  1528. return this;
  1529. },
  1530. _setOption: function(key, value) {
  1531. if(key == 'accept') {
  1532. this.accept = $.isFunction(value) ? value : function(d) {
  1533. return d.is(value);
  1534. };
  1535. }
  1536. $.Widget.prototype._setOption.apply(this, arguments);
  1537. },
  1538. _activate: function(event) {
  1539. var draggable = $.ui.ddmanager.current;
  1540. if(this.options.activeClass) this.element.addClass(this.options.activeClass);
  1541. (draggable && this._trigger('activate', event, this.ui(draggable)));
  1542. },
  1543. _deactivate: function(event) {
  1544. var draggable = $.ui.ddmanager.current;
  1545. if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
  1546. (draggable && this._trigger('deactivate', event, this.ui(draggable)));
  1547. },
  1548. _over: function(event) {
  1549. var draggable = $.ui.ddmanager.current;
  1550. if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
  1551. if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
  1552. if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
  1553. this._trigger('over', event, this.ui(draggable));
  1554. }
  1555. },
  1556. _out: function(event) {
  1557. var draggable = $.ui.ddmanager.current;
  1558. if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
  1559. if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
  1560. if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
  1561. this._trigger('out', event, this.ui(draggable));
  1562. }
  1563. },
  1564. _drop: function(event,custom) {
  1565. var draggable = custom || $.ui.ddmanager.current;
  1566. if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
  1567. var childrenIntersection = false;
  1568. this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
  1569. var inst = $.data(this, 'droppable');
  1570. if(
  1571. inst.options.greedy
  1572. && !inst.options.disabled
  1573. && inst.options.scope == draggable.options.scope
  1574. && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
  1575. && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
  1576. ) { childrenIntersection = true; return false; }
  1577. });
  1578. if(childrenIntersection) return false;
  1579. if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
  1580. if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
  1581. if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
  1582. this._trigger('drop', event, this.ui(draggable));
  1583. return this.element;
  1584. }
  1585. return false;
  1586. },
  1587. ui: function(c) {
  1588. return {
  1589. draggable: (c.currentItem || c.element),
  1590. helper: c.helper,
  1591. position: c.position,
  1592. offset: c.positionAbs
  1593. };
  1594. }
  1595. });
  1596. $.extend($.ui.droppable, {
  1597. version: "1.8.6"
  1598. });
  1599. $.ui.intersect = function(draggable, droppable, toleranceMode) {
  1600. if (!droppable.offset) return false;
  1601. var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
  1602. y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
  1603. var l = droppable.offset.left, r = l + droppable.proportions.width,
  1604. t = droppable.offset.top, b = t + droppable.proportions.height;
  1605. switch (toleranceMode) {
  1606. case 'fit':
  1607. return (l <= x1 && x2 <= r
  1608. && t <= y1 && y2 <= b);
  1609. break;
  1610. case 'intersect':
  1611. return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
  1612. && x2 - (draggable.helperProportions.width / 2) < r // Left Half
  1613. && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
  1614. && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
  1615. break;
  1616. case 'pointer':
  1617. var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
  1618. draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
  1619. isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
  1620. return isOver;
  1621. break;
  1622. case 'touch':
  1623. return (
  1624. (y1 >= t && y1 <= b) || // Top edge touching
  1625. (y2 >= t && y2 <= b) || // Bottom edge touching
  1626. (y1 < t && y2 > b) // Surrounded vertically
  1627. ) && (
  1628. (x1 >= l && x1 <= r) || // Left edge touching
  1629. (x2 >= l && x2 <= r) || // Right edge touching
  1630. (x1 < l && x2 > r) // Surrounded horizontally
  1631. );
  1632. break;
  1633. default:
  1634. return false;
  1635. break;
  1636. }
  1637. };
  1638. /*
  1639. This manager tracks offsets of draggables and droppables
  1640. */
  1641. $.ui.ddmanager = {
  1642. current: null,
  1643. droppables: { 'default': [] },
  1644. prepareOffsets: function(t, event) {
  1645. var m = $.ui.ddmanager.droppables[t.options.scope] || [];
  1646. var type = event ? event.type : null; // workaround for #2317
  1647. var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
  1648. droppablesLoop: for (var i = 0; i < m.length; i++) {
  1649. if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
  1650. for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
  1651. m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
  1652. m[i].offset = m[i].element.offset();
  1653. m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
  1654. if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
  1655. }
  1656. },
  1657. drop: function(draggable, event) {
  1658. var dropped = false;
  1659. $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
  1660. if(!this.options) return;
  1661. if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
  1662. dropped = dropped || this._drop.call(this, event);
  1663. if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
  1664. this.isout = 1; this.isover = 0;
  1665. this._deactivate.call(this, event);
  1666. }
  1667. });
  1668. return dropped;
  1669. },
  1670. drag: function(draggable, event) {
  1671. //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
  1672. if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
  1673. //Run through all droppables and check their positions based on specific tolerance options
  1674. $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
  1675. if(this.options.disabled || this.greedyChild || !this.visible) return;
  1676. var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
  1677. var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
  1678. if(!c) return;
  1679. var parentInstance;
  1680. if (this.options.greedy) {
  1681. var parent = this.element.parents(':data(droppable):eq(0)');
  1682. if (parent.length) {
  1683. parentInstance = $.data(parent[0], 'droppable');
  1684. parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
  1685. }
  1686. }
  1687. // we just moved into a greedy child
  1688. if (parentInstance && c == 'isover') {
  1689. parentInstance['isover'] = 0;
  1690. parentInstance['isout'] = 1;
  1691. parentInstance._out.call(parentInstance, event);
  1692. }
  1693. this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
  1694. this[c == "isover" ? "_over" : "_out"].call(this, event);
  1695. // we just moved out of a greedy child
  1696. if (parentInstance && c == 'isout') {
  1697. parentInstance['isout'] = 0;
  1698. parentInstance['isover'] = 1;
  1699. parentInstance._over.call(parentInstance, event);
  1700. }
  1701. });
  1702. }
  1703. };
  1704. })(jQuery);
  1705. /*
  1706. * jQuery UI Resizable 1.8.6
  1707. *
  1708. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  1709. * Dual licensed under the MIT or GPL Version 2 licenses.
  1710. * http://jquery.org/license
  1711. *
  1712. * http://docs.jquery.com/UI/Resizables
  1713. *
  1714. * Depends:
  1715. * jquery.ui.core.js
  1716. * jquery.ui.mouse.js
  1717. * jquery.ui.widget.js
  1718. */
  1719. (function( $, undefined ) {
  1720. $.widget("ui.resizable", $.ui.mouse, {
  1721. widgetEventPrefix: "resize",
  1722. options: {
  1723. alsoResize: false,
  1724. animate: false,
  1725. animateDuration: "slow",
  1726. animateEasing: "swing",
  1727. aspectRatio: false,
  1728. autoHide: false,
  1729. containment: false,
  1730. ghost: false,
  1731. grid: false,
  1732. handles: "e,s,se",
  1733. helper: false,
  1734. maxHeight: null,
  1735. maxWidth: null,
  1736. minHeight: 10,
  1737. minWidth: 10,
  1738. zIndex: 1000
  1739. },
  1740. _create: function() {
  1741. var self = this, o = this.options;
  1742. this.element.addClass("ui-resizable");
  1743. $.extend(this, {
  1744. _aspectRatio: !!(o.aspectRatio),
  1745. aspectRatio: o.aspectRatio,
  1746. originalElement: this.element,
  1747. _proportionallyResizeElements: [],
  1748. _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null
  1749. });
  1750. //Wrap the element if it cannot hold child nodes
  1751. if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
  1752. //Opera fix for relative positioning
  1753. if (/relative/.test(this.element.css('position')) && $.browser.opera)
  1754. this.element.css({ position: 'relative', top: 'auto', left: 'auto' });
  1755. //Create a wrapper element and set the wrapper to the new current internal element
  1756. this.element.wrap(
  1757. $('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({
  1758. position: this.element.css('position'),
  1759. width: this.element.outerWidth(),
  1760. height: this.element.outerHeight(),
  1761. top: this.element.css('top'),
  1762. left: this.element.css('left')
  1763. })
  1764. );
  1765. //Overwrite the original this.element
  1766. this.element = this.element.parent().data(
  1767. "resizable", this.element.data('resizable')
  1768. );
  1769. this.elementIsWrapper = true;
  1770. //Move margins to the wrapper
  1771. this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") });
  1772. this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
  1773. //Prevent Safari textarea resize
  1774. this.originalResizeStyle = this.originalElement.css('resize');
  1775. this.originalElement.css('resize', 'none');
  1776. //Push the actual element to our proportionallyResize internal array
  1777. this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' }));
  1778. // avoid IE jump (hard set the margin)
  1779. this.originalElement.css({ margin: this.originalElement.css('margin') });
  1780. // fix handlers offset
  1781. this._proportionallyResize();
  1782. }
  1783. this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' });
  1784. if(this.handles.constructor == String) {
  1785. if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw';
  1786. var n = this.handles.split(","); this.handles = {};
  1787. for(var i = 0; i < n.length; i++) {
  1788. var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle;
  1789. var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>');
  1790. // increase zIndex of sw, se, ne, nw axis
  1791. //TODO : this modifies original option
  1792. if(/sw|se|ne|nw/.test(handle)) axis.css({ zIndex: ++o.zIndex });
  1793. //TODO : What's going on here?
  1794. if ('se' == handle) {
  1795. axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');
  1796. };
  1797. //Insert into internal handles object and append to element
  1798. this.handles[handle] = '.ui-resizable-'+handle;
  1799. this.element.append(axis);
  1800. }
  1801. }
  1802. this._renderAxis = function(target) {
  1803. target = target || this.element;
  1804. for(var i in this.handles) {
  1805. if(this.handles[i].constructor == String)
  1806. this.handles[i] = $(this.handles[i], this.element).show();
  1807. //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
  1808. if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
  1809. var axis = $(this.handles[i], this.element), padWrapper = 0;
  1810. //Checking the correct pad and border
  1811. padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
  1812. //The padding type i have to apply...
  1813. var padPos = [ 'padding',
  1814. /ne|nw|n/.test(i) ? 'Top' :
  1815. /se|sw|s/.test(i) ? 'Bottom' :
  1816. /^e$/.test(i) ? 'Right' : 'Left' ].join("");
  1817. target.css(padPos, padWrapper);
  1818. this._proportionallyResize();
  1819. }
  1820. //TODO: What's that good for? There's not anything to be executed left
  1821. if(!$(this.handles[i]).length)
  1822. continue;
  1823. }
  1824. };
  1825. //TODO: make renderAxis a prototype function
  1826. this._renderAxis(this.element);
  1827. this._handles = $('.ui-resizable-handle', this.element)
  1828. .disableSelection();
  1829. //Matching axis name
  1830. this._handles.mouseover(function() {
  1831. if (!self.resizing) {
  1832. if (this.className)
  1833. var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
  1834. //Axis, default = se
  1835. self.axis = axis && axis[1] ? axis[1] : 'se';
  1836. }
  1837. });
  1838. //If we want to auto hide the elements
  1839. if (o.autoHide) {
  1840. this._handles.hide();
  1841. $(this.element)
  1842. .addClass("ui-resizable-autohide")
  1843. .hover(function() {
  1844. $(this).removeClass("ui-resizable-autohide");
  1845. self._handles.show();
  1846. },
  1847. function(){
  1848. if (!self.resizing) {
  1849. $(this).addClass("ui-resizable-autohide");
  1850. self._handles.hide();
  1851. }
  1852. });
  1853. }
  1854. //Initialize the mouse interaction
  1855. this._mouseInit();
  1856. },
  1857. destroy: function() {
  1858. this._mouseDestroy();
  1859. var _destroy = function(exp) {
  1860. $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
  1861. .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
  1862. };
  1863. //TODO: Unwrap at same DOM position
  1864. if (this.elementIsWrapper) {
  1865. _destroy(this.element);
  1866. var wrapper = this.element;
  1867. wrapper.after(
  1868. this.originalElement.css({
  1869. position: wrapper.css('position'),
  1870. width: wrapper.outerWidth(),
  1871. height: wrapper.outerHeight(),
  1872. top: wrapper.css('top'),
  1873. left: wrapper.css('left')
  1874. })
  1875. ).remove();
  1876. }
  1877. this.originalElement.css('resize', this.originalResizeStyle);
  1878. _destroy(this.originalElement);
  1879. return this;
  1880. },
  1881. _mouseCapture: function(event) {
  1882. var handle = false;
  1883. for (var i in this.handles) {
  1884. if ($(this.handles[i])[0] == event.target) {
  1885. handle = true;
  1886. }
  1887. }
  1888. return !this.options.disabled && handle;
  1889. },
  1890. _mouseStart: function(event) {
  1891. var o = this.options, iniPos = this.element.position(), el = this.element;
  1892. this.resizing = true;
  1893. this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
  1894. // bugfix for http://dev.jquery.com/ticket/1749
  1895. if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
  1896. el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left });
  1897. }
  1898. //Opera fixing relative position
  1899. if ($.browser.opera && (/relative/).test(el.css('position')))
  1900. el.css({ position: 'relative', top: 'auto', left: 'auto' });
  1901. this._renderProxy();
  1902. var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
  1903. if (o.containment) {
  1904. curleft += $(o.containment).scrollLeft() || 0;
  1905. curtop += $(o.containment).scrollTop() || 0;
  1906. }
  1907. //Store needed variables
  1908. this.offset = this.helper.offset();
  1909. this.position = { left: curleft, top: curtop };
  1910. this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
  1911. this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
  1912. this.originalPosition = { left: curleft, top: curtop };
  1913. this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
  1914. this.originalMousePosition = { left: event.pageX, top: event.pageY };
  1915. //Aspect Ratio
  1916. this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
  1917. var cursor = $('.ui-resizable-' + this.axis).css('cursor');
  1918. $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor);
  1919. el.addClass("ui-resizable-resizing");
  1920. this._propagate("start", event);
  1921. return true;
  1922. },
  1923. _mouseDrag: function(event) {
  1924. //Increase performance, avoid regex
  1925. var el = this.helper, o = this.options, props = {},
  1926. self = this, smp = this.originalMousePosition, a = this.axis;
  1927. var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0;
  1928. var trigger = this._change[a];
  1929. if (!trigger) return false;
  1930. // Calculate the attrs that will be change
  1931. var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;
  1932. if (this._aspectRatio || event.shiftKey)
  1933. data = this._updateRatio(data, event);
  1934. data = this._respectSize(data, event);
  1935. // plugins callbacks need to be called first
  1936. this._propagate("resize", event);
  1937. el.css({
  1938. top: this.position.top + "px", left: this.position.left + "px",
  1939. width: this.size.width + "px", height: this.size.height + "px"
  1940. });
  1941. if (!this._helper && this._proportionallyResizeElements.length)
  1942. this._proportionallyResize();
  1943. this._updateCache(data);
  1944. // calling the user callback at the end
  1945. this._trigger('resize', event, this.ui());
  1946. return false;
  1947. },
  1948. _mouseStop: function(event) {
  1949. this.resizing = false;
  1950. var o = this.options, self = this;
  1951. if(this._helper) {
  1952. var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
  1953. soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
  1954. soffsetw = ista ? 0 : self.sizeDiff.width;
  1955. var s = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
  1956. left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
  1957. top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
  1958. if (!o.animate)
  1959. this.element.css($.extend(s, { top: top, left: left }));
  1960. self.helper.height(self.size.height);
  1961. self.helper.width(self.size.width);
  1962. if (this._helper && !o.animate) this._proportionallyResize();
  1963. }
  1964. $('body').css('cursor', 'auto');
  1965. this.element.removeClass("ui-resizable-resizing");
  1966. this._propagate("stop", event);
  1967. if (this._helper) this.helper.remove();
  1968. return false;
  1969. },
  1970. _updateCache: function(data) {
  1971. var o = this.options;
  1972. this.offset = this.helper.offset();
  1973. if (isNumber(data.left)) this.position.left = data.left;
  1974. if (isNumber(data.top)) this.position.top = data.top;
  1975. if (isNumber(data.height)) this.size.height = data.height;
  1976. if (isNumber(data.width)) this.size.width = data.width;
  1977. },
  1978. _updateRatio: function(data, event) {
  1979. var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
  1980. if (data.height) data.width = (csize.height * this.aspectRatio);
  1981. else if (data.width) data.height = (csize.width / this.aspectRatio);
  1982. if (a == 'sw') {
  1983. data.left = cpos.left + (csize.width - data.width);
  1984. data.top = null;
  1985. }
  1986. if (a == 'nw') {
  1987. data.top = cpos.top + (csize.height - data.height);
  1988. data.left = cpos.left + (csize.width - data.width);
  1989. }
  1990. return data;
  1991. },
  1992. _respectSize: function(data, event) {
  1993. var el = this.helper, o = this.options, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,
  1994. ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
  1995. isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height);
  1996. if (isminw) data.width = o.minWidth;
  1997. if (isminh) data.height = o.minHeight;
  1998. if (ismaxw) data.width = o.maxWidth;
  1999. if (ismaxh) data.height = o.maxHeight;
  2000. var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;
  2001. var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
  2002. if (isminw && cw) data.left = dw - o.minWidth;
  2003. if (ismaxw && cw) data.left = dw - o.maxWidth;
  2004. if (isminh && ch) data.top = dh - o.minHeight;
  2005. if (ismaxh && ch) data.top = dh - o.maxHeight;
  2006. // fixing jump error on top/left - bug #2330
  2007. var isNotwh = !data.width && !data.height;
  2008. if (isNotwh && !data.left && data.top) data.top = null;
  2009. else if (isNotwh && !data.top && data.left) data.left = null;
  2010. return data;
  2011. },
  2012. _proportionallyResize: function() {
  2013. var o = this.options;
  2014. if (!this._proportionallyResizeElements.length) return;
  2015. var element = this.helper || this.element;
  2016. for (var i=0; i < this._proportionallyResizeElements.length; i++) {
  2017. var prel = this._proportionallyResizeElements[i];
  2018. if (!this.borderDif) {
  2019. var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
  2020. p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
  2021. this.borderDif = $.map(b, function(v, i) {
  2022. var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
  2023. return border + padding;
  2024. });
  2025. }
  2026. if ($.browser.msie && !(!($(element).is(':hidden') || $(element).parents(':hidden').length)))
  2027. continue;
  2028. prel.css({
  2029. height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
  2030. width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
  2031. });
  2032. };
  2033. },
  2034. _renderProxy: function() {
  2035. var el = this.element, o = this.options;
  2036. this.elementOffset = el.offset();
  2037. if(this._helper) {
  2038. this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
  2039. // fix ie6 offset TODO: This seems broken
  2040. var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
  2041. pxyoffset = ( ie6 ? 2 : -1 );
  2042. this.helper.addClass(this._helper).css({
  2043. width: this.element.outerWidth() + pxyoffset,
  2044. height: this.element.outerHeight() + pxyoffset,
  2045. position: 'absolute',
  2046. left: this.elementOffset.left - ie6offset +'px',
  2047. top: this.elementOffset.top - ie6offset +'px',
  2048. zIndex: ++o.zIndex //TODO: Don't modify option
  2049. });
  2050. this.helper
  2051. .appendTo("body")
  2052. .disableSelection();
  2053. } else {
  2054. this.helper = this.element;
  2055. }
  2056. },
  2057. _change: {
  2058. e: function(event, dx, dy) {
  2059. return { width: this.originalSize.width + dx };
  2060. },
  2061. w: function(event, dx, dy) {
  2062. var o = this.options, cs = this.originalSize, sp = this.originalPosition;
  2063. return { left: sp.left + dx, width: cs.width - dx };
  2064. },
  2065. n: function(event, dx, dy) {
  2066. var o = this.options, cs = this.originalSize, sp = this.originalPosition;
  2067. return { top: sp.top + dy, height: cs.height - dy };
  2068. },
  2069. s: function(event, dx, dy) {
  2070. return { height: this.originalSize.height + dy };
  2071. },
  2072. se: function(event, dx, dy) {
  2073. return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
  2074. },
  2075. sw: function(event, dx, dy) {
  2076. return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
  2077. },
  2078. ne: function(event, dx, dy) {
  2079. return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
  2080. },
  2081. nw: function(event, dx, dy) {
  2082. return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
  2083. }
  2084. },
  2085. _propagate: function(n, event) {
  2086. $.ui.plugin.call(this, n, [event, this.ui()]);
  2087. (n != "resize" && this._trigger(n, event, this.ui()));
  2088. },
  2089. plugins: {},
  2090. ui: function() {
  2091. return {
  2092. originalElement: this.originalElement,
  2093. element: this.element,
  2094. helper: this.helper,
  2095. position: this.position,
  2096. size: this.size,
  2097. originalSize: this.originalSize,
  2098. originalPosition: this.originalPosition
  2099. };
  2100. }
  2101. });
  2102. $.extend($.ui.resizable, {
  2103. version: "1.8.6"
  2104. });
  2105. /*
  2106. * Resizable Extensions
  2107. */
  2108. $.ui.plugin.add("resizable", "alsoResize", {
  2109. start: function (event, ui) {
  2110. var self = $(this).data("resizable"), o = self.options;
  2111. var _store = function (exp) {
  2112. $(exp).each(function() {
  2113. var el = $(this);
  2114. el.data("resizable-alsoresize", {
  2115. width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
  2116. left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10),
  2117. position: el.css('position') // to reset Opera on stop()
  2118. });
  2119. });
  2120. };
  2121. if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) {
  2122. if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
  2123. else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
  2124. }else{
  2125. _store(o.alsoResize);
  2126. }
  2127. },
  2128. resize: function (event, ui) {
  2129. var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition;
  2130. var delta = {
  2131. height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,
  2132. top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0
  2133. },
  2134. _alsoResize = function (exp, c) {
  2135. $(exp).each(function() {
  2136. var el = $(this), start = $(this).data("resizable-alsoresize"), style = {},
  2137. css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left'];
  2138. $.each(css, function (i, prop) {
  2139. var sum = (start[prop]||0) + (delta[prop]||0);
  2140. if (sum && sum >= 0)
  2141. style[prop] = sum || null;
  2142. });
  2143. // Opera fixing relative position
  2144. if ($.browser.opera && /relative/.test(el.css('position'))) {
  2145. self._revertToRelativePosition = true;
  2146. el.css({ position: 'absolute', top: 'auto', left: 'auto' });
  2147. }
  2148. el.css(style);
  2149. });
  2150. };
  2151. if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
  2152. $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
  2153. }else{
  2154. _alsoResize(o.alsoResize);
  2155. }
  2156. },
  2157. stop: function (event, ui) {
  2158. var self = $(this).data("resizable"), o = self.options;
  2159. var _reset = function (exp) {
  2160. $(exp).each(function() {
  2161. var el = $(this);
  2162. // reset position for Opera - no need to verify it was changed
  2163. el.css({ position: el.data("resizable-alsoresize").position });
  2164. });
  2165. };
  2166. if (self._revertToRelativePosition) {
  2167. self._revertToRelativePosition = false;
  2168. if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
  2169. $.each(o.alsoResize, function (exp) { _reset(exp); });
  2170. }else{
  2171. _reset(o.alsoResize);
  2172. }
  2173. }
  2174. $(this).removeData("resizable-alsoresize");
  2175. }
  2176. });
  2177. $.ui.plugin.add("resizable", "animate", {
  2178. stop: function(event, ui) {
  2179. var self = $(this).data("resizable"), o = self.options;
  2180. var pr = self._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
  2181. soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
  2182. soffsetw = ista ? 0 : self.sizeDiff.width;
  2183. var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
  2184. left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
  2185. top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
  2186. self.element.animate(
  2187. $.extend(style, top && left ? { top: top, left: left } : {}), {
  2188. duration: o.animateDuration,
  2189. easing: o.animateEasing,
  2190. step: function() {
  2191. var data = {
  2192. width: parseInt(self.element.css('width'), 10),
  2193. height: parseInt(self.element.css('height'), 10),
  2194. top: parseInt(self.element.css('top'), 10),
  2195. left: parseInt(self.element.css('left'), 10)
  2196. };
  2197. if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height });
  2198. // propagating resize, and updating values for each animation step
  2199. self._updateCache(data);
  2200. self._propagate("resize", event);
  2201. }
  2202. }
  2203. );
  2204. }
  2205. });
  2206. $.ui.plugin.add("resizable", "containment", {
  2207. start: function(event, ui) {
  2208. var self = $(this).data("resizable"), o = self.options, el = self.element;
  2209. var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
  2210. if (!ce) return;
  2211. self.containerElement = $(ce);
  2212. if (/document/.test(oc) || oc == document) {
  2213. self.containerOffset = { left: 0, top: 0 };
  2214. self.containerPosition = { left: 0, top: 0 };
  2215. self.parentData = {
  2216. element: $(document), left: 0, top: 0,
  2217. width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
  2218. };
  2219. }
  2220. // i'm a node, so compute top, left, right, bottom
  2221. else {
  2222. var element = $(ce), p = [];
  2223. $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
  2224. self.containerOffset = element.offset();
  2225. self.containerPosition = element.position();
  2226. self.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
  2227. var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width,
  2228. width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
  2229. self.parentData = {
  2230. element: ce, left: co.left, top: co.top, width: width, height: height
  2231. };
  2232. }
  2233. },
  2234. resize: function(event, ui) {
  2235. var self = $(this).data("resizable"), o = self.options,
  2236. ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position,
  2237. pRatio = self._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
  2238. if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co;
  2239. if (cp.left < (self._helper ? co.left : 0)) {
  2240. self.size.width = self.size.width + (self._helper ? (self.position.left - co.left) : (self.position.left - cop.left));
  2241. if (pRatio) self.size.height = self.size.width / o.aspectRatio;
  2242. self.position.left = o.helper ? co.left : 0;
  2243. }
  2244. if (cp.top < (self._helper ? co.top : 0)) {
  2245. self.size.height = self.size.height + (self._helper ? (self.position.top - co.top) : self.position.top);
  2246. if (pRatio) self.size.width = self.size.height * o.aspectRatio;
  2247. self.position.top = self._helper ? co.top : 0;
  2248. }
  2249. self.offset.left = self.parentData.left+self.position.left;
  2250. self.offset.top = self.parentData.top+self.position.top;
  2251. var woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ),
  2252. hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height );
  2253. var isParent = self.containerElement.get(0) == self.element.parent().get(0),
  2254. isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position'));
  2255. if(isParent && isOffsetRelative) woset -= self.parentData.left;
  2256. if (woset + self.size.width >= self.parentData.width) {
  2257. self.size.width = self.parentData.width - woset;
  2258. if (pRatio) self.size.height = self.size.width / self.aspectRatio;
  2259. }
  2260. if (hoset + self.size.height >= self.parentData.height) {
  2261. self.size.height = self.parentData.height - hoset;
  2262. if (pRatio) self.size.width = self.size.height * self.aspectRatio;
  2263. }
  2264. },
  2265. stop: function(event, ui){
  2266. var self = $(this).data("resizable"), o = self.options, cp = self.position,
  2267. co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement;
  2268. var helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height;
  2269. if (self._helper && !o.animate && (/relative/).test(ce.css('position')))
  2270. $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
  2271. if (self._helper && !o.animate && (/static/).test(ce.css('position')))
  2272. $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
  2273. }
  2274. });
  2275. $.ui.plugin.add("resizable", "ghost", {
  2276. start: function(event, ui) {
  2277. var self = $(this).data("resizable"), o = self.options, cs = self.size;
  2278. self.ghost = self.originalElement.clone();
  2279. self.ghost
  2280. .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
  2281. .addClass('ui-resizable-ghost')
  2282. .addClass(typeof o.ghost == 'string' ? o.ghost : '');
  2283. self.ghost.appendTo(self.helper);
  2284. },
  2285. resize: function(event, ui){
  2286. var self = $(this).data("resizable"), o = self.options;
  2287. if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });
  2288. },
  2289. stop: function(event, ui){
  2290. var self = $(this).data("resizable"), o = self.options;
  2291. if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));
  2292. }
  2293. });
  2294. $.ui.plugin.add("resizable", "grid", {
  2295. resize: function(event, ui) {
  2296. var self = $(this).data("resizable"), o = self.options, cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || event.shiftKey;
  2297. o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
  2298. var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1);
  2299. if (/^(se|s|e)$/.test(a)) {
  2300. self.size.width = os.width + ox;
  2301. self.size.height = os.height + oy;
  2302. }
  2303. else if (/^(ne)$/.test(a)) {
  2304. self.size.width = os.width + ox;
  2305. self.size.height = os.height + oy;
  2306. self.position.top = op.top - oy;
  2307. }
  2308. else if (/^(sw)$/.test(a)) {
  2309. self.size.width = os.width + ox;
  2310. self.size.height = os.height + oy;
  2311. self.position.left = op.left - ox;
  2312. }
  2313. else {
  2314. self.size.width = os.width + ox;
  2315. self.size.height = os.height + oy;
  2316. self.position.top = op.top - oy;
  2317. self.position.left = op.left - ox;
  2318. }
  2319. }
  2320. });
  2321. var num = function(v) {
  2322. return parseInt(v, 10) || 0;
  2323. };
  2324. var isNumber = function(value) {
  2325. return !isNaN(parseInt(value, 10));
  2326. };
  2327. })(jQuery);
  2328. /*
  2329. * jQuery UI Selectable 1.8.6
  2330. *
  2331. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  2332. * Dual licensed under the MIT or GPL Version 2 licenses.
  2333. * http://jquery.org/license
  2334. *
  2335. * http://docs.jquery.com/UI/Selectables
  2336. *
  2337. * Depends:
  2338. * jquery.ui.core.js
  2339. * jquery.ui.mouse.js
  2340. * jquery.ui.widget.js
  2341. */
  2342. (function( $, undefined ) {
  2343. $.widget("ui.selectable", $.ui.mouse, {
  2344. options: {
  2345. appendTo: 'body',
  2346. autoRefresh: true,
  2347. distance: 0,
  2348. filter: '*',
  2349. tolerance: 'touch'
  2350. },
  2351. _create: function() {
  2352. var self = this;
  2353. this.element.addClass("ui-selectable");
  2354. this.dragged = false;
  2355. // cache selectee children based on filter
  2356. var selectees;
  2357. this.refresh = function() {
  2358. selectees = $(self.options.filter, self.element[0]);
  2359. selectees.each(function() {
  2360. var $this = $(this);
  2361. var pos = $this.offset();
  2362. $.data(this, "selectable-item", {
  2363. element: this,
  2364. $element: $this,
  2365. left: pos.left,
  2366. top: pos.top,
  2367. right: pos.left + $this.outerWidth(),
  2368. bottom: pos.top + $this.outerHeight(),
  2369. startselected: false,
  2370. selected: $this.hasClass('ui-selected'),
  2371. selecting: $this.hasClass('ui-selecting'),
  2372. unselecting: $this.hasClass('ui-unselecting')
  2373. });
  2374. });
  2375. };
  2376. this.refresh();
  2377. this.selectees = selectees.addClass("ui-selectee");
  2378. this._mouseInit();
  2379. this.helper = $("<div class='ui-selectable-helper'></div>");
  2380. },
  2381. destroy: function() {
  2382. this.selectees
  2383. .removeClass("ui-selectee")
  2384. .removeData("selectable-item");
  2385. this.element
  2386. .removeClass("ui-selectable ui-selectable-disabled")
  2387. .removeData("selectable")
  2388. .unbind(".selectable");
  2389. this._mouseDestroy();
  2390. return this;
  2391. },
  2392. _mouseStart: function(event) {
  2393. var self = this;
  2394. this.opos = [event.pageX, event.pageY];
  2395. if (this.options.disabled)
  2396. return;
  2397. var options = this.options;
  2398. this.selectees = $(options.filter, this.element[0]);
  2399. this._trigger("start", event);
  2400. $(options.appendTo).append(this.helper);
  2401. // position helper (lasso)
  2402. this.helper.css({
  2403. "left": event.clientX,
  2404. "top": event.clientY,
  2405. "width": 0,
  2406. "height": 0
  2407. });
  2408. if (options.autoRefresh) {
  2409. this.refresh();
  2410. }
  2411. this.selectees.filter('.ui-selected').each(function() {
  2412. var selectee = $.data(this, "selectable-item");
  2413. selectee.startselected = true;
  2414. if (!event.metaKey) {
  2415. selectee.$element.removeClass('ui-selected');
  2416. selectee.selected = false;
  2417. selectee.$element.addClass('ui-unselecting');
  2418. selectee.unselecting = true;
  2419. // selectable UNSELECTING callback
  2420. self._trigger("unselecting", event, {
  2421. unselecting: selectee.element
  2422. });
  2423. }
  2424. });
  2425. $(event.target).parents().andSelf().each(function() {
  2426. var selectee = $.data(this, "selectable-item");
  2427. if (selectee) {
  2428. var doSelect = !event.metaKey || !selectee.$element.hasClass('ui-selected');
  2429. selectee.$element
  2430. .removeClass(doSelect ? "ui-unselecting" : "ui-selected")
  2431. .addClass(doSelect ? "ui-selecting" : "ui-unselecting");
  2432. selectee.unselecting = !doSelect;
  2433. selectee.selecting = doSelect;
  2434. selectee.selected = doSelect;
  2435. // selectable (UN)SELECTING callback
  2436. if (doSelect) {
  2437. self._trigger("selecting", event, {
  2438. selecting: selectee.element
  2439. });
  2440. } else {
  2441. self._trigger("unselecting", event, {
  2442. unselecting: selectee.element
  2443. });
  2444. }
  2445. return false;
  2446. }
  2447. });
  2448. },
  2449. _mouseDrag: function(event) {
  2450. var self = this;
  2451. this.dragged = true;
  2452. if (this.options.disabled)
  2453. return;
  2454. var options = this.options;
  2455. var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY;
  2456. if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }
  2457. if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }
  2458. this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});
  2459. this.selectees.each(function() {
  2460. var selectee = $.data(this, "selectable-item");
  2461. //prevent helper from being selected if appendTo: selectable
  2462. if (!selectee || selectee.element == self.element[0])
  2463. return;
  2464. var hit = false;
  2465. if (options.tolerance == 'touch') {
  2466. hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
  2467. } else if (options.tolerance == 'fit') {
  2468. hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
  2469. }
  2470. if (hit) {
  2471. // SELECT
  2472. if (selectee.selected) {
  2473. selectee.$element.removeClass('ui-selected');
  2474. selectee.selected = false;
  2475. }
  2476. if (selectee.unselecting) {
  2477. selectee.$element.removeClass('ui-unselecting');
  2478. selectee.unselecting = false;
  2479. }
  2480. if (!selectee.selecting) {
  2481. selectee.$element.addClass('ui-selecting');
  2482. selectee.selecting = true;
  2483. // selectable SELECTING callback
  2484. self._trigger("selecting", event, {
  2485. selecting: selectee.element
  2486. });
  2487. }
  2488. } else {
  2489. // UNSELECT
  2490. if (selectee.selecting) {
  2491. if (event.metaKey && selectee.startselected) {
  2492. selectee.$element.removeClass('ui-selecting');
  2493. selectee.selecting = false;
  2494. selectee.$element.addClass('ui-selected');
  2495. selectee.selected = true;
  2496. } else {
  2497. selectee.$element.removeClass('ui-selecting');
  2498. selectee.selecting = false;
  2499. if (selectee.startselected) {
  2500. selectee.$element.addClass('ui-unselecting');
  2501. selectee.unselecting = true;
  2502. }
  2503. // selectable UNSELECTING callback
  2504. self._trigger("unselecting", event, {
  2505. unselecting: selectee.element
  2506. });
  2507. }
  2508. }
  2509. if (selectee.selected) {
  2510. if (!event.metaKey && !selectee.startselected) {
  2511. selectee.$element.removeClass('ui-selected');
  2512. selectee.selected = false;
  2513. selectee.$element.addClass('ui-unselecting');
  2514. selectee.unselecting = true;
  2515. // selectable UNSELECTING callback
  2516. self._trigger("unselecting", event, {
  2517. unselecting: selectee.element
  2518. });
  2519. }
  2520. }
  2521. }
  2522. });
  2523. return false;
  2524. },
  2525. _mouseStop: function(event) {
  2526. var self = this;
  2527. this.dragged = false;
  2528. var options = this.options;
  2529. $('.ui-unselecting', this.element[0]).each(function() {
  2530. var selectee = $.data(this, "selectable-item");
  2531. selectee.$element.removeClass('ui-unselecting');
  2532. selectee.unselecting = false;
  2533. selectee.startselected = false;
  2534. self._trigger("unselected", event, {
  2535. unselected: selectee.element
  2536. });
  2537. });
  2538. $('.ui-selecting', this.element[0]).each(function() {
  2539. var selectee = $.data(this, "selectable-item");
  2540. selectee.$element.removeClass('ui-selecting').addClass('ui-selected');
  2541. selectee.selecting = false;
  2542. selectee.selected = true;
  2543. selectee.startselected = true;
  2544. self._trigger("selected", event, {
  2545. selected: selectee.element
  2546. });
  2547. });
  2548. this._trigger("stop", event);
  2549. this.helper.remove();
  2550. return false;
  2551. }
  2552. });
  2553. $.extend($.ui.selectable, {
  2554. version: "1.8.6"
  2555. });
  2556. })(jQuery);
  2557. /*
  2558. * jQuery UI Sortable 1.8.6
  2559. *
  2560. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  2561. * Dual licensed under the MIT or GPL Version 2 licenses.
  2562. * http://jquery.org/license
  2563. *
  2564. * http://docs.jquery.com/UI/Sortables
  2565. *
  2566. * Depends:
  2567. * jquery.ui.core.js
  2568. * jquery.ui.mouse.js
  2569. * jquery.ui.widget.js
  2570. */
  2571. (function( $, undefined ) {
  2572. $.widget("ui.sortable", $.ui.mouse, {
  2573. widgetEventPrefix: "sort",
  2574. options: {
  2575. appendTo: "parent",
  2576. axis: false,
  2577. connectWith: false,
  2578. containment: false,
  2579. cursor: 'auto',
  2580. cursorAt: false,
  2581. dropOnEmpty: true,
  2582. forcePlaceholderSize: false,
  2583. forceHelperSize: false,
  2584. grid: false,
  2585. handle: false,
  2586. helper: "original",
  2587. items: '> *',
  2588. opacity: false,
  2589. placeholder: false,
  2590. revert: false,
  2591. scroll: true,
  2592. scrollSensitivity: 20,
  2593. scrollSpeed: 20,
  2594. scope: "default",
  2595. tolerance: "intersect",
  2596. zIndex: 1000
  2597. },
  2598. _create: function() {
  2599. var o = this.options;
  2600. this.containerCache = {};
  2601. this.element.addClass("ui-sortable");
  2602. //Get the items
  2603. this.refresh();
  2604. //Let's determine if the items are floating
  2605. this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false;
  2606. //Let's determine the parent's offset
  2607. this.offset = this.element.offset();
  2608. //Initialize mouse events for interaction
  2609. this._mouseInit();
  2610. },
  2611. destroy: function() {
  2612. this.element
  2613. .removeClass("ui-sortable ui-sortable-disabled")
  2614. .removeData("sortable")
  2615. .unbind(".sortable");
  2616. this._mouseDestroy();
  2617. for ( var i = this.items.length - 1; i >= 0; i-- )
  2618. this.items[i].item.removeData("sortable-item");
  2619. return this;
  2620. },
  2621. _setOption: function(key, value){
  2622. if ( key === "disabled" ) {
  2623. this.options[ key ] = value;
  2624. this.widget()
  2625. [ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" );
  2626. } else {
  2627. // Don't call widget base _setOption for disable as it adds ui-state-disabled class
  2628. $.Widget.prototype._setOption.apply(this, arguments);
  2629. }
  2630. },
  2631. _mouseCapture: function(event, overrideHandle) {
  2632. if (this.reverting) {
  2633. return false;
  2634. }
  2635. if(this.options.disabled || this.options.type == 'static') return false;
  2636. //We have to refresh the items data once first
  2637. this._refreshItems(event);
  2638. //Find out if the clicked node (or one of its parents) is a actual item in this.items
  2639. var currentItem = null, self = this, nodes = $(event.target).parents().each(function() {
  2640. if($.data(this, 'sortable-item') == self) {
  2641. currentItem = $(this);
  2642. return false;
  2643. }
  2644. });
  2645. if($.data(event.target, 'sortable-item') == self) currentItem = $(event.target);
  2646. if(!currentItem) return false;
  2647. if(this.options.handle && !overrideHandle) {
  2648. var validHandle = false;
  2649. $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; });
  2650. if(!validHandle) return false;
  2651. }
  2652. this.currentItem = currentItem;
  2653. this._removeCurrentsFromItems();
  2654. return true;
  2655. },
  2656. _mouseStart: function(event, overrideHandle, noActivation) {
  2657. var o = this.options, self = this;
  2658. this.currentContainer = this;
  2659. //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
  2660. this.refreshPositions();
  2661. //Create and append the visible helper
  2662. this.helper = this._createHelper(event);
  2663. //Cache the helper size
  2664. this._cacheHelperProportions();
  2665. /*
  2666. * - Position generation -
  2667. * This block generates everything position related - it's the core of draggables.
  2668. */
  2669. //Cache the margins of the original element
  2670. this._cacheMargins();
  2671. //Get the next scrolling parent
  2672. this.scrollParent = this.helper.scrollParent();
  2673. //The element's absolute position on the page minus margins
  2674. this.offset = this.currentItem.offset();
  2675. this.offset = {
  2676. top: this.offset.top - this.margins.top,
  2677. left: this.offset.left - this.margins.left
  2678. };
  2679. // Only after we got the offset, we can change the helper's position to absolute
  2680. // TODO: Still need to figure out a way to make relative sorting possible
  2681. this.helper.css("position", "absolute");
  2682. this.cssPosition = this.helper.css("position");
  2683. $.extend(this.offset, {
  2684. click: { //Where the click happened, relative to the element
  2685. left: event.pageX - this.offset.left,
  2686. top: event.pageY - this.offset.top
  2687. },
  2688. parent: this._getParentOffset(),
  2689. relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
  2690. });
  2691. //Generate the original position
  2692. this.originalPosition = this._generatePosition(event);
  2693. this.originalPageX = event.pageX;
  2694. this.originalPageY = event.pageY;
  2695. //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
  2696. (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
  2697. //Cache the former DOM position
  2698. this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
  2699. //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
  2700. if(this.helper[0] != this.currentItem[0]) {
  2701. this.currentItem.hide();
  2702. }
  2703. //Create the placeholder
  2704. this._createPlaceholder();
  2705. //Set a containment if given in the options
  2706. if(o.containment)
  2707. this._setContainment();
  2708. if(o.cursor) { // cursor option
  2709. if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor");
  2710. $('body').css("cursor", o.cursor);
  2711. }
  2712. if(o.opacity) { // opacity option
  2713. if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity");
  2714. this.helper.css("opacity", o.opacity);
  2715. }
  2716. if(o.zIndex) { // zIndex option
  2717. if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex");
  2718. this.helper.css("zIndex", o.zIndex);
  2719. }
  2720. //Prepare scrolling
  2721. if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML')
  2722. this.overflowOffset = this.scrollParent.offset();
  2723. //Call callbacks
  2724. this._trigger("start", event, this._uiHash());
  2725. //Recache the helper size
  2726. if(!this._preserveHelperProportions)
  2727. this._cacheHelperProportions();
  2728. //Post 'activate' events to possible containers
  2729. if(!noActivation) {
  2730. for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, self._uiHash(this)); }
  2731. }
  2732. //Prepare possible droppables
  2733. if($.ui.ddmanager)
  2734. $.ui.ddmanager.current = this;
  2735. if ($.ui.ddmanager && !o.dropBehaviour)
  2736. $.ui.ddmanager.prepareOffsets(this, event);
  2737. this.dragging = true;
  2738. this.helper.addClass("ui-sortable-helper");
  2739. this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
  2740. return true;
  2741. },
  2742. _mouseDrag: function(event) {
  2743. //Compute the helpers position
  2744. this.position = this._generatePosition(event);
  2745. this.positionAbs = this._convertPositionTo("absolute");
  2746. if (!this.lastPositionAbs) {
  2747. this.lastPositionAbs = this.positionAbs;
  2748. }
  2749. //Do scrolling
  2750. if(this.options.scroll) {
  2751. var o = this.options, scrolled = false;
  2752. if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
  2753. if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
  2754. this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
  2755. else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
  2756. this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
  2757. if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
  2758. this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
  2759. else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
  2760. this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
  2761. } else {
  2762. if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
  2763. scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
  2764. else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
  2765. scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
  2766. if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
  2767. scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
  2768. else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
  2769. scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
  2770. }
  2771. if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
  2772. $.ui.ddmanager.prepareOffsets(this, event);
  2773. }
  2774. //Regenerate the absolute position used for position checks
  2775. this.positionAbs = this._convertPositionTo("absolute");
  2776. //Set the helper position
  2777. if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
  2778. if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
  2779. //Rearrange
  2780. for (var i = this.items.length - 1; i >= 0; i--) {
  2781. //Cache variables and intersection, continue if no intersection
  2782. var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
  2783. if (!intersection) continue;
  2784. if(itemElement != this.currentItem[0] //cannot intersect with itself
  2785. && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
  2786. && !$.ui.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
  2787. && (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true)
  2788. //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
  2789. ) {
  2790. this.direction = intersection == 1 ? "down" : "up";
  2791. if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
  2792. this._rearrange(event, item);
  2793. } else {
  2794. break;
  2795. }
  2796. this._trigger("change", event, this._uiHash());
  2797. break;
  2798. }
  2799. }
  2800. //Post events to containers
  2801. this._contactContainers(event);
  2802. //Interconnect with droppables
  2803. if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
  2804. //Call callbacks
  2805. this._trigger('sort', event, this._uiHash());
  2806. this.lastPositionAbs = this.positionAbs;
  2807. return false;
  2808. },
  2809. _mouseStop: function(event, noPropagation) {
  2810. if(!event) return;
  2811. //If we are using droppables, inform the manager about the drop
  2812. if ($.ui.ddmanager && !this.options.dropBehaviour)
  2813. $.ui.ddmanager.drop(this, event);
  2814. if(this.options.revert) {
  2815. var self = this;
  2816. var cur = self.placeholder.offset();
  2817. self.reverting = true;
  2818. $(this.helper).animate({
  2819. left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
  2820. top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
  2821. }, parseInt(this.options.revert, 10) || 500, function() {
  2822. self._clear(event);
  2823. });
  2824. } else {
  2825. this._clear(event, noPropagation);
  2826. }
  2827. return false;
  2828. },
  2829. cancel: function() {
  2830. var self = this;
  2831. if(this.dragging) {
  2832. this._mouseUp();
  2833. if(this.options.helper == "original")
  2834. this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
  2835. else
  2836. this.currentItem.show();
  2837. //Post deactivating events to containers
  2838. for (var i = this.containers.length - 1; i >= 0; i--){
  2839. this.containers[i]._trigger("deactivate", null, self._uiHash(this));
  2840. if(this.containers[i].containerCache.over) {
  2841. this.containers[i]._trigger("out", null, self._uiHash(this));
  2842. this.containers[i].containerCache.over = 0;
  2843. }
  2844. }
  2845. }
  2846. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
  2847. if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  2848. if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
  2849. $.extend(this, {
  2850. helper: null,
  2851. dragging: false,
  2852. reverting: false,
  2853. _noFinalSort: null
  2854. });
  2855. if(this.domPosition.prev) {
  2856. $(this.domPosition.prev).after(this.currentItem);
  2857. } else {
  2858. $(this.domPosition.parent).prepend(this.currentItem);
  2859. }
  2860. return this;
  2861. },
  2862. serialize: function(o) {
  2863. var items = this._getItemsAsjQuery(o && o.connected);
  2864. var str = []; o = o || {};
  2865. $(items).each(function() {
  2866. var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
  2867. if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));
  2868. });
  2869. if(!str.length && o.key) {
  2870. str.push(o.key + '=');
  2871. }
  2872. return str.join('&');
  2873. },
  2874. toArray: function(o) {
  2875. var items = this._getItemsAsjQuery(o && o.connected);
  2876. var ret = []; o = o || {};
  2877. items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); });
  2878. return ret;
  2879. },
  2880. /* Be careful with the following core functions */
  2881. _intersectsWith: function(item) {
  2882. var x1 = this.positionAbs.left,
  2883. x2 = x1 + this.helperProportions.width,
  2884. y1 = this.positionAbs.top,
  2885. y2 = y1 + this.helperProportions.height;
  2886. var l = item.left,
  2887. r = l + item.width,
  2888. t = item.top,
  2889. b = t + item.height;
  2890. var dyClick = this.offset.click.top,
  2891. dxClick = this.offset.click.left;
  2892. var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;
  2893. if( this.options.tolerance == "pointer"
  2894. || this.options.forcePointerForContainers
  2895. || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])
  2896. ) {
  2897. return isOverElement;
  2898. } else {
  2899. return (l < x1 + (this.helperProportions.width / 2) // Right Half
  2900. && x2 - (this.helperProportions.width / 2) < r // Left Half
  2901. && t < y1 + (this.helperProportions.height / 2) // Bottom Half
  2902. && y2 - (this.helperProportions.height / 2) < b ); // Top Half
  2903. }
  2904. },
  2905. _intersectsWithPointer: function(item) {
  2906. var isOverElementHeight = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
  2907. isOverElementWidth = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
  2908. isOverElement = isOverElementHeight && isOverElementWidth,
  2909. verticalDirection = this._getDragVerticalDirection(),
  2910. horizontalDirection = this._getDragHorizontalDirection();
  2911. if (!isOverElement)
  2912. return false;
  2913. return this.floating ?
  2914. ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 )
  2915. : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) );
  2916. },
  2917. _intersectsWithSides: function(item) {
  2918. var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
  2919. isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
  2920. verticalDirection = this._getDragVerticalDirection(),
  2921. horizontalDirection = this._getDragHorizontalDirection();
  2922. if (this.floating && horizontalDirection) {
  2923. return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
  2924. } else {
  2925. return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
  2926. }
  2927. },
  2928. _getDragVerticalDirection: function() {
  2929. var delta = this.positionAbs.top - this.lastPositionAbs.top;
  2930. return delta != 0 && (delta > 0 ? "down" : "up");
  2931. },
  2932. _getDragHorizontalDirection: function() {
  2933. var delta = this.positionAbs.left - this.lastPositionAbs.left;
  2934. return delta != 0 && (delta > 0 ? "right" : "left");
  2935. },
  2936. refresh: function(event) {
  2937. this._refreshItems(event);
  2938. this.refreshPositions();
  2939. return this;
  2940. },
  2941. _connectWith: function() {
  2942. var options = this.options;
  2943. return options.connectWith.constructor == String
  2944. ? [options.connectWith]
  2945. : options.connectWith;
  2946. },
  2947. _getItemsAsjQuery: function(connected) {
  2948. var self = this;
  2949. var items = [];
  2950. var queries = [];
  2951. var connectWith = this._connectWith();
  2952. if(connectWith && connected) {
  2953. for (var i = connectWith.length - 1; i >= 0; i--){
  2954. var cur = $(connectWith[i]);
  2955. for (var j = cur.length - 1; j >= 0; j--){
  2956. var inst = $.data(cur[j], 'sortable');
  2957. if(inst && inst != this && !inst.options.disabled) {
  2958. queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]);
  2959. }
  2960. };
  2961. };
  2962. }
  2963. queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]);
  2964. for (var i = queries.length - 1; i >= 0; i--){
  2965. queries[i][0].each(function() {
  2966. items.push(this);
  2967. });
  2968. };
  2969. return $(items);
  2970. },
  2971. _removeCurrentsFromItems: function() {
  2972. var list = this.currentItem.find(":data(sortable-item)");
  2973. for (var i=0; i < this.items.length; i++) {
  2974. for (var j=0; j < list.length; j++) {
  2975. if(list[j] == this.items[i].item[0])
  2976. this.items.splice(i,1);
  2977. };
  2978. };
  2979. },
  2980. _refreshItems: function(event) {
  2981. this.items = [];
  2982. this.containers = [this];
  2983. var items = this.items;
  2984. var self = this;
  2985. var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
  2986. var connectWith = this._connectWith();
  2987. if(connectWith) {
  2988. for (var i = connectWith.length - 1; i >= 0; i--){
  2989. var cur = $(connectWith[i]);
  2990. for (var j = cur.length - 1; j >= 0; j--){
  2991. var inst = $.data(cur[j], 'sortable');
  2992. if(inst && inst != this && !inst.options.disabled) {
  2993. queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
  2994. this.containers.push(inst);
  2995. }
  2996. };
  2997. };
  2998. }
  2999. for (var i = queries.length - 1; i >= 0; i--) {
  3000. var targetData = queries[i][1];
  3001. var _queries = queries[i][0];
  3002. for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) {
  3003. var item = $(_queries[j]);
  3004. item.data('sortable-item', targetData); // Data for target checking (mouse manager)
  3005. items.push({
  3006. item: item,
  3007. instance: targetData,
  3008. width: 0, height: 0,
  3009. left: 0, top: 0
  3010. });
  3011. };
  3012. };
  3013. },
  3014. refreshPositions: function(fast) {
  3015. //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
  3016. if(this.offsetParent && this.helper) {
  3017. this.offset.parent = this._getParentOffset();
  3018. }
  3019. for (var i = this.items.length - 1; i >= 0; i--){
  3020. var item = this.items[i];
  3021. var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
  3022. if (!fast) {
  3023. item.width = t.outerWidth();
  3024. item.height = t.outerHeight();
  3025. }
  3026. var p = t.offset();
  3027. item.left = p.left;
  3028. item.top = p.top;
  3029. };
  3030. if(this.options.custom && this.options.custom.refreshContainers) {
  3031. this.options.custom.refreshContainers.call(this);
  3032. } else {
  3033. for (var i = this.containers.length - 1; i >= 0; i--){
  3034. var p = this.containers[i].element.offset();
  3035. this.containers[i].containerCache.left = p.left;
  3036. this.containers[i].containerCache.top = p.top;
  3037. this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
  3038. this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
  3039. };
  3040. }
  3041. return this;
  3042. },
  3043. _createPlaceholder: function(that) {
  3044. var self = that || this, o = self.options;
  3045. if(!o.placeholder || o.placeholder.constructor == String) {
  3046. var className = o.placeholder;
  3047. o.placeholder = {
  3048. element: function() {
  3049. var el = $(document.createElement(self.currentItem[0].nodeName))
  3050. .addClass(className || self.currentItem[0].className+" ui-sortable-placeholder")
  3051. .removeClass("ui-sortable-helper")[0];
  3052. if(!className)
  3053. el.style.visibility = "hidden";
  3054. return el;
  3055. },
  3056. update: function(container, p) {
  3057. // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
  3058. // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
  3059. if(className && !o.forcePlaceholderSize) return;
  3060. //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
  3061. if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); };
  3062. if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); };
  3063. }
  3064. };
  3065. }
  3066. //Create the placeholder
  3067. self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem));
  3068. //Append it after the actual current item
  3069. self.currentItem.after(self.placeholder);
  3070. //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
  3071. o.placeholder.update(self, self.placeholder);
  3072. },
  3073. _contactContainers: function(event) {
  3074. // get innermost container that intersects with item
  3075. var innermostContainer = null, innermostIndex = null;
  3076. for (var i = this.containers.length - 1; i >= 0; i--){
  3077. // never consider a container that's located within the item itself
  3078. if($.ui.contains(this.currentItem[0], this.containers[i].element[0]))
  3079. continue;
  3080. if(this._intersectsWith(this.containers[i].containerCache)) {
  3081. // if we've already found a container and it's more "inner" than this, then continue
  3082. if(innermostContainer && $.ui.contains(this.containers[i].element[0], innermostContainer.element[0]))
  3083. continue;
  3084. innermostContainer = this.containers[i];
  3085. innermostIndex = i;
  3086. } else {
  3087. // container doesn't intersect. trigger "out" event if necessary
  3088. if(this.containers[i].containerCache.over) {
  3089. this.containers[i]._trigger("out", event, this._uiHash(this));
  3090. this.containers[i].containerCache.over = 0;
  3091. }
  3092. }
  3093. }
  3094. // if no intersecting containers found, return
  3095. if(!innermostContainer) return;
  3096. // move the item into the container if it's not there already
  3097. if(this.containers.length === 1) {
  3098. this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
  3099. this.containers[innermostIndex].containerCache.over = 1;
  3100. } else if(this.currentContainer != this.containers[innermostIndex]) {
  3101. //When entering a new container, we will find the item with the least distance and append our item near it
  3102. var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top'];
  3103. for (var j = this.items.length - 1; j >= 0; j--) {
  3104. if(!$.ui.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
  3105. var cur = this.items[j][this.containers[innermostIndex].floating ? 'left' : 'top'];
  3106. if(Math.abs(cur - base) < dist) {
  3107. dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
  3108. }
  3109. }
  3110. if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
  3111. return;
  3112. this.currentContainer = this.containers[innermostIndex];
  3113. itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
  3114. this._trigger("change", event, this._uiHash());
  3115. this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
  3116. //Update the placeholder
  3117. this.options.placeholder.update(this.currentContainer, this.placeholder);
  3118. this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
  3119. this.containers[innermostIndex].containerCache.over = 1;
  3120. }
  3121. },
  3122. _createHelper: function(event) {
  3123. var o = this.options;
  3124. var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem);
  3125. if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already
  3126. $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
  3127. if(helper[0] == this.currentItem[0])
  3128. this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
  3129. if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width());
  3130. if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height());
  3131. return helper;
  3132. },
  3133. _adjustOffsetFromHelper: function(obj) {
  3134. if (typeof obj == 'string') {
  3135. obj = obj.split(' ');
  3136. }
  3137. if ($.isArray(obj)) {
  3138. obj = {left: +obj[0], top: +obj[1] || 0};
  3139. }
  3140. if ('left' in obj) {
  3141. this.offset.click.left = obj.left + this.margins.left;
  3142. }
  3143. if ('right' in obj) {
  3144. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  3145. }
  3146. if ('top' in obj) {
  3147. this.offset.click.top = obj.top + this.margins.top;
  3148. }
  3149. if ('bottom' in obj) {
  3150. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  3151. }
  3152. },
  3153. _getParentOffset: function() {
  3154. //Get the offsetParent and cache its position
  3155. this.offsetParent = this.helper.offsetParent();
  3156. var po = this.offsetParent.offset();
  3157. // This is a special case where we need to modify a offset calculated on start, since the following happened:
  3158. // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
  3159. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
  3160. // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
  3161. if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
  3162. po.left += this.scrollParent.scrollLeft();
  3163. po.top += this.scrollParent.scrollTop();
  3164. }
  3165. if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
  3166. || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
  3167. po = { top: 0, left: 0 };
  3168. return {
  3169. top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
  3170. left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
  3171. };
  3172. },
  3173. _getRelativeOffset: function() {
  3174. if(this.cssPosition == "relative") {
  3175. var p = this.currentItem.position();
  3176. return {
  3177. top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
  3178. left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
  3179. };
  3180. } else {
  3181. return { top: 0, left: 0 };
  3182. }
  3183. },
  3184. _cacheMargins: function() {
  3185. this.margins = {
  3186. left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
  3187. top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
  3188. };
  3189. },
  3190. _cacheHelperProportions: function() {
  3191. this.helperProportions = {
  3192. width: this.helper.outerWidth(),
  3193. height: this.helper.outerHeight()
  3194. };
  3195. },
  3196. _setContainment: function() {
  3197. var o = this.options;
  3198. if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
  3199. if(o.containment == 'document' || o.containment == 'window') this.containment = [
  3200. 0 - this.offset.relative.left - this.offset.parent.left,
  3201. 0 - this.offset.relative.top - this.offset.parent.top,
  3202. $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
  3203. ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
  3204. ];
  3205. if(!(/^(document|window|parent)$/).test(o.containment)) {
  3206. var ce = $(o.containment)[0];
  3207. var co = $(o.containment).offset();
  3208. var over = ($(ce).css("overflow") != 'hidden');
  3209. this.containment = [
  3210. co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
  3211. co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
  3212. co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
  3213. co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
  3214. ];
  3215. }
  3216. },
  3217. _convertPositionTo: function(d, pos) {
  3218. if(!pos) pos = this.position;
  3219. var mod = d == "absolute" ? 1 : -1;
  3220. var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
  3221. return {
  3222. top: (
  3223. pos.top // The absolute mouse position
  3224. + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
  3225. + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
  3226. - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
  3227. ),
  3228. left: (
  3229. pos.left // The absolute mouse position
  3230. + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
  3231. + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
  3232. - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
  3233. )
  3234. };
  3235. },
  3236. _generatePosition: function(event) {
  3237. var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
  3238. // This is another very weird special case that only happens for relative elements:
  3239. // 1. If the css position is relative
  3240. // 2. and the scroll parent is the document or similar to the offset parent
  3241. // we have to refresh the relative offset during the scroll so there are no jumps
  3242. if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {
  3243. this.offset.relative = this._getRelativeOffset();
  3244. }
  3245. var pageX = event.pageX;
  3246. var pageY = event.pageY;
  3247. /*
  3248. * - Position constraining -
  3249. * Constrain the position to a mix of grid, containment.
  3250. */
  3251. if(this.originalPosition) { //If we are not dragging yet, we won't check for options
  3252. if(this.containment) {
  3253. if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
  3254. if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
  3255. if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
  3256. if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
  3257. }
  3258. if(o.grid) {
  3259. var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
  3260. pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
  3261. var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
  3262. pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
  3263. }
  3264. }
  3265. return {
  3266. top: (
  3267. pageY // The absolute mouse position
  3268. - this.offset.click.top // Click offset (relative to the element)
  3269. - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
  3270. - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
  3271. + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
  3272. ),
  3273. left: (
  3274. pageX // The absolute mouse position
  3275. - this.offset.click.left // Click offset (relative to the element)
  3276. - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
  3277. - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
  3278. + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
  3279. )
  3280. };
  3281. },
  3282. _rearrange: function(event, i, a, hardRefresh) {
  3283. a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling));
  3284. //Various things done here to improve the performance:
  3285. // 1. we create a setTimeout, that calls refreshPositions
  3286. // 2. on the instance, we have a counter variable, that get's higher after every append
  3287. // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
  3288. // 4. this lets only the last addition to the timeout stack through
  3289. this.counter = this.counter ? ++this.counter : 1;
  3290. var self = this, counter = this.counter;
  3291. window.setTimeout(function() {
  3292. if(counter == self.counter) self.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
  3293. },0);
  3294. },
  3295. _clear: function(event, noPropagation) {
  3296. this.reverting = false;
  3297. // We delay all events that have to be triggered to after the point where the placeholder has been removed and
  3298. // everything else normalized again
  3299. var delayedTriggers = [], self = this;
  3300. // We first have to update the dom position of the actual currentItem
  3301. // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
  3302. if(!this._noFinalSort && this.currentItem[0].parentNode) this.placeholder.before(this.currentItem);
  3303. this._noFinalSort = null;
  3304. if(this.helper[0] == this.currentItem[0]) {
  3305. for(var i in this._storedCSS) {
  3306. if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = '';
  3307. }
  3308. this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
  3309. } else {
  3310. this.currentItem.show();
  3311. }
  3312. if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
  3313. if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
  3314. if(!$.ui.contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element
  3315. if(!noPropagation) delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
  3316. for (var i = this.containers.length - 1; i >= 0; i--){
  3317. if($.ui.contains(this.containers[i].element[0], this.currentItem[0]) && !noPropagation) {
  3318. delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
  3319. delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
  3320. }
  3321. };
  3322. };
  3323. //Post events to containers
  3324. for (var i = this.containers.length - 1; i >= 0; i--){
  3325. if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
  3326. if(this.containers[i].containerCache.over) {
  3327. delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
  3328. this.containers[i].containerCache.over = 0;
  3329. }
  3330. }
  3331. //Do what was originally in plugins
  3332. if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor
  3333. if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity
  3334. if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index
  3335. this.dragging = false;
  3336. if(this.cancelHelperRemoval) {
  3337. if(!noPropagation) {
  3338. this._trigger("beforeStop", event, this._uiHash());
  3339. for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
  3340. this._trigger("stop", event, this._uiHash());
  3341. }
  3342. return false;
  3343. }
  3344. if(!noPropagation) this._trigger("beforeStop", event, this._uiHash());
  3345. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
  3346. this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  3347. if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null;
  3348. if(!noPropagation) {
  3349. for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
  3350. this._trigger("stop", event, this._uiHash());
  3351. }
  3352. this.fromOutside = false;
  3353. return true;
  3354. },
  3355. _trigger: function() {
  3356. if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
  3357. this.cancel();
  3358. }
  3359. },
  3360. _uiHash: function(inst) {
  3361. var self = inst || this;
  3362. return {
  3363. helper: self.helper,
  3364. placeholder: self.placeholder || $([]),
  3365. position: self.position,
  3366. originalPosition: self.originalPosition,
  3367. offset: self.positionAbs,
  3368. item: self.currentItem,
  3369. sender: inst ? inst.element : null
  3370. };
  3371. }
  3372. });
  3373. $.extend($.ui.sortable, {
  3374. version: "1.8.6"
  3375. });
  3376. })(jQuery);
  3377. /*
  3378. * jQuery UI Accordion 1.8.6
  3379. *
  3380. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  3381. * Dual licensed under the MIT or GPL Version 2 licenses.
  3382. * http://jquery.org/license
  3383. *
  3384. * http://docs.jquery.com/UI/Accordion
  3385. *
  3386. * Depends:
  3387. * jquery.ui.core.js
  3388. * jquery.ui.widget.js
  3389. */
  3390. (function( $, undefined ) {
  3391. $.widget( "ui.accordion", {
  3392. options: {
  3393. active: 0,
  3394. animated: "slide",
  3395. autoHeight: true,
  3396. clearStyle: false,
  3397. collapsible: false,
  3398. event: "click",
  3399. fillSpace: false,
  3400. header: "> li > :first-child,> :not(li):even",
  3401. icons: {
  3402. header: "ui-icon-triangle-1-e",
  3403. headerSelected: "ui-icon-triangle-1-s"
  3404. },
  3405. navigation: false,
  3406. navigationFilter: function() {
  3407. return this.href.toLowerCase() === location.href.toLowerCase();
  3408. }
  3409. },
  3410. _create: function() {
  3411. var self = this,
  3412. options = self.options;
  3413. self.running = 0;
  3414. self.element
  3415. .addClass( "ui-accordion ui-widget ui-helper-reset" )
  3416. // in lack of child-selectors in CSS
  3417. // we need to mark top-LIs in a UL-accordion for some IE-fix
  3418. .children( "li" )
  3419. .addClass( "ui-accordion-li-fix" );
  3420. self.headers = self.element.find( options.header )
  3421. .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" )
  3422. .bind( "mouseenter.accordion", function() {
  3423. if ( options.disabled ) {
  3424. return;
  3425. }
  3426. $( this ).addClass( "ui-state-hover" );
  3427. })
  3428. .bind( "mouseleave.accordion", function() {
  3429. if ( options.disabled ) {
  3430. return;
  3431. }
  3432. $( this ).removeClass( "ui-state-hover" );
  3433. })
  3434. .bind( "focus.accordion", function() {
  3435. if ( options.disabled ) {
  3436. return;
  3437. }
  3438. $( this ).addClass( "ui-state-focus" );
  3439. })
  3440. .bind( "blur.accordion", function() {
  3441. if ( options.disabled ) {
  3442. return;
  3443. }
  3444. $( this ).removeClass( "ui-state-focus" );
  3445. });
  3446. self.headers.next()
  3447. .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" );
  3448. if ( options.navigation ) {
  3449. var current = self.element.find( "a" ).filter( options.navigationFilter ).eq( 0 );
  3450. if ( current.length ) {
  3451. var header = current.closest( ".ui-accordion-header" );
  3452. if ( header.length ) {
  3453. // anchor within header
  3454. self.active = header;
  3455. } else {
  3456. // anchor within content
  3457. self.active = current.closest( ".ui-accordion-content" ).prev();
  3458. }
  3459. }
  3460. }
  3461. self.active = self._findActive( self.active || options.active )
  3462. .addClass( "ui-state-default ui-state-active" )
  3463. .toggleClass( "ui-corner-all" )
  3464. .toggleClass( "ui-corner-top" );
  3465. self.active.next().addClass( "ui-accordion-content-active" );
  3466. self._createIcons();
  3467. self.resize();
  3468. // ARIA
  3469. self.element.attr( "role", "tablist" );
  3470. self.headers
  3471. .attr( "role", "tab" )
  3472. .bind( "keydown.accordion", function( event ) {
  3473. return self._keydown( event );
  3474. })
  3475. .next()
  3476. .attr( "role", "tabpanel" );
  3477. self.headers
  3478. .not( self.active || "" )
  3479. .attr({
  3480. "aria-expanded": "false",
  3481. tabIndex: -1
  3482. })
  3483. .next()
  3484. .hide();
  3485. // make sure at least one header is in the tab order
  3486. if ( !self.active.length ) {
  3487. self.headers.eq( 0 ).attr( "tabIndex", 0 );
  3488. } else {
  3489. self.active
  3490. .attr({
  3491. "aria-expanded": "true",
  3492. tabIndex: 0
  3493. });
  3494. }
  3495. // only need links in tab order for Safari
  3496. if ( !$.browser.safari ) {
  3497. self.headers.find( "a" ).attr( "tabIndex", -1 );
  3498. }
  3499. if ( options.event ) {
  3500. self.headers.bind( options.event.split(" ").join(".accordion ") + ".accordion", function(event) {
  3501. self._clickHandler.call( self, event, this );
  3502. event.preventDefault();
  3503. });
  3504. }
  3505. },
  3506. _createIcons: function() {
  3507. var options = this.options;
  3508. if ( options.icons ) {
  3509. $( "<span></span>" )
  3510. .addClass( "ui-icon " + options.icons.header )
  3511. .prependTo( this.headers );
  3512. this.active.children( ".ui-icon" )
  3513. .toggleClass(options.icons.header)
  3514. .toggleClass(options.icons.headerSelected);
  3515. this.element.addClass( "ui-accordion-icons" );
  3516. }
  3517. },
  3518. _destroyIcons: function() {
  3519. this.headers.children( ".ui-icon" ).remove();
  3520. this.element.removeClass( "ui-accordion-icons" );
  3521. },
  3522. destroy: function() {
  3523. var options = this.options;
  3524. this.element
  3525. .removeClass( "ui-accordion ui-widget ui-helper-reset" )
  3526. .removeAttr( "role" );
  3527. this.headers
  3528. .unbind( ".accordion" )
  3529. .removeClass( "ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
  3530. .removeAttr( "role" )
  3531. .removeAttr( "aria-expanded" )
  3532. .removeAttr( "tabIndex" );
  3533. this.headers.find( "a" ).removeAttr( "tabIndex" );
  3534. this._destroyIcons();
  3535. var contents = this.headers.next()
  3536. .css( "display", "" )
  3537. .removeAttr( "role" )
  3538. .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled" );
  3539. if ( options.autoHeight || options.fillHeight ) {
  3540. contents.css( "height", "" );
  3541. }
  3542. return $.Widget.prototype.destroy.call( this );
  3543. },
  3544. _setOption: function( key, value ) {
  3545. $.Widget.prototype._setOption.apply( this, arguments );
  3546. if ( key == "active" ) {
  3547. this.activate( value );
  3548. }
  3549. if ( key == "icons" ) {
  3550. this._destroyIcons();
  3551. if ( value ) {
  3552. this._createIcons();
  3553. }
  3554. }
  3555. // #5332 - opacity doesn't cascade to positioned elements in IE
  3556. // so we need to add the disabled class to the headers and panels
  3557. if ( key == "disabled" ) {
  3558. this.headers.add(this.headers.next())
  3559. [ value ? "addClass" : "removeClass" ](
  3560. "ui-accordion-disabled ui-state-disabled" );
  3561. }
  3562. },
  3563. _keydown: function( event ) {
  3564. if ( this.options.disabled || event.altKey || event.ctrlKey ) {
  3565. return;
  3566. }
  3567. var keyCode = $.ui.keyCode,
  3568. length = this.headers.length,
  3569. currentIndex = this.headers.index( event.target ),
  3570. toFocus = false;
  3571. switch ( event.keyCode ) {
  3572. case keyCode.RIGHT:
  3573. case keyCode.DOWN:
  3574. toFocus = this.headers[ ( currentIndex + 1 ) % length ];
  3575. break;
  3576. case keyCode.LEFT:
  3577. case keyCode.UP:
  3578. toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
  3579. break;
  3580. case keyCode.SPACE:
  3581. case keyCode.ENTER:
  3582. this._clickHandler( { target: event.target }, event.target );
  3583. event.preventDefault();
  3584. }
  3585. if ( toFocus ) {
  3586. $( event.target ).attr( "tabIndex", -1 );
  3587. $( toFocus ).attr( "tabIndex", 0 );
  3588. toFocus.focus();
  3589. return false;
  3590. }
  3591. return true;
  3592. },
  3593. resize: function() {
  3594. var options = this.options,
  3595. maxHeight;
  3596. if ( options.fillSpace ) {
  3597. if ( $.browser.msie ) {
  3598. var defOverflow = this.element.parent().css( "overflow" );
  3599. this.element.parent().css( "overflow", "hidden");
  3600. }
  3601. maxHeight = this.element.parent().height();
  3602. if ($.browser.msie) {
  3603. this.element.parent().css( "overflow", defOverflow );
  3604. }
  3605. this.headers.each(function() {
  3606. maxHeight -= $( this ).outerHeight( true );
  3607. });
  3608. this.headers.next()
  3609. .each(function() {
  3610. $( this ).height( Math.max( 0, maxHeight -
  3611. $( this ).innerHeight() + $( this ).height() ) );
  3612. })
  3613. .css( "overflow", "auto" );
  3614. } else if ( options.autoHeight ) {
  3615. maxHeight = 0;
  3616. this.headers.next()
  3617. .each(function() {
  3618. maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
  3619. })
  3620. .height( maxHeight );
  3621. }
  3622. return this;
  3623. },
  3624. activate: function( index ) {
  3625. // TODO this gets called on init, changing the option without an explicit call for that
  3626. this.options.active = index;
  3627. // call clickHandler with custom event
  3628. var active = this._findActive( index )[ 0 ];
  3629. this._clickHandler( { target: active }, active );
  3630. return this;
  3631. },
  3632. _findActive: function( selector ) {
  3633. return selector
  3634. ? typeof selector === "number"
  3635. ? this.headers.filter( ":eq(" + selector + ")" )
  3636. : this.headers.not( this.headers.not( selector ) )
  3637. : selector === false
  3638. ? $( [] )
  3639. : this.headers.filter( ":eq(0)" );
  3640. },
  3641. // TODO isn't event.target enough? why the separate target argument?
  3642. _clickHandler: function( event, target ) {
  3643. var options = this.options;
  3644. if ( options.disabled ) {
  3645. return;
  3646. }
  3647. // called only when using activate(false) to close all parts programmatically
  3648. if ( !event.target ) {
  3649. if ( !options.collapsible ) {
  3650. return;
  3651. }
  3652. this.active
  3653. .removeClass( "ui-state-active ui-corner-top" )
  3654. .addClass( "ui-state-default ui-corner-all" )
  3655. .children( ".ui-icon" )
  3656. .removeClass( options.icons.headerSelected )
  3657. .addClass( options.icons.header );
  3658. this.active.next().addClass( "ui-accordion-content-active" );
  3659. var toHide = this.active.next(),
  3660. data = {
  3661. options: options,
  3662. newHeader: $( [] ),
  3663. oldHeader: options.active,
  3664. newContent: $( [] ),
  3665. oldContent: toHide
  3666. },
  3667. toShow = ( this.active = $( [] ) );
  3668. this._toggle( toShow, toHide, data );
  3669. return;
  3670. }
  3671. // get the click target
  3672. var clicked = $( event.currentTarget || target ),
  3673. clickedIsActive = clicked[0] === this.active[0];
  3674. // TODO the option is changed, is that correct?
  3675. // TODO if it is correct, shouldn't that happen after determining that the click is valid?
  3676. options.active = options.collapsible && clickedIsActive ?
  3677. false :
  3678. this.headers.index( clicked );
  3679. // if animations are still active, or the active header is the target, ignore click
  3680. if ( this.running || ( !options.collapsible && clickedIsActive ) ) {
  3681. return;
  3682. }
  3683. // switch classes
  3684. this.active
  3685. .removeClass( "ui-state-active ui-corner-top" )
  3686. .addClass( "ui-state-default ui-corner-all" )
  3687. .children( ".ui-icon" )
  3688. .removeClass( options.icons.headerSelected )
  3689. .addClass( options.icons.header );
  3690. if ( !clickedIsActive ) {
  3691. clicked
  3692. .removeClass( "ui-state-default ui-corner-all" )
  3693. .addClass( "ui-state-active ui-corner-top" )
  3694. .children( ".ui-icon" )
  3695. .removeClass( options.icons.header )
  3696. .addClass( options.icons.headerSelected );
  3697. clicked
  3698. .next()
  3699. .addClass( "ui-accordion-content-active" );
  3700. }
  3701. // find elements to show and hide
  3702. var toShow = clicked.next(),
  3703. toHide = this.active.next(),
  3704. data = {
  3705. options: options,
  3706. newHeader: clickedIsActive && options.collapsible ? $([]) : clicked,
  3707. oldHeader: this.active,
  3708. newContent: clickedIsActive && options.collapsible ? $([]) : toShow,
  3709. oldContent: toHide
  3710. },
  3711. down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] );
  3712. this.active = clickedIsActive ? $([]) : clicked;
  3713. this._toggle( toShow, toHide, data, clickedIsActive, down );
  3714. return;
  3715. },
  3716. _toggle: function( toShow, toHide, data, clickedIsActive, down ) {
  3717. var self = this,
  3718. options = self.options;
  3719. self.toShow = toShow;
  3720. self.toHide = toHide;
  3721. self.data = data;
  3722. var complete = function() {
  3723. if ( !self ) {
  3724. return;
  3725. }
  3726. return self._completed.apply( self, arguments );
  3727. };
  3728. // trigger changestart event
  3729. self._trigger( "changestart", null, self.data );
  3730. // count elements to animate
  3731. self.running = toHide.size() === 0 ? toShow.size() : toHide.size();
  3732. if ( options.animated ) {
  3733. var animOptions = {};
  3734. if ( options.collapsible && clickedIsActive ) {
  3735. animOptions = {
  3736. toShow: $( [] ),
  3737. toHide: toHide,
  3738. complete: complete,
  3739. down: down,
  3740. autoHeight: options.autoHeight || options.fillSpace
  3741. };
  3742. } else {
  3743. animOptions = {
  3744. toShow: toShow,
  3745. toHide: toHide,
  3746. complete: complete,
  3747. down: down,
  3748. autoHeight: options.autoHeight || options.fillSpace
  3749. };
  3750. }
  3751. if ( !options.proxied ) {
  3752. options.proxied = options.animated;
  3753. }
  3754. if ( !options.proxiedDuration ) {
  3755. options.proxiedDuration = options.duration;
  3756. }
  3757. options.animated = $.isFunction( options.proxied ) ?
  3758. options.proxied( animOptions ) :
  3759. options.proxied;
  3760. options.duration = $.isFunction( options.proxiedDuration ) ?
  3761. options.proxiedDuration( animOptions ) :
  3762. options.proxiedDuration;
  3763. var animations = $.ui.accordion.animations,
  3764. duration = options.duration,
  3765. easing = options.animated;
  3766. if ( easing && !animations[ easing ] && !$.easing[ easing ] ) {
  3767. easing = "slide";
  3768. }
  3769. if ( !animations[ easing ] ) {
  3770. animations[ easing ] = function( options ) {
  3771. this.slide( options, {
  3772. easing: easing,
  3773. duration: duration || 700
  3774. });
  3775. };
  3776. }
  3777. animations[ easing ]( animOptions );
  3778. } else {
  3779. if ( options.collapsible && clickedIsActive ) {
  3780. toShow.toggle();
  3781. } else {
  3782. toHide.hide();
  3783. toShow.show();
  3784. }
  3785. complete( true );
  3786. }
  3787. // TODO assert that the blur and focus triggers are really necessary, remove otherwise
  3788. toHide.prev()
  3789. .attr({
  3790. "aria-expanded": "false",
  3791. tabIndex: -1
  3792. })
  3793. .blur();
  3794. toShow.prev()
  3795. .attr({
  3796. "aria-expanded": "true",
  3797. tabIndex: 0
  3798. })
  3799. .focus();
  3800. },
  3801. _completed: function( cancel ) {
  3802. this.running = cancel ? 0 : --this.running;
  3803. if ( this.running ) {
  3804. return;
  3805. }
  3806. if ( this.options.clearStyle ) {
  3807. this.toShow.add( this.toHide ).css({
  3808. height: "",
  3809. overflow: ""
  3810. });
  3811. }
  3812. // other classes are removed before the animation; this one needs to stay until completed
  3813. this.toHide.removeClass( "ui-accordion-content-active" );
  3814. this._trigger( "change", null, this.data );
  3815. }
  3816. });
  3817. $.extend( $.ui.accordion, {
  3818. version: "1.8.6",
  3819. animations: {
  3820. slide: function( options, additions ) {
  3821. options = $.extend({
  3822. easing: "swing",
  3823. duration: 300
  3824. }, options, additions );
  3825. if ( !options.toHide.size() ) {
  3826. options.toShow.animate({
  3827. height: "show",
  3828. paddingTop: "show",
  3829. paddingBottom: "show"
  3830. }, options );
  3831. return;
  3832. }
  3833. if ( !options.toShow.size() ) {
  3834. options.toHide.animate({
  3835. height: "hide",
  3836. paddingTop: "hide",
  3837. paddingBottom: "hide"
  3838. }, options );
  3839. return;
  3840. }
  3841. var overflow = options.toShow.css( "overflow" ),
  3842. percentDone = 0,
  3843. showProps = {},
  3844. hideProps = {},
  3845. fxAttrs = [ "height", "paddingTop", "paddingBottom" ],
  3846. originalWidth;
  3847. // fix width before calculating height of hidden element
  3848. var s = options.toShow;
  3849. originalWidth = s[0].style.width;
  3850. s.width( parseInt( s.parent().width(), 10 )
  3851. - parseInt( s.css( "paddingLeft" ), 10 )
  3852. - parseInt( s.css( "paddingRight" ), 10 )
  3853. - ( parseInt( s.css( "borderLeftWidth" ), 10 ) || 0 )
  3854. - ( parseInt( s.css( "borderRightWidth" ), 10) || 0 ) );
  3855. $.each( fxAttrs, function( i, prop ) {
  3856. hideProps[ prop ] = "hide";
  3857. var parts = ( "" + $.css( options.toShow[0], prop ) ).match( /^([\d+-.]+)(.*)$/ );
  3858. showProps[ prop ] = {
  3859. value: parts[ 1 ],
  3860. unit: parts[ 2 ] || "px"
  3861. };
  3862. });
  3863. options.toShow.css({ height: 0, overflow: "hidden" }).show();
  3864. options.toHide
  3865. .filter( ":hidden" )
  3866. .each( options.complete )
  3867. .end()
  3868. .filter( ":visible" )
  3869. .animate( hideProps, {
  3870. step: function( now, settings ) {
  3871. // only calculate the percent when animating height
  3872. // IE gets very inconsistent results when animating elements
  3873. // with small values, which is common for padding
  3874. if ( settings.prop == "height" ) {
  3875. percentDone = ( settings.end - settings.start === 0 ) ? 0 :
  3876. ( settings.now - settings.start ) / ( settings.end - settings.start );
  3877. }
  3878. options.toShow[ 0 ].style[ settings.prop ] =
  3879. ( percentDone * showProps[ settings.prop ].value )
  3880. + showProps[ settings.prop ].unit;
  3881. },
  3882. duration: options.duration,
  3883. easing: options.easing,
  3884. complete: function() {
  3885. if ( !options.autoHeight ) {
  3886. options.toShow.css( "height", "" );
  3887. }
  3888. options.toShow.css({
  3889. width: originalWidth,
  3890. overflow: overflow
  3891. });
  3892. options.complete();
  3893. }
  3894. });
  3895. },
  3896. bounceslide: function( options ) {
  3897. this.slide( options, {
  3898. easing: options.down ? "easeOutBounce" : "swing",
  3899. duration: options.down ? 1000 : 200
  3900. });
  3901. }
  3902. }
  3903. });
  3904. })( jQuery );
  3905. /*
  3906. * jQuery UI Autocomplete 1.8.6
  3907. *
  3908. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  3909. * Dual licensed under the MIT or GPL Version 2 licenses.
  3910. * http://jquery.org/license
  3911. *
  3912. * http://docs.jquery.com/UI/Autocomplete
  3913. *
  3914. * Depends:
  3915. * jquery.ui.core.js
  3916. * jquery.ui.widget.js
  3917. * jquery.ui.position.js
  3918. */
  3919. (function( $, undefined ) {
  3920. $.widget( "ui.autocomplete", {
  3921. options: {
  3922. appendTo: "body",
  3923. delay: 300,
  3924. minLength: 1,
  3925. position: {
  3926. my: "left top",
  3927. at: "left bottom",
  3928. collision: "none"
  3929. },
  3930. source: null
  3931. },
  3932. _create: function() {
  3933. var self = this,
  3934. doc = this.element[ 0 ].ownerDocument,
  3935. suppressKeyPress;
  3936. this.element
  3937. .addClass( "ui-autocomplete-input" )
  3938. .attr( "autocomplete", "off" )
  3939. // TODO verify these actually work as intended
  3940. .attr({
  3941. role: "textbox",
  3942. "aria-autocomplete": "list",
  3943. "aria-haspopup": "true"
  3944. })
  3945. .bind( "keydown.autocomplete", function( event ) {
  3946. if ( self.options.disabled || self.element.attr( "readonly" ) ) {
  3947. return;
  3948. }
  3949. suppressKeyPress = false;
  3950. var keyCode = $.ui.keyCode;
  3951. switch( event.keyCode ) {
  3952. case keyCode.PAGE_UP:
  3953. self._move( "previousPage", event );
  3954. break;
  3955. case keyCode.PAGE_DOWN:
  3956. self._move( "nextPage", event );
  3957. break;
  3958. case keyCode.UP:
  3959. self._move( "previous", event );
  3960. // prevent moving cursor to beginning of text field in some browsers
  3961. event.preventDefault();
  3962. break;
  3963. case keyCode.DOWN:
  3964. self._move( "next", event );
  3965. // prevent moving cursor to end of text field in some browsers
  3966. event.preventDefault();
  3967. break;
  3968. case keyCode.ENTER:
  3969. case keyCode.NUMPAD_ENTER:
  3970. // when menu is open and has focus
  3971. if ( self.menu.active ) {
  3972. // #6055 - Opera still allows the keypress to occur
  3973. // which causes forms to submit
  3974. suppressKeyPress = true;
  3975. event.preventDefault();
  3976. }
  3977. //passthrough - ENTER and TAB both select the current element
  3978. case keyCode.TAB:
  3979. if ( !self.menu.active ) {
  3980. return;
  3981. }
  3982. self.menu.select( event );
  3983. break;
  3984. case keyCode.ESCAPE:
  3985. self.element.val( self.term );
  3986. self.close( event );
  3987. break;
  3988. default:
  3989. // keypress is triggered before the input value is changed
  3990. clearTimeout( self.searching );
  3991. self.searching = setTimeout(function() {
  3992. // only search if the value has changed
  3993. if ( self.term != self.element.val() ) {
  3994. self.selectedItem = null;
  3995. self.search( null, event );
  3996. }
  3997. }, self.options.delay );
  3998. break;
  3999. }
  4000. })
  4001. .bind( "keypress.autocomplete", function( event ) {
  4002. if ( suppressKeyPress ) {
  4003. suppressKeyPress = false;
  4004. event.preventDefault();
  4005. }
  4006. })
  4007. .bind( "focus.autocomplete", function() {
  4008. if ( self.options.disabled ) {
  4009. return;
  4010. }
  4011. self.selectedItem = null;
  4012. self.previous = self.element.val();
  4013. })
  4014. .bind( "blur.autocomplete", function( event ) {
  4015. if ( self.options.disabled ) {
  4016. return;
  4017. }
  4018. clearTimeout( self.searching );
  4019. // clicks on the menu (or a button to trigger a search) will cause a blur event
  4020. self.closing = setTimeout(function() {
  4021. self.close( event );
  4022. self._change( event );
  4023. }, 150 );
  4024. });
  4025. this._initSource();
  4026. this.response = function() {
  4027. return self._response.apply( self, arguments );
  4028. };
  4029. this.menu = $( "<ul></ul>" )
  4030. .addClass( "ui-autocomplete" )
  4031. .appendTo( $( this.options.appendTo || "body", doc )[0] )
  4032. // prevent the close-on-blur in case of a "slow" click on the menu (long mousedown)
  4033. .mousedown(function( event ) {
  4034. // clicking on the scrollbar causes focus to shift to the body
  4035. // but we can't detect a mouseup or a click immediately afterward
  4036. // so we have to track the next mousedown and close the menu if
  4037. // the user clicks somewhere outside of the autocomplete
  4038. var menuElement = self.menu.element[ 0 ];
  4039. if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
  4040. setTimeout(function() {
  4041. $( document ).one( 'mousedown', function( event ) {
  4042. if ( event.target !== self.element[ 0 ] &&
  4043. event.target !== menuElement &&
  4044. !$.ui.contains( menuElement, event.target ) ) {
  4045. self.close();
  4046. }
  4047. });
  4048. }, 1 );
  4049. }
  4050. // use another timeout to make sure the blur-event-handler on the input was already triggered
  4051. setTimeout(function() {
  4052. clearTimeout( self.closing );
  4053. }, 13);
  4054. })
  4055. .menu({
  4056. focus: function( event, ui ) {
  4057. var item = ui.item.data( "item.autocomplete" );
  4058. if ( false !== self._trigger( "focus", event, { item: item } ) ) {
  4059. // use value to match what will end up in the input, if it was a key event
  4060. if ( /^key/.test(event.originalEvent.type) ) {
  4061. self.element.val( item.value );
  4062. }
  4063. }
  4064. },
  4065. selected: function( event, ui ) {
  4066. var item = ui.item.data( "item.autocomplete" ),
  4067. previous = self.previous;
  4068. // only trigger when focus was lost (click on menu)
  4069. if ( self.element[0] !== doc.activeElement ) {
  4070. self.element.focus();
  4071. self.previous = previous;
  4072. // #6109 - IE triggers two focus events and the second
  4073. // is asynchronous, so we need to reset the previous
  4074. // term synchronously and asynchronously :-(
  4075. setTimeout(function() {
  4076. self.previous = previous;
  4077. }, 1);
  4078. }
  4079. if ( false !== self._trigger( "select", event, { item: item } ) ) {
  4080. self.element.val( item.value );
  4081. }
  4082. // reset the term after the select event
  4083. // this allows custom select handling to work properly
  4084. self.term = self.element.val();
  4085. self.close( event );
  4086. self.selectedItem = item;
  4087. },
  4088. blur: function( event, ui ) {
  4089. // don't set the value of the text field if it's already correct
  4090. // this prevents moving the cursor unnecessarily
  4091. if ( self.menu.element.is(":visible") &&
  4092. ( self.element.val() !== self.term ) ) {
  4093. self.element.val( self.term );
  4094. }
  4095. }
  4096. })
  4097. .zIndex( this.element.zIndex() + 1 )
  4098. // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
  4099. .css({ top: 0, left: 0 })
  4100. .hide()
  4101. .data( "menu" );
  4102. if ( $.fn.bgiframe ) {
  4103. this.menu.element.bgiframe();
  4104. }
  4105. },
  4106. destroy: function() {
  4107. this.element
  4108. .removeClass( "ui-autocomplete-input" )
  4109. .removeAttr( "autocomplete" )
  4110. .removeAttr( "role" )
  4111. .removeAttr( "aria-autocomplete" )
  4112. .removeAttr( "aria-haspopup" );
  4113. this.menu.element.remove();
  4114. $.Widget.prototype.destroy.call( this );
  4115. },
  4116. _setOption: function( key, value ) {
  4117. $.Widget.prototype._setOption.apply( this, arguments );
  4118. if ( key === "source" ) {
  4119. this._initSource();
  4120. }
  4121. if ( key === "appendTo" ) {
  4122. this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] )
  4123. }
  4124. },
  4125. _initSource: function() {
  4126. var self = this,
  4127. array,
  4128. url;
  4129. if ( $.isArray(this.options.source) ) {
  4130. array = this.options.source;
  4131. this.source = function( request, response ) {
  4132. response( $.ui.autocomplete.filter(array, request.term) );
  4133. };
  4134. } else if ( typeof this.options.source === "string" ) {
  4135. url = this.options.source;
  4136. this.source = function( request, response ) {
  4137. if (self.xhr) {
  4138. self.xhr.abort();
  4139. }
  4140. self.xhr = $.getJSON( url, request, function( data, status, xhr ) {
  4141. if ( xhr === self.xhr ) {
  4142. response( data );
  4143. }
  4144. self.xhr = null;
  4145. });
  4146. };
  4147. } else {
  4148. this.source = this.options.source;
  4149. }
  4150. },
  4151. search: function( value, event ) {
  4152. value = value != null ? value : this.element.val();
  4153. // always save the actual value, not the one passed as an argument
  4154. this.term = this.element.val();
  4155. if ( value.length < this.options.minLength ) {
  4156. return this.close( event );
  4157. }
  4158. clearTimeout( this.closing );
  4159. if ( this._trigger( "search", event ) === false ) {
  4160. return;
  4161. }
  4162. return this._search( value );
  4163. },
  4164. _search: function( value ) {
  4165. this.element.addClass( "ui-autocomplete-loading" );
  4166. this.source( { term: value }, this.response );
  4167. },
  4168. _response: function( content ) {
  4169. if ( content && content.length ) {
  4170. content = this._normalize( content );
  4171. this._suggest( content );
  4172. this._trigger( "open" );
  4173. } else {
  4174. this.close();
  4175. }
  4176. this.element.removeClass( "ui-autocomplete-loading" );
  4177. },
  4178. close: function( event ) {
  4179. clearTimeout( this.closing );
  4180. if ( this.menu.element.is(":visible") ) {
  4181. this._trigger( "close", event );
  4182. this.menu.element.hide();
  4183. this.menu.deactivate();
  4184. }
  4185. },
  4186. _change: function( event ) {
  4187. if ( this.previous !== this.element.val() ) {
  4188. this._trigger( "change", event, { item: this.selectedItem } );
  4189. }
  4190. },
  4191. _normalize: function( items ) {
  4192. // assume all items have the right format when the first item is complete
  4193. if ( items.length && items[0].label && items[0].value ) {
  4194. return items;
  4195. }
  4196. return $.map( items, function(item) {
  4197. if ( typeof item === "string" ) {
  4198. return {
  4199. label: item,
  4200. value: item
  4201. };
  4202. }
  4203. return $.extend({
  4204. label: item.label || item.value,
  4205. value: item.value || item.label
  4206. }, item );
  4207. });
  4208. },
  4209. _suggest: function( items ) {
  4210. var ul = this.menu.element
  4211. .empty()
  4212. .zIndex( this.element.zIndex() + 1 );
  4213. this._renderMenu( ul, items );
  4214. // TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate
  4215. this.menu.deactivate();
  4216. this.menu.refresh();
  4217. this.menu.element.show().position( $.extend({
  4218. of: this.element
  4219. }, this.options.position ));
  4220. this._resizeMenu();
  4221. },
  4222. _resizeMenu: function() {
  4223. var ul = this.menu.element;
  4224. ul.outerWidth( Math.max(
  4225. ul.width( "" ).outerWidth(),
  4226. this.element.outerWidth()
  4227. ) );
  4228. },
  4229. _renderMenu: function( ul, items ) {
  4230. var self = this;
  4231. $.each( items, function( index, item ) {
  4232. self._renderItem( ul, item );
  4233. });
  4234. },
  4235. _renderItem: function( ul, item) {
  4236. return $( "<li></li>" )
  4237. .data( "item.autocomplete", item )
  4238. .append( $( "<a></a>" ).text( item.label ) )
  4239. .appendTo( ul );
  4240. },
  4241. _move: function( direction, event ) {
  4242. if ( !this.menu.element.is(":visible") ) {
  4243. this.search( null, event );
  4244. return;
  4245. }
  4246. if ( this.menu.first() && /^previous/.test(direction) ||
  4247. this.menu.last() && /^next/.test(direction) ) {
  4248. this.element.val( this.term );
  4249. this.menu.deactivate();
  4250. return;
  4251. }
  4252. this.menu[ direction ]( event );
  4253. },
  4254. widget: function() {
  4255. return this.menu.element;
  4256. }
  4257. });
  4258. $.extend( $.ui.autocomplete, {
  4259. escapeRegex: function( value ) {
  4260. return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
  4261. },
  4262. filter: function(array, term) {
  4263. var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
  4264. return $.grep( array, function(value) {
  4265. return matcher.test( value.label || value.value || value );
  4266. });
  4267. }
  4268. });
  4269. }( jQuery ));
  4270. /*
  4271. * jQuery UI Menu (not officially released)
  4272. *
  4273. * This widget isn't yet finished and the API is subject to change. We plan to finish
  4274. * it for the next release. You're welcome to give it a try anyway and give us feedback,
  4275. * as long as you're okay with migrating your code later on. We can help with that, too.
  4276. *
  4277. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  4278. * Dual licensed under the MIT or GPL Version 2 licenses.
  4279. * http://jquery.org/license
  4280. *
  4281. * http://docs.jquery.com/UI/Menu
  4282. *
  4283. * Depends:
  4284. * jquery.ui.core.js
  4285. * jquery.ui.widget.js
  4286. */
  4287. (function($) {
  4288. $.widget("ui.menu", {
  4289. _create: function() {
  4290. var self = this;
  4291. this.element
  4292. .addClass("ui-menu ui-widget ui-widget-content ui-corner-all")
  4293. .attr({
  4294. role: "listbox",
  4295. "aria-activedescendant": "ui-active-menuitem"
  4296. })
  4297. .click(function( event ) {
  4298. if ( !$( event.target ).closest( ".ui-menu-item a" ).length ) {
  4299. return;
  4300. }
  4301. // temporary
  4302. event.preventDefault();
  4303. self.select( event );
  4304. });
  4305. this.refresh();
  4306. },
  4307. refresh: function() {
  4308. var self = this;
  4309. // don't refresh list items that are already adapted
  4310. var items = this.element.children("li:not(.ui-menu-item):has(a)")
  4311. .addClass("ui-menu-item")
  4312. .attr("role", "menuitem");
  4313. items.children("a")
  4314. .addClass("ui-corner-all")
  4315. .attr("tabindex", -1)
  4316. // mouseenter doesn't work with event delegation
  4317. .mouseenter(function( event ) {
  4318. self.activate( event, $(this).parent() );
  4319. })
  4320. .mouseleave(function() {
  4321. self.deactivate();
  4322. });
  4323. },
  4324. activate: function( event, item ) {
  4325. this.deactivate();
  4326. if (this.hasScroll()) {
  4327. var offset = item.offset().top - this.element.offset().top,
  4328. scroll = this.element.attr("scrollTop"),
  4329. elementHeight = this.element.height();
  4330. if (offset < 0) {
  4331. this.element.attr("scrollTop", scroll + offset);
  4332. } else if (offset >= elementHeight) {
  4333. this.element.attr("scrollTop", scroll + offset - elementHeight + item.height());
  4334. }
  4335. }
  4336. this.active = item.eq(0)
  4337. .children("a")
  4338. .addClass("ui-state-hover")
  4339. .attr("id", "ui-active-menuitem")
  4340. .end();
  4341. this._trigger("focus", event, { item: item });
  4342. },
  4343. deactivate: function() {
  4344. if (!this.active) { return; }
  4345. this.active.children("a")
  4346. .removeClass("ui-state-hover")
  4347. .removeAttr("id");
  4348. this._trigger("blur");
  4349. this.active = null;
  4350. },
  4351. next: function(event) {
  4352. this.move("next", ".ui-menu-item:first", event);
  4353. },
  4354. previous: function(event) {
  4355. this.move("prev", ".ui-menu-item:last", event);
  4356. },
  4357. first: function() {
  4358. return this.active && !this.active.prevAll(".ui-menu-item").length;
  4359. },
  4360. last: function() {
  4361. return this.active && !this.active.nextAll(".ui-menu-item").length;
  4362. },
  4363. move: function(direction, edge, event) {
  4364. if (!this.active) {
  4365. this.activate(event, this.element.children(edge));
  4366. return;
  4367. }
  4368. var next = this.active[direction + "All"](".ui-menu-item").eq(0);
  4369. if (next.length) {
  4370. this.activate(event, next);
  4371. } else {
  4372. this.activate(event, this.element.children(edge));
  4373. }
  4374. },
  4375. // TODO merge with previousPage
  4376. nextPage: function(event) {
  4377. if (this.hasScroll()) {
  4378. // TODO merge with no-scroll-else
  4379. if (!this.active || this.last()) {
  4380. this.activate(event, this.element.children(".ui-menu-item:first"));
  4381. return;
  4382. }
  4383. var base = this.active.offset().top,
  4384. height = this.element.height(),
  4385. result = this.element.children(".ui-menu-item").filter(function() {
  4386. var close = $(this).offset().top - base - height + $(this).height();
  4387. // TODO improve approximation
  4388. return close < 10 && close > -10;
  4389. });
  4390. // TODO try to catch this earlier when scrollTop indicates the last page anyway
  4391. if (!result.length) {
  4392. result = this.element.children(".ui-menu-item:last");
  4393. }
  4394. this.activate(event, result);
  4395. } else {
  4396. this.activate(event, this.element.children(".ui-menu-item")
  4397. .filter(!this.active || this.last() ? ":first" : ":last"));
  4398. }
  4399. },
  4400. // TODO merge with nextPage
  4401. previousPage: function(event) {
  4402. if (this.hasScroll()) {
  4403. // TODO merge with no-scroll-else
  4404. if (!this.active || this.first()) {
  4405. this.activate(event, this.element.children(".ui-menu-item:last"));
  4406. return;
  4407. }
  4408. var base = this.active.offset().top,
  4409. height = this.element.height();
  4410. result = this.element.children(".ui-menu-item").filter(function() {
  4411. var close = $(this).offset().top - base + height - $(this).height();
  4412. // TODO improve approximation
  4413. return close < 10 && close > -10;
  4414. });
  4415. // TODO try to catch this earlier when scrollTop indicates the last page anyway
  4416. if (!result.length) {
  4417. result = this.element.children(".ui-menu-item:first");
  4418. }
  4419. this.activate(event, result);
  4420. } else {
  4421. this.activate(event, this.element.children(".ui-menu-item")
  4422. .filter(!this.active || this.first() ? ":last" : ":first"));
  4423. }
  4424. },
  4425. hasScroll: function() {
  4426. return this.element.height() < this.element.attr("scrollHeight");
  4427. },
  4428. select: function( event ) {
  4429. this._trigger("selected", event, { item: this.active });
  4430. }
  4431. });
  4432. }(jQuery));
  4433. /*
  4434. * jQuery UI Button 1.8.6
  4435. *
  4436. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  4437. * Dual licensed under the MIT or GPL Version 2 licenses.
  4438. * http://jquery.org/license
  4439. *
  4440. * http://docs.jquery.com/UI/Button
  4441. *
  4442. * Depends:
  4443. * jquery.ui.core.js
  4444. * jquery.ui.widget.js
  4445. */
  4446. (function( $, undefined ) {
  4447. var lastActive,
  4448. baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
  4449. stateClasses = "ui-state-hover ui-state-active ",
  4450. typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
  4451. formResetHandler = function( event ) {
  4452. $( ":ui-button", event.target.form ).each(function() {
  4453. var inst = $( this ).data( "button" );
  4454. setTimeout(function() {
  4455. inst.refresh();
  4456. }, 1 );
  4457. });
  4458. },
  4459. radioGroup = function( radio ) {
  4460. var name = radio.name,
  4461. form = radio.form,
  4462. radios = $( [] );
  4463. if ( name ) {
  4464. if ( form ) {
  4465. radios = $( form ).find( "[name='" + name + "']" );
  4466. } else {
  4467. radios = $( "[name='" + name + "']", radio.ownerDocument )
  4468. .filter(function() {
  4469. return !this.form;
  4470. });
  4471. }
  4472. }
  4473. return radios;
  4474. };
  4475. $.widget( "ui.button", {
  4476. options: {
  4477. disabled: null,
  4478. text: true,
  4479. label: null,
  4480. icons: {
  4481. primary: null,
  4482. secondary: null
  4483. }
  4484. },
  4485. _create: function() {
  4486. this.element.closest( "form" )
  4487. .unbind( "reset.button" )
  4488. .bind( "reset.button", formResetHandler );
  4489. if ( typeof this.options.disabled !== "boolean" ) {
  4490. this.options.disabled = this.element.attr( "disabled" );
  4491. }
  4492. this._determineButtonType();
  4493. this.hasTitle = !!this.buttonElement.attr( "title" );
  4494. var self = this,
  4495. options = this.options,
  4496. toggleButton = this.type === "checkbox" || this.type === "radio",
  4497. hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ),
  4498. focusClass = "ui-state-focus";
  4499. if ( options.label === null ) {
  4500. options.label = this.buttonElement.html();
  4501. }
  4502. if ( this.element.is( ":disabled" ) ) {
  4503. options.disabled = true;
  4504. }
  4505. this.buttonElement
  4506. .addClass( baseClasses )
  4507. .attr( "role", "button" )
  4508. .bind( "mouseenter.button", function() {
  4509. if ( options.disabled ) {
  4510. return;
  4511. }
  4512. $( this ).addClass( "ui-state-hover" );
  4513. if ( this === lastActive ) {
  4514. $( this ).addClass( "ui-state-active" );
  4515. }
  4516. })
  4517. .bind( "mouseleave.button", function() {
  4518. if ( options.disabled ) {
  4519. return;
  4520. }
  4521. $( this ).removeClass( hoverClass );
  4522. })
  4523. .bind( "focus.button", function() {
  4524. // no need to check disabled, focus won't be triggered anyway
  4525. $( this ).addClass( focusClass );
  4526. })
  4527. .bind( "blur.button", function() {
  4528. $( this ).removeClass( focusClass );
  4529. });
  4530. if ( toggleButton ) {
  4531. this.element.bind( "change.button", function() {
  4532. self.refresh();
  4533. });
  4534. }
  4535. if ( this.type === "checkbox" ) {
  4536. this.buttonElement.bind( "click.button", function() {
  4537. if ( options.disabled ) {
  4538. return false;
  4539. }
  4540. $( this ).toggleClass( "ui-state-active" );
  4541. self.buttonElement.attr( "aria-pressed", self.element[0].checked );
  4542. });
  4543. } else if ( this.type === "radio" ) {
  4544. this.buttonElement.bind( "click.button", function() {
  4545. if ( options.disabled ) {
  4546. return false;
  4547. }
  4548. $( this ).addClass( "ui-state-active" );
  4549. self.buttonElement.attr( "aria-pressed", true );
  4550. var radio = self.element[ 0 ];
  4551. radioGroup( radio )
  4552. .not( radio )
  4553. .map(function() {
  4554. return $( this ).button( "widget" )[ 0 ];
  4555. })
  4556. .removeClass( "ui-state-active" )
  4557. .attr( "aria-pressed", false );
  4558. });
  4559. } else {
  4560. this.buttonElement
  4561. .bind( "mousedown.button", function() {
  4562. if ( options.disabled ) {
  4563. return false;
  4564. }
  4565. $( this ).addClass( "ui-state-active" );
  4566. lastActive = this;
  4567. $( document ).one( "mouseup", function() {
  4568. lastActive = null;
  4569. });
  4570. })
  4571. .bind( "mouseup.button", function() {
  4572. if ( options.disabled ) {
  4573. return false;
  4574. }
  4575. $( this ).removeClass( "ui-state-active" );
  4576. })
  4577. .bind( "keydown.button", function(event) {
  4578. if ( options.disabled ) {
  4579. return false;
  4580. }
  4581. if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) {
  4582. $( this ).addClass( "ui-state-active" );
  4583. }
  4584. })
  4585. .bind( "keyup.button", function() {
  4586. $( this ).removeClass( "ui-state-active" );
  4587. });
  4588. if ( this.buttonElement.is("a") ) {
  4589. this.buttonElement.keyup(function(event) {
  4590. if ( event.keyCode === $.ui.keyCode.SPACE ) {
  4591. // TODO pass through original event correctly (just as 2nd argument doesn't work)
  4592. $( this ).click();
  4593. }
  4594. });
  4595. }
  4596. }
  4597. // TODO: pull out $.Widget's handling for the disabled option into
  4598. // $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
  4599. // be overridden by individual plugins
  4600. this._setOption( "disabled", options.disabled );
  4601. },
  4602. _determineButtonType: function() {
  4603. if ( this.element.is(":checkbox") ) {
  4604. this.type = "checkbox";
  4605. } else {
  4606. if ( this.element.is(":radio") ) {
  4607. this.type = "radio";
  4608. } else {
  4609. if ( this.element.is("input") ) {
  4610. this.type = "input";
  4611. } else {
  4612. this.type = "button";
  4613. }
  4614. }
  4615. }
  4616. if ( this.type === "checkbox" || this.type === "radio" ) {
  4617. // we don't search against the document in case the element
  4618. // is disconnected from the DOM
  4619. this.buttonElement = this.element.parents().last()
  4620. .find( "label[for=" + this.element.attr("id") + "]" );
  4621. this.element.addClass( "ui-helper-hidden-accessible" );
  4622. var checked = this.element.is( ":checked" );
  4623. if ( checked ) {
  4624. this.buttonElement.addClass( "ui-state-active" );
  4625. }
  4626. this.buttonElement.attr( "aria-pressed", checked );
  4627. } else {
  4628. this.buttonElement = this.element;
  4629. }
  4630. },
  4631. widget: function() {
  4632. return this.buttonElement;
  4633. },
  4634. destroy: function() {
  4635. this.element
  4636. .removeClass( "ui-helper-hidden-accessible" );
  4637. this.buttonElement
  4638. .removeClass( baseClasses + " " + stateClasses + " " + typeClasses )
  4639. .removeAttr( "role" )
  4640. .removeAttr( "aria-pressed" )
  4641. .html( this.buttonElement.find(".ui-button-text").html() );
  4642. if ( !this.hasTitle ) {
  4643. this.buttonElement.removeAttr( "title" );
  4644. }
  4645. $.Widget.prototype.destroy.call( this );
  4646. },
  4647. _setOption: function( key, value ) {
  4648. $.Widget.prototype._setOption.apply( this, arguments );
  4649. if ( key === "disabled" ) {
  4650. if ( value ) {
  4651. this.element.attr( "disabled", true );
  4652. } else {
  4653. this.element.removeAttr( "disabled" );
  4654. }
  4655. }
  4656. this._resetButton();
  4657. },
  4658. refresh: function() {
  4659. var isDisabled = this.element.is( ":disabled" );
  4660. if ( isDisabled !== this.options.disabled ) {
  4661. this._setOption( "disabled", isDisabled );
  4662. }
  4663. if ( this.type === "radio" ) {
  4664. radioGroup( this.element[0] ).each(function() {
  4665. if ( $( this ).is( ":checked" ) ) {
  4666. $( this ).button( "widget" )
  4667. .addClass( "ui-state-active" )
  4668. .attr( "aria-pressed", true );
  4669. } else {
  4670. $( this ).button( "widget" )
  4671. .removeClass( "ui-state-active" )
  4672. .attr( "aria-pressed", false );
  4673. }
  4674. });
  4675. } else if ( this.type === "checkbox" ) {
  4676. if ( this.element.is( ":checked" ) ) {
  4677. this.buttonElement
  4678. .addClass( "ui-state-active" )
  4679. .attr( "aria-pressed", true );
  4680. } else {
  4681. this.buttonElement
  4682. .removeClass( "ui-state-active" )
  4683. .attr( "aria-pressed", false );
  4684. }
  4685. }
  4686. },
  4687. _resetButton: function() {
  4688. if ( this.type === "input" ) {
  4689. if ( this.options.label ) {
  4690. this.element.val( this.options.label );
  4691. }
  4692. return;
  4693. }
  4694. var buttonElement = this.buttonElement.removeClass( typeClasses ),
  4695. buttonText = $( "<span></span>" )
  4696. .addClass( "ui-button-text" )
  4697. .html( this.options.label )
  4698. .appendTo( buttonElement.empty() )
  4699. .text(),
  4700. icons = this.options.icons,
  4701. multipleIcons = icons.primary && icons.secondary;
  4702. if ( icons.primary || icons.secondary ) {
  4703. buttonElement.addClass( "ui-button-text-icon" +
  4704. ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
  4705. if ( icons.primary ) {
  4706. buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
  4707. }
  4708. if ( icons.secondary ) {
  4709. buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
  4710. }
  4711. if ( !this.options.text ) {
  4712. buttonElement
  4713. .addClass( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" )
  4714. .removeClass( "ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary" );
  4715. if ( !this.hasTitle ) {
  4716. buttonElement.attr( "title", buttonText );
  4717. }
  4718. }
  4719. } else {
  4720. buttonElement.addClass( "ui-button-text-only" );
  4721. }
  4722. }
  4723. });
  4724. $.widget( "ui.buttonset", {
  4725. _create: function() {
  4726. this.element.addClass( "ui-buttonset" );
  4727. },
  4728. _init: function() {
  4729. this.refresh();
  4730. },
  4731. _setOption: function( key, value ) {
  4732. if ( key === "disabled" ) {
  4733. this.buttons.button( "option", key, value );
  4734. }
  4735. $.Widget.prototype._setOption.apply( this, arguments );
  4736. },
  4737. refresh: function() {
  4738. this.buttons = this.element.find( ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" )
  4739. .filter( ":ui-button" )
  4740. .button( "refresh" )
  4741. .end()
  4742. .not( ":ui-button" )
  4743. .button()
  4744. .end()
  4745. .map(function() {
  4746. return $( this ).button( "widget" )[ 0 ];
  4747. })
  4748. .removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
  4749. .filter( ":visible" )
  4750. .filter( ":first" )
  4751. .addClass( "ui-corner-left" )
  4752. .end()
  4753. .filter( ":last" )
  4754. .addClass( "ui-corner-right" )
  4755. .end()
  4756. .end()
  4757. .end();
  4758. },
  4759. destroy: function() {
  4760. this.element.removeClass( "ui-buttonset" );
  4761. this.buttons
  4762. .map(function() {
  4763. return $( this ).button( "widget" )[ 0 ];
  4764. })
  4765. .removeClass( "ui-corner-left ui-corner-right" )
  4766. .end()
  4767. .button( "destroy" );
  4768. $.Widget.prototype.destroy.call( this );
  4769. }
  4770. });
  4771. }( jQuery ) );
  4772. /*
  4773. * jQuery UI Dialog 1.8.6
  4774. *
  4775. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  4776. * Dual licensed under the MIT or GPL Version 2 licenses.
  4777. * http://jquery.org/license
  4778. *
  4779. * http://docs.jquery.com/UI/Dialog
  4780. *
  4781. * Depends:
  4782. * jquery.ui.core.js
  4783. * jquery.ui.widget.js
  4784. * jquery.ui.button.js
  4785. * jquery.ui.draggable.js
  4786. * jquery.ui.mouse.js
  4787. * jquery.ui.position.js
  4788. * jquery.ui.resizable.js
  4789. */
  4790. (function( $, undefined ) {
  4791. var uiDialogClasses =
  4792. 'ui-dialog ' +
  4793. 'ui-widget ' +
  4794. 'ui-widget-content ' +
  4795. 'ui-corner-all ',
  4796. sizeRelatedOptions = {
  4797. buttons: true,
  4798. height: true,
  4799. maxHeight: true,
  4800. maxWidth: true,
  4801. minHeight: true,
  4802. minWidth: true,
  4803. width: true
  4804. },
  4805. resizableRelatedOptions = {
  4806. maxHeight: true,
  4807. maxWidth: true,
  4808. minHeight: true,
  4809. minWidth: true
  4810. };
  4811. $.widget("ui.dialog", {
  4812. options: {
  4813. autoOpen: true,
  4814. buttons: {},
  4815. closeOnEscape: true,
  4816. closeText: 'close',
  4817. dialogClass: '',
  4818. draggable: true,
  4819. hide: null,
  4820. height: 'auto',
  4821. maxHeight: false,
  4822. maxWidth: false,
  4823. minHeight: 150,
  4824. minWidth: 150,
  4825. modal: false,
  4826. position: {
  4827. my: 'center',
  4828. at: 'center',
  4829. of: window,
  4830. collision: 'fit',
  4831. // ensure that the titlebar is never outside the document
  4832. using: function(pos) {
  4833. var topOffset = $(this).css(pos).offset().top;
  4834. if (topOffset < 0) {
  4835. $(this).css('top', pos.top - topOffset);
  4836. }
  4837. }
  4838. },
  4839. resizable: true,
  4840. show: null,
  4841. stack: true,
  4842. title: '',
  4843. width: 300,
  4844. zIndex: 1000
  4845. },
  4846. _create: function() {
  4847. this.originalTitle = this.element.attr('title');
  4848. // #5742 - .attr() might return a DOMElement
  4849. if ( typeof this.originalTitle !== "string" ) {
  4850. this.originalTitle = "";
  4851. }
  4852. this.options.title = this.options.title || this.originalTitle;
  4853. var self = this,
  4854. options = self.options,
  4855. title = options.title || '&#160;',
  4856. titleId = $.ui.dialog.getTitleId(self.element),
  4857. uiDialog = (self.uiDialog = $('<div></div>'))
  4858. .appendTo(document.body)
  4859. .hide()
  4860. .addClass(uiDialogClasses + options.dialogClass)
  4861. .css({
  4862. zIndex: options.zIndex
  4863. })
  4864. // setting tabIndex makes the div focusable
  4865. // setting outline to 0 prevents a border on focus in Mozilla
  4866. .attr('tabIndex', -1).css('outline', 0).keydown(function(event) {
  4867. if (options.closeOnEscape && event.keyCode &&
  4868. event.keyCode === $.ui.keyCode.ESCAPE) {
  4869. self.close(event);
  4870. event.preventDefault();
  4871. }
  4872. })
  4873. .attr({
  4874. role: 'dialog',
  4875. 'aria-labelledby': titleId
  4876. })
  4877. .mousedown(function(event) {
  4878. self.moveToTop(false, event);
  4879. }),
  4880. uiDialogContent = self.element
  4881. .show()
  4882. .removeAttr('title')
  4883. .addClass(
  4884. 'ui-dialog-content ' +
  4885. 'ui-widget-content')
  4886. .appendTo(uiDialog),
  4887. uiDialogTitlebar = (self.uiDialogTitlebar = $('<div></div>'))
  4888. .addClass(
  4889. 'ui-dialog-titlebar ' +
  4890. 'ui-widget-header ' +
  4891. 'ui-corner-all ' +
  4892. 'ui-helper-clearfix'
  4893. )
  4894. .prependTo(uiDialog),
  4895. uiDialogTitlebarClose = $('<a href="#"></a>')
  4896. .addClass(
  4897. 'ui-dialog-titlebar-close ' +
  4898. 'ui-corner-all'
  4899. )
  4900. .attr('role', 'button')
  4901. .hover(
  4902. function() {
  4903. uiDialogTitlebarClose.addClass('ui-state-hover');
  4904. },
  4905. function() {
  4906. uiDialogTitlebarClose.removeClass('ui-state-hover');
  4907. }
  4908. )
  4909. .focus(function() {
  4910. uiDialogTitlebarClose.addClass('ui-state-focus');
  4911. })
  4912. .blur(function() {
  4913. uiDialogTitlebarClose.removeClass('ui-state-focus');
  4914. })
  4915. .click(function(event) {
  4916. self.close(event);
  4917. return false;
  4918. })
  4919. .appendTo(uiDialogTitlebar),
  4920. uiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $('<span></span>'))
  4921. .addClass(
  4922. 'ui-icon ' +
  4923. 'ui-icon-closethick'
  4924. )
  4925. .text(options.closeText)
  4926. .appendTo(uiDialogTitlebarClose),
  4927. uiDialogTitle = $('<span></span>')
  4928. .addClass('ui-dialog-title')
  4929. .attr('id', titleId)
  4930. .html(title)
  4931. .prependTo(uiDialogTitlebar);
  4932. //handling of deprecated beforeclose (vs beforeClose) option
  4933. //Ticket #4669 http://dev.jqueryui.com/ticket/4669
  4934. //TODO: remove in 1.9pre
  4935. if ($.isFunction(options.beforeclose) && !$.isFunction(options.beforeClose)) {
  4936. options.beforeClose = options.beforeclose;
  4937. }
  4938. uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
  4939. if (options.draggable && $.fn.draggable) {
  4940. self._makeDraggable();
  4941. }
  4942. if (options.resizable && $.fn.resizable) {
  4943. self._makeResizable();
  4944. }
  4945. self._createButtons(options.buttons);
  4946. self._isOpen = false;
  4947. if ($.fn.bgiframe) {
  4948. uiDialog.bgiframe();
  4949. }
  4950. },
  4951. _init: function() {
  4952. if ( this.options.autoOpen ) {
  4953. this.open();
  4954. }
  4955. },
  4956. destroy: function() {
  4957. var self = this;
  4958. if (self.overlay) {
  4959. self.overlay.destroy();
  4960. }
  4961. self.uiDialog.hide();
  4962. self.element
  4963. .unbind('.dialog')
  4964. .removeData('dialog')
  4965. .removeClass('ui-dialog-content ui-widget-content')
  4966. .hide().appendTo('body');
  4967. self.uiDialog.remove();
  4968. if (self.originalTitle) {
  4969. self.element.attr('title', self.originalTitle);
  4970. }
  4971. return self;
  4972. },
  4973. widget: function() {
  4974. return this.uiDialog;
  4975. },
  4976. close: function(event) {
  4977. var self = this,
  4978. maxZ;
  4979. if (false === self._trigger('beforeClose', event)) {
  4980. return;
  4981. }
  4982. if (self.overlay) {
  4983. self.overlay.destroy();
  4984. }
  4985. self.uiDialog.unbind('keypress.ui-dialog');
  4986. self._isOpen = false;
  4987. if (self.options.hide) {
  4988. self.uiDialog.hide(self.options.hide, function() {
  4989. self._trigger('close', event);
  4990. });
  4991. } else {
  4992. self.uiDialog.hide();
  4993. self._trigger('close', event);
  4994. }
  4995. $.ui.dialog.overlay.resize();
  4996. // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
  4997. if (self.options.modal) {
  4998. maxZ = 0;
  4999. $('.ui-dialog').each(function() {
  5000. if (this !== self.uiDialog[0]) {
  5001. maxZ = Math.max(maxZ, $(this).css('z-index'));
  5002. }
  5003. });
  5004. $.ui.dialog.maxZ = maxZ;
  5005. }
  5006. return self;
  5007. },
  5008. isOpen: function() {
  5009. return this._isOpen;
  5010. },
  5011. // the force parameter allows us to move modal dialogs to their correct
  5012. // position on open
  5013. moveToTop: function(force, event) {
  5014. var self = this,
  5015. options = self.options,
  5016. saveScroll;
  5017. if ((options.modal && !force) ||
  5018. (!options.stack && !options.modal)) {
  5019. return self._trigger('focus', event);
  5020. }
  5021. if (options.zIndex > $.ui.dialog.maxZ) {
  5022. $.ui.dialog.maxZ = options.zIndex;
  5023. }
  5024. if (self.overlay) {
  5025. $.ui.dialog.maxZ += 1;
  5026. self.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ);
  5027. }
  5028. //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
  5029. // http://ui.jquery.com/bugs/ticket/3193
  5030. saveScroll = { scrollTop: self.element.attr('scrollTop'), scrollLeft: self.element.attr('scrollLeft') };
  5031. $.ui.dialog.maxZ += 1;
  5032. self.uiDialog.css('z-index', $.ui.dialog.maxZ);
  5033. self.element.attr(saveScroll);
  5034. self._trigger('focus', event);
  5035. return self;
  5036. },
  5037. open: function() {
  5038. if (this._isOpen) { return; }
  5039. var self = this,
  5040. options = self.options,
  5041. uiDialog = self.uiDialog;
  5042. self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null;
  5043. self._size();
  5044. self._position(options.position);
  5045. uiDialog.show(options.show);
  5046. self.moveToTop(true);
  5047. // prevent tabbing out of modal dialogs
  5048. if (options.modal) {
  5049. uiDialog.bind('keypress.ui-dialog', function(event) {
  5050. if (event.keyCode !== $.ui.keyCode.TAB) {
  5051. return;
  5052. }
  5053. var tabbables = $(':tabbable', this),
  5054. first = tabbables.filter(':first'),
  5055. last = tabbables.filter(':last');
  5056. if (event.target === last[0] && !event.shiftKey) {
  5057. first.focus(1);
  5058. return false;
  5059. } else if (event.target === first[0] && event.shiftKey) {
  5060. last.focus(1);
  5061. return false;
  5062. }
  5063. });
  5064. }
  5065. // set focus to the first tabbable element in the content area or the first button
  5066. // if there are no tabbable elements, set focus on the dialog itself
  5067. $(self.element.find(':tabbable').get().concat(
  5068. uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat(
  5069. uiDialog.get()))).eq(0).focus();
  5070. self._isOpen = true;
  5071. self._trigger('open');
  5072. return self;
  5073. },
  5074. _createButtons: function(buttons) {
  5075. var self = this,
  5076. hasButtons = false,
  5077. uiDialogButtonPane = $('<div></div>')
  5078. .addClass(
  5079. 'ui-dialog-buttonpane ' +
  5080. 'ui-widget-content ' +
  5081. 'ui-helper-clearfix'
  5082. ),
  5083. uiButtonSet = $( "<div></div>" )
  5084. .addClass( "ui-dialog-buttonset" )
  5085. .appendTo( uiDialogButtonPane );
  5086. // if we already have a button pane, remove it
  5087. self.uiDialog.find('.ui-dialog-buttonpane').remove();
  5088. if (typeof buttons === 'object' && buttons !== null) {
  5089. $.each(buttons, function() {
  5090. return !(hasButtons = true);
  5091. });
  5092. }
  5093. if (hasButtons) {
  5094. $.each(buttons, function(name, props) {
  5095. props = $.isFunction( props ) ?
  5096. { click: props, text: name } :
  5097. props;
  5098. var button = $('<button type="button"></button>')
  5099. .attr( props, true )
  5100. .unbind('click')
  5101. .click(function() {
  5102. props.click.apply(self.element[0], arguments);
  5103. })
  5104. .appendTo(uiButtonSet);
  5105. if ($.fn.button) {
  5106. button.button();
  5107. }
  5108. });
  5109. uiDialogButtonPane.appendTo(self.uiDialog);
  5110. }
  5111. },
  5112. _makeDraggable: function() {
  5113. var self = this,
  5114. options = self.options,
  5115. doc = $(document),
  5116. heightBeforeDrag;
  5117. function filteredUi(ui) {
  5118. return {
  5119. position: ui.position,
  5120. offset: ui.offset
  5121. };
  5122. }
  5123. self.uiDialog.draggable({
  5124. cancel: '.ui-dialog-content, .ui-dialog-titlebar-close',
  5125. handle: '.ui-dialog-titlebar',
  5126. containment: 'document',
  5127. start: function(event, ui) {
  5128. heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height();
  5129. $(this).height($(this).height()).addClass("ui-dialog-dragging");
  5130. self._trigger('dragStart', event, filteredUi(ui));
  5131. },
  5132. drag: function(event, ui) {
  5133. self._trigger('drag', event, filteredUi(ui));
  5134. },
  5135. stop: function(event, ui) {
  5136. options.position = [ui.position.left - doc.scrollLeft(),
  5137. ui.position.top - doc.scrollTop()];
  5138. $(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);
  5139. self._trigger('dragStop', event, filteredUi(ui));
  5140. $.ui.dialog.overlay.resize();
  5141. }
  5142. });
  5143. },
  5144. _makeResizable: function(handles) {
  5145. handles = (handles === undefined ? this.options.resizable : handles);
  5146. var self = this,
  5147. options = self.options,
  5148. // .ui-resizable has position: relative defined in the stylesheet
  5149. // but dialogs have to use absolute or fixed positioning
  5150. position = self.uiDialog.css('position'),
  5151. resizeHandles = (typeof handles === 'string' ?
  5152. handles :
  5153. 'n,e,s,w,se,sw,ne,nw'
  5154. );
  5155. function filteredUi(ui) {
  5156. return {
  5157. originalPosition: ui.originalPosition,
  5158. originalSize: ui.originalSize,
  5159. position: ui.position,
  5160. size: ui.size
  5161. };
  5162. }
  5163. self.uiDialog.resizable({
  5164. cancel: '.ui-dialog-content',
  5165. containment: 'document',
  5166. alsoResize: self.element,
  5167. maxWidth: options.maxWidth,
  5168. maxHeight: options.maxHeight,
  5169. minWidth: options.minWidth,
  5170. minHeight: self._minHeight(),
  5171. handles: resizeHandles,
  5172. start: function(event, ui) {
  5173. $(this).addClass("ui-dialog-resizing");
  5174. self._trigger('resizeStart', event, filteredUi(ui));
  5175. },
  5176. resize: function(event, ui) {
  5177. self._trigger('resize', event, filteredUi(ui));
  5178. },
  5179. stop: function(event, ui) {
  5180. $(this).removeClass("ui-dialog-resizing");
  5181. options.height = $(this).height();
  5182. options.width = $(this).width();
  5183. self._trigger('resizeStop', event, filteredUi(ui));
  5184. $.ui.dialog.overlay.resize();
  5185. }
  5186. })
  5187. .css('position', position)
  5188. .find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');
  5189. },
  5190. _minHeight: function() {
  5191. var options = this.options;
  5192. if (options.height === 'auto') {
  5193. return options.minHeight;
  5194. } else {
  5195. return Math.min(options.minHeight, options.height);
  5196. }
  5197. },
  5198. _position: function(position) {
  5199. var myAt = [],
  5200. offset = [0, 0],
  5201. isVisible;
  5202. if (position) {
  5203. // deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
  5204. // if (typeof position == 'string' || $.isArray(position)) {
  5205. // myAt = $.isArray(position) ? position : position.split(' ');
  5206. if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) {
  5207. myAt = position.split ? position.split(' ') : [position[0], position[1]];
  5208. if (myAt.length === 1) {
  5209. myAt[1] = myAt[0];
  5210. }
  5211. $.each(['left', 'top'], function(i, offsetPosition) {
  5212. if (+myAt[i] === myAt[i]) {
  5213. offset[i] = myAt[i];
  5214. myAt[i] = offsetPosition;
  5215. }
  5216. });
  5217. position = {
  5218. my: myAt.join(" "),
  5219. at: myAt.join(" "),
  5220. offset: offset.join(" ")
  5221. };
  5222. }
  5223. position = $.extend({}, $.ui.dialog.prototype.options.position, position);
  5224. } else {
  5225. position = $.ui.dialog.prototype.options.position;
  5226. }
  5227. // need to show the dialog to get the actual offset in the position plugin
  5228. isVisible = this.uiDialog.is(':visible');
  5229. if (!isVisible) {
  5230. this.uiDialog.show();
  5231. }
  5232. this.uiDialog
  5233. // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
  5234. .css({ top: 0, left: 0 })
  5235. .position(position);
  5236. if (!isVisible) {
  5237. this.uiDialog.hide();
  5238. }
  5239. },
  5240. _setOptions: function( options ) {
  5241. var self = this,
  5242. resizableOptions = {},
  5243. resize = false;
  5244. $.each( options, function( key, value ) {
  5245. self._setOption( key, value );
  5246. if ( key in sizeRelatedOptions ) {
  5247. resize = true;
  5248. }
  5249. if ( key in resizableRelatedOptions ) {
  5250. resizableOptions[ key ] = value;
  5251. }
  5252. });
  5253. if ( resize ) {
  5254. this._size();
  5255. }
  5256. if ( this.uiDialog.is( ":data(resizable)" ) ) {
  5257. this.uiDialog.resizable( "option", resizableOptions );
  5258. }
  5259. },
  5260. _setOption: function(key, value){
  5261. var self = this,
  5262. uiDialog = self.uiDialog;
  5263. switch (key) {
  5264. //handling of deprecated beforeclose (vs beforeClose) option
  5265. //Ticket #4669 http://dev.jqueryui.com/ticket/4669
  5266. //TODO: remove in 1.9pre
  5267. case "beforeclose":
  5268. key = "beforeClose";
  5269. break;
  5270. case "buttons":
  5271. self._createButtons(value);
  5272. break;
  5273. case "closeText":
  5274. // ensure that we always pass a string
  5275. self.uiDialogTitlebarCloseText.text("" + value);
  5276. break;
  5277. case "dialogClass":
  5278. uiDialog
  5279. .removeClass(self.options.dialogClass)
  5280. .addClass(uiDialogClasses + value);
  5281. break;
  5282. case "disabled":
  5283. if (value) {
  5284. uiDialog.addClass('ui-dialog-disabled');
  5285. } else {
  5286. uiDialog.removeClass('ui-dialog-disabled');
  5287. }
  5288. break;
  5289. case "draggable":
  5290. var isDraggable = uiDialog.is( ":data(draggable)" )
  5291. if ( isDraggable && !value ) {
  5292. uiDialog.draggable( "destroy" );
  5293. }
  5294. if ( !isDraggable && value ) {
  5295. self._makeDraggable();
  5296. }
  5297. break;
  5298. case "position":
  5299. self._position(value);
  5300. break;
  5301. case "resizable":
  5302. // currently resizable, becoming non-resizable
  5303. var isResizable = uiDialog.is( ":data(resizable)" )
  5304. if (isResizable && !value) {
  5305. uiDialog.resizable('destroy');
  5306. }
  5307. // currently resizable, changing handles
  5308. if (isResizable && typeof value === 'string') {
  5309. uiDialog.resizable('option', 'handles', value);
  5310. }
  5311. // currently non-resizable, becoming resizable
  5312. if (!isResizable && value !== false) {
  5313. self._makeResizable(value);
  5314. }
  5315. break;
  5316. case "title":
  5317. // convert whatever was passed in o a string, for html() to not throw up
  5318. $(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || '&#160;'));
  5319. break;
  5320. }
  5321. $.Widget.prototype._setOption.apply(self, arguments);
  5322. },
  5323. _size: function() {
  5324. /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
  5325. * divs will both have width and height set, so we need to reset them
  5326. */
  5327. var options = this.options,
  5328. nonContentHeight,
  5329. minContentHeight;
  5330. // reset content sizing
  5331. this.element.show().css({
  5332. width: 'auto',
  5333. minHeight: 0,
  5334. height: 0
  5335. });
  5336. if (options.minWidth > options.width) {
  5337. options.width = options.minWidth;
  5338. }
  5339. // reset wrapper sizing
  5340. // determine the height of all the non-content elements
  5341. nonContentHeight = this.uiDialog.css({
  5342. height: 'auto',
  5343. width: options.width
  5344. })
  5345. .height();
  5346. minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
  5347. if ( options.height === "auto" ) {
  5348. // only needed for IE6 support
  5349. if ( $.support.minHeight ) {
  5350. this.element.css({
  5351. minHeight: minContentHeight,
  5352. height: "auto"
  5353. });
  5354. } else {
  5355. this.uiDialog.show();
  5356. var autoHeight = this.element.css( "height", "auto" ).height();
  5357. this.uiDialog.hide();
  5358. this.element.height( Math.max( autoHeight, minContentHeight ) );
  5359. }
  5360. } else {
  5361. this.element.height( Math.max( options.height - nonContentHeight, 0 ) );
  5362. }
  5363. if (this.uiDialog.is(':data(resizable)')) {
  5364. this.uiDialog.resizable('option', 'minHeight', this._minHeight());
  5365. }
  5366. }
  5367. });
  5368. $.extend($.ui.dialog, {
  5369. version: "1.8.6",
  5370. uuid: 0,
  5371. maxZ: 0,
  5372. getTitleId: function($el) {
  5373. var id = $el.attr('id');
  5374. if (!id) {
  5375. this.uuid += 1;
  5376. id = this.uuid;
  5377. }
  5378. return 'ui-dialog-title-' + id;
  5379. },
  5380. overlay: function(dialog) {
  5381. this.$el = $.ui.dialog.overlay.create(dialog);
  5382. }
  5383. });
  5384. $.extend($.ui.dialog.overlay, {
  5385. instances: [],
  5386. // reuse old instances due to IE memory leak with alpha transparency (see #5185)
  5387. oldInstances: [],
  5388. maxZ: 0,
  5389. events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
  5390. function(event) { return event + '.dialog-overlay'; }).join(' '),
  5391. create: function(dialog) {
  5392. if (this.instances.length === 0) {
  5393. // prevent use of anchors and inputs
  5394. // we use a setTimeout in case the overlay is created from an
  5395. // event that we're going to be cancelling (see #2804)
  5396. setTimeout(function() {
  5397. // handle $(el).dialog().dialog('close') (see #4065)
  5398. if ($.ui.dialog.overlay.instances.length) {
  5399. $(document).bind($.ui.dialog.overlay.events, function(event) {
  5400. // stop events if the z-index of the target is < the z-index of the overlay
  5401. // we cannot return true when we don't want to cancel the event (#3523)
  5402. if ($(event.target).zIndex() < $.ui.dialog.overlay.maxZ) {
  5403. return false;
  5404. }
  5405. });
  5406. }
  5407. }, 1);
  5408. // allow closing by pressing the escape key
  5409. $(document).bind('keydown.dialog-overlay', function(event) {
  5410. if (dialog.options.closeOnEscape && event.keyCode &&
  5411. event.keyCode === $.ui.keyCode.ESCAPE) {
  5412. dialog.close(event);
  5413. event.preventDefault();
  5414. }
  5415. });
  5416. // handle window resize
  5417. $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
  5418. }
  5419. var $el = (this.oldInstances.pop() || $('<div></div>').addClass('ui-widget-overlay'))
  5420. .appendTo(document.body)
  5421. .css({
  5422. width: this.width(),
  5423. height: this.height()
  5424. });
  5425. if ($.fn.bgiframe) {
  5426. $el.bgiframe();
  5427. }
  5428. this.instances.push($el);
  5429. return $el;
  5430. },
  5431. destroy: function($el) {
  5432. this.oldInstances.push(this.instances.splice($.inArray($el, this.instances), 1)[0]);
  5433. if (this.instances.length === 0) {
  5434. $([document, window]).unbind('.dialog-overlay');
  5435. }
  5436. $el.remove();
  5437. // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
  5438. var maxZ = 0;
  5439. $.each(this.instances, function() {
  5440. maxZ = Math.max(maxZ, this.css('z-index'));
  5441. });
  5442. this.maxZ = maxZ;
  5443. },
  5444. height: function() {
  5445. var scrollHeight,
  5446. offsetHeight;
  5447. // handle IE 6
  5448. if ($.browser.msie && $.browser.version < 7) {
  5449. scrollHeight = Math.max(
  5450. document.documentElement.scrollHeight,
  5451. document.body.scrollHeight
  5452. );
  5453. offsetHeight = Math.max(
  5454. document.documentElement.offsetHeight,
  5455. document.body.offsetHeight
  5456. );
  5457. if (scrollHeight < offsetHeight) {
  5458. return $(window).height() + 'px';
  5459. } else {
  5460. return scrollHeight + 'px';
  5461. }
  5462. // handle "good" browsers
  5463. } else {
  5464. return $(document).height() + 'px';
  5465. }
  5466. },
  5467. width: function() {
  5468. var scrollWidth,
  5469. offsetWidth;
  5470. // handle IE 6
  5471. if ($.browser.msie && $.browser.version < 7) {
  5472. scrollWidth = Math.max(
  5473. document.documentElement.scrollWidth,
  5474. document.body.scrollWidth
  5475. );
  5476. offsetWidth = Math.max(
  5477. document.documentElement.offsetWidth,
  5478. document.body.offsetWidth
  5479. );
  5480. if (scrollWidth < offsetWidth) {
  5481. return $(window).width() + 'px';
  5482. } else {
  5483. return scrollWidth + 'px';
  5484. }
  5485. // handle "good" browsers
  5486. } else {
  5487. return $(document).width() + 'px';
  5488. }
  5489. },
  5490. resize: function() {
  5491. /* If the dialog is draggable and the user drags it past the
  5492. * right edge of the window, the document becomes wider so we
  5493. * need to stretch the overlay. If the user then drags the
  5494. * dialog back to the left, the document will become narrower,
  5495. * so we need to shrink the overlay to the appropriate size.
  5496. * This is handled by shrinking the overlay before setting it
  5497. * to the full document size.
  5498. */
  5499. var $overlays = $([]);
  5500. $.each($.ui.dialog.overlay.instances, function() {
  5501. $overlays = $overlays.add(this);
  5502. });
  5503. $overlays.css({
  5504. width: 0,
  5505. height: 0
  5506. }).css({
  5507. width: $.ui.dialog.overlay.width(),
  5508. height: $.ui.dialog.overlay.height()
  5509. });
  5510. }
  5511. });
  5512. $.extend($.ui.dialog.overlay.prototype, {
  5513. destroy: function() {
  5514. $.ui.dialog.overlay.destroy(this.$el);
  5515. }
  5516. });
  5517. }(jQuery));
  5518. /*
  5519. * jQuery UI Slider 1.8.6
  5520. *
  5521. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  5522. * Dual licensed under the MIT or GPL Version 2 licenses.
  5523. * http://jquery.org/license
  5524. *
  5525. * http://docs.jquery.com/UI/Slider
  5526. *
  5527. * Depends:
  5528. * jquery.ui.core.js
  5529. * jquery.ui.mouse.js
  5530. * jquery.ui.widget.js
  5531. */
  5532. (function( $, undefined ) {
  5533. // number of pages in a slider
  5534. // (how many times can you page up/down to go through the whole range)
  5535. var numPages = 5;
  5536. $.widget( "ui.slider", $.ui.mouse, {
  5537. widgetEventPrefix: "slide",
  5538. options: {
  5539. animate: false,
  5540. distance: 0,
  5541. max: 100,
  5542. min: 0,
  5543. orientation: "horizontal",
  5544. range: false,
  5545. step: 1,
  5546. value: 0,
  5547. values: null
  5548. },
  5549. _create: function() {
  5550. var self = this,
  5551. o = this.options;
  5552. this._keySliding = false;
  5553. this._mouseSliding = false;
  5554. this._animateOff = true;
  5555. this._handleIndex = null;
  5556. this._detectOrientation();
  5557. this._mouseInit();
  5558. this.element
  5559. .addClass( "ui-slider" +
  5560. " ui-slider-" + this.orientation +
  5561. " ui-widget" +
  5562. " ui-widget-content" +
  5563. " ui-corner-all" );
  5564. if ( o.disabled ) {
  5565. this.element.addClass( "ui-slider-disabled ui-disabled" );
  5566. }
  5567. this.range = $([]);
  5568. if ( o.range ) {
  5569. if ( o.range === true ) {
  5570. this.range = $( "<div></div>" );
  5571. if ( !o.values ) {
  5572. o.values = [ this._valueMin(), this._valueMin() ];
  5573. }
  5574. if ( o.values.length && o.values.length !== 2 ) {
  5575. o.values = [ o.values[0], o.values[0] ];
  5576. }
  5577. } else {
  5578. this.range = $( "<div></div>" );
  5579. }
  5580. this.range
  5581. .appendTo( this.element )
  5582. .addClass( "ui-slider-range" );
  5583. if ( o.range === "min" || o.range === "max" ) {
  5584. this.range.addClass( "ui-slider-range-" + o.range );
  5585. }
  5586. // note: this isn't the most fittingly semantic framework class for this element,
  5587. // but worked best visually with a variety of themes
  5588. this.range.addClass( "ui-widget-header" );
  5589. }
  5590. if ( $( ".ui-slider-handle", this.element ).length === 0 ) {
  5591. $( "<a href='#'></a>" )
  5592. .appendTo( this.element )
  5593. .addClass( "ui-slider-handle" );
  5594. }
  5595. if ( o.values && o.values.length ) {
  5596. while ( $(".ui-slider-handle", this.element).length < o.values.length ) {
  5597. $( "<a href='#'></a>" )
  5598. .appendTo( this.element )
  5599. .addClass( "ui-slider-handle" );
  5600. }
  5601. }
  5602. this.handles = $( ".ui-slider-handle", this.element )
  5603. .addClass( "ui-state-default" +
  5604. " ui-corner-all" );
  5605. this.handle = this.handles.eq( 0 );
  5606. this.handles.add( this.range ).filter( "a" )
  5607. .click(function( event ) {
  5608. event.preventDefault();
  5609. })
  5610. .hover(function() {
  5611. if ( !o.disabled ) {
  5612. $( this ).addClass( "ui-state-hover" );
  5613. }
  5614. }, function() {
  5615. $( this ).removeClass( "ui-state-hover" );
  5616. })
  5617. .focus(function() {
  5618. if ( !o.disabled ) {
  5619. $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" );
  5620. $( this ).addClass( "ui-state-focus" );
  5621. } else {
  5622. $( this ).blur();
  5623. }
  5624. })
  5625. .blur(function() {
  5626. $( this ).removeClass( "ui-state-focus" );
  5627. });
  5628. this.handles.each(function( i ) {
  5629. $( this ).data( "index.ui-slider-handle", i );
  5630. });
  5631. this.handles
  5632. .keydown(function( event ) {
  5633. var ret = true,
  5634. index = $( this ).data( "index.ui-slider-handle" ),
  5635. allowed,
  5636. curVal,
  5637. newVal,
  5638. step;
  5639. if ( self.options.disabled ) {
  5640. return;
  5641. }
  5642. switch ( event.keyCode ) {
  5643. case $.ui.keyCode.HOME:
  5644. case $.ui.keyCode.END:
  5645. case $.ui.keyCode.PAGE_UP:
  5646. case $.ui.keyCode.PAGE_DOWN:
  5647. case $.ui.keyCode.UP:
  5648. case $.ui.keyCode.RIGHT:
  5649. case $.ui.keyCode.DOWN:
  5650. case $.ui.keyCode.LEFT:
  5651. ret = false;
  5652. if ( !self._keySliding ) {
  5653. self._keySliding = true;
  5654. $( this ).addClass( "ui-state-active" );
  5655. allowed = self._start( event, index );
  5656. if ( allowed === false ) {
  5657. return;
  5658. }
  5659. }
  5660. break;
  5661. }
  5662. step = self.options.step;
  5663. if ( self.options.values && self.options.values.length ) {
  5664. curVal = newVal = self.values( index );
  5665. } else {
  5666. curVal = newVal = self.value();
  5667. }
  5668. switch ( event.keyCode ) {
  5669. case $.ui.keyCode.HOME:
  5670. newVal = self._valueMin();
  5671. break;
  5672. case $.ui.keyCode.END:
  5673. newVal = self._valueMax();
  5674. break;
  5675. case $.ui.keyCode.PAGE_UP:
  5676. newVal = self._trimAlignValue( curVal + ( (self._valueMax() - self._valueMin()) / numPages ) );
  5677. break;
  5678. case $.ui.keyCode.PAGE_DOWN:
  5679. newVal = self._trimAlignValue( curVal - ( (self._valueMax() - self._valueMin()) / numPages ) );
  5680. break;
  5681. case $.ui.keyCode.UP:
  5682. case $.ui.keyCode.RIGHT:
  5683. if ( curVal === self._valueMax() ) {
  5684. return;
  5685. }
  5686. newVal = self._trimAlignValue( curVal + step );
  5687. break;
  5688. case $.ui.keyCode.DOWN:
  5689. case $.ui.keyCode.LEFT:
  5690. if ( curVal === self._valueMin() ) {
  5691. return;
  5692. }
  5693. newVal = self._trimAlignValue( curVal - step );
  5694. break;
  5695. }
  5696. self._slide( event, index, newVal );
  5697. return ret;
  5698. })
  5699. .keyup(function( event ) {
  5700. var index = $( this ).data( "index.ui-slider-handle" );
  5701. if ( self._keySliding ) {
  5702. self._keySliding = false;
  5703. self._stop( event, index );
  5704. self._change( event, index );
  5705. $( this ).removeClass( "ui-state-active" );
  5706. }
  5707. });
  5708. this._refreshValue();
  5709. this._animateOff = false;
  5710. },
  5711. destroy: function() {
  5712. this.handles.remove();
  5713. this.range.remove();
  5714. this.element
  5715. .removeClass( "ui-slider" +
  5716. " ui-slider-horizontal" +
  5717. " ui-slider-vertical" +
  5718. " ui-slider-disabled" +
  5719. " ui-widget" +
  5720. " ui-widget-content" +
  5721. " ui-corner-all" )
  5722. .removeData( "slider" )
  5723. .unbind( ".slider" );
  5724. this._mouseDestroy();
  5725. return this;
  5726. },
  5727. _mouseCapture: function( event ) {
  5728. var o = this.options,
  5729. position,
  5730. normValue,
  5731. distance,
  5732. closestHandle,
  5733. self,
  5734. index,
  5735. allowed,
  5736. offset,
  5737. mouseOverHandle;
  5738. if ( o.disabled ) {
  5739. return false;
  5740. }
  5741. this.elementSize = {
  5742. width: this.element.outerWidth(),
  5743. height: this.element.outerHeight()
  5744. };
  5745. this.elementOffset = this.element.offset();
  5746. position = { x: event.pageX, y: event.pageY };
  5747. normValue = this._normValueFromMouse( position );
  5748. distance = this._valueMax() - this._valueMin() + 1;
  5749. self = this;
  5750. this.handles.each(function( i ) {
  5751. var thisDistance = Math.abs( normValue - self.values(i) );
  5752. if ( distance > thisDistance ) {
  5753. distance = thisDistance;
  5754. closestHandle = $( this );
  5755. index = i;
  5756. }
  5757. });
  5758. // workaround for bug #3736 (if both handles of a range are at 0,
  5759. // the first is always used as the one with least distance,
  5760. // and moving it is obviously prevented by preventing negative ranges)
  5761. if( o.range === true && this.values(1) === o.min ) {
  5762. index += 1;
  5763. closestHandle = $( this.handles[index] );
  5764. }
  5765. allowed = this._start( event, index );
  5766. if ( allowed === false ) {
  5767. return false;
  5768. }
  5769. this._mouseSliding = true;
  5770. self._handleIndex = index;
  5771. closestHandle
  5772. .addClass( "ui-state-active" )
  5773. .focus();
  5774. offset = closestHandle.offset();
  5775. mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" );
  5776. this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
  5777. left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
  5778. top: event.pageY - offset.top -
  5779. ( closestHandle.height() / 2 ) -
  5780. ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
  5781. ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
  5782. ( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
  5783. };
  5784. this._slide( event, index, normValue );
  5785. this._animateOff = true;
  5786. return true;
  5787. },
  5788. _mouseStart: function( event ) {
  5789. return true;
  5790. },
  5791. _mouseDrag: function( event ) {
  5792. var position = { x: event.pageX, y: event.pageY },
  5793. normValue = this._normValueFromMouse( position );
  5794. this._slide( event, this._handleIndex, normValue );
  5795. return false;
  5796. },
  5797. _mouseStop: function( event ) {
  5798. this.handles.removeClass( "ui-state-active" );
  5799. this._mouseSliding = false;
  5800. this._stop( event, this._handleIndex );
  5801. this._change( event, this._handleIndex );
  5802. this._handleIndex = null;
  5803. this._clickOffset = null;
  5804. this._animateOff = false;
  5805. return false;
  5806. },
  5807. _detectOrientation: function() {
  5808. this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
  5809. },
  5810. _normValueFromMouse: function( position ) {
  5811. var pixelTotal,
  5812. pixelMouse,
  5813. percentMouse,
  5814. valueTotal,
  5815. valueMouse;
  5816. if ( this.orientation === "horizontal" ) {
  5817. pixelTotal = this.elementSize.width;
  5818. pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
  5819. } else {
  5820. pixelTotal = this.elementSize.height;
  5821. pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
  5822. }
  5823. percentMouse = ( pixelMouse / pixelTotal );
  5824. if ( percentMouse > 1 ) {
  5825. percentMouse = 1;
  5826. }
  5827. if ( percentMouse < 0 ) {
  5828. percentMouse = 0;
  5829. }
  5830. if ( this.orientation === "vertical" ) {
  5831. percentMouse = 1 - percentMouse;
  5832. }
  5833. valueTotal = this._valueMax() - this._valueMin();
  5834. valueMouse = this._valueMin() + percentMouse * valueTotal;
  5835. return this._trimAlignValue( valueMouse );
  5836. },
  5837. _start: function( event, index ) {
  5838. var uiHash = {
  5839. handle: this.handles[ index ],
  5840. value: this.value()
  5841. };
  5842. if ( this.options.values && this.options.values.length ) {
  5843. uiHash.value = this.values( index );
  5844. uiHash.values = this.values();
  5845. }
  5846. return this._trigger( "start", event, uiHash );
  5847. },
  5848. _slide: function( event, index, newVal ) {
  5849. var otherVal,
  5850. newValues,
  5851. allowed;
  5852. if ( this.options.values && this.options.values.length ) {
  5853. otherVal = this.values( index ? 0 : 1 );
  5854. if ( ( this.options.values.length === 2 && this.options.range === true ) &&
  5855. ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
  5856. ) {
  5857. newVal = otherVal;
  5858. }
  5859. if ( newVal !== this.values( index ) ) {
  5860. newValues = this.values();
  5861. newValues[ index ] = newVal;
  5862. // A slide can be canceled by returning false from the slide callback
  5863. allowed = this._trigger( "slide", event, {
  5864. handle: this.handles[ index ],
  5865. value: newVal,
  5866. values: newValues
  5867. } );
  5868. otherVal = this.values( index ? 0 : 1 );
  5869. if ( allowed !== false ) {
  5870. this.values( index, newVal, true );
  5871. }
  5872. }
  5873. } else {
  5874. if ( newVal !== this.value() ) {
  5875. // A slide can be canceled by returning false from the slide callback
  5876. allowed = this._trigger( "slide", event, {
  5877. handle: this.handles[ index ],
  5878. value: newVal
  5879. } );
  5880. if ( allowed !== false ) {
  5881. this.value( newVal );
  5882. }
  5883. }
  5884. }
  5885. },
  5886. _stop: function( event, index ) {
  5887. var uiHash = {
  5888. handle: this.handles[ index ],
  5889. value: this.value()
  5890. };
  5891. if ( this.options.values && this.options.values.length ) {
  5892. uiHash.value = this.values( index );
  5893. uiHash.values = this.values();
  5894. }
  5895. this._trigger( "stop", event, uiHash );
  5896. },
  5897. _change: function( event, index ) {
  5898. if ( !this._keySliding && !this._mouseSliding ) {
  5899. var uiHash = {
  5900. handle: this.handles[ index ],
  5901. value: this.value()
  5902. };
  5903. if ( this.options.values && this.options.values.length ) {
  5904. uiHash.value = this.values( index );
  5905. uiHash.values = this.values();
  5906. }
  5907. this._trigger( "change", event, uiHash );
  5908. }
  5909. },
  5910. value: function( newValue ) {
  5911. if ( arguments.length ) {
  5912. this.options.value = this._trimAlignValue( newValue );
  5913. this._refreshValue();
  5914. this._change( null, 0 );
  5915. }
  5916. return this._value();
  5917. },
  5918. values: function( index, newValue ) {
  5919. var vals,
  5920. newValues,
  5921. i;
  5922. if ( arguments.length > 1 ) {
  5923. this.options.values[ index ] = this._trimAlignValue( newValue );
  5924. this._refreshValue();
  5925. this._change( null, index );
  5926. }
  5927. if ( arguments.length ) {
  5928. if ( $.isArray( arguments[ 0 ] ) ) {
  5929. vals = this.options.values;
  5930. newValues = arguments[ 0 ];
  5931. for ( i = 0; i < vals.length; i += 1 ) {
  5932. vals[ i ] = this._trimAlignValue( newValues[ i ] );
  5933. this._change( null, i );
  5934. }
  5935. this._refreshValue();
  5936. } else {
  5937. if ( this.options.values && this.options.values.length ) {
  5938. return this._values( index );
  5939. } else {
  5940. return this.value();
  5941. }
  5942. }
  5943. } else {
  5944. return this._values();
  5945. }
  5946. },
  5947. _setOption: function( key, value ) {
  5948. var i,
  5949. valsLength = 0;
  5950. if ( $.isArray( this.options.values ) ) {
  5951. valsLength = this.options.values.length;
  5952. }
  5953. $.Widget.prototype._setOption.apply( this, arguments );
  5954. switch ( key ) {
  5955. case "disabled":
  5956. if ( value ) {
  5957. this.handles.filter( ".ui-state-focus" ).blur();
  5958. this.handles.removeClass( "ui-state-hover" );
  5959. this.handles.attr( "disabled", "disabled" );
  5960. this.element.addClass( "ui-disabled" );
  5961. } else {
  5962. this.handles.removeAttr( "disabled" );
  5963. this.element.removeClass( "ui-disabled" );
  5964. }
  5965. break;
  5966. case "orientation":
  5967. this._detectOrientation();
  5968. this.element
  5969. .removeClass( "ui-slider-horizontal ui-slider-vertical" )
  5970. .addClass( "ui-slider-" + this.orientation );
  5971. this._refreshValue();
  5972. break;
  5973. case "value":
  5974. this._animateOff = true;
  5975. this._refreshValue();
  5976. this._change( null, 0 );
  5977. this._animateOff = false;
  5978. break;
  5979. case "values":
  5980. this._animateOff = true;
  5981. this._refreshValue();
  5982. for ( i = 0; i < valsLength; i += 1 ) {
  5983. this._change( null, i );
  5984. }
  5985. this._animateOff = false;
  5986. break;
  5987. }
  5988. },
  5989. //internal value getter
  5990. // _value() returns value trimmed by min and max, aligned by step
  5991. _value: function() {
  5992. var val = this.options.value;
  5993. val = this._trimAlignValue( val );
  5994. return val;
  5995. },
  5996. //internal values getter
  5997. // _values() returns array of values trimmed by min and max, aligned by step
  5998. // _values( index ) returns single value trimmed by min and max, aligned by step
  5999. _values: function( index ) {
  6000. var val,
  6001. vals,
  6002. i;
  6003. if ( arguments.length ) {
  6004. val = this.options.values[ index ];
  6005. val = this._trimAlignValue( val );
  6006. return val;
  6007. } else {
  6008. // .slice() creates a copy of the array
  6009. // this copy gets trimmed by min and max and then returned
  6010. vals = this.options.values.slice();
  6011. for ( i = 0; i < vals.length; i+= 1) {
  6012. vals[ i ] = this._trimAlignValue( vals[ i ] );
  6013. }
  6014. return vals;
  6015. }
  6016. },
  6017. // returns the step-aligned value that val is closest to, between (inclusive) min and max
  6018. _trimAlignValue: function( val ) {
  6019. if ( val < this._valueMin() ) {
  6020. return this._valueMin();
  6021. }
  6022. if ( val > this._valueMax() ) {
  6023. return this._valueMax();
  6024. }
  6025. var step = ( this.options.step > 0 ) ? this.options.step : 1,
  6026. valModStep = val % step,
  6027. alignValue = val - valModStep;
  6028. if ( Math.abs(valModStep) * 2 >= step ) {
  6029. alignValue += ( valModStep > 0 ) ? step : ( -step );
  6030. }
  6031. // Since JavaScript has problems with large floats, round
  6032. // the final value to 5 digits after the decimal point (see #4124)
  6033. return parseFloat( alignValue.toFixed(5) );
  6034. },
  6035. _valueMin: function() {
  6036. return this.options.min;
  6037. },
  6038. _valueMax: function() {
  6039. return this.options.max;
  6040. },
  6041. _refreshValue: function() {
  6042. var oRange = this.options.range,
  6043. o = this.options,
  6044. self = this,
  6045. animate = ( !this._animateOff ) ? o.animate : false,
  6046. valPercent,
  6047. _set = {},
  6048. lastValPercent,
  6049. value,
  6050. valueMin,
  6051. valueMax;
  6052. if ( this.options.values && this.options.values.length ) {
  6053. this.handles.each(function( i, j ) {
  6054. valPercent = ( self.values(i) - self._valueMin() ) / ( self._valueMax() - self._valueMin() ) * 100;
  6055. _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  6056. $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  6057. if ( self.options.range === true ) {
  6058. if ( self.orientation === "horizontal" ) {
  6059. if ( i === 0 ) {
  6060. self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
  6061. }
  6062. if ( i === 1 ) {
  6063. self.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
  6064. }
  6065. } else {
  6066. if ( i === 0 ) {
  6067. self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
  6068. }
  6069. if ( i === 1 ) {
  6070. self.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
  6071. }
  6072. }
  6073. }
  6074. lastValPercent = valPercent;
  6075. });
  6076. } else {
  6077. value = this.value();
  6078. valueMin = this._valueMin();
  6079. valueMax = this._valueMax();
  6080. valPercent = ( valueMax !== valueMin ) ?
  6081. ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
  6082. 0;
  6083. _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  6084. this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  6085. if ( oRange === "min" && this.orientation === "horizontal" ) {
  6086. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
  6087. }
  6088. if ( oRange === "max" && this.orientation === "horizontal" ) {
  6089. this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
  6090. }
  6091. if ( oRange === "min" && this.orientation === "vertical" ) {
  6092. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
  6093. }
  6094. if ( oRange === "max" && this.orientation === "vertical" ) {
  6095. this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
  6096. }
  6097. }
  6098. }
  6099. });
  6100. $.extend( $.ui.slider, {
  6101. version: "1.8.6"
  6102. });
  6103. }(jQuery));
  6104. /*
  6105. * jQuery UI Tabs 1.8.6
  6106. *
  6107. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  6108. * Dual licensed under the MIT or GPL Version 2 licenses.
  6109. * http://jquery.org/license
  6110. *
  6111. * http://docs.jquery.com/UI/Tabs
  6112. *
  6113. * Depends:
  6114. * jquery.ui.core.js
  6115. * jquery.ui.widget.js
  6116. */
  6117. (function( $, undefined ) {
  6118. var tabId = 0,
  6119. listId = 0;
  6120. function getNextTabId() {
  6121. return ++tabId;
  6122. }
  6123. function getNextListId() {
  6124. return ++listId;
  6125. }
  6126. $.widget( "ui.tabs", {
  6127. options: {
  6128. add: null,
  6129. ajaxOptions: null,
  6130. cache: false,
  6131. cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
  6132. collapsible: false,
  6133. disable: null,
  6134. disabled: [],
  6135. enable: null,
  6136. event: "click",
  6137. fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
  6138. idPrefix: "ui-tabs-",
  6139. load: null,
  6140. panelTemplate: "<div></div>",
  6141. remove: null,
  6142. select: null,
  6143. show: null,
  6144. spinner: "<em>Loading&#8230;</em>",
  6145. tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
  6146. },
  6147. _create: function() {
  6148. this._tabify( true );
  6149. },
  6150. _setOption: function( key, value ) {
  6151. if ( key == "selected" ) {
  6152. if (this.options.collapsible && value == this.options.selected ) {
  6153. return;
  6154. }
  6155. this.select( value );
  6156. } else {
  6157. this.options[ key ] = value;
  6158. this._tabify();
  6159. }
  6160. },
  6161. _tabId: function( a ) {
  6162. return a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF-]/g, "" ) ||
  6163. this.options.idPrefix + getNextTabId();
  6164. },
  6165. _sanitizeSelector: function( hash ) {
  6166. // we need this because an id may contain a ":"
  6167. return hash.replace( /:/g, "\\:" );
  6168. },
  6169. _cookie: function() {
  6170. var cookie = this.cookie ||
  6171. ( this.cookie = this.options.cookie.name || "ui-tabs-" + getNextListId() );
  6172. return $.cookie.apply( null, [ cookie ].concat( $.makeArray( arguments ) ) );
  6173. },
  6174. _ui: function( tab, panel ) {
  6175. return {
  6176. tab: tab,
  6177. panel: panel,
  6178. index: this.anchors.index( tab )
  6179. };
  6180. },
  6181. _cleanup: function() {
  6182. // restore all former loading tabs labels
  6183. this.lis.filter( ".ui-state-processing" )
  6184. .removeClass( "ui-state-processing" )
  6185. .find( "span:data(label.tabs)" )
  6186. .each(function() {
  6187. var el = $( this );
  6188. el.html( el.data( "label.tabs" ) ).removeData( "label.tabs" );
  6189. });
  6190. },
  6191. _tabify: function( init ) {
  6192. var self = this,
  6193. o = this.options,
  6194. fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash
  6195. this.list = this.element.find( "ol,ul" ).eq( 0 );
  6196. this.lis = $( " > li:has(a[href])", this.list );
  6197. this.anchors = this.lis.map(function() {
  6198. return $( "a", this )[ 0 ];
  6199. });
  6200. this.panels = $( [] );
  6201. this.anchors.each(function( i, a ) {
  6202. var href = $( a ).attr( "href" );
  6203. // For dynamically created HTML that contains a hash as href IE < 8 expands
  6204. // such href to the full page url with hash and then misinterprets tab as ajax.
  6205. // Same consideration applies for an added tab with a fragment identifier
  6206. // since a[href=#fragment-identifier] does unexpectedly not match.
  6207. // Thus normalize href attribute...
  6208. var hrefBase = href.split( "#" )[ 0 ],
  6209. baseEl;
  6210. if ( hrefBase && ( hrefBase === location.toString().split( "#" )[ 0 ] ||
  6211. ( baseEl = $( "base" )[ 0 ]) && hrefBase === baseEl.href ) ) {
  6212. href = a.hash;
  6213. a.href = href;
  6214. }
  6215. // inline tab
  6216. if ( fragmentId.test( href ) ) {
  6217. self.panels = self.panels.add( self._sanitizeSelector( href ) );
  6218. // remote tab
  6219. // prevent loading the page itself if href is just "#"
  6220. } else if ( href && href !== "#" ) {
  6221. // required for restore on destroy
  6222. $.data( a, "href.tabs", href );
  6223. // TODO until #3808 is fixed strip fragment identifier from url
  6224. // (IE fails to load from such url)
  6225. $.data( a, "load.tabs", href.replace( /#.*$/, "" ) );
  6226. var id = self._tabId( a );
  6227. a.href = "#" + id;
  6228. var $panel = $( "#" + id );
  6229. if ( !$panel.length ) {
  6230. $panel = $( o.panelTemplate )
  6231. .attr( "id", id )
  6232. .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
  6233. .insertAfter( self.panels[ i - 1 ] || self.list );
  6234. $panel.data( "destroy.tabs", true );
  6235. }
  6236. self.panels = self.panels.add( $panel );
  6237. // invalid tab href
  6238. } else {
  6239. o.disabled.push( i );
  6240. }
  6241. });
  6242. // initialization from scratch
  6243. if ( init ) {
  6244. // attach necessary classes for styling
  6245. this.element.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" );
  6246. this.list.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" );
  6247. this.lis.addClass( "ui-state-default ui-corner-top" );
  6248. this.panels.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" );
  6249. // Selected tab
  6250. // use "selected" option or try to retrieve:
  6251. // 1. from fragment identifier in url
  6252. // 2. from cookie
  6253. // 3. from selected class attribute on <li>
  6254. if ( o.selected === undefined ) {
  6255. if ( location.hash ) {
  6256. this.anchors.each(function( i, a ) {
  6257. if ( a.hash == location.hash ) {
  6258. o.selected = i;
  6259. return false;
  6260. }
  6261. });
  6262. }
  6263. if ( typeof o.selected !== "number" && o.cookie ) {
  6264. o.selected = parseInt( self._cookie(), 10 );
  6265. }
  6266. if ( typeof o.selected !== "number" && this.lis.filter( ".ui-tabs-selected" ).length ) {
  6267. o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) );
  6268. }
  6269. o.selected = o.selected || ( this.lis.length ? 0 : -1 );
  6270. } else if ( o.selected === null ) { // usage of null is deprecated, TODO remove in next release
  6271. o.selected = -1;
  6272. }
  6273. // sanity check - default to first tab...
  6274. o.selected = ( ( o.selected >= 0 && this.anchors[ o.selected ] ) || o.selected < 0 )
  6275. ? o.selected
  6276. : 0;
  6277. // Take disabling tabs via class attribute from HTML
  6278. // into account and update option properly.
  6279. // A selected tab cannot become disabled.
  6280. o.disabled = $.unique( o.disabled.concat(
  6281. $.map( this.lis.filter( ".ui-state-disabled" ), function( n, i ) {
  6282. return self.lis.index( n );
  6283. })
  6284. ) ).sort();
  6285. if ( $.inArray( o.selected, o.disabled ) != -1 ) {
  6286. o.disabled.splice( $.inArray( o.selected, o.disabled ), 1 );
  6287. }
  6288. // highlight selected tab
  6289. this.panels.addClass( "ui-tabs-hide" );
  6290. this.lis.removeClass( "ui-tabs-selected ui-state-active" );
  6291. // check for length avoids error when initializing empty list
  6292. if ( o.selected >= 0 && this.anchors.length ) {
  6293. $( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ).removeClass( "ui-tabs-hide" );
  6294. this.lis.eq( o.selected ).addClass( "ui-tabs-selected ui-state-active" );
  6295. // seems to be expected behavior that the show callback is fired
  6296. self.element.queue( "tabs", function() {
  6297. self._trigger( "show", null,
  6298. self._ui( self.anchors[ o.selected ], $( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ) ) );
  6299. });
  6300. this.load( o.selected );
  6301. }
  6302. // clean up to avoid memory leaks in certain versions of IE 6
  6303. // TODO: namespace this event
  6304. $( window ).bind( "unload", function() {
  6305. self.lis.add( self.anchors ).unbind( ".tabs" );
  6306. self.lis = self.anchors = self.panels = null;
  6307. });
  6308. // update selected after add/remove
  6309. } else {
  6310. o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) );
  6311. }
  6312. // update collapsible
  6313. // TODO: use .toggleClass()
  6314. this.element[ o.collapsible ? "addClass" : "removeClass" ]( "ui-tabs-collapsible" );
  6315. // set or update cookie after init and add/remove respectively
  6316. if ( o.cookie ) {
  6317. this._cookie( o.selected, o.cookie );
  6318. }
  6319. // disable tabs
  6320. for ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) {
  6321. $( li )[ $.inArray( i, o.disabled ) != -1 &&
  6322. // TODO: use .toggleClass()
  6323. !$( li ).hasClass( "ui-tabs-selected" ) ? "addClass" : "removeClass" ]( "ui-state-disabled" );
  6324. }
  6325. // reset cache if switching from cached to not cached
  6326. if ( o.cache === false ) {
  6327. this.anchors.removeData( "cache.tabs" );
  6328. }
  6329. // remove all handlers before, tabify may run on existing tabs after add or option change
  6330. this.lis.add( this.anchors ).unbind( ".tabs" );
  6331. if ( o.event !== "mouseover" ) {
  6332. var addState = function( state, el ) {
  6333. if ( el.is( ":not(.ui-state-disabled)" ) ) {
  6334. el.addClass( "ui-state-" + state );
  6335. }
  6336. };
  6337. var removeState = function( state, el ) {
  6338. el.removeClass( "ui-state-" + state );
  6339. };
  6340. this.lis.bind( "mouseover.tabs" , function() {
  6341. addState( "hover", $( this ) );
  6342. });
  6343. this.lis.bind( "mouseout.tabs", function() {
  6344. removeState( "hover", $( this ) );
  6345. });
  6346. this.anchors.bind( "focus.tabs", function() {
  6347. addState( "focus", $( this ).closest( "li" ) );
  6348. });
  6349. this.anchors.bind( "blur.tabs", function() {
  6350. removeState( "focus", $( this ).closest( "li" ) );
  6351. });
  6352. }
  6353. // set up animations
  6354. var hideFx, showFx;
  6355. if ( o.fx ) {
  6356. if ( $.isArray( o.fx ) ) {
  6357. hideFx = o.fx[ 0 ];
  6358. showFx = o.fx[ 1 ];
  6359. } else {
  6360. hideFx = showFx = o.fx;
  6361. }
  6362. }
  6363. // Reset certain styles left over from animation
  6364. // and prevent IE's ClearType bug...
  6365. function resetStyle( $el, fx ) {
  6366. $el.css( "display", "" );
  6367. if ( !$.support.opacity && fx.opacity ) {
  6368. $el[ 0 ].style.removeAttribute( "filter" );
  6369. }
  6370. }
  6371. // Show a tab...
  6372. var showTab = showFx
  6373. ? function( clicked, $show ) {
  6374. $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" );
  6375. $show.hide().removeClass( "ui-tabs-hide" ) // avoid flicker that way
  6376. .animate( showFx, showFx.duration || "normal", function() {
  6377. resetStyle( $show, showFx );
  6378. self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) );
  6379. });
  6380. }
  6381. : function( clicked, $show ) {
  6382. $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" );
  6383. $show.removeClass( "ui-tabs-hide" );
  6384. self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) );
  6385. };
  6386. // Hide a tab, $show is optional...
  6387. var hideTab = hideFx
  6388. ? function( clicked, $hide ) {
  6389. $hide.animate( hideFx, hideFx.duration || "normal", function() {
  6390. self.lis.removeClass( "ui-tabs-selected ui-state-active" );
  6391. $hide.addClass( "ui-tabs-hide" );
  6392. resetStyle( $hide, hideFx );
  6393. self.element.dequeue( "tabs" );
  6394. });
  6395. }
  6396. : function( clicked, $hide, $show ) {
  6397. self.lis.removeClass( "ui-tabs-selected ui-state-active" );
  6398. $hide.addClass( "ui-tabs-hide" );
  6399. self.element.dequeue( "tabs" );
  6400. };
  6401. // attach tab event handler, unbind to avoid duplicates from former tabifying...
  6402. this.anchors.bind( o.event + ".tabs", function() {
  6403. var el = this,
  6404. $li = $(el).closest( "li" ),
  6405. $hide = self.panels.filter( ":not(.ui-tabs-hide)" ),
  6406. $show = $( self._sanitizeSelector( el.hash ) );
  6407. // If tab is already selected and not collapsible or tab disabled or
  6408. // or is already loading or click callback returns false stop here.
  6409. // Check if click handler returns false last so that it is not executed
  6410. // for a disabled or loading tab!
  6411. if ( ( $li.hasClass( "ui-tabs-selected" ) && !o.collapsible) ||
  6412. $li.hasClass( "ui-state-disabled" ) ||
  6413. $li.hasClass( "ui-state-processing" ) ||
  6414. self.panels.filter( ":animated" ).length ||
  6415. self._trigger( "select", null, self._ui( this, $show[ 0 ] ) ) === false ) {
  6416. this.blur();
  6417. return false;
  6418. }
  6419. o.selected = self.anchors.index( this );
  6420. self.abort();
  6421. // if tab may be closed
  6422. if ( o.collapsible ) {
  6423. if ( $li.hasClass( "ui-tabs-selected" ) ) {
  6424. o.selected = -1;
  6425. if ( o.cookie ) {
  6426. self._cookie( o.selected, o.cookie );
  6427. }
  6428. self.element.queue( "tabs", function() {
  6429. hideTab( el, $hide );
  6430. }).dequeue( "tabs" );
  6431. this.blur();
  6432. return false;
  6433. } else if ( !$hide.length ) {
  6434. if ( o.cookie ) {
  6435. self._cookie( o.selected, o.cookie );
  6436. }
  6437. self.element.queue( "tabs", function() {
  6438. showTab( el, $show );
  6439. });
  6440. // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171
  6441. self.load( self.anchors.index( this ) );
  6442. this.blur();
  6443. return false;
  6444. }
  6445. }
  6446. if ( o.cookie ) {
  6447. self._cookie( o.selected, o.cookie );
  6448. }
  6449. // show new tab
  6450. if ( $show.length ) {
  6451. if ( $hide.length ) {
  6452. self.element.queue( "tabs", function() {
  6453. hideTab( el, $hide );
  6454. });
  6455. }
  6456. self.element.queue( "tabs", function() {
  6457. showTab( el, $show );
  6458. });
  6459. self.load( self.anchors.index( this ) );
  6460. } else {
  6461. throw "jQuery UI Tabs: Mismatching fragment identifier.";
  6462. }
  6463. // Prevent IE from keeping other link focussed when using the back button
  6464. // and remove dotted border from clicked link. This is controlled via CSS
  6465. // in modern browsers; blur() removes focus from address bar in Firefox
  6466. // which can become a usability and annoying problem with tabs('rotate').
  6467. if ( $.browser.msie ) {
  6468. this.blur();
  6469. }
  6470. });
  6471. // disable click in any case
  6472. this.anchors.bind( "click.tabs", function(){
  6473. return false;
  6474. });
  6475. },
  6476. _getIndex: function( index ) {
  6477. // meta-function to give users option to provide a href string instead of a numerical index.
  6478. // also sanitizes numerical indexes to valid values.
  6479. if ( typeof index == "string" ) {
  6480. index = this.anchors.index( this.anchors.filter( "[href$=" + index + "]" ) );
  6481. }
  6482. return index;
  6483. },
  6484. destroy: function() {
  6485. var o = this.options;
  6486. this.abort();
  6487. this.element
  6488. .unbind( ".tabs" )
  6489. .removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" )
  6490. .removeData( "tabs" );
  6491. this.list.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" );
  6492. this.anchors.each(function() {
  6493. var href = $.data( this, "href.tabs" );
  6494. if ( href ) {
  6495. this.href = href;
  6496. }
  6497. var $this = $( this ).unbind( ".tabs" );
  6498. $.each( [ "href", "load", "cache" ], function( i, prefix ) {
  6499. $this.removeData( prefix + ".tabs" );
  6500. });
  6501. });
  6502. this.lis.unbind( ".tabs" ).add( this.panels ).each(function() {
  6503. if ( $.data( this, "destroy.tabs" ) ) {
  6504. $( this ).remove();
  6505. } else {
  6506. $( this ).removeClass([
  6507. "ui-state-default",
  6508. "ui-corner-top",
  6509. "ui-tabs-selected",
  6510. "ui-state-active",
  6511. "ui-state-hover",
  6512. "ui-state-focus",
  6513. "ui-state-disabled",
  6514. "ui-tabs-panel",
  6515. "ui-widget-content",
  6516. "ui-corner-bottom",
  6517. "ui-tabs-hide"
  6518. ].join( " " ) );
  6519. }
  6520. });
  6521. if ( o.cookie ) {
  6522. this._cookie( null, o.cookie );
  6523. }
  6524. return this;
  6525. },
  6526. add: function( url, label, index ) {
  6527. if ( index === undefined ) {
  6528. index = this.anchors.length;
  6529. }
  6530. var self = this,
  6531. o = this.options,
  6532. $li = $( o.tabTemplate.replace( /#\{href\}/g, url ).replace( /#\{label\}/g, label ) ),
  6533. id = !url.indexOf( "#" ) ? url.replace( "#", "" ) : this._tabId( $( "a", $li )[ 0 ] );
  6534. $li.addClass( "ui-state-default ui-corner-top" ).data( "destroy.tabs", true );
  6535. // try to find an existing element before creating a new one
  6536. var $panel = $( "#" + id );
  6537. if ( !$panel.length ) {
  6538. $panel = $( o.panelTemplate )
  6539. .attr( "id", id )
  6540. .data( "destroy.tabs", true );
  6541. }
  6542. $panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" );
  6543. if ( index >= this.lis.length ) {
  6544. $li.appendTo( this.list );
  6545. $panel.appendTo( this.list[ 0 ].parentNode );
  6546. } else {
  6547. $li.insertBefore( this.lis[ index ] );
  6548. $panel.insertBefore( this.panels[ index ] );
  6549. }
  6550. o.disabled = $.map( o.disabled, function( n, i ) {
  6551. return n >= index ? ++n : n;
  6552. });
  6553. this._tabify();
  6554. if ( this.anchors.length == 1 ) {
  6555. o.selected = 0;
  6556. $li.addClass( "ui-tabs-selected ui-state-active" );
  6557. $panel.removeClass( "ui-tabs-hide" );
  6558. this.element.queue( "tabs", function() {
  6559. self._trigger( "show", null, self._ui( self.anchors[ 0 ], self.panels[ 0 ] ) );
  6560. });
  6561. this.load( 0 );
  6562. }
  6563. this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
  6564. return this;
  6565. },
  6566. remove: function( index ) {
  6567. index = this._getIndex( index );
  6568. var o = this.options,
  6569. $li = this.lis.eq( index ).remove(),
  6570. $panel = this.panels.eq( index ).remove();
  6571. // If selected tab was removed focus tab to the right or
  6572. // in case the last tab was removed the tab to the left.
  6573. if ( $li.hasClass( "ui-tabs-selected" ) && this.anchors.length > 1) {
  6574. this.select( index + ( index + 1 < this.anchors.length ? 1 : -1 ) );
  6575. }
  6576. o.disabled = $.map(
  6577. $.grep( o.disabled, function(n, i) {
  6578. return n != index;
  6579. }),
  6580. function( n, i ) {
  6581. return n >= index ? --n : n;
  6582. });
  6583. this._tabify();
  6584. this._trigger( "remove", null, this._ui( $li.find( "a" )[ 0 ], $panel[ 0 ] ) );
  6585. return this;
  6586. },
  6587. enable: function( index ) {
  6588. index = this._getIndex( index );
  6589. var o = this.options;
  6590. if ( $.inArray( index, o.disabled ) == -1 ) {
  6591. return;
  6592. }
  6593. this.lis.eq( index ).removeClass( "ui-state-disabled" );
  6594. o.disabled = $.grep( o.disabled, function( n, i ) {
  6595. return n != index;
  6596. });
  6597. this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
  6598. return this;
  6599. },
  6600. disable: function( index ) {
  6601. index = this._getIndex( index );
  6602. var self = this, o = this.options;
  6603. // cannot disable already selected tab
  6604. if ( index != o.selected ) {
  6605. this.lis.eq( index ).addClass( "ui-state-disabled" );
  6606. o.disabled.push( index );
  6607. o.disabled.sort();
  6608. this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
  6609. }
  6610. return this;
  6611. },
  6612. select: function( index ) {
  6613. index = this._getIndex( index );
  6614. if ( index == -1 ) {
  6615. if ( this.options.collapsible && this.options.selected != -1 ) {
  6616. index = this.options.selected;
  6617. } else {
  6618. return this;
  6619. }
  6620. }
  6621. this.anchors.eq( index ).trigger( this.options.event + ".tabs" );
  6622. return this;
  6623. },
  6624. load: function( index ) {
  6625. index = this._getIndex( index );
  6626. var self = this,
  6627. o = this.options,
  6628. a = this.anchors.eq( index )[ 0 ],
  6629. url = $.data( a, "load.tabs" );
  6630. this.abort();
  6631. // not remote or from cache
  6632. if ( !url || this.element.queue( "tabs" ).length !== 0 && $.data( a, "cache.tabs" ) ) {
  6633. this.element.dequeue( "tabs" );
  6634. return;
  6635. }
  6636. // load remote from here on
  6637. this.lis.eq( index ).addClass( "ui-state-processing" );
  6638. if ( o.spinner ) {
  6639. var span = $( "span", a );
  6640. span.data( "label.tabs", span.html() ).html( o.spinner );
  6641. }
  6642. this.xhr = $.ajax( $.extend( {}, o.ajaxOptions, {
  6643. url: url,
  6644. success: function( r, s ) {
  6645. $( self._sanitizeSelector( a.hash ) ).html( r );
  6646. // take care of tab labels
  6647. self._cleanup();
  6648. if ( o.cache ) {
  6649. $.data( a, "cache.tabs", true );
  6650. }
  6651. self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );
  6652. try {
  6653. o.ajaxOptions.success( r, s );
  6654. }
  6655. catch ( e ) {}
  6656. },
  6657. error: function( xhr, s, e ) {
  6658. // take care of tab labels
  6659. self._cleanup();
  6660. self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );
  6661. try {
  6662. // Passing index avoid a race condition when this method is
  6663. // called after the user has selected another tab.
  6664. // Pass the anchor that initiated this request allows
  6665. // loadError to manipulate the tab content panel via $(a.hash)
  6666. o.ajaxOptions.error( xhr, s, index, a );
  6667. }
  6668. catch ( e ) {}
  6669. }
  6670. } ) );
  6671. // last, so that load event is fired before show...
  6672. self.element.dequeue( "tabs" );
  6673. return this;
  6674. },
  6675. abort: function() {
  6676. // stop possibly running animations
  6677. this.element.queue( [] );
  6678. this.panels.stop( false, true );
  6679. // "tabs" queue must not contain more than two elements,
  6680. // which are the callbacks for the latest clicked tab...
  6681. this.element.queue( "tabs", this.element.queue( "tabs" ).splice( -2, 2 ) );
  6682. // terminate pending requests from other tabs
  6683. if ( this.xhr ) {
  6684. this.xhr.abort();
  6685. delete this.xhr;
  6686. }
  6687. // take care of tab labels
  6688. this._cleanup();
  6689. return this;
  6690. },
  6691. url: function( index, url ) {
  6692. this.anchors.eq( index ).removeData( "cache.tabs" ).data( "load.tabs", url );
  6693. return this;
  6694. },
  6695. length: function() {
  6696. return this.anchors.length;
  6697. }
  6698. });
  6699. $.extend( $.ui.tabs, {
  6700. version: "1.8.6"
  6701. });
  6702. /*
  6703. * Tabs Extensions
  6704. */
  6705. /*
  6706. * Rotate
  6707. */
  6708. $.extend( $.ui.tabs.prototype, {
  6709. rotation: null,
  6710. rotate: function( ms, continuing ) {
  6711. var self = this,
  6712. o = this.options;
  6713. var rotate = self._rotate || ( self._rotate = function( e ) {
  6714. clearTimeout( self.rotation );
  6715. self.rotation = setTimeout(function() {
  6716. var t = o.selected;
  6717. self.select( ++t < self.anchors.length ? t : 0 );
  6718. }, ms );
  6719. if ( e ) {
  6720. e.stopPropagation();
  6721. }
  6722. });
  6723. var stop = self._unrotate || ( self._unrotate = !continuing
  6724. ? function(e) {
  6725. if (e.clientX) { // in case of a true click
  6726. self.rotate(null);
  6727. }
  6728. }
  6729. : function( e ) {
  6730. t = o.selected;
  6731. rotate();
  6732. });
  6733. // start rotation
  6734. if ( ms ) {
  6735. this.element.bind( "tabsshow", rotate );
  6736. this.anchors.bind( o.event + ".tabs", stop );
  6737. rotate();
  6738. // stop rotation
  6739. } else {
  6740. clearTimeout( self.rotation );
  6741. this.element.unbind( "tabsshow", rotate );
  6742. this.anchors.unbind( o.event + ".tabs", stop );
  6743. delete this._rotate;
  6744. delete this._unrotate;
  6745. }
  6746. return this;
  6747. }
  6748. });
  6749. })( jQuery );
  6750. /*
  6751. * jQuery UI Datepicker 1.8.6
  6752. *
  6753. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  6754. * Dual licensed under the MIT or GPL Version 2 licenses.
  6755. * http://jquery.org/license
  6756. *
  6757. * http://docs.jquery.com/UI/Datepicker
  6758. *
  6759. * Depends:
  6760. * jquery.ui.core.js
  6761. */
  6762. (function( $, undefined ) {
  6763. $.extend($.ui, { datepicker: { version: "1.8.6" } });
  6764. var PROP_NAME = 'datepicker';
  6765. var dpuuid = new Date().getTime();
  6766. /* Date picker manager.
  6767. Use the singleton instance of this class, $.datepicker, to interact with the date picker.
  6768. Settings for (groups of) date pickers are maintained in an instance object,
  6769. allowing multiple different settings on the same page. */
  6770. function Datepicker() {
  6771. this.debug = false; // Change this to true to start debugging
  6772. this._curInst = null; // The current instance in use
  6773. this._keyEvent = false; // If the last event was a key event
  6774. this._disabledInputs = []; // List of date picker inputs that have been disabled
  6775. this._datepickerShowing = false; // True if the popup picker is showing , false if not
  6776. this._inDialog = false; // True if showing within a "dialog", false if not
  6777. this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
  6778. this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
  6779. this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
  6780. this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
  6781. this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
  6782. this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
  6783. this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
  6784. this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
  6785. this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class
  6786. this.regional = []; // Available regional settings, indexed by language code
  6787. this.regional[''] = { // Default regional settings
  6788. closeText: 'Done', // Display text for close link
  6789. prevText: 'Prev', // Display text for previous month link
  6790. nextText: 'Next', // Display text for next month link
  6791. currentText: 'Today', // Display text for current month link
  6792. monthNames: ['January','February','March','April','May','June',
  6793. 'July','August','September','October','November','December'], // Names of months for drop-down and formatting
  6794. monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
  6795. dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
  6796. dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
  6797. dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
  6798. weekHeader: 'Wk', // Column header for week of the year
  6799. dateFormat: 'mm/dd/yy', // See format options on parseDate
  6800. firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
  6801. isRTL: false, // True if right-to-left language, false if left-to-right
  6802. showMonthAfterYear: false, // True if the year select precedes month, false for month then year
  6803. yearSuffix: '' // Additional text to append to the year in the month headers
  6804. };
  6805. this._defaults = { // Global defaults for all the date picker instances
  6806. showOn: 'focus', // 'focus' for popup on focus,
  6807. // 'button' for trigger button, or 'both' for either
  6808. showAnim: 'fadeIn', // Name of jQuery animation for popup
  6809. showOptions: {}, // Options for enhanced animations
  6810. defaultDate: null, // Used when field is blank: actual date,
  6811. // +/-number for offset from today, null for today
  6812. appendText: '', // Display text following the input box, e.g. showing the format
  6813. buttonText: '...', // Text for trigger button
  6814. buttonImage: '', // URL for trigger button image
  6815. buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
  6816. hideIfNoPrevNext: false, // True to hide next/previous month links
  6817. // if not applicable, false to just disable them
  6818. navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
  6819. gotoCurrent: false, // True if today link goes back to current selection instead
  6820. changeMonth: false, // True if month can be selected directly, false if only prev/next
  6821. changeYear: false, // True if year can be selected directly, false if only prev/next
  6822. yearRange: 'c-10:c+10', // Range of years to display in drop-down,
  6823. // either relative to today's year (-nn:+nn), relative to currently displayed year
  6824. // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
  6825. showOtherMonths: false, // True to show dates in other months, false to leave blank
  6826. selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
  6827. showWeek: false, // True to show week of the year, false to not show it
  6828. calculateWeek: this.iso8601Week, // How to calculate the week of the year,
  6829. // takes a Date and returns the number of the week for it
  6830. shortYearCutoff: '+10', // Short year values < this are in the current century,
  6831. // > this are in the previous century,
  6832. // string value starting with '+' for current year + value
  6833. minDate: null, // The earliest selectable date, or null for no limit
  6834. maxDate: null, // The latest selectable date, or null for no limit
  6835. duration: 'fast', // Duration of display/closure
  6836. beforeShowDay: null, // Function that takes a date and returns an array with
  6837. // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
  6838. // [2] = cell title (optional), e.g. $.datepicker.noWeekends
  6839. beforeShow: null, // Function that takes an input field and
  6840. // returns a set of custom settings for the date picker
  6841. onSelect: null, // Define a callback function when a date is selected
  6842. onChangeMonthYear: null, // Define a callback function when the month or year is changed
  6843. onClose: null, // Define a callback function when the datepicker is closed
  6844. numberOfMonths: 1, // Number of months to show at a time
  6845. showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
  6846. stepMonths: 1, // Number of months to step back/forward
  6847. stepBigMonths: 12, // Number of months to step back/forward for the big links
  6848. altField: '', // Selector for an alternate field to store selected dates into
  6849. altFormat: '', // The date format to use for the alternate field
  6850. constrainInput: true, // The input is constrained by the current date format
  6851. showButtonPanel: false, // True to show button panel, false to not show it
  6852. autoSize: false // True to size the input for the date format, false to leave as is
  6853. };
  6854. $.extend(this._defaults, this.regional['']);
  6855. this.dpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>');
  6856. }
  6857. $.extend(Datepicker.prototype, {
  6858. /* Class name added to elements to indicate already configured with a date picker. */
  6859. markerClassName: 'hasDatepicker',
  6860. /* Debug logging (if enabled). */
  6861. log: function () {
  6862. if (this.debug)
  6863. console.log.apply('', arguments);
  6864. },
  6865. // TODO rename to "widget" when switching to widget factory
  6866. _widgetDatepicker: function() {
  6867. return this.dpDiv;
  6868. },
  6869. /* Override the default settings for all instances of the date picker.
  6870. @param settings object - the new settings to use as defaults (anonymous object)
  6871. @return the manager object */
  6872. setDefaults: function(settings) {
  6873. extendRemove(this._defaults, settings || {});
  6874. return this;
  6875. },
  6876. /* Attach the date picker to a jQuery selection.
  6877. @param target element - the target input field or division or span
  6878. @param settings object - the new settings to use for this date picker instance (anonymous) */
  6879. _attachDatepicker: function(target, settings) {
  6880. // check for settings on the control itself - in namespace 'date:'
  6881. var inlineSettings = null;
  6882. for (var attrName in this._defaults) {
  6883. var attrValue = target.getAttribute('date:' + attrName);
  6884. if (attrValue) {
  6885. inlineSettings = inlineSettings || {};
  6886. try {
  6887. inlineSettings[attrName] = eval(attrValue);
  6888. } catch (err) {
  6889. inlineSettings[attrName] = attrValue;
  6890. }
  6891. }
  6892. }
  6893. var nodeName = target.nodeName.toLowerCase();
  6894. var inline = (nodeName == 'div' || nodeName == 'span');
  6895. if (!target.id) {
  6896. this.uuid += 1;
  6897. target.id = 'dp' + this.uuid;
  6898. }
  6899. var inst = this._newInst($(target), inline);
  6900. inst.settings = $.extend({}, settings || {}, inlineSettings || {});
  6901. if (nodeName == 'input') {
  6902. this._connectDatepicker(target, inst);
  6903. } else if (inline) {
  6904. this._inlineDatepicker(target, inst);
  6905. }
  6906. },
  6907. /* Create a new instance object. */
  6908. _newInst: function(target, inline) {
  6909. var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars
  6910. return {id: id, input: target, // associated target
  6911. selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
  6912. drawMonth: 0, drawYear: 0, // month being drawn
  6913. inline: inline, // is datepicker inline or not
  6914. dpDiv: (!inline ? this.dpDiv : // presentation div
  6915. $('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))};
  6916. },
  6917. /* Attach the date picker to an input field. */
  6918. _connectDatepicker: function(target, inst) {
  6919. var input = $(target);
  6920. inst.append = $([]);
  6921. inst.trigger = $([]);
  6922. if (input.hasClass(this.markerClassName))
  6923. return;
  6924. this._attachments(input, inst);
  6925. input.addClass(this.markerClassName).keydown(this._doKeyDown).
  6926. keypress(this._doKeyPress).keyup(this._doKeyUp).
  6927. bind("setData.datepicker", function(event, key, value) {
  6928. inst.settings[key] = value;
  6929. }).bind("getData.datepicker", function(event, key) {
  6930. return this._get(inst, key);
  6931. });
  6932. this._autoSize(inst);
  6933. $.data(target, PROP_NAME, inst);
  6934. },
  6935. /* Make attachments based on settings. */
  6936. _attachments: function(input, inst) {
  6937. var appendText = this._get(inst, 'appendText');
  6938. var isRTL = this._get(inst, 'isRTL');
  6939. if (inst.append)
  6940. inst.append.remove();
  6941. if (appendText) {
  6942. inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>');
  6943. input[isRTL ? 'before' : 'after'](inst.append);
  6944. }
  6945. input.unbind('focus', this._showDatepicker);
  6946. if (inst.trigger)
  6947. inst.trigger.remove();
  6948. var showOn = this._get(inst, 'showOn');
  6949. if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
  6950. input.focus(this._showDatepicker);
  6951. if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
  6952. var buttonText = this._get(inst, 'buttonText');
  6953. var buttonImage = this._get(inst, 'buttonImage');
  6954. inst.trigger = $(this._get(inst, 'buttonImageOnly') ?
  6955. $('<img/>').addClass(this._triggerClass).
  6956. attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
  6957. $('<button type="button"></button>').addClass(this._triggerClass).
  6958. html(buttonImage == '' ? buttonText : $('<img/>').attr(
  6959. { src:buttonImage, alt:buttonText, title:buttonText })));
  6960. input[isRTL ? 'before' : 'after'](inst.trigger);
  6961. inst.trigger.click(function() {
  6962. if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0])
  6963. $.datepicker._hideDatepicker();
  6964. else
  6965. $.datepicker._showDatepicker(input[0]);
  6966. return false;
  6967. });
  6968. }
  6969. },
  6970. /* Apply the maximum length for the date format. */
  6971. _autoSize: function(inst) {
  6972. if (this._get(inst, 'autoSize') && !inst.inline) {
  6973. var date = new Date(2009, 12 - 1, 20); // Ensure double digits
  6974. var dateFormat = this._get(inst, 'dateFormat');
  6975. if (dateFormat.match(/[DM]/)) {
  6976. var findMax = function(names) {
  6977. var max = 0;
  6978. var maxI = 0;
  6979. for (var i = 0; i < names.length; i++) {
  6980. if (names[i].length > max) {
  6981. max = names[i].length;
  6982. maxI = i;
  6983. }
  6984. }
  6985. return maxI;
  6986. };
  6987. date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
  6988. 'monthNames' : 'monthNamesShort'))));
  6989. date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
  6990. 'dayNames' : 'dayNamesShort'))) + 20 - date.getDay());
  6991. }
  6992. inst.input.attr('size', this._formatDate(inst, date).length);
  6993. }
  6994. },
  6995. /* Attach an inline date picker to a div. */
  6996. _inlineDatepicker: function(target, inst) {
  6997. var divSpan = $(target);
  6998. if (divSpan.hasClass(this.markerClassName))
  6999. return;
  7000. divSpan.addClass(this.markerClassName).append(inst.dpDiv).
  7001. bind("setData.datepicker", function(event, key, value){
  7002. inst.settings[key] = value;
  7003. }).bind("getData.datepicker", function(event, key){
  7004. return this._get(inst, key);
  7005. });
  7006. $.data(target, PROP_NAME, inst);
  7007. this._setDate(inst, this._getDefaultDate(inst), true);
  7008. this._updateDatepicker(inst);
  7009. this._updateAlternate(inst);
  7010. },
  7011. /* Pop-up the date picker in a "dialog" box.
  7012. @param input element - ignored
  7013. @param date string or Date - the initial date to display
  7014. @param onSelect function - the function to call when a date is selected
  7015. @param settings object - update the dialog date picker instance's settings (anonymous object)
  7016. @param pos int[2] - coordinates for the dialog's position within the screen or
  7017. event - with x/y coordinates or
  7018. leave empty for default (screen centre)
  7019. @return the manager object */
  7020. _dialogDatepicker: function(input, date, onSelect, settings, pos) {
  7021. var inst = this._dialogInst; // internal instance
  7022. if (!inst) {
  7023. this.uuid += 1;
  7024. var id = 'dp' + this.uuid;
  7025. this._dialogInput = $('<input type="text" id="' + id +
  7026. '" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');
  7027. this._dialogInput.keydown(this._doKeyDown);
  7028. $('body').append(this._dialogInput);
  7029. inst = this._dialogInst = this._newInst(this._dialogInput, false);
  7030. inst.settings = {};
  7031. $.data(this._dialogInput[0], PROP_NAME, inst);
  7032. }
  7033. extendRemove(inst.settings, settings || {});
  7034. date = (date && date.constructor == Date ? this._formatDate(inst, date) : date);
  7035. this._dialogInput.val(date);
  7036. this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
  7037. if (!this._pos) {
  7038. var browserWidth = document.documentElement.clientWidth;
  7039. var browserHeight = document.documentElement.clientHeight;
  7040. var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
  7041. var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
  7042. this._pos = // should use actual width/height below
  7043. [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
  7044. }
  7045. // move input on screen for focus, but hidden behind dialog
  7046. this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px');
  7047. inst.settings.onSelect = onSelect;
  7048. this._inDialog = true;
  7049. this.dpDiv.addClass(this._dialogClass);
  7050. this._showDatepicker(this._dialogInput[0]);
  7051. if ($.blockUI)
  7052. $.blockUI(this.dpDiv);
  7053. $.data(this._dialogInput[0], PROP_NAME, inst);
  7054. return this;
  7055. },
  7056. /* Detach a datepicker from its control.
  7057. @param target element - the target input field or division or span */
  7058. _destroyDatepicker: function(target) {
  7059. var $target = $(target);
  7060. var inst = $.data(target, PROP_NAME);
  7061. if (!$target.hasClass(this.markerClassName)) {
  7062. return;
  7063. }
  7064. var nodeName = target.nodeName.toLowerCase();
  7065. $.removeData(target, PROP_NAME);
  7066. if (nodeName == 'input') {
  7067. inst.append.remove();
  7068. inst.trigger.remove();
  7069. $target.removeClass(this.markerClassName).
  7070. unbind('focus', this._showDatepicker).
  7071. unbind('keydown', this._doKeyDown).
  7072. unbind('keypress', this._doKeyPress).
  7073. unbind('keyup', this._doKeyUp);
  7074. } else if (nodeName == 'div' || nodeName == 'span')
  7075. $target.removeClass(this.markerClassName).empty();
  7076. },
  7077. /* Enable the date picker to a jQuery selection.
  7078. @param target element - the target input field or division or span */
  7079. _enableDatepicker: function(target) {
  7080. var $target = $(target);
  7081. var inst = $.data(target, PROP_NAME);
  7082. if (!$target.hasClass(this.markerClassName)) {
  7083. return;
  7084. }
  7085. var nodeName = target.nodeName.toLowerCase();
  7086. if (nodeName == 'input') {
  7087. target.disabled = false;
  7088. inst.trigger.filter('button').
  7089. each(function() { this.disabled = false; }).end().
  7090. filter('img').css({opacity: '1.0', cursor: ''});
  7091. }
  7092. else if (nodeName == 'div' || nodeName == 'span') {
  7093. var inline = $target.children('.' + this._inlineClass);
  7094. inline.children().removeClass('ui-state-disabled');
  7095. }
  7096. this._disabledInputs = $.map(this._disabledInputs,
  7097. function(value) { return (value == target ? null : value); }); // delete entry
  7098. },
  7099. /* Disable the date picker to a jQuery selection.
  7100. @param target element - the target input field or division or span */
  7101. _disableDatepicker: function(target) {
  7102. var $target = $(target);
  7103. var inst = $.data(target, PROP_NAME);
  7104. if (!$target.hasClass(this.markerClassName)) {
  7105. return;
  7106. }
  7107. var nodeName = target.nodeName.toLowerCase();
  7108. if (nodeName == 'input') {
  7109. target.disabled = true;
  7110. inst.trigger.filter('button').
  7111. each(function() { this.disabled = true; }).end().
  7112. filter('img').css({opacity: '0.5', cursor: 'default'});
  7113. }
  7114. else if (nodeName == 'div' || nodeName == 'span') {
  7115. var inline = $target.children('.' + this._inlineClass);
  7116. inline.children().addClass('ui-state-disabled');
  7117. }
  7118. this._disabledInputs = $.map(this._disabledInputs,
  7119. function(value) { return (value == target ? null : value); }); // delete entry
  7120. this._disabledInputs[this._disabledInputs.length] = target;
  7121. },
  7122. /* Is the first field in a jQuery collection disabled as a datepicker?
  7123. @param target element - the target input field or division or span
  7124. @return boolean - true if disabled, false if enabled */
  7125. _isDisabledDatepicker: function(target) {
  7126. if (!target) {
  7127. return false;
  7128. }
  7129. for (var i = 0; i < this._disabledInputs.length; i++) {
  7130. if (this._disabledInputs[i] == target)
  7131. return true;
  7132. }
  7133. return false;
  7134. },
  7135. /* Retrieve the instance data for the target control.
  7136. @param target element - the target input field or division or span
  7137. @return object - the associated instance data
  7138. @throws error if a jQuery problem getting data */
  7139. _getInst: function(target) {
  7140. try {
  7141. return $.data(target, PROP_NAME);
  7142. }
  7143. catch (err) {
  7144. throw 'Missing instance data for this datepicker';
  7145. }
  7146. },
  7147. /* Update or retrieve the settings for a date picker attached to an input field or division.
  7148. @param target element - the target input field or division or span
  7149. @param name object - the new settings to update or
  7150. string - the name of the setting to change or retrieve,
  7151. when retrieving also 'all' for all instance settings or
  7152. 'defaults' for all global defaults
  7153. @param value any - the new value for the setting
  7154. (omit if above is an object or to retrieve a value) */
  7155. _optionDatepicker: function(target, name, value) {
  7156. var inst = this._getInst(target);
  7157. if (arguments.length == 2 && typeof name == 'string') {
  7158. return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) :
  7159. (inst ? (name == 'all' ? $.extend({}, inst.settings) :
  7160. this._get(inst, name)) : null));
  7161. }
  7162. var settings = name || {};
  7163. if (typeof name == 'string') {
  7164. settings = {};
  7165. settings[name] = value;
  7166. }
  7167. if (inst) {
  7168. if (this._curInst == inst) {
  7169. this._hideDatepicker();
  7170. }
  7171. var date = this._getDateDatepicker(target, true);
  7172. extendRemove(inst.settings, settings);
  7173. this._attachments($(target), inst);
  7174. this._autoSize(inst);
  7175. this._setDateDatepicker(target, date);
  7176. this._updateDatepicker(inst);
  7177. }
  7178. },
  7179. // change method deprecated
  7180. _changeDatepicker: function(target, name, value) {
  7181. this._optionDatepicker(target, name, value);
  7182. },
  7183. /* Redraw the date picker attached to an input field or division.
  7184. @param target element - the target input field or division or span */
  7185. _refreshDatepicker: function(target) {
  7186. var inst = this._getInst(target);
  7187. if (inst) {
  7188. this._updateDatepicker(inst);
  7189. }
  7190. },
  7191. /* Set the dates for a jQuery selection.
  7192. @param target element - the target input field or division or span
  7193. @param date Date - the new date */
  7194. _setDateDatepicker: function(target, date) {
  7195. var inst = this._getInst(target);
  7196. if (inst) {
  7197. this._setDate(inst, date);
  7198. this._updateDatepicker(inst);
  7199. this._updateAlternate(inst);
  7200. }
  7201. },
  7202. /* Get the date(s) for the first entry in a jQuery selection.
  7203. @param target element - the target input field or division or span
  7204. @param noDefault boolean - true if no default date is to be used
  7205. @return Date - the current date */
  7206. _getDateDatepicker: function(target, noDefault) {
  7207. var inst = this._getInst(target);
  7208. if (inst && !inst.inline)
  7209. this._setDateFromField(inst, noDefault);
  7210. return (inst ? this._getDate(inst) : null);
  7211. },
  7212. /* Handle keystrokes. */
  7213. _doKeyDown: function(event) {
  7214. var inst = $.datepicker._getInst(event.target);
  7215. var handled = true;
  7216. var isRTL = inst.dpDiv.is('.ui-datepicker-rtl');
  7217. inst._keyEvent = true;
  7218. if ($.datepicker._datepickerShowing)
  7219. switch (event.keyCode) {
  7220. case 9: $.datepicker._hideDatepicker();
  7221. handled = false;
  7222. break; // hide on tab out
  7223. case 13: var sel = $('td.' + $.datepicker._dayOverClass, inst.dpDiv).
  7224. add($('td.' + $.datepicker._currentClass, inst.dpDiv));
  7225. if (sel[0])
  7226. $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
  7227. else
  7228. $.datepicker._hideDatepicker();
  7229. return false; // don't submit the form
  7230. break; // select the value on enter
  7231. case 27: $.datepicker._hideDatepicker();
  7232. break; // hide on escape
  7233. case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  7234. -$.datepicker._get(inst, 'stepBigMonths') :
  7235. -$.datepicker._get(inst, 'stepMonths')), 'M');
  7236. break; // previous month/year on page up/+ ctrl
  7237. case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  7238. +$.datepicker._get(inst, 'stepBigMonths') :
  7239. +$.datepicker._get(inst, 'stepMonths')), 'M');
  7240. break; // next month/year on page down/+ ctrl
  7241. case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target);
  7242. handled = event.ctrlKey || event.metaKey;
  7243. break; // clear on ctrl or command +end
  7244. case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target);
  7245. handled = event.ctrlKey || event.metaKey;
  7246. break; // current on ctrl or command +home
  7247. case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D');
  7248. handled = event.ctrlKey || event.metaKey;
  7249. // -1 day on ctrl or command +left
  7250. if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  7251. -$.datepicker._get(inst, 'stepBigMonths') :
  7252. -$.datepicker._get(inst, 'stepMonths')), 'M');
  7253. // next month/year on alt +left on Mac
  7254. break;
  7255. case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D');
  7256. handled = event.ctrlKey || event.metaKey;
  7257. break; // -1 week on ctrl or command +up
  7258. case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D');
  7259. handled = event.ctrlKey || event.metaKey;
  7260. // +1 day on ctrl or command +right
  7261. if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  7262. +$.datepicker._get(inst, 'stepBigMonths') :
  7263. +$.datepicker._get(inst, 'stepMonths')), 'M');
  7264. // next month/year on alt +right
  7265. break;
  7266. case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D');
  7267. handled = event.ctrlKey || event.metaKey;
  7268. break; // +1 week on ctrl or command +down
  7269. default: handled = false;
  7270. }
  7271. else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home
  7272. $.datepicker._showDatepicker(this);
  7273. else {
  7274. handled = false;
  7275. }
  7276. if (handled) {
  7277. event.preventDefault();
  7278. event.stopPropagation();
  7279. }
  7280. },
  7281. /* Filter entered characters - based on date format. */
  7282. _doKeyPress: function(event) {
  7283. var inst = $.datepicker._getInst(event.target);
  7284. if ($.datepicker._get(inst, 'constrainInput')) {
  7285. var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
  7286. var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
  7287. return event.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
  7288. }
  7289. },
  7290. /* Synchronise manual entry and field/alternate field. */
  7291. _doKeyUp: function(event) {
  7292. var inst = $.datepicker._getInst(event.target);
  7293. if (inst.input.val() != inst.lastVal) {
  7294. try {
  7295. var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
  7296. (inst.input ? inst.input.val() : null),
  7297. $.datepicker._getFormatConfig(inst));
  7298. if (date) { // only if valid
  7299. $.datepicker._setDateFromField(inst);
  7300. $.datepicker._updateAlternate(inst);
  7301. $.datepicker._updateDatepicker(inst);
  7302. }
  7303. }
  7304. catch (event) {
  7305. $.datepicker.log(event);
  7306. }
  7307. }
  7308. return true;
  7309. },
  7310. /* Pop-up the date picker for a given input field.
  7311. @param input element - the input field attached to the date picker or
  7312. event - if triggered by focus */
  7313. _showDatepicker: function(input) {
  7314. input = input.target || input;
  7315. if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
  7316. input = $('input', input.parentNode)[0];
  7317. if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
  7318. return;
  7319. var inst = $.datepicker._getInst(input);
  7320. if ($.datepicker._curInst && $.datepicker._curInst != inst) {
  7321. $.datepicker._curInst.dpDiv.stop(true, true);
  7322. }
  7323. var beforeShow = $.datepicker._get(inst, 'beforeShow');
  7324. extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
  7325. inst.lastVal = null;
  7326. $.datepicker._lastInput = input;
  7327. $.datepicker._setDateFromField(inst);
  7328. if ($.datepicker._inDialog) // hide cursor
  7329. input.value = '';
  7330. if (!$.datepicker._pos) { // position below input
  7331. $.datepicker._pos = $.datepicker._findPos(input);
  7332. $.datepicker._pos[1] += input.offsetHeight; // add the height
  7333. }
  7334. var isFixed = false;
  7335. $(input).parents().each(function() {
  7336. isFixed |= $(this).css('position') == 'fixed';
  7337. return !isFixed;
  7338. });
  7339. if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled
  7340. $.datepicker._pos[0] -= document.documentElement.scrollLeft;
  7341. $.datepicker._pos[1] -= document.documentElement.scrollTop;
  7342. }
  7343. var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
  7344. $.datepicker._pos = null;
  7345. // determine sizing offscreen
  7346. inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
  7347. $.datepicker._updateDatepicker(inst);
  7348. // fix width for dynamic number of date pickers
  7349. // and adjust position before showing
  7350. offset = $.datepicker._checkOffset(inst, offset, isFixed);
  7351. inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
  7352. 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
  7353. left: offset.left + 'px', top: offset.top + 'px'});
  7354. if (!inst.inline) {
  7355. var showAnim = $.datepicker._get(inst, 'showAnim');
  7356. var duration = $.datepicker._get(inst, 'duration');
  7357. var postProcess = function() {
  7358. $.datepicker._datepickerShowing = true;
  7359. var borders = $.datepicker._getBorders(inst.dpDiv);
  7360. inst.dpDiv.find('iframe.ui-datepicker-cover'). // IE6- only
  7361. css({left: -borders[0], top: -borders[1],
  7362. width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()});
  7363. };
  7364. inst.dpDiv.zIndex($(input).zIndex()+1);
  7365. if ($.effects && $.effects[showAnim])
  7366. inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
  7367. else
  7368. inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);
  7369. if (!showAnim || !duration)
  7370. postProcess();
  7371. if (inst.input.is(':visible') && !inst.input.is(':disabled'))
  7372. inst.input.focus();
  7373. $.datepicker._curInst = inst;
  7374. }
  7375. },
  7376. /* Generate the date picker content. */
  7377. _updateDatepicker: function(inst) {
  7378. var self = this;
  7379. var borders = $.datepicker._getBorders(inst.dpDiv);
  7380. inst.dpDiv.empty().append(this._generateHTML(inst))
  7381. .find('iframe.ui-datepicker-cover') // IE6- only
  7382. .css({left: -borders[0], top: -borders[1],
  7383. width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
  7384. .end()
  7385. .find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a')
  7386. .bind('mouseout', function(){
  7387. $(this).removeClass('ui-state-hover');
  7388. if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');
  7389. if(this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover');
  7390. })
  7391. .bind('mouseover', function(){
  7392. if (!self._isDisabledDatepicker( inst.inline ? inst.dpDiv.parent()[0] : inst.input[0])) {
  7393. $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
  7394. $(this).addClass('ui-state-hover');
  7395. if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover');
  7396. if(this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover');
  7397. }
  7398. })
  7399. .end()
  7400. .find('.' + this._dayOverClass + ' a')
  7401. .trigger('mouseover')
  7402. .end();
  7403. var numMonths = this._getNumberOfMonths(inst);
  7404. var cols = numMonths[1];
  7405. var width = 17;
  7406. if (cols > 1)
  7407. inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
  7408. else
  7409. inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
  7410. inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
  7411. 'Class']('ui-datepicker-multi');
  7412. inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
  7413. 'Class']('ui-datepicker-rtl');
  7414. if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
  7415. inst.input.is(':visible') && !inst.input.is(':disabled'))
  7416. inst.input.focus();
  7417. },
  7418. /* Retrieve the size of left and top borders for an element.
  7419. @param elem (jQuery object) the element of interest
  7420. @return (number[2]) the left and top borders */
  7421. _getBorders: function(elem) {
  7422. var convert = function(value) {
  7423. return {thin: 1, medium: 2, thick: 3}[value] || value;
  7424. };
  7425. return [parseFloat(convert(elem.css('border-left-width'))),
  7426. parseFloat(convert(elem.css('border-top-width')))];
  7427. },
  7428. /* Check positioning to remain on screen. */
  7429. _checkOffset: function(inst, offset, isFixed) {
  7430. var dpWidth = inst.dpDiv.outerWidth();
  7431. var dpHeight = inst.dpDiv.outerHeight();
  7432. var inputWidth = inst.input ? inst.input.outerWidth() : 0;
  7433. var inputHeight = inst.input ? inst.input.outerHeight() : 0;
  7434. var viewWidth = document.documentElement.clientWidth + $(document).scrollLeft();
  7435. var viewHeight = document.documentElement.clientHeight + $(document).scrollTop();
  7436. offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
  7437. offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
  7438. offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
  7439. // now check if datepicker is showing outside window viewport - move to a better place if so.
  7440. offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
  7441. Math.abs(offset.left + dpWidth - viewWidth) : 0);
  7442. offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
  7443. Math.abs(dpHeight + inputHeight) : 0);
  7444. return offset;
  7445. },
  7446. /* Find an object's position on the screen. */
  7447. _findPos: function(obj) {
  7448. var inst = this._getInst(obj);
  7449. var isRTL = this._get(inst, 'isRTL');
  7450. while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
  7451. obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
  7452. }
  7453. var position = $(obj).offset();
  7454. return [position.left, position.top];
  7455. },
  7456. /* Hide the date picker from view.
  7457. @param input element - the input field attached to the date picker */
  7458. _hideDatepicker: function(input) {
  7459. var inst = this._curInst;
  7460. if (!inst || (input && inst != $.data(input, PROP_NAME)))
  7461. return;
  7462. if (this._datepickerShowing) {
  7463. var showAnim = this._get(inst, 'showAnim');
  7464. var duration = this._get(inst, 'duration');
  7465. var postProcess = function() {
  7466. $.datepicker._tidyDialog(inst);
  7467. this._curInst = null;
  7468. };
  7469. if ($.effects && $.effects[showAnim])
  7470. inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
  7471. else
  7472. inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' :
  7473. (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
  7474. if (!showAnim)
  7475. postProcess();
  7476. var onClose = this._get(inst, 'onClose');
  7477. if (onClose)
  7478. onClose.apply((inst.input ? inst.input[0] : null),
  7479. [(inst.input ? inst.input.val() : ''), inst]); // trigger custom callback
  7480. this._datepickerShowing = false;
  7481. this._lastInput = null;
  7482. if (this._inDialog) {
  7483. this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
  7484. if ($.blockUI) {
  7485. $.unblockUI();
  7486. $('body').append(this.dpDiv);
  7487. }
  7488. }
  7489. this._inDialog = false;
  7490. }
  7491. },
  7492. /* Tidy up after a dialog display. */
  7493. _tidyDialog: function(inst) {
  7494. inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');
  7495. },
  7496. /* Close date picker if clicked elsewhere. */
  7497. _checkExternalClick: function(event) {
  7498. if (!$.datepicker._curInst)
  7499. return;
  7500. var $target = $(event.target);
  7501. if ($target[0].id != $.datepicker._mainDivId &&
  7502. $target.parents('#' + $.datepicker._mainDivId).length == 0 &&
  7503. !$target.hasClass($.datepicker.markerClassName) &&
  7504. !$target.hasClass($.datepicker._triggerClass) &&
  7505. $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))
  7506. $.datepicker._hideDatepicker();
  7507. },
  7508. /* Adjust one of the date sub-fields. */
  7509. _adjustDate: function(id, offset, period) {
  7510. var target = $(id);
  7511. var inst = this._getInst(target[0]);
  7512. if (this._isDisabledDatepicker(target[0])) {
  7513. return;
  7514. }
  7515. this._adjustInstDate(inst, offset +
  7516. (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning
  7517. period);
  7518. this._updateDatepicker(inst);
  7519. },
  7520. /* Action for current link. */
  7521. _gotoToday: function(id) {
  7522. var target = $(id);
  7523. var inst = this._getInst(target[0]);
  7524. if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
  7525. inst.selectedDay = inst.currentDay;
  7526. inst.drawMonth = inst.selectedMonth = inst.currentMonth;
  7527. inst.drawYear = inst.selectedYear = inst.currentYear;
  7528. }
  7529. else {
  7530. var date = new Date();
  7531. inst.selectedDay = date.getDate();
  7532. inst.drawMonth = inst.selectedMonth = date.getMonth();
  7533. inst.drawYear = inst.selectedYear = date.getFullYear();
  7534. }
  7535. this._notifyChange(inst);
  7536. this._adjustDate(target);
  7537. },
  7538. /* Action for selecting a new month/year. */
  7539. _selectMonthYear: function(id, select, period) {
  7540. var target = $(id);
  7541. var inst = this._getInst(target[0]);
  7542. inst._selectingMonthYear = false;
  7543. inst['selected' + (period == 'M' ? 'Month' : 'Year')] =
  7544. inst['draw' + (period == 'M' ? 'Month' : 'Year')] =
  7545. parseInt(select.options[select.selectedIndex].value,10);
  7546. this._notifyChange(inst);
  7547. this._adjustDate(target);
  7548. },
  7549. /* Restore input focus after not changing month/year. */
  7550. _clickMonthYear: function(id) {
  7551. var target = $(id);
  7552. var inst = this._getInst(target[0]);
  7553. if (inst.input && inst._selectingMonthYear) {
  7554. setTimeout(function() {
  7555. inst.input.focus();
  7556. }, 0);
  7557. }
  7558. inst._selectingMonthYear = !inst._selectingMonthYear;
  7559. },
  7560. /* Action for selecting a day. */
  7561. _selectDay: function(id, month, year, td) {
  7562. var target = $(id);
  7563. if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
  7564. return;
  7565. }
  7566. var inst = this._getInst(target[0]);
  7567. inst.selectedDay = inst.currentDay = $('a', td).html();
  7568. inst.selectedMonth = inst.currentMonth = month;
  7569. inst.selectedYear = inst.currentYear = year;
  7570. this._selectDate(id, this._formatDate(inst,
  7571. inst.currentDay, inst.currentMonth, inst.currentYear));
  7572. },
  7573. /* Erase the input field and hide the date picker. */
  7574. _clearDate: function(id) {
  7575. var target = $(id);
  7576. var inst = this._getInst(target[0]);
  7577. this._selectDate(target, '');
  7578. },
  7579. /* Update the input field with the selected date. */
  7580. _selectDate: function(id, dateStr) {
  7581. var target = $(id);
  7582. var inst = this._getInst(target[0]);
  7583. dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
  7584. if (inst.input)
  7585. inst.input.val(dateStr);
  7586. this._updateAlternate(inst);
  7587. var onSelect = this._get(inst, 'onSelect');
  7588. if (onSelect)
  7589. onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
  7590. else if (inst.input)
  7591. inst.input.trigger('change'); // fire the change event
  7592. if (inst.inline)
  7593. this._updateDatepicker(inst);
  7594. else {
  7595. this._hideDatepicker();
  7596. this._lastInput = inst.input[0];
  7597. if (typeof(inst.input[0]) != 'object')
  7598. inst.input.focus(); // restore focus
  7599. this._lastInput = null;
  7600. }
  7601. },
  7602. /* Update any alternate field to synchronise with the main field. */
  7603. _updateAlternate: function(inst) {
  7604. var altField = this._get(inst, 'altField');
  7605. if (altField) { // update alternate field too
  7606. var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');
  7607. var date = this._getDate(inst);
  7608. var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
  7609. $(altField).each(function() { $(this).val(dateStr); });
  7610. }
  7611. },
  7612. /* Set as beforeShowDay function to prevent selection of weekends.
  7613. @param date Date - the date to customise
  7614. @return [boolean, string] - is this date selectable?, what is its CSS class? */
  7615. noWeekends: function(date) {
  7616. var day = date.getDay();
  7617. return [(day > 0 && day < 6), ''];
  7618. },
  7619. /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
  7620. @param date Date - the date to get the week for
  7621. @return number - the number of the week within the year that contains this date */
  7622. iso8601Week: function(date) {
  7623. var checkDate = new Date(date.getTime());
  7624. // Find Thursday of this week starting on Monday
  7625. checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
  7626. var time = checkDate.getTime();
  7627. checkDate.setMonth(0); // Compare with Jan 1
  7628. checkDate.setDate(1);
  7629. return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
  7630. },
  7631. /* Parse a string value into a date object.
  7632. See formatDate below for the possible formats.
  7633. @param format string - the expected format of the date
  7634. @param value string - the date in the above format
  7635. @param settings Object - attributes include:
  7636. shortYearCutoff number - the cutoff year for determining the century (optional)
  7637. dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
  7638. dayNames string[7] - names of the days from Sunday (optional)
  7639. monthNamesShort string[12] - abbreviated names of the months (optional)
  7640. monthNames string[12] - names of the months (optional)
  7641. @return Date - the extracted date value or null if value is blank */
  7642. parseDate: function (format, value, settings) {
  7643. if (format == null || value == null)
  7644. throw 'Invalid arguments';
  7645. value = (typeof value == 'object' ? value.toString() : value + '');
  7646. if (value == '')
  7647. return null;
  7648. var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
  7649. var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
  7650. var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
  7651. var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
  7652. var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
  7653. var year = -1;
  7654. var month = -1;
  7655. var day = -1;
  7656. var doy = -1;
  7657. var literal = false;
  7658. // Check whether a format character is doubled
  7659. var lookAhead = function(match) {
  7660. var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
  7661. if (matches)
  7662. iFormat++;
  7663. return matches;
  7664. };
  7665. // Extract a number from the string value
  7666. var getNumber = function(match) {
  7667. lookAhead(match);
  7668. var size = (match == '@' ? 14 : (match == '!' ? 20 :
  7669. (match == 'y' ? 4 : (match == 'o' ? 3 : 2))));
  7670. var digits = new RegExp('^\\d{1,' + size + '}');
  7671. var num = value.substring(iValue).match(digits);
  7672. if (!num)
  7673. throw 'Missing number at position ' + iValue;
  7674. iValue += num[0].length;
  7675. return parseInt(num[0], 10);
  7676. };
  7677. // Extract a name from the string value and convert to an index
  7678. var getName = function(match, shortNames, longNames) {
  7679. var names = (lookAhead(match) ? longNames : shortNames);
  7680. for (var i = 0; i < names.length; i++) {
  7681. if (value.substr(iValue, names[i].length).toLowerCase() == names[i].toLowerCase()) {
  7682. iValue += names[i].length;
  7683. return i + 1;
  7684. }
  7685. }
  7686. throw 'Unknown name at position ' + iValue;
  7687. };
  7688. // Confirm that a literal character matches the string value
  7689. var checkLiteral = function() {
  7690. if (value.charAt(iValue) != format.charAt(iFormat))
  7691. throw 'Unexpected literal at position ' + iValue;
  7692. iValue++;
  7693. };
  7694. var iValue = 0;
  7695. for (var iFormat = 0; iFormat < format.length; iFormat++) {
  7696. if (literal)
  7697. if (format.charAt(iFormat) == "'" && !lookAhead("'"))
  7698. literal = false;
  7699. else
  7700. checkLiteral();
  7701. else
  7702. switch (format.charAt(iFormat)) {
  7703. case 'd':
  7704. day = getNumber('d');
  7705. break;
  7706. case 'D':
  7707. getName('D', dayNamesShort, dayNames);
  7708. break;
  7709. case 'o':
  7710. doy = getNumber('o');
  7711. break;
  7712. case 'm':
  7713. month = getNumber('m');
  7714. break;
  7715. case 'M':
  7716. month = getName('M', monthNamesShort, monthNames);
  7717. break;
  7718. case 'y':
  7719. year = getNumber('y');
  7720. break;
  7721. case '@':
  7722. var date = new Date(getNumber('@'));
  7723. year = date.getFullYear();
  7724. month = date.getMonth() + 1;
  7725. day = date.getDate();
  7726. break;
  7727. case '!':
  7728. var date = new Date((getNumber('!') - this._ticksTo1970) / 10000);
  7729. year = date.getFullYear();
  7730. month = date.getMonth() + 1;
  7731. day = date.getDate();
  7732. break;
  7733. case "'":
  7734. if (lookAhead("'"))
  7735. checkLiteral();
  7736. else
  7737. literal = true;
  7738. break;
  7739. default:
  7740. checkLiteral();
  7741. }
  7742. }
  7743. if (year == -1)
  7744. year = new Date().getFullYear();
  7745. else if (year < 100)
  7746. year += new Date().getFullYear() - new Date().getFullYear() % 100 +
  7747. (year <= shortYearCutoff ? 0 : -100);
  7748. if (doy > -1) {
  7749. month = 1;
  7750. day = doy;
  7751. do {
  7752. var dim = this._getDaysInMonth(year, month - 1);
  7753. if (day <= dim)
  7754. break;
  7755. month++;
  7756. day -= dim;
  7757. } while (true);
  7758. }
  7759. var date = this._daylightSavingAdjust(new Date(year, month - 1, day));
  7760. if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)
  7761. throw 'Invalid date'; // E.g. 31/02/*
  7762. return date;
  7763. },
  7764. /* Standard date formats. */
  7765. ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
  7766. COOKIE: 'D, dd M yy',
  7767. ISO_8601: 'yy-mm-dd',
  7768. RFC_822: 'D, d M y',
  7769. RFC_850: 'DD, dd-M-y',
  7770. RFC_1036: 'D, d M y',
  7771. RFC_1123: 'D, d M yy',
  7772. RFC_2822: 'D, d M yy',
  7773. RSS: 'D, d M y', // RFC 822
  7774. TICKS: '!',
  7775. TIMESTAMP: '@',
  7776. W3C: 'yy-mm-dd', // ISO 8601
  7777. _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
  7778. Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
  7779. /* Format a date object into a string value.
  7780. The format can be combinations of the following:
  7781. d - day of month (no leading zero)
  7782. dd - day of month (two digit)
  7783. o - day of year (no leading zeros)
  7784. oo - day of year (three digit)
  7785. D - day name short
  7786. DD - day name long
  7787. m - month of year (no leading zero)
  7788. mm - month of year (two digit)
  7789. M - month name short
  7790. MM - month name long
  7791. y - year (two digit)
  7792. yy - year (four digit)
  7793. @ - Unix timestamp (ms since 01/01/1970)
  7794. ! - Windows ticks (100ns since 01/01/0001)
  7795. '...' - literal text
  7796. '' - single quote
  7797. @param format string - the desired format of the date
  7798. @param date Date - the date value to format
  7799. @param settings Object - attributes include:
  7800. dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
  7801. dayNames string[7] - names of the days from Sunday (optional)
  7802. monthNamesShort string[12] - abbreviated names of the months (optional)
  7803. monthNames string[12] - names of the months (optional)
  7804. @return string - the date in the above format */
  7805. formatDate: function (format, date, settings) {
  7806. if (!date)
  7807. return '';
  7808. var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
  7809. var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
  7810. var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
  7811. var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
  7812. // Check whether a format character is doubled
  7813. var lookAhead = function(match) {
  7814. var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
  7815. if (matches)
  7816. iFormat++;
  7817. return matches;
  7818. };
  7819. // Format a number, with leading zero if necessary
  7820. var formatNumber = function(match, value, len) {
  7821. var num = '' + value;
  7822. if (lookAhead(match))
  7823. while (num.length < len)
  7824. num = '0' + num;
  7825. return num;
  7826. };
  7827. // Format a name, short or long as requested
  7828. var formatName = function(match, value, shortNames, longNames) {
  7829. return (lookAhead(match) ? longNames[value] : shortNames[value]);
  7830. };
  7831. var output = '';
  7832. var literal = false;
  7833. if (date)
  7834. for (var iFormat = 0; iFormat < format.length; iFormat++) {
  7835. if (literal)
  7836. if (format.charAt(iFormat) == "'" && !lookAhead("'"))
  7837. literal = false;
  7838. else
  7839. output += format.charAt(iFormat);
  7840. else
  7841. switch (format.charAt(iFormat)) {
  7842. case 'd':
  7843. output += formatNumber('d', date.getDate(), 2);
  7844. break;
  7845. case 'D':
  7846. output += formatName('D', date.getDay(), dayNamesShort, dayNames);
  7847. break;
  7848. case 'o':
  7849. output += formatNumber('o',
  7850. (date.getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000, 3);
  7851. break;
  7852. case 'm':
  7853. output += formatNumber('m', date.getMonth() + 1, 2);
  7854. break;
  7855. case 'M':
  7856. output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
  7857. break;
  7858. case 'y':
  7859. output += (lookAhead('y') ? date.getFullYear() :
  7860. (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
  7861. break;
  7862. case '@':
  7863. output += date.getTime();
  7864. break;
  7865. case '!':
  7866. output += date.getTime() * 10000 + this._ticksTo1970;
  7867. break;
  7868. case "'":
  7869. if (lookAhead("'"))
  7870. output += "'";
  7871. else
  7872. literal = true;
  7873. break;
  7874. default:
  7875. output += format.charAt(iFormat);
  7876. }
  7877. }
  7878. return output;
  7879. },
  7880. /* Extract all possible characters from the date format. */
  7881. _possibleChars: function (format) {
  7882. var chars = '';
  7883. var literal = false;
  7884. // Check whether a format character is doubled
  7885. var lookAhead = function(match) {
  7886. var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
  7887. if (matches)
  7888. iFormat++;
  7889. return matches;
  7890. };
  7891. for (var iFormat = 0; iFormat < format.length; iFormat++)
  7892. if (literal)
  7893. if (format.charAt(iFormat) == "'" && !lookAhead("'"))
  7894. literal = false;
  7895. else
  7896. chars += format.charAt(iFormat);
  7897. else
  7898. switch (format.charAt(iFormat)) {
  7899. case 'd': case 'm': case 'y': case '@':
  7900. chars += '0123456789';
  7901. break;
  7902. case 'D': case 'M':
  7903. return null; // Accept anything
  7904. case "'":
  7905. if (lookAhead("'"))
  7906. chars += "'";
  7907. else
  7908. literal = true;
  7909. break;
  7910. default:
  7911. chars += format.charAt(iFormat);
  7912. }
  7913. return chars;
  7914. },
  7915. /* Get a setting value, defaulting if necessary. */
  7916. _get: function(inst, name) {
  7917. return inst.settings[name] !== undefined ?
  7918. inst.settings[name] : this._defaults[name];
  7919. },
  7920. /* Parse existing date and initialise date picker. */
  7921. _setDateFromField: function(inst, noDefault) {
  7922. if (inst.input.val() == inst.lastVal) {
  7923. return;
  7924. }
  7925. var dateFormat = this._get(inst, 'dateFormat');
  7926. var dates = inst.lastVal = inst.input ? inst.input.val() : null;
  7927. var date, defaultDate;
  7928. date = defaultDate = this._getDefaultDate(inst);
  7929. var settings = this._getFormatConfig(inst);
  7930. try {
  7931. date = this.parseDate(dateFormat, dates, settings) || defaultDate;
  7932. } catch (event) {
  7933. this.log(event);
  7934. dates = (noDefault ? '' : dates);
  7935. }
  7936. inst.selectedDay = date.getDate();
  7937. inst.drawMonth = inst.selectedMonth = date.getMonth();
  7938. inst.drawYear = inst.selectedYear = date.getFullYear();
  7939. inst.currentDay = (dates ? date.getDate() : 0);
  7940. inst.currentMonth = (dates ? date.getMonth() : 0);
  7941. inst.currentYear = (dates ? date.getFullYear() : 0);
  7942. this._adjustInstDate(inst);
  7943. },
  7944. /* Retrieve the default date shown on opening. */
  7945. _getDefaultDate: function(inst) {
  7946. return this._restrictMinMax(inst,
  7947. this._determineDate(inst, this._get(inst, 'defaultDate'), new Date()));
  7948. },
  7949. /* A date may be specified as an exact value or a relative one. */
  7950. _determineDate: function(inst, date, defaultDate) {
  7951. var offsetNumeric = function(offset) {
  7952. var date = new Date();
  7953. date.setDate(date.getDate() + offset);
  7954. return date;
  7955. };
  7956. var offsetString = function(offset) {
  7957. try {
  7958. return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
  7959. offset, $.datepicker._getFormatConfig(inst));
  7960. }
  7961. catch (e) {
  7962. // Ignore
  7963. }
  7964. var date = (offset.toLowerCase().match(/^c/) ?
  7965. $.datepicker._getDate(inst) : null) || new Date();
  7966. var year = date.getFullYear();
  7967. var month = date.getMonth();
  7968. var day = date.getDate();
  7969. var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
  7970. var matches = pattern.exec(offset);
  7971. while (matches) {
  7972. switch (matches[2] || 'd') {
  7973. case 'd' : case 'D' :
  7974. day += parseInt(matches[1],10); break;
  7975. case 'w' : case 'W' :
  7976. day += parseInt(matches[1],10) * 7; break;
  7977. case 'm' : case 'M' :
  7978. month += parseInt(matches[1],10);
  7979. day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
  7980. break;
  7981. case 'y': case 'Y' :
  7982. year += parseInt(matches[1],10);
  7983. day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
  7984. break;
  7985. }
  7986. matches = pattern.exec(offset);
  7987. }
  7988. return new Date(year, month, day);
  7989. };
  7990. date = (date == null ? defaultDate : (typeof date == 'string' ? offsetString(date) :
  7991. (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : date)));
  7992. date = (date && date.toString() == 'Invalid Date' ? defaultDate : date);
  7993. if (date) {
  7994. date.setHours(0);
  7995. date.setMinutes(0);
  7996. date.setSeconds(0);
  7997. date.setMilliseconds(0);
  7998. }
  7999. return this._daylightSavingAdjust(date);
  8000. },
  8001. /* Handle switch to/from daylight saving.
  8002. Hours may be non-zero on daylight saving cut-over:
  8003. > 12 when midnight changeover, but then cannot generate
  8004. midnight datetime, so jump to 1AM, otherwise reset.
  8005. @param date (Date) the date to check
  8006. @return (Date) the corrected date */
  8007. _daylightSavingAdjust: function(date) {
  8008. if (!date) return null;
  8009. date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
  8010. return date;
  8011. },
  8012. /* Set the date(s) directly. */
  8013. _setDate: function(inst, date, noChange) {
  8014. var clear = !(date);
  8015. var origMonth = inst.selectedMonth;
  8016. var origYear = inst.selectedYear;
  8017. date = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
  8018. inst.selectedDay = inst.currentDay = date.getDate();
  8019. inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth();
  8020. inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear();
  8021. if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange)
  8022. this._notifyChange(inst);
  8023. this._adjustInstDate(inst);
  8024. if (inst.input) {
  8025. inst.input.val(clear ? '' : this._formatDate(inst));
  8026. }
  8027. },
  8028. /* Retrieve the date(s) directly. */
  8029. _getDate: function(inst) {
  8030. var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
  8031. this._daylightSavingAdjust(new Date(
  8032. inst.currentYear, inst.currentMonth, inst.currentDay)));
  8033. return startDate;
  8034. },
  8035. /* Generate the HTML for the current state of the date picker. */
  8036. _generateHTML: function(inst) {
  8037. var today = new Date();
  8038. today = this._daylightSavingAdjust(
  8039. new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time
  8040. var isRTL = this._get(inst, 'isRTL');
  8041. var showButtonPanel = this._get(inst, 'showButtonPanel');
  8042. var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
  8043. var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
  8044. var numMonths = this._getNumberOfMonths(inst);
  8045. var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
  8046. var stepMonths = this._get(inst, 'stepMonths');
  8047. var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
  8048. var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
  8049. new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
  8050. var minDate = this._getMinMaxDate(inst, 'min');
  8051. var maxDate = this._getMinMaxDate(inst, 'max');
  8052. var drawMonth = inst.drawMonth - showCurrentAtPos;
  8053. var drawYear = inst.drawYear;
  8054. if (drawMonth < 0) {
  8055. drawMonth += 12;
  8056. drawYear--;
  8057. }
  8058. if (maxDate) {
  8059. var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
  8060. maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
  8061. maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
  8062. while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
  8063. drawMonth--;
  8064. if (drawMonth < 0) {
  8065. drawMonth = 11;
  8066. drawYear--;
  8067. }
  8068. }
  8069. }
  8070. inst.drawMonth = drawMonth;
  8071. inst.drawYear = drawYear;
  8072. var prevText = this._get(inst, 'prevText');
  8073. prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
  8074. this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
  8075. this._getFormatConfig(inst)));
  8076. var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
  8077. '<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_' + dpuuid +
  8078. '.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' +
  8079. ' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' :
  8080. (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>'));
  8081. var nextText = this._get(inst, 'nextText');
  8082. nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
  8083. this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
  8084. this._getFormatConfig(inst)));
  8085. var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
  8086. '<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_' + dpuuid +
  8087. '.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' +
  8088. ' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' :
  8089. (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>'));
  8090. var currentText = this._get(inst, 'currentText');
  8091. var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
  8092. currentText = (!navigationAsDateFormat ? currentText :
  8093. this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
  8094. var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_' + dpuuid +
  8095. '.datepicker._hideDatepicker();">' + this._get(inst, 'closeText') + '</button>' : '');
  8096. var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') +
  8097. (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_' + dpuuid +
  8098. '.datepicker._gotoToday(\'#' + inst.id + '\');"' +
  8099. '>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
  8100. var firstDay = parseInt(this._get(inst, 'firstDay'),10);
  8101. firstDay = (isNaN(firstDay) ? 0 : firstDay);
  8102. var showWeek = this._get(inst, 'showWeek');
  8103. var dayNames = this._get(inst, 'dayNames');
  8104. var dayNamesShort = this._get(inst, 'dayNamesShort');
  8105. var dayNamesMin = this._get(inst, 'dayNamesMin');
  8106. var monthNames = this._get(inst, 'monthNames');
  8107. var monthNamesShort = this._get(inst, 'monthNamesShort');
  8108. var beforeShowDay = this._get(inst, 'beforeShowDay');
  8109. var showOtherMonths = this._get(inst, 'showOtherMonths');
  8110. var selectOtherMonths = this._get(inst, 'selectOtherMonths');
  8111. var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
  8112. var defaultDate = this._getDefaultDate(inst);
  8113. var html = '';
  8114. for (var row = 0; row < numMonths[0]; row++) {
  8115. var group = '';
  8116. for (var col = 0; col < numMonths[1]; col++) {
  8117. var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
  8118. var cornerClass = ' ui-corner-all';
  8119. var calender = '';
  8120. if (isMultiMonth) {
  8121. calender += '<div class="ui-datepicker-group';
  8122. if (numMonths[1] > 1)
  8123. switch (col) {
  8124. case 0: calender += ' ui-datepicker-group-first';
  8125. cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;
  8126. case numMonths[1]-1: calender += ' ui-datepicker-group-last';
  8127. cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;
  8128. default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break;
  8129. }
  8130. calender += '">';
  8131. }
  8132. calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' +
  8133. (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +
  8134. (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +
  8135. this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
  8136. row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
  8137. '</div><table class="ui-datepicker-calendar"><thead>' +
  8138. '<tr>';
  8139. var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : '');
  8140. for (var dow = 0; dow < 7; dow++) { // days of the week
  8141. var day = (dow + firstDay) % 7;
  8142. thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' +
  8143. '<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>';
  8144. }
  8145. calender += thead + '</tr></thead><tbody>';
  8146. var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
  8147. if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
  8148. inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
  8149. var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
  8150. var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate
  8151. var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
  8152. for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
  8153. calender += '<tr>';
  8154. var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' +
  8155. this._get(inst, 'calculateWeek')(printDate) + '</td>');
  8156. for (var dow = 0; dow < 7; dow++) { // create date picker days
  8157. var daySettings = (beforeShowDay ?
  8158. beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
  8159. var otherMonth = (printDate.getMonth() != drawMonth);
  8160. var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
  8161. (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
  8162. tbody += '<td class="' +
  8163. ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends
  8164. (otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
  8165. ((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key
  8166. (defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ?
  8167. // or defaultDate is current printedDate and defaultDate is selectedDate
  8168. ' ' + this._dayOverClass : '') + // highlight selected day
  8169. (unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable days
  8170. (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
  8171. (printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day
  8172. (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
  8173. ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
  8174. (unselectable ? '' : ' onclick="DP_jQuery_' + dpuuid + '.datepicker._selectDay(\'#' +
  8175. inst.id + '\',' + printDate.getMonth() + ',' + printDate.getFullYear() + ', this);return false;"') + '>' + // actions
  8176. (otherMonth && !showOtherMonths ? '&#xa0;' : // display for other months
  8177. (unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' +
  8178. (printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +
  8179. (printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day
  8180. (otherMonth ? ' ui-priority-secondary' : '') + // distinguish dates from other months
  8181. '" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display selectable date
  8182. printDate.setDate(printDate.getDate() + 1);
  8183. printDate = this._daylightSavingAdjust(printDate);
  8184. }
  8185. calender += tbody + '</tr>';
  8186. }
  8187. drawMonth++;
  8188. if (drawMonth > 11) {
  8189. drawMonth = 0;
  8190. drawYear++;
  8191. }
  8192. calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
  8193. ((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
  8194. group += calender;
  8195. }
  8196. html += group;
  8197. }
  8198. html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
  8199. '<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : '');
  8200. inst._keyEvent = false;
  8201. return html;
  8202. },
  8203. /* Generate the month and year header. */
  8204. _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
  8205. secondary, monthNames, monthNamesShort) {
  8206. var changeMonth = this._get(inst, 'changeMonth');
  8207. var changeYear = this._get(inst, 'changeYear');
  8208. var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');
  8209. var html = '<div class="ui-datepicker-title">';
  8210. var monthHtml = '';
  8211. // month selection
  8212. if (secondary || !changeMonth)
  8213. monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span>';
  8214. else {
  8215. var inMinYear = (minDate && minDate.getFullYear() == drawYear);
  8216. var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
  8217. monthHtml += '<select class="ui-datepicker-month" ' +
  8218. 'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' +
  8219. 'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
  8220. '>';
  8221. for (var month = 0; month < 12; month++) {
  8222. if ((!inMinYear || month >= minDate.getMonth()) &&
  8223. (!inMaxYear || month <= maxDate.getMonth()))
  8224. monthHtml += '<option value="' + month + '"' +
  8225. (month == drawMonth ? ' selected="selected"' : '') +
  8226. '>' + monthNamesShort[month] + '</option>';
  8227. }
  8228. monthHtml += '</select>';
  8229. }
  8230. if (!showMonthAfterYear)
  8231. html += monthHtml + (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '');
  8232. // year selection
  8233. if (secondary || !changeYear)
  8234. html += '<span class="ui-datepicker-year">' + drawYear + '</span>';
  8235. else {
  8236. // determine range of years to display
  8237. var years = this._get(inst, 'yearRange').split(':');
  8238. var thisYear = new Date().getFullYear();
  8239. var determineYear = function(value) {
  8240. var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) :
  8241. (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) :
  8242. parseInt(value, 10)));
  8243. return (isNaN(year) ? thisYear : year);
  8244. };
  8245. var year = determineYear(years[0]);
  8246. var endYear = Math.max(year, determineYear(years[1] || ''));
  8247. year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
  8248. endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
  8249. html += '<select class="ui-datepicker-year" ' +
  8250. 'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
  8251. 'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
  8252. '>';
  8253. for (; year <= endYear; year++) {
  8254. html += '<option value="' + year + '"' +
  8255. (year == drawYear ? ' selected="selected"' : '') +
  8256. '>' + year + '</option>';
  8257. }
  8258. html += '</select>';
  8259. }
  8260. html += this._get(inst, 'yearSuffix');
  8261. if (showMonthAfterYear)
  8262. html += (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '') + monthHtml;
  8263. html += '</div>'; // Close datepicker_header
  8264. return html;
  8265. },
  8266. /* Adjust one of the date sub-fields. */
  8267. _adjustInstDate: function(inst, offset, period) {
  8268. var year = inst.drawYear + (period == 'Y' ? offset : 0);
  8269. var month = inst.drawMonth + (period == 'M' ? offset : 0);
  8270. var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
  8271. (period == 'D' ? offset : 0);
  8272. var date = this._restrictMinMax(inst,
  8273. this._daylightSavingAdjust(new Date(year, month, day)));
  8274. inst.selectedDay = date.getDate();
  8275. inst.drawMonth = inst.selectedMonth = date.getMonth();
  8276. inst.drawYear = inst.selectedYear = date.getFullYear();
  8277. if (period == 'M' || period == 'Y')
  8278. this._notifyChange(inst);
  8279. },
  8280. /* Ensure a date is within any min/max bounds. */
  8281. _restrictMinMax: function(inst, date) {
  8282. var minDate = this._getMinMaxDate(inst, 'min');
  8283. var maxDate = this._getMinMaxDate(inst, 'max');
  8284. date = (minDate && date < minDate ? minDate : date);
  8285. date = (maxDate && date > maxDate ? maxDate : date);
  8286. return date;
  8287. },
  8288. /* Notify change of month/year. */
  8289. _notifyChange: function(inst) {
  8290. var onChange = this._get(inst, 'onChangeMonthYear');
  8291. if (onChange)
  8292. onChange.apply((inst.input ? inst.input[0] : null),
  8293. [inst.selectedYear, inst.selectedMonth + 1, inst]);
  8294. },
  8295. /* Determine the number of months to show. */
  8296. _getNumberOfMonths: function(inst) {
  8297. var numMonths = this._get(inst, 'numberOfMonths');
  8298. return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
  8299. },
  8300. /* Determine the current maximum date - ensure no time components are set. */
  8301. _getMinMaxDate: function(inst, minMax) {
  8302. return this._determineDate(inst, this._get(inst, minMax + 'Date'), null);
  8303. },
  8304. /* Find the number of days in a given month. */
  8305. _getDaysInMonth: function(year, month) {
  8306. return 32 - new Date(year, month, 32).getDate();
  8307. },
  8308. /* Find the day of the week of the first of a month. */
  8309. _getFirstDayOfMonth: function(year, month) {
  8310. return new Date(year, month, 1).getDay();
  8311. },
  8312. /* Determines if we should allow a "next/prev" month display change. */
  8313. _canAdjustMonth: function(inst, offset, curYear, curMonth) {
  8314. var numMonths = this._getNumberOfMonths(inst);
  8315. var date = this._daylightSavingAdjust(new Date(curYear,
  8316. curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
  8317. if (offset < 0)
  8318. date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
  8319. return this._isInRange(inst, date);
  8320. },
  8321. /* Is the given date in the accepted range? */
  8322. _isInRange: function(inst, date) {
  8323. var minDate = this._getMinMaxDate(inst, 'min');
  8324. var maxDate = this._getMinMaxDate(inst, 'max');
  8325. return ((!minDate || date.getTime() >= minDate.getTime()) &&
  8326. (!maxDate || date.getTime() <= maxDate.getTime()));
  8327. },
  8328. /* Provide the configuration settings for formatting/parsing. */
  8329. _getFormatConfig: function(inst) {
  8330. var shortYearCutoff = this._get(inst, 'shortYearCutoff');
  8331. shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
  8332. new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
  8333. return {shortYearCutoff: shortYearCutoff,
  8334. dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
  8335. monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
  8336. },
  8337. /* Format the given date for display. */
  8338. _formatDate: function(inst, day, month, year) {
  8339. if (!day) {
  8340. inst.currentDay = inst.selectedDay;
  8341. inst.currentMonth = inst.selectedMonth;
  8342. inst.currentYear = inst.selectedYear;
  8343. }
  8344. var date = (day ? (typeof day == 'object' ? day :
  8345. this._daylightSavingAdjust(new Date(year, month, day))) :
  8346. this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
  8347. return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
  8348. }
  8349. });
  8350. /* jQuery extend now ignores nulls! */
  8351. function extendRemove(target, props) {
  8352. $.extend(target, props);
  8353. for (var name in props)
  8354. if (props[name] == null || props[name] == undefined)
  8355. target[name] = props[name];
  8356. return target;
  8357. };
  8358. /* Determine whether an object is an array. */
  8359. function isArray(a) {
  8360. return (a && (($.browser.safari && typeof a == 'object' && a.length) ||
  8361. (a.constructor && a.constructor.toString().match(/\Array\(\)/))));
  8362. };
  8363. /* Invoke the datepicker functionality.
  8364. @param options string - a command, optionally followed by additional parameters or
  8365. Object - settings for attaching new datepicker functionality
  8366. @return jQuery object */
  8367. $.fn.datepicker = function(options){
  8368. /* Initialise the date picker. */
  8369. if (!$.datepicker.initialized) {
  8370. $(document).mousedown($.datepicker._checkExternalClick).
  8371. find('body').append($.datepicker.dpDiv);
  8372. $.datepicker.initialized = true;
  8373. }
  8374. var otherArgs = Array.prototype.slice.call(arguments, 1);
  8375. if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget'))
  8376. return $.datepicker['_' + options + 'Datepicker'].
  8377. apply($.datepicker, [this[0]].concat(otherArgs));
  8378. if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
  8379. return $.datepicker['_' + options + 'Datepicker'].
  8380. apply($.datepicker, [this[0]].concat(otherArgs));
  8381. return this.each(function() {
  8382. typeof options == 'string' ?
  8383. $.datepicker['_' + options + 'Datepicker'].
  8384. apply($.datepicker, [this].concat(otherArgs)) :
  8385. $.datepicker._attachDatepicker(this, options);
  8386. });
  8387. };
  8388. $.datepicker = new Datepicker(); // singleton instance
  8389. $.datepicker.initialized = false;
  8390. $.datepicker.uuid = new Date().getTime();
  8391. $.datepicker.version = "1.8.6";
  8392. // Workaround for #4055
  8393. // Add another global to avoid noConflict issues with inline event handlers
  8394. window['DP_jQuery_' + dpuuid] = $;
  8395. })(jQuery);
  8396. /*
  8397. * jQuery UI Progressbar 1.8.6
  8398. *
  8399. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  8400. * Dual licensed under the MIT or GPL Version 2 licenses.
  8401. * http://jquery.org/license
  8402. *
  8403. * http://docs.jquery.com/UI/Progressbar
  8404. *
  8405. * Depends:
  8406. * jquery.ui.core.js
  8407. * jquery.ui.widget.js
  8408. */
  8409. (function( $, undefined ) {
  8410. $.widget( "ui.progressbar", {
  8411. options: {
  8412. value: 0
  8413. },
  8414. min: 0,
  8415. max: 100,
  8416. _create: function() {
  8417. this.element
  8418. .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
  8419. .attr({
  8420. role: "progressbar",
  8421. "aria-valuemin": this.min,
  8422. "aria-valuemax": this.max,
  8423. "aria-valuenow": this._value()
  8424. });
  8425. this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
  8426. .appendTo( this.element );
  8427. this._refreshValue();
  8428. },
  8429. destroy: function() {
  8430. this.element
  8431. .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
  8432. .removeAttr( "role" )
  8433. .removeAttr( "aria-valuemin" )
  8434. .removeAttr( "aria-valuemax" )
  8435. .removeAttr( "aria-valuenow" );
  8436. this.valueDiv.remove();
  8437. $.Widget.prototype.destroy.apply( this, arguments );
  8438. },
  8439. value: function( newValue ) {
  8440. if ( newValue === undefined ) {
  8441. return this._value();
  8442. }
  8443. this._setOption( "value", newValue );
  8444. return this;
  8445. },
  8446. _setOption: function( key, value ) {
  8447. if ( key === "value" ) {
  8448. this.options.value = value;
  8449. this._refreshValue();
  8450. this._trigger( "change" );
  8451. if ( this._value() === this.max ) {
  8452. this._trigger( "complete" );
  8453. }
  8454. }
  8455. $.Widget.prototype._setOption.apply( this, arguments );
  8456. },
  8457. _value: function() {
  8458. var val = this.options.value;
  8459. // normalize invalid value
  8460. if ( typeof val !== "number" ) {
  8461. val = 0;
  8462. }
  8463. return Math.min( this.max, Math.max( this.min, val ) );
  8464. },
  8465. _refreshValue: function() {
  8466. var value = this.value();
  8467. this.valueDiv
  8468. .toggleClass( "ui-corner-right", value === this.max )
  8469. .width( value + "%" );
  8470. this.element.attr( "aria-valuenow", value );
  8471. }
  8472. });
  8473. $.extend( $.ui.progressbar, {
  8474. version: "1.8.6"
  8475. });
  8476. })( jQuery );
  8477. /*
  8478. * jQuery UI Effects 1.8.6
  8479. *
  8480. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  8481. * Dual licensed under the MIT or GPL Version 2 licenses.
  8482. * http://jquery.org/license
  8483. *
  8484. * http://docs.jquery.com/UI/Effects/
  8485. */
  8486. ;jQuery.effects || (function($, undefined) {
  8487. $.effects = {};
  8488. /******************************************************************************/
  8489. /****************************** COLOR ANIMATIONS ******************************/
  8490. /******************************************************************************/
  8491. // override the animation for color styles
  8492. $.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor',
  8493. 'borderRightColor', 'borderTopColor', 'borderColor', 'color', 'outlineColor'],
  8494. function(i, attr) {
  8495. $.fx.step[attr] = function(fx) {
  8496. if (!fx.colorInit) {
  8497. fx.start = getColor(fx.elem, attr);
  8498. fx.end = getRGB(fx.end);
  8499. fx.colorInit = true;
  8500. }
  8501. fx.elem.style[attr] = 'rgb(' +
  8502. Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' +
  8503. Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' +
  8504. Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')';
  8505. };
  8506. });
  8507. // Color Conversion functions from highlightFade
  8508. // By Blair Mitchelmore
  8509. // http://jquery.offput.ca/highlightFade/
  8510. // Parse strings looking for color tuples [255,255,255]
  8511. function getRGB(color) {
  8512. var result;
  8513. // Check if we're already dealing with an array of colors
  8514. if ( color && color.constructor == Array && color.length == 3 )
  8515. return color;
  8516. // Look for rgb(num,num,num)
  8517. if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
  8518. return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
  8519. // Look for rgb(num%,num%,num%)
  8520. if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
  8521. return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
  8522. // Look for #a0b1c2
  8523. if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
  8524. return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
  8525. // Look for #fff
  8526. if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
  8527. return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
  8528. // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
  8529. if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
  8530. return colors['transparent'];
  8531. // Otherwise, we're most likely dealing with a named color
  8532. return colors[$.trim(color).toLowerCase()];
  8533. }
  8534. function getColor(elem, attr) {
  8535. var color;
  8536. do {
  8537. color = $.curCSS(elem, attr);
  8538. // Keep going until we find an element that has color, or we hit the body
  8539. if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )
  8540. break;
  8541. attr = "backgroundColor";
  8542. } while ( elem = elem.parentNode );
  8543. return getRGB(color);
  8544. };
  8545. // Some named colors to work with
  8546. // From Interface by Stefan Petre
  8547. // http://interface.eyecon.ro/
  8548. var colors = {
  8549. aqua:[0,255,255],
  8550. azure:[240,255,255],
  8551. beige:[245,245,220],
  8552. black:[0,0,0],
  8553. blue:[0,0,255],
  8554. brown:[165,42,42],
  8555. cyan:[0,255,255],
  8556. darkblue:[0,0,139],
  8557. darkcyan:[0,139,139],
  8558. darkgrey:[169,169,169],
  8559. darkgreen:[0,100,0],
  8560. darkkhaki:[189,183,107],
  8561. darkmagenta:[139,0,139],
  8562. darkolivegreen:[85,107,47],
  8563. darkorange:[255,140,0],
  8564. darkorchid:[153,50,204],
  8565. darkred:[139,0,0],
  8566. darksalmon:[233,150,122],
  8567. darkviolet:[148,0,211],
  8568. fuchsia:[255,0,255],
  8569. gold:[255,215,0],
  8570. green:[0,128,0],
  8571. indigo:[75,0,130],
  8572. khaki:[240,230,140],
  8573. lightblue:[173,216,230],
  8574. lightcyan:[224,255,255],
  8575. lightgreen:[144,238,144],
  8576. lightgrey:[211,211,211],
  8577. lightpink:[255,182,193],
  8578. lightyellow:[255,255,224],
  8579. lime:[0,255,0],
  8580. magenta:[255,0,255],
  8581. maroon:[128,0,0],
  8582. navy:[0,0,128],
  8583. olive:[128,128,0],
  8584. orange:[255,165,0],
  8585. pink:[255,192,203],
  8586. purple:[128,0,128],
  8587. violet:[128,0,128],
  8588. red:[255,0,0],
  8589. silver:[192,192,192],
  8590. white:[255,255,255],
  8591. yellow:[255,255,0],
  8592. transparent: [255,255,255]
  8593. };
  8594. /******************************************************************************/
  8595. /****************************** CLASS ANIMATIONS ******************************/
  8596. /******************************************************************************/
  8597. var classAnimationActions = ['add', 'remove', 'toggle'],
  8598. shorthandStyles = {
  8599. border: 1,
  8600. borderBottom: 1,
  8601. borderColor: 1,
  8602. borderLeft: 1,
  8603. borderRight: 1,
  8604. borderTop: 1,
  8605. borderWidth: 1,
  8606. margin: 1,
  8607. padding: 1
  8608. };
  8609. function getElementStyles() {
  8610. var style = document.defaultView
  8611. ? document.defaultView.getComputedStyle(this, null)
  8612. : this.currentStyle,
  8613. newStyle = {},
  8614. key,
  8615. camelCase;
  8616. // webkit enumerates style porperties
  8617. if (style && style.length && style[0] && style[style[0]]) {
  8618. var len = style.length;
  8619. while (len--) {
  8620. key = style[len];
  8621. if (typeof style[key] == 'string') {
  8622. camelCase = key.replace(/\-(\w)/g, function(all, letter){
  8623. return letter.toUpperCase();
  8624. });
  8625. newStyle[camelCase] = style[key];
  8626. }
  8627. }
  8628. } else {
  8629. for (key in style) {
  8630. if (typeof style[key] === 'string') {
  8631. newStyle[key] = style[key];
  8632. }
  8633. }
  8634. }
  8635. return newStyle;
  8636. }
  8637. function filterStyles(styles) {
  8638. var name, value;
  8639. for (name in styles) {
  8640. value = styles[name];
  8641. if (
  8642. // ignore null and undefined values
  8643. value == null ||
  8644. // ignore functions (when does this occur?)
  8645. $.isFunction(value) ||
  8646. // shorthand styles that need to be expanded
  8647. name in shorthandStyles ||
  8648. // ignore scrollbars (break in IE)
  8649. (/scrollbar/).test(name) ||
  8650. // only colors or values that can be converted to numbers
  8651. (!(/color/i).test(name) && isNaN(parseFloat(value)))
  8652. ) {
  8653. delete styles[name];
  8654. }
  8655. }
  8656. return styles;
  8657. }
  8658. function styleDifference(oldStyle, newStyle) {
  8659. var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459
  8660. name;
  8661. for (name in newStyle) {
  8662. if (oldStyle[name] != newStyle[name]) {
  8663. diff[name] = newStyle[name];
  8664. }
  8665. }
  8666. return diff;
  8667. }
  8668. $.effects.animateClass = function(value, duration, easing, callback) {
  8669. if ($.isFunction(easing)) {
  8670. callback = easing;
  8671. easing = null;
  8672. }
  8673. return this.each(function() {
  8674. var that = $(this),
  8675. originalStyleAttr = that.attr('style') || ' ',
  8676. originalStyle = filterStyles(getElementStyles.call(this)),
  8677. newStyle,
  8678. className = that.attr('className');
  8679. $.each(classAnimationActions, function(i, action) {
  8680. if (value[action]) {
  8681. that[action + 'Class'](value[action]);
  8682. }
  8683. });
  8684. newStyle = filterStyles(getElementStyles.call(this));
  8685. that.attr('className', className);
  8686. that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() {
  8687. $.each(classAnimationActions, function(i, action) {
  8688. if (value[action]) { that[action + 'Class'](value[action]); }
  8689. });
  8690. // work around bug in IE by clearing the cssText before setting it
  8691. if (typeof that.attr('style') == 'object') {
  8692. that.attr('style').cssText = '';
  8693. that.attr('style').cssText = originalStyleAttr;
  8694. } else {
  8695. that.attr('style', originalStyleAttr);
  8696. }
  8697. if (callback) { callback.apply(this, arguments); }
  8698. });
  8699. });
  8700. };
  8701. $.fn.extend({
  8702. _addClass: $.fn.addClass,
  8703. addClass: function(classNames, speed, easing, callback) {
  8704. return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
  8705. },
  8706. _removeClass: $.fn.removeClass,
  8707. removeClass: function(classNames,speed,easing,callback) {
  8708. return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
  8709. },
  8710. _toggleClass: $.fn.toggleClass,
  8711. toggleClass: function(classNames, force, speed, easing, callback) {
  8712. if ( typeof force == "boolean" || force === undefined ) {
  8713. if ( !speed ) {
  8714. // without speed parameter;
  8715. return this._toggleClass(classNames, force);
  8716. } else {
  8717. return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]);
  8718. }
  8719. } else {
  8720. // without switch parameter;
  8721. return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]);
  8722. }
  8723. },
  8724. switchClass: function(remove,add,speed,easing,callback) {
  8725. return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
  8726. }
  8727. });
  8728. /******************************************************************************/
  8729. /*********************************** EFFECTS **********************************/
  8730. /******************************************************************************/
  8731. $.extend($.effects, {
  8732. version: "1.8.6",
  8733. // Saves a set of properties in a data storage
  8734. save: function(element, set) {
  8735. for(var i=0; i < set.length; i++) {
  8736. if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);
  8737. }
  8738. },
  8739. // Restores a set of previously saved properties from a data storage
  8740. restore: function(element, set) {
  8741. for(var i=0; i < set.length; i++) {
  8742. if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));
  8743. }
  8744. },
  8745. setMode: function(el, mode) {
  8746. if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
  8747. return mode;
  8748. },
  8749. getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
  8750. // this should be a little more flexible in the future to handle a string & hash
  8751. var y, x;
  8752. switch (origin[0]) {
  8753. case 'top': y = 0; break;
  8754. case 'middle': y = 0.5; break;
  8755. case 'bottom': y = 1; break;
  8756. default: y = origin[0] / original.height;
  8757. };
  8758. switch (origin[1]) {
  8759. case 'left': x = 0; break;
  8760. case 'center': x = 0.5; break;
  8761. case 'right': x = 1; break;
  8762. default: x = origin[1] / original.width;
  8763. };
  8764. return {x: x, y: y};
  8765. },
  8766. // Wraps the element around a wrapper that copies position properties
  8767. createWrapper: function(element) {
  8768. // if the element is already wrapped, return it
  8769. if (element.parent().is('.ui-effects-wrapper')) {
  8770. return element.parent();
  8771. }
  8772. // wrap the element
  8773. var props = {
  8774. width: element.outerWidth(true),
  8775. height: element.outerHeight(true),
  8776. 'float': element.css('float')
  8777. },
  8778. wrapper = $('<div></div>')
  8779. .addClass('ui-effects-wrapper')
  8780. .css({
  8781. fontSize: '100%',
  8782. background: 'transparent',
  8783. border: 'none',
  8784. margin: 0,
  8785. padding: 0
  8786. });
  8787. element.wrap(wrapper);
  8788. wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element
  8789. // transfer positioning properties to the wrapper
  8790. if (element.css('position') == 'static') {
  8791. wrapper.css({ position: 'relative' });
  8792. element.css({ position: 'relative' });
  8793. } else {
  8794. $.extend(props, {
  8795. position: element.css('position'),
  8796. zIndex: element.css('z-index')
  8797. });
  8798. $.each(['top', 'left', 'bottom', 'right'], function(i, pos) {
  8799. props[pos] = element.css(pos);
  8800. if (isNaN(parseInt(props[pos], 10))) {
  8801. props[pos] = 'auto';
  8802. }
  8803. });
  8804. element.css({position: 'relative', top: 0, left: 0 });
  8805. }
  8806. return wrapper.css(props).show();
  8807. },
  8808. removeWrapper: function(element) {
  8809. if (element.parent().is('.ui-effects-wrapper'))
  8810. return element.parent().replaceWith(element);
  8811. return element;
  8812. },
  8813. setTransition: function(element, list, factor, value) {
  8814. value = value || {};
  8815. $.each(list, function(i, x){
  8816. unit = element.cssUnit(x);
  8817. if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
  8818. });
  8819. return value;
  8820. }
  8821. });
  8822. function _normalizeArguments(effect, options, speed, callback) {
  8823. // shift params for method overloading
  8824. if (typeof effect == 'object') {
  8825. callback = options;
  8826. speed = null;
  8827. options = effect;
  8828. effect = options.effect;
  8829. }
  8830. if ($.isFunction(options)) {
  8831. callback = options;
  8832. speed = null;
  8833. options = {};
  8834. }
  8835. if (typeof options == 'number' || $.fx.speeds[options]) {
  8836. callback = speed;
  8837. speed = options;
  8838. options = {};
  8839. }
  8840. if ($.isFunction(speed)) {
  8841. callback = speed;
  8842. speed = null;
  8843. }
  8844. options = options || {};
  8845. speed = speed || options.duration;
  8846. speed = $.fx.off ? 0 : typeof speed == 'number'
  8847. ? speed : $.fx.speeds[speed] || $.fx.speeds._default;
  8848. callback = callback || options.complete;
  8849. return [effect, options, speed, callback];
  8850. }
  8851. function standardSpeed( speed ) {
  8852. // valid standard speeds
  8853. if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) {
  8854. return true;
  8855. }
  8856. // invalid strings - treat as "normal" speed
  8857. if ( typeof speed === "string" && !$.effects[ speed ] ) {
  8858. return true;
  8859. }
  8860. return false;
  8861. }
  8862. $.fn.extend({
  8863. effect: function(effect, options, speed, callback) {
  8864. var args = _normalizeArguments.apply(this, arguments),
  8865. // TODO: make effects take actual parameters instead of a hash
  8866. args2 = {
  8867. options: args[1],
  8868. duration: args[2],
  8869. callback: args[3]
  8870. },
  8871. mode = args2.options.mode,
  8872. effectMethod = $.effects[effect];
  8873. if ( $.fx.off || !effectMethod ) {
  8874. // delegate to the original method (e.g., .show()) if possible
  8875. if ( mode ) {
  8876. return this[ mode ]( args2.duration, args2.callback );
  8877. } else {
  8878. return this.each(function() {
  8879. if ( args2.callback ) {
  8880. args2.callback.call( this );
  8881. }
  8882. });
  8883. }
  8884. }
  8885. return effectMethod.call(this, args2);
  8886. },
  8887. _show: $.fn.show,
  8888. show: function(speed) {
  8889. if ( standardSpeed( speed ) ) {
  8890. return this._show.apply(this, arguments);
  8891. } else {
  8892. var args = _normalizeArguments.apply(this, arguments);
  8893. args[1].mode = 'show';
  8894. return this.effect.apply(this, args);
  8895. }
  8896. },
  8897. _hide: $.fn.hide,
  8898. hide: function(speed) {
  8899. if ( standardSpeed( speed ) ) {
  8900. return this._hide.apply(this, arguments);
  8901. } else {
  8902. var args = _normalizeArguments.apply(this, arguments);
  8903. args[1].mode = 'hide';
  8904. return this.effect.apply(this, args);
  8905. }
  8906. },
  8907. // jQuery core overloads toggle and creates _toggle
  8908. __toggle: $.fn.toggle,
  8909. toggle: function(speed) {
  8910. if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) {
  8911. return this.__toggle.apply(this, arguments);
  8912. } else {
  8913. var args = _normalizeArguments.apply(this, arguments);
  8914. args[1].mode = 'toggle';
  8915. return this.effect.apply(this, args);
  8916. }
  8917. },
  8918. // helper functions
  8919. cssUnit: function(key) {
  8920. var style = this.css(key), val = [];
  8921. $.each( ['em','px','%','pt'], function(i, unit){
  8922. if(style.indexOf(unit) > 0)
  8923. val = [parseFloat(style), unit];
  8924. });
  8925. return val;
  8926. }
  8927. });
  8928. /******************************************************************************/
  8929. /*********************************** EASING ***********************************/
  8930. /******************************************************************************/
  8931. /*
  8932. * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
  8933. *
  8934. * Uses the built in easing capabilities added In jQuery 1.1
  8935. * to offer multiple easing options
  8936. *
  8937. * TERMS OF USE - jQuery Easing
  8938. *
  8939. * Open source under the BSD License.
  8940. *
  8941. * Copyright 2008 George McGinley Smith
  8942. * All rights reserved.
  8943. *
  8944. * Redistribution and use in source and binary forms, with or without modification,
  8945. * are permitted provided that the following conditions are met:
  8946. *
  8947. * Redistributions of source code must retain the above copyright notice, this list of
  8948. * conditions and the following disclaimer.
  8949. * Redistributions in binary form must reproduce the above copyright notice, this list
  8950. * of conditions and the following disclaimer in the documentation and/or other materials
  8951. * provided with the distribution.
  8952. *
  8953. * Neither the name of the author nor the names of contributors may be used to endorse
  8954. * or promote products derived from this software without specific prior written permission.
  8955. *
  8956. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
  8957. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  8958. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  8959. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  8960. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  8961. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  8962. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  8963. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  8964. * OF THE POSSIBILITY OF SUCH DAMAGE.
  8965. *
  8966. */
  8967. // t: current time, b: begInnIng value, c: change In value, d: duration
  8968. $.easing.jswing = $.easing.swing;
  8969. $.extend($.easing,
  8970. {
  8971. def: 'easeOutQuad',
  8972. swing: function (x, t, b, c, d) {
  8973. //alert($.easing.default);
  8974. return $.easing[$.easing.def](x, t, b, c, d);
  8975. },
  8976. easeInQuad: function (x, t, b, c, d) {
  8977. return c*(t/=d)*t + b;
  8978. },
  8979. easeOutQuad: function (x, t, b, c, d) {
  8980. return -c *(t/=d)*(t-2) + b;
  8981. },
  8982. easeInOutQuad: function (x, t, b, c, d) {
  8983. if ((t/=d/2) < 1) return c/2*t*t + b;
  8984. return -c/2 * ((--t)*(t-2) - 1) + b;
  8985. },
  8986. easeInCubic: function (x, t, b, c, d) {
  8987. return c*(t/=d)*t*t + b;
  8988. },
  8989. easeOutCubic: function (x, t, b, c, d) {
  8990. return c*((t=t/d-1)*t*t + 1) + b;
  8991. },
  8992. easeInOutCubic: function (x, t, b, c, d) {
  8993. if ((t/=d/2) < 1) return c/2*t*t*t + b;
  8994. return c/2*((t-=2)*t*t + 2) + b;
  8995. },
  8996. easeInQuart: function (x, t, b, c, d) {
  8997. return c*(t/=d)*t*t*t + b;
  8998. },
  8999. easeOutQuart: function (x, t, b, c, d) {
  9000. return -c * ((t=t/d-1)*t*t*t - 1) + b;
  9001. },
  9002. easeInOutQuart: function (x, t, b, c, d) {
  9003. if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
  9004. return -c/2 * ((t-=2)*t*t*t - 2) + b;
  9005. },
  9006. easeInQuint: function (x, t, b, c, d) {
  9007. return c*(t/=d)*t*t*t*t + b;
  9008. },
  9009. easeOutQuint: function (x, t, b, c, d) {
  9010. return c*((t=t/d-1)*t*t*t*t + 1) + b;
  9011. },
  9012. easeInOutQuint: function (x, t, b, c, d) {
  9013. if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
  9014. return c/2*((t-=2)*t*t*t*t + 2) + b;
  9015. },
  9016. easeInSine: function (x, t, b, c, d) {
  9017. return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
  9018. },
  9019. easeOutSine: function (x, t, b, c, d) {
  9020. return c * Math.sin(t/d * (Math.PI/2)) + b;
  9021. },
  9022. easeInOutSine: function (x, t, b, c, d) {
  9023. return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
  9024. },
  9025. easeInExpo: function (x, t, b, c, d) {
  9026. return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
  9027. },
  9028. easeOutExpo: function (x, t, b, c, d) {
  9029. return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
  9030. },
  9031. easeInOutExpo: function (x, t, b, c, d) {
  9032. if (t==0) return b;
  9033. if (t==d) return b+c;
  9034. if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
  9035. return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
  9036. },
  9037. easeInCirc: function (x, t, b, c, d) {
  9038. return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
  9039. },
  9040. easeOutCirc: function (x, t, b, c, d) {
  9041. return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
  9042. },
  9043. easeInOutCirc: function (x, t, b, c, d) {
  9044. if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
  9045. return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
  9046. },
  9047. easeInElastic: function (x, t, b, c, d) {
  9048. var s=1.70158;var p=0;var a=c;
  9049. if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
  9050. if (a < Math.abs(c)) { a=c; var s=p/4; }
  9051. else var s = p/(2*Math.PI) * Math.asin (c/a);
  9052. return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  9053. },
  9054. easeOutElastic: function (x, t, b, c, d) {
  9055. var s=1.70158;var p=0;var a=c;
  9056. if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
  9057. if (a < Math.abs(c)) { a=c; var s=p/4; }
  9058. else var s = p/(2*Math.PI) * Math.asin (c/a);
  9059. return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
  9060. },
  9061. easeInOutElastic: function (x, t, b, c, d) {
  9062. var s=1.70158;var p=0;var a=c;
  9063. if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
  9064. if (a < Math.abs(c)) { a=c; var s=p/4; }
  9065. else var s = p/(2*Math.PI) * Math.asin (c/a);
  9066. if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  9067. return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
  9068. },
  9069. easeInBack: function (x, t, b, c, d, s) {
  9070. if (s == undefined) s = 1.70158;
  9071. return c*(t/=d)*t*((s+1)*t - s) + b;
  9072. },
  9073. easeOutBack: function (x, t, b, c, d, s) {
  9074. if (s == undefined) s = 1.70158;
  9075. return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
  9076. },
  9077. easeInOutBack: function (x, t, b, c, d, s) {
  9078. if (s == undefined) s = 1.70158;
  9079. if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
  9080. return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
  9081. },
  9082. easeInBounce: function (x, t, b, c, d) {
  9083. return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;
  9084. },
  9085. easeOutBounce: function (x, t, b, c, d) {
  9086. if ((t/=d) < (1/2.75)) {
  9087. return c*(7.5625*t*t) + b;
  9088. } else if (t < (2/2.75)) {
  9089. return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
  9090. } else if (t < (2.5/2.75)) {
  9091. return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
  9092. } else {
  9093. return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
  9094. }
  9095. },
  9096. easeInOutBounce: function (x, t, b, c, d) {
  9097. if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
  9098. return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
  9099. }
  9100. });
  9101. /*
  9102. *
  9103. * TERMS OF USE - EASING EQUATIONS
  9104. *
  9105. * Open source under the BSD License.
  9106. *
  9107. * Copyright 2001 Robert Penner
  9108. * All rights reserved.
  9109. *
  9110. * Redistribution and use in source and binary forms, with or without modification,
  9111. * are permitted provided that the following conditions are met:
  9112. *
  9113. * Redistributions of source code must retain the above copyright notice, this list of
  9114. * conditions and the following disclaimer.
  9115. * Redistributions in binary form must reproduce the above copyright notice, this list
  9116. * of conditions and the following disclaimer in the documentation and/or other materials
  9117. * provided with the distribution.
  9118. *
  9119. * Neither the name of the author nor the names of contributors may be used to endorse
  9120. * or promote products derived from this software without specific prior written permission.
  9121. *
  9122. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
  9123. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  9124. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  9125. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  9126. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  9127. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  9128. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  9129. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  9130. * OF THE POSSIBILITY OF SUCH DAMAGE.
  9131. *
  9132. */
  9133. })(jQuery);
  9134. /*
  9135. * jQuery UI Effects Blind 1.8.6
  9136. *
  9137. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  9138. * Dual licensed under the MIT or GPL Version 2 licenses.
  9139. * http://jquery.org/license
  9140. *
  9141. * http://docs.jquery.com/UI/Effects/Blind
  9142. *
  9143. * Depends:
  9144. * jquery.effects.core.js
  9145. */
  9146. (function( $, undefined ) {
  9147. $.effects.blind = function(o) {
  9148. return this.queue(function() {
  9149. // Create element
  9150. var el = $(this), props = ['position','top','left'];
  9151. // Set options
  9152. var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
  9153. var direction = o.options.direction || 'vertical'; // Default direction
  9154. // Adjust
  9155. $.effects.save(el, props); el.show(); // Save & Show
  9156. var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
  9157. var ref = (direction == 'vertical') ? 'height' : 'width';
  9158. var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width();
  9159. if(mode == 'show') wrapper.css(ref, 0); // Shift
  9160. // Animation
  9161. var animation = {};
  9162. animation[ref] = mode == 'show' ? distance : 0;
  9163. // Animate
  9164. wrapper.animate(animation, o.duration, o.options.easing, function() {
  9165. if(mode == 'hide') el.hide(); // Hide
  9166. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  9167. if(o.callback) o.callback.apply(el[0], arguments); // Callback
  9168. el.dequeue();
  9169. });
  9170. });
  9171. };
  9172. })(jQuery);
  9173. /*
  9174. * jQuery UI Effects Bounce 1.8.6
  9175. *
  9176. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  9177. * Dual licensed under the MIT or GPL Version 2 licenses.
  9178. * http://jquery.org/license
  9179. *
  9180. * http://docs.jquery.com/UI/Effects/Bounce
  9181. *
  9182. * Depends:
  9183. * jquery.effects.core.js
  9184. */
  9185. (function( $, undefined ) {
  9186. $.effects.bounce = function(o) {
  9187. return this.queue(function() {
  9188. // Create element
  9189. var el = $(this), props = ['position','top','left'];
  9190. // Set options
  9191. var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
  9192. var direction = o.options.direction || 'up'; // Default direction
  9193. var distance = o.options.distance || 20; // Default distance
  9194. var times = o.options.times || 5; // Default # of times
  9195. var speed = o.duration || 250; // Default speed per bounce
  9196. if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE
  9197. // Adjust
  9198. $.effects.save(el, props); el.show(); // Save & Show
  9199. $.effects.createWrapper(el); // Create Wrapper
  9200. var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
  9201. var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
  9202. var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 3 : el.outerWidth({margin:true}) / 3);
  9203. if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
  9204. if (mode == 'hide') distance = distance / (times * 2);
  9205. if (mode != 'hide') times--;
  9206. // Animate
  9207. if (mode == 'show') { // Show Bounce
  9208. var animation = {opacity: 1};
  9209. animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
  9210. el.animate(animation, speed / 2, o.options.easing);
  9211. distance = distance / 2;
  9212. times--;
  9213. };
  9214. for (var i = 0; i < times; i++) { // Bounces
  9215. var animation1 = {}, animation2 = {};
  9216. animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
  9217. animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
  9218. el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing);
  9219. distance = (mode == 'hide') ? distance * 2 : distance / 2;
  9220. };
  9221. if (mode == 'hide') { // Last Bounce
  9222. var animation = {opacity: 0};
  9223. animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
  9224. el.animate(animation, speed / 2, o.options.easing, function(){
  9225. el.hide(); // Hide
  9226. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  9227. if(o.callback) o.callback.apply(this, arguments); // Callback
  9228. });
  9229. } else {
  9230. var animation1 = {}, animation2 = {};
  9231. animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
  9232. animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
  9233. el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){
  9234. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  9235. if(o.callback) o.callback.apply(this, arguments); // Callback
  9236. });
  9237. };
  9238. el.queue('fx', function() { el.dequeue(); });
  9239. el.dequeue();
  9240. });
  9241. };
  9242. })(jQuery);
  9243. /*
  9244. * jQuery UI Effects Clip 1.8.6
  9245. *
  9246. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  9247. * Dual licensed under the MIT or GPL Version 2 licenses.
  9248. * http://jquery.org/license
  9249. *
  9250. * http://docs.jquery.com/UI/Effects/Clip
  9251. *
  9252. * Depends:
  9253. * jquery.effects.core.js
  9254. */
  9255. (function( $, undefined ) {
  9256. $.effects.clip = function(o) {
  9257. return this.queue(function() {
  9258. // Create element
  9259. var el = $(this), props = ['position','top','left','height','width'];
  9260. // Set options
  9261. var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
  9262. var direction = o.options.direction || 'vertical'; // Default direction
  9263. // Adjust
  9264. $.effects.save(el, props); el.show(); // Save & Show
  9265. var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
  9266. var animate = el[0].tagName == 'IMG' ? wrapper : el;
  9267. var ref = {
  9268. size: (direction == 'vertical') ? 'height' : 'width',
  9269. position: (direction == 'vertical') ? 'top' : 'left'
  9270. };
  9271. var distance = (direction == 'vertical') ? animate.height() : animate.width();
  9272. if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift
  9273. // Animation
  9274. var animation = {};
  9275. animation[ref.size] = mode == 'show' ? distance : 0;
  9276. animation[ref.position] = mode == 'show' ? 0 : distance / 2;
  9277. // Animate
  9278. animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
  9279. if(mode == 'hide') el.hide(); // Hide
  9280. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  9281. if(o.callback) o.callback.apply(el[0], arguments); // Callback
  9282. el.dequeue();
  9283. }});
  9284. });
  9285. };
  9286. })(jQuery);
  9287. /*
  9288. * jQuery UI Effects Drop 1.8.6
  9289. *
  9290. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  9291. * Dual licensed under the MIT or GPL Version 2 licenses.
  9292. * http://jquery.org/license
  9293. *
  9294. * http://docs.jquery.com/UI/Effects/Drop
  9295. *
  9296. * Depends:
  9297. * jquery.effects.core.js
  9298. */
  9299. (function( $, undefined ) {
  9300. $.effects.drop = function(o) {
  9301. return this.queue(function() {
  9302. // Create element
  9303. var el = $(this), props = ['position','top','left','opacity'];
  9304. // Set options
  9305. var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
  9306. var direction = o.options.direction || 'left'; // Default Direction
  9307. // Adjust
  9308. $.effects.save(el, props); el.show(); // Save & Show
  9309. $.effects.createWrapper(el); // Create Wrapper
  9310. var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
  9311. var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
  9312. var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2);
  9313. if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
  9314. // Animation
  9315. var animation = {opacity: mode == 'show' ? 1 : 0};
  9316. animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
  9317. // Animate
  9318. el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
  9319. if(mode == 'hide') el.hide(); // Hide
  9320. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  9321. if(o.callback) o.callback.apply(this, arguments); // Callback
  9322. el.dequeue();
  9323. }});
  9324. });
  9325. };
  9326. })(jQuery);
  9327. /*
  9328. * jQuery UI Effects Explode 1.8.6
  9329. *
  9330. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  9331. * Dual licensed under the MIT or GPL Version 2 licenses.
  9332. * http://jquery.org/license
  9333. *
  9334. * http://docs.jquery.com/UI/Effects/Explode
  9335. *
  9336. * Depends:
  9337. * jquery.effects.core.js
  9338. */
  9339. (function( $, undefined ) {
  9340. $.effects.explode = function(o) {
  9341. return this.queue(function() {
  9342. var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
  9343. var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
  9344. o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode;
  9345. var el = $(this).show().css('visibility', 'hidden');
  9346. var offset = el.offset();
  9347. //Substract the margins - not fixing the problem yet.
  9348. offset.top -= parseInt(el.css("marginTop"),10) || 0;
  9349. offset.left -= parseInt(el.css("marginLeft"),10) || 0;
  9350. var width = el.outerWidth(true);
  9351. var height = el.outerHeight(true);
  9352. for(var i=0;i<rows;i++) { // =
  9353. for(var j=0;j<cells;j++) { // ||
  9354. el
  9355. .clone()
  9356. .appendTo('body')
  9357. .wrap('<div></div>')
  9358. .css({
  9359. position: 'absolute',
  9360. visibility: 'visible',
  9361. left: -j*(width/cells),
  9362. top: -i*(height/rows)
  9363. })
  9364. .parent()
  9365. .addClass('ui-effects-explode')
  9366. .css({
  9367. position: 'absolute',
  9368. overflow: 'hidden',
  9369. width: width/cells,
  9370. height: height/rows,
  9371. left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0),
  9372. top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0),
  9373. opacity: o.options.mode == 'show' ? 0 : 1
  9374. }).animate({
  9375. left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)),
  9376. top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)),
  9377. opacity: o.options.mode == 'show' ? 1 : 0
  9378. }, o.duration || 500);
  9379. }
  9380. }
  9381. // Set a timeout, to call the callback approx. when the other animations have finished
  9382. setTimeout(function() {
  9383. o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide();
  9384. if(o.callback) o.callback.apply(el[0]); // Callback
  9385. el.dequeue();
  9386. $('div.ui-effects-explode').remove();
  9387. }, o.duration || 500);
  9388. });
  9389. };
  9390. })(jQuery);
  9391. /*
  9392. * jQuery UI Effects Fade 1.8.6
  9393. *
  9394. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  9395. * Dual licensed under the MIT or GPL Version 2 licenses.
  9396. * http://jquery.org/license
  9397. *
  9398. * http://docs.jquery.com/UI/Effects/Fade
  9399. *
  9400. * Depends:
  9401. * jquery.effects.core.js
  9402. */
  9403. (function( $, undefined ) {
  9404. $.effects.fade = function(o) {
  9405. return this.queue(function() {
  9406. var elem = $(this),
  9407. mode = $.effects.setMode(elem, o.options.mode || 'hide');
  9408. elem.animate({ opacity: mode }, {
  9409. queue: false,
  9410. duration: o.duration,
  9411. easing: o.options.easing,
  9412. complete: function() {
  9413. (o.callback && o.callback.apply(this, arguments));
  9414. elem.dequeue();
  9415. }
  9416. });
  9417. });
  9418. };
  9419. })(jQuery);
  9420. /*
  9421. * jQuery UI Effects Fold 1.8.6
  9422. *
  9423. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  9424. * Dual licensed under the MIT or GPL Version 2 licenses.
  9425. * http://jquery.org/license
  9426. *
  9427. * http://docs.jquery.com/UI/Effects/Fold
  9428. *
  9429. * Depends:
  9430. * jquery.effects.core.js
  9431. */
  9432. (function( $, undefined ) {
  9433. $.effects.fold = function(o) {
  9434. return this.queue(function() {
  9435. // Create element
  9436. var el = $(this), props = ['position','top','left'];
  9437. // Set options
  9438. var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
  9439. var size = o.options.size || 15; // Default fold size
  9440. var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value
  9441. var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;
  9442. // Adjust
  9443. $.effects.save(el, props); el.show(); // Save & Show
  9444. var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
  9445. var widthFirst = ((mode == 'show') != horizFirst);
  9446. var ref = widthFirst ? ['width', 'height'] : ['height', 'width'];
  9447. var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()];
  9448. var percent = /([0-9]+)%/.exec(size);
  9449. if(percent) size = parseInt(percent[1],10) / 100 * distance[mode == 'hide' ? 0 : 1];
  9450. if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift
  9451. // Animation
  9452. var animation1 = {}, animation2 = {};
  9453. animation1[ref[0]] = mode == 'show' ? distance[0] : size;
  9454. animation2[ref[1]] = mode == 'show' ? distance[1] : 0;
  9455. // Animate
  9456. wrapper.animate(animation1, duration, o.options.easing)
  9457. .animate(animation2, duration, o.options.easing, function() {
  9458. if(mode == 'hide') el.hide(); // Hide
  9459. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  9460. if(o.callback) o.callback.apply(el[0], arguments); // Callback
  9461. el.dequeue();
  9462. });
  9463. });
  9464. };
  9465. })(jQuery);
  9466. /*
  9467. * jQuery UI Effects Highlight 1.8.6
  9468. *
  9469. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  9470. * Dual licensed under the MIT or GPL Version 2 licenses.
  9471. * http://jquery.org/license
  9472. *
  9473. * http://docs.jquery.com/UI/Effects/Highlight
  9474. *
  9475. * Depends:
  9476. * jquery.effects.core.js
  9477. */
  9478. (function( $, undefined ) {
  9479. $.effects.highlight = function(o) {
  9480. return this.queue(function() {
  9481. var elem = $(this),
  9482. props = ['backgroundImage', 'backgroundColor', 'opacity'],
  9483. mode = $.effects.setMode(elem, o.options.mode || 'show'),
  9484. animation = {
  9485. backgroundColor: elem.css('backgroundColor')
  9486. };
  9487. if (mode == 'hide') {
  9488. animation.opacity = 0;
  9489. }
  9490. $.effects.save(elem, props);
  9491. elem
  9492. .show()
  9493. .css({
  9494. backgroundImage: 'none',
  9495. backgroundColor: o.options.color || '#ffff99'
  9496. })
  9497. .animate(animation, {
  9498. queue: false,
  9499. duration: o.duration,
  9500. easing: o.options.easing,
  9501. complete: function() {
  9502. (mode == 'hide' && elem.hide());
  9503. $.effects.restore(elem, props);
  9504. (mode == 'show' && !$.support.opacity && this.style.removeAttribute('filter'));
  9505. (o.callback && o.callback.apply(this, arguments));
  9506. elem.dequeue();
  9507. }
  9508. });
  9509. });
  9510. };
  9511. })(jQuery);
  9512. /*
  9513. * jQuery UI Effects Pulsate 1.8.6
  9514. *
  9515. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  9516. * Dual licensed under the MIT or GPL Version 2 licenses.
  9517. * http://jquery.org/license
  9518. *
  9519. * http://docs.jquery.com/UI/Effects/Pulsate
  9520. *
  9521. * Depends:
  9522. * jquery.effects.core.js
  9523. */
  9524. (function( $, undefined ) {
  9525. $.effects.pulsate = function(o) {
  9526. return this.queue(function() {
  9527. var elem = $(this),
  9528. mode = $.effects.setMode(elem, o.options.mode || 'show');
  9529. times = ((o.options.times || 5) * 2) - 1;
  9530. duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2,
  9531. isVisible = elem.is(':visible'),
  9532. animateTo = 0;
  9533. if (!isVisible) {
  9534. elem.css('opacity', 0).show();
  9535. animateTo = 1;
  9536. }
  9537. if ((mode == 'hide' && isVisible) || (mode == 'show' && !isVisible)) {
  9538. times--;
  9539. }
  9540. for (var i = 0; i < times; i++) {
  9541. elem.animate({ opacity: animateTo }, duration, o.options.easing);
  9542. animateTo = (animateTo + 1) % 2;
  9543. }
  9544. elem.animate({ opacity: animateTo }, duration, o.options.easing, function() {
  9545. if (animateTo == 0) {
  9546. elem.hide();
  9547. }
  9548. (o.callback && o.callback.apply(this, arguments));
  9549. });
  9550. elem
  9551. .queue('fx', function() { elem.dequeue(); })
  9552. .dequeue();
  9553. });
  9554. };
  9555. })(jQuery);
  9556. /*
  9557. * jQuery UI Effects Scale 1.8.6
  9558. *
  9559. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  9560. * Dual licensed under the MIT or GPL Version 2 licenses.
  9561. * http://jquery.org/license
  9562. *
  9563. * http://docs.jquery.com/UI/Effects/Scale
  9564. *
  9565. * Depends:
  9566. * jquery.effects.core.js
  9567. */
  9568. (function( $, undefined ) {
  9569. $.effects.puff = function(o) {
  9570. return this.queue(function() {
  9571. var elem = $(this),
  9572. mode = $.effects.setMode(elem, o.options.mode || 'hide'),
  9573. percent = parseInt(o.options.percent, 10) || 150,
  9574. factor = percent / 100,
  9575. original = { height: elem.height(), width: elem.width() };
  9576. $.extend(o.options, {
  9577. fade: true,
  9578. mode: mode,
  9579. percent: mode == 'hide' ? percent : 100,
  9580. from: mode == 'hide'
  9581. ? original
  9582. : {
  9583. height: original.height * factor,
  9584. width: original.width * factor
  9585. }
  9586. });
  9587. elem.effect('scale', o.options, o.duration, o.callback);
  9588. elem.dequeue();
  9589. });
  9590. };
  9591. $.effects.scale = function(o) {
  9592. return this.queue(function() {
  9593. // Create element
  9594. var el = $(this);
  9595. // Set options
  9596. var options = $.extend(true, {}, o.options);
  9597. var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
  9598. var percent = parseInt(o.options.percent,10) || (parseInt(o.options.percent,10) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set default scaling percent
  9599. var direction = o.options.direction || 'both'; // Set default axis
  9600. var origin = o.options.origin; // The origin of the scaling
  9601. if (mode != 'effect') { // Set default origin and restore for show/hide
  9602. options.origin = origin || ['middle','center'];
  9603. options.restore = true;
  9604. }
  9605. var original = {height: el.height(), width: el.width()}; // Save original
  9606. el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state
  9607. // Adjust
  9608. var factor = { // Set scaling factor
  9609. y: direction != 'horizontal' ? (percent / 100) : 1,
  9610. x: direction != 'vertical' ? (percent / 100) : 1
  9611. };
  9612. el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state
  9613. if (o.options.fade) { // Fade option to support puff
  9614. if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;};
  9615. if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;};
  9616. };
  9617. // Animation
  9618. options.from = el.from; options.to = el.to; options.mode = mode;
  9619. // Animate
  9620. el.effect('size', options, o.duration, o.callback);
  9621. el.dequeue();
  9622. });
  9623. };
  9624. $.effects.size = function(o) {
  9625. return this.queue(function() {
  9626. // Create element
  9627. var el = $(this), props = ['position','top','left','width','height','overflow','opacity'];
  9628. var props1 = ['position','top','left','overflow','opacity']; // Always restore
  9629. var props2 = ['width','height','overflow']; // Copy for children
  9630. var cProps = ['fontSize'];
  9631. var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom'];
  9632. var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight'];
  9633. // Set options
  9634. var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
  9635. var restore = o.options.restore || false; // Default restore
  9636. var scale = o.options.scale || 'both'; // Default scale mode
  9637. var origin = o.options.origin; // The origin of the sizing
  9638. var original = {height: el.height(), width: el.width()}; // Save original
  9639. el.from = o.options.from || original; // Default from state
  9640. el.to = o.options.to || original; // Default to state
  9641. // Adjust
  9642. if (origin) { // Calculate baseline shifts
  9643. var baseline = $.effects.getBaseline(origin, original);
  9644. el.from.top = (original.height - el.from.height) * baseline.y;
  9645. el.from.left = (original.width - el.from.width) * baseline.x;
  9646. el.to.top = (original.height - el.to.height) * baseline.y;
  9647. el.to.left = (original.width - el.to.width) * baseline.x;
  9648. };
  9649. var factor = { // Set scaling factor
  9650. from: {y: el.from.height / original.height, x: el.from.width / original.width},
  9651. to: {y: el.to.height / original.height, x: el.to.width / original.width}
  9652. };
  9653. if (scale == 'box' || scale == 'both') { // Scale the css box
  9654. if (factor.from.y != factor.to.y) { // Vertical props scaling
  9655. props = props.concat(vProps);
  9656. el.from = $.effects.setTransition(el, vProps, factor.from.y, el.from);
  9657. el.to = $.effects.setTransition(el, vProps, factor.to.y, el.to);
  9658. };
  9659. if (factor.from.x != factor.to.x) { // Horizontal props scaling
  9660. props = props.concat(hProps);
  9661. el.from = $.effects.setTransition(el, hProps, factor.from.x, el.from);
  9662. el.to = $.effects.setTransition(el, hProps, factor.to.x, el.to);
  9663. };
  9664. };
  9665. if (scale == 'content' || scale == 'both') { // Scale the content
  9666. if (factor.from.y != factor.to.y) { // Vertical props scaling
  9667. props = props.concat(cProps);
  9668. el.from = $.effects.setTransition(el, cProps, factor.from.y, el.from);
  9669. el.to = $.effects.setTransition(el, cProps, factor.to.y, el.to);
  9670. };
  9671. };
  9672. $.effects.save(el, restore ? props : props1); el.show(); // Save & Show
  9673. $.effects.createWrapper(el); // Create Wrapper
  9674. el.css('overflow','hidden').css(el.from); // Shift
  9675. // Animate
  9676. if (scale == 'content' || scale == 'both') { // Scale the children
  9677. vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size
  9678. hProps = hProps.concat(['marginLeft','marginRight']); // Add margins
  9679. props2 = props.concat(vProps).concat(hProps); // Concat
  9680. el.find("*[width]").each(function(){
  9681. child = $(this);
  9682. if (restore) $.effects.save(child, props2);
  9683. var c_original = {height: child.height(), width: child.width()}; // Save original
  9684. child.from = {height: c_original.height * factor.from.y, width: c_original.width * factor.from.x};
  9685. child.to = {height: c_original.height * factor.to.y, width: c_original.width * factor.to.x};
  9686. if (factor.from.y != factor.to.y) { // Vertical props scaling
  9687. child.from = $.effects.setTransition(child, vProps, factor.from.y, child.from);
  9688. child.to = $.effects.setTransition(child, vProps, factor.to.y, child.to);
  9689. };
  9690. if (factor.from.x != factor.to.x) { // Horizontal props scaling
  9691. child.from = $.effects.setTransition(child, hProps, factor.from.x, child.from);
  9692. child.to = $.effects.setTransition(child, hProps, factor.to.x, child.to);
  9693. };
  9694. child.css(child.from); // Shift children
  9695. child.animate(child.to, o.duration, o.options.easing, function(){
  9696. if (restore) $.effects.restore(child, props2); // Restore children
  9697. }); // Animate children
  9698. });
  9699. };
  9700. // Animate
  9701. el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
  9702. if (el.to.opacity === 0) {
  9703. el.css('opacity', el.from.opacity);
  9704. }
  9705. if(mode == 'hide') el.hide(); // Hide
  9706. $.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore
  9707. if(o.callback) o.callback.apply(this, arguments); // Callback
  9708. el.dequeue();
  9709. }});
  9710. });
  9711. };
  9712. })(jQuery);
  9713. /*
  9714. * jQuery UI Effects Shake 1.8.6
  9715. *
  9716. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  9717. * Dual licensed under the MIT or GPL Version 2 licenses.
  9718. * http://jquery.org/license
  9719. *
  9720. * http://docs.jquery.com/UI/Effects/Shake
  9721. *
  9722. * Depends:
  9723. * jquery.effects.core.js
  9724. */
  9725. (function( $, undefined ) {
  9726. $.effects.shake = function(o) {
  9727. return this.queue(function() {
  9728. // Create element
  9729. var el = $(this), props = ['position','top','left'];
  9730. // Set options
  9731. var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
  9732. var direction = o.options.direction || 'left'; // Default direction
  9733. var distance = o.options.distance || 20; // Default distance
  9734. var times = o.options.times || 3; // Default # of times
  9735. var speed = o.duration || o.options.duration || 140; // Default speed per shake
  9736. // Adjust
  9737. $.effects.save(el, props); el.show(); // Save & Show
  9738. $.effects.createWrapper(el); // Create Wrapper
  9739. var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
  9740. var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
  9741. // Animation
  9742. var animation = {}, animation1 = {}, animation2 = {};
  9743. animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
  9744. animation1[ref] = (motion == 'pos' ? '+=' : '-=') + distance * 2;
  9745. animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2;
  9746. // Animate
  9747. el.animate(animation, speed, o.options.easing);
  9748. for (var i = 1; i < times; i++) { // Shakes
  9749. el.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing);
  9750. };
  9751. el.animate(animation1, speed, o.options.easing).
  9752. animate(animation, speed / 2, o.options.easing, function(){ // Last shake
  9753. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  9754. if(o.callback) o.callback.apply(this, arguments); // Callback
  9755. });
  9756. el.queue('fx', function() { el.dequeue(); });
  9757. el.dequeue();
  9758. });
  9759. };
  9760. })(jQuery);
  9761. /*
  9762. * jQuery UI Effects Slide 1.8.6
  9763. *
  9764. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  9765. * Dual licensed under the MIT or GPL Version 2 licenses.
  9766. * http://jquery.org/license
  9767. *
  9768. * http://docs.jquery.com/UI/Effects/Slide
  9769. *
  9770. * Depends:
  9771. * jquery.effects.core.js
  9772. */
  9773. (function( $, undefined ) {
  9774. $.effects.slide = function(o) {
  9775. return this.queue(function() {
  9776. // Create element
  9777. var el = $(this), props = ['position','top','left'];
  9778. // Set options
  9779. var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
  9780. var direction = o.options.direction || 'left'; // Default Direction
  9781. // Adjust
  9782. $.effects.save(el, props); el.show(); // Save & Show
  9783. $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
  9784. var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
  9785. var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
  9786. var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));
  9787. if (mode == 'show') el.css(ref, motion == 'pos' ? -distance : distance); // Shift
  9788. // Animation
  9789. var animation = {};
  9790. animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
  9791. // Animate
  9792. el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
  9793. if(mode == 'hide') el.hide(); // Hide
  9794. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  9795. if(o.callback) o.callback.apply(this, arguments); // Callback
  9796. el.dequeue();
  9797. }});
  9798. });
  9799. };
  9800. })(jQuery);
  9801. /*
  9802. * jQuery UI Effects Transfer 1.8.6
  9803. *
  9804. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  9805. * Dual licensed under the MIT or GPL Version 2 licenses.
  9806. * http://jquery.org/license
  9807. *
  9808. * http://docs.jquery.com/UI/Effects/Transfer
  9809. *
  9810. * Depends:
  9811. * jquery.effects.core.js
  9812. */
  9813. (function( $, undefined ) {
  9814. $.effects.transfer = function(o) {
  9815. return this.queue(function() {
  9816. var elem = $(this),
  9817. target = $(o.options.to),
  9818. endPosition = target.offset(),
  9819. animation = {
  9820. top: endPosition.top,
  9821. left: endPosition.left,
  9822. height: target.innerHeight(),
  9823. width: target.innerWidth()
  9824. },
  9825. startPosition = elem.offset(),
  9826. transfer = $('<div class="ui-effects-transfer"></div>')
  9827. .appendTo(document.body)
  9828. .addClass(o.options.className)
  9829. .css({
  9830. top: startPosition.top,
  9831. left: startPosition.left,
  9832. height: elem.innerHeight(),
  9833. width: elem.innerWidth(),
  9834. position: 'absolute'
  9835. })
  9836. .animate(animation, o.duration, o.options.easing, function() {
  9837. transfer.remove();
  9838. (o.callback && o.callback.apply(elem[0], arguments));
  9839. elem.dequeue();
  9840. });
  9841. });
  9842. };
  9843. })(jQuery);