jquery-ui.js 307 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133
  1. /*
  2. * jQuery UI 1.7.2
  3. *
  4. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  5. * Dual licensed under the MIT (MIT-LICENSE.txt)
  6. * and GPL (GPL-LICENSE.txt) licenses.
  7. *
  8. * http://docs.jquery.com/UI
  9. */
  10. ;jQuery.ui || (function($) {
  11. var _remove = $.fn.remove,
  12. isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9);
  13. //Helper functions and ui object
  14. $.ui = {
  15. version: "1.7.2",
  16. // $.ui.plugin is deprecated. Use the proxy pattern instead.
  17. plugin: {
  18. add: function(module, option, set) {
  19. var proto = $.ui[module].prototype;
  20. for(var i in set) {
  21. proto.plugins[i] = proto.plugins[i] || [];
  22. proto.plugins[i].push([option, set[i]]);
  23. }
  24. },
  25. call: function(instance, name, args) {
  26. var set = instance.plugins[name];
  27. if(!set || !instance.element[0].parentNode) { return; }
  28. for (var i = 0; i < set.length; i++) {
  29. if (instance.options[set[i][0]]) {
  30. set[i][1].apply(instance.element, args);
  31. }
  32. }
  33. }
  34. },
  35. contains: function(a, b) {
  36. return document.compareDocumentPosition
  37. ? a.compareDocumentPosition(b) & 16
  38. : a !== b && a.contains(b);
  39. },
  40. hasScroll: function(el, a) {
  41. //If overflow is hidden, the element might have extra content, but the user wants to hide it
  42. if ($(el).css('overflow') == 'hidden') { return false; }
  43. var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
  44. has = false;
  45. if (el[scroll] > 0) { return true; }
  46. // TODO: determine which cases actually cause this to happen
  47. // if the element doesn't have the scroll set, see if it's possible to
  48. // set the scroll
  49. el[scroll] = 1;
  50. has = (el[scroll] > 0);
  51. el[scroll] = 0;
  52. return has;
  53. },
  54. isOverAxis: function(x, reference, size) {
  55. //Determines when x coordinate is over "b" element axis
  56. return (x > reference) && (x < (reference + size));
  57. },
  58. isOver: function(y, x, top, left, height, width) {
  59. //Determines when x, y coordinates is over "b" element
  60. return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width);
  61. },
  62. keyCode: {
  63. BACKSPACE: 8,
  64. CAPS_LOCK: 20,
  65. COMMA: 188,
  66. CONTROL: 17,
  67. DELETE: 46,
  68. DOWN: 40,
  69. END: 35,
  70. ENTER: 13,
  71. ESCAPE: 27,
  72. HOME: 36,
  73. INSERT: 45,
  74. LEFT: 37,
  75. NUMPAD_ADD: 107,
  76. NUMPAD_DECIMAL: 110,
  77. NUMPAD_DIVIDE: 111,
  78. NUMPAD_ENTER: 108,
  79. NUMPAD_MULTIPLY: 106,
  80. NUMPAD_SUBTRACT: 109,
  81. PAGE_DOWN: 34,
  82. PAGE_UP: 33,
  83. PERIOD: 190,
  84. RIGHT: 39,
  85. SHIFT: 16,
  86. SPACE: 32,
  87. TAB: 9,
  88. UP: 38
  89. }
  90. };
  91. // WAI-ARIA normalization
  92. if (isFF2) {
  93. var attr = $.attr,
  94. removeAttr = $.fn.removeAttr,
  95. ariaNS = "http://www.w3.org/2005/07/aaa",
  96. ariaState = /^aria-/,
  97. ariaRole = /^wairole:/;
  98. $.attr = function(elem, name, value) {
  99. var set = value !== undefined;
  100. return (name == 'role'
  101. ? (set
  102. ? attr.call(this, elem, name, "wairole:" + value)
  103. : (attr.apply(this, arguments) || "").replace(ariaRole, ""))
  104. : (ariaState.test(name)
  105. ? (set
  106. ? elem.setAttributeNS(ariaNS,
  107. name.replace(ariaState, "aaa:"), value)
  108. : attr.call(this, elem, name.replace(ariaState, "aaa:")))
  109. : attr.apply(this, arguments)));
  110. };
  111. $.fn.removeAttr = function(name) {
  112. return (ariaState.test(name)
  113. ? this.each(function() {
  114. this.removeAttributeNS(ariaNS, name.replace(ariaState, ""));
  115. }) : removeAttr.call(this, name));
  116. };
  117. }
  118. //jQuery plugins
  119. $.fn.extend({
  120. remove: function() {
  121. // Safari has a native remove event which actually removes DOM elements,
  122. // so we have to use triggerHandler instead of trigger (#3037).
  123. $("*", this).add(this).each(function() {
  124. $(this).triggerHandler("remove");
  125. });
  126. return _remove.apply(this, arguments );
  127. },
  128. enableSelection: function() {
  129. return this
  130. .attr('unselectable', 'off')
  131. .css('MozUserSelect', '')
  132. .unbind('selectstart.ui');
  133. },
  134. disableSelection: function() {
  135. return this
  136. .attr('unselectable', 'on')
  137. .css('MozUserSelect', 'none')
  138. .bind('selectstart.ui', function() { return false; });
  139. },
  140. scrollParent: function() {
  141. var scrollParent;
  142. if(($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
  143. scrollParent = this.parents().filter(function() {
  144. 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));
  145. }).eq(0);
  146. } else {
  147. scrollParent = this.parents().filter(function() {
  148. return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
  149. }).eq(0);
  150. }
  151. return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
  152. }
  153. });
  154. //Additional selectors
  155. $.extend($.expr[':'], {
  156. data: function(elem, i, match) {
  157. return !!$.data(elem, match[3]);
  158. },
  159. focusable: function(element) {
  160. var nodeName = element.nodeName.toLowerCase(),
  161. tabIndex = $.attr(element, 'tabindex');
  162. return (/input|select|textarea|button|object/.test(nodeName)
  163. ? !element.disabled
  164. : 'a' == nodeName || 'area' == nodeName
  165. ? element.href || !isNaN(tabIndex)
  166. : !isNaN(tabIndex))
  167. // the element and all of its ancestors must be visible
  168. // the browser may report that the area is hidden
  169. && !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length;
  170. },
  171. tabbable: function(element) {
  172. var tabIndex = $.attr(element, 'tabindex');
  173. return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable');
  174. }
  175. });
  176. // $.widget is a factory to create jQuery plugins
  177. // taking some boilerplate code out of the plugin code
  178. function getter(namespace, plugin, method, args) {
  179. function getMethods(type) {
  180. var methods = $[namespace][plugin][type] || [];
  181. return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods);
  182. }
  183. var methods = getMethods('getter');
  184. if (args.length == 1 && typeof args[0] == 'string') {
  185. methods = methods.concat(getMethods('getterSetter'));
  186. }
  187. return ($.inArray(method, methods) != -1);
  188. }
  189. $.widget = function(name, prototype) {
  190. var namespace = name.split(".")[0];
  191. name = name.split(".")[1];
  192. // create plugin method
  193. $.fn[name] = function(options) {
  194. var isMethodCall = (typeof options == 'string'),
  195. args = Array.prototype.slice.call(arguments, 1);
  196. // prevent calls to internal methods
  197. if (isMethodCall && options.substring(0, 1) == '_') {
  198. return this;
  199. }
  200. // handle getter methods
  201. if (isMethodCall && getter(namespace, name, options, args)) {
  202. var instance = $.data(this[0], name);
  203. return (instance ? instance[options].apply(instance, args)
  204. : undefined);
  205. }
  206. // handle initialization and non-getter methods
  207. return this.each(function() {
  208. var instance = $.data(this, name);
  209. // constructor
  210. (!instance && !isMethodCall &&
  211. $.data(this, name, new $[namespace][name](this, options))._init());
  212. // method call
  213. (instance && isMethodCall && $.isFunction(instance[options]) &&
  214. instance[options].apply(instance, args));
  215. });
  216. };
  217. // create widget constructor
  218. $[namespace] = $[namespace] || {};
  219. $[namespace][name] = function(element, options) {
  220. var self = this;
  221. this.namespace = namespace;
  222. this.widgetName = name;
  223. this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
  224. this.widgetBaseClass = namespace + '-' + name;
  225. this.options = $.extend({},
  226. $.widget.defaults,
  227. $[namespace][name].defaults,
  228. $.metadata && $.metadata.get(element)[name],
  229. options);
  230. this.element = $(element)
  231. .bind('setData.' + name, function(event, key, value) {
  232. if (event.target == element) {
  233. return self._setData(key, value);
  234. }
  235. })
  236. .bind('getData.' + name, function(event, key) {
  237. if (event.target == element) {
  238. return self._getData(key);
  239. }
  240. })
  241. .bind('remove', function() {
  242. return self.destroy();
  243. });
  244. };
  245. // add widget prototype
  246. $[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
  247. // TODO: merge getter and getterSetter properties from widget prototype
  248. // and plugin prototype
  249. $[namespace][name].getterSetter = 'option';
  250. };
  251. $.widget.prototype = {
  252. _init: function() {},
  253. destroy: function() {
  254. this.element.removeData(this.widgetName)
  255. .removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled')
  256. .removeAttr('aria-disabled');
  257. },
  258. option: function(key, value) {
  259. var options = key,
  260. self = this;
  261. if (typeof key == "string") {
  262. if (value === undefined) {
  263. return this._getData(key);
  264. }
  265. options = {};
  266. options[key] = value;
  267. }
  268. $.each(options, function(key, value) {
  269. self._setData(key, value);
  270. });
  271. },
  272. _getData: function(key) {
  273. return this.options[key];
  274. },
  275. _setData: function(key, value) {
  276. this.options[key] = value;
  277. if (key == 'disabled') {
  278. this.element
  279. [value ? 'addClass' : 'removeClass'](
  280. this.widgetBaseClass + '-disabled' + ' ' +
  281. this.namespace + '-state-disabled')
  282. .attr("aria-disabled", value);
  283. }
  284. },
  285. enable: function() {
  286. this._setData('disabled', false);
  287. },
  288. disable: function() {
  289. this._setData('disabled', true);
  290. },
  291. _trigger: function(type, event, data) {
  292. var callback = this.options[type],
  293. eventName = (type == this.widgetEventPrefix
  294. ? type : this.widgetEventPrefix + type);
  295. event = $.Event(event);
  296. event.type = eventName;
  297. // copy original event properties over to the new event
  298. // this would happen if we could call $.event.fix instead of $.Event
  299. // but we don't have a way to force an event to be fixed multiple times
  300. if (event.originalEvent) {
  301. for (var i = $.event.props.length, prop; i;) {
  302. prop = $.event.props[--i];
  303. event[prop] = event.originalEvent[prop];
  304. }
  305. }
  306. this.element.trigger(event, data);
  307. return !($.isFunction(callback) && callback.call(this.element[0], event, data) === false
  308. || event.isDefaultPrevented());
  309. }
  310. };
  311. $.widget.defaults = {
  312. disabled: false
  313. };
  314. /** Mouse Interaction Plugin **/
  315. $.ui.mouse = {
  316. _mouseInit: function() {
  317. var self = this;
  318. this.element
  319. .bind('mousedown.'+this.widgetName, function(event) {
  320. return self._mouseDown(event);
  321. })
  322. .bind('click.'+this.widgetName, function(event) {
  323. if(self._preventClickEvent) {
  324. self._preventClickEvent = false;
  325. event.stopImmediatePropagation();
  326. return false;
  327. }
  328. });
  329. // Prevent text selection in IE
  330. if ($.browser.msie) {
  331. this._mouseUnselectable = this.element.attr('unselectable');
  332. this.element.attr('unselectable', 'on');
  333. }
  334. this.started = false;
  335. },
  336. // TODO: make sure destroying one instance of mouse doesn't mess with
  337. // other instances of mouse
  338. _mouseDestroy: function() {
  339. this.element.unbind('.'+this.widgetName);
  340. // Restore text selection in IE
  341. ($.browser.msie
  342. && this.element.attr('unselectable', this._mouseUnselectable));
  343. },
  344. _mouseDown: function(event) {
  345. // don't let more than one widget handle mouseStart
  346. // TODO: figure out why we have to use originalEvent
  347. event.originalEvent = event.originalEvent || {};
  348. if (event.originalEvent.mouseHandled) { return; }
  349. // we may have missed mouseup (out of window)
  350. (this._mouseStarted && this._mouseUp(event));
  351. this._mouseDownEvent = event;
  352. var self = this,
  353. btnIsLeft = (event.which == 1),
  354. elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
  355. if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
  356. return true;
  357. }
  358. this.mouseDelayMet = !this.options.delay;
  359. if (!this.mouseDelayMet) {
  360. this._mouseDelayTimer = setTimeout(function() {
  361. self.mouseDelayMet = true;
  362. }, this.options.delay);
  363. }
  364. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  365. this._mouseStarted = (this._mouseStart(event) !== false);
  366. if (!this._mouseStarted) {
  367. event.preventDefault();
  368. return true;
  369. }
  370. }
  371. // these delegates are required to keep context
  372. this._mouseMoveDelegate = function(event) {
  373. return self._mouseMove(event);
  374. };
  375. this._mouseUpDelegate = function(event) {
  376. return self._mouseUp(event);
  377. };
  378. $(document)
  379. .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
  380. .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
  381. // preventDefault() is used to prevent the selection of text here -
  382. // however, in Safari, this causes select boxes not to be selectable
  383. // anymore, so this fix is needed
  384. ($.browser.safari || event.preventDefault());
  385. event.originalEvent.mouseHandled = true;
  386. return true;
  387. },
  388. _mouseMove: function(event) {
  389. // IE mouseup check - mouseup happened when mouse was out of window
  390. if ($.browser.msie && !event.button) {
  391. return this._mouseUp(event);
  392. }
  393. if (this._mouseStarted) {
  394. this._mouseDrag(event);
  395. return event.preventDefault();
  396. }
  397. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  398. this._mouseStarted =
  399. (this._mouseStart(this._mouseDownEvent, event) !== false);
  400. (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
  401. }
  402. return !this._mouseStarted;
  403. },
  404. _mouseUp: function(event) {
  405. $(document)
  406. .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
  407. .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
  408. if (this._mouseStarted) {
  409. this._mouseStarted = false;
  410. this._preventClickEvent = (event.target == this._mouseDownEvent.target);
  411. this._mouseStop(event);
  412. }
  413. return false;
  414. },
  415. _mouseDistanceMet: function(event) {
  416. return (Math.max(
  417. Math.abs(this._mouseDownEvent.pageX - event.pageX),
  418. Math.abs(this._mouseDownEvent.pageY - event.pageY)
  419. ) >= this.options.distance
  420. );
  421. },
  422. _mouseDelayMet: function(event) {
  423. return this.mouseDelayMet;
  424. },
  425. // These are placeholder methods, to be overriden by extending plugin
  426. _mouseStart: function(event) {},
  427. _mouseDrag: function(event) {},
  428. _mouseStop: function(event) {},
  429. _mouseCapture: function(event) { return true; }
  430. };
  431. $.ui.mouse.defaults = {
  432. cancel: null,
  433. distance: 1,
  434. delay: 0
  435. };
  436. })(jQuery);
  437. /*
  438. * jQuery UI Draggable 1.7.2
  439. *
  440. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  441. * Dual licensed under the MIT (MIT-LICENSE.txt)
  442. * and GPL (GPL-LICENSE.txt) licenses.
  443. *
  444. * http://docs.jquery.com/UI/Draggables
  445. *
  446. * Depends:
  447. * ui.core.js
  448. */
  449. (function($) {
  450. $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
  451. _init: function() {
  452. if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
  453. this.element[0].style.position = 'relative';
  454. (this.options.addClasses && this.element.addClass("ui-draggable"));
  455. (this.options.disabled && this.element.addClass("ui-draggable-disabled"));
  456. this._mouseInit();
  457. },
  458. destroy: function() {
  459. if(!this.element.data('draggable')) return;
  460. this.element
  461. .removeData("draggable")
  462. .unbind(".draggable")
  463. .removeClass("ui-draggable"
  464. + " ui-draggable-dragging"
  465. + " ui-draggable-disabled");
  466. this._mouseDestroy();
  467. },
  468. _mouseCapture: function(event) {
  469. var o = this.options;
  470. if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
  471. return false;
  472. //Quit if we're not on a valid handle
  473. this.handle = this._getHandle(event);
  474. if (!this.handle)
  475. return false;
  476. return true;
  477. },
  478. _mouseStart: function(event) {
  479. var o = this.options;
  480. //Create and append the visible helper
  481. this.helper = this._createHelper(event);
  482. //Cache the helper size
  483. this._cacheHelperProportions();
  484. //If ddmanager is used for droppables, set the global draggable
  485. if($.ui.ddmanager)
  486. $.ui.ddmanager.current = this;
  487. /*
  488. * - Position generation -
  489. * This block generates everything position related - it's the core of draggables.
  490. */
  491. //Cache the margins of the original element
  492. this._cacheMargins();
  493. //Store the helper's css position
  494. this.cssPosition = this.helper.css("position");
  495. this.scrollParent = this.helper.scrollParent();
  496. //The element's absolute position on the page minus margins
  497. this.offset = this.element.offset();
  498. this.offset = {
  499. top: this.offset.top - this.margins.top,
  500. left: this.offset.left - this.margins.left
  501. };
  502. $.extend(this.offset, {
  503. click: { //Where the click happened, relative to the element
  504. left: event.pageX - this.offset.left,
  505. top: event.pageY - this.offset.top
  506. },
  507. parent: this._getParentOffset(),
  508. relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
  509. });
  510. //Generate the original position
  511. this.originalPosition = this._generatePosition(event);
  512. this.originalPageX = event.pageX;
  513. this.originalPageY = event.pageY;
  514. //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
  515. if(o.cursorAt)
  516. this._adjustOffsetFromHelper(o.cursorAt);
  517. //Set a containment if given in the options
  518. if(o.containment)
  519. this._setContainment();
  520. //Call plugins and callbacks
  521. this._trigger("start", event);
  522. //Recache the helper size
  523. this._cacheHelperProportions();
  524. //Prepare the droppable offsets
  525. if ($.ui.ddmanager && !o.dropBehaviour)
  526. $.ui.ddmanager.prepareOffsets(this, event);
  527. this.helper.addClass("ui-draggable-dragging");
  528. this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
  529. return true;
  530. },
  531. _mouseDrag: function(event, noPropagation) {
  532. //Compute the helpers position
  533. this.position = this._generatePosition(event);
  534. this.positionAbs = this._convertPositionTo("absolute");
  535. //Call plugins and callbacks and use the resulting position if something is returned
  536. if (!noPropagation) {
  537. var ui = this._uiHash();
  538. this._trigger('drag', event, ui);
  539. this.position = ui.position;
  540. }
  541. if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
  542. if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
  543. if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
  544. return false;
  545. },
  546. _mouseStop: function(event) {
  547. //If we are using droppables, inform the manager about the drop
  548. var dropped = false;
  549. if ($.ui.ddmanager && !this.options.dropBehaviour)
  550. dropped = $.ui.ddmanager.drop(this, event);
  551. //if a drop comes from outside (a sortable)
  552. if(this.dropped) {
  553. dropped = this.dropped;
  554. this.dropped = false;
  555. }
  556. 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))) {
  557. var self = this;
  558. $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
  559. self._trigger("stop", event);
  560. self._clear();
  561. });
  562. } else {
  563. this._trigger("stop", event);
  564. this._clear();
  565. }
  566. return false;
  567. },
  568. _getHandle: function(event) {
  569. var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
  570. $(this.options.handle, this.element)
  571. .find("*")
  572. .andSelf()
  573. .each(function() {
  574. if(this == event.target) handle = true;
  575. });
  576. return handle;
  577. },
  578. _createHelper: function(event) {
  579. var o = this.options;
  580. var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone() : this.element);
  581. if(!helper.parents('body').length)
  582. helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
  583. if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
  584. helper.css("position", "absolute");
  585. return helper;
  586. },
  587. _adjustOffsetFromHelper: function(obj) {
  588. if(obj.left != undefined) this.offset.click.left = obj.left + this.margins.left;
  589. if(obj.right != undefined) this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  590. if(obj.top != undefined) this.offset.click.top = obj.top + this.margins.top;
  591. if(obj.bottom != undefined) this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  592. },
  593. _getParentOffset: function() {
  594. //Get the offsetParent and cache its position
  595. this.offsetParent = this.helper.offsetParent();
  596. var po = this.offsetParent.offset();
  597. // This is a special case where we need to modify a offset calculated on start, since the following happened:
  598. // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
  599. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
  600. // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
  601. if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
  602. po.left += this.scrollParent.scrollLeft();
  603. po.top += this.scrollParent.scrollTop();
  604. }
  605. if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
  606. || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
  607. po = { top: 0, left: 0 };
  608. return {
  609. top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
  610. left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
  611. };
  612. },
  613. _getRelativeOffset: function() {
  614. if(this.cssPosition == "relative") {
  615. var p = this.element.position();
  616. return {
  617. top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
  618. left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
  619. };
  620. } else {
  621. return { top: 0, left: 0 };
  622. }
  623. },
  624. _cacheMargins: function() {
  625. this.margins = {
  626. left: (parseInt(this.element.css("marginLeft"),10) || 0),
  627. top: (parseInt(this.element.css("marginTop"),10) || 0)
  628. };
  629. },
  630. _cacheHelperProportions: function() {
  631. this.helperProportions = {
  632. width: this.helper.outerWidth(),
  633. height: this.helper.outerHeight()
  634. };
  635. },
  636. _setContainment: function() {
  637. var o = this.options;
  638. if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
  639. if(o.containment == 'document' || o.containment == 'window') this.containment = [
  640. 0 - this.offset.relative.left - this.offset.parent.left,
  641. 0 - this.offset.relative.top - this.offset.parent.top,
  642. $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
  643. ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
  644. ];
  645. if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
  646. var ce = $(o.containment)[0]; if(!ce) return;
  647. var co = $(o.containment).offset();
  648. var over = ($(ce).css("overflow") != 'hidden');
  649. this.containment = [
  650. co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
  651. co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
  652. 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,
  653. 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
  654. ];
  655. } else if(o.containment.constructor == Array) {
  656. this.containment = o.containment;
  657. }
  658. },
  659. _convertPositionTo: function(d, pos) {
  660. if(!pos) pos = this.position;
  661. var mod = d == "absolute" ? 1 : -1;
  662. 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);
  663. return {
  664. top: (
  665. pos.top // The absolute mouse position
  666. + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
  667. + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
  668. - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
  669. ),
  670. left: (
  671. pos.left // The absolute mouse position
  672. + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
  673. + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
  674. - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
  675. )
  676. };
  677. },
  678. _generatePosition: function(event) {
  679. 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);
  680. // This is another very weird special case that only happens for relative elements:
  681. // 1. If the css position is relative
  682. // 2. and the scroll parent is the document or similar to the offset parent
  683. // we have to refresh the relative offset during the scroll so there are no jumps
  684. if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {
  685. this.offset.relative = this._getRelativeOffset();
  686. }
  687. var pageX = event.pageX;
  688. var pageY = event.pageY;
  689. /*
  690. * - Position constraining -
  691. * Constrain the position to a mix of grid, containment.
  692. */
  693. if(this.originalPosition) { //If we are not dragging yet, we won't check for options
  694. if(this.containment) {
  695. if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
  696. if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
  697. if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
  698. if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
  699. }
  700. if(o.grid) {
  701. var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
  702. 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;
  703. var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
  704. 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;
  705. }
  706. }
  707. return {
  708. top: (
  709. pageY // The absolute mouse position
  710. - this.offset.click.top // Click offset (relative to the element)
  711. - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
  712. - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
  713. + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
  714. ),
  715. left: (
  716. pageX // The absolute mouse position
  717. - this.offset.click.left // Click offset (relative to the element)
  718. - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
  719. - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
  720. + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
  721. )
  722. };
  723. },
  724. _clear: function() {
  725. this.helper.removeClass("ui-draggable-dragging");
  726. if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove();
  727. //if($.ui.ddmanager) $.ui.ddmanager.current = null;
  728. this.helper = null;
  729. this.cancelHelperRemoval = false;
  730. },
  731. // From now on bulk stuff - mainly helpers
  732. _trigger: function(type, event, ui) {
  733. ui = ui || this._uiHash();
  734. $.ui.plugin.call(this, type, [event, ui]);
  735. if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
  736. return $.widget.prototype._trigger.call(this, type, event, ui);
  737. },
  738. plugins: {},
  739. _uiHash: function(event) {
  740. return {
  741. helper: this.helper,
  742. position: this.position,
  743. absolutePosition: this.positionAbs, //deprecated
  744. offset: this.positionAbs
  745. };
  746. }
  747. }));
  748. $.extend($.ui.draggable, {
  749. version: "1.7.2",
  750. eventPrefix: "drag",
  751. defaults: {
  752. addClasses: true,
  753. appendTo: "parent",
  754. axis: false,
  755. cancel: ":input,option",
  756. connectToSortable: false,
  757. containment: false,
  758. cursor: "auto",
  759. cursorAt: false,
  760. delay: 0,
  761. distance: 1,
  762. grid: false,
  763. handle: false,
  764. helper: "original",
  765. iframeFix: false,
  766. opacity: false,
  767. refreshPositions: false,
  768. revert: false,
  769. revertDuration: 500,
  770. scope: "default",
  771. scroll: true,
  772. scrollSensitivity: 20,
  773. scrollSpeed: 20,
  774. snap: false,
  775. snapMode: "both",
  776. snapTolerance: 20,
  777. stack: false,
  778. zIndex: false
  779. }
  780. });
  781. $.ui.plugin.add("draggable", "connectToSortable", {
  782. start: function(event, ui) {
  783. var inst = $(this).data("draggable"), o = inst.options,
  784. uiSortable = $.extend({}, ui, { item: inst.element });
  785. inst.sortables = [];
  786. $(o.connectToSortable).each(function() {
  787. var sortable = $.data(this, 'sortable');
  788. if (sortable && !sortable.options.disabled) {
  789. inst.sortables.push({
  790. instance: sortable,
  791. shouldRevert: sortable.options.revert
  792. });
  793. sortable._refreshItems(); //Do a one-time refresh at start to refresh the containerCache
  794. sortable._trigger("activate", event, uiSortable);
  795. }
  796. });
  797. },
  798. stop: function(event, ui) {
  799. //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
  800. var inst = $(this).data("draggable"),
  801. uiSortable = $.extend({}, ui, { item: inst.element });
  802. $.each(inst.sortables, function() {
  803. if(this.instance.isOver) {
  804. this.instance.isOver = 0;
  805. inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
  806. this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
  807. //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
  808. if(this.shouldRevert) this.instance.options.revert = true;
  809. //Trigger the stop of the sortable
  810. this.instance._mouseStop(event);
  811. this.instance.options.helper = this.instance.options._helper;
  812. //If the helper has been the original item, restore properties in the sortable
  813. if(inst.options.helper == 'original')
  814. this.instance.currentItem.css({ top: 'auto', left: 'auto' });
  815. } else {
  816. this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
  817. this.instance._trigger("deactivate", event, uiSortable);
  818. }
  819. });
  820. },
  821. drag: function(event, ui) {
  822. var inst = $(this).data("draggable"), self = this;
  823. var checkPos = function(o) {
  824. var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
  825. var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
  826. var itemHeight = o.height, itemWidth = o.width;
  827. var itemTop = o.top, itemLeft = o.left;
  828. return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);
  829. };
  830. $.each(inst.sortables, function(i) {
  831. //Copy over some variables to allow calling the sortable's native _intersectsWith
  832. this.instance.positionAbs = inst.positionAbs;
  833. this.instance.helperProportions = inst.helperProportions;
  834. this.instance.offset.click = inst.offset.click;
  835. if(this.instance._intersectsWith(this.instance.containerCache)) {
  836. //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
  837. if(!this.instance.isOver) {
  838. this.instance.isOver = 1;
  839. //Now we fake the start of dragging for the sortable instance,
  840. //by cloning the list group item, appending it to the sortable and using it as inst.currentItem
  841. //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)
  842. this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true);
  843. this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
  844. this.instance.options.helper = function() { return ui.helper[0]; };
  845. event.target = this.instance.currentItem[0];
  846. this.instance._mouseCapture(event, true);
  847. this.instance._mouseStart(event, true, true);
  848. //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
  849. this.instance.offset.click.top = inst.offset.click.top;
  850. this.instance.offset.click.left = inst.offset.click.left;
  851. this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
  852. this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
  853. inst._trigger("toSortable", event);
  854. inst.dropped = this.instance.element; //draggable revert needs that
  855. //hack so receive/update callbacks work (mostly)
  856. inst.currentItem = inst.element;
  857. this.instance.fromOutside = inst;
  858. }
  859. //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
  860. if(this.instance.currentItem) this.instance._mouseDrag(event);
  861. } else {
  862. //If it doesn't intersect with the sortable, and it intersected before,
  863. //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
  864. if(this.instance.isOver) {
  865. this.instance.isOver = 0;
  866. this.instance.cancelHelperRemoval = true;
  867. //Prevent reverting on this forced stop
  868. this.instance.options.revert = false;
  869. // The out event needs to be triggered independently
  870. this.instance._trigger('out', event, this.instance._uiHash(this.instance));
  871. this.instance._mouseStop(event, true);
  872. this.instance.options.helper = this.instance.options._helper;
  873. //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
  874. this.instance.currentItem.remove();
  875. if(this.instance.placeholder) this.instance.placeholder.remove();
  876. inst._trigger("fromSortable", event);
  877. inst.dropped = false; //draggable revert needs that
  878. }
  879. };
  880. });
  881. }
  882. });
  883. $.ui.plugin.add("draggable", "cursor", {
  884. start: function(event, ui) {
  885. var t = $('body'), o = $(this).data('draggable').options;
  886. if (t.css("cursor")) o._cursor = t.css("cursor");
  887. t.css("cursor", o.cursor);
  888. },
  889. stop: function(event, ui) {
  890. var o = $(this).data('draggable').options;
  891. if (o._cursor) $('body').css("cursor", o._cursor);
  892. }
  893. });
  894. $.ui.plugin.add("draggable", "iframeFix", {
  895. start: function(event, ui) {
  896. var o = $(this).data('draggable').options;
  897. $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
  898. $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
  899. .css({
  900. width: this.offsetWidth+"px", height: this.offsetHeight+"px",
  901. position: "absolute", opacity: "0.001", zIndex: 1000
  902. })
  903. .css($(this).offset())
  904. .appendTo("body");
  905. });
  906. },
  907. stop: function(event, ui) {
  908. $("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers
  909. }
  910. });
  911. $.ui.plugin.add("draggable", "opacity", {
  912. start: function(event, ui) {
  913. var t = $(ui.helper), o = $(this).data('draggable').options;
  914. if(t.css("opacity")) o._opacity = t.css("opacity");
  915. t.css('opacity', o.opacity);
  916. },
  917. stop: function(event, ui) {
  918. var o = $(this).data('draggable').options;
  919. if(o._opacity) $(ui.helper).css('opacity', o._opacity);
  920. }
  921. });
  922. $.ui.plugin.add("draggable", "scroll", {
  923. start: function(event, ui) {
  924. var i = $(this).data("draggable");
  925. if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
  926. },
  927. drag: function(event, ui) {
  928. var i = $(this).data("draggable"), o = i.options, scrolled = false;
  929. if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
  930. if(!o.axis || o.axis != 'x') {
  931. if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
  932. i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
  933. else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
  934. i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
  935. }
  936. if(!o.axis || o.axis != 'y') {
  937. if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
  938. i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
  939. else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)
  940. i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
  941. }
  942. } else {
  943. if(!o.axis || o.axis != 'x') {
  944. if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
  945. scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
  946. else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
  947. scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
  948. }
  949. if(!o.axis || o.axis != 'y') {
  950. if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
  951. scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
  952. else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
  953. scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
  954. }
  955. }
  956. if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
  957. $.ui.ddmanager.prepareOffsets(i, event);
  958. }
  959. });
  960. $.ui.plugin.add("draggable", "snap", {
  961. start: function(event, ui) {
  962. var i = $(this).data("draggable"), o = i.options;
  963. i.snapElements = [];
  964. $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
  965. var $t = $(this); var $o = $t.offset();
  966. if(this != i.element[0]) i.snapElements.push({
  967. item: this,
  968. width: $t.outerWidth(), height: $t.outerHeight(),
  969. top: $o.top, left: $o.left
  970. });
  971. });
  972. },
  973. drag: function(event, ui) {
  974. var inst = $(this).data("draggable"), o = inst.options;
  975. var d = o.snapTolerance;
  976. var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
  977. y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
  978. for (var i = inst.snapElements.length - 1; i >= 0; i--){
  979. var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
  980. t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
  981. //Yes, I know, this is insane ;)
  982. 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))) {
  983. 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 })));
  984. inst.snapElements[i].snapping = false;
  985. continue;
  986. }
  987. if(o.snapMode != 'inner') {
  988. var ts = Math.abs(t - y2) <= d;
  989. var bs = Math.abs(b - y1) <= d;
  990. var ls = Math.abs(l - x2) <= d;
  991. var rs = Math.abs(r - x1) <= d;
  992. if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
  993. if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
  994. if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
  995. if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
  996. }
  997. var first = (ts || bs || ls || rs);
  998. if(o.snapMode != 'outer') {
  999. var ts = Math.abs(t - y1) <= d;
  1000. var bs = Math.abs(b - y2) <= d;
  1001. var ls = Math.abs(l - x1) <= d;
  1002. var rs = Math.abs(r - x2) <= d;
  1003. if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
  1004. if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
  1005. if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
  1006. if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
  1007. }
  1008. if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
  1009. (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
  1010. inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
  1011. };
  1012. }
  1013. });
  1014. $.ui.plugin.add("draggable", "stack", {
  1015. start: function(event, ui) {
  1016. var o = $(this).data("draggable").options;
  1017. var group = $.makeArray($(o.stack.group)).sort(function(a,b) {
  1018. return (parseInt($(a).css("zIndex"),10) || o.stack.min) - (parseInt($(b).css("zIndex"),10) || o.stack.min);
  1019. });
  1020. $(group).each(function(i) {
  1021. this.style.zIndex = o.stack.min + i;
  1022. });
  1023. this[0].style.zIndex = o.stack.min + group.length;
  1024. }
  1025. });
  1026. $.ui.plugin.add("draggable", "zIndex", {
  1027. start: function(event, ui) {
  1028. var t = $(ui.helper), o = $(this).data("draggable").options;
  1029. if(t.css("zIndex")) o._zIndex = t.css("zIndex");
  1030. t.css('zIndex', o.zIndex);
  1031. },
  1032. stop: function(event, ui) {
  1033. var o = $(this).data("draggable").options;
  1034. if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
  1035. }
  1036. });
  1037. })(jQuery);
  1038. /*
  1039. * jQuery UI Droppable 1.7.2
  1040. *
  1041. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  1042. * Dual licensed under the MIT (MIT-LICENSE.txt)
  1043. * and GPL (GPL-LICENSE.txt) licenses.
  1044. *
  1045. * http://docs.jquery.com/UI/Droppables
  1046. *
  1047. * Depends:
  1048. * ui.core.js
  1049. * ui.draggable.js
  1050. */
  1051. (function($) {
  1052. $.widget("ui.droppable", {
  1053. _init: function() {
  1054. var o = this.options, accept = o.accept;
  1055. this.isover = 0; this.isout = 1;
  1056. this.options.accept = this.options.accept && $.isFunction(this.options.accept) ? this.options.accept : function(d) {
  1057. return d.is(accept);
  1058. };
  1059. //Store the droppable's proportions
  1060. this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
  1061. // Add the reference and positions to the manager
  1062. $.ui.ddmanager.droppables[this.options.scope] = $.ui.ddmanager.droppables[this.options.scope] || [];
  1063. $.ui.ddmanager.droppables[this.options.scope].push(this);
  1064. (this.options.addClasses && this.element.addClass("ui-droppable"));
  1065. },
  1066. destroy: function() {
  1067. var drop = $.ui.ddmanager.droppables[this.options.scope];
  1068. for ( var i = 0; i < drop.length; i++ )
  1069. if ( drop[i] == this )
  1070. drop.splice(i, 1);
  1071. this.element
  1072. .removeClass("ui-droppable ui-droppable-disabled")
  1073. .removeData("droppable")
  1074. .unbind(".droppable");
  1075. },
  1076. _setData: function(key, value) {
  1077. if(key == 'accept') {
  1078. this.options.accept = value && $.isFunction(value) ? value : function(d) {
  1079. return d.is(value);
  1080. };
  1081. } else {
  1082. $.widget.prototype._setData.apply(this, arguments);
  1083. }
  1084. },
  1085. _activate: function(event) {
  1086. var draggable = $.ui.ddmanager.current;
  1087. if(this.options.activeClass) this.element.addClass(this.options.activeClass);
  1088. (draggable && this._trigger('activate', event, this.ui(draggable)));
  1089. },
  1090. _deactivate: function(event) {
  1091. var draggable = $.ui.ddmanager.current;
  1092. if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
  1093. (draggable && this._trigger('deactivate', event, this.ui(draggable)));
  1094. },
  1095. _over: function(event) {
  1096. var draggable = $.ui.ddmanager.current;
  1097. if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
  1098. if (this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
  1099. if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
  1100. this._trigger('over', event, this.ui(draggable));
  1101. }
  1102. },
  1103. _out: function(event) {
  1104. var draggable = $.ui.ddmanager.current;
  1105. if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
  1106. if (this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
  1107. if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
  1108. this._trigger('out', event, this.ui(draggable));
  1109. }
  1110. },
  1111. _drop: function(event,custom) {
  1112. var draggable = custom || $.ui.ddmanager.current;
  1113. if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
  1114. var childrenIntersection = false;
  1115. this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
  1116. var inst = $.data(this, 'droppable');
  1117. if(inst.options.greedy && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)) {
  1118. childrenIntersection = true; return false;
  1119. }
  1120. });
  1121. if(childrenIntersection) return false;
  1122. if(this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
  1123. if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
  1124. if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
  1125. this._trigger('drop', event, this.ui(draggable));
  1126. return this.element;
  1127. }
  1128. return false;
  1129. },
  1130. ui: function(c) {
  1131. return {
  1132. draggable: (c.currentItem || c.element),
  1133. helper: c.helper,
  1134. position: c.position,
  1135. absolutePosition: c.positionAbs, //deprecated
  1136. offset: c.positionAbs
  1137. };
  1138. }
  1139. });
  1140. $.extend($.ui.droppable, {
  1141. version: "1.7.2",
  1142. eventPrefix: 'drop',
  1143. defaults: {
  1144. accept: '*',
  1145. activeClass: false,
  1146. addClasses: true,
  1147. greedy: false,
  1148. hoverClass: false,
  1149. scope: 'default',
  1150. tolerance: 'intersect'
  1151. }
  1152. });
  1153. $.ui.intersect = function(draggable, droppable, toleranceMode) {
  1154. if (!droppable.offset) return false;
  1155. var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
  1156. y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
  1157. var l = droppable.offset.left, r = l + droppable.proportions.width,
  1158. t = droppable.offset.top, b = t + droppable.proportions.height;
  1159. switch (toleranceMode) {
  1160. case 'fit':
  1161. return (l < x1 && x2 < r
  1162. && t < y1 && y2 < b);
  1163. break;
  1164. case 'intersect':
  1165. return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
  1166. && x2 - (draggable.helperProportions.width / 2) < r // Left Half
  1167. && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
  1168. && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
  1169. break;
  1170. case 'pointer':
  1171. var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
  1172. draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
  1173. isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
  1174. return isOver;
  1175. break;
  1176. case 'touch':
  1177. return (
  1178. (y1 >= t && y1 <= b) || // Top edge touching
  1179. (y2 >= t && y2 <= b) || // Bottom edge touching
  1180. (y1 < t && y2 > b) // Surrounded vertically
  1181. ) && (
  1182. (x1 >= l && x1 <= r) || // Left edge touching
  1183. (x2 >= l && x2 <= r) || // Right edge touching
  1184. (x1 < l && x2 > r) // Surrounded horizontally
  1185. );
  1186. break;
  1187. default:
  1188. return false;
  1189. break;
  1190. }
  1191. };
  1192. /*
  1193. This manager tracks offsets of draggables and droppables
  1194. */
  1195. $.ui.ddmanager = {
  1196. current: null,
  1197. droppables: { 'default': [] },
  1198. prepareOffsets: function(t, event) {
  1199. var m = $.ui.ddmanager.droppables[t.options.scope];
  1200. var type = event ? event.type : null; // workaround for #2317
  1201. var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
  1202. droppablesLoop: for (var i = 0; i < m.length; i++) {
  1203. if(m[i].options.disabled || (t && !m[i].options.accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
  1204. 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
  1205. m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
  1206. m[i].offset = m[i].element.offset();
  1207. m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
  1208. if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
  1209. }
  1210. },
  1211. drop: function(draggable, event) {
  1212. var dropped = false;
  1213. $.each($.ui.ddmanager.droppables[draggable.options.scope], function() {
  1214. if(!this.options) return;
  1215. if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
  1216. dropped = this._drop.call(this, event);
  1217. if (!this.options.disabled && this.visible && this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
  1218. this.isout = 1; this.isover = 0;
  1219. this._deactivate.call(this, event);
  1220. }
  1221. });
  1222. return dropped;
  1223. },
  1224. drag: function(draggable, event) {
  1225. //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
  1226. if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
  1227. //Run through all droppables and check their positions based on specific tolerance options
  1228. $.each($.ui.ddmanager.droppables[draggable.options.scope], function() {
  1229. if(this.options.disabled || this.greedyChild || !this.visible) return;
  1230. var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
  1231. var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
  1232. if(!c) return;
  1233. var parentInstance;
  1234. if (this.options.greedy) {
  1235. var parent = this.element.parents(':data(droppable):eq(0)');
  1236. if (parent.length) {
  1237. parentInstance = $.data(parent[0], 'droppable');
  1238. parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
  1239. }
  1240. }
  1241. // we just moved into a greedy child
  1242. if (parentInstance && c == 'isover') {
  1243. parentInstance['isover'] = 0;
  1244. parentInstance['isout'] = 1;
  1245. parentInstance._out.call(parentInstance, event);
  1246. }
  1247. this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
  1248. this[c == "isover" ? "_over" : "_out"].call(this, event);
  1249. // we just moved out of a greedy child
  1250. if (parentInstance && c == 'isout') {
  1251. parentInstance['isout'] = 0;
  1252. parentInstance['isover'] = 1;
  1253. parentInstance._over.call(parentInstance, event);
  1254. }
  1255. });
  1256. }
  1257. };
  1258. })(jQuery);
  1259. /*
  1260. * jQuery UI Resizable 1.7.2
  1261. *
  1262. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  1263. * Dual licensed under the MIT (MIT-LICENSE.txt)
  1264. * and GPL (GPL-LICENSE.txt) licenses.
  1265. *
  1266. * http://docs.jquery.com/UI/Resizables
  1267. *
  1268. * Depends:
  1269. * ui.core.js
  1270. */
  1271. (function($) {
  1272. $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
  1273. _init: function() {
  1274. var self = this, o = this.options;
  1275. this.element.addClass("ui-resizable");
  1276. $.extend(this, {
  1277. _aspectRatio: !!(o.aspectRatio),
  1278. aspectRatio: o.aspectRatio,
  1279. originalElement: this.element,
  1280. _proportionallyResizeElements: [],
  1281. _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null
  1282. });
  1283. //Wrap the element if it cannot hold child nodes
  1284. if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
  1285. //Opera fix for relative positioning
  1286. if (/relative/.test(this.element.css('position')) && $.browser.opera)
  1287. this.element.css({ position: 'relative', top: 'auto', left: 'auto' });
  1288. //Create a wrapper element and set the wrapper to the new current internal element
  1289. this.element.wrap(
  1290. $('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({
  1291. position: this.element.css('position'),
  1292. width: this.element.outerWidth(),
  1293. height: this.element.outerHeight(),
  1294. top: this.element.css('top'),
  1295. left: this.element.css('left')
  1296. })
  1297. );
  1298. //Overwrite the original this.element
  1299. this.element = this.element.parent().data(
  1300. "resizable", this.element.data('resizable')
  1301. );
  1302. this.elementIsWrapper = true;
  1303. //Move margins to the wrapper
  1304. this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") });
  1305. this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
  1306. //Prevent Safari textarea resize
  1307. this.originalResizeStyle = this.originalElement.css('resize');
  1308. this.originalElement.css('resize', 'none');
  1309. //Push the actual element to our proportionallyResize internal array
  1310. this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' }));
  1311. // avoid IE jump (hard set the margin)
  1312. this.originalElement.css({ margin: this.originalElement.css('margin') });
  1313. // fix handlers offset
  1314. this._proportionallyResize();
  1315. }
  1316. 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' });
  1317. if(this.handles.constructor == String) {
  1318. if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw';
  1319. var n = this.handles.split(","); this.handles = {};
  1320. for(var i = 0; i < n.length; i++) {
  1321. var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle;
  1322. var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>');
  1323. // increase zIndex of sw, se, ne, nw axis
  1324. //TODO : this modifies original option
  1325. if(/sw|se|ne|nw/.test(handle)) axis.css({ zIndex: ++o.zIndex });
  1326. //TODO : What's going on here?
  1327. if ('se' == handle) {
  1328. axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');
  1329. };
  1330. //Insert into internal handles object and append to element
  1331. this.handles[handle] = '.ui-resizable-'+handle;
  1332. this.element.append(axis);
  1333. }
  1334. }
  1335. this._renderAxis = function(target) {
  1336. target = target || this.element;
  1337. for(var i in this.handles) {
  1338. if(this.handles[i].constructor == String)
  1339. this.handles[i] = $(this.handles[i], this.element).show();
  1340. //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
  1341. if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
  1342. var axis = $(this.handles[i], this.element), padWrapper = 0;
  1343. //Checking the correct pad and border
  1344. padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
  1345. //The padding type i have to apply...
  1346. var padPos = [ 'padding',
  1347. /ne|nw|n/.test(i) ? 'Top' :
  1348. /se|sw|s/.test(i) ? 'Bottom' :
  1349. /^e$/.test(i) ? 'Right' : 'Left' ].join("");
  1350. target.css(padPos, padWrapper);
  1351. this._proportionallyResize();
  1352. }
  1353. //TODO: What's that good for? There's not anything to be executed left
  1354. if(!$(this.handles[i]).length)
  1355. continue;
  1356. }
  1357. };
  1358. //TODO: make renderAxis a prototype function
  1359. this._renderAxis(this.element);
  1360. this._handles = $('.ui-resizable-handle', this.element)
  1361. .disableSelection();
  1362. //Matching axis name
  1363. this._handles.mouseover(function() {
  1364. if (!self.resizing) {
  1365. if (this.className)
  1366. var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
  1367. //Axis, default = se
  1368. self.axis = axis && axis[1] ? axis[1] : 'se';
  1369. }
  1370. });
  1371. //If we want to auto hide the elements
  1372. if (o.autoHide) {
  1373. this._handles.hide();
  1374. $(this.element)
  1375. .addClass("ui-resizable-autohide")
  1376. .hover(function() {
  1377. $(this).removeClass("ui-resizable-autohide");
  1378. self._handles.show();
  1379. },
  1380. function(){
  1381. if (!self.resizing) {
  1382. $(this).addClass("ui-resizable-autohide");
  1383. self._handles.hide();
  1384. }
  1385. });
  1386. }
  1387. //Initialize the mouse interaction
  1388. this._mouseInit();
  1389. },
  1390. destroy: function() {
  1391. this._mouseDestroy();
  1392. var _destroy = function(exp) {
  1393. $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
  1394. .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
  1395. };
  1396. //TODO: Unwrap at same DOM position
  1397. if (this.elementIsWrapper) {
  1398. _destroy(this.element);
  1399. var wrapper = this.element;
  1400. wrapper.parent().append(
  1401. this.originalElement.css({
  1402. position: wrapper.css('position'),
  1403. width: wrapper.outerWidth(),
  1404. height: wrapper.outerHeight(),
  1405. top: wrapper.css('top'),
  1406. left: wrapper.css('left')
  1407. })
  1408. ).end().remove();
  1409. }
  1410. this.originalElement.css('resize', this.originalResizeStyle);
  1411. _destroy(this.originalElement);
  1412. },
  1413. _mouseCapture: function(event) {
  1414. var handle = false;
  1415. for(var i in this.handles) {
  1416. if($(this.handles[i])[0] == event.target) handle = true;
  1417. }
  1418. return this.options.disabled || !!handle;
  1419. },
  1420. _mouseStart: function(event) {
  1421. var o = this.options, iniPos = this.element.position(), el = this.element;
  1422. this.resizing = true;
  1423. this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
  1424. // bugfix for http://dev.jquery.com/ticket/1749
  1425. if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
  1426. el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left });
  1427. }
  1428. //Opera fixing relative position
  1429. if ($.browser.opera && (/relative/).test(el.css('position')))
  1430. el.css({ position: 'relative', top: 'auto', left: 'auto' });
  1431. this._renderProxy();
  1432. var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
  1433. if (o.containment) {
  1434. curleft += $(o.containment).scrollLeft() || 0;
  1435. curtop += $(o.containment).scrollTop() || 0;
  1436. }
  1437. //Store needed variables
  1438. this.offset = this.helper.offset();
  1439. this.position = { left: curleft, top: curtop };
  1440. this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
  1441. this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
  1442. this.originalPosition = { left: curleft, top: curtop };
  1443. this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
  1444. this.originalMousePosition = { left: event.pageX, top: event.pageY };
  1445. //Aspect Ratio
  1446. this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
  1447. var cursor = $('.ui-resizable-' + this.axis).css('cursor');
  1448. $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor);
  1449. el.addClass("ui-resizable-resizing");
  1450. this._propagate("start", event);
  1451. return true;
  1452. },
  1453. _mouseDrag: function(event) {
  1454. //Increase performance, avoid regex
  1455. var el = this.helper, o = this.options, props = {},
  1456. self = this, smp = this.originalMousePosition, a = this.axis;
  1457. var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0;
  1458. var trigger = this._change[a];
  1459. if (!trigger) return false;
  1460. // Calculate the attrs that will be change
  1461. var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;
  1462. if (this._aspectRatio || event.shiftKey)
  1463. data = this._updateRatio(data, event);
  1464. data = this._respectSize(data, event);
  1465. // plugins callbacks need to be called first
  1466. this._propagate("resize", event);
  1467. el.css({
  1468. top: this.position.top + "px", left: this.position.left + "px",
  1469. width: this.size.width + "px", height: this.size.height + "px"
  1470. });
  1471. if (!this._helper && this._proportionallyResizeElements.length)
  1472. this._proportionallyResize();
  1473. this._updateCache(data);
  1474. // calling the user callback at the end
  1475. this._trigger('resize', event, this.ui());
  1476. return false;
  1477. },
  1478. _mouseStop: function(event) {
  1479. this.resizing = false;
  1480. var o = this.options, self = this;
  1481. if(this._helper) {
  1482. var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
  1483. soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
  1484. soffsetw = ista ? 0 : self.sizeDiff.width;
  1485. var s = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
  1486. left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
  1487. top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
  1488. if (!o.animate)
  1489. this.element.css($.extend(s, { top: top, left: left }));
  1490. self.helper.height(self.size.height);
  1491. self.helper.width(self.size.width);
  1492. if (this._helper && !o.animate) this._proportionallyResize();
  1493. }
  1494. $('body').css('cursor', 'auto');
  1495. this.element.removeClass("ui-resizable-resizing");
  1496. this._propagate("stop", event);
  1497. if (this._helper) this.helper.remove();
  1498. return false;
  1499. },
  1500. _updateCache: function(data) {
  1501. var o = this.options;
  1502. this.offset = this.helper.offset();
  1503. if (isNumber(data.left)) this.position.left = data.left;
  1504. if (isNumber(data.top)) this.position.top = data.top;
  1505. if (isNumber(data.height)) this.size.height = data.height;
  1506. if (isNumber(data.width)) this.size.width = data.width;
  1507. },
  1508. _updateRatio: function(data, event) {
  1509. var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
  1510. if (data.height) data.width = (csize.height * this.aspectRatio);
  1511. else if (data.width) data.height = (csize.width / this.aspectRatio);
  1512. if (a == 'sw') {
  1513. data.left = cpos.left + (csize.width - data.width);
  1514. data.top = null;
  1515. }
  1516. if (a == 'nw') {
  1517. data.top = cpos.top + (csize.height - data.height);
  1518. data.left = cpos.left + (csize.width - data.width);
  1519. }
  1520. return data;
  1521. },
  1522. _respectSize: function(data, event) {
  1523. var el = this.helper, o = this.options, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,
  1524. ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
  1525. isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height);
  1526. if (isminw) data.width = o.minWidth;
  1527. if (isminh) data.height = o.minHeight;
  1528. if (ismaxw) data.width = o.maxWidth;
  1529. if (ismaxh) data.height = o.maxHeight;
  1530. var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;
  1531. var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
  1532. if (isminw && cw) data.left = dw - o.minWidth;
  1533. if (ismaxw && cw) data.left = dw - o.maxWidth;
  1534. if (isminh && ch) data.top = dh - o.minHeight;
  1535. if (ismaxh && ch) data.top = dh - o.maxHeight;
  1536. // fixing jump error on top/left - bug #2330
  1537. var isNotwh = !data.width && !data.height;
  1538. if (isNotwh && !data.left && data.top) data.top = null;
  1539. else if (isNotwh && !data.top && data.left) data.left = null;
  1540. return data;
  1541. },
  1542. _proportionallyResize: function() {
  1543. var o = this.options;
  1544. if (!this._proportionallyResizeElements.length) return;
  1545. var element = this.helper || this.element;
  1546. for (var i=0; i < this._proportionallyResizeElements.length; i++) {
  1547. var prel = this._proportionallyResizeElements[i];
  1548. if (!this.borderDif) {
  1549. var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
  1550. p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
  1551. this.borderDif = $.map(b, function(v, i) {
  1552. var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
  1553. return border + padding;
  1554. });
  1555. }
  1556. if ($.browser.msie && !(!($(element).is(':hidden') || $(element).parents(':hidden').length)))
  1557. continue;
  1558. prel.css({
  1559. height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
  1560. width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
  1561. });
  1562. };
  1563. },
  1564. _renderProxy: function() {
  1565. var el = this.element, o = this.options;
  1566. this.elementOffset = el.offset();
  1567. if(this._helper) {
  1568. this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
  1569. // fix ie6 offset TODO: This seems broken
  1570. var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
  1571. pxyoffset = ( ie6 ? 2 : -1 );
  1572. this.helper.addClass(this._helper).css({
  1573. width: this.element.outerWidth() + pxyoffset,
  1574. height: this.element.outerHeight() + pxyoffset,
  1575. position: 'absolute',
  1576. left: this.elementOffset.left - ie6offset +'px',
  1577. top: this.elementOffset.top - ie6offset +'px',
  1578. zIndex: ++o.zIndex //TODO: Don't modify option
  1579. });
  1580. this.helper
  1581. .appendTo("body")
  1582. .disableSelection();
  1583. } else {
  1584. this.helper = this.element;
  1585. }
  1586. },
  1587. _change: {
  1588. e: function(event, dx, dy) {
  1589. return { width: this.originalSize.width + dx };
  1590. },
  1591. w: function(event, dx, dy) {
  1592. var o = this.options, cs = this.originalSize, sp = this.originalPosition;
  1593. return { left: sp.left + dx, width: cs.width - dx };
  1594. },
  1595. n: function(event, dx, dy) {
  1596. var o = this.options, cs = this.originalSize, sp = this.originalPosition;
  1597. return { top: sp.top + dy, height: cs.height - dy };
  1598. },
  1599. s: function(event, dx, dy) {
  1600. return { height: this.originalSize.height + dy };
  1601. },
  1602. se: function(event, dx, dy) {
  1603. return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
  1604. },
  1605. sw: function(event, dx, dy) {
  1606. return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
  1607. },
  1608. ne: function(event, dx, dy) {
  1609. return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
  1610. },
  1611. nw: function(event, dx, dy) {
  1612. return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
  1613. }
  1614. },
  1615. _propagate: function(n, event) {
  1616. $.ui.plugin.call(this, n, [event, this.ui()]);
  1617. (n != "resize" && this._trigger(n, event, this.ui()));
  1618. },
  1619. plugins: {},
  1620. ui: function() {
  1621. return {
  1622. originalElement: this.originalElement,
  1623. element: this.element,
  1624. helper: this.helper,
  1625. position: this.position,
  1626. size: this.size,
  1627. originalSize: this.originalSize,
  1628. originalPosition: this.originalPosition
  1629. };
  1630. }
  1631. }));
  1632. $.extend($.ui.resizable, {
  1633. version: "1.7.2",
  1634. eventPrefix: "resize",
  1635. defaults: {
  1636. alsoResize: false,
  1637. animate: false,
  1638. animateDuration: "slow",
  1639. animateEasing: "swing",
  1640. aspectRatio: false,
  1641. autoHide: false,
  1642. cancel: ":input,option",
  1643. containment: false,
  1644. delay: 0,
  1645. distance: 1,
  1646. ghost: false,
  1647. grid: false,
  1648. handles: "e,s,se",
  1649. helper: false,
  1650. maxHeight: null,
  1651. maxWidth: null,
  1652. minHeight: 10,
  1653. minWidth: 10,
  1654. zIndex: 1000
  1655. }
  1656. });
  1657. /*
  1658. * Resizable Extensions
  1659. */
  1660. $.ui.plugin.add("resizable", "alsoResize", {
  1661. start: function(event, ui) {
  1662. var self = $(this).data("resizable"), o = self.options;
  1663. _store = function(exp) {
  1664. $(exp).each(function() {
  1665. $(this).data("resizable-alsoresize", {
  1666. width: parseInt($(this).width(), 10), height: parseInt($(this).height(), 10),
  1667. left: parseInt($(this).css('left'), 10), top: parseInt($(this).css('top'), 10)
  1668. });
  1669. });
  1670. };
  1671. if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) {
  1672. if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
  1673. else { $.each(o.alsoResize, function(exp, c) { _store(exp); }); }
  1674. }else{
  1675. _store(o.alsoResize);
  1676. }
  1677. },
  1678. resize: function(event, ui){
  1679. var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition;
  1680. var delta = {
  1681. height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,
  1682. top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0
  1683. },
  1684. _alsoResize = function(exp, c) {
  1685. $(exp).each(function() {
  1686. var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, css = c && c.length ? c : ['width', 'height', 'top', 'left'];
  1687. $.each(css || ['width', 'height', 'top', 'left'], function(i, prop) {
  1688. var sum = (start[prop]||0) + (delta[prop]||0);
  1689. if (sum && sum >= 0)
  1690. style[prop] = sum || null;
  1691. });
  1692. //Opera fixing relative position
  1693. if (/relative/.test(el.css('position')) && $.browser.opera) {
  1694. self._revertToRelativePosition = true;
  1695. el.css({ position: 'absolute', top: 'auto', left: 'auto' });
  1696. }
  1697. el.css(style);
  1698. });
  1699. };
  1700. if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
  1701. $.each(o.alsoResize, function(exp, c) { _alsoResize(exp, c); });
  1702. }else{
  1703. _alsoResize(o.alsoResize);
  1704. }
  1705. },
  1706. stop: function(event, ui){
  1707. var self = $(this).data("resizable");
  1708. //Opera fixing relative position
  1709. if (self._revertToRelativePosition && $.browser.opera) {
  1710. self._revertToRelativePosition = false;
  1711. el.css({ position: 'relative' });
  1712. }
  1713. $(this).removeData("resizable-alsoresize-start");
  1714. }
  1715. });
  1716. $.ui.plugin.add("resizable", "animate", {
  1717. stop: function(event, ui) {
  1718. var self = $(this).data("resizable"), o = self.options;
  1719. var pr = self._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
  1720. soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
  1721. soffsetw = ista ? 0 : self.sizeDiff.width;
  1722. var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
  1723. left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
  1724. top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
  1725. self.element.animate(
  1726. $.extend(style, top && left ? { top: top, left: left } : {}), {
  1727. duration: o.animateDuration,
  1728. easing: o.animateEasing,
  1729. step: function() {
  1730. var data = {
  1731. width: parseInt(self.element.css('width'), 10),
  1732. height: parseInt(self.element.css('height'), 10),
  1733. top: parseInt(self.element.css('top'), 10),
  1734. left: parseInt(self.element.css('left'), 10)
  1735. };
  1736. if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height });
  1737. // propagating resize, and updating values for each animation step
  1738. self._updateCache(data);
  1739. self._propagate("resize", event);
  1740. }
  1741. }
  1742. );
  1743. }
  1744. });
  1745. $.ui.plugin.add("resizable", "containment", {
  1746. start: function(event, ui) {
  1747. var self = $(this).data("resizable"), o = self.options, el = self.element;
  1748. var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
  1749. if (!ce) return;
  1750. self.containerElement = $(ce);
  1751. if (/document/.test(oc) || oc == document) {
  1752. self.containerOffset = { left: 0, top: 0 };
  1753. self.containerPosition = { left: 0, top: 0 };
  1754. self.parentData = {
  1755. element: $(document), left: 0, top: 0,
  1756. width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
  1757. };
  1758. }
  1759. // i'm a node, so compute top, left, right, bottom
  1760. else {
  1761. var element = $(ce), p = [];
  1762. $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
  1763. self.containerOffset = element.offset();
  1764. self.containerPosition = element.position();
  1765. self.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
  1766. var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width,
  1767. width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
  1768. self.parentData = {
  1769. element: ce, left: co.left, top: co.top, width: width, height: height
  1770. };
  1771. }
  1772. },
  1773. resize: function(event, ui) {
  1774. var self = $(this).data("resizable"), o = self.options,
  1775. ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position,
  1776. pRatio = self._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
  1777. if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co;
  1778. if (cp.left < (self._helper ? co.left : 0)) {
  1779. self.size.width = self.size.width + (self._helper ? (self.position.left - co.left) : (self.position.left - cop.left));
  1780. if (pRatio) self.size.height = self.size.width / o.aspectRatio;
  1781. self.position.left = o.helper ? co.left : 0;
  1782. }
  1783. if (cp.top < (self._helper ? co.top : 0)) {
  1784. self.size.height = self.size.height + (self._helper ? (self.position.top - co.top) : self.position.top);
  1785. if (pRatio) self.size.width = self.size.height * o.aspectRatio;
  1786. self.position.top = self._helper ? co.top : 0;
  1787. }
  1788. self.offset.left = self.parentData.left+self.position.left;
  1789. self.offset.top = self.parentData.top+self.position.top;
  1790. var woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ),
  1791. hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height );
  1792. var isParent = self.containerElement.get(0) == self.element.parent().get(0),
  1793. isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position'));
  1794. if(isParent && isOffsetRelative) woset -= self.parentData.left;
  1795. if (woset + self.size.width >= self.parentData.width) {
  1796. self.size.width = self.parentData.width - woset;
  1797. if (pRatio) self.size.height = self.size.width / self.aspectRatio;
  1798. }
  1799. if (hoset + self.size.height >= self.parentData.height) {
  1800. self.size.height = self.parentData.height - hoset;
  1801. if (pRatio) self.size.width = self.size.height * self.aspectRatio;
  1802. }
  1803. },
  1804. stop: function(event, ui){
  1805. var self = $(this).data("resizable"), o = self.options, cp = self.position,
  1806. co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement;
  1807. var helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height;
  1808. if (self._helper && !o.animate && (/relative/).test(ce.css('position')))
  1809. $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
  1810. if (self._helper && !o.animate && (/static/).test(ce.css('position')))
  1811. $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
  1812. }
  1813. });
  1814. $.ui.plugin.add("resizable", "ghost", {
  1815. start: function(event, ui) {
  1816. var self = $(this).data("resizable"), o = self.options, cs = self.size;
  1817. self.ghost = self.originalElement.clone();
  1818. self.ghost
  1819. .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
  1820. .addClass('ui-resizable-ghost')
  1821. .addClass(typeof o.ghost == 'string' ? o.ghost : '');
  1822. self.ghost.appendTo(self.helper);
  1823. },
  1824. resize: function(event, ui){
  1825. var self = $(this).data("resizable"), o = self.options;
  1826. if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });
  1827. },
  1828. stop: function(event, ui){
  1829. var self = $(this).data("resizable"), o = self.options;
  1830. if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));
  1831. }
  1832. });
  1833. $.ui.plugin.add("resizable", "grid", {
  1834. resize: function(event, ui) {
  1835. 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;
  1836. o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
  1837. 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);
  1838. if (/^(se|s|e)$/.test(a)) {
  1839. self.size.width = os.width + ox;
  1840. self.size.height = os.height + oy;
  1841. }
  1842. else if (/^(ne)$/.test(a)) {
  1843. self.size.width = os.width + ox;
  1844. self.size.height = os.height + oy;
  1845. self.position.top = op.top - oy;
  1846. }
  1847. else if (/^(sw)$/.test(a)) {
  1848. self.size.width = os.width + ox;
  1849. self.size.height = os.height + oy;
  1850. self.position.left = op.left - ox;
  1851. }
  1852. else {
  1853. self.size.width = os.width + ox;
  1854. self.size.height = os.height + oy;
  1855. self.position.top = op.top - oy;
  1856. self.position.left = op.left - ox;
  1857. }
  1858. }
  1859. });
  1860. var num = function(v) {
  1861. return parseInt(v, 10) || 0;
  1862. };
  1863. var isNumber = function(value) {
  1864. return !isNaN(parseInt(value, 10));
  1865. };
  1866. })(jQuery);
  1867. /*
  1868. * jQuery UI Selectable 1.7.2
  1869. *
  1870. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  1871. * Dual licensed under the MIT (MIT-LICENSE.txt)
  1872. * and GPL (GPL-LICENSE.txt) licenses.
  1873. *
  1874. * http://docs.jquery.com/UI/Selectables
  1875. *
  1876. * Depends:
  1877. * ui.core.js
  1878. */
  1879. (function($) {
  1880. $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
  1881. _init: function() {
  1882. var self = this;
  1883. this.element.addClass("ui-selectable");
  1884. this.dragged = false;
  1885. // cache selectee children based on filter
  1886. var selectees;
  1887. this.refresh = function() {
  1888. selectees = $(self.options.filter, self.element[0]);
  1889. selectees.each(function() {
  1890. var $this = $(this);
  1891. var pos = $this.offset();
  1892. $.data(this, "selectable-item", {
  1893. element: this,
  1894. $element: $this,
  1895. left: pos.left,
  1896. top: pos.top,
  1897. right: pos.left + $this.outerWidth(),
  1898. bottom: pos.top + $this.outerHeight(),
  1899. startselected: false,
  1900. selected: $this.hasClass('ui-selected'),
  1901. selecting: $this.hasClass('ui-selecting'),
  1902. unselecting: $this.hasClass('ui-unselecting')
  1903. });
  1904. });
  1905. };
  1906. this.refresh();
  1907. this.selectees = selectees.addClass("ui-selectee");
  1908. this._mouseInit();
  1909. this.helper = $(document.createElement('div'))
  1910. .css({border:'1px dotted black'})
  1911. .addClass("ui-selectable-helper");
  1912. },
  1913. destroy: function() {
  1914. this.element
  1915. .removeClass("ui-selectable ui-selectable-disabled")
  1916. .removeData("selectable")
  1917. .unbind(".selectable");
  1918. this._mouseDestroy();
  1919. },
  1920. _mouseStart: function(event) {
  1921. var self = this;
  1922. this.opos = [event.pageX, event.pageY];
  1923. if (this.options.disabled)
  1924. return;
  1925. var options = this.options;
  1926. this.selectees = $(options.filter, this.element[0]);
  1927. this._trigger("start", event);
  1928. $(options.appendTo).append(this.helper);
  1929. // position helper (lasso)
  1930. this.helper.css({
  1931. "z-index": 100,
  1932. "position": "absolute",
  1933. "left": event.clientX,
  1934. "top": event.clientY,
  1935. "width": 0,
  1936. "height": 0
  1937. });
  1938. if (options.autoRefresh) {
  1939. this.refresh();
  1940. }
  1941. this.selectees.filter('.ui-selected').each(function() {
  1942. var selectee = $.data(this, "selectable-item");
  1943. selectee.startselected = true;
  1944. if (!event.metaKey) {
  1945. selectee.$element.removeClass('ui-selected');
  1946. selectee.selected = false;
  1947. selectee.$element.addClass('ui-unselecting');
  1948. selectee.unselecting = true;
  1949. // selectable UNSELECTING callback
  1950. self._trigger("unselecting", event, {
  1951. unselecting: selectee.element
  1952. });
  1953. }
  1954. });
  1955. $(event.target).parents().andSelf().each(function() {
  1956. var selectee = $.data(this, "selectable-item");
  1957. if (selectee) {
  1958. selectee.$element.removeClass("ui-unselecting").addClass('ui-selecting');
  1959. selectee.unselecting = false;
  1960. selectee.selecting = true;
  1961. selectee.selected = true;
  1962. // selectable SELECTING callback
  1963. self._trigger("selecting", event, {
  1964. selecting: selectee.element
  1965. });
  1966. return false;
  1967. }
  1968. });
  1969. },
  1970. _mouseDrag: function(event) {
  1971. var self = this;
  1972. this.dragged = true;
  1973. if (this.options.disabled)
  1974. return;
  1975. var options = this.options;
  1976. var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY;
  1977. if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }
  1978. if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }
  1979. this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});
  1980. this.selectees.each(function() {
  1981. var selectee = $.data(this, "selectable-item");
  1982. //prevent helper from being selected if appendTo: selectable
  1983. if (!selectee || selectee.element == self.element[0])
  1984. return;
  1985. var hit = false;
  1986. if (options.tolerance == 'touch') {
  1987. hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
  1988. } else if (options.tolerance == 'fit') {
  1989. hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
  1990. }
  1991. if (hit) {
  1992. // SELECT
  1993. if (selectee.selected) {
  1994. selectee.$element.removeClass('ui-selected');
  1995. selectee.selected = false;
  1996. }
  1997. if (selectee.unselecting) {
  1998. selectee.$element.removeClass('ui-unselecting');
  1999. selectee.unselecting = false;
  2000. }
  2001. if (!selectee.selecting) {
  2002. selectee.$element.addClass('ui-selecting');
  2003. selectee.selecting = true;
  2004. // selectable SELECTING callback
  2005. self._trigger("selecting", event, {
  2006. selecting: selectee.element
  2007. });
  2008. }
  2009. } else {
  2010. // UNSELECT
  2011. if (selectee.selecting) {
  2012. if (event.metaKey && selectee.startselected) {
  2013. selectee.$element.removeClass('ui-selecting');
  2014. selectee.selecting = false;
  2015. selectee.$element.addClass('ui-selected');
  2016. selectee.selected = true;
  2017. } else {
  2018. selectee.$element.removeClass('ui-selecting');
  2019. selectee.selecting = false;
  2020. if (selectee.startselected) {
  2021. selectee.$element.addClass('ui-unselecting');
  2022. selectee.unselecting = true;
  2023. }
  2024. // selectable UNSELECTING callback
  2025. self._trigger("unselecting", event, {
  2026. unselecting: selectee.element
  2027. });
  2028. }
  2029. }
  2030. if (selectee.selected) {
  2031. if (!event.metaKey && !selectee.startselected) {
  2032. selectee.$element.removeClass('ui-selected');
  2033. selectee.selected = false;
  2034. selectee.$element.addClass('ui-unselecting');
  2035. selectee.unselecting = true;
  2036. // selectable UNSELECTING callback
  2037. self._trigger("unselecting", event, {
  2038. unselecting: selectee.element
  2039. });
  2040. }
  2041. }
  2042. }
  2043. });
  2044. return false;
  2045. },
  2046. _mouseStop: function(event) {
  2047. var self = this;
  2048. this.dragged = false;
  2049. var options = this.options;
  2050. $('.ui-unselecting', this.element[0]).each(function() {
  2051. var selectee = $.data(this, "selectable-item");
  2052. selectee.$element.removeClass('ui-unselecting');
  2053. selectee.unselecting = false;
  2054. selectee.startselected = false;
  2055. self._trigger("unselected", event, {
  2056. unselected: selectee.element
  2057. });
  2058. });
  2059. $('.ui-selecting', this.element[0]).each(function() {
  2060. var selectee = $.data(this, "selectable-item");
  2061. selectee.$element.removeClass('ui-selecting').addClass('ui-selected');
  2062. selectee.selecting = false;
  2063. selectee.selected = true;
  2064. selectee.startselected = true;
  2065. self._trigger("selected", event, {
  2066. selected: selectee.element
  2067. });
  2068. });
  2069. this._trigger("stop", event);
  2070. this.helper.remove();
  2071. return false;
  2072. }
  2073. }));
  2074. $.extend($.ui.selectable, {
  2075. version: "1.7.2",
  2076. defaults: {
  2077. appendTo: 'body',
  2078. autoRefresh: true,
  2079. cancel: ":input,option",
  2080. delay: 0,
  2081. distance: 0,
  2082. filter: '*',
  2083. tolerance: 'touch'
  2084. }
  2085. });
  2086. })(jQuery);
  2087. /*
  2088. * jQuery UI Sortable 1.7.2
  2089. *
  2090. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  2091. * Dual licensed under the MIT (MIT-LICENSE.txt)
  2092. * and GPL (GPL-LICENSE.txt) licenses.
  2093. *
  2094. * http://docs.jquery.com/UI/Sortables
  2095. *
  2096. * Depends:
  2097. * ui.core.js
  2098. */
  2099. (function($) {
  2100. $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
  2101. _init: function() {
  2102. var o = this.options;
  2103. this.containerCache = {};
  2104. this.element.addClass("ui-sortable");
  2105. //Get the items
  2106. this.refresh();
  2107. //Let's determine if the items are floating
  2108. this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false;
  2109. //Let's determine the parent's offset
  2110. this.offset = this.element.offset();
  2111. //Initialize mouse events for interaction
  2112. this._mouseInit();
  2113. },
  2114. destroy: function() {
  2115. this.element
  2116. .removeClass("ui-sortable ui-sortable-disabled")
  2117. .removeData("sortable")
  2118. .unbind(".sortable");
  2119. this._mouseDestroy();
  2120. for ( var i = this.items.length - 1; i >= 0; i-- )
  2121. this.items[i].item.removeData("sortable-item");
  2122. },
  2123. _mouseCapture: function(event, overrideHandle) {
  2124. if (this.reverting) {
  2125. return false;
  2126. }
  2127. if(this.options.disabled || this.options.type == 'static') return false;
  2128. //We have to refresh the items data once first
  2129. this._refreshItems(event);
  2130. //Find out if the clicked node (or one of its parents) is a actual item in this.items
  2131. var currentItem = null, self = this, nodes = $(event.target).parents().each(function() {
  2132. if($.data(this, 'sortable-item') == self) {
  2133. currentItem = $(this);
  2134. return false;
  2135. }
  2136. });
  2137. if($.data(event.target, 'sortable-item') == self) currentItem = $(event.target);
  2138. if(!currentItem) return false;
  2139. if(this.options.handle && !overrideHandle) {
  2140. var validHandle = false;
  2141. $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; });
  2142. if(!validHandle) return false;
  2143. }
  2144. this.currentItem = currentItem;
  2145. this._removeCurrentsFromItems();
  2146. return true;
  2147. },
  2148. _mouseStart: function(event, overrideHandle, noActivation) {
  2149. var o = this.options, self = this;
  2150. this.currentContainer = this;
  2151. //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
  2152. this.refreshPositions();
  2153. //Create and append the visible helper
  2154. this.helper = this._createHelper(event);
  2155. //Cache the helper size
  2156. this._cacheHelperProportions();
  2157. /*
  2158. * - Position generation -
  2159. * This block generates everything position related - it's the core of draggables.
  2160. */
  2161. //Cache the margins of the original element
  2162. this._cacheMargins();
  2163. //Get the next scrolling parent
  2164. this.scrollParent = this.helper.scrollParent();
  2165. //The element's absolute position on the page minus margins
  2166. this.offset = this.currentItem.offset();
  2167. this.offset = {
  2168. top: this.offset.top - this.margins.top,
  2169. left: this.offset.left - this.margins.left
  2170. };
  2171. // Only after we got the offset, we can change the helper's position to absolute
  2172. // TODO: Still need to figure out a way to make relative sorting possible
  2173. this.helper.css("position", "absolute");
  2174. this.cssPosition = this.helper.css("position");
  2175. $.extend(this.offset, {
  2176. click: { //Where the click happened, relative to the element
  2177. left: event.pageX - this.offset.left,
  2178. top: event.pageY - this.offset.top
  2179. },
  2180. parent: this._getParentOffset(),
  2181. relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
  2182. });
  2183. //Generate the original position
  2184. this.originalPosition = this._generatePosition(event);
  2185. this.originalPageX = event.pageX;
  2186. this.originalPageY = event.pageY;
  2187. //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
  2188. if(o.cursorAt)
  2189. this._adjustOffsetFromHelper(o.cursorAt);
  2190. //Cache the former DOM position
  2191. this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
  2192. //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
  2193. if(this.helper[0] != this.currentItem[0]) {
  2194. this.currentItem.hide();
  2195. }
  2196. //Create the placeholder
  2197. this._createPlaceholder();
  2198. //Set a containment if given in the options
  2199. if(o.containment)
  2200. this._setContainment();
  2201. if(o.cursor) { // cursor option
  2202. if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor");
  2203. $('body').css("cursor", o.cursor);
  2204. }
  2205. if(o.opacity) { // opacity option
  2206. if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity");
  2207. this.helper.css("opacity", o.opacity);
  2208. }
  2209. if(o.zIndex) { // zIndex option
  2210. if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex");
  2211. this.helper.css("zIndex", o.zIndex);
  2212. }
  2213. //Prepare scrolling
  2214. if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML')
  2215. this.overflowOffset = this.scrollParent.offset();
  2216. //Call callbacks
  2217. this._trigger("start", event, this._uiHash());
  2218. //Recache the helper size
  2219. if(!this._preserveHelperProportions)
  2220. this._cacheHelperProportions();
  2221. //Post 'activate' events to possible containers
  2222. if(!noActivation) {
  2223. for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, self._uiHash(this)); }
  2224. }
  2225. //Prepare possible droppables
  2226. if($.ui.ddmanager)
  2227. $.ui.ddmanager.current = this;
  2228. if ($.ui.ddmanager && !o.dropBehaviour)
  2229. $.ui.ddmanager.prepareOffsets(this, event);
  2230. this.dragging = true;
  2231. this.helper.addClass("ui-sortable-helper");
  2232. this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
  2233. return true;
  2234. },
  2235. _mouseDrag: function(event) {
  2236. //Compute the helpers position
  2237. this.position = this._generatePosition(event);
  2238. this.positionAbs = this._convertPositionTo("absolute");
  2239. if (!this.lastPositionAbs) {
  2240. this.lastPositionAbs = this.positionAbs;
  2241. }
  2242. //Do scrolling
  2243. if(this.options.scroll) {
  2244. var o = this.options, scrolled = false;
  2245. if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
  2246. if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
  2247. this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
  2248. else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
  2249. this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
  2250. if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
  2251. this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
  2252. else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
  2253. this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
  2254. } else {
  2255. if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
  2256. scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
  2257. else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
  2258. scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
  2259. if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
  2260. scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
  2261. else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
  2262. scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
  2263. }
  2264. if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
  2265. $.ui.ddmanager.prepareOffsets(this, event);
  2266. }
  2267. //Regenerate the absolute position used for position checks
  2268. this.positionAbs = this._convertPositionTo("absolute");
  2269. //Set the helper position
  2270. if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
  2271. if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
  2272. //Rearrange
  2273. for (var i = this.items.length - 1; i >= 0; i--) {
  2274. //Cache variables and intersection, continue if no intersection
  2275. var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
  2276. if (!intersection) continue;
  2277. if(itemElement != this.currentItem[0] //cannot intersect with itself
  2278. && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
  2279. && !$.ui.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
  2280. && (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true)
  2281. ) {
  2282. this.direction = intersection == 1 ? "down" : "up";
  2283. if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
  2284. this._rearrange(event, item);
  2285. } else {
  2286. break;
  2287. }
  2288. this._trigger("change", event, this._uiHash());
  2289. break;
  2290. }
  2291. }
  2292. //Post events to containers
  2293. this._contactContainers(event);
  2294. //Interconnect with droppables
  2295. if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
  2296. //Call callbacks
  2297. this._trigger('sort', event, this._uiHash());
  2298. this.lastPositionAbs = this.positionAbs;
  2299. return false;
  2300. },
  2301. _mouseStop: function(event, noPropagation) {
  2302. if(!event) return;
  2303. //If we are using droppables, inform the manager about the drop
  2304. if ($.ui.ddmanager && !this.options.dropBehaviour)
  2305. $.ui.ddmanager.drop(this, event);
  2306. if(this.options.revert) {
  2307. var self = this;
  2308. var cur = self.placeholder.offset();
  2309. self.reverting = true;
  2310. $(this.helper).animate({
  2311. left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
  2312. top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
  2313. }, parseInt(this.options.revert, 10) || 500, function() {
  2314. self._clear(event);
  2315. });
  2316. } else {
  2317. this._clear(event, noPropagation);
  2318. }
  2319. return false;
  2320. },
  2321. cancel: function() {
  2322. var self = this;
  2323. if(this.dragging) {
  2324. this._mouseUp();
  2325. if(this.options.helper == "original")
  2326. this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
  2327. else
  2328. this.currentItem.show();
  2329. //Post deactivating events to containers
  2330. for (var i = this.containers.length - 1; i >= 0; i--){
  2331. this.containers[i]._trigger("deactivate", null, self._uiHash(this));
  2332. if(this.containers[i].containerCache.over) {
  2333. this.containers[i]._trigger("out", null, self._uiHash(this));
  2334. this.containers[i].containerCache.over = 0;
  2335. }
  2336. }
  2337. }
  2338. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
  2339. if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  2340. if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
  2341. $.extend(this, {
  2342. helper: null,
  2343. dragging: false,
  2344. reverting: false,
  2345. _noFinalSort: null
  2346. });
  2347. if(this.domPosition.prev) {
  2348. $(this.domPosition.prev).after(this.currentItem);
  2349. } else {
  2350. $(this.domPosition.parent).prepend(this.currentItem);
  2351. }
  2352. return true;
  2353. },
  2354. serialize: function(o) {
  2355. var items = this._getItemsAsjQuery(o && o.connected);
  2356. var str = []; o = o || {};
  2357. $(items).each(function() {
  2358. var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
  2359. if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));
  2360. });
  2361. return str.join('&');
  2362. },
  2363. toArray: function(o) {
  2364. var items = this._getItemsAsjQuery(o && o.connected);
  2365. var ret = []; o = o || {};
  2366. items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); });
  2367. return ret;
  2368. },
  2369. /* Be careful with the following core functions */
  2370. _intersectsWith: function(item) {
  2371. var x1 = this.positionAbs.left,
  2372. x2 = x1 + this.helperProportions.width,
  2373. y1 = this.positionAbs.top,
  2374. y2 = y1 + this.helperProportions.height;
  2375. var l = item.left,
  2376. r = l + item.width,
  2377. t = item.top,
  2378. b = t + item.height;
  2379. var dyClick = this.offset.click.top,
  2380. dxClick = this.offset.click.left;
  2381. var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;
  2382. if( this.options.tolerance == "pointer"
  2383. || this.options.forcePointerForContainers
  2384. || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])
  2385. ) {
  2386. return isOverElement;
  2387. } else {
  2388. return (l < x1 + (this.helperProportions.width / 2) // Right Half
  2389. && x2 - (this.helperProportions.width / 2) < r // Left Half
  2390. && t < y1 + (this.helperProportions.height / 2) // Bottom Half
  2391. && y2 - (this.helperProportions.height / 2) < b ); // Top Half
  2392. }
  2393. },
  2394. _intersectsWithPointer: function(item) {
  2395. var isOverElementHeight = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
  2396. isOverElementWidth = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
  2397. isOverElement = isOverElementHeight && isOverElementWidth,
  2398. verticalDirection = this._getDragVerticalDirection(),
  2399. horizontalDirection = this._getDragHorizontalDirection();
  2400. if (!isOverElement)
  2401. return false;
  2402. return this.floating ?
  2403. ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 )
  2404. : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) );
  2405. },
  2406. _intersectsWithSides: function(item) {
  2407. var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
  2408. isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
  2409. verticalDirection = this._getDragVerticalDirection(),
  2410. horizontalDirection = this._getDragHorizontalDirection();
  2411. if (this.floating && horizontalDirection) {
  2412. return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
  2413. } else {
  2414. return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
  2415. }
  2416. },
  2417. _getDragVerticalDirection: function() {
  2418. var delta = this.positionAbs.top - this.lastPositionAbs.top;
  2419. return delta != 0 && (delta > 0 ? "down" : "up");
  2420. },
  2421. _getDragHorizontalDirection: function() {
  2422. var delta = this.positionAbs.left - this.lastPositionAbs.left;
  2423. return delta != 0 && (delta > 0 ? "right" : "left");
  2424. },
  2425. refresh: function(event) {
  2426. this._refreshItems(event);
  2427. this.refreshPositions();
  2428. },
  2429. _connectWith: function() {
  2430. var options = this.options;
  2431. return options.connectWith.constructor == String
  2432. ? [options.connectWith]
  2433. : options.connectWith;
  2434. },
  2435. _getItemsAsjQuery: function(connected) {
  2436. var self = this;
  2437. var items = [];
  2438. var queries = [];
  2439. var connectWith = this._connectWith();
  2440. if(connectWith && connected) {
  2441. for (var i = connectWith.length - 1; i >= 0; i--){
  2442. var cur = $(connectWith[i]);
  2443. for (var j = cur.length - 1; j >= 0; j--){
  2444. var inst = $.data(cur[j], 'sortable');
  2445. if(inst && inst != this && !inst.options.disabled) {
  2446. queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper"), inst]);
  2447. }
  2448. };
  2449. };
  2450. }
  2451. 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"), this]);
  2452. for (var i = queries.length - 1; i >= 0; i--){
  2453. queries[i][0].each(function() {
  2454. items.push(this);
  2455. });
  2456. };
  2457. return $(items);
  2458. },
  2459. _removeCurrentsFromItems: function() {
  2460. var list = this.currentItem.find(":data(sortable-item)");
  2461. for (var i=0; i < this.items.length; i++) {
  2462. for (var j=0; j < list.length; j++) {
  2463. if(list[j] == this.items[i].item[0])
  2464. this.items.splice(i,1);
  2465. };
  2466. };
  2467. },
  2468. _refreshItems: function(event) {
  2469. this.items = [];
  2470. this.containers = [this];
  2471. var items = this.items;
  2472. var self = this;
  2473. var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
  2474. var connectWith = this._connectWith();
  2475. if(connectWith) {
  2476. for (var i = connectWith.length - 1; i >= 0; i--){
  2477. var cur = $(connectWith[i]);
  2478. for (var j = cur.length - 1; j >= 0; j--){
  2479. var inst = $.data(cur[j], 'sortable');
  2480. if(inst && inst != this && !inst.options.disabled) {
  2481. queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
  2482. this.containers.push(inst);
  2483. }
  2484. };
  2485. };
  2486. }
  2487. for (var i = queries.length - 1; i >= 0; i--) {
  2488. var targetData = queries[i][1];
  2489. var _queries = queries[i][0];
  2490. for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) {
  2491. var item = $(_queries[j]);
  2492. item.data('sortable-item', targetData); // Data for target checking (mouse manager)
  2493. items.push({
  2494. item: item,
  2495. instance: targetData,
  2496. width: 0, height: 0,
  2497. left: 0, top: 0
  2498. });
  2499. };
  2500. };
  2501. },
  2502. refreshPositions: function(fast) {
  2503. //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
  2504. if(this.offsetParent && this.helper) {
  2505. this.offset.parent = this._getParentOffset();
  2506. }
  2507. for (var i = this.items.length - 1; i >= 0; i--){
  2508. var item = this.items[i];
  2509. //We ignore calculating positions of all connected containers when we're not over them
  2510. if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0])
  2511. continue;
  2512. var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
  2513. if (!fast) {
  2514. item.width = t.outerWidth();
  2515. item.height = t.outerHeight();
  2516. }
  2517. var p = t.offset();
  2518. item.left = p.left;
  2519. item.top = p.top;
  2520. };
  2521. if(this.options.custom && this.options.custom.refreshContainers) {
  2522. this.options.custom.refreshContainers.call(this);
  2523. } else {
  2524. for (var i = this.containers.length - 1; i >= 0; i--){
  2525. var p = this.containers[i].element.offset();
  2526. this.containers[i].containerCache.left = p.left;
  2527. this.containers[i].containerCache.top = p.top;
  2528. this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
  2529. this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
  2530. };
  2531. }
  2532. },
  2533. _createPlaceholder: function(that) {
  2534. var self = that || this, o = self.options;
  2535. if(!o.placeholder || o.placeholder.constructor == String) {
  2536. var className = o.placeholder;
  2537. o.placeholder = {
  2538. element: function() {
  2539. var el = $(document.createElement(self.currentItem[0].nodeName))
  2540. .addClass(className || self.currentItem[0].className+" ui-sortable-placeholder")
  2541. .removeClass("ui-sortable-helper")[0];
  2542. if(!className)
  2543. el.style.visibility = "hidden";
  2544. return el;
  2545. },
  2546. update: function(container, p) {
  2547. // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
  2548. // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
  2549. if(className && !o.forcePlaceholderSize) return;
  2550. //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
  2551. if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); };
  2552. if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); };
  2553. }
  2554. };
  2555. }
  2556. //Create the placeholder
  2557. self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem));
  2558. //Append it after the actual current item
  2559. self.currentItem.after(self.placeholder);
  2560. //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
  2561. o.placeholder.update(self, self.placeholder);
  2562. },
  2563. _contactContainers: function(event) {
  2564. for (var i = this.containers.length - 1; i >= 0; i--){
  2565. if(this._intersectsWith(this.containers[i].containerCache)) {
  2566. if(!this.containers[i].containerCache.over) {
  2567. if(this.currentContainer != this.containers[i]) {
  2568. //When entering a new container, we will find the item with the least distance and append our item near it
  2569. var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[i].floating ? 'left' : 'top'];
  2570. for (var j = this.items.length - 1; j >= 0; j--) {
  2571. if(!$.ui.contains(this.containers[i].element[0], this.items[j].item[0])) continue;
  2572. var cur = this.items[j][this.containers[i].floating ? 'left' : 'top'];
  2573. if(Math.abs(cur - base) < dist) {
  2574. dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
  2575. }
  2576. }
  2577. if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
  2578. continue;
  2579. this.currentContainer = this.containers[i];
  2580. itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[i].element, true);
  2581. this._trigger("change", event, this._uiHash());
  2582. this.containers[i]._trigger("change", event, this._uiHash(this));
  2583. //Update the placeholder
  2584. this.options.placeholder.update(this.currentContainer, this.placeholder);
  2585. }
  2586. this.containers[i]._trigger("over", event, this._uiHash(this));
  2587. this.containers[i].containerCache.over = 1;
  2588. }
  2589. } else {
  2590. if(this.containers[i].containerCache.over) {
  2591. this.containers[i]._trigger("out", event, this._uiHash(this));
  2592. this.containers[i].containerCache.over = 0;
  2593. }
  2594. }
  2595. };
  2596. },
  2597. _createHelper: function(event) {
  2598. var o = this.options;
  2599. var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem);
  2600. if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already
  2601. $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
  2602. if(helper[0] == this.currentItem[0])
  2603. 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") };
  2604. if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width());
  2605. if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height());
  2606. return helper;
  2607. },
  2608. _adjustOffsetFromHelper: function(obj) {
  2609. if(obj.left != undefined) this.offset.click.left = obj.left + this.margins.left;
  2610. if(obj.right != undefined) this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  2611. if(obj.top != undefined) this.offset.click.top = obj.top + this.margins.top;
  2612. if(obj.bottom != undefined) this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  2613. },
  2614. _getParentOffset: function() {
  2615. //Get the offsetParent and cache its position
  2616. this.offsetParent = this.helper.offsetParent();
  2617. var po = this.offsetParent.offset();
  2618. // This is a special case where we need to modify a offset calculated on start, since the following happened:
  2619. // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
  2620. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
  2621. // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
  2622. if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
  2623. po.left += this.scrollParent.scrollLeft();
  2624. po.top += this.scrollParent.scrollTop();
  2625. }
  2626. if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
  2627. || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
  2628. po = { top: 0, left: 0 };
  2629. return {
  2630. top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
  2631. left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
  2632. };
  2633. },
  2634. _getRelativeOffset: function() {
  2635. if(this.cssPosition == "relative") {
  2636. var p = this.currentItem.position();
  2637. return {
  2638. top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
  2639. left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
  2640. };
  2641. } else {
  2642. return { top: 0, left: 0 };
  2643. }
  2644. },
  2645. _cacheMargins: function() {
  2646. this.margins = {
  2647. left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
  2648. top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
  2649. };
  2650. },
  2651. _cacheHelperProportions: function() {
  2652. this.helperProportions = {
  2653. width: this.helper.outerWidth(),
  2654. height: this.helper.outerHeight()
  2655. };
  2656. },
  2657. _setContainment: function() {
  2658. var o = this.options;
  2659. if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
  2660. if(o.containment == 'document' || o.containment == 'window') this.containment = [
  2661. 0 - this.offset.relative.left - this.offset.parent.left,
  2662. 0 - this.offset.relative.top - this.offset.parent.top,
  2663. $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
  2664. ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
  2665. ];
  2666. if(!(/^(document|window|parent)$/).test(o.containment)) {
  2667. var ce = $(o.containment)[0];
  2668. var co = $(o.containment).offset();
  2669. var over = ($(ce).css("overflow") != 'hidden');
  2670. this.containment = [
  2671. co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
  2672. co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
  2673. 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,
  2674. 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
  2675. ];
  2676. }
  2677. },
  2678. _convertPositionTo: function(d, pos) {
  2679. if(!pos) pos = this.position;
  2680. var mod = d == "absolute" ? 1 : -1;
  2681. 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);
  2682. return {
  2683. top: (
  2684. pos.top // The absolute mouse position
  2685. + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
  2686. + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
  2687. - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
  2688. ),
  2689. left: (
  2690. pos.left // The absolute mouse position
  2691. + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
  2692. + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
  2693. - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
  2694. )
  2695. };
  2696. },
  2697. _generatePosition: function(event) {
  2698. 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);
  2699. // This is another very weird special case that only happens for relative elements:
  2700. // 1. If the css position is relative
  2701. // 2. and the scroll parent is the document or similar to the offset parent
  2702. // we have to refresh the relative offset during the scroll so there are no jumps
  2703. if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {
  2704. this.offset.relative = this._getRelativeOffset();
  2705. }
  2706. var pageX = event.pageX;
  2707. var pageY = event.pageY;
  2708. /*
  2709. * - Position constraining -
  2710. * Constrain the position to a mix of grid, containment.
  2711. */
  2712. if(this.originalPosition) { //If we are not dragging yet, we won't check for options
  2713. if(this.containment) {
  2714. if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
  2715. if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
  2716. if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
  2717. if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
  2718. }
  2719. if(o.grid) {
  2720. var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
  2721. 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;
  2722. var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
  2723. 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;
  2724. }
  2725. }
  2726. return {
  2727. top: (
  2728. pageY // The absolute mouse position
  2729. - this.offset.click.top // Click offset (relative to the element)
  2730. - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
  2731. - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
  2732. + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
  2733. ),
  2734. left: (
  2735. pageX // The absolute mouse position
  2736. - this.offset.click.left // Click offset (relative to the element)
  2737. - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
  2738. - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
  2739. + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
  2740. )
  2741. };
  2742. },
  2743. _rearrange: function(event, i, a, hardRefresh) {
  2744. 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));
  2745. //Various things done here to improve the performance:
  2746. // 1. we create a setTimeout, that calls refreshPositions
  2747. // 2. on the instance, we have a counter variable, that get's higher after every append
  2748. // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
  2749. // 4. this lets only the last addition to the timeout stack through
  2750. this.counter = this.counter ? ++this.counter : 1;
  2751. var self = this, counter = this.counter;
  2752. window.setTimeout(function() {
  2753. if(counter == self.counter) self.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
  2754. },0);
  2755. },
  2756. _clear: function(event, noPropagation) {
  2757. this.reverting = false;
  2758. // We delay all events that have to be triggered to after the point where the placeholder has been removed and
  2759. // everything else normalized again
  2760. var delayedTriggers = [], self = this;
  2761. // We first have to update the dom position of the actual currentItem
  2762. // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
  2763. if(!this._noFinalSort && this.currentItem[0].parentNode) this.placeholder.before(this.currentItem);
  2764. this._noFinalSort = null;
  2765. if(this.helper[0] == this.currentItem[0]) {
  2766. for(var i in this._storedCSS) {
  2767. if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = '';
  2768. }
  2769. this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
  2770. } else {
  2771. this.currentItem.show();
  2772. }
  2773. if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
  2774. 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
  2775. if(!$.ui.contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element
  2776. if(!noPropagation) delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
  2777. for (var i = this.containers.length - 1; i >= 0; i--){
  2778. if($.ui.contains(this.containers[i].element[0], this.currentItem[0]) && !noPropagation) {
  2779. delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
  2780. delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
  2781. }
  2782. };
  2783. };
  2784. //Post events to containers
  2785. for (var i = this.containers.length - 1; i >= 0; i--){
  2786. if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
  2787. if(this.containers[i].containerCache.over) {
  2788. delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
  2789. this.containers[i].containerCache.over = 0;
  2790. }
  2791. }
  2792. //Do what was originally in plugins
  2793. if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor
  2794. if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset cursor
  2795. if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index
  2796. this.dragging = false;
  2797. if(this.cancelHelperRemoval) {
  2798. if(!noPropagation) {
  2799. this._trigger("beforeStop", event, this._uiHash());
  2800. for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
  2801. this._trigger("stop", event, this._uiHash());
  2802. }
  2803. return false;
  2804. }
  2805. if(!noPropagation) this._trigger("beforeStop", event, this._uiHash());
  2806. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
  2807. this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  2808. if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null;
  2809. if(!noPropagation) {
  2810. for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
  2811. this._trigger("stop", event, this._uiHash());
  2812. }
  2813. this.fromOutside = false;
  2814. return true;
  2815. },
  2816. _trigger: function() {
  2817. if ($.widget.prototype._trigger.apply(this, arguments) === false) {
  2818. this.cancel();
  2819. }
  2820. },
  2821. _uiHash: function(inst) {
  2822. var self = inst || this;
  2823. return {
  2824. helper: self.helper,
  2825. placeholder: self.placeholder || $([]),
  2826. position: self.position,
  2827. absolutePosition: self.positionAbs, //deprecated
  2828. offset: self.positionAbs,
  2829. item: self.currentItem,
  2830. sender: inst ? inst.element : null
  2831. };
  2832. }
  2833. }));
  2834. $.extend($.ui.sortable, {
  2835. getter: "serialize toArray",
  2836. version: "1.7.2",
  2837. eventPrefix: "sort",
  2838. defaults: {
  2839. appendTo: "parent",
  2840. axis: false,
  2841. cancel: ":input,option",
  2842. connectWith: false,
  2843. containment: false,
  2844. cursor: 'auto',
  2845. cursorAt: false,
  2846. delay: 0,
  2847. distance: 1,
  2848. dropOnEmpty: true,
  2849. forcePlaceholderSize: false,
  2850. forceHelperSize: false,
  2851. grid: false,
  2852. handle: false,
  2853. helper: "original",
  2854. items: '> *',
  2855. opacity: false,
  2856. placeholder: false,
  2857. revert: false,
  2858. scroll: true,
  2859. scrollSensitivity: 20,
  2860. scrollSpeed: 20,
  2861. scope: "default",
  2862. tolerance: "intersect",
  2863. zIndex: 1000
  2864. }
  2865. });
  2866. })(jQuery);
  2867. /*
  2868. * jQuery UI Effects 1.7.2
  2869. *
  2870. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  2871. * Dual licensed under the MIT (MIT-LICENSE.txt)
  2872. * and GPL (GPL-LICENSE.txt) licenses.
  2873. *
  2874. * http://docs.jquery.com/UI/Effects/
  2875. */
  2876. ;jQuery.effects || (function($) {
  2877. $.effects = {
  2878. version: "1.7.2",
  2879. // Saves a set of properties in a data storage
  2880. save: function(element, set) {
  2881. for(var i=0; i < set.length; i++) {
  2882. if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);
  2883. }
  2884. },
  2885. // Restores a set of previously saved properties from a data storage
  2886. restore: function(element, set) {
  2887. for(var i=0; i < set.length; i++) {
  2888. if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));
  2889. }
  2890. },
  2891. setMode: function(el, mode) {
  2892. if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
  2893. return mode;
  2894. },
  2895. getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
  2896. // this should be a little more flexible in the future to handle a string & hash
  2897. var y, x;
  2898. switch (origin[0]) {
  2899. case 'top': y = 0; break;
  2900. case 'middle': y = 0.5; break;
  2901. case 'bottom': y = 1; break;
  2902. default: y = origin[0] / original.height;
  2903. };
  2904. switch (origin[1]) {
  2905. case 'left': x = 0; break;
  2906. case 'center': x = 0.5; break;
  2907. case 'right': x = 1; break;
  2908. default: x = origin[1] / original.width;
  2909. };
  2910. return {x: x, y: y};
  2911. },
  2912. // Wraps the element around a wrapper that copies position properties
  2913. createWrapper: function(element) {
  2914. //if the element is already wrapped, return it
  2915. if (element.parent().is('.ui-effects-wrapper'))
  2916. return element.parent();
  2917. //Cache width,height and float properties of the element, and create a wrapper around it
  2918. var props = { width: element.outerWidth(true), height: element.outerHeight(true), 'float': element.css('float') };
  2919. element.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');
  2920. var wrapper = element.parent();
  2921. //Transfer the positioning of the element to the wrapper
  2922. if (element.css('position') == 'static') {
  2923. wrapper.css({ position: 'relative' });
  2924. element.css({ position: 'relative'} );
  2925. } else {
  2926. var top = element.css('top'); if(isNaN(parseInt(top,10))) top = 'auto';
  2927. var left = element.css('left'); if(isNaN(parseInt(left,10))) left = 'auto';
  2928. wrapper.css({ position: element.css('position'), top: top, left: left, zIndex: element.css('z-index') }).show();
  2929. element.css({position: 'relative', top: 0, left: 0 });
  2930. }
  2931. wrapper.css(props);
  2932. return wrapper;
  2933. },
  2934. removeWrapper: function(element) {
  2935. if (element.parent().is('.ui-effects-wrapper'))
  2936. return element.parent().replaceWith(element);
  2937. return element;
  2938. },
  2939. setTransition: function(element, list, factor, value) {
  2940. value = value || {};
  2941. $.each(list, function(i, x){
  2942. unit = element.cssUnit(x);
  2943. if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
  2944. });
  2945. return value;
  2946. },
  2947. //Base function to animate from one class to another in a seamless transition
  2948. animateClass: function(value, duration, easing, callback) {
  2949. var cb = (typeof easing == "function" ? easing : (callback ? callback : null));
  2950. var ea = (typeof easing == "string" ? easing : null);
  2951. return this.each(function() {
  2952. var offset = {}; var that = $(this); var oldStyleAttr = that.attr("style") || '';
  2953. if(typeof oldStyleAttr == 'object') oldStyleAttr = oldStyleAttr["cssText"]; /* Stupidly in IE, style is a object.. */
  2954. if(value.toggle) { that.hasClass(value.toggle) ? value.remove = value.toggle : value.add = value.toggle; }
  2955. //Let's get a style offset
  2956. var oldStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
  2957. if(value.add) that.addClass(value.add); if(value.remove) that.removeClass(value.remove);
  2958. var newStyle = $.extend({}, (document.defaultView ? document.defaultView.getComputedStyle(this,null) : this.currentStyle));
  2959. if(value.add) that.removeClass(value.add); if(value.remove) that.addClass(value.remove);
  2960. // The main function to form the object for animation
  2961. for(var n in newStyle) {
  2962. if( typeof newStyle[n] != "function" && newStyle[n] /* No functions and null properties */
  2963. && n.indexOf("Moz") == -1 && n.indexOf("length") == -1 /* No mozilla spezific render properties. */
  2964. && newStyle[n] != oldStyle[n] /* Only values that have changed are used for the animation */
  2965. && (n.match(/color/i) || (!n.match(/color/i) && !isNaN(parseInt(newStyle[n],10)))) /* Only things that can be parsed to integers or colors */
  2966. && (oldStyle.position != "static" || (oldStyle.position == "static" && !n.match(/left|top|bottom|right/))) /* No need for positions when dealing with static positions */
  2967. ) offset[n] = newStyle[n];
  2968. }
  2969. that.animate(offset, duration, ea, function() { // Animate the newly constructed offset object
  2970. // Change style attribute back to original. For stupid IE, we need to clear the damn object.
  2971. if(typeof $(this).attr("style") == 'object') { $(this).attr("style")["cssText"] = ""; $(this).attr("style")["cssText"] = oldStyleAttr; } else $(this).attr("style", oldStyleAttr);
  2972. if(value.add) $(this).addClass(value.add); if(value.remove) $(this).removeClass(value.remove);
  2973. if(cb) cb.apply(this, arguments);
  2974. });
  2975. });
  2976. }
  2977. };
  2978. function _normalizeArguments(a, m) {
  2979. var o = a[1] && a[1].constructor == Object ? a[1] : {}; if(m) o.mode = m;
  2980. var speed = a[1] && a[1].constructor != Object ? a[1] : (o.duration ? o.duration : a[2]); //either comes from options.duration or the secon/third argument
  2981. speed = $.fx.off ? 0 : typeof speed === "number" ? speed : $.fx.speeds[speed] || $.fx.speeds._default;
  2982. var callback = o.callback || ( $.isFunction(a[1]) && a[1] ) || ( $.isFunction(a[2]) && a[2] ) || ( $.isFunction(a[3]) && a[3] );
  2983. return [a[0], o, speed, callback];
  2984. }
  2985. //Extend the methods of jQuery
  2986. $.fn.extend({
  2987. //Save old methods
  2988. _show: $.fn.show,
  2989. _hide: $.fn.hide,
  2990. __toggle: $.fn.toggle,
  2991. _addClass: $.fn.addClass,
  2992. _removeClass: $.fn.removeClass,
  2993. _toggleClass: $.fn.toggleClass,
  2994. // New effect methods
  2995. effect: function(fx, options, speed, callback) {
  2996. return $.effects[fx] ? $.effects[fx].call(this, {method: fx, options: options || {}, duration: speed, callback: callback }) : null;
  2997. },
  2998. show: function() {
  2999. if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])))
  3000. return this._show.apply(this, arguments);
  3001. else {
  3002. return this.effect.apply(this, _normalizeArguments(arguments, 'show'));
  3003. }
  3004. },
  3005. hide: function() {
  3006. if(!arguments[0] || (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])))
  3007. return this._hide.apply(this, arguments);
  3008. else {
  3009. return this.effect.apply(this, _normalizeArguments(arguments, 'hide'));
  3010. }
  3011. },
  3012. toggle: function(){
  3013. if(!arguments[0] ||
  3014. (arguments[0].constructor == Number || (/(slow|normal|fast)/).test(arguments[0])) ||
  3015. ($.isFunction(arguments[0]) || typeof arguments[0] == 'boolean')) {
  3016. return this.__toggle.apply(this, arguments);
  3017. } else {
  3018. return this.effect.apply(this, _normalizeArguments(arguments, 'toggle'));
  3019. }
  3020. },
  3021. addClass: function(classNames, speed, easing, callback) {
  3022. return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
  3023. },
  3024. removeClass: function(classNames,speed,easing,callback) {
  3025. return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
  3026. },
  3027. toggleClass: function(classNames,speed,easing,callback) {
  3028. return ( (typeof speed !== "boolean") && speed ) ? $.effects.animateClass.apply(this, [{ toggle: classNames },speed,easing,callback]) : this._toggleClass(classNames, speed);
  3029. },
  3030. morph: function(remove,add,speed,easing,callback) {
  3031. return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
  3032. },
  3033. switchClass: function() {
  3034. return this.morph.apply(this, arguments);
  3035. },
  3036. // helper functions
  3037. cssUnit: function(key) {
  3038. var style = this.css(key), val = [];
  3039. $.each( ['em','px','%','pt'], function(i, unit){
  3040. if(style.indexOf(unit) > 0)
  3041. val = [parseFloat(style), unit];
  3042. });
  3043. return val;
  3044. }
  3045. });
  3046. /*
  3047. * jQuery Color Animations
  3048. * Copyright 2007 John Resig
  3049. * Released under the MIT and GPL licenses.
  3050. */
  3051. // We override the animation for all of these color styles
  3052. $.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
  3053. $.fx.step[attr] = function(fx) {
  3054. if ( fx.state == 0 ) {
  3055. fx.start = getColor( fx.elem, attr );
  3056. fx.end = getRGB( fx.end );
  3057. }
  3058. fx.elem.style[attr] = "rgb(" + [
  3059. Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0],10), 255), 0),
  3060. Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1],10), 255), 0),
  3061. Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2],10), 255), 0)
  3062. ].join(",") + ")";
  3063. };
  3064. });
  3065. // Color Conversion functions from highlightFade
  3066. // By Blair Mitchelmore
  3067. // http://jquery.offput.ca/highlightFade/
  3068. // Parse strings looking for color tuples [255,255,255]
  3069. function getRGB(color) {
  3070. var result;
  3071. // Check if we're already dealing with an array of colors
  3072. if ( color && color.constructor == Array && color.length == 3 )
  3073. return color;
  3074. // Look for rgb(num,num,num)
  3075. if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
  3076. return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
  3077. // Look for rgb(num%,num%,num%)
  3078. if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
  3079. return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
  3080. // Look for #a0b1c2
  3081. if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
  3082. return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
  3083. // Look for #fff
  3084. if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
  3085. return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
  3086. // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
  3087. if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
  3088. return colors['transparent'];
  3089. // Otherwise, we're most likely dealing with a named color
  3090. return colors[$.trim(color).toLowerCase()];
  3091. }
  3092. function getColor(elem, attr) {
  3093. var color;
  3094. do {
  3095. color = $.curCSS(elem, attr);
  3096. // Keep going until we find an element that has color, or we hit the body
  3097. if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )
  3098. break;
  3099. attr = "backgroundColor";
  3100. } while ( elem = elem.parentNode );
  3101. return getRGB(color);
  3102. };
  3103. // Some named colors to work with
  3104. // From Interface by Stefan Petre
  3105. // http://interface.eyecon.ro/
  3106. var colors = {
  3107. aqua:[0,255,255],
  3108. azure:[240,255,255],
  3109. beige:[245,245,220],
  3110. black:[0,0,0],
  3111. blue:[0,0,255],
  3112. brown:[165,42,42],
  3113. cyan:[0,255,255],
  3114. darkblue:[0,0,139],
  3115. darkcyan:[0,139,139],
  3116. darkgrey:[169,169,169],
  3117. darkgreen:[0,100,0],
  3118. darkkhaki:[189,183,107],
  3119. darkmagenta:[139,0,139],
  3120. darkolivegreen:[85,107,47],
  3121. darkorange:[255,140,0],
  3122. darkorchid:[153,50,204],
  3123. darkred:[139,0,0],
  3124. darksalmon:[233,150,122],
  3125. darkviolet:[148,0,211],
  3126. fuchsia:[255,0,255],
  3127. gold:[255,215,0],
  3128. green:[0,128,0],
  3129. indigo:[75,0,130],
  3130. khaki:[240,230,140],
  3131. lightblue:[173,216,230],
  3132. lightcyan:[224,255,255],
  3133. lightgreen:[144,238,144],
  3134. lightgrey:[211,211,211],
  3135. lightpink:[255,182,193],
  3136. lightyellow:[255,255,224],
  3137. lime:[0,255,0],
  3138. magenta:[255,0,255],
  3139. maroon:[128,0,0],
  3140. navy:[0,0,128],
  3141. olive:[128,128,0],
  3142. orange:[255,165,0],
  3143. pink:[255,192,203],
  3144. purple:[128,0,128],
  3145. violet:[128,0,128],
  3146. red:[255,0,0],
  3147. silver:[192,192,192],
  3148. white:[255,255,255],
  3149. yellow:[255,255,0],
  3150. transparent: [255,255,255]
  3151. };
  3152. /*
  3153. * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
  3154. *
  3155. * Uses the built in easing capabilities added In jQuery 1.1
  3156. * to offer multiple easing options
  3157. *
  3158. * TERMS OF USE - jQuery Easing
  3159. *
  3160. * Open source under the BSD License.
  3161. *
  3162. * Copyright 2008 George McGinley Smith
  3163. * All rights reserved.
  3164. *
  3165. * Redistribution and use in source and binary forms, with or without modification,
  3166. * are permitted provided that the following conditions are met:
  3167. *
  3168. * Redistributions of source code must retain the above copyright notice, this list of
  3169. * conditions and the following disclaimer.
  3170. * Redistributions in binary form must reproduce the above copyright notice, this list
  3171. * of conditions and the following disclaimer in the documentation and/or other materials
  3172. * provided with the distribution.
  3173. *
  3174. * Neither the name of the author nor the names of contributors may be used to endorse
  3175. * or promote products derived from this software without specific prior written permission.
  3176. *
  3177. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
  3178. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  3179. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  3180. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  3181. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  3182. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  3183. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  3184. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  3185. * OF THE POSSIBILITY OF SUCH DAMAGE.
  3186. *
  3187. */
  3188. // t: current time, b: begInnIng value, c: change In value, d: duration
  3189. $.easing.jswing = $.easing.swing;
  3190. $.extend($.easing,
  3191. {
  3192. def: 'easeOutQuad',
  3193. swing: function (x, t, b, c, d) {
  3194. //alert($.easing.default);
  3195. return $.easing[$.easing.def](x, t, b, c, d);
  3196. },
  3197. easeInQuad: function (x, t, b, c, d) {
  3198. return c*(t/=d)*t + b;
  3199. },
  3200. easeOutQuad: function (x, t, b, c, d) {
  3201. return -c *(t/=d)*(t-2) + b;
  3202. },
  3203. easeInOutQuad: function (x, t, b, c, d) {
  3204. if ((t/=d/2) < 1) return c/2*t*t + b;
  3205. return -c/2 * ((--t)*(t-2) - 1) + b;
  3206. },
  3207. easeInCubic: function (x, t, b, c, d) {
  3208. return c*(t/=d)*t*t + b;
  3209. },
  3210. easeOutCubic: function (x, t, b, c, d) {
  3211. return c*((t=t/d-1)*t*t + 1) + b;
  3212. },
  3213. easeInOutCubic: function (x, t, b, c, d) {
  3214. if ((t/=d/2) < 1) return c/2*t*t*t + b;
  3215. return c/2*((t-=2)*t*t + 2) + b;
  3216. },
  3217. easeInQuart: function (x, t, b, c, d) {
  3218. return c*(t/=d)*t*t*t + b;
  3219. },
  3220. easeOutQuart: function (x, t, b, c, d) {
  3221. return -c * ((t=t/d-1)*t*t*t - 1) + b;
  3222. },
  3223. easeInOutQuart: function (x, t, b, c, d) {
  3224. if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
  3225. return -c/2 * ((t-=2)*t*t*t - 2) + b;
  3226. },
  3227. easeInQuint: function (x, t, b, c, d) {
  3228. return c*(t/=d)*t*t*t*t + b;
  3229. },
  3230. easeOutQuint: function (x, t, b, c, d) {
  3231. return c*((t=t/d-1)*t*t*t*t + 1) + b;
  3232. },
  3233. easeInOutQuint: function (x, t, b, c, d) {
  3234. if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
  3235. return c/2*((t-=2)*t*t*t*t + 2) + b;
  3236. },
  3237. easeInSine: function (x, t, b, c, d) {
  3238. return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
  3239. },
  3240. easeOutSine: function (x, t, b, c, d) {
  3241. return c * Math.sin(t/d * (Math.PI/2)) + b;
  3242. },
  3243. easeInOutSine: function (x, t, b, c, d) {
  3244. return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
  3245. },
  3246. easeInExpo: function (x, t, b, c, d) {
  3247. return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
  3248. },
  3249. easeOutExpo: function (x, t, b, c, d) {
  3250. return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
  3251. },
  3252. easeInOutExpo: function (x, t, b, c, d) {
  3253. if (t==0) return b;
  3254. if (t==d) return b+c;
  3255. if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
  3256. return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
  3257. },
  3258. easeInCirc: function (x, t, b, c, d) {
  3259. return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
  3260. },
  3261. easeOutCirc: function (x, t, b, c, d) {
  3262. return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
  3263. },
  3264. easeInOutCirc: function (x, t, b, c, d) {
  3265. if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
  3266. return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
  3267. },
  3268. easeInElastic: function (x, t, b, c, d) {
  3269. var s=1.70158;var p=0;var a=c;
  3270. if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
  3271. if (a < Math.abs(c)) { a=c; var s=p/4; }
  3272. else var s = p/(2*Math.PI) * Math.asin (c/a);
  3273. return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  3274. },
  3275. easeOutElastic: function (x, t, b, c, d) {
  3276. var s=1.70158;var p=0;var a=c;
  3277. if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
  3278. if (a < Math.abs(c)) { a=c; var s=p/4; }
  3279. else var s = p/(2*Math.PI) * Math.asin (c/a);
  3280. return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
  3281. },
  3282. easeInOutElastic: function (x, t, b, c, d) {
  3283. var s=1.70158;var p=0;var a=c;
  3284. if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
  3285. if (a < Math.abs(c)) { a=c; var s=p/4; }
  3286. else var s = p/(2*Math.PI) * Math.asin (c/a);
  3287. if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  3288. return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
  3289. },
  3290. easeInBack: function (x, t, b, c, d, s) {
  3291. if (s == undefined) s = 1.70158;
  3292. return c*(t/=d)*t*((s+1)*t - s) + b;
  3293. },
  3294. easeOutBack: function (x, t, b, c, d, s) {
  3295. if (s == undefined) s = 1.70158;
  3296. return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
  3297. },
  3298. easeInOutBack: function (x, t, b, c, d, s) {
  3299. if (s == undefined) s = 1.70158;
  3300. if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
  3301. return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
  3302. },
  3303. easeInBounce: function (x, t, b, c, d) {
  3304. return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;
  3305. },
  3306. easeOutBounce: function (x, t, b, c, d) {
  3307. if ((t/=d) < (1/2.75)) {
  3308. return c*(7.5625*t*t) + b;
  3309. } else if (t < (2/2.75)) {
  3310. return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
  3311. } else if (t < (2.5/2.75)) {
  3312. return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
  3313. } else {
  3314. return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
  3315. }
  3316. },
  3317. easeInOutBounce: function (x, t, b, c, d) {
  3318. if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
  3319. return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
  3320. }
  3321. });
  3322. /*
  3323. *
  3324. * TERMS OF USE - EASING EQUATIONS
  3325. *
  3326. * Open source under the BSD License.
  3327. *
  3328. * Copyright 2001 Robert Penner
  3329. * All rights reserved.
  3330. *
  3331. * Redistribution and use in source and binary forms, with or without modification,
  3332. * are permitted provided that the following conditions are met:
  3333. *
  3334. * Redistributions of source code must retain the above copyright notice, this list of
  3335. * conditions and the following disclaimer.
  3336. * Redistributions in binary form must reproduce the above copyright notice, this list
  3337. * of conditions and the following disclaimer in the documentation and/or other materials
  3338. * provided with the distribution.
  3339. *
  3340. * Neither the name of the author nor the names of contributors may be used to endorse
  3341. * or promote products derived from this software without specific prior written permission.
  3342. *
  3343. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
  3344. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  3345. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  3346. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  3347. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  3348. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  3349. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  3350. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  3351. * OF THE POSSIBILITY OF SUCH DAMAGE.
  3352. *
  3353. */
  3354. })(jQuery);
  3355. /*
  3356. * jQuery UI Effects Blind 1.7.2
  3357. *
  3358. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  3359. * Dual licensed under the MIT (MIT-LICENSE.txt)
  3360. * and GPL (GPL-LICENSE.txt) licenses.
  3361. *
  3362. * http://docs.jquery.com/UI/Effects/Blind
  3363. *
  3364. * Depends:
  3365. * effects.core.js
  3366. */
  3367. (function($) {
  3368. $.effects.blind = function(o) {
  3369. return this.queue(function() {
  3370. // Create element
  3371. var el = $(this), props = ['position','top','left'];
  3372. // Set options
  3373. var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
  3374. var direction = o.options.direction || 'vertical'; // Default direction
  3375. // Adjust
  3376. $.effects.save(el, props); el.show(); // Save & Show
  3377. var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
  3378. var ref = (direction == 'vertical') ? 'height' : 'width';
  3379. var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width();
  3380. if(mode == 'show') wrapper.css(ref, 0); // Shift
  3381. // Animation
  3382. var animation = {};
  3383. animation[ref] = mode == 'show' ? distance : 0;
  3384. // Animate
  3385. wrapper.animate(animation, o.duration, o.options.easing, function() {
  3386. if(mode == 'hide') el.hide(); // Hide
  3387. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  3388. if(o.callback) o.callback.apply(el[0], arguments); // Callback
  3389. el.dequeue();
  3390. });
  3391. });
  3392. };
  3393. })(jQuery);
  3394. /*
  3395. * jQuery UI Effects Bounce 1.7.2
  3396. *
  3397. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  3398. * Dual licensed under the MIT (MIT-LICENSE.txt)
  3399. * and GPL (GPL-LICENSE.txt) licenses.
  3400. *
  3401. * http://docs.jquery.com/UI/Effects/Bounce
  3402. *
  3403. * Depends:
  3404. * effects.core.js
  3405. */
  3406. (function($) {
  3407. $.effects.bounce = function(o) {
  3408. return this.queue(function() {
  3409. // Create element
  3410. var el = $(this), props = ['position','top','left'];
  3411. // Set options
  3412. var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
  3413. var direction = o.options.direction || 'up'; // Default direction
  3414. var distance = o.options.distance || 20; // Default distance
  3415. var times = o.options.times || 5; // Default # of times
  3416. var speed = o.duration || 250; // Default speed per bounce
  3417. if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE
  3418. // Adjust
  3419. $.effects.save(el, props); el.show(); // Save & Show
  3420. $.effects.createWrapper(el); // Create Wrapper
  3421. var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
  3422. var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
  3423. var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 3 : el.outerWidth({margin:true}) / 3);
  3424. if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
  3425. if (mode == 'hide') distance = distance / (times * 2);
  3426. if (mode != 'hide') times--;
  3427. // Animate
  3428. if (mode == 'show') { // Show Bounce
  3429. var animation = {opacity: 1};
  3430. animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
  3431. el.animate(animation, speed / 2, o.options.easing);
  3432. distance = distance / 2;
  3433. times--;
  3434. };
  3435. for (var i = 0; i < times; i++) { // Bounces
  3436. var animation1 = {}, animation2 = {};
  3437. animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
  3438. animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
  3439. el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing);
  3440. distance = (mode == 'hide') ? distance * 2 : distance / 2;
  3441. };
  3442. if (mode == 'hide') { // Last Bounce
  3443. var animation = {opacity: 0};
  3444. animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
  3445. el.animate(animation, speed / 2, o.options.easing, function(){
  3446. el.hide(); // Hide
  3447. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  3448. if(o.callback) o.callback.apply(this, arguments); // Callback
  3449. });
  3450. } else {
  3451. var animation1 = {}, animation2 = {};
  3452. animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
  3453. animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
  3454. el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){
  3455. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  3456. if(o.callback) o.callback.apply(this, arguments); // Callback
  3457. });
  3458. };
  3459. el.queue('fx', function() { el.dequeue(); });
  3460. el.dequeue();
  3461. });
  3462. };
  3463. })(jQuery);
  3464. /*
  3465. * jQuery UI Effects Clip 1.7.2
  3466. *
  3467. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  3468. * Dual licensed under the MIT (MIT-LICENSE.txt)
  3469. * and GPL (GPL-LICENSE.txt) licenses.
  3470. *
  3471. * http://docs.jquery.com/UI/Effects/Clip
  3472. *
  3473. * Depends:
  3474. * effects.core.js
  3475. */
  3476. (function($) {
  3477. $.effects.clip = function(o) {
  3478. return this.queue(function() {
  3479. // Create element
  3480. var el = $(this), props = ['position','top','left','height','width'];
  3481. // Set options
  3482. var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
  3483. var direction = o.options.direction || 'vertical'; // Default direction
  3484. // Adjust
  3485. $.effects.save(el, props); el.show(); // Save & Show
  3486. var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
  3487. var animate = el[0].tagName == 'IMG' ? wrapper : el;
  3488. var ref = {
  3489. size: (direction == 'vertical') ? 'height' : 'width',
  3490. position: (direction == 'vertical') ? 'top' : 'left'
  3491. };
  3492. var distance = (direction == 'vertical') ? animate.height() : animate.width();
  3493. if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift
  3494. // Animation
  3495. var animation = {};
  3496. animation[ref.size] = mode == 'show' ? distance : 0;
  3497. animation[ref.position] = mode == 'show' ? 0 : distance / 2;
  3498. // Animate
  3499. animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
  3500. if(mode == 'hide') el.hide(); // Hide
  3501. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  3502. if(o.callback) o.callback.apply(el[0], arguments); // Callback
  3503. el.dequeue();
  3504. }});
  3505. });
  3506. };
  3507. })(jQuery);
  3508. /*
  3509. * jQuery UI Effects Drop 1.7.2
  3510. *
  3511. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  3512. * Dual licensed under the MIT (MIT-LICENSE.txt)
  3513. * and GPL (GPL-LICENSE.txt) licenses.
  3514. *
  3515. * http://docs.jquery.com/UI/Effects/Drop
  3516. *
  3517. * Depends:
  3518. * effects.core.js
  3519. */
  3520. (function($) {
  3521. $.effects.drop = function(o) {
  3522. return this.queue(function() {
  3523. // Create element
  3524. var el = $(this), props = ['position','top','left','opacity'];
  3525. // Set options
  3526. var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
  3527. var direction = o.options.direction || 'left'; // Default Direction
  3528. // Adjust
  3529. $.effects.save(el, props); el.show(); // Save & Show
  3530. $.effects.createWrapper(el); // Create Wrapper
  3531. var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
  3532. var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
  3533. var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2);
  3534. if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
  3535. // Animation
  3536. var animation = {opacity: mode == 'show' ? 1 : 0};
  3537. animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
  3538. // Animate
  3539. el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
  3540. if(mode == 'hide') el.hide(); // Hide
  3541. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  3542. if(o.callback) o.callback.apply(this, arguments); // Callback
  3543. el.dequeue();
  3544. }});
  3545. });
  3546. };
  3547. })(jQuery);
  3548. /*
  3549. * jQuery UI Effects Explode 1.7.2
  3550. *
  3551. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  3552. * Dual licensed under the MIT (MIT-LICENSE.txt)
  3553. * and GPL (GPL-LICENSE.txt) licenses.
  3554. *
  3555. * http://docs.jquery.com/UI/Effects/Explode
  3556. *
  3557. * Depends:
  3558. * effects.core.js
  3559. */
  3560. (function($) {
  3561. $.effects.explode = function(o) {
  3562. return this.queue(function() {
  3563. var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
  3564. var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
  3565. o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode;
  3566. var el = $(this).show().css('visibility', 'hidden');
  3567. var offset = el.offset();
  3568. //Substract the margins - not fixing the problem yet.
  3569. offset.top -= parseInt(el.css("marginTop"),10) || 0;
  3570. offset.left -= parseInt(el.css("marginLeft"),10) || 0;
  3571. var width = el.outerWidth(true);
  3572. var height = el.outerHeight(true);
  3573. for(var i=0;i<rows;i++) { // =
  3574. for(var j=0;j<cells;j++) { // ||
  3575. el
  3576. .clone()
  3577. .appendTo('body')
  3578. .wrap('<div></div>')
  3579. .css({
  3580. position: 'absolute',
  3581. visibility: 'visible',
  3582. left: -j*(width/cells),
  3583. top: -i*(height/rows)
  3584. })
  3585. .parent()
  3586. .addClass('ui-effects-explode')
  3587. .css({
  3588. position: 'absolute',
  3589. overflow: 'hidden',
  3590. width: width/cells,
  3591. height: height/rows,
  3592. left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0),
  3593. top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0),
  3594. opacity: o.options.mode == 'show' ? 0 : 1
  3595. }).animate({
  3596. left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)),
  3597. top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)),
  3598. opacity: o.options.mode == 'show' ? 1 : 0
  3599. }, o.duration || 500);
  3600. }
  3601. }
  3602. // Set a timeout, to call the callback approx. when the other animations have finished
  3603. setTimeout(function() {
  3604. o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide();
  3605. if(o.callback) o.callback.apply(el[0]); // Callback
  3606. el.dequeue();
  3607. $('div.ui-effects-explode').remove();
  3608. }, o.duration || 500);
  3609. });
  3610. };
  3611. })(jQuery);
  3612. /*
  3613. * jQuery UI Effects Fold 1.7.2
  3614. *
  3615. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  3616. * Dual licensed under the MIT (MIT-LICENSE.txt)
  3617. * and GPL (GPL-LICENSE.txt) licenses.
  3618. *
  3619. * http://docs.jquery.com/UI/Effects/Fold
  3620. *
  3621. * Depends:
  3622. * effects.core.js
  3623. */
  3624. (function($) {
  3625. $.effects.fold = function(o) {
  3626. return this.queue(function() {
  3627. // Create element
  3628. var el = $(this), props = ['position','top','left'];
  3629. // Set options
  3630. var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
  3631. var size = o.options.size || 15; // Default fold size
  3632. var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value
  3633. var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;
  3634. // Adjust
  3635. $.effects.save(el, props); el.show(); // Save & Show
  3636. var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
  3637. var widthFirst = ((mode == 'show') != horizFirst);
  3638. var ref = widthFirst ? ['width', 'height'] : ['height', 'width'];
  3639. var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()];
  3640. var percent = /([0-9]+)%/.exec(size);
  3641. if(percent) size = parseInt(percent[1],10) / 100 * distance[mode == 'hide' ? 0 : 1];
  3642. if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift
  3643. // Animation
  3644. var animation1 = {}, animation2 = {};
  3645. animation1[ref[0]] = mode == 'show' ? distance[0] : size;
  3646. animation2[ref[1]] = mode == 'show' ? distance[1] : 0;
  3647. // Animate
  3648. wrapper.animate(animation1, duration, o.options.easing)
  3649. .animate(animation2, duration, o.options.easing, function() {
  3650. if(mode == 'hide') el.hide(); // Hide
  3651. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  3652. if(o.callback) o.callback.apply(el[0], arguments); // Callback
  3653. el.dequeue();
  3654. });
  3655. });
  3656. };
  3657. })(jQuery);
  3658. /*
  3659. * jQuery UI Effects Highlight 1.7.2
  3660. *
  3661. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  3662. * Dual licensed under the MIT (MIT-LICENSE.txt)
  3663. * and GPL (GPL-LICENSE.txt) licenses.
  3664. *
  3665. * http://docs.jquery.com/UI/Effects/Highlight
  3666. *
  3667. * Depends:
  3668. * effects.core.js
  3669. */
  3670. (function($) {
  3671. $.effects.highlight = function(o) {
  3672. return this.queue(function() {
  3673. // Create element
  3674. var el = $(this), props = ['backgroundImage','backgroundColor','opacity'];
  3675. // Set options
  3676. var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
  3677. var color = o.options.color || "#ffff99"; // Default highlight color
  3678. var oldColor = el.css("backgroundColor");
  3679. // Adjust
  3680. $.effects.save(el, props); el.show(); // Save & Show
  3681. el.css({backgroundImage: 'none', backgroundColor: color}); // Shift
  3682. // Animation
  3683. var animation = {backgroundColor: oldColor };
  3684. if (mode == "hide") animation['opacity'] = 0;
  3685. // Animate
  3686. el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
  3687. if(mode == "hide") el.hide();
  3688. $.effects.restore(el, props);
  3689. if (mode == "show" && $.browser.msie) this.style.removeAttribute('filter');
  3690. if(o.callback) o.callback.apply(this, arguments);
  3691. el.dequeue();
  3692. }});
  3693. });
  3694. };
  3695. })(jQuery);
  3696. /*
  3697. * jQuery UI Effects Pulsate 1.7.2
  3698. *
  3699. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  3700. * Dual licensed under the MIT (MIT-LICENSE.txt)
  3701. * and GPL (GPL-LICENSE.txt) licenses.
  3702. *
  3703. * http://docs.jquery.com/UI/Effects/Pulsate
  3704. *
  3705. * Depends:
  3706. * effects.core.js
  3707. */
  3708. (function($) {
  3709. $.effects.pulsate = function(o) {
  3710. return this.queue(function() {
  3711. // Create element
  3712. var el = $(this);
  3713. // Set options
  3714. var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
  3715. var times = o.options.times || 5; // Default # of times
  3716. var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;
  3717. // Adjust
  3718. if (mode == 'hide') times--;
  3719. if (el.is(':hidden')) { // Show fadeIn
  3720. el.css('opacity', 0);
  3721. el.show(); // Show
  3722. el.animate({opacity: 1}, duration, o.options.easing);
  3723. times = times-2;
  3724. }
  3725. // Animate
  3726. for (var i = 0; i < times; i++) { // Pulsate
  3727. el.animate({opacity: 0}, duration, o.options.easing).animate({opacity: 1}, duration, o.options.easing);
  3728. };
  3729. if (mode == 'hide') { // Last Pulse
  3730. el.animate({opacity: 0}, duration, o.options.easing, function(){
  3731. el.hide(); // Hide
  3732. if(o.callback) o.callback.apply(this, arguments); // Callback
  3733. });
  3734. } else {
  3735. el.animate({opacity: 0}, duration, o.options.easing).animate({opacity: 1}, duration, o.options.easing, function(){
  3736. if(o.callback) o.callback.apply(this, arguments); // Callback
  3737. });
  3738. };
  3739. el.queue('fx', function() { el.dequeue(); });
  3740. el.dequeue();
  3741. });
  3742. };
  3743. })(jQuery);
  3744. /*
  3745. * jQuery UI Effects Scale 1.7.2
  3746. *
  3747. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  3748. * Dual licensed under the MIT (MIT-LICENSE.txt)
  3749. * and GPL (GPL-LICENSE.txt) licenses.
  3750. *
  3751. * http://docs.jquery.com/UI/Effects/Scale
  3752. *
  3753. * Depends:
  3754. * effects.core.js
  3755. */
  3756. (function($) {
  3757. $.effects.puff = function(o) {
  3758. return this.queue(function() {
  3759. // Create element
  3760. var el = $(this);
  3761. // Set options
  3762. var options = $.extend(true, {}, o.options);
  3763. var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
  3764. var percent = parseInt(o.options.percent,10) || 150; // Set default puff percent
  3765. options.fade = true; // It's not a puff if it doesn't fade! :)
  3766. var original = {height: el.height(), width: el.width()}; // Save original
  3767. // Adjust
  3768. var factor = percent / 100;
  3769. el.from = (mode == 'hide') ? original : {height: original.height * factor, width: original.width * factor};
  3770. // Animation
  3771. options.from = el.from;
  3772. options.percent = (mode == 'hide') ? percent : 100;
  3773. options.mode = mode;
  3774. // Animate
  3775. el.effect('scale', options, o.duration, o.callback);
  3776. el.dequeue();
  3777. });
  3778. };
  3779. $.effects.scale = function(o) {
  3780. return this.queue(function() {
  3781. // Create element
  3782. var el = $(this);
  3783. // Set options
  3784. var options = $.extend(true, {}, o.options);
  3785. var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
  3786. var percent = parseInt(o.options.percent,10) || (parseInt(o.options.percent,10) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set default scaling percent
  3787. var direction = o.options.direction || 'both'; // Set default axis
  3788. var origin = o.options.origin; // The origin of the scaling
  3789. if (mode != 'effect') { // Set default origin and restore for show/hide
  3790. options.origin = origin || ['middle','center'];
  3791. options.restore = true;
  3792. }
  3793. var original = {height: el.height(), width: el.width()}; // Save original
  3794. el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state
  3795. // Adjust
  3796. var factor = { // Set scaling factor
  3797. y: direction != 'horizontal' ? (percent / 100) : 1,
  3798. x: direction != 'vertical' ? (percent / 100) : 1
  3799. };
  3800. el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state
  3801. if (o.options.fade) { // Fade option to support puff
  3802. if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;};
  3803. if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;};
  3804. };
  3805. // Animation
  3806. options.from = el.from; options.to = el.to; options.mode = mode;
  3807. // Animate
  3808. el.effect('size', options, o.duration, o.callback);
  3809. el.dequeue();
  3810. });
  3811. };
  3812. $.effects.size = function(o) {
  3813. return this.queue(function() {
  3814. // Create element
  3815. var el = $(this), props = ['position','top','left','width','height','overflow','opacity'];
  3816. var props1 = ['position','top','left','overflow','opacity']; // Always restore
  3817. var props2 = ['width','height','overflow']; // Copy for children
  3818. var cProps = ['fontSize'];
  3819. var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom'];
  3820. var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight'];
  3821. // Set options
  3822. var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
  3823. var restore = o.options.restore || false; // Default restore
  3824. var scale = o.options.scale || 'both'; // Default scale mode
  3825. var origin = o.options.origin; // The origin of the sizing
  3826. var original = {height: el.height(), width: el.width()}; // Save original
  3827. el.from = o.options.from || original; // Default from state
  3828. el.to = o.options.to || original; // Default to state
  3829. // Adjust
  3830. if (origin) { // Calculate baseline shifts
  3831. var baseline = $.effects.getBaseline(origin, original);
  3832. el.from.top = (original.height - el.from.height) * baseline.y;
  3833. el.from.left = (original.width - el.from.width) * baseline.x;
  3834. el.to.top = (original.height - el.to.height) * baseline.y;
  3835. el.to.left = (original.width - el.to.width) * baseline.x;
  3836. };
  3837. var factor = { // Set scaling factor
  3838. from: {y: el.from.height / original.height, x: el.from.width / original.width},
  3839. to: {y: el.to.height / original.height, x: el.to.width / original.width}
  3840. };
  3841. if (scale == 'box' || scale == 'both') { // Scale the css box
  3842. if (factor.from.y != factor.to.y) { // Vertical props scaling
  3843. props = props.concat(vProps);
  3844. el.from = $.effects.setTransition(el, vProps, factor.from.y, el.from);
  3845. el.to = $.effects.setTransition(el, vProps, factor.to.y, el.to);
  3846. };
  3847. if (factor.from.x != factor.to.x) { // Horizontal props scaling
  3848. props = props.concat(hProps);
  3849. el.from = $.effects.setTransition(el, hProps, factor.from.x, el.from);
  3850. el.to = $.effects.setTransition(el, hProps, factor.to.x, el.to);
  3851. };
  3852. };
  3853. if (scale == 'content' || scale == 'both') { // Scale the content
  3854. if (factor.from.y != factor.to.y) { // Vertical props scaling
  3855. props = props.concat(cProps);
  3856. el.from = $.effects.setTransition(el, cProps, factor.from.y, el.from);
  3857. el.to = $.effects.setTransition(el, cProps, factor.to.y, el.to);
  3858. };
  3859. };
  3860. $.effects.save(el, restore ? props : props1); el.show(); // Save & Show
  3861. $.effects.createWrapper(el); // Create Wrapper
  3862. el.css('overflow','hidden').css(el.from); // Shift
  3863. // Animate
  3864. if (scale == 'content' || scale == 'both') { // Scale the children
  3865. vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size
  3866. hProps = hProps.concat(['marginLeft','marginRight']); // Add margins
  3867. props2 = props.concat(vProps).concat(hProps); // Concat
  3868. el.find("*[width]").each(function(){
  3869. child = $(this);
  3870. if (restore) $.effects.save(child, props2);
  3871. var c_original = {height: child.height(), width: child.width()}; // Save original
  3872. child.from = {height: c_original.height * factor.from.y, width: c_original.width * factor.from.x};
  3873. child.to = {height: c_original.height * factor.to.y, width: c_original.width * factor.to.x};
  3874. if (factor.from.y != factor.to.y) { // Vertical props scaling
  3875. child.from = $.effects.setTransition(child, vProps, factor.from.y, child.from);
  3876. child.to = $.effects.setTransition(child, vProps, factor.to.y, child.to);
  3877. };
  3878. if (factor.from.x != factor.to.x) { // Horizontal props scaling
  3879. child.from = $.effects.setTransition(child, hProps, factor.from.x, child.from);
  3880. child.to = $.effects.setTransition(child, hProps, factor.to.x, child.to);
  3881. };
  3882. child.css(child.from); // Shift children
  3883. child.animate(child.to, o.duration, o.options.easing, function(){
  3884. if (restore) $.effects.restore(child, props2); // Restore children
  3885. }); // Animate children
  3886. });
  3887. };
  3888. // Animate
  3889. el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
  3890. if(mode == 'hide') el.hide(); // Hide
  3891. $.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore
  3892. if(o.callback) o.callback.apply(this, arguments); // Callback
  3893. el.dequeue();
  3894. }});
  3895. });
  3896. };
  3897. })(jQuery);
  3898. /*
  3899. * jQuery UI Effects Shake 1.7.2
  3900. *
  3901. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  3902. * Dual licensed under the MIT (MIT-LICENSE.txt)
  3903. * and GPL (GPL-LICENSE.txt) licenses.
  3904. *
  3905. * http://docs.jquery.com/UI/Effects/Shake
  3906. *
  3907. * Depends:
  3908. * effects.core.js
  3909. */
  3910. (function($) {
  3911. $.effects.shake = function(o) {
  3912. return this.queue(function() {
  3913. // Create element
  3914. var el = $(this), props = ['position','top','left'];
  3915. // Set options
  3916. var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
  3917. var direction = o.options.direction || 'left'; // Default direction
  3918. var distance = o.options.distance || 20; // Default distance
  3919. var times = o.options.times || 3; // Default # of times
  3920. var speed = o.duration || o.options.duration || 140; // Default speed per shake
  3921. // Adjust
  3922. $.effects.save(el, props); el.show(); // Save & Show
  3923. $.effects.createWrapper(el); // Create Wrapper
  3924. var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
  3925. var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
  3926. // Animation
  3927. var animation = {}, animation1 = {}, animation2 = {};
  3928. animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
  3929. animation1[ref] = (motion == 'pos' ? '+=' : '-=') + distance * 2;
  3930. animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2;
  3931. // Animate
  3932. el.animate(animation, speed, o.options.easing);
  3933. for (var i = 1; i < times; i++) { // Shakes
  3934. el.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing);
  3935. };
  3936. el.animate(animation1, speed, o.options.easing).
  3937. animate(animation, speed / 2, o.options.easing, function(){ // Last shake
  3938. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  3939. if(o.callback) o.callback.apply(this, arguments); // Callback
  3940. });
  3941. el.queue('fx', function() { el.dequeue(); });
  3942. el.dequeue();
  3943. });
  3944. };
  3945. })(jQuery);
  3946. /*
  3947. * jQuery UI Effects Slide 1.7.2
  3948. *
  3949. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  3950. * Dual licensed under the MIT (MIT-LICENSE.txt)
  3951. * and GPL (GPL-LICENSE.txt) licenses.
  3952. *
  3953. * http://docs.jquery.com/UI/Effects/Slide
  3954. *
  3955. * Depends:
  3956. * effects.core.js
  3957. */
  3958. (function($) {
  3959. $.effects.slide = function(o) {
  3960. return this.queue(function() {
  3961. // Create element
  3962. var el = $(this), props = ['position','top','left'];
  3963. // Set options
  3964. var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
  3965. var direction = o.options.direction || 'left'; // Default Direction
  3966. // Adjust
  3967. $.effects.save(el, props); el.show(); // Save & Show
  3968. $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
  3969. var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
  3970. var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
  3971. var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));
  3972. if (mode == 'show') el.css(ref, motion == 'pos' ? -distance : distance); // Shift
  3973. // Animation
  3974. var animation = {};
  3975. animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
  3976. // Animate
  3977. el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
  3978. if(mode == 'hide') el.hide(); // Hide
  3979. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  3980. if(o.callback) o.callback.apply(this, arguments); // Callback
  3981. el.dequeue();
  3982. }});
  3983. });
  3984. };
  3985. })(jQuery);
  3986. /*
  3987. * jQuery UI Effects Transfer 1.7.2
  3988. *
  3989. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  3990. * Dual licensed under the MIT (MIT-LICENSE.txt)
  3991. * and GPL (GPL-LICENSE.txt) licenses.
  3992. *
  3993. * http://docs.jquery.com/UI/Effects/Transfer
  3994. *
  3995. * Depends:
  3996. * effects.core.js
  3997. */
  3998. (function($) {
  3999. $.effects.transfer = function(o) {
  4000. return this.queue(function() {
  4001. var elem = $(this),
  4002. target = $(o.options.to),
  4003. endPosition = target.offset(),
  4004. animation = {
  4005. top: endPosition.top,
  4006. left: endPosition.left,
  4007. height: target.innerHeight(),
  4008. width: target.innerWidth()
  4009. },
  4010. startPosition = elem.offset(),
  4011. transfer = $('<div class="ui-effects-transfer"></div>')
  4012. .appendTo(document.body)
  4013. .addClass(o.options.className)
  4014. .css({
  4015. top: startPosition.top,
  4016. left: startPosition.left,
  4017. height: elem.innerHeight(),
  4018. width: elem.innerWidth(),
  4019. position: 'absolute'
  4020. })
  4021. .animate(animation, o.duration, o.options.easing, function() {
  4022. transfer.remove();
  4023. (o.callback && o.callback.apply(elem[0], arguments));
  4024. elem.dequeue();
  4025. });
  4026. });
  4027. };
  4028. })(jQuery);
  4029. /*
  4030. * jQuery UI Accordion 1.7.2
  4031. *
  4032. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  4033. * Dual licensed under the MIT (MIT-LICENSE.txt)
  4034. * and GPL (GPL-LICENSE.txt) licenses.
  4035. *
  4036. * http://docs.jquery.com/UI/Accordion
  4037. *
  4038. * Depends:
  4039. * ui.core.js
  4040. */
  4041. (function($) {
  4042. $.widget("ui.accordion", {
  4043. _init: function() {
  4044. var o = this.options, self = this;
  4045. this.running = 0;
  4046. // if the user set the alwaysOpen option on init
  4047. // then we need to set the collapsible option
  4048. // if they set both on init, collapsible will take priority
  4049. if (o.collapsible == $.ui.accordion.defaults.collapsible &&
  4050. o.alwaysOpen != $.ui.accordion.defaults.alwaysOpen) {
  4051. o.collapsible = !o.alwaysOpen;
  4052. }
  4053. if ( o.navigation ) {
  4054. var current = this.element.find("a").filter(o.navigationFilter);
  4055. if ( current.length ) {
  4056. if ( current.filter(o.header).length ) {
  4057. this.active = current;
  4058. } else {
  4059. this.active = current.parent().parent().prev();
  4060. current.addClass("ui-accordion-content-active");
  4061. }
  4062. }
  4063. }
  4064. this.element.addClass("ui-accordion ui-widget ui-helper-reset");
  4065. // in lack of child-selectors in CSS we need to mark top-LIs in a UL-accordion for some IE-fix
  4066. if (this.element[0].nodeName == "UL") {
  4067. this.element.children("li").addClass("ui-accordion-li-fix");
  4068. }
  4069. this.headers = this.element.find(o.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all")
  4070. .bind("mouseenter.accordion", function(){ $(this).addClass('ui-state-hover'); })
  4071. .bind("mouseleave.accordion", function(){ $(this).removeClass('ui-state-hover'); })
  4072. .bind("focus.accordion", function(){ $(this).addClass('ui-state-focus'); })
  4073. .bind("blur.accordion", function(){ $(this).removeClass('ui-state-focus'); });
  4074. this.headers
  4075. .next()
  4076. .addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
  4077. this.active = this._findActive(this.active || o.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");
  4078. this.active.next().addClass('ui-accordion-content-active');
  4079. //Append icon elements
  4080. $("<span/>").addClass("ui-icon " + o.icons.header).prependTo(this.headers);
  4081. this.active.find(".ui-icon").toggleClass(o.icons.header).toggleClass(o.icons.headerSelected);
  4082. // IE7-/Win - Extra vertical space in lists fixed
  4083. if ($.browser.msie) {
  4084. this.element.find('a').css('zoom', '1');
  4085. }
  4086. this.resize();
  4087. //ARIA
  4088. this.element.attr('role','tablist');
  4089. this.headers
  4090. .attr('role','tab')
  4091. .bind('keydown', function(event) { return self._keydown(event); })
  4092. .next()
  4093. .attr('role','tabpanel');
  4094. this.headers
  4095. .not(this.active || "")
  4096. .attr('aria-expanded','false')
  4097. .attr("tabIndex", "-1")
  4098. .next()
  4099. .hide();
  4100. // make sure at least one header is in the tab order
  4101. if (!this.active.length) {
  4102. this.headers.eq(0).attr('tabIndex','0');
  4103. } else {
  4104. this.active
  4105. .attr('aria-expanded','true')
  4106. .attr('tabIndex', '0');
  4107. }
  4108. // only need links in taborder for Safari
  4109. if (!$.browser.safari)
  4110. this.headers.find('a').attr('tabIndex','-1');
  4111. if (o.event) {
  4112. this.headers.bind((o.event) + ".accordion", function(event) { return self._clickHandler.call(self, event, this); });
  4113. }
  4114. },
  4115. destroy: function() {
  4116. var o = this.options;
  4117. this.element
  4118. .removeClass("ui-accordion ui-widget ui-helper-reset")
  4119. .removeAttr("role")
  4120. .unbind('.accordion')
  4121. .removeData('accordion');
  4122. this.headers
  4123. .unbind(".accordion")
  4124. .removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top")
  4125. .removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");
  4126. this.headers.find("a").removeAttr("tabindex");
  4127. this.headers.children(".ui-icon").remove();
  4128. var contents = this.headers.next().css("display", "").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");
  4129. if (o.autoHeight || o.fillHeight) {
  4130. contents.css("height", "");
  4131. }
  4132. },
  4133. _setData: function(key, value) {
  4134. if(key == 'alwaysOpen') { key = 'collapsible'; value = !value; }
  4135. $.widget.prototype._setData.apply(this, arguments);
  4136. },
  4137. _keydown: function(event) {
  4138. var o = this.options, keyCode = $.ui.keyCode;
  4139. if (o.disabled || event.altKey || event.ctrlKey)
  4140. return;
  4141. var length = this.headers.length;
  4142. var currentIndex = this.headers.index(event.target);
  4143. var toFocus = false;
  4144. switch(event.keyCode) {
  4145. case keyCode.RIGHT:
  4146. case keyCode.DOWN:
  4147. toFocus = this.headers[(currentIndex + 1) % length];
  4148. break;
  4149. case keyCode.LEFT:
  4150. case keyCode.UP:
  4151. toFocus = this.headers[(currentIndex - 1 + length) % length];
  4152. break;
  4153. case keyCode.SPACE:
  4154. case keyCode.ENTER:
  4155. return this._clickHandler({ target: event.target }, event.target);
  4156. }
  4157. if (toFocus) {
  4158. $(event.target).attr('tabIndex','-1');
  4159. $(toFocus).attr('tabIndex','0');
  4160. toFocus.focus();
  4161. return false;
  4162. }
  4163. return true;
  4164. },
  4165. resize: function() {
  4166. var o = this.options, maxHeight;
  4167. if (o.fillSpace) {
  4168. if($.browser.msie) { var defOverflow = this.element.parent().css('overflow'); this.element.parent().css('overflow', 'hidden'); }
  4169. maxHeight = this.element.parent().height();
  4170. if($.browser.msie) { this.element.parent().css('overflow', defOverflow); }
  4171. this.headers.each(function() {
  4172. maxHeight -= $(this).outerHeight();
  4173. });
  4174. var maxPadding = 0;
  4175. this.headers.next().each(function() {
  4176. maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height());
  4177. }).height(Math.max(0, maxHeight - maxPadding))
  4178. .css('overflow', 'auto');
  4179. } else if ( o.autoHeight ) {
  4180. maxHeight = 0;
  4181. this.headers.next().each(function() {
  4182. maxHeight = Math.max(maxHeight, $(this).outerHeight());
  4183. }).height(maxHeight);
  4184. }
  4185. },
  4186. activate: function(index) {
  4187. // call clickHandler with custom event
  4188. var active = this._findActive(index)[0];
  4189. this._clickHandler({ target: active }, active);
  4190. },
  4191. _findActive: function(selector) {
  4192. return selector
  4193. ? typeof selector == "number"
  4194. ? this.headers.filter(":eq(" + selector + ")")
  4195. : this.headers.not(this.headers.not(selector))
  4196. : selector === false
  4197. ? $([])
  4198. : this.headers.filter(":eq(0)");
  4199. },
  4200. _clickHandler: function(event, target) {
  4201. var o = this.options;
  4202. if (o.disabled) return false;
  4203. // called only when using activate(false) to close all parts programmatically
  4204. if (!event.target && o.collapsible) {
  4205. this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all")
  4206. .find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);
  4207. this.active.next().addClass('ui-accordion-content-active');
  4208. var toHide = this.active.next(),
  4209. data = {
  4210. options: o,
  4211. newHeader: $([]),
  4212. oldHeader: o.active,
  4213. newContent: $([]),
  4214. oldContent: toHide
  4215. },
  4216. toShow = (this.active = $([]));
  4217. this._toggle(toShow, toHide, data);
  4218. return false;
  4219. }
  4220. // get the click target
  4221. var clicked = $(event.currentTarget || target);
  4222. var clickedIsActive = clicked[0] == this.active[0];
  4223. // if animations are still active, or the active header is the target, ignore click
  4224. if (this.running || (!o.collapsible && clickedIsActive)) {
  4225. return false;
  4226. }
  4227. // switch classes
  4228. this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all")
  4229. .find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);
  4230. this.active.next().addClass('ui-accordion-content-active');
  4231. if (!clickedIsActive) {
  4232. clicked.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top")
  4233. .find(".ui-icon").removeClass(o.icons.header).addClass(o.icons.headerSelected);
  4234. clicked.next().addClass('ui-accordion-content-active');
  4235. }
  4236. // find elements to show and hide
  4237. var toShow = clicked.next(),
  4238. toHide = this.active.next(),
  4239. data = {
  4240. options: o,
  4241. newHeader: clickedIsActive && o.collapsible ? $([]) : clicked,
  4242. oldHeader: this.active,
  4243. newContent: clickedIsActive && o.collapsible ? $([]) : toShow.find('> *'),
  4244. oldContent: toHide.find('> *')
  4245. },
  4246. down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] );
  4247. this.active = clickedIsActive ? $([]) : clicked;
  4248. this._toggle(toShow, toHide, data, clickedIsActive, down);
  4249. return false;
  4250. },
  4251. _toggle: function(toShow, toHide, data, clickedIsActive, down) {
  4252. var o = this.options, self = this;
  4253. this.toShow = toShow;
  4254. this.toHide = toHide;
  4255. this.data = data;
  4256. var complete = function() { if(!self) return; return self._completed.apply(self, arguments); };
  4257. // trigger changestart event
  4258. this._trigger("changestart", null, this.data);
  4259. // count elements to animate
  4260. this.running = toHide.size() === 0 ? toShow.size() : toHide.size();
  4261. if (o.animated) {
  4262. var animOptions = {};
  4263. if ( o.collapsible && clickedIsActive ) {
  4264. animOptions = {
  4265. toShow: $([]),
  4266. toHide: toHide,
  4267. complete: complete,
  4268. down: down,
  4269. autoHeight: o.autoHeight || o.fillSpace
  4270. };
  4271. } else {
  4272. animOptions = {
  4273. toShow: toShow,
  4274. toHide: toHide,
  4275. complete: complete,
  4276. down: down,
  4277. autoHeight: o.autoHeight || o.fillSpace
  4278. };
  4279. }
  4280. if (!o.proxied) {
  4281. o.proxied = o.animated;
  4282. }
  4283. if (!o.proxiedDuration) {
  4284. o.proxiedDuration = o.duration;
  4285. }
  4286. o.animated = $.isFunction(o.proxied) ?
  4287. o.proxied(animOptions) : o.proxied;
  4288. o.duration = $.isFunction(o.proxiedDuration) ?
  4289. o.proxiedDuration(animOptions) : o.proxiedDuration;
  4290. var animations = $.ui.accordion.animations,
  4291. duration = o.duration,
  4292. easing = o.animated;
  4293. if (!animations[easing]) {
  4294. animations[easing] = function(options) {
  4295. this.slide(options, {
  4296. easing: easing,
  4297. duration: duration || 700
  4298. });
  4299. };
  4300. }
  4301. animations[easing](animOptions);
  4302. } else {
  4303. if (o.collapsible && clickedIsActive) {
  4304. toShow.toggle();
  4305. } else {
  4306. toHide.hide();
  4307. toShow.show();
  4308. }
  4309. complete(true);
  4310. }
  4311. toHide.prev().attr('aria-expanded','false').attr("tabIndex", "-1").blur();
  4312. toShow.prev().attr('aria-expanded','true').attr("tabIndex", "0").focus();
  4313. },
  4314. _completed: function(cancel) {
  4315. var o = this.options;
  4316. this.running = cancel ? 0 : --this.running;
  4317. if (this.running) return;
  4318. if (o.clearStyle) {
  4319. this.toShow.add(this.toHide).css({
  4320. height: "",
  4321. overflow: ""
  4322. });
  4323. }
  4324. this._trigger('change', null, this.data);
  4325. }
  4326. });
  4327. $.extend($.ui.accordion, {
  4328. version: "1.7.2",
  4329. defaults: {
  4330. active: null,
  4331. alwaysOpen: true, //deprecated, use collapsible
  4332. animated: 'slide',
  4333. autoHeight: true,
  4334. clearStyle: false,
  4335. collapsible: false,
  4336. event: "click",
  4337. fillSpace: false,
  4338. header: "> li > :first-child,> :not(li):even",
  4339. icons: {
  4340. header: "ui-icon-triangle-1-e",
  4341. headerSelected: "ui-icon-triangle-1-s"
  4342. },
  4343. navigation: false,
  4344. navigationFilter: function() {
  4345. return this.href.toLowerCase() == location.href.toLowerCase();
  4346. }
  4347. },
  4348. animations: {
  4349. slide: function(options, additions) {
  4350. options = $.extend({
  4351. easing: "swing",
  4352. duration: 300
  4353. }, options, additions);
  4354. if ( !options.toHide.size() ) {
  4355. options.toShow.animate({height: "show"}, options);
  4356. return;
  4357. }
  4358. if ( !options.toShow.size() ) {
  4359. options.toHide.animate({height: "hide"}, options);
  4360. return;
  4361. }
  4362. var overflow = options.toShow.css('overflow'),
  4363. percentDone,
  4364. showProps = {},
  4365. hideProps = {},
  4366. fxAttrs = [ "height", "paddingTop", "paddingBottom" ],
  4367. originalWidth;
  4368. // fix width before calculating height of hidden element
  4369. var s = options.toShow;
  4370. originalWidth = s[0].style.width;
  4371. s.width( parseInt(s.parent().width(),10) - parseInt(s.css("paddingLeft"),10) - parseInt(s.css("paddingRight"),10) - (parseInt(s.css("borderLeftWidth"),10) || 0) - (parseInt(s.css("borderRightWidth"),10) || 0) );
  4372. $.each(fxAttrs, function(i, prop) {
  4373. hideProps[prop] = 'hide';
  4374. var parts = ('' + $.css(options.toShow[0], prop)).match(/^([\d+-.]+)(.*)$/);
  4375. showProps[prop] = {
  4376. value: parts[1],
  4377. unit: parts[2] || 'px'
  4378. };
  4379. });
  4380. options.toShow.css({ height: 0, overflow: 'hidden' }).show();
  4381. options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate(hideProps,{
  4382. step: function(now, settings) {
  4383. // only calculate the percent when animating height
  4384. // IE gets very inconsistent results when animating elements
  4385. // with small values, which is common for padding
  4386. if (settings.prop == 'height') {
  4387. percentDone = (settings.now - settings.start) / (settings.end - settings.start);
  4388. }
  4389. options.toShow[0].style[settings.prop] =
  4390. (percentDone * showProps[settings.prop].value) + showProps[settings.prop].unit;
  4391. },
  4392. duration: options.duration,
  4393. easing: options.easing,
  4394. complete: function() {
  4395. if ( !options.autoHeight ) {
  4396. options.toShow.css("height", "");
  4397. }
  4398. options.toShow.css("width", originalWidth);
  4399. options.toShow.css({overflow: overflow});
  4400. options.complete();
  4401. }
  4402. });
  4403. },
  4404. bounceslide: function(options) {
  4405. this.slide(options, {
  4406. easing: options.down ? "easeOutBounce" : "swing",
  4407. duration: options.down ? 1000 : 200
  4408. });
  4409. },
  4410. easeslide: function(options) {
  4411. this.slide(options, {
  4412. easing: "easeinout",
  4413. duration: 700
  4414. });
  4415. }
  4416. }
  4417. });
  4418. })(jQuery);
  4419. /*
  4420. * jQuery UI Datepicker 1.7.2
  4421. *
  4422. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  4423. * Dual licensed under the MIT (MIT-LICENSE.txt)
  4424. * and GPL (GPL-LICENSE.txt) licenses.
  4425. *
  4426. * http://docs.jquery.com/UI/Datepicker
  4427. *
  4428. * Depends:
  4429. * ui.core.js
  4430. */
  4431. (function($) { // hide the namespace
  4432. $.extend($.ui, { datepicker: { version: "1.7.2" } });
  4433. var PROP_NAME = 'datepicker';
  4434. /* Date picker manager.
  4435. Use the singleton instance of this class, $.datepicker, to interact with the date picker.
  4436. Settings for (groups of) date pickers are maintained in an instance object,
  4437. allowing multiple different settings on the same page. */
  4438. function Datepicker() {
  4439. this.debug = false; // Change this to true to start debugging
  4440. this._curInst = null; // The current instance in use
  4441. this._keyEvent = false; // If the last event was a key event
  4442. this._disabledInputs = []; // List of date picker inputs that have been disabled
  4443. this._datepickerShowing = false; // True if the popup picker is showing , false if not
  4444. this._inDialog = false; // True if showing within a "dialog", false if not
  4445. this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
  4446. this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
  4447. this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
  4448. this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
  4449. this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
  4450. this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
  4451. this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
  4452. this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
  4453. this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class
  4454. this.regional = []; // Available regional settings, indexed by language code
  4455. this.regional[''] = { // Default regional settings
  4456. closeText: 'Done', // Display text for close link
  4457. prevText: 'Prev', // Display text for previous month link
  4458. nextText: 'Next', // Display text for next month link
  4459. currentText: 'Today', // Display text for current month link
  4460. monthNames: ['January','February','March','April','May','June',
  4461. 'July','August','September','October','November','December'], // Names of months for drop-down and formatting
  4462. monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
  4463. dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
  4464. dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
  4465. dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
  4466. dateFormat: 'mm/dd/yy', // See format options on parseDate
  4467. firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
  4468. isRTL: false // True if right-to-left language, false if left-to-right
  4469. };
  4470. this._defaults = { // Global defaults for all the date picker instances
  4471. showOn: 'focus', // 'focus' for popup on focus,
  4472. // 'button' for trigger button, or 'both' for either
  4473. showAnim: 'show', // Name of jQuery animation for popup
  4474. showOptions: {}, // Options for enhanced animations
  4475. defaultDate: null, // Used when field is blank: actual date,
  4476. // +/-number for offset from today, null for today
  4477. appendText: '', // Display text following the input box, e.g. showing the format
  4478. buttonText: '...', // Text for trigger button
  4479. buttonImage: '', // URL for trigger button image
  4480. buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
  4481. hideIfNoPrevNext: false, // True to hide next/previous month links
  4482. // if not applicable, false to just disable them
  4483. navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
  4484. gotoCurrent: false, // True if today link goes back to current selection instead
  4485. changeMonth: false, // True if month can be selected directly, false if only prev/next
  4486. changeYear: false, // True if year can be selected directly, false if only prev/next
  4487. showMonthAfterYear: false, // True if the year select precedes month, false for month then year
  4488. yearRange: '-10:+10', // Range of years to display in drop-down,
  4489. // either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)
  4490. showOtherMonths: false, // True to show dates in other months, false to leave blank
  4491. calculateWeek: this.iso8601Week, // How to calculate the week of the year,
  4492. // takes a Date and returns the number of the week for it
  4493. shortYearCutoff: '+10', // Short year values < this are in the current century,
  4494. // > this are in the previous century,
  4495. // string value starting with '+' for current year + value
  4496. minDate: null, // The earliest selectable date, or null for no limit
  4497. maxDate: null, // The latest selectable date, or null for no limit
  4498. duration: 'normal', // Duration of display/closure
  4499. beforeShowDay: null, // Function that takes a date and returns an array with
  4500. // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
  4501. // [2] = cell title (optional), e.g. $.datepicker.noWeekends
  4502. beforeShow: null, // Function that takes an input field and
  4503. // returns a set of custom settings for the date picker
  4504. onSelect: null, // Define a callback function when a date is selected
  4505. onChangeMonthYear: null, // Define a callback function when the month or year is changed
  4506. onClose: null, // Define a callback function when the datepicker is closed
  4507. numberOfMonths: 1, // Number of months to show at a time
  4508. showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
  4509. stepMonths: 1, // Number of months to step back/forward
  4510. stepBigMonths: 12, // Number of months to step back/forward for the big links
  4511. altField: '', // Selector for an alternate field to store selected dates into
  4512. altFormat: '', // The date format to use for the alternate field
  4513. constrainInput: true, // The input is constrained by the current date format
  4514. showButtonPanel: false // True to show button panel, false to not show it
  4515. };
  4516. $.extend(this._defaults, this.regional['']);
  4517. 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>');
  4518. }
  4519. $.extend(Datepicker.prototype, {
  4520. /* Class name added to elements to indicate already configured with a date picker. */
  4521. markerClassName: 'hasDatepicker',
  4522. /* Debug logging (if enabled). */
  4523. log: function () {
  4524. if (this.debug)
  4525. console.log.apply('', arguments);
  4526. },
  4527. /* Override the default settings for all instances of the date picker.
  4528. @param settings object - the new settings to use as defaults (anonymous object)
  4529. @return the manager object */
  4530. setDefaults: function(settings) {
  4531. extendRemove(this._defaults, settings || {});
  4532. return this;
  4533. },
  4534. /* Attach the date picker to a jQuery selection.
  4535. @param target element - the target input field or division or span
  4536. @param settings object - the new settings to use for this date picker instance (anonymous) */
  4537. _attachDatepicker: function(target, settings) {
  4538. // check for settings on the control itself - in namespace 'date:'
  4539. var inlineSettings = null;
  4540. for (var attrName in this._defaults) {
  4541. var attrValue = target.getAttribute('date:' + attrName);
  4542. if (attrValue) {
  4543. inlineSettings = inlineSettings || {};
  4544. try {
  4545. inlineSettings[attrName] = eval(attrValue);
  4546. } catch (err) {
  4547. inlineSettings[attrName] = attrValue;
  4548. }
  4549. }
  4550. }
  4551. var nodeName = target.nodeName.toLowerCase();
  4552. var inline = (nodeName == 'div' || nodeName == 'span');
  4553. if (!target.id)
  4554. target.id = 'dp' + (++this.uuid);
  4555. var inst = this._newInst($(target), inline);
  4556. inst.settings = $.extend({}, settings || {}, inlineSettings || {});
  4557. if (nodeName == 'input') {
  4558. this._connectDatepicker(target, inst);
  4559. } else if (inline) {
  4560. this._inlineDatepicker(target, inst);
  4561. }
  4562. },
  4563. /* Create a new instance object. */
  4564. _newInst: function(target, inline) {
  4565. var id = target[0].id.replace(/([:\[\]\.])/g, '\\\\$1'); // escape jQuery meta chars
  4566. return {id: id, input: target, // associated target
  4567. selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
  4568. drawMonth: 0, drawYear: 0, // month being drawn
  4569. inline: inline, // is datepicker inline or not
  4570. dpDiv: (!inline ? this.dpDiv : // presentation div
  4571. $('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))};
  4572. },
  4573. /* Attach the date picker to an input field. */
  4574. _connectDatepicker: function(target, inst) {
  4575. var input = $(target);
  4576. inst.append = $([]);
  4577. inst.trigger = $([]);
  4578. if (input.hasClass(this.markerClassName))
  4579. return;
  4580. var appendText = this._get(inst, 'appendText');
  4581. var isRTL = this._get(inst, 'isRTL');
  4582. if (appendText) {
  4583. inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>');
  4584. input[isRTL ? 'before' : 'after'](inst.append);
  4585. }
  4586. var showOn = this._get(inst, 'showOn');
  4587. if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
  4588. input.focus(this._showDatepicker);
  4589. if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
  4590. var buttonText = this._get(inst, 'buttonText');
  4591. var buttonImage = this._get(inst, 'buttonImage');
  4592. inst.trigger = $(this._get(inst, 'buttonImageOnly') ?
  4593. $('<img/>').addClass(this._triggerClass).
  4594. attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
  4595. $('<button type="button"></button>').addClass(this._triggerClass).
  4596. html(buttonImage == '' ? buttonText : $('<img/>').attr(
  4597. { src:buttonImage, alt:buttonText, title:buttonText })));
  4598. input[isRTL ? 'before' : 'after'](inst.trigger);
  4599. inst.trigger.click(function() {
  4600. if ($.datepicker._datepickerShowing && $.datepicker._lastInput == target)
  4601. $.datepicker._hideDatepicker();
  4602. else
  4603. $.datepicker._showDatepicker(target);
  4604. return false;
  4605. });
  4606. }
  4607. input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).
  4608. bind("setData.datepicker", function(event, key, value) {
  4609. inst.settings[key] = value;
  4610. }).bind("getData.datepicker", function(event, key) {
  4611. return this._get(inst, key);
  4612. });
  4613. $.data(target, PROP_NAME, inst);
  4614. },
  4615. /* Attach an inline date picker to a div. */
  4616. _inlineDatepicker: function(target, inst) {
  4617. var divSpan = $(target);
  4618. if (divSpan.hasClass(this.markerClassName))
  4619. return;
  4620. divSpan.addClass(this.markerClassName).append(inst.dpDiv).
  4621. bind("setData.datepicker", function(event, key, value){
  4622. inst.settings[key] = value;
  4623. }).bind("getData.datepicker", function(event, key){
  4624. return this._get(inst, key);
  4625. });
  4626. $.data(target, PROP_NAME, inst);
  4627. this._setDate(inst, this._getDefaultDate(inst));
  4628. this._updateDatepicker(inst);
  4629. this._updateAlternate(inst);
  4630. },
  4631. /* Pop-up the date picker in a "dialog" box.
  4632. @param input element - ignored
  4633. @param dateText string - the initial date to display (in the current format)
  4634. @param onSelect function - the function(dateText) to call when a date is selected
  4635. @param settings object - update the dialog date picker instance's settings (anonymous object)
  4636. @param pos int[2] - coordinates for the dialog's position within the screen or
  4637. event - with x/y coordinates or
  4638. leave empty for default (screen centre)
  4639. @return the manager object */
  4640. _dialogDatepicker: function(input, dateText, onSelect, settings, pos) {
  4641. var inst = this._dialogInst; // internal instance
  4642. if (!inst) {
  4643. var id = 'dp' + (++this.uuid);
  4644. this._dialogInput = $('<input type="text" id="' + id +
  4645. '" size="1" style="position: absolute; top: -100px;"/>');
  4646. this._dialogInput.keydown(this._doKeyDown);
  4647. $('body').append(this._dialogInput);
  4648. inst = this._dialogInst = this._newInst(this._dialogInput, false);
  4649. inst.settings = {};
  4650. $.data(this._dialogInput[0], PROP_NAME, inst);
  4651. }
  4652. extendRemove(inst.settings, settings || {});
  4653. this._dialogInput.val(dateText);
  4654. this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
  4655. if (!this._pos) {
  4656. var browserWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
  4657. var browserHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
  4658. var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
  4659. var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
  4660. this._pos = // should use actual width/height below
  4661. [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
  4662. }
  4663. // move input on screen for focus, but hidden behind dialog
  4664. this._dialogInput.css('left', this._pos[0] + 'px').css('top', this._pos[1] + 'px');
  4665. inst.settings.onSelect = onSelect;
  4666. this._inDialog = true;
  4667. this.dpDiv.addClass(this._dialogClass);
  4668. this._showDatepicker(this._dialogInput[0]);
  4669. if ($.blockUI)
  4670. $.blockUI(this.dpDiv);
  4671. $.data(this._dialogInput[0], PROP_NAME, inst);
  4672. return this;
  4673. },
  4674. /* Detach a datepicker from its control.
  4675. @param target element - the target input field or division or span */
  4676. _destroyDatepicker: function(target) {
  4677. var $target = $(target);
  4678. var inst = $.data(target, PROP_NAME);
  4679. if (!$target.hasClass(this.markerClassName)) {
  4680. return;
  4681. }
  4682. var nodeName = target.nodeName.toLowerCase();
  4683. $.removeData(target, PROP_NAME);
  4684. if (nodeName == 'input') {
  4685. inst.append.remove();
  4686. inst.trigger.remove();
  4687. $target.removeClass(this.markerClassName).
  4688. unbind('focus', this._showDatepicker).
  4689. unbind('keydown', this._doKeyDown).
  4690. unbind('keypress', this._doKeyPress);
  4691. } else if (nodeName == 'div' || nodeName == 'span')
  4692. $target.removeClass(this.markerClassName).empty();
  4693. },
  4694. /* Enable the date picker to a jQuery selection.
  4695. @param target element - the target input field or division or span */
  4696. _enableDatepicker: function(target) {
  4697. var $target = $(target);
  4698. var inst = $.data(target, PROP_NAME);
  4699. if (!$target.hasClass(this.markerClassName)) {
  4700. return;
  4701. }
  4702. var nodeName = target.nodeName.toLowerCase();
  4703. if (nodeName == 'input') {
  4704. target.disabled = false;
  4705. inst.trigger.filter('button').
  4706. each(function() { this.disabled = false; }).end().
  4707. filter('img').css({opacity: '1.0', cursor: ''});
  4708. }
  4709. else if (nodeName == 'div' || nodeName == 'span') {
  4710. var inline = $target.children('.' + this._inlineClass);
  4711. inline.children().removeClass('ui-state-disabled');
  4712. }
  4713. this._disabledInputs = $.map(this._disabledInputs,
  4714. function(value) { return (value == target ? null : value); }); // delete entry
  4715. },
  4716. /* Disable the date picker to a jQuery selection.
  4717. @param target element - the target input field or division or span */
  4718. _disableDatepicker: function(target) {
  4719. var $target = $(target);
  4720. var inst = $.data(target, PROP_NAME);
  4721. if (!$target.hasClass(this.markerClassName)) {
  4722. return;
  4723. }
  4724. var nodeName = target.nodeName.toLowerCase();
  4725. if (nodeName == 'input') {
  4726. target.disabled = true;
  4727. inst.trigger.filter('button').
  4728. each(function() { this.disabled = true; }).end().
  4729. filter('img').css({opacity: '0.5', cursor: 'default'});
  4730. }
  4731. else if (nodeName == 'div' || nodeName == 'span') {
  4732. var inline = $target.children('.' + this._inlineClass);
  4733. inline.children().addClass('ui-state-disabled');
  4734. }
  4735. this._disabledInputs = $.map(this._disabledInputs,
  4736. function(value) { return (value == target ? null : value); }); // delete entry
  4737. this._disabledInputs[this._disabledInputs.length] = target;
  4738. },
  4739. /* Is the first field in a jQuery collection disabled as a datepicker?
  4740. @param target element - the target input field or division or span
  4741. @return boolean - true if disabled, false if enabled */
  4742. _isDisabledDatepicker: function(target) {
  4743. if (!target) {
  4744. return false;
  4745. }
  4746. for (var i = 0; i < this._disabledInputs.length; i++) {
  4747. if (this._disabledInputs[i] == target)
  4748. return true;
  4749. }
  4750. return false;
  4751. },
  4752. /* Retrieve the instance data for the target control.
  4753. @param target element - the target input field or division or span
  4754. @return object - the associated instance data
  4755. @throws error if a jQuery problem getting data */
  4756. _getInst: function(target) {
  4757. try {
  4758. return $.data(target, PROP_NAME);
  4759. }
  4760. catch (err) {
  4761. throw 'Missing instance data for this datepicker';
  4762. }
  4763. },
  4764. /* Update or retrieve the settings for a date picker attached to an input field or division.
  4765. @param target element - the target input field or division or span
  4766. @param name object - the new settings to update or
  4767. string - the name of the setting to change or retrieve,
  4768. when retrieving also 'all' for all instance settings or
  4769. 'defaults' for all global defaults
  4770. @param value any - the new value for the setting
  4771. (omit if above is an object or to retrieve a value) */
  4772. _optionDatepicker: function(target, name, value) {
  4773. var inst = this._getInst(target);
  4774. if (arguments.length == 2 && typeof name == 'string') {
  4775. return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) :
  4776. (inst ? (name == 'all' ? $.extend({}, inst.settings) :
  4777. this._get(inst, name)) : null));
  4778. }
  4779. var settings = name || {};
  4780. if (typeof name == 'string') {
  4781. settings = {};
  4782. settings[name] = value;
  4783. }
  4784. if (inst) {
  4785. if (this._curInst == inst) {
  4786. this._hideDatepicker(null);
  4787. }
  4788. var date = this._getDateDatepicker(target);
  4789. extendRemove(inst.settings, settings);
  4790. this._setDateDatepicker(target, date);
  4791. this._updateDatepicker(inst);
  4792. }
  4793. },
  4794. // change method deprecated
  4795. _changeDatepicker: function(target, name, value) {
  4796. this._optionDatepicker(target, name, value);
  4797. },
  4798. /* Redraw the date picker attached to an input field or division.
  4799. @param target element - the target input field or division or span */
  4800. _refreshDatepicker: function(target) {
  4801. var inst = this._getInst(target);
  4802. if (inst) {
  4803. this._updateDatepicker(inst);
  4804. }
  4805. },
  4806. /* Set the dates for a jQuery selection.
  4807. @param target element - the target input field or division or span
  4808. @param date Date - the new date
  4809. @param endDate Date - the new end date for a range (optional) */
  4810. _setDateDatepicker: function(target, date, endDate) {
  4811. var inst = this._getInst(target);
  4812. if (inst) {
  4813. this._setDate(inst, date, endDate);
  4814. this._updateDatepicker(inst);
  4815. this._updateAlternate(inst);
  4816. }
  4817. },
  4818. /* Get the date(s) for the first entry in a jQuery selection.
  4819. @param target element - the target input field or division or span
  4820. @return Date - the current date or
  4821. Date[2] - the current dates for a range */
  4822. _getDateDatepicker: function(target) {
  4823. var inst = this._getInst(target);
  4824. if (inst && !inst.inline)
  4825. this._setDateFromField(inst);
  4826. return (inst ? this._getDate(inst) : null);
  4827. },
  4828. /* Handle keystrokes. */
  4829. _doKeyDown: function(event) {
  4830. var inst = $.datepicker._getInst(event.target);
  4831. var handled = true;
  4832. var isRTL = inst.dpDiv.is('.ui-datepicker-rtl');
  4833. inst._keyEvent = true;
  4834. if ($.datepicker._datepickerShowing)
  4835. switch (event.keyCode) {
  4836. case 9: $.datepicker._hideDatepicker(null, '');
  4837. break; // hide on tab out
  4838. case 13: var sel = $('td.' + $.datepicker._dayOverClass +
  4839. ', td.' + $.datepicker._currentClass, inst.dpDiv);
  4840. if (sel[0])
  4841. $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
  4842. else
  4843. $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration'));
  4844. return false; // don't submit the form
  4845. break; // select the value on enter
  4846. case 27: $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration'));
  4847. break; // hide on escape
  4848. case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  4849. -$.datepicker._get(inst, 'stepBigMonths') :
  4850. -$.datepicker._get(inst, 'stepMonths')), 'M');
  4851. break; // previous month/year on page up/+ ctrl
  4852. case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  4853. +$.datepicker._get(inst, 'stepBigMonths') :
  4854. +$.datepicker._get(inst, 'stepMonths')), 'M');
  4855. break; // next month/year on page down/+ ctrl
  4856. case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target);
  4857. handled = event.ctrlKey || event.metaKey;
  4858. break; // clear on ctrl or command +end
  4859. case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target);
  4860. handled = event.ctrlKey || event.metaKey;
  4861. break; // current on ctrl or command +home
  4862. case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D');
  4863. handled = event.ctrlKey || event.metaKey;
  4864. // -1 day on ctrl or command +left
  4865. if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  4866. -$.datepicker._get(inst, 'stepBigMonths') :
  4867. -$.datepicker._get(inst, 'stepMonths')), 'M');
  4868. // next month/year on alt +left on Mac
  4869. break;
  4870. case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D');
  4871. handled = event.ctrlKey || event.metaKey;
  4872. break; // -1 week on ctrl or command +up
  4873. case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D');
  4874. handled = event.ctrlKey || event.metaKey;
  4875. // +1 day on ctrl or command +right
  4876. if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  4877. +$.datepicker._get(inst, 'stepBigMonths') :
  4878. +$.datepicker._get(inst, 'stepMonths')), 'M');
  4879. // next month/year on alt +right
  4880. break;
  4881. case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D');
  4882. handled = event.ctrlKey || event.metaKey;
  4883. break; // +1 week on ctrl or command +down
  4884. default: handled = false;
  4885. }
  4886. else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home
  4887. $.datepicker._showDatepicker(this);
  4888. else {
  4889. handled = false;
  4890. }
  4891. if (handled) {
  4892. event.preventDefault();
  4893. event.stopPropagation();
  4894. }
  4895. },
  4896. /* Filter entered characters - based on date format. */
  4897. _doKeyPress: function(event) {
  4898. var inst = $.datepicker._getInst(event.target);
  4899. if ($.datepicker._get(inst, 'constrainInput')) {
  4900. var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
  4901. var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
  4902. return event.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
  4903. }
  4904. },
  4905. /* Pop-up the date picker for a given input field.
  4906. @param input element - the input field attached to the date picker or
  4907. event - if triggered by focus */
  4908. _showDatepicker: function(input) {
  4909. input = input.target || input;
  4910. if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
  4911. input = $('input', input.parentNode)[0];
  4912. if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
  4913. return;
  4914. var inst = $.datepicker._getInst(input);
  4915. var beforeShow = $.datepicker._get(inst, 'beforeShow');
  4916. extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
  4917. $.datepicker._hideDatepicker(null, '');
  4918. $.datepicker._lastInput = input;
  4919. $.datepicker._setDateFromField(inst);
  4920. if ($.datepicker._inDialog) // hide cursor
  4921. input.value = '';
  4922. if (!$.datepicker._pos) { // position below input
  4923. $.datepicker._pos = $.datepicker._findPos(input);
  4924. $.datepicker._pos[1] += input.offsetHeight; // add the height
  4925. }
  4926. var isFixed = false;
  4927. $(input).parents().each(function() {
  4928. isFixed |= $(this).css('position') == 'fixed';
  4929. return !isFixed;
  4930. });
  4931. if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled
  4932. $.datepicker._pos[0] -= document.documentElement.scrollLeft;
  4933. $.datepicker._pos[1] -= document.documentElement.scrollTop;
  4934. }
  4935. var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
  4936. $.datepicker._pos = null;
  4937. inst.rangeStart = null;
  4938. // determine sizing offscreen
  4939. inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
  4940. $.datepicker._updateDatepicker(inst);
  4941. // fix width for dynamic number of date pickers
  4942. // and adjust position before showing
  4943. offset = $.datepicker._checkOffset(inst, offset, isFixed);
  4944. inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
  4945. 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
  4946. left: offset.left + 'px', top: offset.top + 'px'});
  4947. if (!inst.inline) {
  4948. var showAnim = $.datepicker._get(inst, 'showAnim') || 'show';
  4949. var duration = $.datepicker._get(inst, 'duration');
  4950. var postProcess = function() {
  4951. $.datepicker._datepickerShowing = true;
  4952. if ($.browser.msie && parseInt($.browser.version,10) < 7) // fix IE < 7 select problems
  4953. $('iframe.ui-datepicker-cover').css({width: inst.dpDiv.width() + 4,
  4954. height: inst.dpDiv.height() + 4});
  4955. };
  4956. if ($.effects && $.effects[showAnim])
  4957. inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
  4958. else
  4959. inst.dpDiv[showAnim](duration, postProcess);
  4960. if (duration == '')
  4961. postProcess();
  4962. if (inst.input[0].type != 'hidden')
  4963. inst.input[0].focus();
  4964. $.datepicker._curInst = inst;
  4965. }
  4966. },
  4967. /* Generate the date picker content. */
  4968. _updateDatepicker: function(inst) {
  4969. var dims = {width: inst.dpDiv.width() + 4,
  4970. height: inst.dpDiv.height() + 4};
  4971. var self = this;
  4972. inst.dpDiv.empty().append(this._generateHTML(inst))
  4973. .find('iframe.ui-datepicker-cover').
  4974. css({width: dims.width, height: dims.height})
  4975. .end()
  4976. .find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a')
  4977. .bind('mouseout', function(){
  4978. $(this).removeClass('ui-state-hover');
  4979. if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');
  4980. if(this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover');
  4981. })
  4982. .bind('mouseover', function(){
  4983. if (!self._isDisabledDatepicker( inst.inline ? inst.dpDiv.parent()[0] : inst.input[0])) {
  4984. $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
  4985. $(this).addClass('ui-state-hover');
  4986. if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover');
  4987. if(this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover');
  4988. }
  4989. })
  4990. .end()
  4991. .find('.' + this._dayOverClass + ' a')
  4992. .trigger('mouseover')
  4993. .end();
  4994. var numMonths = this._getNumberOfMonths(inst);
  4995. var cols = numMonths[1];
  4996. var width = 17;
  4997. if (cols > 1) {
  4998. inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
  4999. } else {
  5000. inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
  5001. }
  5002. inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
  5003. 'Class']('ui-datepicker-multi');
  5004. inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
  5005. 'Class']('ui-datepicker-rtl');
  5006. if (inst.input && inst.input[0].type != 'hidden' && inst == $.datepicker._curInst)
  5007. $(inst.input[0]).focus();
  5008. },
  5009. /* Check positioning to remain on screen. */
  5010. _checkOffset: function(inst, offset, isFixed) {
  5011. var dpWidth = inst.dpDiv.outerWidth();
  5012. var dpHeight = inst.dpDiv.outerHeight();
  5013. var inputWidth = inst.input ? inst.input.outerWidth() : 0;
  5014. var inputHeight = inst.input ? inst.input.outerHeight() : 0;
  5015. var viewWidth = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) + $(document).scrollLeft();
  5016. var viewHeight = (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight) + $(document).scrollTop();
  5017. offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
  5018. offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
  5019. offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
  5020. // now check if datepicker is showing outside window viewport - move to a better place if so.
  5021. offset.left -= (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? Math.abs(offset.left + dpWidth - viewWidth) : 0;
  5022. offset.top -= (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? Math.abs(offset.top + dpHeight + inputHeight*2 - viewHeight) : 0;
  5023. return offset;
  5024. },
  5025. /* Find an object's position on the screen. */
  5026. _findPos: function(obj) {
  5027. while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
  5028. obj = obj.nextSibling;
  5029. }
  5030. var position = $(obj).offset();
  5031. return [position.left, position.top];
  5032. },
  5033. /* Hide the date picker from view.
  5034. @param input element - the input field attached to the date picker
  5035. @param duration string - the duration over which to close the date picker */
  5036. _hideDatepicker: function(input, duration) {
  5037. var inst = this._curInst;
  5038. if (!inst || (input && inst != $.data(input, PROP_NAME)))
  5039. return;
  5040. if (inst.stayOpen)
  5041. this._selectDate('#' + inst.id, this._formatDate(inst,
  5042. inst.currentDay, inst.currentMonth, inst.currentYear));
  5043. inst.stayOpen = false;
  5044. if (this._datepickerShowing) {
  5045. duration = (duration != null ? duration : this._get(inst, 'duration'));
  5046. var showAnim = this._get(inst, 'showAnim');
  5047. var postProcess = function() {
  5048. $.datepicker._tidyDialog(inst);
  5049. };
  5050. if (duration != '' && $.effects && $.effects[showAnim])
  5051. inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'),
  5052. duration, postProcess);
  5053. else
  5054. inst.dpDiv[(duration == '' ? 'hide' : (showAnim == 'slideDown' ? 'slideUp' :
  5055. (showAnim == 'fadeIn' ? 'fadeOut' : 'hide')))](duration, postProcess);
  5056. if (duration == '')
  5057. this._tidyDialog(inst);
  5058. var onClose = this._get(inst, 'onClose');
  5059. if (onClose)
  5060. onClose.apply((inst.input ? inst.input[0] : null),
  5061. [(inst.input ? inst.input.val() : ''), inst]); // trigger custom callback
  5062. this._datepickerShowing = false;
  5063. this._lastInput = null;
  5064. if (this._inDialog) {
  5065. this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
  5066. if ($.blockUI) {
  5067. $.unblockUI();
  5068. $('body').append(this.dpDiv);
  5069. }
  5070. }
  5071. this._inDialog = false;
  5072. }
  5073. this._curInst = null;
  5074. },
  5075. /* Tidy up after a dialog display. */
  5076. _tidyDialog: function(inst) {
  5077. inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');
  5078. },
  5079. /* Close date picker if clicked elsewhere. */
  5080. _checkExternalClick: function(event) {
  5081. if (!$.datepicker._curInst)
  5082. return;
  5083. var $target = $(event.target);
  5084. if (($target.parents('#' + $.datepicker._mainDivId).length == 0) &&
  5085. !$target.hasClass($.datepicker.markerClassName) &&
  5086. !$target.hasClass($.datepicker._triggerClass) &&
  5087. $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))
  5088. $.datepicker._hideDatepicker(null, '');
  5089. },
  5090. /* Adjust one of the date sub-fields. */
  5091. _adjustDate: function(id, offset, period) {
  5092. var target = $(id);
  5093. var inst = this._getInst(target[0]);
  5094. if (this._isDisabledDatepicker(target[0])) {
  5095. return;
  5096. }
  5097. this._adjustInstDate(inst, offset +
  5098. (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning
  5099. period);
  5100. this._updateDatepicker(inst);
  5101. },
  5102. /* Action for current link. */
  5103. _gotoToday: function(id) {
  5104. var target = $(id);
  5105. var inst = this._getInst(target[0]);
  5106. if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
  5107. inst.selectedDay = inst.currentDay;
  5108. inst.drawMonth = inst.selectedMonth = inst.currentMonth;
  5109. inst.drawYear = inst.selectedYear = inst.currentYear;
  5110. }
  5111. else {
  5112. var date = new Date();
  5113. inst.selectedDay = date.getDate();
  5114. inst.drawMonth = inst.selectedMonth = date.getMonth();
  5115. inst.drawYear = inst.selectedYear = date.getFullYear();
  5116. }
  5117. this._notifyChange(inst);
  5118. this._adjustDate(target);
  5119. },
  5120. /* Action for selecting a new month/year. */
  5121. _selectMonthYear: function(id, select, period) {
  5122. var target = $(id);
  5123. var inst = this._getInst(target[0]);
  5124. inst._selectingMonthYear = false;
  5125. inst['selected' + (period == 'M' ? 'Month' : 'Year')] =
  5126. inst['draw' + (period == 'M' ? 'Month' : 'Year')] =
  5127. parseInt(select.options[select.selectedIndex].value,10);
  5128. this._notifyChange(inst);
  5129. this._adjustDate(target);
  5130. },
  5131. /* Restore input focus after not changing month/year. */
  5132. _clickMonthYear: function(id) {
  5133. var target = $(id);
  5134. var inst = this._getInst(target[0]);
  5135. if (inst.input && inst._selectingMonthYear && !$.browser.msie)
  5136. inst.input[0].focus();
  5137. inst._selectingMonthYear = !inst._selectingMonthYear;
  5138. },
  5139. /* Action for selecting a day. */
  5140. _selectDay: function(id, month, year, td) {
  5141. var target = $(id);
  5142. if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
  5143. return;
  5144. }
  5145. var inst = this._getInst(target[0]);
  5146. inst.selectedDay = inst.currentDay = $('a', td).html();
  5147. inst.selectedMonth = inst.currentMonth = month;
  5148. inst.selectedYear = inst.currentYear = year;
  5149. if (inst.stayOpen) {
  5150. inst.endDay = inst.endMonth = inst.endYear = null;
  5151. }
  5152. this._selectDate(id, this._formatDate(inst,
  5153. inst.currentDay, inst.currentMonth, inst.currentYear));
  5154. if (inst.stayOpen) {
  5155. inst.rangeStart = this._daylightSavingAdjust(
  5156. new Date(inst.currentYear, inst.currentMonth, inst.currentDay));
  5157. this._updateDatepicker(inst);
  5158. }
  5159. },
  5160. /* Erase the input field and hide the date picker. */
  5161. _clearDate: function(id) {
  5162. var target = $(id);
  5163. var inst = this._getInst(target[0]);
  5164. inst.stayOpen = false;
  5165. inst.endDay = inst.endMonth = inst.endYear = inst.rangeStart = null;
  5166. this._selectDate(target, '');
  5167. },
  5168. /* Update the input field with the selected date. */
  5169. _selectDate: function(id, dateStr) {
  5170. var target = $(id);
  5171. var inst = this._getInst(target[0]);
  5172. dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
  5173. if (inst.input)
  5174. inst.input.val(dateStr);
  5175. this._updateAlternate(inst);
  5176. var onSelect = this._get(inst, 'onSelect');
  5177. if (onSelect)
  5178. onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
  5179. else if (inst.input)
  5180. inst.input.trigger('change'); // fire the change event
  5181. if (inst.inline)
  5182. this._updateDatepicker(inst);
  5183. else if (!inst.stayOpen) {
  5184. this._hideDatepicker(null, this._get(inst, 'duration'));
  5185. this._lastInput = inst.input[0];
  5186. if (typeof(inst.input[0]) != 'object')
  5187. inst.input[0].focus(); // restore focus
  5188. this._lastInput = null;
  5189. }
  5190. },
  5191. /* Update any alternate field to synchronise with the main field. */
  5192. _updateAlternate: function(inst) {
  5193. var altField = this._get(inst, 'altField');
  5194. if (altField) { // update alternate field too
  5195. var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');
  5196. var date = this._getDate(inst);
  5197. dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
  5198. $(altField).each(function() { $(this).val(dateStr); });
  5199. }
  5200. },
  5201. /* Set as beforeShowDay function to prevent selection of weekends.
  5202. @param date Date - the date to customise
  5203. @return [boolean, string] - is this date selectable?, what is its CSS class? */
  5204. noWeekends: function(date) {
  5205. var day = date.getDay();
  5206. return [(day > 0 && day < 6), ''];
  5207. },
  5208. /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
  5209. @param date Date - the date to get the week for
  5210. @return number - the number of the week within the year that contains this date */
  5211. iso8601Week: function(date) {
  5212. var checkDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
  5213. var firstMon = new Date(checkDate.getFullYear(), 1 - 1, 4); // First week always contains 4 Jan
  5214. var firstDay = firstMon.getDay() || 7; // Day of week: Mon = 1, ..., Sun = 7
  5215. firstMon.setDate(firstMon.getDate() + 1 - firstDay); // Preceding Monday
  5216. if (firstDay < 4 && checkDate < firstMon) { // Adjust first three days in year if necessary
  5217. checkDate.setDate(checkDate.getDate() - 3); // Generate for previous year
  5218. return $.datepicker.iso8601Week(checkDate);
  5219. } else if (checkDate > new Date(checkDate.getFullYear(), 12 - 1, 28)) { // Check last three days in year
  5220. firstDay = new Date(checkDate.getFullYear() + 1, 1 - 1, 4).getDay() || 7;
  5221. if (firstDay > 4 && (checkDate.getDay() || 7) < firstDay - 3) { // Adjust if necessary
  5222. return 1;
  5223. }
  5224. }
  5225. return Math.floor(((checkDate - firstMon) / 86400000) / 7) + 1; // Weeks to given date
  5226. },
  5227. /* Parse a string value into a date object.
  5228. See formatDate below for the possible formats.
  5229. @param format string - the expected format of the date
  5230. @param value string - the date in the above format
  5231. @param settings Object - attributes include:
  5232. shortYearCutoff number - the cutoff year for determining the century (optional)
  5233. dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
  5234. dayNames string[7] - names of the days from Sunday (optional)
  5235. monthNamesShort string[12] - abbreviated names of the months (optional)
  5236. monthNames string[12] - names of the months (optional)
  5237. @return Date - the extracted date value or null if value is blank */
  5238. parseDate: function (format, value, settings) {
  5239. if (format == null || value == null)
  5240. throw 'Invalid arguments';
  5241. value = (typeof value == 'object' ? value.toString() : value + '');
  5242. if (value == '')
  5243. return null;
  5244. var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
  5245. var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
  5246. var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
  5247. var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
  5248. var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
  5249. var year = -1;
  5250. var month = -1;
  5251. var day = -1;
  5252. var doy = -1;
  5253. var literal = false;
  5254. // Check whether a format character is doubled
  5255. var lookAhead = function(match) {
  5256. var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
  5257. if (matches)
  5258. iFormat++;
  5259. return matches;
  5260. };
  5261. // Extract a number from the string value
  5262. var getNumber = function(match) {
  5263. lookAhead(match);
  5264. var origSize = (match == '@' ? 14 : (match == 'y' ? 4 : (match == 'o' ? 3 : 2)));
  5265. var size = origSize;
  5266. var num = 0;
  5267. while (size > 0 && iValue < value.length &&
  5268. value.charAt(iValue) >= '0' && value.charAt(iValue) <= '9') {
  5269. num = num * 10 + parseInt(value.charAt(iValue++),10);
  5270. size--;
  5271. }
  5272. if (size == origSize)
  5273. throw 'Missing number at position ' + iValue;
  5274. return num;
  5275. };
  5276. // Extract a name from the string value and convert to an index
  5277. var getName = function(match, shortNames, longNames) {
  5278. var names = (lookAhead(match) ? longNames : shortNames);
  5279. var size = 0;
  5280. for (var j = 0; j < names.length; j++)
  5281. size = Math.max(size, names[j].length);
  5282. var name = '';
  5283. var iInit = iValue;
  5284. while (size > 0 && iValue < value.length) {
  5285. name += value.charAt(iValue++);
  5286. for (var i = 0; i < names.length; i++)
  5287. if (name == names[i])
  5288. return i + 1;
  5289. size--;
  5290. }
  5291. throw 'Unknown name at position ' + iInit;
  5292. };
  5293. // Confirm that a literal character matches the string value
  5294. var checkLiteral = function() {
  5295. if (value.charAt(iValue) != format.charAt(iFormat))
  5296. throw 'Unexpected literal at position ' + iValue;
  5297. iValue++;
  5298. };
  5299. var iValue = 0;
  5300. for (var iFormat = 0; iFormat < format.length; iFormat++) {
  5301. if (literal)
  5302. if (format.charAt(iFormat) == "'" && !lookAhead("'"))
  5303. literal = false;
  5304. else
  5305. checkLiteral();
  5306. else
  5307. switch (format.charAt(iFormat)) {
  5308. case 'd':
  5309. day = getNumber('d');
  5310. break;
  5311. case 'D':
  5312. getName('D', dayNamesShort, dayNames);
  5313. break;
  5314. case 'o':
  5315. doy = getNumber('o');
  5316. break;
  5317. case 'm':
  5318. month = getNumber('m');
  5319. break;
  5320. case 'M':
  5321. month = getName('M', monthNamesShort, monthNames);
  5322. break;
  5323. case 'y':
  5324. year = getNumber('y');
  5325. break;
  5326. case '@':
  5327. var date = new Date(getNumber('@'));
  5328. year = date.getFullYear();
  5329. month = date.getMonth() + 1;
  5330. day = date.getDate();
  5331. break;
  5332. case "'":
  5333. if (lookAhead("'"))
  5334. checkLiteral();
  5335. else
  5336. literal = true;
  5337. break;
  5338. default:
  5339. checkLiteral();
  5340. }
  5341. }
  5342. if (year == -1)
  5343. year = new Date().getFullYear();
  5344. else if (year < 100)
  5345. year += new Date().getFullYear() - new Date().getFullYear() % 100 +
  5346. (year <= shortYearCutoff ? 0 : -100);
  5347. if (doy > -1) {
  5348. month = 1;
  5349. day = doy;
  5350. do {
  5351. var dim = this._getDaysInMonth(year, month - 1);
  5352. if (day <= dim)
  5353. break;
  5354. month++;
  5355. day -= dim;
  5356. } while (true);
  5357. }
  5358. var date = this._daylightSavingAdjust(new Date(year, month - 1, day));
  5359. if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)
  5360. throw 'Invalid date'; // E.g. 31/02/*
  5361. return date;
  5362. },
  5363. /* Standard date formats. */
  5364. ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
  5365. COOKIE: 'D, dd M yy',
  5366. ISO_8601: 'yy-mm-dd',
  5367. RFC_822: 'D, d M y',
  5368. RFC_850: 'DD, dd-M-y',
  5369. RFC_1036: 'D, d M y',
  5370. RFC_1123: 'D, d M yy',
  5371. RFC_2822: 'D, d M yy',
  5372. RSS: 'D, d M y', // RFC 822
  5373. TIMESTAMP: '@',
  5374. W3C: 'yy-mm-dd', // ISO 8601
  5375. /* Format a date object into a string value.
  5376. The format can be combinations of the following:
  5377. d - day of month (no leading zero)
  5378. dd - day of month (two digit)
  5379. o - day of year (no leading zeros)
  5380. oo - day of year (three digit)
  5381. D - day name short
  5382. DD - day name long
  5383. m - month of year (no leading zero)
  5384. mm - month of year (two digit)
  5385. M - month name short
  5386. MM - month name long
  5387. y - year (two digit)
  5388. yy - year (four digit)
  5389. @ - Unix timestamp (ms since 01/01/1970)
  5390. '...' - literal text
  5391. '' - single quote
  5392. @param format string - the desired format of the date
  5393. @param date Date - the date value to format
  5394. @param settings Object - attributes include:
  5395. dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
  5396. dayNames string[7] - names of the days from Sunday (optional)
  5397. monthNamesShort string[12] - abbreviated names of the months (optional)
  5398. monthNames string[12] - names of the months (optional)
  5399. @return string - the date in the above format */
  5400. formatDate: function (format, date, settings) {
  5401. if (!date)
  5402. return '';
  5403. var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
  5404. var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
  5405. var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
  5406. var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
  5407. // Check whether a format character is doubled
  5408. var lookAhead = function(match) {
  5409. var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
  5410. if (matches)
  5411. iFormat++;
  5412. return matches;
  5413. };
  5414. // Format a number, with leading zero if necessary
  5415. var formatNumber = function(match, value, len) {
  5416. var num = '' + value;
  5417. if (lookAhead(match))
  5418. while (num.length < len)
  5419. num = '0' + num;
  5420. return num;
  5421. };
  5422. // Format a name, short or long as requested
  5423. var formatName = function(match, value, shortNames, longNames) {
  5424. return (lookAhead(match) ? longNames[value] : shortNames[value]);
  5425. };
  5426. var output = '';
  5427. var literal = false;
  5428. if (date)
  5429. for (var iFormat = 0; iFormat < format.length; iFormat++) {
  5430. if (literal)
  5431. if (format.charAt(iFormat) == "'" && !lookAhead("'"))
  5432. literal = false;
  5433. else
  5434. output += format.charAt(iFormat);
  5435. else
  5436. switch (format.charAt(iFormat)) {
  5437. case 'd':
  5438. output += formatNumber('d', date.getDate(), 2);
  5439. break;
  5440. case 'D':
  5441. output += formatName('D', date.getDay(), dayNamesShort, dayNames);
  5442. break;
  5443. case 'o':
  5444. var doy = date.getDate();
  5445. for (var m = date.getMonth() - 1; m >= 0; m--)
  5446. doy += this._getDaysInMonth(date.getFullYear(), m);
  5447. output += formatNumber('o', doy, 3);
  5448. break;
  5449. case 'm':
  5450. output += formatNumber('m', date.getMonth() + 1, 2);
  5451. break;
  5452. case 'M':
  5453. output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
  5454. break;
  5455. case 'y':
  5456. output += (lookAhead('y') ? date.getFullYear() :
  5457. (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
  5458. break;
  5459. case '@':
  5460. output += date.getTime();
  5461. break;
  5462. case "'":
  5463. if (lookAhead("'"))
  5464. output += "'";
  5465. else
  5466. literal = true;
  5467. break;
  5468. default:
  5469. output += format.charAt(iFormat);
  5470. }
  5471. }
  5472. return output;
  5473. },
  5474. /* Extract all possible characters from the date format. */
  5475. _possibleChars: function (format) {
  5476. var chars = '';
  5477. var literal = false;
  5478. for (var iFormat = 0; iFormat < format.length; iFormat++)
  5479. if (literal)
  5480. if (format.charAt(iFormat) == "'" && !lookAhead("'"))
  5481. literal = false;
  5482. else
  5483. chars += format.charAt(iFormat);
  5484. else
  5485. switch (format.charAt(iFormat)) {
  5486. case 'd': case 'm': case 'y': case '@':
  5487. chars += '0123456789';
  5488. break;
  5489. case 'D': case 'M':
  5490. return null; // Accept anything
  5491. case "'":
  5492. if (lookAhead("'"))
  5493. chars += "'";
  5494. else
  5495. literal = true;
  5496. break;
  5497. default:
  5498. chars += format.charAt(iFormat);
  5499. }
  5500. return chars;
  5501. },
  5502. /* Get a setting value, defaulting if necessary. */
  5503. _get: function(inst, name) {
  5504. return inst.settings[name] !== undefined ?
  5505. inst.settings[name] : this._defaults[name];
  5506. },
  5507. /* Parse existing date and initialise date picker. */
  5508. _setDateFromField: function(inst) {
  5509. var dateFormat = this._get(inst, 'dateFormat');
  5510. var dates = inst.input ? inst.input.val() : null;
  5511. inst.endDay = inst.endMonth = inst.endYear = null;
  5512. var date = defaultDate = this._getDefaultDate(inst);
  5513. var settings = this._getFormatConfig(inst);
  5514. try {
  5515. date = this.parseDate(dateFormat, dates, settings) || defaultDate;
  5516. } catch (event) {
  5517. this.log(event);
  5518. date = defaultDate;
  5519. }
  5520. inst.selectedDay = date.getDate();
  5521. inst.drawMonth = inst.selectedMonth = date.getMonth();
  5522. inst.drawYear = inst.selectedYear = date.getFullYear();
  5523. inst.currentDay = (dates ? date.getDate() : 0);
  5524. inst.currentMonth = (dates ? date.getMonth() : 0);
  5525. inst.currentYear = (dates ? date.getFullYear() : 0);
  5526. this._adjustInstDate(inst);
  5527. },
  5528. /* Retrieve the default date shown on opening. */
  5529. _getDefaultDate: function(inst) {
  5530. var date = this._determineDate(this._get(inst, 'defaultDate'), new Date());
  5531. var minDate = this._getMinMaxDate(inst, 'min', true);
  5532. var maxDate = this._getMinMaxDate(inst, 'max');
  5533. date = (minDate && date < minDate ? minDate : date);
  5534. date = (maxDate && date > maxDate ? maxDate : date);
  5535. return date;
  5536. },
  5537. /* A date may be specified as an exact value or a relative one. */
  5538. _determineDate: function(date, defaultDate) {
  5539. var offsetNumeric = function(offset) {
  5540. var date = new Date();
  5541. date.setDate(date.getDate() + offset);
  5542. return date;
  5543. };
  5544. var offsetString = function(offset, getDaysInMonth) {
  5545. var date = new Date();
  5546. var year = date.getFullYear();
  5547. var month = date.getMonth();
  5548. var day = date.getDate();
  5549. var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
  5550. var matches = pattern.exec(offset);
  5551. while (matches) {
  5552. switch (matches[2] || 'd') {
  5553. case 'd' : case 'D' :
  5554. day += parseInt(matches[1],10); break;
  5555. case 'w' : case 'W' :
  5556. day += parseInt(matches[1],10) * 7; break;
  5557. case 'm' : case 'M' :
  5558. month += parseInt(matches[1],10);
  5559. day = Math.min(day, getDaysInMonth(year, month));
  5560. break;
  5561. case 'y': case 'Y' :
  5562. year += parseInt(matches[1],10);
  5563. day = Math.min(day, getDaysInMonth(year, month));
  5564. break;
  5565. }
  5566. matches = pattern.exec(offset);
  5567. }
  5568. return new Date(year, month, day);
  5569. };
  5570. date = (date == null ? defaultDate :
  5571. (typeof date == 'string' ? offsetString(date, this._getDaysInMonth) :
  5572. (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : date)));
  5573. date = (date && date.toString() == 'Invalid Date' ? defaultDate : date);
  5574. if (date) {
  5575. date.setHours(0);
  5576. date.setMinutes(0);
  5577. date.setSeconds(0);
  5578. date.setMilliseconds(0);
  5579. }
  5580. return this._daylightSavingAdjust(date);
  5581. },
  5582. /* Handle switch to/from daylight saving.
  5583. Hours may be non-zero on daylight saving cut-over:
  5584. > 12 when midnight changeover, but then cannot generate
  5585. midnight datetime, so jump to 1AM, otherwise reset.
  5586. @param date (Date) the date to check
  5587. @return (Date) the corrected date */
  5588. _daylightSavingAdjust: function(date) {
  5589. if (!date) return null;
  5590. date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
  5591. return date;
  5592. },
  5593. /* Set the date(s) directly. */
  5594. _setDate: function(inst, date, endDate) {
  5595. var clear = !(date);
  5596. var origMonth = inst.selectedMonth;
  5597. var origYear = inst.selectedYear;
  5598. date = this._determineDate(date, new Date());
  5599. inst.selectedDay = inst.currentDay = date.getDate();
  5600. inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth();
  5601. inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear();
  5602. if (origMonth != inst.selectedMonth || origYear != inst.selectedYear)
  5603. this._notifyChange(inst);
  5604. this._adjustInstDate(inst);
  5605. if (inst.input) {
  5606. inst.input.val(clear ? '' : this._formatDate(inst));
  5607. }
  5608. },
  5609. /* Retrieve the date(s) directly. */
  5610. _getDate: function(inst) {
  5611. var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
  5612. this._daylightSavingAdjust(new Date(
  5613. inst.currentYear, inst.currentMonth, inst.currentDay)));
  5614. return startDate;
  5615. },
  5616. /* Generate the HTML for the current state of the date picker. */
  5617. _generateHTML: function(inst) {
  5618. var today = new Date();
  5619. today = this._daylightSavingAdjust(
  5620. new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time
  5621. var isRTL = this._get(inst, 'isRTL');
  5622. var showButtonPanel = this._get(inst, 'showButtonPanel');
  5623. var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
  5624. var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
  5625. var numMonths = this._getNumberOfMonths(inst);
  5626. var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
  5627. var stepMonths = this._get(inst, 'stepMonths');
  5628. var stepBigMonths = this._get(inst, 'stepBigMonths');
  5629. var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
  5630. var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
  5631. new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
  5632. var minDate = this._getMinMaxDate(inst, 'min', true);
  5633. var maxDate = this._getMinMaxDate(inst, 'max');
  5634. var drawMonth = inst.drawMonth - showCurrentAtPos;
  5635. var drawYear = inst.drawYear;
  5636. if (drawMonth < 0) {
  5637. drawMonth += 12;
  5638. drawYear--;
  5639. }
  5640. if (maxDate) {
  5641. var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
  5642. maxDate.getMonth() - numMonths[1] + 1, maxDate.getDate()));
  5643. maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
  5644. while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
  5645. drawMonth--;
  5646. if (drawMonth < 0) {
  5647. drawMonth = 11;
  5648. drawYear--;
  5649. }
  5650. }
  5651. }
  5652. inst.drawMonth = drawMonth;
  5653. inst.drawYear = drawYear;
  5654. var prevText = this._get(inst, 'prevText');
  5655. prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
  5656. this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
  5657. this._getFormatConfig(inst)));
  5658. var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
  5659. '<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' +
  5660. ' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' :
  5661. (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>'));
  5662. var nextText = this._get(inst, 'nextText');
  5663. nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
  5664. this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
  5665. this._getFormatConfig(inst)));
  5666. var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
  5667. '<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' +
  5668. ' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' :
  5669. (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>'));
  5670. var currentText = this._get(inst, 'currentText');
  5671. var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
  5672. currentText = (!navigationAsDateFormat ? currentText :
  5673. this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
  5674. var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery.datepicker._hideDatepicker();">' + this._get(inst, 'closeText') + '</button>' : '');
  5675. var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') +
  5676. (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery.datepicker._gotoToday(\'#' + inst.id + '\');"' +
  5677. '>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
  5678. var firstDay = parseInt(this._get(inst, 'firstDay'),10);
  5679. firstDay = (isNaN(firstDay) ? 0 : firstDay);
  5680. var dayNames = this._get(inst, 'dayNames');
  5681. var dayNamesShort = this._get(inst, 'dayNamesShort');
  5682. var dayNamesMin = this._get(inst, 'dayNamesMin');
  5683. var monthNames = this._get(inst, 'monthNames');
  5684. var monthNamesShort = this._get(inst, 'monthNamesShort');
  5685. var beforeShowDay = this._get(inst, 'beforeShowDay');
  5686. var showOtherMonths = this._get(inst, 'showOtherMonths');
  5687. var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
  5688. var endDate = inst.endDay ? this._daylightSavingAdjust(
  5689. new Date(inst.endYear, inst.endMonth, inst.endDay)) : currentDate;
  5690. var defaultDate = this._getDefaultDate(inst);
  5691. var html = '';
  5692. for (var row = 0; row < numMonths[0]; row++) {
  5693. var group = '';
  5694. for (var col = 0; col < numMonths[1]; col++) {
  5695. var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
  5696. var cornerClass = ' ui-corner-all';
  5697. var calender = '';
  5698. if (isMultiMonth) {
  5699. calender += '<div class="ui-datepicker-group ui-datepicker-group-';
  5700. switch (col) {
  5701. case 0: calender += 'first'; cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;
  5702. case numMonths[1]-1: calender += 'last'; cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;
  5703. default: calender += 'middle'; cornerClass = ''; break;
  5704. }
  5705. calender += '">';
  5706. }
  5707. calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' +
  5708. (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +
  5709. (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +
  5710. this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
  5711. selectedDate, row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
  5712. '</div><table class="ui-datepicker-calendar"><thead>' +
  5713. '<tr>';
  5714. var thead = '';
  5715. for (var dow = 0; dow < 7; dow++) { // days of the week
  5716. var day = (dow + firstDay) % 7;
  5717. thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' +
  5718. '<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>';
  5719. }
  5720. calender += thead + '</tr></thead><tbody>';
  5721. var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
  5722. if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
  5723. inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
  5724. var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
  5725. var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate
  5726. var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
  5727. for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
  5728. calender += '<tr>';
  5729. var tbody = '';
  5730. for (var dow = 0; dow < 7; dow++) { // create date picker days
  5731. var daySettings = (beforeShowDay ?
  5732. beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
  5733. var otherMonth = (printDate.getMonth() != drawMonth);
  5734. var unselectable = otherMonth || !daySettings[0] ||
  5735. (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
  5736. tbody += '<td class="' +
  5737. ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends
  5738. (otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
  5739. ((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key
  5740. (defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ?
  5741. // or defaultDate is current printedDate and defaultDate is selectedDate
  5742. ' ' + this._dayOverClass : '') + // highlight selected day
  5743. (unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable days
  5744. (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
  5745. (printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? // in current range
  5746. ' ' + this._currentClass : '') + // highlight selected day
  5747. (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
  5748. ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
  5749. (unselectable ? '' : ' onclick="DP_jQuery.datepicker._selectDay(\'#' +
  5750. inst.id + '\',' + drawMonth + ',' + drawYear + ', this);return false;"') + '>' + // actions
  5751. (otherMonth ? (showOtherMonths ? printDate.getDate() : '&#xa0;') : // display for other months
  5752. (unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' +
  5753. (printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +
  5754. (printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? // in current range
  5755. ' ui-state-active' : '') + // highlight selected day
  5756. '" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display for this month
  5757. printDate.setDate(printDate.getDate() + 1);
  5758. printDate = this._daylightSavingAdjust(printDate);
  5759. }
  5760. calender += tbody + '</tr>';
  5761. }
  5762. drawMonth++;
  5763. if (drawMonth > 11) {
  5764. drawMonth = 0;
  5765. drawYear++;
  5766. }
  5767. calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
  5768. ((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
  5769. group += calender;
  5770. }
  5771. html += group;
  5772. }
  5773. html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
  5774. '<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : '');
  5775. inst._keyEvent = false;
  5776. return html;
  5777. },
  5778. /* Generate the month and year header. */
  5779. _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
  5780. selectedDate, secondary, monthNames, monthNamesShort) {
  5781. minDate = (inst.rangeStart && minDate && selectedDate < minDate ? selectedDate : minDate);
  5782. var changeMonth = this._get(inst, 'changeMonth');
  5783. var changeYear = this._get(inst, 'changeYear');
  5784. var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');
  5785. var html = '<div class="ui-datepicker-title">';
  5786. var monthHtml = '';
  5787. // month selection
  5788. if (secondary || !changeMonth)
  5789. monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span> ';
  5790. else {
  5791. var inMinYear = (minDate && minDate.getFullYear() == drawYear);
  5792. var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
  5793. monthHtml += '<select class="ui-datepicker-month" ' +
  5794. 'onchange="DP_jQuery.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' +
  5795. 'onclick="DP_jQuery.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
  5796. '>';
  5797. for (var month = 0; month < 12; month++) {
  5798. if ((!inMinYear || month >= minDate.getMonth()) &&
  5799. (!inMaxYear || month <= maxDate.getMonth()))
  5800. monthHtml += '<option value="' + month + '"' +
  5801. (month == drawMonth ? ' selected="selected"' : '') +
  5802. '>' + monthNamesShort[month] + '</option>';
  5803. }
  5804. monthHtml += '</select>';
  5805. }
  5806. if (!showMonthAfterYear)
  5807. html += monthHtml + ((secondary || changeMonth || changeYear) && (!(changeMonth && changeYear)) ? '&#xa0;' : '');
  5808. // year selection
  5809. if (secondary || !changeYear)
  5810. html += '<span class="ui-datepicker-year">' + drawYear + '</span>';
  5811. else {
  5812. // determine range of years to display
  5813. var years = this._get(inst, 'yearRange').split(':');
  5814. var year = 0;
  5815. var endYear = 0;
  5816. if (years.length != 2) {
  5817. year = drawYear - 10;
  5818. endYear = drawYear + 10;
  5819. } else if (years[0].charAt(0) == '+' || years[0].charAt(0) == '-') {
  5820. year = drawYear + parseInt(years[0], 10);
  5821. endYear = drawYear + parseInt(years[1], 10);
  5822. } else {
  5823. year = parseInt(years[0], 10);
  5824. endYear = parseInt(years[1], 10);
  5825. }
  5826. year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
  5827. endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
  5828. html += '<select class="ui-datepicker-year" ' +
  5829. 'onchange="DP_jQuery.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
  5830. 'onclick="DP_jQuery.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
  5831. '>';
  5832. for (; year <= endYear; year++) {
  5833. html += '<option value="' + year + '"' +
  5834. (year == drawYear ? ' selected="selected"' : '') +
  5835. '>' + year + '</option>';
  5836. }
  5837. html += '</select>';
  5838. }
  5839. if (showMonthAfterYear)
  5840. html += (secondary || changeMonth || changeYear ? '&#xa0;' : '') + monthHtml;
  5841. html += '</div>'; // Close datepicker_header
  5842. return html;
  5843. },
  5844. /* Adjust one of the date sub-fields. */
  5845. _adjustInstDate: function(inst, offset, period) {
  5846. var year = inst.drawYear + (period == 'Y' ? offset : 0);
  5847. var month = inst.drawMonth + (period == 'M' ? offset : 0);
  5848. var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
  5849. (period == 'D' ? offset : 0);
  5850. var date = this._daylightSavingAdjust(new Date(year, month, day));
  5851. // ensure it is within the bounds set
  5852. var minDate = this._getMinMaxDate(inst, 'min', true);
  5853. var maxDate = this._getMinMaxDate(inst, 'max');
  5854. date = (minDate && date < minDate ? minDate : date);
  5855. date = (maxDate && date > maxDate ? maxDate : date);
  5856. inst.selectedDay = date.getDate();
  5857. inst.drawMonth = inst.selectedMonth = date.getMonth();
  5858. inst.drawYear = inst.selectedYear = date.getFullYear();
  5859. if (period == 'M' || period == 'Y')
  5860. this._notifyChange(inst);
  5861. },
  5862. /* Notify change of month/year. */
  5863. _notifyChange: function(inst) {
  5864. var onChange = this._get(inst, 'onChangeMonthYear');
  5865. if (onChange)
  5866. onChange.apply((inst.input ? inst.input[0] : null),
  5867. [inst.selectedYear, inst.selectedMonth + 1, inst]);
  5868. },
  5869. /* Determine the number of months to show. */
  5870. _getNumberOfMonths: function(inst) {
  5871. var numMonths = this._get(inst, 'numberOfMonths');
  5872. return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
  5873. },
  5874. /* Determine the current maximum date - ensure no time components are set - may be overridden for a range. */
  5875. _getMinMaxDate: function(inst, minMax, checkRange) {
  5876. var date = this._determineDate(this._get(inst, minMax + 'Date'), null);
  5877. return (!checkRange || !inst.rangeStart ? date :
  5878. (!date || inst.rangeStart > date ? inst.rangeStart : date));
  5879. },
  5880. /* Find the number of days in a given month. */
  5881. _getDaysInMonth: function(year, month) {
  5882. return 32 - new Date(year, month, 32).getDate();
  5883. },
  5884. /* Find the day of the week of the first of a month. */
  5885. _getFirstDayOfMonth: function(year, month) {
  5886. return new Date(year, month, 1).getDay();
  5887. },
  5888. /* Determines if we should allow a "next/prev" month display change. */
  5889. _canAdjustMonth: function(inst, offset, curYear, curMonth) {
  5890. var numMonths = this._getNumberOfMonths(inst);
  5891. var date = this._daylightSavingAdjust(new Date(
  5892. curYear, curMonth + (offset < 0 ? offset : numMonths[1]), 1));
  5893. if (offset < 0)
  5894. date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
  5895. return this._isInRange(inst, date);
  5896. },
  5897. /* Is the given date in the accepted range? */
  5898. _isInRange: function(inst, date) {
  5899. // during range selection, use minimum of selected date and range start
  5900. var newMinDate = (!inst.rangeStart ? null : this._daylightSavingAdjust(
  5901. new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay)));
  5902. newMinDate = (newMinDate && inst.rangeStart < newMinDate ? inst.rangeStart : newMinDate);
  5903. var minDate = newMinDate || this._getMinMaxDate(inst, 'min');
  5904. var maxDate = this._getMinMaxDate(inst, 'max');
  5905. return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate));
  5906. },
  5907. /* Provide the configuration settings for formatting/parsing. */
  5908. _getFormatConfig: function(inst) {
  5909. var shortYearCutoff = this._get(inst, 'shortYearCutoff');
  5910. shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
  5911. new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
  5912. return {shortYearCutoff: shortYearCutoff,
  5913. dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
  5914. monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
  5915. },
  5916. /* Format the given date for display. */
  5917. _formatDate: function(inst, day, month, year) {
  5918. if (!day) {
  5919. inst.currentDay = inst.selectedDay;
  5920. inst.currentMonth = inst.selectedMonth;
  5921. inst.currentYear = inst.selectedYear;
  5922. }
  5923. var date = (day ? (typeof day == 'object' ? day :
  5924. this._daylightSavingAdjust(new Date(year, month, day))) :
  5925. this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
  5926. return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
  5927. }
  5928. });
  5929. /* jQuery extend now ignores nulls! */
  5930. function extendRemove(target, props) {
  5931. $.extend(target, props);
  5932. for (var name in props)
  5933. if (props[name] == null || props[name] == undefined)
  5934. target[name] = props[name];
  5935. return target;
  5936. };
  5937. /* Determine whether an object is an array. */
  5938. function isArray(a) {
  5939. return (a && (($.browser.safari && typeof a == 'object' && a.length) ||
  5940. (a.constructor && a.constructor.toString().match(/\Array\(\)/))));
  5941. };
  5942. /* Invoke the datepicker functionality.
  5943. @param options string - a command, optionally followed by additional parameters or
  5944. Object - settings for attaching new datepicker functionality
  5945. @return jQuery object */
  5946. $.fn.datepicker = function(options){
  5947. /* Initialise the date picker. */
  5948. if (!$.datepicker.initialized) {
  5949. $(document).mousedown($.datepicker._checkExternalClick).
  5950. find('body').append($.datepicker.dpDiv);
  5951. $.datepicker.initialized = true;
  5952. }
  5953. var otherArgs = Array.prototype.slice.call(arguments, 1);
  5954. if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate'))
  5955. return $.datepicker['_' + options + 'Datepicker'].
  5956. apply($.datepicker, [this[0]].concat(otherArgs));
  5957. if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
  5958. return $.datepicker['_' + options + 'Datepicker'].
  5959. apply($.datepicker, [this[0]].concat(otherArgs));
  5960. return this.each(function() {
  5961. typeof options == 'string' ?
  5962. $.datepicker['_' + options + 'Datepicker'].
  5963. apply($.datepicker, [this].concat(otherArgs)) :
  5964. $.datepicker._attachDatepicker(this, options);
  5965. });
  5966. };
  5967. $.datepicker = new Datepicker(); // singleton instance
  5968. $.datepicker.initialized = false;
  5969. $.datepicker.uuid = new Date().getTime();
  5970. $.datepicker.version = "1.7.2";
  5971. // Workaround for #4055
  5972. // Add another global to avoid noConflict issues with inline event handlers
  5973. window.DP_jQuery = $;
  5974. })(jQuery);
  5975. /*
  5976. * jQuery UI Dialog 1.7.2
  5977. *
  5978. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  5979. * Dual licensed under the MIT (MIT-LICENSE.txt)
  5980. * and GPL (GPL-LICENSE.txt) licenses.
  5981. *
  5982. * http://docs.jquery.com/UI/Dialog
  5983. *
  5984. * Depends:
  5985. * ui.core.js
  5986. * ui.draggable.js
  5987. * ui.resizable.js
  5988. */
  5989. (function($) {
  5990. var setDataSwitch = {
  5991. dragStart: "start.draggable",
  5992. drag: "drag.draggable",
  5993. dragStop: "stop.draggable",
  5994. maxHeight: "maxHeight.resizable",
  5995. minHeight: "minHeight.resizable",
  5996. maxWidth: "maxWidth.resizable",
  5997. minWidth: "minWidth.resizable",
  5998. resizeStart: "start.resizable",
  5999. resize: "drag.resizable",
  6000. resizeStop: "stop.resizable"
  6001. },
  6002. uiDialogClasses =
  6003. 'ui-dialog ' +
  6004. 'ui-widget ' +
  6005. 'ui-widget-content ' +
  6006. 'ui-corner-all ';
  6007. $.widget("ui.dialog", {
  6008. _init: function() {
  6009. this.originalTitle = this.element.attr('title');
  6010. var self = this,
  6011. options = this.options,
  6012. title = options.title || this.originalTitle || '&nbsp;',
  6013. titleId = $.ui.dialog.getTitleId(this.element),
  6014. uiDialog = (this.uiDialog = $('<div/>'))
  6015. .appendTo(document.body)
  6016. .hide()
  6017. .addClass(uiDialogClasses + options.dialogClass)
  6018. .css({
  6019. position: 'absolute',
  6020. overflow: 'hidden',
  6021. zIndex: options.zIndex
  6022. })
  6023. // setting tabIndex makes the div focusable
  6024. // setting outline to 0 prevents a border on focus in Mozilla
  6025. .attr('tabIndex', -1).css('outline', 0).keydown(function(event) {
  6026. (options.closeOnEscape && event.keyCode
  6027. && event.keyCode == $.ui.keyCode.ESCAPE && self.close(event));
  6028. })
  6029. .attr({
  6030. role: 'dialog',
  6031. 'aria-labelledby': titleId
  6032. })
  6033. .mousedown(function(event) {
  6034. self.moveToTop(false, event);
  6035. }),
  6036. uiDialogContent = this.element
  6037. .show()
  6038. .removeAttr('title')
  6039. .addClass(
  6040. 'ui-dialog-content ' +
  6041. 'ui-widget-content')
  6042. .appendTo(uiDialog),
  6043. uiDialogTitlebar = (this.uiDialogTitlebar = $('<div></div>'))
  6044. .addClass(
  6045. 'ui-dialog-titlebar ' +
  6046. 'ui-widget-header ' +
  6047. 'ui-corner-all ' +
  6048. 'ui-helper-clearfix'
  6049. )
  6050. .prependTo(uiDialog),
  6051. uiDialogTitlebarClose = $('<a href="#"/>')
  6052. .addClass(
  6053. 'ui-dialog-titlebar-close ' +
  6054. 'ui-corner-all'
  6055. )
  6056. .attr('role', 'button')
  6057. .hover(
  6058. function() {
  6059. uiDialogTitlebarClose.addClass('ui-state-hover');
  6060. },
  6061. function() {
  6062. uiDialogTitlebarClose.removeClass('ui-state-hover');
  6063. }
  6064. )
  6065. .focus(function() {
  6066. uiDialogTitlebarClose.addClass('ui-state-focus');
  6067. })
  6068. .blur(function() {
  6069. uiDialogTitlebarClose.removeClass('ui-state-focus');
  6070. })
  6071. .mousedown(function(ev) {
  6072. ev.stopPropagation();
  6073. })
  6074. .click(function(event) {
  6075. self.close(event);
  6076. return false;
  6077. })
  6078. .appendTo(uiDialogTitlebar),
  6079. uiDialogTitlebarCloseText = (this.uiDialogTitlebarCloseText = $('<span/>'))
  6080. .addClass(
  6081. 'ui-icon ' +
  6082. 'ui-icon-closethick'
  6083. )
  6084. .text(options.closeText)
  6085. .appendTo(uiDialogTitlebarClose),
  6086. uiDialogTitle = $('<span/>')
  6087. .addClass('ui-dialog-title')
  6088. .attr('id', titleId)
  6089. .html(title)
  6090. .prependTo(uiDialogTitlebar);
  6091. uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
  6092. (options.draggable && $.fn.draggable && this._makeDraggable());
  6093. (options.resizable && $.fn.resizable && this._makeResizable());
  6094. this._createButtons(options.buttons);
  6095. this._isOpen = false;
  6096. (options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe());
  6097. (options.autoOpen && this.open());
  6098. },
  6099. destroy: function() {
  6100. (this.overlay && this.overlay.destroy());
  6101. this.uiDialog.hide();
  6102. this.element
  6103. .unbind('.dialog')
  6104. .removeData('dialog')
  6105. .removeClass('ui-dialog-content ui-widget-content')
  6106. .hide().appendTo('body');
  6107. this.uiDialog.remove();
  6108. (this.originalTitle && this.element.attr('title', this.originalTitle));
  6109. },
  6110. close: function(event) {
  6111. var self = this;
  6112. if (false === self._trigger('beforeclose', event)) {
  6113. return;
  6114. }
  6115. (self.overlay && self.overlay.destroy());
  6116. self.uiDialog.unbind('keypress.ui-dialog');
  6117. (self.options.hide
  6118. ? self.uiDialog.hide(self.options.hide, function() {
  6119. self._trigger('close', event);
  6120. })
  6121. : self.uiDialog.hide() && self._trigger('close', event));
  6122. $.ui.dialog.overlay.resize();
  6123. self._isOpen = false;
  6124. // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
  6125. if (self.options.modal) {
  6126. var maxZ = 0;
  6127. $('.ui-dialog').each(function() {
  6128. if (this != self.uiDialog[0]) {
  6129. maxZ = Math.max(maxZ, $(this).css('z-index'));
  6130. }
  6131. });
  6132. $.ui.dialog.maxZ = maxZ;
  6133. }
  6134. },
  6135. isOpen: function() {
  6136. return this._isOpen;
  6137. },
  6138. // the force parameter allows us to move modal dialogs to their correct
  6139. // position on open
  6140. moveToTop: function(force, event) {
  6141. if ((this.options.modal && !force)
  6142. || (!this.options.stack && !this.options.modal)) {
  6143. return this._trigger('focus', event);
  6144. }
  6145. if (this.options.zIndex > $.ui.dialog.maxZ) {
  6146. $.ui.dialog.maxZ = this.options.zIndex;
  6147. }
  6148. (this.overlay && this.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = ++$.ui.dialog.maxZ));
  6149. //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
  6150. // http://ui.jquery.com/bugs/ticket/3193
  6151. var saveScroll = { scrollTop: this.element.attr('scrollTop'), scrollLeft: this.element.attr('scrollLeft') };
  6152. this.uiDialog.css('z-index', ++$.ui.dialog.maxZ);
  6153. this.element.attr(saveScroll);
  6154. this._trigger('focus', event);
  6155. },
  6156. open: function() {
  6157. if (this._isOpen) { return; }
  6158. var options = this.options,
  6159. uiDialog = this.uiDialog;
  6160. this.overlay = options.modal ? new $.ui.dialog.overlay(this) : null;
  6161. (uiDialog.next().length && uiDialog.appendTo('body'));
  6162. this._size();
  6163. this._position(options.position);
  6164. uiDialog.show(options.show);
  6165. this.moveToTop(true);
  6166. // prevent tabbing out of modal dialogs
  6167. (options.modal && uiDialog.bind('keypress.ui-dialog', function(event) {
  6168. if (event.keyCode != $.ui.keyCode.TAB) {
  6169. return;
  6170. }
  6171. var tabbables = $(':tabbable', this),
  6172. first = tabbables.filter(':first')[0],
  6173. last = tabbables.filter(':last')[0];
  6174. if (event.target == last && !event.shiftKey) {
  6175. setTimeout(function() {
  6176. first.focus();
  6177. }, 1);
  6178. } else if (event.target == first && event.shiftKey) {
  6179. setTimeout(function() {
  6180. last.focus();
  6181. }, 1);
  6182. }
  6183. }));
  6184. // set focus to the first tabbable element in the content area or the first button
  6185. // if there are no tabbable elements, set focus on the dialog itself
  6186. $([])
  6187. .add(uiDialog.find('.ui-dialog-content :tabbable:first'))
  6188. .add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first'))
  6189. .add(uiDialog)
  6190. .filter(':first')
  6191. .focus();
  6192. this._trigger('open');
  6193. this._isOpen = true;
  6194. },
  6195. _createButtons: function(buttons) {
  6196. var self = this,
  6197. hasButtons = false,
  6198. uiDialogButtonPane = $('<div></div>')
  6199. .addClass(
  6200. 'ui-dialog-buttonpane ' +
  6201. 'ui-widget-content ' +
  6202. 'ui-helper-clearfix'
  6203. );
  6204. // if we already have a button pane, remove it
  6205. this.uiDialog.find('.ui-dialog-buttonpane').remove();
  6206. (typeof buttons == 'object' && buttons !== null &&
  6207. $.each(buttons, function() { return !(hasButtons = true); }));
  6208. if (hasButtons) {
  6209. $.each(buttons, function(name, fn) {
  6210. $('<button type="button"></button>')
  6211. .addClass(
  6212. 'ui-state-default ' +
  6213. 'ui-corner-all'
  6214. )
  6215. .text(name)
  6216. .click(function() { fn.apply(self.element[0], arguments); })
  6217. .hover(
  6218. function() {
  6219. $(this).addClass('ui-state-hover');
  6220. },
  6221. function() {
  6222. $(this).removeClass('ui-state-hover');
  6223. }
  6224. )
  6225. .focus(function() {
  6226. $(this).addClass('ui-state-focus');
  6227. })
  6228. .blur(function() {
  6229. $(this).removeClass('ui-state-focus');
  6230. })
  6231. .appendTo(uiDialogButtonPane);
  6232. });
  6233. uiDialogButtonPane.appendTo(this.uiDialog);
  6234. }
  6235. },
  6236. _makeDraggable: function() {
  6237. var self = this,
  6238. options = this.options,
  6239. heightBeforeDrag;
  6240. this.uiDialog.draggable({
  6241. cancel: '.ui-dialog-content',
  6242. handle: '.ui-dialog-titlebar',
  6243. containment: 'document',
  6244. start: function() {
  6245. heightBeforeDrag = options.height;
  6246. $(this).height($(this).height()).addClass("ui-dialog-dragging");
  6247. (options.dragStart && options.dragStart.apply(self.element[0], arguments));
  6248. },
  6249. drag: function() {
  6250. (options.drag && options.drag.apply(self.element[0], arguments));
  6251. },
  6252. stop: function() {
  6253. $(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);
  6254. (options.dragStop && options.dragStop.apply(self.element[0], arguments));
  6255. $.ui.dialog.overlay.resize();
  6256. }
  6257. });
  6258. },
  6259. _makeResizable: function(handles) {
  6260. handles = (handles === undefined ? this.options.resizable : handles);
  6261. var self = this,
  6262. options = this.options,
  6263. resizeHandles = typeof handles == 'string'
  6264. ? handles
  6265. : 'n,e,s,w,se,sw,ne,nw';
  6266. this.uiDialog.resizable({
  6267. cancel: '.ui-dialog-content',
  6268. alsoResize: this.element,
  6269. maxWidth: options.maxWidth,
  6270. maxHeight: options.maxHeight,
  6271. minWidth: options.minWidth,
  6272. minHeight: options.minHeight,
  6273. start: function() {
  6274. $(this).addClass("ui-dialog-resizing");
  6275. (options.resizeStart && options.resizeStart.apply(self.element[0], arguments));
  6276. },
  6277. resize: function() {
  6278. (options.resize && options.resize.apply(self.element[0], arguments));
  6279. },
  6280. handles: resizeHandles,
  6281. stop: function() {
  6282. $(this).removeClass("ui-dialog-resizing");
  6283. options.height = $(this).height();
  6284. options.width = $(this).width();
  6285. (options.resizeStop && options.resizeStop.apply(self.element[0], arguments));
  6286. $.ui.dialog.overlay.resize();
  6287. }
  6288. })
  6289. .find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');
  6290. },
  6291. _position: function(pos) {
  6292. var wnd = $(window), doc = $(document),
  6293. pTop = doc.scrollTop(), pLeft = doc.scrollLeft(),
  6294. minTop = pTop;
  6295. if ($.inArray(pos, ['center','top','right','bottom','left']) >= 0) {
  6296. pos = [
  6297. pos == 'right' || pos == 'left' ? pos : 'center',
  6298. pos == 'top' || pos == 'bottom' ? pos : 'middle'
  6299. ];
  6300. }
  6301. if (pos.constructor != Array) {
  6302. pos = ['center', 'middle'];
  6303. }
  6304. if (pos[0].constructor == Number) {
  6305. pLeft += pos[0];
  6306. } else {
  6307. switch (pos[0]) {
  6308. case 'left':
  6309. pLeft += 0;
  6310. break;
  6311. case 'right':
  6312. pLeft += wnd.width() - this.uiDialog.outerWidth();
  6313. break;
  6314. default:
  6315. case 'center':
  6316. pLeft += (wnd.width() - this.uiDialog.outerWidth()) / 2;
  6317. }
  6318. }
  6319. if (pos[1].constructor == Number) {
  6320. pTop += pos[1];
  6321. } else {
  6322. switch (pos[1]) {
  6323. case 'top':
  6324. pTop += 0;
  6325. break;
  6326. case 'bottom':
  6327. pTop += wnd.height() - this.uiDialog.outerHeight();
  6328. break;
  6329. default:
  6330. case 'middle':
  6331. pTop += (wnd.height() - this.uiDialog.outerHeight()) / 2;
  6332. }
  6333. }
  6334. // prevent the dialog from being too high (make sure the titlebar
  6335. // is accessible)
  6336. pTop = Math.max(pTop, minTop);
  6337. this.uiDialog.css({top: pTop, left: pLeft});
  6338. },
  6339. _setData: function(key, value){
  6340. (setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value));
  6341. switch (key) {
  6342. case "buttons":
  6343. this._createButtons(value);
  6344. break;
  6345. case "closeText":
  6346. this.uiDialogTitlebarCloseText.text(value);
  6347. break;
  6348. case "dialogClass":
  6349. this.uiDialog
  6350. .removeClass(this.options.dialogClass)
  6351. .addClass(uiDialogClasses + value);
  6352. break;
  6353. case "draggable":
  6354. (value
  6355. ? this._makeDraggable()
  6356. : this.uiDialog.draggable('destroy'));
  6357. break;
  6358. case "height":
  6359. this.uiDialog.height(value);
  6360. break;
  6361. case "position":
  6362. this._position(value);
  6363. break;
  6364. case "resizable":
  6365. var uiDialog = this.uiDialog,
  6366. isResizable = this.uiDialog.is(':data(resizable)');
  6367. // currently resizable, becoming non-resizable
  6368. (isResizable && !value && uiDialog.resizable('destroy'));
  6369. // currently resizable, changing handles
  6370. (isResizable && typeof value == 'string' &&
  6371. uiDialog.resizable('option', 'handles', value));
  6372. // currently non-resizable, becoming resizable
  6373. (isResizable || this._makeResizable(value));
  6374. break;
  6375. case "title":
  6376. $(".ui-dialog-title", this.uiDialogTitlebar).html(value || '&nbsp;');
  6377. break;
  6378. case "width":
  6379. this.uiDialog.width(value);
  6380. break;
  6381. }
  6382. $.widget.prototype._setData.apply(this, arguments);
  6383. },
  6384. _size: function() {
  6385. /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
  6386. * divs will both have width and height set, so we need to reset them
  6387. */
  6388. var options = this.options;
  6389. // reset content sizing
  6390. this.element.css({
  6391. height: 0,
  6392. minHeight: 0,
  6393. width: 'auto'
  6394. });
  6395. // reset wrapper sizing
  6396. // determine the height of all the non-content elements
  6397. var nonContentHeight = this.uiDialog.css({
  6398. height: 'auto',
  6399. width: options.width
  6400. })
  6401. .height();
  6402. this.element
  6403. .css({
  6404. minHeight: Math.max(options.minHeight - nonContentHeight, 0),
  6405. height: options.height == 'auto'
  6406. ? 'auto'
  6407. : Math.max(options.height - nonContentHeight, 0)
  6408. });
  6409. }
  6410. });
  6411. $.extend($.ui.dialog, {
  6412. version: "1.7.2",
  6413. defaults: {
  6414. autoOpen: true,
  6415. bgiframe: false,
  6416. buttons: {},
  6417. closeOnEscape: true,
  6418. closeText: 'close',
  6419. dialogClass: '',
  6420. draggable: true,
  6421. hide: null,
  6422. height: 'auto',
  6423. maxHeight: false,
  6424. maxWidth: false,
  6425. minHeight: 150,
  6426. minWidth: 150,
  6427. modal: false,
  6428. position: 'center',
  6429. resizable: true,
  6430. show: null,
  6431. stack: true,
  6432. title: '',
  6433. width: 300,
  6434. zIndex: 1000
  6435. },
  6436. getter: 'isOpen',
  6437. uuid: 0,
  6438. maxZ: 0,
  6439. getTitleId: function($el) {
  6440. return 'ui-dialog-title-' + ($el.attr('id') || ++this.uuid);
  6441. },
  6442. overlay: function(dialog) {
  6443. this.$el = $.ui.dialog.overlay.create(dialog);
  6444. }
  6445. });
  6446. $.extend($.ui.dialog.overlay, {
  6447. instances: [],
  6448. maxZ: 0,
  6449. events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
  6450. function(event) { return event + '.dialog-overlay'; }).join(' '),
  6451. create: function(dialog) {
  6452. if (this.instances.length === 0) {
  6453. // prevent use of anchors and inputs
  6454. // we use a setTimeout in case the overlay is created from an
  6455. // event that we're going to be cancelling (see #2804)
  6456. setTimeout(function() {
  6457. // handle $(el).dialog().dialog('close') (see #4065)
  6458. if ($.ui.dialog.overlay.instances.length) {
  6459. $(document).bind($.ui.dialog.overlay.events, function(event) {
  6460. var dialogZ = $(event.target).parents('.ui-dialog').css('zIndex') || 0;
  6461. return (dialogZ > $.ui.dialog.overlay.maxZ);
  6462. });
  6463. }
  6464. }, 1);
  6465. // allow closing by pressing the escape key
  6466. $(document).bind('keydown.dialog-overlay', function(event) {
  6467. (dialog.options.closeOnEscape && event.keyCode
  6468. && event.keyCode == $.ui.keyCode.ESCAPE && dialog.close(event));
  6469. });
  6470. // handle window resize
  6471. $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
  6472. }
  6473. var $el = $('<div></div>').appendTo(document.body)
  6474. .addClass('ui-widget-overlay').css({
  6475. width: this.width(),
  6476. height: this.height()
  6477. });
  6478. (dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe());
  6479. this.instances.push($el);
  6480. return $el;
  6481. },
  6482. destroy: function($el) {
  6483. this.instances.splice($.inArray(this.instances, $el), 1);
  6484. if (this.instances.length === 0) {
  6485. $([document, window]).unbind('.dialog-overlay');
  6486. }
  6487. $el.remove();
  6488. // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
  6489. var maxZ = 0;
  6490. $.each(this.instances, function() {
  6491. maxZ = Math.max(maxZ, this.css('z-index'));
  6492. });
  6493. this.maxZ = maxZ;
  6494. },
  6495. height: function() {
  6496. // handle IE 6
  6497. if ($.browser.msie && $.browser.version < 7) {
  6498. var scrollHeight = Math.max(
  6499. document.documentElement.scrollHeight,
  6500. document.body.scrollHeight
  6501. );
  6502. var offsetHeight = Math.max(
  6503. document.documentElement.offsetHeight,
  6504. document.body.offsetHeight
  6505. );
  6506. if (scrollHeight < offsetHeight) {
  6507. return $(window).height() + 'px';
  6508. } else {
  6509. return scrollHeight + 'px';
  6510. }
  6511. // handle "good" browsers
  6512. } else {
  6513. return $(document).height() + 'px';
  6514. }
  6515. },
  6516. width: function() {
  6517. // handle IE 6
  6518. if ($.browser.msie && $.browser.version < 7) {
  6519. var scrollWidth = Math.max(
  6520. document.documentElement.scrollWidth,
  6521. document.body.scrollWidth
  6522. );
  6523. var offsetWidth = Math.max(
  6524. document.documentElement.offsetWidth,
  6525. document.body.offsetWidth
  6526. );
  6527. if (scrollWidth < offsetWidth) {
  6528. return $(window).width() + 'px';
  6529. } else {
  6530. return scrollWidth + 'px';
  6531. }
  6532. // handle "good" browsers
  6533. } else {
  6534. return $(document).width() + 'px';
  6535. }
  6536. },
  6537. resize: function() {
  6538. /* If the dialog is draggable and the user drags it past the
  6539. * right edge of the window, the document becomes wider so we
  6540. * need to stretch the overlay. If the user then drags the
  6541. * dialog back to the left, the document will become narrower,
  6542. * so we need to shrink the overlay to the appropriate size.
  6543. * This is handled by shrinking the overlay before setting it
  6544. * to the full document size.
  6545. */
  6546. var $overlays = $([]);
  6547. $.each($.ui.dialog.overlay.instances, function() {
  6548. $overlays = $overlays.add(this);
  6549. });
  6550. $overlays.css({
  6551. width: 0,
  6552. height: 0
  6553. }).css({
  6554. width: $.ui.dialog.overlay.width(),
  6555. height: $.ui.dialog.overlay.height()
  6556. });
  6557. }
  6558. });
  6559. $.extend($.ui.dialog.overlay.prototype, {
  6560. destroy: function() {
  6561. $.ui.dialog.overlay.destroy(this.$el);
  6562. }
  6563. });
  6564. })(jQuery);
  6565. /*
  6566. * jQuery UI Progressbar 1.7.2
  6567. *
  6568. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  6569. * Dual licensed under the MIT (MIT-LICENSE.txt)
  6570. * and GPL (GPL-LICENSE.txt) licenses.
  6571. *
  6572. * http://docs.jquery.com/UI/Progressbar
  6573. *
  6574. * Depends:
  6575. * ui.core.js
  6576. */
  6577. (function($) {
  6578. $.widget("ui.progressbar", {
  6579. _init: function() {
  6580. this.element
  6581. .addClass("ui-progressbar"
  6582. + " ui-widget"
  6583. + " ui-widget-content"
  6584. + " ui-corner-all")
  6585. .attr({
  6586. role: "progressbar",
  6587. "aria-valuemin": this._valueMin(),
  6588. "aria-valuemax": this._valueMax(),
  6589. "aria-valuenow": this._value()
  6590. });
  6591. this.valueDiv = $('<div class="ui-progressbar-value ui-widget-header ui-corner-left"></div>').appendTo(this.element);
  6592. this._refreshValue();
  6593. },
  6594. destroy: function() {
  6595. this.element
  6596. .removeClass("ui-progressbar"
  6597. + " ui-widget"
  6598. + " ui-widget-content"
  6599. + " ui-corner-all")
  6600. .removeAttr("role")
  6601. .removeAttr("aria-valuemin")
  6602. .removeAttr("aria-valuemax")
  6603. .removeAttr("aria-valuenow")
  6604. .removeData("progressbar")
  6605. .unbind(".progressbar");
  6606. this.valueDiv.remove();
  6607. $.widget.prototype.destroy.apply(this, arguments);
  6608. },
  6609. value: function(newValue) {
  6610. if (newValue === undefined) {
  6611. return this._value();
  6612. }
  6613. this._setData('value', newValue);
  6614. return this;
  6615. },
  6616. _setData: function(key, value) {
  6617. switch (key) {
  6618. case 'value':
  6619. this.options.value = value;
  6620. this._refreshValue();
  6621. this._trigger('change', null, {});
  6622. break;
  6623. }
  6624. $.widget.prototype._setData.apply(this, arguments);
  6625. },
  6626. _value: function() {
  6627. var val = this.options.value;
  6628. if (val < this._valueMin()) val = this._valueMin();
  6629. if (val > this._valueMax()) val = this._valueMax();
  6630. return val;
  6631. },
  6632. _valueMin: function() {
  6633. var valueMin = 0;
  6634. return valueMin;
  6635. },
  6636. _valueMax: function() {
  6637. var valueMax = 100;
  6638. return valueMax;
  6639. },
  6640. _refreshValue: function() {
  6641. var value = this.value();
  6642. this.valueDiv[value == this._valueMax() ? 'addClass' : 'removeClass']("ui-corner-right");
  6643. this.valueDiv.width(value + '%');
  6644. this.element.attr("aria-valuenow", value);
  6645. }
  6646. });
  6647. $.extend($.ui.progressbar, {
  6648. version: "1.7.2",
  6649. defaults: {
  6650. value: 0
  6651. }
  6652. });
  6653. })(jQuery);
  6654. /*
  6655. * jQuery UI Slider 1.7.2
  6656. *
  6657. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  6658. * Dual licensed under the MIT (MIT-LICENSE.txt)
  6659. * and GPL (GPL-LICENSE.txt) licenses.
  6660. *
  6661. * http://docs.jquery.com/UI/Slider
  6662. *
  6663. * Depends:
  6664. * ui.core.js
  6665. */
  6666. (function($) {
  6667. $.widget("ui.slider", $.extend({}, $.ui.mouse, {
  6668. _init: function() {
  6669. var self = this, o = this.options;
  6670. this._keySliding = false;
  6671. this._handleIndex = null;
  6672. this._detectOrientation();
  6673. this._mouseInit();
  6674. this.element
  6675. .addClass("ui-slider"
  6676. + " ui-slider-" + this.orientation
  6677. + " ui-widget"
  6678. + " ui-widget-content"
  6679. + " ui-corner-all");
  6680. this.range = $([]);
  6681. if (o.range) {
  6682. if (o.range === true) {
  6683. this.range = $('<div></div>');
  6684. if (!o.values) o.values = [this._valueMin(), this._valueMin()];
  6685. if (o.values.length && o.values.length != 2) {
  6686. o.values = [o.values[0], o.values[0]];
  6687. }
  6688. } else {
  6689. this.range = $('<div></div>');
  6690. }
  6691. this.range
  6692. .appendTo(this.element)
  6693. .addClass("ui-slider-range");
  6694. if (o.range == "min" || o.range == "max") {
  6695. this.range.addClass("ui-slider-range-" + o.range);
  6696. }
  6697. // note: this isn't the most fittingly semantic framework class for this element,
  6698. // but worked best visually with a variety of themes
  6699. this.range.addClass("ui-widget-header");
  6700. }
  6701. if ($(".ui-slider-handle", this.element).length == 0)
  6702. $('<a href="#"></a>')
  6703. .appendTo(this.element)
  6704. .addClass("ui-slider-handle");
  6705. if (o.values && o.values.length) {
  6706. while ($(".ui-slider-handle", this.element).length < o.values.length)
  6707. $('<a href="#"></a>')
  6708. .appendTo(this.element)
  6709. .addClass("ui-slider-handle");
  6710. }
  6711. this.handles = $(".ui-slider-handle", this.element)
  6712. .addClass("ui-state-default"
  6713. + " ui-corner-all");
  6714. this.handle = this.handles.eq(0);
  6715. this.handles.add(this.range).filter("a")
  6716. .click(function(event) {
  6717. event.preventDefault();
  6718. })
  6719. .hover(function() {
  6720. if (!o.disabled) {
  6721. $(this).addClass('ui-state-hover');
  6722. }
  6723. }, function() {
  6724. $(this).removeClass('ui-state-hover');
  6725. })
  6726. .focus(function() {
  6727. if (!o.disabled) {
  6728. $(".ui-slider .ui-state-focus").removeClass('ui-state-focus'); $(this).addClass('ui-state-focus');
  6729. } else {
  6730. $(this).blur();
  6731. }
  6732. })
  6733. .blur(function() {
  6734. $(this).removeClass('ui-state-focus');
  6735. });
  6736. this.handles.each(function(i) {
  6737. $(this).data("index.ui-slider-handle", i);
  6738. });
  6739. this.handles.keydown(function(event) {
  6740. var ret = true;
  6741. var index = $(this).data("index.ui-slider-handle");
  6742. if (self.options.disabled)
  6743. return;
  6744. switch (event.keyCode) {
  6745. case $.ui.keyCode.HOME:
  6746. case $.ui.keyCode.END:
  6747. case $.ui.keyCode.UP:
  6748. case $.ui.keyCode.RIGHT:
  6749. case $.ui.keyCode.DOWN:
  6750. case $.ui.keyCode.LEFT:
  6751. ret = false;
  6752. if (!self._keySliding) {
  6753. self._keySliding = true;
  6754. $(this).addClass("ui-state-active");
  6755. self._start(event, index);
  6756. }
  6757. break;
  6758. }
  6759. var curVal, newVal, step = self._step();
  6760. if (self.options.values && self.options.values.length) {
  6761. curVal = newVal = self.values(index);
  6762. } else {
  6763. curVal = newVal = self.value();
  6764. }
  6765. switch (event.keyCode) {
  6766. case $.ui.keyCode.HOME:
  6767. newVal = self._valueMin();
  6768. break;
  6769. case $.ui.keyCode.END:
  6770. newVal = self._valueMax();
  6771. break;
  6772. case $.ui.keyCode.UP:
  6773. case $.ui.keyCode.RIGHT:
  6774. if(curVal == self._valueMax()) return;
  6775. newVal = curVal + step;
  6776. break;
  6777. case $.ui.keyCode.DOWN:
  6778. case $.ui.keyCode.LEFT:
  6779. if(curVal == self._valueMin()) return;
  6780. newVal = curVal - step;
  6781. break;
  6782. }
  6783. self._slide(event, index, newVal);
  6784. return ret;
  6785. }).keyup(function(event) {
  6786. var index = $(this).data("index.ui-slider-handle");
  6787. if (self._keySliding) {
  6788. self._stop(event, index);
  6789. self._change(event, index);
  6790. self._keySliding = false;
  6791. $(this).removeClass("ui-state-active");
  6792. }
  6793. });
  6794. this._refreshValue();
  6795. },
  6796. destroy: function() {
  6797. this.handles.remove();
  6798. this.range.remove();
  6799. this.element
  6800. .removeClass("ui-slider"
  6801. + " ui-slider-horizontal"
  6802. + " ui-slider-vertical"
  6803. + " ui-slider-disabled"
  6804. + " ui-widget"
  6805. + " ui-widget-content"
  6806. + " ui-corner-all")
  6807. .removeData("slider")
  6808. .unbind(".slider");
  6809. this._mouseDestroy();
  6810. },
  6811. _mouseCapture: function(event) {
  6812. var o = this.options;
  6813. if (o.disabled)
  6814. return false;
  6815. this.elementSize = {
  6816. width: this.element.outerWidth(),
  6817. height: this.element.outerHeight()
  6818. };
  6819. this.elementOffset = this.element.offset();
  6820. var position = { x: event.pageX, y: event.pageY };
  6821. var normValue = this._normValueFromMouse(position);
  6822. var distance = this._valueMax() - this._valueMin() + 1, closestHandle;
  6823. var self = this, index;
  6824. this.handles.each(function(i) {
  6825. var thisDistance = Math.abs(normValue - self.values(i));
  6826. if (distance > thisDistance) {
  6827. distance = thisDistance;
  6828. closestHandle = $(this);
  6829. index = i;
  6830. }
  6831. });
  6832. // workaround for bug #3736 (if both handles of a range are at 0,
  6833. // the first is always used as the one with least distance,
  6834. // and moving it is obviously prevented by preventing negative ranges)
  6835. if(o.range == true && this.values(1) == o.min) {
  6836. closestHandle = $(this.handles[++index]);
  6837. }
  6838. this._start(event, index);
  6839. self._handleIndex = index;
  6840. closestHandle
  6841. .addClass("ui-state-active")
  6842. .focus();
  6843. var offset = closestHandle.offset();
  6844. var mouseOverHandle = !$(event.target).parents().andSelf().is('.ui-slider-handle');
  6845. this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
  6846. left: event.pageX - offset.left - (closestHandle.width() / 2),
  6847. top: event.pageY - offset.top
  6848. - (closestHandle.height() / 2)
  6849. - (parseInt(closestHandle.css('borderTopWidth'),10) || 0)
  6850. - (parseInt(closestHandle.css('borderBottomWidth'),10) || 0)
  6851. + (parseInt(closestHandle.css('marginTop'),10) || 0)
  6852. };
  6853. normValue = this._normValueFromMouse(position);
  6854. this._slide(event, index, normValue);
  6855. return true;
  6856. },
  6857. _mouseStart: function(event) {
  6858. return true;
  6859. },
  6860. _mouseDrag: function(event) {
  6861. var position = { x: event.pageX, y: event.pageY };
  6862. var normValue = this._normValueFromMouse(position);
  6863. this._slide(event, this._handleIndex, normValue);
  6864. return false;
  6865. },
  6866. _mouseStop: function(event) {
  6867. this.handles.removeClass("ui-state-active");
  6868. this._stop(event, this._handleIndex);
  6869. this._change(event, this._handleIndex);
  6870. this._handleIndex = null;
  6871. this._clickOffset = null;
  6872. return false;
  6873. },
  6874. _detectOrientation: function() {
  6875. this.orientation = this.options.orientation == 'vertical' ? 'vertical' : 'horizontal';
  6876. },
  6877. _normValueFromMouse: function(position) {
  6878. var pixelTotal, pixelMouse;
  6879. if ('horizontal' == this.orientation) {
  6880. pixelTotal = this.elementSize.width;
  6881. pixelMouse = position.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0);
  6882. } else {
  6883. pixelTotal = this.elementSize.height;
  6884. pixelMouse = position.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0);
  6885. }
  6886. var percentMouse = (pixelMouse / pixelTotal);
  6887. if (percentMouse > 1) percentMouse = 1;
  6888. if (percentMouse < 0) percentMouse = 0;
  6889. if ('vertical' == this.orientation)
  6890. percentMouse = 1 - percentMouse;
  6891. var valueTotal = this._valueMax() - this._valueMin(),
  6892. valueMouse = percentMouse * valueTotal,
  6893. valueMouseModStep = valueMouse % this.options.step,
  6894. normValue = this._valueMin() + valueMouse - valueMouseModStep;
  6895. if (valueMouseModStep > (this.options.step / 2))
  6896. normValue += this.options.step;
  6897. // Since JavaScript has problems with large floats, round
  6898. // the final value to 5 digits after the decimal point (see #4124)
  6899. return parseFloat(normValue.toFixed(5));
  6900. },
  6901. _start: function(event, index) {
  6902. var uiHash = {
  6903. handle: this.handles[index],
  6904. value: this.value()
  6905. };
  6906. if (this.options.values && this.options.values.length) {
  6907. uiHash.value = this.values(index);
  6908. uiHash.values = this.values();
  6909. }
  6910. this._trigger("start", event, uiHash);
  6911. },
  6912. _slide: function(event, index, newVal) {
  6913. var handle = this.handles[index];
  6914. if (this.options.values && this.options.values.length) {
  6915. var otherVal = this.values(index ? 0 : 1);
  6916. if ((this.options.values.length == 2 && this.options.range === true) &&
  6917. ((index == 0 && newVal > otherVal) || (index == 1 && newVal < otherVal))){
  6918. newVal = otherVal;
  6919. }
  6920. if (newVal != this.values(index)) {
  6921. var newValues = this.values();
  6922. newValues[index] = newVal;
  6923. // A slide can be canceled by returning false from the slide callback
  6924. var allowed = this._trigger("slide", event, {
  6925. handle: this.handles[index],
  6926. value: newVal,
  6927. values: newValues
  6928. });
  6929. var otherVal = this.values(index ? 0 : 1);
  6930. if (allowed !== false) {
  6931. this.values(index, newVal, ( event.type == 'mousedown' && this.options.animate ), true);
  6932. }
  6933. }
  6934. } else {
  6935. if (newVal != this.value()) {
  6936. // A slide can be canceled by returning false from the slide callback
  6937. var allowed = this._trigger("slide", event, {
  6938. handle: this.handles[index],
  6939. value: newVal
  6940. });
  6941. if (allowed !== false) {
  6942. this._setData('value', newVal, ( event.type == 'mousedown' && this.options.animate ));
  6943. }
  6944. }
  6945. }
  6946. },
  6947. _stop: function(event, index) {
  6948. var uiHash = {
  6949. handle: this.handles[index],
  6950. value: this.value()
  6951. };
  6952. if (this.options.values && this.options.values.length) {
  6953. uiHash.value = this.values(index);
  6954. uiHash.values = this.values();
  6955. }
  6956. this._trigger("stop", event, uiHash);
  6957. },
  6958. _change: function(event, index) {
  6959. var uiHash = {
  6960. handle: this.handles[index],
  6961. value: this.value()
  6962. };
  6963. if (this.options.values && this.options.values.length) {
  6964. uiHash.value = this.values(index);
  6965. uiHash.values = this.values();
  6966. }
  6967. this._trigger("change", event, uiHash);
  6968. },
  6969. value: function(newValue) {
  6970. if (arguments.length) {
  6971. this._setData("value", newValue);
  6972. this._change(null, 0);
  6973. }
  6974. return this._value();
  6975. },
  6976. values: function(index, newValue, animated, noPropagation) {
  6977. if (arguments.length > 1) {
  6978. this.options.values[index] = newValue;
  6979. this._refreshValue(animated);
  6980. if(!noPropagation) this._change(null, index);
  6981. }
  6982. if (arguments.length) {
  6983. if (this.options.values && this.options.values.length) {
  6984. return this._values(index);
  6985. } else {
  6986. return this.value();
  6987. }
  6988. } else {
  6989. return this._values();
  6990. }
  6991. },
  6992. _setData: function(key, value, animated) {
  6993. $.widget.prototype._setData.apply(this, arguments);
  6994. switch (key) {
  6995. case 'disabled':
  6996. if (value) {
  6997. this.handles.filter(".ui-state-focus").blur();
  6998. this.handles.removeClass("ui-state-hover");
  6999. this.handles.attr("disabled", "disabled");
  7000. } else {
  7001. this.handles.removeAttr("disabled");
  7002. }
  7003. case 'orientation':
  7004. this._detectOrientation();
  7005. this.element
  7006. .removeClass("ui-slider-horizontal ui-slider-vertical")
  7007. .addClass("ui-slider-" + this.orientation);
  7008. this._refreshValue(animated);
  7009. break;
  7010. case 'value':
  7011. this._refreshValue(animated);
  7012. break;
  7013. }
  7014. },
  7015. _step: function() {
  7016. var step = this.options.step;
  7017. return step;
  7018. },
  7019. _value: function() {
  7020. var val = this.options.value;
  7021. if (val < this._valueMin()) val = this._valueMin();
  7022. if (val > this._valueMax()) val = this._valueMax();
  7023. return val;
  7024. },
  7025. _values: function(index) {
  7026. if (arguments.length) {
  7027. var val = this.options.values[index];
  7028. if (val < this._valueMin()) val = this._valueMin();
  7029. if (val > this._valueMax()) val = this._valueMax();
  7030. return val;
  7031. } else {
  7032. return this.options.values;
  7033. }
  7034. },
  7035. _valueMin: function() {
  7036. var valueMin = this.options.min;
  7037. return valueMin;
  7038. },
  7039. _valueMax: function() {
  7040. var valueMax = this.options.max;
  7041. return valueMax;
  7042. },
  7043. _refreshValue: function(animate) {
  7044. var oRange = this.options.range, o = this.options, self = this;
  7045. if (this.options.values && this.options.values.length) {
  7046. var vp0, vp1;
  7047. this.handles.each(function(i, j) {
  7048. var valPercent = (self.values(i) - self._valueMin()) / (self._valueMax() - self._valueMin()) * 100;
  7049. var _set = {}; _set[self.orientation == 'horizontal' ? 'left' : 'bottom'] = valPercent + '%';
  7050. $(this).stop(1,1)[animate ? 'animate' : 'css'](_set, o.animate);
  7051. if (self.options.range === true) {
  7052. if (self.orientation == 'horizontal') {
  7053. (i == 0) && self.range.stop(1,1)[animate ? 'animate' : 'css']({ left: valPercent + '%' }, o.animate);
  7054. (i == 1) && self.range[animate ? 'animate' : 'css']({ width: (valPercent - lastValPercent) + '%' }, { queue: false, duration: o.animate });
  7055. } else {
  7056. (i == 0) && self.range.stop(1,1)[animate ? 'animate' : 'css']({ bottom: (valPercent) + '%' }, o.animate);
  7057. (i == 1) && self.range[animate ? 'animate' : 'css']({ height: (valPercent - lastValPercent) + '%' }, { queue: false, duration: o.animate });
  7058. }
  7059. }
  7060. lastValPercent = valPercent;
  7061. });
  7062. } else {
  7063. var value = this.value(),
  7064. valueMin = this._valueMin(),
  7065. valueMax = this._valueMax(),
  7066. valPercent = valueMax != valueMin
  7067. ? (value - valueMin) / (valueMax - valueMin) * 100
  7068. : 0;
  7069. var _set = {}; _set[self.orientation == 'horizontal' ? 'left' : 'bottom'] = valPercent + '%';
  7070. this.handle.stop(1,1)[animate ? 'animate' : 'css'](_set, o.animate);
  7071. (oRange == "min") && (this.orientation == "horizontal") && this.range.stop(1,1)[animate ? 'animate' : 'css']({ width: valPercent + '%' }, o.animate);
  7072. (oRange == "max") && (this.orientation == "horizontal") && this.range[animate ? 'animate' : 'css']({ width: (100 - valPercent) + '%' }, { queue: false, duration: o.animate });
  7073. (oRange == "min") && (this.orientation == "vertical") && this.range.stop(1,1)[animate ? 'animate' : 'css']({ height: valPercent + '%' }, o.animate);
  7074. (oRange == "max") && (this.orientation == "vertical") && this.range[animate ? 'animate' : 'css']({ height: (100 - valPercent) + '%' }, { queue: false, duration: o.animate });
  7075. }
  7076. }
  7077. }));
  7078. $.extend($.ui.slider, {
  7079. getter: "value values",
  7080. version: "1.7.2",
  7081. eventPrefix: "slide",
  7082. defaults: {
  7083. animate: false,
  7084. delay: 0,
  7085. distance: 0,
  7086. max: 100,
  7087. min: 0,
  7088. orientation: 'horizontal',
  7089. range: false,
  7090. step: 1,
  7091. value: 0,
  7092. values: null
  7093. }
  7094. });
  7095. })(jQuery);
  7096. /*
  7097. * jQuery UI Tabs 1.7.2
  7098. *
  7099. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  7100. * Dual licensed under the MIT (MIT-LICENSE.txt)
  7101. * and GPL (GPL-LICENSE.txt) licenses.
  7102. *
  7103. * http://docs.jquery.com/UI/Tabs
  7104. *
  7105. * Depends:
  7106. * ui.core.js
  7107. */
  7108. (function($) {
  7109. $.widget("ui.tabs", {
  7110. _init: function() {
  7111. if (this.options.deselectable !== undefined) {
  7112. this.options.collapsible = this.options.deselectable;
  7113. }
  7114. this._tabify(true);
  7115. },
  7116. _setData: function(key, value) {
  7117. if (key == 'selected') {
  7118. if (this.options.collapsible && value == this.options.selected) {
  7119. return;
  7120. }
  7121. this.select(value);
  7122. }
  7123. else {
  7124. this.options[key] = value;
  7125. if (key == 'deselectable') {
  7126. this.options.collapsible = value;
  7127. }
  7128. this._tabify();
  7129. }
  7130. },
  7131. _tabId: function(a) {
  7132. return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '') ||
  7133. this.options.idPrefix + $.data(a);
  7134. },
  7135. _sanitizeSelector: function(hash) {
  7136. return hash.replace(/:/g, '\\:'); // we need this because an id may contain a ":"
  7137. },
  7138. _cookie: function() {
  7139. var cookie = this.cookie || (this.cookie = this.options.cookie.name || 'ui-tabs-' + $.data(this.list[0]));
  7140. return $.cookie.apply(null, [cookie].concat($.makeArray(arguments)));
  7141. },
  7142. _ui: function(tab, panel) {
  7143. return {
  7144. tab: tab,
  7145. panel: panel,
  7146. index: this.anchors.index(tab)
  7147. };
  7148. },
  7149. _cleanup: function() {
  7150. // restore all former loading tabs labels
  7151. this.lis.filter('.ui-state-processing').removeClass('ui-state-processing')
  7152. .find('span:data(label.tabs)')
  7153. .each(function() {
  7154. var el = $(this);
  7155. el.html(el.data('label.tabs')).removeData('label.tabs');
  7156. });
  7157. },
  7158. _tabify: function(init) {
  7159. this.list = this.element.children('ul:first');
  7160. this.lis = $('li:has(a[href])', this.list);
  7161. this.anchors = this.lis.map(function() { return $('a', this)[0]; });
  7162. this.panels = $([]);
  7163. var self = this, o = this.options;
  7164. var fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash
  7165. this.anchors.each(function(i, a) {
  7166. var href = $(a).attr('href');
  7167. // For dynamically created HTML that contains a hash as href IE < 8 expands
  7168. // such href to the full page url with hash and then misinterprets tab as ajax.
  7169. // Same consideration applies for an added tab with a fragment identifier
  7170. // since a[href=#fragment-identifier] does unexpectedly not match.
  7171. // Thus normalize href attribute...
  7172. var hrefBase = href.split('#')[0], baseEl;
  7173. if (hrefBase && (hrefBase === location.toString().split('#')[0] ||
  7174. (baseEl = $('base')[0]) && hrefBase === baseEl.href)) {
  7175. href = a.hash;
  7176. a.href = href;
  7177. }
  7178. // inline tab
  7179. if (fragmentId.test(href)) {
  7180. self.panels = self.panels.add(self._sanitizeSelector(href));
  7181. }
  7182. // remote tab
  7183. else if (href != '#') { // prevent loading the page itself if href is just "#"
  7184. $.data(a, 'href.tabs', href); // required for restore on destroy
  7185. // TODO until #3808 is fixed strip fragment identifier from url
  7186. // (IE fails to load from such url)
  7187. $.data(a, 'load.tabs', href.replace(/#.*$/, '')); // mutable data
  7188. var id = self._tabId(a);
  7189. a.href = '#' + id;
  7190. var $panel = $('#' + id);
  7191. if (!$panel.length) {
  7192. $panel = $(o.panelTemplate).attr('id', id).addClass('ui-tabs-panel ui-widget-content ui-corner-bottom')
  7193. .insertAfter(self.panels[i - 1] || self.list);
  7194. $panel.data('destroy.tabs', true);
  7195. }
  7196. self.panels = self.panels.add($panel);
  7197. }
  7198. // invalid tab href
  7199. else {
  7200. o.disabled.push(i);
  7201. }
  7202. });
  7203. // initialization from scratch
  7204. if (init) {
  7205. // attach necessary classes for styling
  7206. this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all');
  7207. this.list.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');
  7208. this.lis.addClass('ui-state-default ui-corner-top');
  7209. this.panels.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom');
  7210. // Selected tab
  7211. // use "selected" option or try to retrieve:
  7212. // 1. from fragment identifier in url
  7213. // 2. from cookie
  7214. // 3. from selected class attribute on <li>
  7215. if (o.selected === undefined) {
  7216. if (location.hash) {
  7217. this.anchors.each(function(i, a) {
  7218. if (a.hash == location.hash) {
  7219. o.selected = i;
  7220. return false; // break
  7221. }
  7222. });
  7223. }
  7224. if (typeof o.selected != 'number' && o.cookie) {
  7225. o.selected = parseInt(self._cookie(), 10);
  7226. }
  7227. if (typeof o.selected != 'number' && this.lis.filter('.ui-tabs-selected').length) {
  7228. o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected'));
  7229. }
  7230. o.selected = o.selected || 0;
  7231. }
  7232. else if (o.selected === null) { // usage of null is deprecated, TODO remove in next release
  7233. o.selected = -1;
  7234. }
  7235. // sanity check - default to first tab...
  7236. o.selected = ((o.selected >= 0 && this.anchors[o.selected]) || o.selected < 0) ? o.selected : 0;
  7237. // Take disabling tabs via class attribute from HTML
  7238. // into account and update option properly.
  7239. // A selected tab cannot become disabled.
  7240. o.disabled = $.unique(o.disabled.concat(
  7241. $.map(this.lis.filter('.ui-state-disabled'),
  7242. function(n, i) { return self.lis.index(n); } )
  7243. )).sort();
  7244. if ($.inArray(o.selected, o.disabled) != -1) {
  7245. o.disabled.splice($.inArray(o.selected, o.disabled), 1);
  7246. }
  7247. // highlight selected tab
  7248. this.panels.addClass('ui-tabs-hide');
  7249. this.lis.removeClass('ui-tabs-selected ui-state-active');
  7250. if (o.selected >= 0 && this.anchors.length) { // check for length avoids error when initializing empty list
  7251. this.panels.eq(o.selected).removeClass('ui-tabs-hide');
  7252. this.lis.eq(o.selected).addClass('ui-tabs-selected ui-state-active');
  7253. // seems to be expected behavior that the show callback is fired
  7254. self.element.queue("tabs", function() {
  7255. self._trigger('show', null, self._ui(self.anchors[o.selected], self.panels[o.selected]));
  7256. });
  7257. this.load(o.selected);
  7258. }
  7259. // clean up to avoid memory leaks in certain versions of IE 6
  7260. $(window).bind('unload', function() {
  7261. self.lis.add(self.anchors).unbind('.tabs');
  7262. self.lis = self.anchors = self.panels = null;
  7263. });
  7264. }
  7265. // update selected after add/remove
  7266. else {
  7267. o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected'));
  7268. }
  7269. // update collapsible
  7270. this.element[o.collapsible ? 'addClass' : 'removeClass']('ui-tabs-collapsible');
  7271. // set or update cookie after init and add/remove respectively
  7272. if (o.cookie) {
  7273. this._cookie(o.selected, o.cookie);
  7274. }
  7275. // disable tabs
  7276. for (var i = 0, li; (li = this.lis[i]); i++) {
  7277. $(li)[$.inArray(i, o.disabled) != -1 &&
  7278. !$(li).hasClass('ui-tabs-selected') ? 'addClass' : 'removeClass']('ui-state-disabled');
  7279. }
  7280. // reset cache if switching from cached to not cached
  7281. if (o.cache === false) {
  7282. this.anchors.removeData('cache.tabs');
  7283. }
  7284. // remove all handlers before, tabify may run on existing tabs after add or option change
  7285. this.lis.add(this.anchors).unbind('.tabs');
  7286. if (o.event != 'mouseover') {
  7287. var addState = function(state, el) {
  7288. if (el.is(':not(.ui-state-disabled)')) {
  7289. el.addClass('ui-state-' + state);
  7290. }
  7291. };
  7292. var removeState = function(state, el) {
  7293. el.removeClass('ui-state-' + state);
  7294. };
  7295. this.lis.bind('mouseover.tabs', function() {
  7296. addState('hover', $(this));
  7297. });
  7298. this.lis.bind('mouseout.tabs', function() {
  7299. removeState('hover', $(this));
  7300. });
  7301. this.anchors.bind('focus.tabs', function() {
  7302. addState('focus', $(this).closest('li'));
  7303. });
  7304. this.anchors.bind('blur.tabs', function() {
  7305. removeState('focus', $(this).closest('li'));
  7306. });
  7307. }
  7308. // set up animations
  7309. var hideFx, showFx;
  7310. if (o.fx) {
  7311. if ($.isArray(o.fx)) {
  7312. hideFx = o.fx[0];
  7313. showFx = o.fx[1];
  7314. }
  7315. else {
  7316. hideFx = showFx = o.fx;
  7317. }
  7318. }
  7319. // Reset certain styles left over from animation
  7320. // and prevent IE's ClearType bug...
  7321. function resetStyle($el, fx) {
  7322. $el.css({ display: '' });
  7323. if ($.browser.msie && fx.opacity) {
  7324. $el[0].style.removeAttribute('filter');
  7325. }
  7326. }
  7327. // Show a tab...
  7328. var showTab = showFx ?
  7329. function(clicked, $show) {
  7330. $(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active');
  7331. $show.hide().removeClass('ui-tabs-hide') // avoid flicker that way
  7332. .animate(showFx, showFx.duration || 'normal', function() {
  7333. resetStyle($show, showFx);
  7334. self._trigger('show', null, self._ui(clicked, $show[0]));
  7335. });
  7336. } :
  7337. function(clicked, $show) {
  7338. $(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active');
  7339. $show.removeClass('ui-tabs-hide');
  7340. self._trigger('show', null, self._ui(clicked, $show[0]));
  7341. };
  7342. // Hide a tab, $show is optional...
  7343. var hideTab = hideFx ?
  7344. function(clicked, $hide) {
  7345. $hide.animate(hideFx, hideFx.duration || 'normal', function() {
  7346. self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default');
  7347. $hide.addClass('ui-tabs-hide');
  7348. resetStyle($hide, hideFx);
  7349. self.element.dequeue("tabs");
  7350. });
  7351. } :
  7352. function(clicked, $hide, $show) {
  7353. self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default');
  7354. $hide.addClass('ui-tabs-hide');
  7355. self.element.dequeue("tabs");
  7356. };
  7357. // attach tab event handler, unbind to avoid duplicates from former tabifying...
  7358. this.anchors.bind(o.event + '.tabs', function() {
  7359. var el = this, $li = $(this).closest('li'), $hide = self.panels.filter(':not(.ui-tabs-hide)'),
  7360. $show = $(self._sanitizeSelector(this.hash));
  7361. // If tab is already selected and not collapsible or tab disabled or
  7362. // or is already loading or click callback returns false stop here.
  7363. // Check if click handler returns false last so that it is not executed
  7364. // for a disabled or loading tab!
  7365. if (($li.hasClass('ui-tabs-selected') && !o.collapsible) ||
  7366. $li.hasClass('ui-state-disabled') ||
  7367. $li.hasClass('ui-state-processing') ||
  7368. self._trigger('select', null, self._ui(this, $show[0])) === false) {
  7369. this.blur();
  7370. return false;
  7371. }
  7372. o.selected = self.anchors.index(this);
  7373. self.abort();
  7374. // if tab may be closed
  7375. if (o.collapsible) {
  7376. if ($li.hasClass('ui-tabs-selected')) {
  7377. o.selected = -1;
  7378. if (o.cookie) {
  7379. self._cookie(o.selected, o.cookie);
  7380. }
  7381. self.element.queue("tabs", function() {
  7382. hideTab(el, $hide);
  7383. }).dequeue("tabs");
  7384. this.blur();
  7385. return false;
  7386. }
  7387. else if (!$hide.length) {
  7388. if (o.cookie) {
  7389. self._cookie(o.selected, o.cookie);
  7390. }
  7391. self.element.queue("tabs", function() {
  7392. showTab(el, $show);
  7393. });
  7394. self.load(self.anchors.index(this)); // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171
  7395. this.blur();
  7396. return false;
  7397. }
  7398. }
  7399. if (o.cookie) {
  7400. self._cookie(o.selected, o.cookie);
  7401. }
  7402. // show new tab
  7403. if ($show.length) {
  7404. if ($hide.length) {
  7405. self.element.queue("tabs", function() {
  7406. hideTab(el, $hide);
  7407. });
  7408. }
  7409. self.element.queue("tabs", function() {
  7410. showTab(el, $show);
  7411. });
  7412. self.load(self.anchors.index(this));
  7413. }
  7414. else {
  7415. throw 'jQuery UI Tabs: Mismatching fragment identifier.';
  7416. }
  7417. // Prevent IE from keeping other link focussed when using the back button
  7418. // and remove dotted border from clicked link. This is controlled via CSS
  7419. // in modern browsers; blur() removes focus from address bar in Firefox
  7420. // which can become a usability and annoying problem with tabs('rotate').
  7421. if ($.browser.msie) {
  7422. this.blur();
  7423. }
  7424. });
  7425. // disable click in any case
  7426. this.anchors.bind('click.tabs', function(){return false;});
  7427. },
  7428. destroy: function() {
  7429. var o = this.options;
  7430. this.abort();
  7431. this.element.unbind('.tabs')
  7432. .removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible')
  7433. .removeData('tabs');
  7434. this.list.removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');
  7435. this.anchors.each(function() {
  7436. var href = $.data(this, 'href.tabs');
  7437. if (href) {
  7438. this.href = href;
  7439. }
  7440. var $this = $(this).unbind('.tabs');
  7441. $.each(['href', 'load', 'cache'], function(i, prefix) {
  7442. $this.removeData(prefix + '.tabs');
  7443. });
  7444. });
  7445. this.lis.unbind('.tabs').add(this.panels).each(function() {
  7446. if ($.data(this, 'destroy.tabs')) {
  7447. $(this).remove();
  7448. }
  7449. else {
  7450. $(this).removeClass([
  7451. 'ui-state-default',
  7452. 'ui-corner-top',
  7453. 'ui-tabs-selected',
  7454. 'ui-state-active',
  7455. 'ui-state-hover',
  7456. 'ui-state-focus',
  7457. 'ui-state-disabled',
  7458. 'ui-tabs-panel',
  7459. 'ui-widget-content',
  7460. 'ui-corner-bottom',
  7461. 'ui-tabs-hide'
  7462. ].join(' '));
  7463. }
  7464. });
  7465. if (o.cookie) {
  7466. this._cookie(null, o.cookie);
  7467. }
  7468. },
  7469. add: function(url, label, index) {
  7470. if (index === undefined) {
  7471. index = this.anchors.length; // append by default
  7472. }
  7473. var self = this, o = this.options,
  7474. $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label)),
  7475. id = !url.indexOf('#') ? url.replace('#', '') : this._tabId($('a', $li)[0]);
  7476. $li.addClass('ui-state-default ui-corner-top').data('destroy.tabs', true);
  7477. // try to find an existing element before creating a new one
  7478. var $panel = $('#' + id);
  7479. if (!$panel.length) {
  7480. $panel = $(o.panelTemplate).attr('id', id).data('destroy.tabs', true);
  7481. }
  7482. $panel.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide');
  7483. if (index >= this.lis.length) {
  7484. $li.appendTo(this.list);
  7485. $panel.appendTo(this.list[0].parentNode);
  7486. }
  7487. else {
  7488. $li.insertBefore(this.lis[index]);
  7489. $panel.insertBefore(this.panels[index]);
  7490. }
  7491. o.disabled = $.map(o.disabled,
  7492. function(n, i) { return n >= index ? ++n : n; });
  7493. this._tabify();
  7494. if (this.anchors.length == 1) { // after tabify
  7495. $li.addClass('ui-tabs-selected ui-state-active');
  7496. $panel.removeClass('ui-tabs-hide');
  7497. this.element.queue("tabs", function() {
  7498. self._trigger('show', null, self._ui(self.anchors[0], self.panels[0]));
  7499. });
  7500. this.load(0);
  7501. }
  7502. // callback
  7503. this._trigger('add', null, this._ui(this.anchors[index], this.panels[index]));
  7504. },
  7505. remove: function(index) {
  7506. var o = this.options, $li = this.lis.eq(index).remove(),
  7507. $panel = this.panels.eq(index).remove();
  7508. // If selected tab was removed focus tab to the right or
  7509. // in case the last tab was removed the tab to the left.
  7510. if ($li.hasClass('ui-tabs-selected') && this.anchors.length > 1) {
  7511. this.select(index + (index + 1 < this.anchors.length ? 1 : -1));
  7512. }
  7513. o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }),
  7514. function(n, i) { return n >= index ? --n : n; });
  7515. this._tabify();
  7516. // callback
  7517. this._trigger('remove', null, this._ui($li.find('a')[0], $panel[0]));
  7518. },
  7519. enable: function(index) {
  7520. var o = this.options;
  7521. if ($.inArray(index, o.disabled) == -1) {
  7522. return;
  7523. }
  7524. this.lis.eq(index).removeClass('ui-state-disabled');
  7525. o.disabled = $.grep(o.disabled, function(n, i) { return n != index; });
  7526. // callback
  7527. this._trigger('enable', null, this._ui(this.anchors[index], this.panels[index]));
  7528. },
  7529. disable: function(index) {
  7530. var self = this, o = this.options;
  7531. if (index != o.selected) { // cannot disable already selected tab
  7532. this.lis.eq(index).addClass('ui-state-disabled');
  7533. o.disabled.push(index);
  7534. o.disabled.sort();
  7535. // callback
  7536. this._trigger('disable', null, this._ui(this.anchors[index], this.panels[index]));
  7537. }
  7538. },
  7539. select: function(index) {
  7540. if (typeof index == 'string') {
  7541. index = this.anchors.index(this.anchors.filter('[href$=' + index + ']'));
  7542. }
  7543. else if (index === null) { // usage of null is deprecated, TODO remove in next release
  7544. index = -1;
  7545. }
  7546. if (index == -1 && this.options.collapsible) {
  7547. index = this.options.selected;
  7548. }
  7549. this.anchors.eq(index).trigger(this.options.event + '.tabs');
  7550. },
  7551. load: function(index) {
  7552. var self = this, o = this.options, a = this.anchors.eq(index)[0], url = $.data(a, 'load.tabs');
  7553. this.abort();
  7554. // not remote or from cache
  7555. if (!url || this.element.queue("tabs").length !== 0 && $.data(a, 'cache.tabs')) {
  7556. this.element.dequeue("tabs");
  7557. return;
  7558. }
  7559. // load remote from here on
  7560. this.lis.eq(index).addClass('ui-state-processing');
  7561. if (o.spinner) {
  7562. var span = $('span', a);
  7563. span.data('label.tabs', span.html()).html(o.spinner);
  7564. }
  7565. this.xhr = $.ajax($.extend({}, o.ajaxOptions, {
  7566. url: url,
  7567. success: function(r, s) {
  7568. $(self._sanitizeSelector(a.hash)).html(r);
  7569. // take care of tab labels
  7570. self._cleanup();
  7571. if (o.cache) {
  7572. $.data(a, 'cache.tabs', true); // if loaded once do not load them again
  7573. }
  7574. // callbacks
  7575. self._trigger('load', null, self._ui(self.anchors[index], self.panels[index]));
  7576. try {
  7577. o.ajaxOptions.success(r, s);
  7578. }
  7579. catch (e) {}
  7580. // last, so that load event is fired before show...
  7581. self.element.dequeue("tabs");
  7582. }
  7583. }));
  7584. },
  7585. abort: function() {
  7586. // stop possibly running animations
  7587. this.element.queue([]);
  7588. this.panels.stop(false, true);
  7589. // terminate pending requests from other tabs
  7590. if (this.xhr) {
  7591. this.xhr.abort();
  7592. delete this.xhr;
  7593. }
  7594. // take care of tab labels
  7595. this._cleanup();
  7596. },
  7597. url: function(index, url) {
  7598. this.anchors.eq(index).removeData('cache.tabs').data('load.tabs', url);
  7599. },
  7600. length: function() {
  7601. return this.anchors.length;
  7602. }
  7603. });
  7604. $.extend($.ui.tabs, {
  7605. version: '1.7.2',
  7606. getter: 'length',
  7607. defaults: {
  7608. ajaxOptions: null,
  7609. cache: false,
  7610. cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
  7611. collapsible: false,
  7612. disabled: [],
  7613. event: 'click',
  7614. fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
  7615. idPrefix: 'ui-tabs-',
  7616. panelTemplate: '<div></div>',
  7617. spinner: '<em>Loading&#8230;</em>',
  7618. tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>'
  7619. }
  7620. });
  7621. /*
  7622. * Tabs Extensions
  7623. */
  7624. /*
  7625. * Rotate
  7626. */
  7627. $.extend($.ui.tabs.prototype, {
  7628. rotation: null,
  7629. rotate: function(ms, continuing) {
  7630. var self = this, o = this.options;
  7631. var rotate = self._rotate || (self._rotate = function(e) {
  7632. clearTimeout(self.rotation);
  7633. self.rotation = setTimeout(function() {
  7634. var t = o.selected;
  7635. self.select( ++t < self.anchors.length ? t : 0 );
  7636. }, ms);
  7637. if (e) {
  7638. e.stopPropagation();
  7639. }
  7640. });
  7641. var stop = self._unrotate || (self._unrotate = !continuing ?
  7642. function(e) {
  7643. if (e.clientX) { // in case of a true click
  7644. self.rotate(null);
  7645. }
  7646. } :
  7647. function(e) {
  7648. t = o.selected;
  7649. rotate();
  7650. });
  7651. // start rotation
  7652. if (ms) {
  7653. this.element.bind('tabsshow', rotate);
  7654. this.anchors.bind(o.event + '.tabs', stop);
  7655. rotate();
  7656. }
  7657. // stop rotation
  7658. else {
  7659. clearTimeout(self.rotation);
  7660. this.element.unbind('tabsshow', rotate);
  7661. this.anchors.unbind(o.event + '.tabs', stop);
  7662. delete this._rotate;
  7663. delete this._unrotate;
  7664. }
  7665. }
  7666. });
  7667. })(jQuery);