jquery-ui.js 365 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630
  1. /*!
  2. * Note: While Microsoft is not the author of this file, Microsoft is
  3. * offering you a license subject to the terms of the Microsoft Software
  4. * License Terms for Microsoft ASP.NET Model View Controller 3.
  5. * Microsoft reserves all other rights. The notices below are provided
  6. * for informational purposes only and are not the license terms under
  7. * which Microsoft distributed this file.
  8. *
  9. * jQuery UI 1.8.7
  10. *
  11. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  12. *
  13. * http://docs.jquery.com/UI
  14. */
  15. (function( $, undefined ) {
  16. // prevent duplicate loading
  17. // this is only a problem because we proxy existing functions
  18. // and we don't want to double proxy them
  19. $.ui = $.ui || {};
  20. if ( $.ui.version ) {
  21. return;
  22. }
  23. $.extend( $.ui, {
  24. version: "1.8.7",
  25. keyCode: {
  26. ALT: 18,
  27. BACKSPACE: 8,
  28. CAPS_LOCK: 20,
  29. COMMA: 188,
  30. COMMAND: 91,
  31. COMMAND_LEFT: 91, // COMMAND
  32. COMMAND_RIGHT: 93,
  33. CONTROL: 17,
  34. DELETE: 46,
  35. DOWN: 40,
  36. END: 35,
  37. ENTER: 13,
  38. ESCAPE: 27,
  39. HOME: 36,
  40. INSERT: 45,
  41. LEFT: 37,
  42. MENU: 93, // COMMAND_RIGHT
  43. NUMPAD_ADD: 107,
  44. NUMPAD_DECIMAL: 110,
  45. NUMPAD_DIVIDE: 111,
  46. NUMPAD_ENTER: 108,
  47. NUMPAD_MULTIPLY: 106,
  48. NUMPAD_SUBTRACT: 109,
  49. PAGE_DOWN: 34,
  50. PAGE_UP: 33,
  51. PERIOD: 190,
  52. RIGHT: 39,
  53. SHIFT: 16,
  54. SPACE: 32,
  55. TAB: 9,
  56. UP: 38,
  57. WINDOWS: 91 // COMMAND
  58. }
  59. });
  60. // plugins
  61. $.fn.extend({
  62. _focus: $.fn.focus,
  63. focus: function( delay, fn ) {
  64. return typeof delay === "number" ?
  65. this.each(function() {
  66. var elem = this;
  67. setTimeout(function() {
  68. $( elem ).focus();
  69. if ( fn ) {
  70. fn.call( elem );
  71. }
  72. }, delay );
  73. }) :
  74. this._focus.apply( this, arguments );
  75. },
  76. scrollParent: function() {
  77. var scrollParent;
  78. if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
  79. scrollParent = this.parents().filter(function() {
  80. 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));
  81. }).eq(0);
  82. } else {
  83. scrollParent = this.parents().filter(function() {
  84. return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
  85. }).eq(0);
  86. }
  87. return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
  88. },
  89. zIndex: function( zIndex ) {
  90. if ( zIndex !== undefined ) {
  91. return this.css( "zIndex", zIndex );
  92. }
  93. if ( this.length ) {
  94. var elem = $( this[ 0 ] ), position, value;
  95. while ( elem.length && elem[ 0 ] !== document ) {
  96. // Ignore z-index if position is set to a value where z-index is ignored by the browser
  97. // This makes behavior of this function consistent across browsers
  98. // WebKit always returns auto if the element is positioned
  99. position = elem.css( "position" );
  100. if ( position === "absolute" || position === "relative" || position === "fixed" ) {
  101. // IE returns 0 when zIndex is not specified
  102. // other browsers return a string
  103. // we ignore the case of nested elements with an explicit value of 0
  104. // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
  105. value = parseInt( elem.css( "zIndex" ), 10 );
  106. if ( !isNaN( value ) && value !== 0 ) {
  107. return value;
  108. }
  109. }
  110. elem = elem.parent();
  111. }
  112. }
  113. return 0;
  114. },
  115. disableSelection: function() {
  116. return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
  117. ".ui-disableSelection", function( event ) {
  118. event.preventDefault();
  119. });
  120. },
  121. enableSelection: function() {
  122. return this.unbind( ".ui-disableSelection" );
  123. }
  124. });
  125. $.each( [ "Width", "Height" ], function( i, name ) {
  126. var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
  127. type = name.toLowerCase(),
  128. orig = {
  129. innerWidth: $.fn.innerWidth,
  130. innerHeight: $.fn.innerHeight,
  131. outerWidth: $.fn.outerWidth,
  132. outerHeight: $.fn.outerHeight
  133. };
  134. function reduce( elem, size, border, margin ) {
  135. $.each( side, function() {
  136. size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
  137. if ( border ) {
  138. size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
  139. }
  140. if ( margin ) {
  141. size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
  142. }
  143. });
  144. return size;
  145. }
  146. $.fn[ "inner" + name ] = function( size ) {
  147. if ( size === undefined ) {
  148. return orig[ "inner" + name ].call( this );
  149. }
  150. return this.each(function() {
  151. $( this ).css( type, reduce( this, size ) + "px" );
  152. });
  153. };
  154. $.fn[ "outer" + name] = function( size, margin ) {
  155. if ( typeof size !== "number" ) {
  156. return orig[ "outer" + name ].call( this, size );
  157. }
  158. return this.each(function() {
  159. $( this).css( type, reduce( this, size, true, margin ) + "px" );
  160. });
  161. };
  162. });
  163. // selectors
  164. function visible( element ) {
  165. return !$( element ).parents().andSelf().filter(function() {
  166. return $.curCSS( this, "visibility" ) === "hidden" ||
  167. $.expr.filters.hidden( this );
  168. }).length;
  169. }
  170. $.extend( $.expr[ ":" ], {
  171. data: function( elem, i, match ) {
  172. return !!$.data( elem, match[ 3 ] );
  173. },
  174. focusable: function( element ) {
  175. var nodeName = element.nodeName.toLowerCase(),
  176. tabIndex = $.attr( element, "tabindex" );
  177. if ( "area" === nodeName ) {
  178. var map = element.parentNode,
  179. mapName = map.name,
  180. img;
  181. if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
  182. return false;
  183. }
  184. img = $( "img[usemap=#" + mapName + "]" )[0];
  185. return !!img && visible( img );
  186. }
  187. return ( /input|select|textarea|button|object/.test( nodeName )
  188. ? !element.disabled
  189. : "a" == nodeName
  190. ? element.href || !isNaN( tabIndex )
  191. : !isNaN( tabIndex ))
  192. // the element and all of its ancestors must be visible
  193. && visible( element );
  194. },
  195. tabbable: function( element ) {
  196. var tabIndex = $.attr( element, "tabindex" );
  197. return ( isNaN( tabIndex ) || tabIndex >= 0 ) && $( element ).is( ":focusable" );
  198. }
  199. });
  200. // support
  201. $(function() {
  202. var body = document.body,
  203. div = body.appendChild( div = document.createElement( "div" ) );
  204. $.extend( div.style, {
  205. minHeight: "100px",
  206. height: "auto",
  207. padding: 0,
  208. borderWidth: 0
  209. });
  210. $.support.minHeight = div.offsetHeight === 100;
  211. $.support.selectstart = "onselectstart" in div;
  212. // set display to none to avoid a layout bug in IE
  213. // http://dev.jquery.com/ticket/4014
  214. body.removeChild( div ).style.display = "none";
  215. });
  216. // deprecated
  217. $.extend( $.ui, {
  218. // $.ui.plugin is deprecated. Use the proxy pattern instead.
  219. plugin: {
  220. add: function( module, option, set ) {
  221. var proto = $.ui[ module ].prototype;
  222. for ( var i in set ) {
  223. proto.plugins[ i ] = proto.plugins[ i ] || [];
  224. proto.plugins[ i ].push( [ option, set[ i ] ] );
  225. }
  226. },
  227. call: function( instance, name, args ) {
  228. var set = instance.plugins[ name ];
  229. if ( !set || !instance.element[ 0 ].parentNode ) {
  230. return;
  231. }
  232. for ( var i = 0; i < set.length; i++ ) {
  233. if ( instance.options[ set[ i ][ 0 ] ] ) {
  234. set[ i ][ 1 ].apply( instance.element, args );
  235. }
  236. }
  237. }
  238. },
  239. // will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
  240. contains: function( a, b ) {
  241. return document.compareDocumentPosition ?
  242. a.compareDocumentPosition( b ) & 16 :
  243. a !== b && a.contains( b );
  244. },
  245. // only used by resizable
  246. hasScroll: function( el, a ) {
  247. //If overflow is hidden, the element might have extra content, but the user wants to hide it
  248. if ( $( el ).css( "overflow" ) === "hidden") {
  249. return false;
  250. }
  251. var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
  252. has = false;
  253. if ( el[ scroll ] > 0 ) {
  254. return true;
  255. }
  256. // TODO: determine which cases actually cause this to happen
  257. // if the element doesn't have the scroll set, see if it's possible to
  258. // set the scroll
  259. el[ scroll ] = 1;
  260. has = ( el[ scroll ] > 0 );
  261. el[ scroll ] = 0;
  262. return has;
  263. },
  264. // these are odd functions, fix the API or move into individual plugins
  265. isOverAxis: function( x, reference, size ) {
  266. //Determines when x coordinate is over "b" element axis
  267. return ( x > reference ) && ( x < ( reference + size ) );
  268. },
  269. isOver: function( y, x, top, left, height, width ) {
  270. //Determines when x, y coordinates is over "b" element
  271. return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
  272. }
  273. });
  274. })( jQuery );
  275. /*!
  276. * Note: While Microsoft is not the author of this file, Microsoft is
  277. * offering you a license subject to the terms of the Microsoft Software
  278. * License Terms for Microsoft ASP.NET Model View Controller 3.
  279. * Microsoft reserves all other rights. The notices below are provided
  280. * for informational purposes only and are not the license terms under
  281. * which Microsoft distributed this file.
  282. *
  283. * jQuery UI Widget 1.8.7
  284. *
  285. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  286. *
  287. * http://docs.jquery.com/UI/Widget
  288. */
  289. (function( $, undefined ) {
  290. // jQuery 1.4+
  291. if ( $.cleanData ) {
  292. var _cleanData = $.cleanData;
  293. $.cleanData = function( elems ) {
  294. for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
  295. $( elem ).triggerHandler( "remove" );
  296. }
  297. _cleanData( elems );
  298. };
  299. } else {
  300. var _remove = $.fn.remove;
  301. $.fn.remove = function( selector, keepData ) {
  302. return this.each(function() {
  303. if ( !keepData ) {
  304. if ( !selector || $.filter( selector, [ this ] ).length ) {
  305. $( "*", this ).add( [ this ] ).each(function() {
  306. $( this ).triggerHandler( "remove" );
  307. });
  308. }
  309. }
  310. return _remove.call( $(this), selector, keepData );
  311. });
  312. };
  313. }
  314. $.widget = function( name, base, prototype ) {
  315. var namespace = name.split( "." )[ 0 ],
  316. fullName;
  317. name = name.split( "." )[ 1 ];
  318. fullName = namespace + "-" + name;
  319. if ( !prototype ) {
  320. prototype = base;
  321. base = $.Widget;
  322. }
  323. // create selector for plugin
  324. $.expr[ ":" ][ fullName ] = function( elem ) {
  325. return !!$.data( elem, name );
  326. };
  327. $[ namespace ] = $[ namespace ] || {};
  328. $[ namespace ][ name ] = function( options, element ) {
  329. // allow instantiation without initializing for simple inheritance
  330. if ( arguments.length ) {
  331. this._createWidget( options, element );
  332. }
  333. };
  334. var basePrototype = new base();
  335. // we need to make the options hash a property directly on the new instance
  336. // otherwise we'll modify the options hash on the prototype that we're
  337. // inheriting from
  338. // $.each( basePrototype, function( key, val ) {
  339. // if ( $.isPlainObject(val) ) {
  340. // basePrototype[ key ] = $.extend( {}, val );
  341. // }
  342. // });
  343. basePrototype.options = $.extend( true, {}, basePrototype.options );
  344. $[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
  345. namespace: namespace,
  346. widgetName: name,
  347. widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
  348. widgetBaseClass: fullName
  349. }, prototype );
  350. $.widget.bridge( name, $[ namespace ][ name ] );
  351. };
  352. $.widget.bridge = function( name, object ) {
  353. $.fn[ name ] = function( options ) {
  354. var isMethodCall = typeof options === "string",
  355. args = Array.prototype.slice.call( arguments, 1 ),
  356. returnValue = this;
  357. // allow multiple hashes to be passed on init
  358. options = !isMethodCall && args.length ?
  359. $.extend.apply( null, [ true, options ].concat(args) ) :
  360. options;
  361. // prevent calls to internal methods
  362. if ( isMethodCall && options.charAt( 0 ) === "_" ) {
  363. return returnValue;
  364. }
  365. if ( isMethodCall ) {
  366. this.each(function() {
  367. var instance = $.data( this, name ),
  368. methodValue = instance && $.isFunction( instance[options] ) ?
  369. instance[ options ].apply( instance, args ) :
  370. instance;
  371. // TODO: add this back in 1.9 and use $.error() (see #5972)
  372. // if ( !instance ) {
  373. // throw "cannot call methods on " + name + " prior to initialization; " +
  374. // "attempted to call method '" + options + "'";
  375. // }
  376. // if ( !$.isFunction( instance[options] ) ) {
  377. // throw "no such method '" + options + "' for " + name + " widget instance";
  378. // }
  379. // var methodValue = instance[ options ].apply( instance, args );
  380. if ( methodValue !== instance && methodValue !== undefined ) {
  381. returnValue = methodValue;
  382. return false;
  383. }
  384. });
  385. } else {
  386. this.each(function() {
  387. var instance = $.data( this, name );
  388. if ( instance ) {
  389. instance.option( options || {} )._init();
  390. } else {
  391. $.data( this, name, new object( options, this ) );
  392. }
  393. });
  394. }
  395. return returnValue;
  396. };
  397. };
  398. $.Widget = function( options, element ) {
  399. // allow instantiation without initializing for simple inheritance
  400. if ( arguments.length ) {
  401. this._createWidget( options, element );
  402. }
  403. };
  404. $.Widget.prototype = {
  405. widgetName: "widget",
  406. widgetEventPrefix: "",
  407. options: {
  408. disabled: false
  409. },
  410. _createWidget: function( options, element ) {
  411. // $.widget.bridge stores the plugin instance, but we do it anyway
  412. // so that it's stored even before the _create function runs
  413. $.data( element, this.widgetName, this );
  414. this.element = $( element );
  415. this.options = $.extend( true, {},
  416. this.options,
  417. this._getCreateOptions(),
  418. options );
  419. var self = this;
  420. this.element.bind( "remove." + this.widgetName, function() {
  421. self.destroy();
  422. });
  423. this._create();
  424. this._trigger( "create" );
  425. this._init();
  426. },
  427. _getCreateOptions: function() {
  428. return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
  429. },
  430. _create: function() {},
  431. _init: function() {},
  432. destroy: function() {
  433. this.element
  434. .unbind( "." + this.widgetName )
  435. .removeData( this.widgetName );
  436. this.widget()
  437. .unbind( "." + this.widgetName )
  438. .removeAttr( "aria-disabled" )
  439. .removeClass(
  440. this.widgetBaseClass + "-disabled " +
  441. "ui-state-disabled" );
  442. },
  443. widget: function() {
  444. return this.element;
  445. },
  446. option: function( key, value ) {
  447. var options = key;
  448. if ( arguments.length === 0 ) {
  449. // don't return a reference to the internal hash
  450. return $.extend( {}, this.options );
  451. }
  452. if (typeof key === "string" ) {
  453. if ( value === undefined ) {
  454. return this.options[ key ];
  455. }
  456. options = {};
  457. options[ key ] = value;
  458. }
  459. this._setOptions( options );
  460. return this;
  461. },
  462. _setOptions: function( options ) {
  463. var self = this;
  464. $.each( options, function( key, value ) {
  465. self._setOption( key, value );
  466. });
  467. return this;
  468. },
  469. _setOption: function( key, value ) {
  470. this.options[ key ] = value;
  471. if ( key === "disabled" ) {
  472. this.widget()
  473. [ value ? "addClass" : "removeClass"](
  474. this.widgetBaseClass + "-disabled" + " " +
  475. "ui-state-disabled" )
  476. .attr( "aria-disabled", value );
  477. }
  478. return this;
  479. },
  480. enable: function() {
  481. return this._setOption( "disabled", false );
  482. },
  483. disable: function() {
  484. return this._setOption( "disabled", true );
  485. },
  486. _trigger: function( type, event, data ) {
  487. var callback = this.options[ type ];
  488. event = $.Event( event );
  489. event.type = ( type === this.widgetEventPrefix ?
  490. type :
  491. this.widgetEventPrefix + type ).toLowerCase();
  492. data = data || {};
  493. // copy original event properties over to the new event
  494. // this would happen if we could call $.event.fix instead of $.Event
  495. // but we don't have a way to force an event to be fixed multiple times
  496. if ( event.originalEvent ) {
  497. for ( var i = $.event.props.length, prop; i; ) {
  498. prop = $.event.props[ --i ];
  499. event[ prop ] = event.originalEvent[ prop ];
  500. }
  501. }
  502. this.element.trigger( event, data );
  503. return !( $.isFunction(callback) &&
  504. callback.call( this.element[0], event, data ) === false ||
  505. event.isDefaultPrevented() );
  506. }
  507. };
  508. })( jQuery );
  509. /*!
  510. * Note: While Microsoft is not the author of this file, Microsoft is
  511. * offering you a license subject to the terms of the Microsoft Software
  512. * License Terms for Microsoft ASP.NET Model View Controller 3.
  513. * Microsoft reserves all other rights. The notices below are provided
  514. * for informational purposes only and are not the license terms under
  515. * which Microsoft distributed this file.
  516. *
  517. * jQuery UI Mouse 1.8.7
  518. *
  519. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  520. *
  521. * http://docs.jquery.com/UI/Mouse
  522. *
  523. * Depends:
  524. * jquery.ui.widget.js
  525. */
  526. (function( $, undefined ) {
  527. $.widget("ui.mouse", {
  528. options: {
  529. cancel: ':input,option',
  530. distance: 1,
  531. delay: 0
  532. },
  533. _mouseInit: function() {
  534. var self = this;
  535. this.element
  536. .bind('mousedown.'+this.widgetName, function(event) {
  537. return self._mouseDown(event);
  538. })
  539. .bind('click.'+this.widgetName, function(event) {
  540. if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) {
  541. $.removeData(event.target, self.widgetName + '.preventClickEvent');
  542. event.stopImmediatePropagation();
  543. return false;
  544. }
  545. });
  546. this.started = false;
  547. },
  548. // TODO: make sure destroying one instance of mouse doesn't mess with
  549. // other instances of mouse
  550. _mouseDestroy: function() {
  551. this.element.unbind('.'+this.widgetName);
  552. },
  553. _mouseDown: function(event) {
  554. // don't let more than one widget handle mouseStart
  555. // TODO: figure out why we have to use originalEvent
  556. event.originalEvent = event.originalEvent || {};
  557. if (event.originalEvent.mouseHandled) { return; }
  558. // we may have missed mouseup (out of window)
  559. (this._mouseStarted && this._mouseUp(event));
  560. this._mouseDownEvent = event;
  561. var self = this,
  562. btnIsLeft = (event.which == 1),
  563. elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
  564. if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
  565. return true;
  566. }
  567. this.mouseDelayMet = !this.options.delay;
  568. if (!this.mouseDelayMet) {
  569. this._mouseDelayTimer = setTimeout(function() {
  570. self.mouseDelayMet = true;
  571. }, this.options.delay);
  572. }
  573. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  574. this._mouseStarted = (this._mouseStart(event) !== false);
  575. if (!this._mouseStarted) {
  576. event.preventDefault();
  577. return true;
  578. }
  579. }
  580. // these delegates are required to keep context
  581. this._mouseMoveDelegate = function(event) {
  582. return self._mouseMove(event);
  583. };
  584. this._mouseUpDelegate = function(event) {
  585. return self._mouseUp(event);
  586. };
  587. $(document)
  588. .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
  589. .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
  590. event.preventDefault();
  591. event.originalEvent.mouseHandled = true;
  592. return true;
  593. },
  594. _mouseMove: function(event) {
  595. // IE mouseup check - mouseup happened when mouse was out of window
  596. if ($.browser.msie && !(document.documentMode >= 9) && !event.button) {
  597. return this._mouseUp(event);
  598. }
  599. if (this._mouseStarted) {
  600. this._mouseDrag(event);
  601. return event.preventDefault();
  602. }
  603. if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
  604. this._mouseStarted =
  605. (this._mouseStart(this._mouseDownEvent, event) !== false);
  606. (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
  607. }
  608. return !this._mouseStarted;
  609. },
  610. _mouseUp: function(event) {
  611. $(document)
  612. .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
  613. .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
  614. if (this._mouseStarted) {
  615. this._mouseStarted = false;
  616. if (event.target == this._mouseDownEvent.target) {
  617. $.data(event.target, this.widgetName + '.preventClickEvent', true);
  618. }
  619. this._mouseStop(event);
  620. }
  621. return false;
  622. },
  623. _mouseDistanceMet: function(event) {
  624. return (Math.max(
  625. Math.abs(this._mouseDownEvent.pageX - event.pageX),
  626. Math.abs(this._mouseDownEvent.pageY - event.pageY)
  627. ) >= this.options.distance
  628. );
  629. },
  630. _mouseDelayMet: function(event) {
  631. return this.mouseDelayMet;
  632. },
  633. // These are placeholder methods, to be overriden by extending plugin
  634. _mouseStart: function(event) {},
  635. _mouseDrag: function(event) {},
  636. _mouseStop: function(event) {},
  637. _mouseCapture: function(event) { return true; }
  638. });
  639. })(jQuery);
  640. /*
  641. * Note: While Microsoft is not the author of this file, Microsoft is
  642. * offering you a license subject to the terms of the Microsoft Software
  643. * License Terms for Microsoft ASP.NET Model View Controller 3.
  644. * Microsoft reserves all other rights. The notices below are provided
  645. * for informational purposes only and are not the license terms under
  646. * which Microsoft distributed this file.
  647. *
  648. * jQuery UI Draggable 1.8.7
  649. *
  650. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  651. *
  652. * http://docs.jquery.com/UI/Draggables
  653. *
  654. * Depends:
  655. * jquery.ui.core.js
  656. * jquery.ui.mouse.js
  657. * jquery.ui.widget.js
  658. */
  659. (function( $, undefined ) {
  660. $.widget("ui.draggable", $.ui.mouse, {
  661. widgetEventPrefix: "drag",
  662. options: {
  663. addClasses: true,
  664. appendTo: "parent",
  665. axis: false,
  666. connectToSortable: false,
  667. containment: false,
  668. cursor: "auto",
  669. cursorAt: false,
  670. grid: false,
  671. handle: false,
  672. helper: "original",
  673. iframeFix: false,
  674. opacity: false,
  675. refreshPositions: false,
  676. revert: false,
  677. revertDuration: 500,
  678. scope: "default",
  679. scroll: true,
  680. scrollSensitivity: 20,
  681. scrollSpeed: 20,
  682. snap: false,
  683. snapMode: "both",
  684. snapTolerance: 20,
  685. stack: false,
  686. zIndex: false
  687. },
  688. _create: function() {
  689. if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
  690. this.element[0].style.position = 'relative';
  691. (this.options.addClasses && this.element.addClass("ui-draggable"));
  692. (this.options.disabled && this.element.addClass("ui-draggable-disabled"));
  693. this._mouseInit();
  694. },
  695. destroy: function() {
  696. if(!this.element.data('draggable')) return;
  697. this.element
  698. .removeData("draggable")
  699. .unbind(".draggable")
  700. .removeClass("ui-draggable"
  701. + " ui-draggable-dragging"
  702. + " ui-draggable-disabled");
  703. this._mouseDestroy();
  704. return this;
  705. },
  706. _mouseCapture: function(event) {
  707. var o = this.options;
  708. // among others, prevent a drag on a resizable-handle
  709. if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
  710. return false;
  711. //Quit if we're not on a valid handle
  712. this.handle = this._getHandle(event);
  713. if (!this.handle)
  714. return false;
  715. return true;
  716. },
  717. _mouseStart: function(event) {
  718. var o = this.options;
  719. //Create and append the visible helper
  720. this.helper = this._createHelper(event);
  721. //Cache the helper size
  722. this._cacheHelperProportions();
  723. //If ddmanager is used for droppables, set the global draggable
  724. if($.ui.ddmanager)
  725. $.ui.ddmanager.current = this;
  726. /*
  727. * - Position generation -
  728. * This block generates everything position related - it's the core of draggables.
  729. */
  730. //Cache the margins of the original element
  731. this._cacheMargins();
  732. //Store the helper's css position
  733. this.cssPosition = this.helper.css("position");
  734. this.scrollParent = this.helper.scrollParent();
  735. //The element's absolute position on the page minus margins
  736. this.offset = this.positionAbs = this.element.offset();
  737. this.offset = {
  738. top: this.offset.top - this.margins.top,
  739. left: this.offset.left - this.margins.left
  740. };
  741. $.extend(this.offset, {
  742. click: { //Where the click happened, relative to the element
  743. left: event.pageX - this.offset.left,
  744. top: event.pageY - this.offset.top
  745. },
  746. parent: this._getParentOffset(),
  747. relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
  748. });
  749. //Generate the original position
  750. this.originalPosition = this.position = this._generatePosition(event);
  751. this.originalPageX = event.pageX;
  752. this.originalPageY = event.pageY;
  753. //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
  754. (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
  755. //Set a containment if given in the options
  756. if(o.containment)
  757. this._setContainment();
  758. //Trigger event + callbacks
  759. if(this._trigger("start", event) === false) {
  760. this._clear();
  761. return false;
  762. }
  763. //Recache the helper size
  764. this._cacheHelperProportions();
  765. //Prepare the droppable offsets
  766. if ($.ui.ddmanager && !o.dropBehaviour)
  767. $.ui.ddmanager.prepareOffsets(this, event);
  768. this.helper.addClass("ui-draggable-dragging");
  769. this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
  770. return true;
  771. },
  772. _mouseDrag: function(event, noPropagation) {
  773. //Compute the helpers position
  774. this.position = this._generatePosition(event);
  775. this.positionAbs = this._convertPositionTo("absolute");
  776. //Call plugins and callbacks and use the resulting position if something is returned
  777. if (!noPropagation) {
  778. var ui = this._uiHash();
  779. if(this._trigger('drag', event, ui) === false) {
  780. this._mouseUp({});
  781. return false;
  782. }
  783. this.position = ui.position;
  784. }
  785. if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
  786. if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
  787. if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
  788. return false;
  789. },
  790. _mouseStop: function(event) {
  791. //If we are using droppables, inform the manager about the drop
  792. var dropped = false;
  793. if ($.ui.ddmanager && !this.options.dropBehaviour)
  794. dropped = $.ui.ddmanager.drop(this, event);
  795. //if a drop comes from outside (a sortable)
  796. if(this.dropped) {
  797. dropped = this.dropped;
  798. this.dropped = false;
  799. }
  800. //if the original element is removed, don't bother to continue
  801. if(!this.element[0] || !this.element[0].parentNode)
  802. return false;
  803. 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))) {
  804. var self = this;
  805. $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
  806. if(self._trigger("stop", event) !== false) {
  807. self._clear();
  808. }
  809. });
  810. } else {
  811. if(this._trigger("stop", event) !== false) {
  812. this._clear();
  813. }
  814. }
  815. return false;
  816. },
  817. cancel: function() {
  818. if(this.helper.is(".ui-draggable-dragging")) {
  819. this._mouseUp({});
  820. } else {
  821. this._clear();
  822. }
  823. return this;
  824. },
  825. _getHandle: function(event) {
  826. var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
  827. $(this.options.handle, this.element)
  828. .find("*")
  829. .andSelf()
  830. .each(function() {
  831. if(this == event.target) handle = true;
  832. });
  833. return handle;
  834. },
  835. _createHelper: function(event) {
  836. var o = this.options;
  837. var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone() : this.element);
  838. if(!helper.parents('body').length)
  839. helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
  840. if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
  841. helper.css("position", "absolute");
  842. return helper;
  843. },
  844. _adjustOffsetFromHelper: function(obj) {
  845. if (typeof obj == 'string') {
  846. obj = obj.split(' ');
  847. }
  848. if ($.isArray(obj)) {
  849. obj = {left: +obj[0], top: +obj[1] || 0};
  850. }
  851. if ('left' in obj) {
  852. this.offset.click.left = obj.left + this.margins.left;
  853. }
  854. if ('right' in obj) {
  855. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  856. }
  857. if ('top' in obj) {
  858. this.offset.click.top = obj.top + this.margins.top;
  859. }
  860. if ('bottom' in obj) {
  861. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  862. }
  863. },
  864. _getParentOffset: function() {
  865. //Get the offsetParent and cache its position
  866. this.offsetParent = this.helper.offsetParent();
  867. var po = this.offsetParent.offset();
  868. // This is a special case where we need to modify a offset calculated on start, since the following happened:
  869. // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
  870. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
  871. // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
  872. if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
  873. po.left += this.scrollParent.scrollLeft();
  874. po.top += this.scrollParent.scrollTop();
  875. }
  876. if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
  877. || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
  878. po = { top: 0, left: 0 };
  879. return {
  880. top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
  881. left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
  882. };
  883. },
  884. _getRelativeOffset: function() {
  885. if(this.cssPosition == "relative") {
  886. var p = this.element.position();
  887. return {
  888. top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
  889. left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
  890. };
  891. } else {
  892. return { top: 0, left: 0 };
  893. }
  894. },
  895. _cacheMargins: function() {
  896. this.margins = {
  897. left: (parseInt(this.element.css("marginLeft"),10) || 0),
  898. top: (parseInt(this.element.css("marginTop"),10) || 0)
  899. };
  900. },
  901. _cacheHelperProportions: function() {
  902. this.helperProportions = {
  903. width: this.helper.outerWidth(),
  904. height: this.helper.outerHeight()
  905. };
  906. },
  907. _setContainment: function() {
  908. var o = this.options;
  909. if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
  910. if(o.containment == 'document' || o.containment == 'window') this.containment = [
  911. (o.containment == 'document' ? 0 : $(window).scrollLeft()) - this.offset.relative.left - this.offset.parent.left,
  912. (o.containment == 'document' ? 0 : $(window).scrollTop()) - this.offset.relative.top - this.offset.parent.top,
  913. (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
  914. (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
  915. ];
  916. if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
  917. var ce = $(o.containment)[0]; if(!ce) return;
  918. var co = $(o.containment).offset();
  919. var over = ($(ce).css("overflow") != 'hidden');
  920. this.containment = [
  921. co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
  922. co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
  923. 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,
  924. 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
  925. ];
  926. } else if(o.containment.constructor == Array) {
  927. this.containment = o.containment;
  928. }
  929. },
  930. _convertPositionTo: function(d, pos) {
  931. if(!pos) pos = this.position;
  932. var mod = d == "absolute" ? 1 : -1;
  933. 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);
  934. return {
  935. top: (
  936. pos.top // The absolute mouse position
  937. + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
  938. + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
  939. - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
  940. ),
  941. left: (
  942. pos.left // The absolute mouse position
  943. + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
  944. + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
  945. - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
  946. )
  947. };
  948. },
  949. _generatePosition: function(event) {
  950. 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);
  951. var pageX = event.pageX;
  952. var pageY = event.pageY;
  953. /*
  954. * - Position constraining -
  955. * Constrain the position to a mix of grid, containment.
  956. */
  957. if(this.originalPosition) { //If we are not dragging yet, we won't check for options
  958. if(this.containment) {
  959. if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
  960. if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
  961. if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
  962. if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
  963. }
  964. if(o.grid) {
  965. var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
  966. 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;
  967. var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
  968. 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;
  969. }
  970. }
  971. return {
  972. top: (
  973. pageY // The absolute mouse position
  974. - this.offset.click.top // Click offset (relative to the element)
  975. - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
  976. - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
  977. + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
  978. ),
  979. left: (
  980. pageX // The absolute mouse position
  981. - this.offset.click.left // Click offset (relative to the element)
  982. - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
  983. - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
  984. + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
  985. )
  986. };
  987. },
  988. _clear: function() {
  989. this.helper.removeClass("ui-draggable-dragging");
  990. if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove();
  991. //if($.ui.ddmanager) $.ui.ddmanager.current = null;
  992. this.helper = null;
  993. this.cancelHelperRemoval = false;
  994. },
  995. // From now on bulk stuff - mainly helpers
  996. _trigger: function(type, event, ui) {
  997. ui = ui || this._uiHash();
  998. $.ui.plugin.call(this, type, [event, ui]);
  999. if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
  1000. return $.Widget.prototype._trigger.call(this, type, event, ui);
  1001. },
  1002. plugins: {},
  1003. _uiHash: function(event) {
  1004. return {
  1005. helper: this.helper,
  1006. position: this.position,
  1007. originalPosition: this.originalPosition,
  1008. offset: this.positionAbs
  1009. };
  1010. }
  1011. });
  1012. $.extend($.ui.draggable, {
  1013. version: "1.8.7"
  1014. });
  1015. $.ui.plugin.add("draggable", "connectToSortable", {
  1016. start: function(event, ui) {
  1017. var inst = $(this).data("draggable"), o = inst.options,
  1018. uiSortable = $.extend({}, ui, { item: inst.element });
  1019. inst.sortables = [];
  1020. $(o.connectToSortable).each(function() {
  1021. var sortable = $.data(this, 'sortable');
  1022. if (sortable && !sortable.options.disabled) {
  1023. inst.sortables.push({
  1024. instance: sortable,
  1025. shouldRevert: sortable.options.revert
  1026. });
  1027. sortable._refreshItems(); //Do a one-time refresh at start to refresh the containerCache
  1028. sortable._trigger("activate", event, uiSortable);
  1029. }
  1030. });
  1031. },
  1032. stop: function(event, ui) {
  1033. //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
  1034. var inst = $(this).data("draggable"),
  1035. uiSortable = $.extend({}, ui, { item: inst.element });
  1036. $.each(inst.sortables, function() {
  1037. if(this.instance.isOver) {
  1038. this.instance.isOver = 0;
  1039. inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
  1040. this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
  1041. //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
  1042. if(this.shouldRevert) this.instance.options.revert = true;
  1043. //Trigger the stop of the sortable
  1044. this.instance._mouseStop(event);
  1045. this.instance.options.helper = this.instance.options._helper;
  1046. //If the helper has been the original item, restore properties in the sortable
  1047. if(inst.options.helper == 'original')
  1048. this.instance.currentItem.css({ top: 'auto', left: 'auto' });
  1049. } else {
  1050. this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
  1051. this.instance._trigger("deactivate", event, uiSortable);
  1052. }
  1053. });
  1054. },
  1055. drag: function(event, ui) {
  1056. var inst = $(this).data("draggable"), self = this;
  1057. var checkPos = function(o) {
  1058. var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
  1059. var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
  1060. var itemHeight = o.height, itemWidth = o.width;
  1061. var itemTop = o.top, itemLeft = o.left;
  1062. return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);
  1063. };
  1064. $.each(inst.sortables, function(i) {
  1065. //Copy over some variables to allow calling the sortable's native _intersectsWith
  1066. this.instance.positionAbs = inst.positionAbs;
  1067. this.instance.helperProportions = inst.helperProportions;
  1068. this.instance.offset.click = inst.offset.click;
  1069. if(this.instance._intersectsWith(this.instance.containerCache)) {
  1070. //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
  1071. if(!this.instance.isOver) {
  1072. this.instance.isOver = 1;
  1073. //Now we fake the start of dragging for the sortable instance,
  1074. //by cloning the list group item, appending it to the sortable and using it as inst.currentItem
  1075. //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)
  1076. this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true);
  1077. this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
  1078. this.instance.options.helper = function() { return ui.helper[0]; };
  1079. event.target = this.instance.currentItem[0];
  1080. this.instance._mouseCapture(event, true);
  1081. this.instance._mouseStart(event, true, true);
  1082. //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
  1083. this.instance.offset.click.top = inst.offset.click.top;
  1084. this.instance.offset.click.left = inst.offset.click.left;
  1085. this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
  1086. this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
  1087. inst._trigger("toSortable", event);
  1088. inst.dropped = this.instance.element; //draggable revert needs that
  1089. //hack so receive/update callbacks work (mostly)
  1090. inst.currentItem = inst.element;
  1091. this.instance.fromOutside = inst;
  1092. }
  1093. //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
  1094. if(this.instance.currentItem) this.instance._mouseDrag(event);
  1095. } else {
  1096. //If it doesn't intersect with the sortable, and it intersected before,
  1097. //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
  1098. if(this.instance.isOver) {
  1099. this.instance.isOver = 0;
  1100. this.instance.cancelHelperRemoval = true;
  1101. //Prevent reverting on this forced stop
  1102. this.instance.options.revert = false;
  1103. // The out event needs to be triggered independently
  1104. this.instance._trigger('out', event, this.instance._uiHash(this.instance));
  1105. this.instance._mouseStop(event, true);
  1106. this.instance.options.helper = this.instance.options._helper;
  1107. //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
  1108. this.instance.currentItem.remove();
  1109. if(this.instance.placeholder) this.instance.placeholder.remove();
  1110. inst._trigger("fromSortable", event);
  1111. inst.dropped = false; //draggable revert needs that
  1112. }
  1113. };
  1114. });
  1115. }
  1116. });
  1117. $.ui.plugin.add("draggable", "cursor", {
  1118. start: function(event, ui) {
  1119. var t = $('body'), o = $(this).data('draggable').options;
  1120. if (t.css("cursor")) o._cursor = t.css("cursor");
  1121. t.css("cursor", o.cursor);
  1122. },
  1123. stop: function(event, ui) {
  1124. var o = $(this).data('draggable').options;
  1125. if (o._cursor) $('body').css("cursor", o._cursor);
  1126. }
  1127. });
  1128. $.ui.plugin.add("draggable", "iframeFix", {
  1129. start: function(event, ui) {
  1130. var o = $(this).data('draggable').options;
  1131. $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
  1132. $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
  1133. .css({
  1134. width: this.offsetWidth+"px", height: this.offsetHeight+"px",
  1135. position: "absolute", opacity: "0.001", zIndex: 1000
  1136. })
  1137. .css($(this).offset())
  1138. .appendTo("body");
  1139. });
  1140. },
  1141. stop: function(event, ui) {
  1142. $("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers
  1143. }
  1144. });
  1145. $.ui.plugin.add("draggable", "opacity", {
  1146. start: function(event, ui) {
  1147. var t = $(ui.helper), o = $(this).data('draggable').options;
  1148. if(t.css("opacity")) o._opacity = t.css("opacity");
  1149. t.css('opacity', o.opacity);
  1150. },
  1151. stop: function(event, ui) {
  1152. var o = $(this).data('draggable').options;
  1153. if(o._opacity) $(ui.helper).css('opacity', o._opacity);
  1154. }
  1155. });
  1156. $.ui.plugin.add("draggable", "scroll", {
  1157. start: function(event, ui) {
  1158. var i = $(this).data("draggable");
  1159. if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
  1160. },
  1161. drag: function(event, ui) {
  1162. var i = $(this).data("draggable"), o = i.options, scrolled = false;
  1163. if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
  1164. if(!o.axis || o.axis != 'x') {
  1165. if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
  1166. i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
  1167. else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
  1168. i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
  1169. }
  1170. if(!o.axis || o.axis != 'y') {
  1171. if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
  1172. i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
  1173. else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)
  1174. i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
  1175. }
  1176. } else {
  1177. if(!o.axis || o.axis != 'x') {
  1178. if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
  1179. scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
  1180. else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
  1181. scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
  1182. }
  1183. if(!o.axis || o.axis != 'y') {
  1184. if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
  1185. scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
  1186. else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
  1187. scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
  1188. }
  1189. }
  1190. if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
  1191. $.ui.ddmanager.prepareOffsets(i, event);
  1192. }
  1193. });
  1194. $.ui.plugin.add("draggable", "snap", {
  1195. start: function(event, ui) {
  1196. var i = $(this).data("draggable"), o = i.options;
  1197. i.snapElements = [];
  1198. $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
  1199. var $t = $(this); var $o = $t.offset();
  1200. if(this != i.element[0]) i.snapElements.push({
  1201. item: this,
  1202. width: $t.outerWidth(), height: $t.outerHeight(),
  1203. top: $o.top, left: $o.left
  1204. });
  1205. });
  1206. },
  1207. drag: function(event, ui) {
  1208. var inst = $(this).data("draggable"), o = inst.options;
  1209. var d = o.snapTolerance;
  1210. var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
  1211. y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
  1212. for (var i = inst.snapElements.length - 1; i >= 0; i--){
  1213. var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
  1214. t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
  1215. //Yes, I know, this is insane ;)
  1216. 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))) {
  1217. 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 })));
  1218. inst.snapElements[i].snapping = false;
  1219. continue;
  1220. }
  1221. if(o.snapMode != 'inner') {
  1222. var ts = Math.abs(t - y2) <= d;
  1223. var bs = Math.abs(b - y1) <= d;
  1224. var ls = Math.abs(l - x2) <= d;
  1225. var rs = Math.abs(r - x1) <= d;
  1226. if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
  1227. if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
  1228. if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
  1229. if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
  1230. }
  1231. var first = (ts || bs || ls || rs);
  1232. if(o.snapMode != 'outer') {
  1233. var ts = Math.abs(t - y1) <= d;
  1234. var bs = Math.abs(b - y2) <= d;
  1235. var ls = Math.abs(l - x1) <= d;
  1236. var rs = Math.abs(r - x2) <= d;
  1237. if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
  1238. if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
  1239. if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
  1240. if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
  1241. }
  1242. if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
  1243. (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
  1244. inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
  1245. };
  1246. }
  1247. });
  1248. $.ui.plugin.add("draggable", "stack", {
  1249. start: function(event, ui) {
  1250. var o = $(this).data("draggable").options;
  1251. var group = $.makeArray($(o.stack)).sort(function(a,b) {
  1252. return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
  1253. });
  1254. if (!group.length) { return; }
  1255. var min = parseInt(group[0].style.zIndex) || 0;
  1256. $(group).each(function(i) {
  1257. this.style.zIndex = min + i;
  1258. });
  1259. this[0].style.zIndex = min + group.length;
  1260. }
  1261. });
  1262. $.ui.plugin.add("draggable", "zIndex", {
  1263. start: function(event, ui) {
  1264. var t = $(ui.helper), o = $(this).data("draggable").options;
  1265. if(t.css("zIndex")) o._zIndex = t.css("zIndex");
  1266. t.css('zIndex', o.zIndex);
  1267. },
  1268. stop: function(event, ui) {
  1269. var o = $(this).data("draggable").options;
  1270. if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
  1271. }
  1272. });
  1273. })(jQuery);
  1274. /*
  1275. * Note: While Microsoft is not the author of this file, Microsoft is
  1276. * offering you a license subject to the terms of the Microsoft Software
  1277. * License Terms for Microsoft ASP.NET Model View Controller 3.
  1278. * Microsoft reserves all other rights. The notices below are provided
  1279. * for informational purposes only and are not the license terms under
  1280. * which Microsoft distributed this file.
  1281. *
  1282. * jQuery UI Droppable 1.8.7
  1283. *
  1284. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  1285. *
  1286. * http://docs.jquery.com/UI/Droppables
  1287. *
  1288. * Depends:
  1289. * jquery.ui.core.js
  1290. * jquery.ui.widget.js
  1291. * jquery.ui.mouse.js
  1292. * jquery.ui.draggable.js
  1293. */
  1294. (function( $, undefined ) {
  1295. $.widget("ui.droppable", {
  1296. widgetEventPrefix: "drop",
  1297. options: {
  1298. accept: '*',
  1299. activeClass: false,
  1300. addClasses: true,
  1301. greedy: false,
  1302. hoverClass: false,
  1303. scope: 'default',
  1304. tolerance: 'intersect'
  1305. },
  1306. _create: function() {
  1307. var o = this.options, accept = o.accept;
  1308. this.isover = 0; this.isout = 1;
  1309. this.accept = $.isFunction(accept) ? accept : function(d) {
  1310. return d.is(accept);
  1311. };
  1312. //Store the droppable's proportions
  1313. this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
  1314. // Add the reference and positions to the manager
  1315. $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || [];
  1316. $.ui.ddmanager.droppables[o.scope].push(this);
  1317. (o.addClasses && this.element.addClass("ui-droppable"));
  1318. },
  1319. destroy: function() {
  1320. var drop = $.ui.ddmanager.droppables[this.options.scope];
  1321. for ( var i = 0; i < drop.length; i++ )
  1322. if ( drop[i] == this )
  1323. drop.splice(i, 1);
  1324. this.element
  1325. .removeClass("ui-droppable ui-droppable-disabled")
  1326. .removeData("droppable")
  1327. .unbind(".droppable");
  1328. return this;
  1329. },
  1330. _setOption: function(key, value) {
  1331. if(key == 'accept') {
  1332. this.accept = $.isFunction(value) ? value : function(d) {
  1333. return d.is(value);
  1334. };
  1335. }
  1336. $.Widget.prototype._setOption.apply(this, arguments);
  1337. },
  1338. _activate: function(event) {
  1339. var draggable = $.ui.ddmanager.current;
  1340. if(this.options.activeClass) this.element.addClass(this.options.activeClass);
  1341. (draggable && this._trigger('activate', event, this.ui(draggable)));
  1342. },
  1343. _deactivate: function(event) {
  1344. var draggable = $.ui.ddmanager.current;
  1345. if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
  1346. (draggable && this._trigger('deactivate', event, this.ui(draggable)));
  1347. },
  1348. _over: function(event) {
  1349. var draggable = $.ui.ddmanager.current;
  1350. if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
  1351. if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
  1352. if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
  1353. this._trigger('over', event, this.ui(draggable));
  1354. }
  1355. },
  1356. _out: function(event) {
  1357. var draggable = $.ui.ddmanager.current;
  1358. if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
  1359. if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
  1360. if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
  1361. this._trigger('out', event, this.ui(draggable));
  1362. }
  1363. },
  1364. _drop: function(event,custom) {
  1365. var draggable = custom || $.ui.ddmanager.current;
  1366. if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
  1367. var childrenIntersection = false;
  1368. this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
  1369. var inst = $.data(this, 'droppable');
  1370. if(
  1371. inst.options.greedy
  1372. && !inst.options.disabled
  1373. && inst.options.scope == draggable.options.scope
  1374. && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
  1375. && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
  1376. ) { childrenIntersection = true; return false; }
  1377. });
  1378. if(childrenIntersection) return false;
  1379. if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
  1380. if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
  1381. if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
  1382. this._trigger('drop', event, this.ui(draggable));
  1383. return this.element;
  1384. }
  1385. return false;
  1386. },
  1387. ui: function(c) {
  1388. return {
  1389. draggable: (c.currentItem || c.element),
  1390. helper: c.helper,
  1391. position: c.position,
  1392. offset: c.positionAbs
  1393. };
  1394. }
  1395. });
  1396. $.extend($.ui.droppable, {
  1397. version: "1.8.7"
  1398. });
  1399. $.ui.intersect = function(draggable, droppable, toleranceMode) {
  1400. if (!droppable.offset) return false;
  1401. var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
  1402. y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
  1403. var l = droppable.offset.left, r = l + droppable.proportions.width,
  1404. t = droppable.offset.top, b = t + droppable.proportions.height;
  1405. switch (toleranceMode) {
  1406. case 'fit':
  1407. return (l <= x1 && x2 <= r
  1408. && t <= y1 && y2 <= b);
  1409. break;
  1410. case 'intersect':
  1411. return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
  1412. && x2 - (draggable.helperProportions.width / 2) < r // Left Half
  1413. && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
  1414. && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
  1415. break;
  1416. case 'pointer':
  1417. var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
  1418. draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
  1419. isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
  1420. return isOver;
  1421. break;
  1422. case 'touch':
  1423. return (
  1424. (y1 >= t && y1 <= b) || // Top edge touching
  1425. (y2 >= t && y2 <= b) || // Bottom edge touching
  1426. (y1 < t && y2 > b) // Surrounded vertically
  1427. ) && (
  1428. (x1 >= l && x1 <= r) || // Left edge touching
  1429. (x2 >= l && x2 <= r) || // Right edge touching
  1430. (x1 < l && x2 > r) // Surrounded horizontally
  1431. );
  1432. break;
  1433. default:
  1434. return false;
  1435. break;
  1436. }
  1437. };
  1438. /*
  1439. This manager tracks offsets of draggables and droppables
  1440. */
  1441. $.ui.ddmanager = {
  1442. current: null,
  1443. droppables: { 'default': [] },
  1444. prepareOffsets: function(t, event) {
  1445. var m = $.ui.ddmanager.droppables[t.options.scope] || [];
  1446. var type = event ? event.type : null; // workaround for #2317
  1447. var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
  1448. droppablesLoop: for (var i = 0; i < m.length; i++) {
  1449. if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
  1450. 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
  1451. m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
  1452. m[i].offset = m[i].element.offset();
  1453. m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
  1454. if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
  1455. }
  1456. },
  1457. drop: function(draggable, event) {
  1458. var dropped = false;
  1459. $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
  1460. if(!this.options) return;
  1461. if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
  1462. dropped = dropped || this._drop.call(this, event);
  1463. if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
  1464. this.isout = 1; this.isover = 0;
  1465. this._deactivate.call(this, event);
  1466. }
  1467. });
  1468. return dropped;
  1469. },
  1470. drag: function(draggable, event) {
  1471. //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
  1472. if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
  1473. //Run through all droppables and check their positions based on specific tolerance options
  1474. $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
  1475. if(this.options.disabled || this.greedyChild || !this.visible) return;
  1476. var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
  1477. var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
  1478. if(!c) return;
  1479. var parentInstance;
  1480. if (this.options.greedy) {
  1481. var parent = this.element.parents(':data(droppable):eq(0)');
  1482. if (parent.length) {
  1483. parentInstance = $.data(parent[0], 'droppable');
  1484. parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
  1485. }
  1486. }
  1487. // we just moved into a greedy child
  1488. if (parentInstance && c == 'isover') {
  1489. parentInstance['isover'] = 0;
  1490. parentInstance['isout'] = 1;
  1491. parentInstance._out.call(parentInstance, event);
  1492. }
  1493. this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
  1494. this[c == "isover" ? "_over" : "_out"].call(this, event);
  1495. // we just moved out of a greedy child
  1496. if (parentInstance && c == 'isout') {
  1497. parentInstance['isout'] = 0;
  1498. parentInstance['isover'] = 1;
  1499. parentInstance._over.call(parentInstance, event);
  1500. }
  1501. });
  1502. }
  1503. };
  1504. })(jQuery);
  1505. /*
  1506. * Note: While Microsoft is not the author of this file, Microsoft is
  1507. * offering you a license subject to the terms of the Microsoft Software
  1508. * License Terms for Microsoft ASP.NET Model View Controller 3.
  1509. * Microsoft reserves all other rights. The notices below are provided
  1510. * for informational purposes only and are not the license terms under
  1511. * which Microsoft distributed this file.
  1512. *
  1513. * jQuery UI Resizable 1.8.7
  1514. *
  1515. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  1516. *
  1517. * http://docs.jquery.com/UI/Resizables
  1518. *
  1519. * Depends:
  1520. * jquery.ui.core.js
  1521. * jquery.ui.mouse.js
  1522. * jquery.ui.widget.js
  1523. */
  1524. (function( $, undefined ) {
  1525. $.widget("ui.resizable", $.ui.mouse, {
  1526. widgetEventPrefix: "resize",
  1527. options: {
  1528. alsoResize: false,
  1529. animate: false,
  1530. animateDuration: "slow",
  1531. animateEasing: "swing",
  1532. aspectRatio: false,
  1533. autoHide: false,
  1534. containment: false,
  1535. ghost: false,
  1536. grid: false,
  1537. handles: "e,s,se",
  1538. helper: false,
  1539. maxHeight: null,
  1540. maxWidth: null,
  1541. minHeight: 10,
  1542. minWidth: 10,
  1543. zIndex: 1000
  1544. },
  1545. _create: function() {
  1546. var self = this, o = this.options;
  1547. this.element.addClass("ui-resizable");
  1548. $.extend(this, {
  1549. _aspectRatio: !!(o.aspectRatio),
  1550. aspectRatio: o.aspectRatio,
  1551. originalElement: this.element,
  1552. _proportionallyResizeElements: [],
  1553. _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null
  1554. });
  1555. //Wrap the element if it cannot hold child nodes
  1556. if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
  1557. //Opera fix for relative positioning
  1558. if (/relative/.test(this.element.css('position')) && $.browser.opera)
  1559. this.element.css({ position: 'relative', top: 'auto', left: 'auto' });
  1560. //Create a wrapper element and set the wrapper to the new current internal element
  1561. this.element.wrap(
  1562. $('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({
  1563. position: this.element.css('position'),
  1564. width: this.element.outerWidth(),
  1565. height: this.element.outerHeight(),
  1566. top: this.element.css('top'),
  1567. left: this.element.css('left')
  1568. })
  1569. );
  1570. //Overwrite the original this.element
  1571. this.element = this.element.parent().data(
  1572. "resizable", this.element.data('resizable')
  1573. );
  1574. this.elementIsWrapper = true;
  1575. //Move margins to the wrapper
  1576. this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") });
  1577. this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
  1578. //Prevent Safari textarea resize
  1579. this.originalResizeStyle = this.originalElement.css('resize');
  1580. this.originalElement.css('resize', 'none');
  1581. //Push the actual element to our proportionallyResize internal array
  1582. this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' }));
  1583. // avoid IE jump (hard set the margin)
  1584. this.originalElement.css({ margin: this.originalElement.css('margin') });
  1585. // fix handlers offset
  1586. this._proportionallyResize();
  1587. }
  1588. 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' });
  1589. if(this.handles.constructor == String) {
  1590. if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw';
  1591. var n = this.handles.split(","); this.handles = {};
  1592. for(var i = 0; i < n.length; i++) {
  1593. var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle;
  1594. var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>');
  1595. // increase zIndex of sw, se, ne, nw axis
  1596. //TODO : this modifies original option
  1597. if(/sw|se|ne|nw/.test(handle)) axis.css({ zIndex: ++o.zIndex });
  1598. //TODO : What's going on here?
  1599. if ('se' == handle) {
  1600. axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');
  1601. };
  1602. //Insert into internal handles object and append to element
  1603. this.handles[handle] = '.ui-resizable-'+handle;
  1604. this.element.append(axis);
  1605. }
  1606. }
  1607. this._renderAxis = function(target) {
  1608. target = target || this.element;
  1609. for(var i in this.handles) {
  1610. if(this.handles[i].constructor == String)
  1611. this.handles[i] = $(this.handles[i], this.element).show();
  1612. //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
  1613. if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
  1614. var axis = $(this.handles[i], this.element), padWrapper = 0;
  1615. //Checking the correct pad and border
  1616. padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
  1617. //The padding type i have to apply...
  1618. var padPos = [ 'padding',
  1619. /ne|nw|n/.test(i) ? 'Top' :
  1620. /se|sw|s/.test(i) ? 'Bottom' :
  1621. /^e$/.test(i) ? 'Right' : 'Left' ].join("");
  1622. target.css(padPos, padWrapper);
  1623. this._proportionallyResize();
  1624. }
  1625. //TODO: What's that good for? There's not anything to be executed left
  1626. if(!$(this.handles[i]).length)
  1627. continue;
  1628. }
  1629. };
  1630. //TODO: make renderAxis a prototype function
  1631. this._renderAxis(this.element);
  1632. this._handles = $('.ui-resizable-handle', this.element)
  1633. .disableSelection();
  1634. //Matching axis name
  1635. this._handles.mouseover(function() {
  1636. if (!self.resizing) {
  1637. if (this.className)
  1638. var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
  1639. //Axis, default = se
  1640. self.axis = axis && axis[1] ? axis[1] : 'se';
  1641. }
  1642. });
  1643. //If we want to auto hide the elements
  1644. if (o.autoHide) {
  1645. this._handles.hide();
  1646. $(this.element)
  1647. .addClass("ui-resizable-autohide")
  1648. .hover(function() {
  1649. $(this).removeClass("ui-resizable-autohide");
  1650. self._handles.show();
  1651. },
  1652. function(){
  1653. if (!self.resizing) {
  1654. $(this).addClass("ui-resizable-autohide");
  1655. self._handles.hide();
  1656. }
  1657. });
  1658. }
  1659. //Initialize the mouse interaction
  1660. this._mouseInit();
  1661. },
  1662. destroy: function() {
  1663. this._mouseDestroy();
  1664. var _destroy = function(exp) {
  1665. $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
  1666. .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
  1667. };
  1668. //TODO: Unwrap at same DOM position
  1669. if (this.elementIsWrapper) {
  1670. _destroy(this.element);
  1671. var wrapper = this.element;
  1672. wrapper.after(
  1673. this.originalElement.css({
  1674. position: wrapper.css('position'),
  1675. width: wrapper.outerWidth(),
  1676. height: wrapper.outerHeight(),
  1677. top: wrapper.css('top'),
  1678. left: wrapper.css('left')
  1679. })
  1680. ).remove();
  1681. }
  1682. this.originalElement.css('resize', this.originalResizeStyle);
  1683. _destroy(this.originalElement);
  1684. return this;
  1685. },
  1686. _mouseCapture: function(event) {
  1687. var handle = false;
  1688. for (var i in this.handles) {
  1689. if ($(this.handles[i])[0] == event.target) {
  1690. handle = true;
  1691. }
  1692. }
  1693. return !this.options.disabled && handle;
  1694. },
  1695. _mouseStart: function(event) {
  1696. var o = this.options, iniPos = this.element.position(), el = this.element;
  1697. this.resizing = true;
  1698. this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
  1699. // bugfix for http://dev.jquery.com/ticket/1749
  1700. if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
  1701. el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left });
  1702. }
  1703. //Opera fixing relative position
  1704. if ($.browser.opera && (/relative/).test(el.css('position')))
  1705. el.css({ position: 'relative', top: 'auto', left: 'auto' });
  1706. this._renderProxy();
  1707. var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
  1708. if (o.containment) {
  1709. curleft += $(o.containment).scrollLeft() || 0;
  1710. curtop += $(o.containment).scrollTop() || 0;
  1711. }
  1712. //Store needed variables
  1713. this.offset = this.helper.offset();
  1714. this.position = { left: curleft, top: curtop };
  1715. this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
  1716. this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
  1717. this.originalPosition = { left: curleft, top: curtop };
  1718. this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
  1719. this.originalMousePosition = { left: event.pageX, top: event.pageY };
  1720. //Aspect Ratio
  1721. this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
  1722. var cursor = $('.ui-resizable-' + this.axis).css('cursor');
  1723. $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor);
  1724. el.addClass("ui-resizable-resizing");
  1725. this._propagate("start", event);
  1726. return true;
  1727. },
  1728. _mouseDrag: function(event) {
  1729. //Increase performance, avoid regex
  1730. var el = this.helper, o = this.options, props = {},
  1731. self = this, smp = this.originalMousePosition, a = this.axis;
  1732. var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0;
  1733. var trigger = this._change[a];
  1734. if (!trigger) return false;
  1735. // Calculate the attrs that will be change
  1736. var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;
  1737. if (this._aspectRatio || event.shiftKey)
  1738. data = this._updateRatio(data, event);
  1739. data = this._respectSize(data, event);
  1740. // plugins callbacks need to be called first
  1741. this._propagate("resize", event);
  1742. el.css({
  1743. top: this.position.top + "px", left: this.position.left + "px",
  1744. width: this.size.width + "px", height: this.size.height + "px"
  1745. });
  1746. if (!this._helper && this._proportionallyResizeElements.length)
  1747. this._proportionallyResize();
  1748. this._updateCache(data);
  1749. // calling the user callback at the end
  1750. this._trigger('resize', event, this.ui());
  1751. return false;
  1752. },
  1753. _mouseStop: function(event) {
  1754. this.resizing = false;
  1755. var o = this.options, self = this;
  1756. if(this._helper) {
  1757. var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
  1758. soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
  1759. soffsetw = ista ? 0 : self.sizeDiff.width;
  1760. var s = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
  1761. left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
  1762. top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
  1763. if (!o.animate)
  1764. this.element.css($.extend(s, { top: top, left: left }));
  1765. self.helper.height(self.size.height);
  1766. self.helper.width(self.size.width);
  1767. if (this._helper && !o.animate) this._proportionallyResize();
  1768. }
  1769. $('body').css('cursor', 'auto');
  1770. this.element.removeClass("ui-resizable-resizing");
  1771. this._propagate("stop", event);
  1772. if (this._helper) this.helper.remove();
  1773. return false;
  1774. },
  1775. _updateCache: function(data) {
  1776. var o = this.options;
  1777. this.offset = this.helper.offset();
  1778. if (isNumber(data.left)) this.position.left = data.left;
  1779. if (isNumber(data.top)) this.position.top = data.top;
  1780. if (isNumber(data.height)) this.size.height = data.height;
  1781. if (isNumber(data.width)) this.size.width = data.width;
  1782. },
  1783. _updateRatio: function(data, event) {
  1784. var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
  1785. if (data.height) data.width = (csize.height * this.aspectRatio);
  1786. else if (data.width) data.height = (csize.width / this.aspectRatio);
  1787. if (a == 'sw') {
  1788. data.left = cpos.left + (csize.width - data.width);
  1789. data.top = null;
  1790. }
  1791. if (a == 'nw') {
  1792. data.top = cpos.top + (csize.height - data.height);
  1793. data.left = cpos.left + (csize.width - data.width);
  1794. }
  1795. return data;
  1796. },
  1797. _respectSize: function(data, event) {
  1798. var el = this.helper, o = this.options, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,
  1799. ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
  1800. isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height);
  1801. if (isminw) data.width = o.minWidth;
  1802. if (isminh) data.height = o.minHeight;
  1803. if (ismaxw) data.width = o.maxWidth;
  1804. if (ismaxh) data.height = o.maxHeight;
  1805. var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;
  1806. var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
  1807. if (isminw && cw) data.left = dw - o.minWidth;
  1808. if (ismaxw && cw) data.left = dw - o.maxWidth;
  1809. if (isminh && ch) data.top = dh - o.minHeight;
  1810. if (ismaxh && ch) data.top = dh - o.maxHeight;
  1811. // fixing jump error on top/left - bug #2330
  1812. var isNotwh = !data.width && !data.height;
  1813. if (isNotwh && !data.left && data.top) data.top = null;
  1814. else if (isNotwh && !data.top && data.left) data.left = null;
  1815. return data;
  1816. },
  1817. _proportionallyResize: function() {
  1818. var o = this.options;
  1819. if (!this._proportionallyResizeElements.length) return;
  1820. var element = this.helper || this.element;
  1821. for (var i=0; i < this._proportionallyResizeElements.length; i++) {
  1822. var prel = this._proportionallyResizeElements[i];
  1823. if (!this.borderDif) {
  1824. var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
  1825. p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
  1826. this.borderDif = $.map(b, function(v, i) {
  1827. var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
  1828. return border + padding;
  1829. });
  1830. }
  1831. if ($.browser.msie && !(!($(element).is(':hidden') || $(element).parents(':hidden').length)))
  1832. continue;
  1833. prel.css({
  1834. height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
  1835. width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
  1836. });
  1837. };
  1838. },
  1839. _renderProxy: function() {
  1840. var el = this.element, o = this.options;
  1841. this.elementOffset = el.offset();
  1842. if(this._helper) {
  1843. this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
  1844. // fix ie6 offset TODO: This seems broken
  1845. var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
  1846. pxyoffset = ( ie6 ? 2 : -1 );
  1847. this.helper.addClass(this._helper).css({
  1848. width: this.element.outerWidth() + pxyoffset,
  1849. height: this.element.outerHeight() + pxyoffset,
  1850. position: 'absolute',
  1851. left: this.elementOffset.left - ie6offset +'px',
  1852. top: this.elementOffset.top - ie6offset +'px',
  1853. zIndex: ++o.zIndex //TODO: Don't modify option
  1854. });
  1855. this.helper
  1856. .appendTo("body")
  1857. .disableSelection();
  1858. } else {
  1859. this.helper = this.element;
  1860. }
  1861. },
  1862. _change: {
  1863. e: function(event, dx, dy) {
  1864. return { width: this.originalSize.width + dx };
  1865. },
  1866. w: function(event, dx, dy) {
  1867. var o = this.options, cs = this.originalSize, sp = this.originalPosition;
  1868. return { left: sp.left + dx, width: cs.width - dx };
  1869. },
  1870. n: function(event, dx, dy) {
  1871. var o = this.options, cs = this.originalSize, sp = this.originalPosition;
  1872. return { top: sp.top + dy, height: cs.height - dy };
  1873. },
  1874. s: function(event, dx, dy) {
  1875. return { height: this.originalSize.height + dy };
  1876. },
  1877. se: function(event, dx, dy) {
  1878. return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
  1879. },
  1880. sw: function(event, dx, dy) {
  1881. return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
  1882. },
  1883. ne: function(event, dx, dy) {
  1884. return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
  1885. },
  1886. nw: function(event, dx, dy) {
  1887. return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
  1888. }
  1889. },
  1890. _propagate: function(n, event) {
  1891. $.ui.plugin.call(this, n, [event, this.ui()]);
  1892. (n != "resize" && this._trigger(n, event, this.ui()));
  1893. },
  1894. plugins: {},
  1895. ui: function() {
  1896. return {
  1897. originalElement: this.originalElement,
  1898. element: this.element,
  1899. helper: this.helper,
  1900. position: this.position,
  1901. size: this.size,
  1902. originalSize: this.originalSize,
  1903. originalPosition: this.originalPosition
  1904. };
  1905. }
  1906. });
  1907. $.extend($.ui.resizable, {
  1908. version: "1.8.7"
  1909. });
  1910. /*
  1911. * Resizable Extensions
  1912. */
  1913. $.ui.plugin.add("resizable", "alsoResize", {
  1914. start: function (event, ui) {
  1915. var self = $(this).data("resizable"), o = self.options;
  1916. var _store = function (exp) {
  1917. $(exp).each(function() {
  1918. var el = $(this);
  1919. el.data("resizable-alsoresize", {
  1920. width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
  1921. left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10),
  1922. position: el.css('position') // to reset Opera on stop()
  1923. });
  1924. });
  1925. };
  1926. if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) {
  1927. if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
  1928. else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
  1929. }else{
  1930. _store(o.alsoResize);
  1931. }
  1932. },
  1933. resize: function (event, ui) {
  1934. var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition;
  1935. var delta = {
  1936. height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,
  1937. top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0
  1938. },
  1939. _alsoResize = function (exp, c) {
  1940. $(exp).each(function() {
  1941. var el = $(this), start = $(this).data("resizable-alsoresize"), style = {},
  1942. css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left'];
  1943. $.each(css, function (i, prop) {
  1944. var sum = (start[prop]||0) + (delta[prop]||0);
  1945. if (sum && sum >= 0)
  1946. style[prop] = sum || null;
  1947. });
  1948. // Opera fixing relative position
  1949. if ($.browser.opera && /relative/.test(el.css('position'))) {
  1950. self._revertToRelativePosition = true;
  1951. el.css({ position: 'absolute', top: 'auto', left: 'auto' });
  1952. }
  1953. el.css(style);
  1954. });
  1955. };
  1956. if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
  1957. $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
  1958. }else{
  1959. _alsoResize(o.alsoResize);
  1960. }
  1961. },
  1962. stop: function (event, ui) {
  1963. var self = $(this).data("resizable"), o = self.options;
  1964. var _reset = function (exp) {
  1965. $(exp).each(function() {
  1966. var el = $(this);
  1967. // reset position for Opera - no need to verify it was changed
  1968. el.css({ position: el.data("resizable-alsoresize").position });
  1969. });
  1970. };
  1971. if (self._revertToRelativePosition) {
  1972. self._revertToRelativePosition = false;
  1973. if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
  1974. $.each(o.alsoResize, function (exp) { _reset(exp); });
  1975. }else{
  1976. _reset(o.alsoResize);
  1977. }
  1978. }
  1979. $(this).removeData("resizable-alsoresize");
  1980. }
  1981. });
  1982. $.ui.plugin.add("resizable", "animate", {
  1983. stop: function(event, ui) {
  1984. var self = $(this).data("resizable"), o = self.options;
  1985. var pr = self._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
  1986. soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
  1987. soffsetw = ista ? 0 : self.sizeDiff.width;
  1988. var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
  1989. left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
  1990. top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
  1991. self.element.animate(
  1992. $.extend(style, top && left ? { top: top, left: left } : {}), {
  1993. duration: o.animateDuration,
  1994. easing: o.animateEasing,
  1995. step: function() {
  1996. var data = {
  1997. width: parseInt(self.element.css('width'), 10),
  1998. height: parseInt(self.element.css('height'), 10),
  1999. top: parseInt(self.element.css('top'), 10),
  2000. left: parseInt(self.element.css('left'), 10)
  2001. };
  2002. if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height });
  2003. // propagating resize, and updating values for each animation step
  2004. self._updateCache(data);
  2005. self._propagate("resize", event);
  2006. }
  2007. }
  2008. );
  2009. }
  2010. });
  2011. $.ui.plugin.add("resizable", "containment", {
  2012. start: function(event, ui) {
  2013. var self = $(this).data("resizable"), o = self.options, el = self.element;
  2014. var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
  2015. if (!ce) return;
  2016. self.containerElement = $(ce);
  2017. if (/document/.test(oc) || oc == document) {
  2018. self.containerOffset = { left: 0, top: 0 };
  2019. self.containerPosition = { left: 0, top: 0 };
  2020. self.parentData = {
  2021. element: $(document), left: 0, top: 0,
  2022. width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
  2023. };
  2024. }
  2025. // i'm a node, so compute top, left, right, bottom
  2026. else {
  2027. var element = $(ce), p = [];
  2028. $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
  2029. self.containerOffset = element.offset();
  2030. self.containerPosition = element.position();
  2031. self.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
  2032. var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width,
  2033. width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
  2034. self.parentData = {
  2035. element: ce, left: co.left, top: co.top, width: width, height: height
  2036. };
  2037. }
  2038. },
  2039. resize: function(event, ui) {
  2040. var self = $(this).data("resizable"), o = self.options,
  2041. ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position,
  2042. pRatio = self._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
  2043. if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co;
  2044. if (cp.left < (self._helper ? co.left : 0)) {
  2045. self.size.width = self.size.width + (self._helper ? (self.position.left - co.left) : (self.position.left - cop.left));
  2046. if (pRatio) self.size.height = self.size.width / o.aspectRatio;
  2047. self.position.left = o.helper ? co.left : 0;
  2048. }
  2049. if (cp.top < (self._helper ? co.top : 0)) {
  2050. self.size.height = self.size.height + (self._helper ? (self.position.top - co.top) : self.position.top);
  2051. if (pRatio) self.size.width = self.size.height * o.aspectRatio;
  2052. self.position.top = self._helper ? co.top : 0;
  2053. }
  2054. self.offset.left = self.parentData.left+self.position.left;
  2055. self.offset.top = self.parentData.top+self.position.top;
  2056. var woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ),
  2057. hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height );
  2058. var isParent = self.containerElement.get(0) == self.element.parent().get(0),
  2059. isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position'));
  2060. if(isParent && isOffsetRelative) woset -= self.parentData.left;
  2061. if (woset + self.size.width >= self.parentData.width) {
  2062. self.size.width = self.parentData.width - woset;
  2063. if (pRatio) self.size.height = self.size.width / self.aspectRatio;
  2064. }
  2065. if (hoset + self.size.height >= self.parentData.height) {
  2066. self.size.height = self.parentData.height - hoset;
  2067. if (pRatio) self.size.width = self.size.height * self.aspectRatio;
  2068. }
  2069. },
  2070. stop: function(event, ui){
  2071. var self = $(this).data("resizable"), o = self.options, cp = self.position,
  2072. co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement;
  2073. var helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height;
  2074. if (self._helper && !o.animate && (/relative/).test(ce.css('position')))
  2075. $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
  2076. if (self._helper && !o.animate && (/static/).test(ce.css('position')))
  2077. $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
  2078. }
  2079. });
  2080. $.ui.plugin.add("resizable", "ghost", {
  2081. start: function(event, ui) {
  2082. var self = $(this).data("resizable"), o = self.options, cs = self.size;
  2083. self.ghost = self.originalElement.clone();
  2084. self.ghost
  2085. .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
  2086. .addClass('ui-resizable-ghost')
  2087. .addClass(typeof o.ghost == 'string' ? o.ghost : '');
  2088. self.ghost.appendTo(self.helper);
  2089. },
  2090. resize: function(event, ui){
  2091. var self = $(this).data("resizable"), o = self.options;
  2092. if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });
  2093. },
  2094. stop: function(event, ui){
  2095. var self = $(this).data("resizable"), o = self.options;
  2096. if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));
  2097. }
  2098. });
  2099. $.ui.plugin.add("resizable", "grid", {
  2100. resize: function(event, ui) {
  2101. 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;
  2102. o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
  2103. 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);
  2104. if (/^(se|s|e)$/.test(a)) {
  2105. self.size.width = os.width + ox;
  2106. self.size.height = os.height + oy;
  2107. }
  2108. else if (/^(ne)$/.test(a)) {
  2109. self.size.width = os.width + ox;
  2110. self.size.height = os.height + oy;
  2111. self.position.top = op.top - oy;
  2112. }
  2113. else if (/^(sw)$/.test(a)) {
  2114. self.size.width = os.width + ox;
  2115. self.size.height = os.height + oy;
  2116. self.position.left = op.left - ox;
  2117. }
  2118. else {
  2119. self.size.width = os.width + ox;
  2120. self.size.height = os.height + oy;
  2121. self.position.top = op.top - oy;
  2122. self.position.left = op.left - ox;
  2123. }
  2124. }
  2125. });
  2126. var num = function(v) {
  2127. return parseInt(v, 10) || 0;
  2128. };
  2129. var isNumber = function(value) {
  2130. return !isNaN(parseInt(value, 10));
  2131. };
  2132. })(jQuery);
  2133. /*
  2134. * Note: While Microsoft is not the author of this file, Microsoft is
  2135. * offering you a license subject to the terms of the Microsoft Software
  2136. * License Terms for Microsoft ASP.NET Model View Controller 3.
  2137. * Microsoft reserves all other rights. The notices below are provided
  2138. * for informational purposes only and are not the license terms under
  2139. * which Microsoft distributed this file.
  2140. *
  2141. * jQuery UI Selectable 1.8.7
  2142. *
  2143. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  2144. *
  2145. * http://docs.jquery.com/UI/Selectables
  2146. *
  2147. * Depends:
  2148. * jquery.ui.core.js
  2149. * jquery.ui.mouse.js
  2150. * jquery.ui.widget.js
  2151. */
  2152. (function( $, undefined ) {
  2153. $.widget("ui.selectable", $.ui.mouse, {
  2154. options: {
  2155. appendTo: 'body',
  2156. autoRefresh: true,
  2157. distance: 0,
  2158. filter: '*',
  2159. tolerance: 'touch'
  2160. },
  2161. _create: function() {
  2162. var self = this;
  2163. this.element.addClass("ui-selectable");
  2164. this.dragged = false;
  2165. // cache selectee children based on filter
  2166. var selectees;
  2167. this.refresh = function() {
  2168. selectees = $(self.options.filter, self.element[0]);
  2169. selectees.each(function() {
  2170. var $this = $(this);
  2171. var pos = $this.offset();
  2172. $.data(this, "selectable-item", {
  2173. element: this,
  2174. $element: $this,
  2175. left: pos.left,
  2176. top: pos.top,
  2177. right: pos.left + $this.outerWidth(),
  2178. bottom: pos.top + $this.outerHeight(),
  2179. startselected: false,
  2180. selected: $this.hasClass('ui-selected'),
  2181. selecting: $this.hasClass('ui-selecting'),
  2182. unselecting: $this.hasClass('ui-unselecting')
  2183. });
  2184. });
  2185. };
  2186. this.refresh();
  2187. this.selectees = selectees.addClass("ui-selectee");
  2188. this._mouseInit();
  2189. this.helper = $("<div class='ui-selectable-helper'></div>");
  2190. },
  2191. destroy: function() {
  2192. this.selectees
  2193. .removeClass("ui-selectee")
  2194. .removeData("selectable-item");
  2195. this.element
  2196. .removeClass("ui-selectable ui-selectable-disabled")
  2197. .removeData("selectable")
  2198. .unbind(".selectable");
  2199. this._mouseDestroy();
  2200. return this;
  2201. },
  2202. _mouseStart: function(event) {
  2203. var self = this;
  2204. this.opos = [event.pageX, event.pageY];
  2205. if (this.options.disabled)
  2206. return;
  2207. var options = this.options;
  2208. this.selectees = $(options.filter, this.element[0]);
  2209. this._trigger("start", event);
  2210. $(options.appendTo).append(this.helper);
  2211. // position helper (lasso)
  2212. this.helper.css({
  2213. "left": event.clientX,
  2214. "top": event.clientY,
  2215. "width": 0,
  2216. "height": 0
  2217. });
  2218. if (options.autoRefresh) {
  2219. this.refresh();
  2220. }
  2221. this.selectees.filter('.ui-selected').each(function() {
  2222. var selectee = $.data(this, "selectable-item");
  2223. selectee.startselected = true;
  2224. if (!event.metaKey) {
  2225. selectee.$element.removeClass('ui-selected');
  2226. selectee.selected = false;
  2227. selectee.$element.addClass('ui-unselecting');
  2228. selectee.unselecting = true;
  2229. // selectable UNSELECTING callback
  2230. self._trigger("unselecting", event, {
  2231. unselecting: selectee.element
  2232. });
  2233. }
  2234. });
  2235. $(event.target).parents().andSelf().each(function() {
  2236. var selectee = $.data(this, "selectable-item");
  2237. if (selectee) {
  2238. var doSelect = !event.metaKey || !selectee.$element.hasClass('ui-selected');
  2239. selectee.$element
  2240. .removeClass(doSelect ? "ui-unselecting" : "ui-selected")
  2241. .addClass(doSelect ? "ui-selecting" : "ui-unselecting");
  2242. selectee.unselecting = !doSelect;
  2243. selectee.selecting = doSelect;
  2244. selectee.selected = doSelect;
  2245. // selectable (UN)SELECTING callback
  2246. if (doSelect) {
  2247. self._trigger("selecting", event, {
  2248. selecting: selectee.element
  2249. });
  2250. } else {
  2251. self._trigger("unselecting", event, {
  2252. unselecting: selectee.element
  2253. });
  2254. }
  2255. return false;
  2256. }
  2257. });
  2258. },
  2259. _mouseDrag: function(event) {
  2260. var self = this;
  2261. this.dragged = true;
  2262. if (this.options.disabled)
  2263. return;
  2264. var options = this.options;
  2265. var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY;
  2266. if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }
  2267. if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }
  2268. this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});
  2269. this.selectees.each(function() {
  2270. var selectee = $.data(this, "selectable-item");
  2271. //prevent helper from being selected if appendTo: selectable
  2272. if (!selectee || selectee.element == self.element[0])
  2273. return;
  2274. var hit = false;
  2275. if (options.tolerance == 'touch') {
  2276. hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
  2277. } else if (options.tolerance == 'fit') {
  2278. hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
  2279. }
  2280. if (hit) {
  2281. // SELECT
  2282. if (selectee.selected) {
  2283. selectee.$element.removeClass('ui-selected');
  2284. selectee.selected = false;
  2285. }
  2286. if (selectee.unselecting) {
  2287. selectee.$element.removeClass('ui-unselecting');
  2288. selectee.unselecting = false;
  2289. }
  2290. if (!selectee.selecting) {
  2291. selectee.$element.addClass('ui-selecting');
  2292. selectee.selecting = true;
  2293. // selectable SELECTING callback
  2294. self._trigger("selecting", event, {
  2295. selecting: selectee.element
  2296. });
  2297. }
  2298. } else {
  2299. // UNSELECT
  2300. if (selectee.selecting) {
  2301. if (event.metaKey && selectee.startselected) {
  2302. selectee.$element.removeClass('ui-selecting');
  2303. selectee.selecting = false;
  2304. selectee.$element.addClass('ui-selected');
  2305. selectee.selected = true;
  2306. } else {
  2307. selectee.$element.removeClass('ui-selecting');
  2308. selectee.selecting = false;
  2309. if (selectee.startselected) {
  2310. selectee.$element.addClass('ui-unselecting');
  2311. selectee.unselecting = true;
  2312. }
  2313. // selectable UNSELECTING callback
  2314. self._trigger("unselecting", event, {
  2315. unselecting: selectee.element
  2316. });
  2317. }
  2318. }
  2319. if (selectee.selected) {
  2320. if (!event.metaKey && !selectee.startselected) {
  2321. selectee.$element.removeClass('ui-selected');
  2322. selectee.selected = false;
  2323. selectee.$element.addClass('ui-unselecting');
  2324. selectee.unselecting = true;
  2325. // selectable UNSELECTING callback
  2326. self._trigger("unselecting", event, {
  2327. unselecting: selectee.element
  2328. });
  2329. }
  2330. }
  2331. }
  2332. });
  2333. return false;
  2334. },
  2335. _mouseStop: function(event) {
  2336. var self = this;
  2337. this.dragged = false;
  2338. var options = this.options;
  2339. $('.ui-unselecting', this.element[0]).each(function() {
  2340. var selectee = $.data(this, "selectable-item");
  2341. selectee.$element.removeClass('ui-unselecting');
  2342. selectee.unselecting = false;
  2343. selectee.startselected = false;
  2344. self._trigger("unselected", event, {
  2345. unselected: selectee.element
  2346. });
  2347. });
  2348. $('.ui-selecting', this.element[0]).each(function() {
  2349. var selectee = $.data(this, "selectable-item");
  2350. selectee.$element.removeClass('ui-selecting').addClass('ui-selected');
  2351. selectee.selecting = false;
  2352. selectee.selected = true;
  2353. selectee.startselected = true;
  2354. self._trigger("selected", event, {
  2355. selected: selectee.element
  2356. });
  2357. });
  2358. this._trigger("stop", event);
  2359. this.helper.remove();
  2360. return false;
  2361. }
  2362. });
  2363. $.extend($.ui.selectable, {
  2364. version: "1.8.7"
  2365. });
  2366. })(jQuery);
  2367. /*
  2368. * Note: While Microsoft is not the author of this file, Microsoft is
  2369. * offering you a license subject to the terms of the Microsoft Software
  2370. * License Terms for Microsoft ASP.NET Model View Controller 3.
  2371. * Microsoft reserves all other rights. The notices below are provided
  2372. * for informational purposes only and are not the license terms under
  2373. * which Microsoft distributed this file.
  2374. *
  2375. * jQuery UI Sortable 1.8.7
  2376. *
  2377. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  2378. *
  2379. * http://docs.jquery.com/UI/Sortables
  2380. *
  2381. * Depends:
  2382. * jquery.ui.core.js
  2383. * jquery.ui.mouse.js
  2384. * jquery.ui.widget.js
  2385. */
  2386. (function( $, undefined ) {
  2387. $.widget("ui.sortable", $.ui.mouse, {
  2388. widgetEventPrefix: "sort",
  2389. options: {
  2390. appendTo: "parent",
  2391. axis: false,
  2392. connectWith: false,
  2393. containment: false,
  2394. cursor: 'auto',
  2395. cursorAt: false,
  2396. dropOnEmpty: true,
  2397. forcePlaceholderSize: false,
  2398. forceHelperSize: false,
  2399. grid: false,
  2400. handle: false,
  2401. helper: "original",
  2402. items: '> *',
  2403. opacity: false,
  2404. placeholder: false,
  2405. revert: false,
  2406. scroll: true,
  2407. scrollSensitivity: 20,
  2408. scrollSpeed: 20,
  2409. scope: "default",
  2410. tolerance: "intersect",
  2411. zIndex: 1000
  2412. },
  2413. _create: function() {
  2414. var o = this.options;
  2415. this.containerCache = {};
  2416. this.element.addClass("ui-sortable");
  2417. //Get the items
  2418. this.refresh();
  2419. //Let's determine if the items are floating
  2420. this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false;
  2421. //Let's determine the parent's offset
  2422. this.offset = this.element.offset();
  2423. //Initialize mouse events for interaction
  2424. this._mouseInit();
  2425. },
  2426. destroy: function() {
  2427. this.element
  2428. .removeClass("ui-sortable ui-sortable-disabled")
  2429. .removeData("sortable")
  2430. .unbind(".sortable");
  2431. this._mouseDestroy();
  2432. for ( var i = this.items.length - 1; i >= 0; i-- )
  2433. this.items[i].item.removeData("sortable-item");
  2434. return this;
  2435. },
  2436. _setOption: function(key, value){
  2437. if ( key === "disabled" ) {
  2438. this.options[ key ] = value;
  2439. this.widget()
  2440. [ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" );
  2441. } else {
  2442. // Don't call widget base _setOption for disable as it adds ui-state-disabled class
  2443. $.Widget.prototype._setOption.apply(this, arguments);
  2444. }
  2445. },
  2446. _mouseCapture: function(event, overrideHandle) {
  2447. if (this.reverting) {
  2448. return false;
  2449. }
  2450. if(this.options.disabled || this.options.type == 'static') return false;
  2451. //We have to refresh the items data once first
  2452. this._refreshItems(event);
  2453. //Find out if the clicked node (or one of its parents) is a actual item in this.items
  2454. var currentItem = null, self = this, nodes = $(event.target).parents().each(function() {
  2455. if($.data(this, 'sortable-item') == self) {
  2456. currentItem = $(this);
  2457. return false;
  2458. }
  2459. });
  2460. if($.data(event.target, 'sortable-item') == self) currentItem = $(event.target);
  2461. if(!currentItem) return false;
  2462. if(this.options.handle && !overrideHandle) {
  2463. var validHandle = false;
  2464. $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; });
  2465. if(!validHandle) return false;
  2466. }
  2467. this.currentItem = currentItem;
  2468. this._removeCurrentsFromItems();
  2469. return true;
  2470. },
  2471. _mouseStart: function(event, overrideHandle, noActivation) {
  2472. var o = this.options, self = this;
  2473. this.currentContainer = this;
  2474. //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
  2475. this.refreshPositions();
  2476. //Create and append the visible helper
  2477. this.helper = this._createHelper(event);
  2478. //Cache the helper size
  2479. this._cacheHelperProportions();
  2480. /*
  2481. * - Position generation -
  2482. * This block generates everything position related - it's the core of draggables.
  2483. */
  2484. //Cache the margins of the original element
  2485. this._cacheMargins();
  2486. //Get the next scrolling parent
  2487. this.scrollParent = this.helper.scrollParent();
  2488. //The element's absolute position on the page minus margins
  2489. this.offset = this.currentItem.offset();
  2490. this.offset = {
  2491. top: this.offset.top - this.margins.top,
  2492. left: this.offset.left - this.margins.left
  2493. };
  2494. // Only after we got the offset, we can change the helper's position to absolute
  2495. // TODO: Still need to figure out a way to make relative sorting possible
  2496. this.helper.css("position", "absolute");
  2497. this.cssPosition = this.helper.css("position");
  2498. $.extend(this.offset, {
  2499. click: { //Where the click happened, relative to the element
  2500. left: event.pageX - this.offset.left,
  2501. top: event.pageY - this.offset.top
  2502. },
  2503. parent: this._getParentOffset(),
  2504. relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
  2505. });
  2506. //Generate the original position
  2507. this.originalPosition = this._generatePosition(event);
  2508. this.originalPageX = event.pageX;
  2509. this.originalPageY = event.pageY;
  2510. //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
  2511. (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
  2512. //Cache the former DOM position
  2513. this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
  2514. //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
  2515. if(this.helper[0] != this.currentItem[0]) {
  2516. this.currentItem.hide();
  2517. }
  2518. //Create the placeholder
  2519. this._createPlaceholder();
  2520. //Set a containment if given in the options
  2521. if(o.containment)
  2522. this._setContainment();
  2523. if(o.cursor) { // cursor option
  2524. if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor");
  2525. $('body').css("cursor", o.cursor);
  2526. }
  2527. if(o.opacity) { // opacity option
  2528. if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity");
  2529. this.helper.css("opacity", o.opacity);
  2530. }
  2531. if(o.zIndex) { // zIndex option
  2532. if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex");
  2533. this.helper.css("zIndex", o.zIndex);
  2534. }
  2535. //Prepare scrolling
  2536. if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML')
  2537. this.overflowOffset = this.scrollParent.offset();
  2538. //Call callbacks
  2539. this._trigger("start", event, this._uiHash());
  2540. //Recache the helper size
  2541. if(!this._preserveHelperProportions)
  2542. this._cacheHelperProportions();
  2543. //Post 'activate' events to possible containers
  2544. if(!noActivation) {
  2545. for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, self._uiHash(this)); }
  2546. }
  2547. //Prepare possible droppables
  2548. if($.ui.ddmanager)
  2549. $.ui.ddmanager.current = this;
  2550. if ($.ui.ddmanager && !o.dropBehaviour)
  2551. $.ui.ddmanager.prepareOffsets(this, event);
  2552. this.dragging = true;
  2553. this.helper.addClass("ui-sortable-helper");
  2554. this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
  2555. return true;
  2556. },
  2557. _mouseDrag: function(event) {
  2558. //Compute the helpers position
  2559. this.position = this._generatePosition(event);
  2560. this.positionAbs = this._convertPositionTo("absolute");
  2561. if (!this.lastPositionAbs) {
  2562. this.lastPositionAbs = this.positionAbs;
  2563. }
  2564. //Do scrolling
  2565. if(this.options.scroll) {
  2566. var o = this.options, scrolled = false;
  2567. if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
  2568. if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
  2569. this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
  2570. else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
  2571. this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
  2572. if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
  2573. this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
  2574. else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
  2575. this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
  2576. } else {
  2577. if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
  2578. scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
  2579. else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
  2580. scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
  2581. if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
  2582. scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
  2583. else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
  2584. scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
  2585. }
  2586. if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
  2587. $.ui.ddmanager.prepareOffsets(this, event);
  2588. }
  2589. //Regenerate the absolute position used for position checks
  2590. this.positionAbs = this._convertPositionTo("absolute");
  2591. //Set the helper position
  2592. if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
  2593. if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
  2594. //Rearrange
  2595. for (var i = this.items.length - 1; i >= 0; i--) {
  2596. //Cache variables and intersection, continue if no intersection
  2597. var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
  2598. if (!intersection) continue;
  2599. if(itemElement != this.currentItem[0] //cannot intersect with itself
  2600. && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
  2601. && !$.ui.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
  2602. && (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true)
  2603. //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
  2604. ) {
  2605. this.direction = intersection == 1 ? "down" : "up";
  2606. if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
  2607. this._rearrange(event, item);
  2608. } else {
  2609. break;
  2610. }
  2611. this._trigger("change", event, this._uiHash());
  2612. break;
  2613. }
  2614. }
  2615. //Post events to containers
  2616. this._contactContainers(event);
  2617. //Interconnect with droppables
  2618. if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
  2619. //Call callbacks
  2620. this._trigger('sort', event, this._uiHash());
  2621. this.lastPositionAbs = this.positionAbs;
  2622. return false;
  2623. },
  2624. _mouseStop: function(event, noPropagation) {
  2625. if(!event) return;
  2626. //If we are using droppables, inform the manager about the drop
  2627. if ($.ui.ddmanager && !this.options.dropBehaviour)
  2628. $.ui.ddmanager.drop(this, event);
  2629. if(this.options.revert) {
  2630. var self = this;
  2631. var cur = self.placeholder.offset();
  2632. self.reverting = true;
  2633. $(this.helper).animate({
  2634. left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
  2635. top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
  2636. }, parseInt(this.options.revert, 10) || 500, function() {
  2637. self._clear(event);
  2638. });
  2639. } else {
  2640. this._clear(event, noPropagation);
  2641. }
  2642. return false;
  2643. },
  2644. cancel: function() {
  2645. var self = this;
  2646. if(this.dragging) {
  2647. this._mouseUp();
  2648. if(this.options.helper == "original")
  2649. this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
  2650. else
  2651. this.currentItem.show();
  2652. //Post deactivating events to containers
  2653. for (var i = this.containers.length - 1; i >= 0; i--){
  2654. this.containers[i]._trigger("deactivate", null, self._uiHash(this));
  2655. if(this.containers[i].containerCache.over) {
  2656. this.containers[i]._trigger("out", null, self._uiHash(this));
  2657. this.containers[i].containerCache.over = 0;
  2658. }
  2659. }
  2660. }
  2661. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
  2662. if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  2663. if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
  2664. $.extend(this, {
  2665. helper: null,
  2666. dragging: false,
  2667. reverting: false,
  2668. _noFinalSort: null
  2669. });
  2670. if(this.domPosition.prev) {
  2671. $(this.domPosition.prev).after(this.currentItem);
  2672. } else {
  2673. $(this.domPosition.parent).prepend(this.currentItem);
  2674. }
  2675. return this;
  2676. },
  2677. serialize: function(o) {
  2678. var items = this._getItemsAsjQuery(o && o.connected);
  2679. var str = []; o = o || {};
  2680. $(items).each(function() {
  2681. var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
  2682. if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));
  2683. });
  2684. if(!str.length && o.key) {
  2685. str.push(o.key + '=');
  2686. }
  2687. return str.join('&');
  2688. },
  2689. toArray: function(o) {
  2690. var items = this._getItemsAsjQuery(o && o.connected);
  2691. var ret = []; o = o || {};
  2692. items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); });
  2693. return ret;
  2694. },
  2695. /* Be careful with the following core functions */
  2696. _intersectsWith: function(item) {
  2697. var x1 = this.positionAbs.left,
  2698. x2 = x1 + this.helperProportions.width,
  2699. y1 = this.positionAbs.top,
  2700. y2 = y1 + this.helperProportions.height;
  2701. var l = item.left,
  2702. r = l + item.width,
  2703. t = item.top,
  2704. b = t + item.height;
  2705. var dyClick = this.offset.click.top,
  2706. dxClick = this.offset.click.left;
  2707. var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;
  2708. if( this.options.tolerance == "pointer"
  2709. || this.options.forcePointerForContainers
  2710. || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])
  2711. ) {
  2712. return isOverElement;
  2713. } else {
  2714. return (l < x1 + (this.helperProportions.width / 2) // Right Half
  2715. && x2 - (this.helperProportions.width / 2) < r // Left Half
  2716. && t < y1 + (this.helperProportions.height / 2) // Bottom Half
  2717. && y2 - (this.helperProportions.height / 2) < b ); // Top Half
  2718. }
  2719. },
  2720. _intersectsWithPointer: function(item) {
  2721. var isOverElementHeight = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
  2722. isOverElementWidth = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
  2723. isOverElement = isOverElementHeight && isOverElementWidth,
  2724. verticalDirection = this._getDragVerticalDirection(),
  2725. horizontalDirection = this._getDragHorizontalDirection();
  2726. if (!isOverElement)
  2727. return false;
  2728. return this.floating ?
  2729. ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 )
  2730. : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) );
  2731. },
  2732. _intersectsWithSides: function(item) {
  2733. var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
  2734. isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
  2735. verticalDirection = this._getDragVerticalDirection(),
  2736. horizontalDirection = this._getDragHorizontalDirection();
  2737. if (this.floating && horizontalDirection) {
  2738. return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
  2739. } else {
  2740. return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
  2741. }
  2742. },
  2743. _getDragVerticalDirection: function() {
  2744. var delta = this.positionAbs.top - this.lastPositionAbs.top;
  2745. return delta != 0 && (delta > 0 ? "down" : "up");
  2746. },
  2747. _getDragHorizontalDirection: function() {
  2748. var delta = this.positionAbs.left - this.lastPositionAbs.left;
  2749. return delta != 0 && (delta > 0 ? "right" : "left");
  2750. },
  2751. refresh: function(event) {
  2752. this._refreshItems(event);
  2753. this.refreshPositions();
  2754. return this;
  2755. },
  2756. _connectWith: function() {
  2757. var options = this.options;
  2758. return options.connectWith.constructor == String
  2759. ? [options.connectWith]
  2760. : options.connectWith;
  2761. },
  2762. _getItemsAsjQuery: function(connected) {
  2763. var self = this;
  2764. var items = [];
  2765. var queries = [];
  2766. var connectWith = this._connectWith();
  2767. if(connectWith && connected) {
  2768. for (var i = connectWith.length - 1; i >= 0; i--){
  2769. var cur = $(connectWith[i]);
  2770. for (var j = cur.length - 1; j >= 0; j--){
  2771. var inst = $.data(cur[j], 'sortable');
  2772. if(inst && inst != this && !inst.options.disabled) {
  2773. queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]);
  2774. }
  2775. };
  2776. };
  2777. }
  2778. queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]);
  2779. for (var i = queries.length - 1; i >= 0; i--){
  2780. queries[i][0].each(function() {
  2781. items.push(this);
  2782. });
  2783. };
  2784. return $(items);
  2785. },
  2786. _removeCurrentsFromItems: function() {
  2787. var list = this.currentItem.find(":data(sortable-item)");
  2788. for (var i=0; i < this.items.length; i++) {
  2789. for (var j=0; j < list.length; j++) {
  2790. if(list[j] == this.items[i].item[0])
  2791. this.items.splice(i,1);
  2792. };
  2793. };
  2794. },
  2795. _refreshItems: function(event) {
  2796. this.items = [];
  2797. this.containers = [this];
  2798. var items = this.items;
  2799. var self = this;
  2800. var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
  2801. var connectWith = this._connectWith();
  2802. if(connectWith) {
  2803. for (var i = connectWith.length - 1; i >= 0; i--){
  2804. var cur = $(connectWith[i]);
  2805. for (var j = cur.length - 1; j >= 0; j--){
  2806. var inst = $.data(cur[j], 'sortable');
  2807. if(inst && inst != this && !inst.options.disabled) {
  2808. queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
  2809. this.containers.push(inst);
  2810. }
  2811. };
  2812. };
  2813. }
  2814. for (var i = queries.length - 1; i >= 0; i--) {
  2815. var targetData = queries[i][1];
  2816. var _queries = queries[i][0];
  2817. for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) {
  2818. var item = $(_queries[j]);
  2819. item.data('sortable-item', targetData); // Data for target checking (mouse manager)
  2820. items.push({
  2821. item: item,
  2822. instance: targetData,
  2823. width: 0, height: 0,
  2824. left: 0, top: 0
  2825. });
  2826. };
  2827. };
  2828. },
  2829. refreshPositions: function(fast) {
  2830. //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
  2831. if(this.offsetParent && this.helper) {
  2832. this.offset.parent = this._getParentOffset();
  2833. }
  2834. for (var i = this.items.length - 1; i >= 0; i--){
  2835. var item = this.items[i];
  2836. var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
  2837. if (!fast) {
  2838. item.width = t.outerWidth();
  2839. item.height = t.outerHeight();
  2840. }
  2841. var p = t.offset();
  2842. item.left = p.left;
  2843. item.top = p.top;
  2844. };
  2845. if(this.options.custom && this.options.custom.refreshContainers) {
  2846. this.options.custom.refreshContainers.call(this);
  2847. } else {
  2848. for (var i = this.containers.length - 1; i >= 0; i--){
  2849. var p = this.containers[i].element.offset();
  2850. this.containers[i].containerCache.left = p.left;
  2851. this.containers[i].containerCache.top = p.top;
  2852. this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
  2853. this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
  2854. };
  2855. }
  2856. return this;
  2857. },
  2858. _createPlaceholder: function(that) {
  2859. var self = that || this, o = self.options;
  2860. if(!o.placeholder || o.placeholder.constructor == String) {
  2861. var className = o.placeholder;
  2862. o.placeholder = {
  2863. element: function() {
  2864. var el = $(document.createElement(self.currentItem[0].nodeName))
  2865. .addClass(className || self.currentItem[0].className+" ui-sortable-placeholder")
  2866. .removeClass("ui-sortable-helper")[0];
  2867. if(!className)
  2868. el.style.visibility = "hidden";
  2869. return el;
  2870. },
  2871. update: function(container, p) {
  2872. // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
  2873. // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
  2874. if(className && !o.forcePlaceholderSize) return;
  2875. //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
  2876. if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); };
  2877. if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); };
  2878. }
  2879. };
  2880. }
  2881. //Create the placeholder
  2882. self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem));
  2883. //Append it after the actual current item
  2884. self.currentItem.after(self.placeholder);
  2885. //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
  2886. o.placeholder.update(self, self.placeholder);
  2887. },
  2888. _contactContainers: function(event) {
  2889. // get innermost container that intersects with item
  2890. var innermostContainer = null, innermostIndex = null;
  2891. for (var i = this.containers.length - 1; i >= 0; i--){
  2892. // never consider a container that's located within the item itself
  2893. if($.ui.contains(this.currentItem[0], this.containers[i].element[0]))
  2894. continue;
  2895. if(this._intersectsWith(this.containers[i].containerCache)) {
  2896. // if we've already found a container and it's more "inner" than this, then continue
  2897. if(innermostContainer && $.ui.contains(this.containers[i].element[0], innermostContainer.element[0]))
  2898. continue;
  2899. innermostContainer = this.containers[i];
  2900. innermostIndex = i;
  2901. } else {
  2902. // container doesn't intersect. trigger "out" event if necessary
  2903. if(this.containers[i].containerCache.over) {
  2904. this.containers[i]._trigger("out", event, this._uiHash(this));
  2905. this.containers[i].containerCache.over = 0;
  2906. }
  2907. }
  2908. }
  2909. // if no intersecting containers found, return
  2910. if(!innermostContainer) return;
  2911. // move the item into the container if it's not there already
  2912. if(this.containers.length === 1) {
  2913. this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
  2914. this.containers[innermostIndex].containerCache.over = 1;
  2915. } else if(this.currentContainer != this.containers[innermostIndex]) {
  2916. //When entering a new container, we will find the item with the least distance and append our item near it
  2917. var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top'];
  2918. for (var j = this.items.length - 1; j >= 0; j--) {
  2919. if(!$.ui.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
  2920. var cur = this.items[j][this.containers[innermostIndex].floating ? 'left' : 'top'];
  2921. if(Math.abs(cur - base) < dist) {
  2922. dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
  2923. }
  2924. }
  2925. if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
  2926. return;
  2927. this.currentContainer = this.containers[innermostIndex];
  2928. itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
  2929. this._trigger("change", event, this._uiHash());
  2930. this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
  2931. //Update the placeholder
  2932. this.options.placeholder.update(this.currentContainer, this.placeholder);
  2933. this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
  2934. this.containers[innermostIndex].containerCache.over = 1;
  2935. }
  2936. },
  2937. _createHelper: function(event) {
  2938. var o = this.options;
  2939. var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem);
  2940. if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already
  2941. $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
  2942. if(helper[0] == this.currentItem[0])
  2943. 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") };
  2944. if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width());
  2945. if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height());
  2946. return helper;
  2947. },
  2948. _adjustOffsetFromHelper: function(obj) {
  2949. if (typeof obj == 'string') {
  2950. obj = obj.split(' ');
  2951. }
  2952. if ($.isArray(obj)) {
  2953. obj = {left: +obj[0], top: +obj[1] || 0};
  2954. }
  2955. if ('left' in obj) {
  2956. this.offset.click.left = obj.left + this.margins.left;
  2957. }
  2958. if ('right' in obj) {
  2959. this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
  2960. }
  2961. if ('top' in obj) {
  2962. this.offset.click.top = obj.top + this.margins.top;
  2963. }
  2964. if ('bottom' in obj) {
  2965. this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
  2966. }
  2967. },
  2968. _getParentOffset: function() {
  2969. //Get the offsetParent and cache its position
  2970. this.offsetParent = this.helper.offsetParent();
  2971. var po = this.offsetParent.offset();
  2972. // This is a special case where we need to modify a offset calculated on start, since the following happened:
  2973. // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
  2974. // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
  2975. // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
  2976. if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
  2977. po.left += this.scrollParent.scrollLeft();
  2978. po.top += this.scrollParent.scrollTop();
  2979. }
  2980. if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
  2981. || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
  2982. po = { top: 0, left: 0 };
  2983. return {
  2984. top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
  2985. left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
  2986. };
  2987. },
  2988. _getRelativeOffset: function() {
  2989. if(this.cssPosition == "relative") {
  2990. var p = this.currentItem.position();
  2991. return {
  2992. top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
  2993. left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
  2994. };
  2995. } else {
  2996. return { top: 0, left: 0 };
  2997. }
  2998. },
  2999. _cacheMargins: function() {
  3000. this.margins = {
  3001. left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
  3002. top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
  3003. };
  3004. },
  3005. _cacheHelperProportions: function() {
  3006. this.helperProportions = {
  3007. width: this.helper.outerWidth(),
  3008. height: this.helper.outerHeight()
  3009. };
  3010. },
  3011. _setContainment: function() {
  3012. var o = this.options;
  3013. if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
  3014. if(o.containment == 'document' || o.containment == 'window') this.containment = [
  3015. 0 - this.offset.relative.left - this.offset.parent.left,
  3016. 0 - this.offset.relative.top - this.offset.parent.top,
  3017. $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
  3018. ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
  3019. ];
  3020. if(!(/^(document|window|parent)$/).test(o.containment)) {
  3021. var ce = $(o.containment)[0];
  3022. var co = $(o.containment).offset();
  3023. var over = ($(ce).css("overflow") != 'hidden');
  3024. this.containment = [
  3025. co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
  3026. co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
  3027. 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,
  3028. 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
  3029. ];
  3030. }
  3031. },
  3032. _convertPositionTo: function(d, pos) {
  3033. if(!pos) pos = this.position;
  3034. var mod = d == "absolute" ? 1 : -1;
  3035. 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);
  3036. return {
  3037. top: (
  3038. pos.top // The absolute mouse position
  3039. + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
  3040. + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
  3041. - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
  3042. ),
  3043. left: (
  3044. pos.left // The absolute mouse position
  3045. + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
  3046. + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
  3047. - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
  3048. )
  3049. };
  3050. },
  3051. _generatePosition: function(event) {
  3052. 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);
  3053. // This is another very weird special case that only happens for relative elements:
  3054. // 1. If the css position is relative
  3055. // 2. and the scroll parent is the document or similar to the offset parent
  3056. // we have to refresh the relative offset during the scroll so there are no jumps
  3057. if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {
  3058. this.offset.relative = this._getRelativeOffset();
  3059. }
  3060. var pageX = event.pageX;
  3061. var pageY = event.pageY;
  3062. /*
  3063. * - Position constraining -
  3064. * Constrain the position to a mix of grid, containment.
  3065. */
  3066. if(this.originalPosition) { //If we are not dragging yet, we won't check for options
  3067. if(this.containment) {
  3068. if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
  3069. if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
  3070. if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
  3071. if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
  3072. }
  3073. if(o.grid) {
  3074. var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
  3075. 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;
  3076. var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
  3077. 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;
  3078. }
  3079. }
  3080. return {
  3081. top: (
  3082. pageY // The absolute mouse position
  3083. - this.offset.click.top // Click offset (relative to the element)
  3084. - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
  3085. - this.offset.parent.top // The offsetParent's offset without borders (offset + border)
  3086. + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
  3087. ),
  3088. left: (
  3089. pageX // The absolute mouse position
  3090. - this.offset.click.left // Click offset (relative to the element)
  3091. - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
  3092. - this.offset.parent.left // The offsetParent's offset without borders (offset + border)
  3093. + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
  3094. )
  3095. };
  3096. },
  3097. _rearrange: function(event, i, a, hardRefresh) {
  3098. 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));
  3099. //Various things done here to improve the performance:
  3100. // 1. we create a setTimeout, that calls refreshPositions
  3101. // 2. on the instance, we have a counter variable, that get's higher after every append
  3102. // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
  3103. // 4. this lets only the last addition to the timeout stack through
  3104. this.counter = this.counter ? ++this.counter : 1;
  3105. var self = this, counter = this.counter;
  3106. window.setTimeout(function() {
  3107. if(counter == self.counter) self.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
  3108. },0);
  3109. },
  3110. _clear: function(event, noPropagation) {
  3111. this.reverting = false;
  3112. // We delay all events that have to be triggered to after the point where the placeholder has been removed and
  3113. // everything else normalized again
  3114. var delayedTriggers = [], self = this;
  3115. // We first have to update the dom position of the actual currentItem
  3116. // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
  3117. if(!this._noFinalSort && this.currentItem[0].parentNode) this.placeholder.before(this.currentItem);
  3118. this._noFinalSort = null;
  3119. if(this.helper[0] == this.currentItem[0]) {
  3120. for(var i in this._storedCSS) {
  3121. if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = '';
  3122. }
  3123. this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
  3124. } else {
  3125. this.currentItem.show();
  3126. }
  3127. if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
  3128. 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
  3129. if(!$.ui.contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element
  3130. if(!noPropagation) delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
  3131. for (var i = this.containers.length - 1; i >= 0; i--){
  3132. if($.ui.contains(this.containers[i].element[0], this.currentItem[0]) && !noPropagation) {
  3133. delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
  3134. delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
  3135. }
  3136. };
  3137. };
  3138. //Post events to containers
  3139. for (var i = this.containers.length - 1; i >= 0; i--){
  3140. if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
  3141. if(this.containers[i].containerCache.over) {
  3142. delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
  3143. this.containers[i].containerCache.over = 0;
  3144. }
  3145. }
  3146. //Do what was originally in plugins
  3147. if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor
  3148. if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity
  3149. if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index
  3150. this.dragging = false;
  3151. if(this.cancelHelperRemoval) {
  3152. if(!noPropagation) {
  3153. this._trigger("beforeStop", event, this._uiHash());
  3154. for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
  3155. this._trigger("stop", event, this._uiHash());
  3156. }
  3157. return false;
  3158. }
  3159. if(!noPropagation) this._trigger("beforeStop", event, this._uiHash());
  3160. //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
  3161. this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
  3162. if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null;
  3163. if(!noPropagation) {
  3164. for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
  3165. this._trigger("stop", event, this._uiHash());
  3166. }
  3167. this.fromOutside = false;
  3168. return true;
  3169. },
  3170. _trigger: function() {
  3171. if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
  3172. this.cancel();
  3173. }
  3174. },
  3175. _uiHash: function(inst) {
  3176. var self = inst || this;
  3177. return {
  3178. helper: self.helper,
  3179. placeholder: self.placeholder || $([]),
  3180. position: self.position,
  3181. originalPosition: self.originalPosition,
  3182. offset: self.positionAbs,
  3183. item: self.currentItem,
  3184. sender: inst ? inst.element : null
  3185. };
  3186. }
  3187. });
  3188. $.extend($.ui.sortable, {
  3189. version: "1.8.7"
  3190. });
  3191. })(jQuery);
  3192. /*
  3193. * Note: While Microsoft is not the author of this file, Microsoft is
  3194. * offering you a license subject to the terms of the Microsoft Software
  3195. * License Terms for Microsoft ASP.NET Model View Controller 3.
  3196. * Microsoft reserves all other rights. The notices below are provided
  3197. * for informational purposes only and are not the license terms under
  3198. * which Microsoft distributed this file.
  3199. *
  3200. * jQuery UI Effects 1.8.7
  3201. *
  3202. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  3203. *
  3204. * http://docs.jquery.com/UI/Effects/
  3205. */
  3206. ;jQuery.effects || (function($, undefined) {
  3207. $.effects = {};
  3208. /******************************************************************************/
  3209. /****************************** COLOR ANIMATIONS ******************************/
  3210. /******************************************************************************/
  3211. // override the animation for color styles
  3212. $.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor',
  3213. 'borderRightColor', 'borderTopColor', 'borderColor', 'color', 'outlineColor'],
  3214. function(i, attr) {
  3215. $.fx.step[attr] = function(fx) {
  3216. if (!fx.colorInit) {
  3217. fx.start = getColor(fx.elem, attr);
  3218. fx.end = getRGB(fx.end);
  3219. fx.colorInit = true;
  3220. }
  3221. fx.elem.style[attr] = 'rgb(' +
  3222. Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' +
  3223. Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' +
  3224. Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')';
  3225. };
  3226. });
  3227. // Color Conversion functions from highlightFade
  3228. // By Blair Mitchelmore
  3229. // http://jquery.offput.ca/highlightFade/
  3230. // Parse strings looking for color tuples [255,255,255]
  3231. function getRGB(color) {
  3232. var result;
  3233. // Check if we're already dealing with an array of colors
  3234. if ( color && color.constructor == Array && color.length == 3 )
  3235. return color;
  3236. // Look for rgb(num,num,num)
  3237. if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
  3238. return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
  3239. // Look for rgb(num%,num%,num%)
  3240. if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
  3241. return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
  3242. // Look for #a0b1c2
  3243. if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
  3244. return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
  3245. // Look for #fff
  3246. if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
  3247. return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
  3248. // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
  3249. if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
  3250. return colors['transparent'];
  3251. // Otherwise, we're most likely dealing with a named color
  3252. return colors[$.trim(color).toLowerCase()];
  3253. }
  3254. function getColor(elem, attr) {
  3255. var color;
  3256. do {
  3257. color = $.curCSS(elem, attr);
  3258. // Keep going until we find an element that has color, or we hit the body
  3259. if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )
  3260. break;
  3261. attr = "backgroundColor";
  3262. } while ( elem = elem.parentNode );
  3263. return getRGB(color);
  3264. };
  3265. // Some named colors to work with
  3266. // From Interface by Stefan Petre
  3267. // http://interface.eyecon.ro/
  3268. var colors = {
  3269. aqua:[0,255,255],
  3270. azure:[240,255,255],
  3271. beige:[245,245,220],
  3272. black:[0,0,0],
  3273. blue:[0,0,255],
  3274. brown:[165,42,42],
  3275. cyan:[0,255,255],
  3276. darkblue:[0,0,139],
  3277. darkcyan:[0,139,139],
  3278. darkgrey:[169,169,169],
  3279. darkgreen:[0,100,0],
  3280. darkkhaki:[189,183,107],
  3281. darkmagenta:[139,0,139],
  3282. darkolivegreen:[85,107,47],
  3283. darkorange:[255,140,0],
  3284. darkorchid:[153,50,204],
  3285. darkred:[139,0,0],
  3286. darksalmon:[233,150,122],
  3287. darkviolet:[148,0,211],
  3288. fuchsia:[255,0,255],
  3289. gold:[255,215,0],
  3290. green:[0,128,0],
  3291. indigo:[75,0,130],
  3292. khaki:[240,230,140],
  3293. lightblue:[173,216,230],
  3294. lightcyan:[224,255,255],
  3295. lightgreen:[144,238,144],
  3296. lightgrey:[211,211,211],
  3297. lightpink:[255,182,193],
  3298. lightyellow:[255,255,224],
  3299. lime:[0,255,0],
  3300. magenta:[255,0,255],
  3301. maroon:[128,0,0],
  3302. navy:[0,0,128],
  3303. olive:[128,128,0],
  3304. orange:[255,165,0],
  3305. pink:[255,192,203],
  3306. purple:[128,0,128],
  3307. violet:[128,0,128],
  3308. red:[255,0,0],
  3309. silver:[192,192,192],
  3310. white:[255,255,255],
  3311. yellow:[255,255,0],
  3312. transparent: [255,255,255]
  3313. };
  3314. /******************************************************************************/
  3315. /****************************** CLASS ANIMATIONS ******************************/
  3316. /******************************************************************************/
  3317. var classAnimationActions = ['add', 'remove', 'toggle'],
  3318. shorthandStyles = {
  3319. border: 1,
  3320. borderBottom: 1,
  3321. borderColor: 1,
  3322. borderLeft: 1,
  3323. borderRight: 1,
  3324. borderTop: 1,
  3325. borderWidth: 1,
  3326. margin: 1,
  3327. padding: 1
  3328. };
  3329. function getElementStyles() {
  3330. var style = document.defaultView
  3331. ? document.defaultView.getComputedStyle(this, null)
  3332. : this.currentStyle,
  3333. newStyle = {},
  3334. key,
  3335. camelCase;
  3336. // webkit enumerates style porperties
  3337. if (style && style.length && style[0] && style[style[0]]) {
  3338. var len = style.length;
  3339. while (len--) {
  3340. key = style[len];
  3341. if (typeof style[key] == 'string') {
  3342. camelCase = key.replace(/\-(\w)/g, function(all, letter){
  3343. return letter.toUpperCase();
  3344. });
  3345. newStyle[camelCase] = style[key];
  3346. }
  3347. }
  3348. } else {
  3349. for (key in style) {
  3350. if (typeof style[key] === 'string') {
  3351. newStyle[key] = style[key];
  3352. }
  3353. }
  3354. }
  3355. return newStyle;
  3356. }
  3357. function filterStyles(styles) {
  3358. var name, value;
  3359. for (name in styles) {
  3360. value = styles[name];
  3361. if (
  3362. // ignore null and undefined values
  3363. value == null ||
  3364. // ignore functions (when does this occur?)
  3365. $.isFunction(value) ||
  3366. // shorthand styles that need to be expanded
  3367. name in shorthandStyles ||
  3368. // ignore scrollbars (break in IE)
  3369. (/scrollbar/).test(name) ||
  3370. // only colors or values that can be converted to numbers
  3371. (!(/color/i).test(name) && isNaN(parseFloat(value)))
  3372. ) {
  3373. delete styles[name];
  3374. }
  3375. }
  3376. return styles;
  3377. }
  3378. function styleDifference(oldStyle, newStyle) {
  3379. var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459
  3380. name;
  3381. for (name in newStyle) {
  3382. if (oldStyle[name] != newStyle[name]) {
  3383. diff[name] = newStyle[name];
  3384. }
  3385. }
  3386. return diff;
  3387. }
  3388. $.effects.animateClass = function(value, duration, easing, callback) {
  3389. if ($.isFunction(easing)) {
  3390. callback = easing;
  3391. easing = null;
  3392. }
  3393. return this.each(function() {
  3394. $.queue(this, 'fx', function() {
  3395. var that = $(this),
  3396. originalStyleAttr = that.attr('style') || ' ',
  3397. originalStyle = filterStyles(getElementStyles.call(this)),
  3398. newStyle,
  3399. className = that.attr('className');
  3400. $.each(classAnimationActions, function(i, action) {
  3401. if (value[action]) {
  3402. that[action + 'Class'](value[action]);
  3403. }
  3404. });
  3405. newStyle = filterStyles(getElementStyles.call(this));
  3406. that.attr('className', className);
  3407. that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() {
  3408. $.each(classAnimationActions, function(i, action) {
  3409. if (value[action]) { that[action + 'Class'](value[action]); }
  3410. });
  3411. // work around bug in IE by clearing the cssText before setting it
  3412. if (typeof that.attr('style') == 'object') {
  3413. that.attr('style').cssText = '';
  3414. that.attr('style').cssText = originalStyleAttr;
  3415. } else {
  3416. that.attr('style', originalStyleAttr);
  3417. }
  3418. if (callback) { callback.apply(this, arguments); }
  3419. });
  3420. // $.animate adds a function to the end of the queue
  3421. // but we want it at the front
  3422. var queue = $.queue(this),
  3423. anim = queue.splice(queue.length - 1, 1)[0];
  3424. queue.splice(1, 0, anim);
  3425. $.dequeue(this);
  3426. });
  3427. });
  3428. };
  3429. $.fn.extend({
  3430. _addClass: $.fn.addClass,
  3431. addClass: function(classNames, speed, easing, callback) {
  3432. return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
  3433. },
  3434. _removeClass: $.fn.removeClass,
  3435. removeClass: function(classNames,speed,easing,callback) {
  3436. return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
  3437. },
  3438. _toggleClass: $.fn.toggleClass,
  3439. toggleClass: function(classNames, force, speed, easing, callback) {
  3440. if ( typeof force == "boolean" || force === undefined ) {
  3441. if ( !speed ) {
  3442. // without speed parameter;
  3443. return this._toggleClass(classNames, force);
  3444. } else {
  3445. return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]);
  3446. }
  3447. } else {
  3448. // without switch parameter;
  3449. return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]);
  3450. }
  3451. },
  3452. switchClass: function(remove,add,speed,easing,callback) {
  3453. return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
  3454. }
  3455. });
  3456. /******************************************************************************/
  3457. /*********************************** EFFECTS **********************************/
  3458. /******************************************************************************/
  3459. $.extend($.effects, {
  3460. version: "1.8.7",
  3461. // Saves a set of properties in a data storage
  3462. save: function(element, set) {
  3463. for(var i=0; i < set.length; i++) {
  3464. if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);
  3465. }
  3466. },
  3467. // Restores a set of previously saved properties from a data storage
  3468. restore: function(element, set) {
  3469. for(var i=0; i < set.length; i++) {
  3470. if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));
  3471. }
  3472. },
  3473. setMode: function(el, mode) {
  3474. if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
  3475. return mode;
  3476. },
  3477. getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
  3478. // this should be a little more flexible in the future to handle a string & hash
  3479. var y, x;
  3480. switch (origin[0]) {
  3481. case 'top': y = 0; break;
  3482. case 'middle': y = 0.5; break;
  3483. case 'bottom': y = 1; break;
  3484. default: y = origin[0] / original.height;
  3485. };
  3486. switch (origin[1]) {
  3487. case 'left': x = 0; break;
  3488. case 'center': x = 0.5; break;
  3489. case 'right': x = 1; break;
  3490. default: x = origin[1] / original.width;
  3491. };
  3492. return {x: x, y: y};
  3493. },
  3494. // Wraps the element around a wrapper that copies position properties
  3495. createWrapper: function(element) {
  3496. // if the element is already wrapped, return it
  3497. if (element.parent().is('.ui-effects-wrapper')) {
  3498. return element.parent();
  3499. }
  3500. // wrap the element
  3501. var props = {
  3502. width: element.outerWidth(true),
  3503. height: element.outerHeight(true),
  3504. 'float': element.css('float')
  3505. },
  3506. wrapper = $('<div></div>')
  3507. .addClass('ui-effects-wrapper')
  3508. .css({
  3509. fontSize: '100%',
  3510. background: 'transparent',
  3511. border: 'none',
  3512. margin: 0,
  3513. padding: 0
  3514. });
  3515. element.wrap(wrapper);
  3516. wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element
  3517. // transfer positioning properties to the wrapper
  3518. if (element.css('position') == 'static') {
  3519. wrapper.css({ position: 'relative' });
  3520. element.css({ position: 'relative' });
  3521. } else {
  3522. $.extend(props, {
  3523. position: element.css('position'),
  3524. zIndex: element.css('z-index')
  3525. });
  3526. $.each(['top', 'left', 'bottom', 'right'], function(i, pos) {
  3527. props[pos] = element.css(pos);
  3528. if (isNaN(parseInt(props[pos], 10))) {
  3529. props[pos] = 'auto';
  3530. }
  3531. });
  3532. element.css({position: 'relative', top: 0, left: 0 });
  3533. }
  3534. return wrapper.css(props).show();
  3535. },
  3536. removeWrapper: function(element) {
  3537. if (element.parent().is('.ui-effects-wrapper'))
  3538. return element.parent().replaceWith(element);
  3539. return element;
  3540. },
  3541. setTransition: function(element, list, factor, value) {
  3542. value = value || {};
  3543. $.each(list, function(i, x){
  3544. unit = element.cssUnit(x);
  3545. if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
  3546. });
  3547. return value;
  3548. }
  3549. });
  3550. function _normalizeArguments(effect, options, speed, callback) {
  3551. // shift params for method overloading
  3552. if (typeof effect == 'object') {
  3553. callback = options;
  3554. speed = null;
  3555. options = effect;
  3556. effect = options.effect;
  3557. }
  3558. if ($.isFunction(options)) {
  3559. callback = options;
  3560. speed = null;
  3561. options = {};
  3562. }
  3563. if (typeof options == 'number' || $.fx.speeds[options]) {
  3564. callback = speed;
  3565. speed = options;
  3566. options = {};
  3567. }
  3568. if ($.isFunction(speed)) {
  3569. callback = speed;
  3570. speed = null;
  3571. }
  3572. options = options || {};
  3573. speed = speed || options.duration;
  3574. speed = $.fx.off ? 0 : typeof speed == 'number'
  3575. ? speed : speed in $.fx.speeds ? $.fx.speeds[speed] : $.fx.speeds._default;
  3576. callback = callback || options.complete;
  3577. return [effect, options, speed, callback];
  3578. }
  3579. function standardSpeed( speed ) {
  3580. // valid standard speeds
  3581. if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) {
  3582. return true;
  3583. }
  3584. // invalid strings - treat as "normal" speed
  3585. if ( typeof speed === "string" && !$.effects[ speed ] ) {
  3586. return true;
  3587. }
  3588. return false;
  3589. }
  3590. $.fn.extend({
  3591. effect: function(effect, options, speed, callback) {
  3592. var args = _normalizeArguments.apply(this, arguments),
  3593. // TODO: make effects take actual parameters instead of a hash
  3594. args2 = {
  3595. options: args[1],
  3596. duration: args[2],
  3597. callback: args[3]
  3598. },
  3599. mode = args2.options.mode,
  3600. effectMethod = $.effects[effect];
  3601. if ( $.fx.off || !effectMethod ) {
  3602. // delegate to the original method (e.g., .show()) if possible
  3603. if ( mode ) {
  3604. return this[ mode ]( args2.duration, args2.callback );
  3605. } else {
  3606. return this.each(function() {
  3607. if ( args2.callback ) {
  3608. args2.callback.call( this );
  3609. }
  3610. });
  3611. }
  3612. }
  3613. return effectMethod.call(this, args2);
  3614. },
  3615. _show: $.fn.show,
  3616. show: function(speed) {
  3617. if ( standardSpeed( speed ) ) {
  3618. return this._show.apply(this, arguments);
  3619. } else {
  3620. var args = _normalizeArguments.apply(this, arguments);
  3621. args[1].mode = 'show';
  3622. return this.effect.apply(this, args);
  3623. }
  3624. },
  3625. _hide: $.fn.hide,
  3626. hide: function(speed) {
  3627. if ( standardSpeed( speed ) ) {
  3628. return this._hide.apply(this, arguments);
  3629. } else {
  3630. var args = _normalizeArguments.apply(this, arguments);
  3631. args[1].mode = 'hide';
  3632. return this.effect.apply(this, args);
  3633. }
  3634. },
  3635. // jQuery core overloads toggle and creates _toggle
  3636. __toggle: $.fn.toggle,
  3637. toggle: function(speed) {
  3638. if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) {
  3639. return this.__toggle.apply(this, arguments);
  3640. } else {
  3641. var args = _normalizeArguments.apply(this, arguments);
  3642. args[1].mode = 'toggle';
  3643. return this.effect.apply(this, args);
  3644. }
  3645. },
  3646. // helper functions
  3647. cssUnit: function(key) {
  3648. var style = this.css(key), val = [];
  3649. $.each( ['em','px','%','pt'], function(i, unit){
  3650. if(style.indexOf(unit) > 0)
  3651. val = [parseFloat(style), unit];
  3652. });
  3653. return val;
  3654. }
  3655. });
  3656. /******************************************************************************/
  3657. /*********************************** EASING ***********************************/
  3658. /******************************************************************************/
  3659. /*
  3660. * Note: While Microsoft is not the author of this file, Microsoft is
  3661. * offering you a license subject to the terms of the Microsoft Software
  3662. * License Terms for Microsoft ASP.NET Model View Controller 3.
  3663. * Microsoft reserves all other rights. The notices below are provided
  3664. * for informational purposes only and are not the license terms under
  3665. * which Microsoft distributed this file.
  3666. *
  3667. * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
  3668. *
  3669. * Uses the built in easing capabilities added In jQuery 1.1
  3670. * to offer multiple easing options
  3671. *
  3672. * Copyright 2008 George McGinley Smith
  3673. *
  3674. */
  3675. // t: current time, b: begInnIng value, c: change In value, d: duration
  3676. $.easing.jswing = $.easing.swing;
  3677. $.extend($.easing,
  3678. {
  3679. def: 'easeOutQuad',
  3680. swing: function (x, t, b, c, d) {
  3681. //alert($.easing.default);
  3682. return $.easing[$.easing.def](x, t, b, c, d);
  3683. },
  3684. easeInQuad: function (x, t, b, c, d) {
  3685. return c*(t/=d)*t + b;
  3686. },
  3687. easeOutQuad: function (x, t, b, c, d) {
  3688. return -c *(t/=d)*(t-2) + b;
  3689. },
  3690. easeInOutQuad: function (x, t, b, c, d) {
  3691. if ((t/=d/2) < 1) return c/2*t*t + b;
  3692. return -c/2 * ((--t)*(t-2) - 1) + b;
  3693. },
  3694. easeInCubic: function (x, t, b, c, d) {
  3695. return c*(t/=d)*t*t + b;
  3696. },
  3697. easeOutCubic: function (x, t, b, c, d) {
  3698. return c*((t=t/d-1)*t*t + 1) + b;
  3699. },
  3700. easeInOutCubic: function (x, t, b, c, d) {
  3701. if ((t/=d/2) < 1) return c/2*t*t*t + b;
  3702. return c/2*((t-=2)*t*t + 2) + b;
  3703. },
  3704. easeInQuart: function (x, t, b, c, d) {
  3705. return c*(t/=d)*t*t*t + b;
  3706. },
  3707. easeOutQuart: function (x, t, b, c, d) {
  3708. return -c * ((t=t/d-1)*t*t*t - 1) + b;
  3709. },
  3710. easeInOutQuart: function (x, t, b, c, d) {
  3711. if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
  3712. return -c/2 * ((t-=2)*t*t*t - 2) + b;
  3713. },
  3714. easeInQuint: function (x, t, b, c, d) {
  3715. return c*(t/=d)*t*t*t*t + b;
  3716. },
  3717. easeOutQuint: function (x, t, b, c, d) {
  3718. return c*((t=t/d-1)*t*t*t*t + 1) + b;
  3719. },
  3720. easeInOutQuint: function (x, t, b, c, d) {
  3721. if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
  3722. return c/2*((t-=2)*t*t*t*t + 2) + b;
  3723. },
  3724. easeInSine: function (x, t, b, c, d) {
  3725. return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
  3726. },
  3727. easeOutSine: function (x, t, b, c, d) {
  3728. return c * Math.sin(t/d * (Math.PI/2)) + b;
  3729. },
  3730. easeInOutSine: function (x, t, b, c, d) {
  3731. return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
  3732. },
  3733. easeInExpo: function (x, t, b, c, d) {
  3734. return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
  3735. },
  3736. easeOutExpo: function (x, t, b, c, d) {
  3737. return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
  3738. },
  3739. easeInOutExpo: function (x, t, b, c, d) {
  3740. if (t==0) return b;
  3741. if (t==d) return b+c;
  3742. if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
  3743. return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
  3744. },
  3745. easeInCirc: function (x, t, b, c, d) {
  3746. return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
  3747. },
  3748. easeOutCirc: function (x, t, b, c, d) {
  3749. return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
  3750. },
  3751. easeInOutCirc: function (x, t, b, c, d) {
  3752. if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
  3753. return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
  3754. },
  3755. easeInElastic: function (x, t, b, c, d) {
  3756. var s=1.70158;var p=0;var a=c;
  3757. if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
  3758. if (a < Math.abs(c)) { a=c; var s=p/4; }
  3759. else var s = p/(2*Math.PI) * Math.asin (c/a);
  3760. return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  3761. },
  3762. easeOutElastic: function (x, t, b, c, d) {
  3763. var s=1.70158;var p=0;var a=c;
  3764. if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
  3765. if (a < Math.abs(c)) { a=c; var s=p/4; }
  3766. else var s = p/(2*Math.PI) * Math.asin (c/a);
  3767. return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
  3768. },
  3769. easeInOutElastic: function (x, t, b, c, d) {
  3770. var s=1.70158;var p=0;var a=c;
  3771. if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
  3772. if (a < Math.abs(c)) { a=c; var s=p/4; }
  3773. else var s = p/(2*Math.PI) * Math.asin (c/a);
  3774. if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
  3775. return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
  3776. },
  3777. easeInBack: function (x, t, b, c, d, s) {
  3778. if (s == undefined) s = 1.70158;
  3779. return c*(t/=d)*t*((s+1)*t - s) + b;
  3780. },
  3781. easeOutBack: function (x, t, b, c, d, s) {
  3782. if (s == undefined) s = 1.70158;
  3783. return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
  3784. },
  3785. easeInOutBack: function (x, t, b, c, d, s) {
  3786. if (s == undefined) s = 1.70158;
  3787. if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
  3788. return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
  3789. },
  3790. easeInBounce: function (x, t, b, c, d) {
  3791. return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;
  3792. },
  3793. easeOutBounce: function (x, t, b, c, d) {
  3794. if ((t/=d) < (1/2.75)) {
  3795. return c*(7.5625*t*t) + b;
  3796. } else if (t < (2/2.75)) {
  3797. return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
  3798. } else if (t < (2.5/2.75)) {
  3799. return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
  3800. } else {
  3801. return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
  3802. }
  3803. },
  3804. easeInOutBounce: function (x, t, b, c, d) {
  3805. if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
  3806. return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
  3807. }
  3808. });
  3809. /*
  3810. * Note: While Microsoft is not the author of this file, Microsoft is
  3811. * offering you a license subject to the terms of the Microsoft Software
  3812. * License Terms for Microsoft ASP.NET Model View Controller 3.
  3813. * Microsoft reserves all other rights. The notices below are provided
  3814. * for informational purposes only and are not the license terms under
  3815. * which Microsoft distributed this file.
  3816. *
  3817. * Copyright 2001 Robert Penner
  3818. *
  3819. */
  3820. })(jQuery);
  3821. /*
  3822. * Note: While Microsoft is not the author of this file, Microsoft is
  3823. * offering you a license subject to the terms of the Microsoft Software
  3824. * License Terms for Microsoft ASP.NET Model View Controller 3.
  3825. * Microsoft reserves all other rights. The notices below are provided
  3826. * for informational purposes only and are not the license terms under
  3827. * which Microsoft distributed this file.
  3828. *
  3829. * jQuery UI Effects Blind 1.8.7
  3830. *
  3831. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  3832. *
  3833. * http://docs.jquery.com/UI/Effects/Blind
  3834. *
  3835. * Depends:
  3836. * jquery.effects.core.js
  3837. */
  3838. (function( $, undefined ) {
  3839. $.effects.blind = function(o) {
  3840. return this.queue(function() {
  3841. // Create element
  3842. var el = $(this), props = ['position','top','left'];
  3843. // Set options
  3844. var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
  3845. var direction = o.options.direction || 'vertical'; // Default direction
  3846. // Adjust
  3847. $.effects.save(el, props); el.show(); // Save & Show
  3848. var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
  3849. var ref = (direction == 'vertical') ? 'height' : 'width';
  3850. var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width();
  3851. if(mode == 'show') wrapper.css(ref, 0); // Shift
  3852. // Animation
  3853. var animation = {};
  3854. animation[ref] = mode == 'show' ? distance : 0;
  3855. // Animate
  3856. wrapper.animate(animation, o.duration, o.options.easing, function() {
  3857. if(mode == 'hide') el.hide(); // Hide
  3858. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  3859. if(o.callback) o.callback.apply(el[0], arguments); // Callback
  3860. el.dequeue();
  3861. });
  3862. });
  3863. };
  3864. })(jQuery);
  3865. /*
  3866. * Note: While Microsoft is not the author of this file, Microsoft is
  3867. * offering you a license subject to the terms of the Microsoft Software
  3868. * License Terms for Microsoft ASP.NET Model View Controller 3.
  3869. * Microsoft reserves all other rights. The notices below are provided
  3870. * for informational purposes only and are not the license terms under
  3871. * which Microsoft distributed this file.
  3872. *
  3873. * jQuery UI Effects Bounce 1.8.7
  3874. *
  3875. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  3876. *
  3877. * http://docs.jquery.com/UI/Effects/Bounce
  3878. *
  3879. * Depends:
  3880. * jquery.effects.core.js
  3881. */
  3882. (function( $, undefined ) {
  3883. $.effects.bounce = function(o) {
  3884. return this.queue(function() {
  3885. // Create element
  3886. var el = $(this), props = ['position','top','left'];
  3887. // Set options
  3888. var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
  3889. var direction = o.options.direction || 'up'; // Default direction
  3890. var distance = o.options.distance || 20; // Default distance
  3891. var times = o.options.times || 5; // Default # of times
  3892. var speed = o.duration || 250; // Default speed per bounce
  3893. if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE
  3894. // Adjust
  3895. $.effects.save(el, props); el.show(); // Save & Show
  3896. $.effects.createWrapper(el); // Create Wrapper
  3897. var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
  3898. var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
  3899. var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 3 : el.outerWidth({margin:true}) / 3);
  3900. if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
  3901. if (mode == 'hide') distance = distance / (times * 2);
  3902. if (mode != 'hide') times--;
  3903. // Animate
  3904. if (mode == 'show') { // Show Bounce
  3905. var animation = {opacity: 1};
  3906. animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
  3907. el.animate(animation, speed / 2, o.options.easing);
  3908. distance = distance / 2;
  3909. times--;
  3910. };
  3911. for (var i = 0; i < times; i++) { // Bounces
  3912. var animation1 = {}, animation2 = {};
  3913. animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
  3914. animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
  3915. el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing);
  3916. distance = (mode == 'hide') ? distance * 2 : distance / 2;
  3917. };
  3918. if (mode == 'hide') { // Last Bounce
  3919. var animation = {opacity: 0};
  3920. animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
  3921. el.animate(animation, speed / 2, o.options.easing, function(){
  3922. el.hide(); // Hide
  3923. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  3924. if(o.callback) o.callback.apply(this, arguments); // Callback
  3925. });
  3926. } else {
  3927. var animation1 = {}, animation2 = {};
  3928. animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
  3929. animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
  3930. el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){
  3931. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  3932. if(o.callback) o.callback.apply(this, arguments); // Callback
  3933. });
  3934. };
  3935. el.queue('fx', function() { el.dequeue(); });
  3936. el.dequeue();
  3937. });
  3938. };
  3939. })(jQuery);
  3940. /*
  3941. * Note: While Microsoft is not the author of this file, Microsoft is
  3942. * offering you a license subject to the terms of the Microsoft Software
  3943. * License Terms for Microsoft ASP.NET Model View Controller 3.
  3944. * Microsoft reserves all other rights. The notices below are provided
  3945. * for informational purposes only and are not the license terms under
  3946. * which Microsoft distributed this file.
  3947. *
  3948. * jQuery UI Effects Clip 1.8.7
  3949. *
  3950. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  3951. *
  3952. * http://docs.jquery.com/UI/Effects/Clip
  3953. *
  3954. * Depends:
  3955. * jquery.effects.core.js
  3956. */
  3957. (function( $, undefined ) {
  3958. $.effects.clip = function(o) {
  3959. return this.queue(function() {
  3960. // Create element
  3961. var el = $(this), props = ['position','top','left','height','width'];
  3962. // Set options
  3963. var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
  3964. var direction = o.options.direction || 'vertical'; // Default direction
  3965. // Adjust
  3966. $.effects.save(el, props); el.show(); // Save & Show
  3967. var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
  3968. var animate = el[0].tagName == 'IMG' ? wrapper : el;
  3969. var ref = {
  3970. size: (direction == 'vertical') ? 'height' : 'width',
  3971. position: (direction == 'vertical') ? 'top' : 'left'
  3972. };
  3973. var distance = (direction == 'vertical') ? animate.height() : animate.width();
  3974. if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift
  3975. // Animation
  3976. var animation = {};
  3977. animation[ref.size] = mode == 'show' ? distance : 0;
  3978. animation[ref.position] = mode == 'show' ? 0 : distance / 2;
  3979. // Animate
  3980. animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
  3981. if(mode == 'hide') el.hide(); // Hide
  3982. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  3983. if(o.callback) o.callback.apply(el[0], arguments); // Callback
  3984. el.dequeue();
  3985. }});
  3986. });
  3987. };
  3988. })(jQuery);
  3989. /*
  3990. * Note: While Microsoft is not the author of this file, Microsoft is
  3991. * offering you a license subject to the terms of the Microsoft Software
  3992. * License Terms for Microsoft ASP.NET Model View Controller 3.
  3993. * Microsoft reserves all other rights. The notices below are provided
  3994. * for informational purposes only and are not the license terms under
  3995. * which Microsoft distributed this file.
  3996. *
  3997. * jQuery UI Effects Drop 1.8.7
  3998. *
  3999. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  4000. *
  4001. * http://docs.jquery.com/UI/Effects/Drop
  4002. *
  4003. * Depends:
  4004. * jquery.effects.core.js
  4005. */
  4006. (function( $, undefined ) {
  4007. $.effects.drop = function(o) {
  4008. return this.queue(function() {
  4009. // Create element
  4010. var el = $(this), props = ['position','top','left','opacity'];
  4011. // Set options
  4012. var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
  4013. var direction = o.options.direction || 'left'; // Default Direction
  4014. // Adjust
  4015. $.effects.save(el, props); el.show(); // Save & Show
  4016. $.effects.createWrapper(el); // Create Wrapper
  4017. var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
  4018. var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
  4019. var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2);
  4020. if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
  4021. // Animation
  4022. var animation = {opacity: mode == 'show' ? 1 : 0};
  4023. animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
  4024. // Animate
  4025. el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
  4026. if(mode == 'hide') el.hide(); // Hide
  4027. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  4028. if(o.callback) o.callback.apply(this, arguments); // Callback
  4029. el.dequeue();
  4030. }});
  4031. });
  4032. };
  4033. })(jQuery);
  4034. /*
  4035. * Note: While Microsoft is not the author of this file, Microsoft is
  4036. * offering you a license subject to the terms of the Microsoft Software
  4037. * License Terms for Microsoft ASP.NET Model View Controller 3.
  4038. * Microsoft reserves all other rights. The notices below are provided
  4039. * for informational purposes only and are not the license terms under
  4040. * which Microsoft distributed this file.
  4041. *
  4042. * jQuery UI Effects Explode 1.8.7
  4043. *
  4044. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  4045. *
  4046. * http://docs.jquery.com/UI/Effects/Explode
  4047. *
  4048. * Depends:
  4049. * jquery.effects.core.js
  4050. */
  4051. (function( $, undefined ) {
  4052. $.effects.explode = function(o) {
  4053. return this.queue(function() {
  4054. var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
  4055. var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
  4056. o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode;
  4057. var el = $(this).show().css('visibility', 'hidden');
  4058. var offset = el.offset();
  4059. //Substract the margins - not fixing the problem yet.
  4060. offset.top -= parseInt(el.css("marginTop"),10) || 0;
  4061. offset.left -= parseInt(el.css("marginLeft"),10) || 0;
  4062. var width = el.outerWidth(true);
  4063. var height = el.outerHeight(true);
  4064. for(var i=0;i<rows;i++) { // =
  4065. for(var j=0;j<cells;j++) { // ||
  4066. el
  4067. .clone()
  4068. .appendTo('body')
  4069. .wrap('<div></div>')
  4070. .css({
  4071. position: 'absolute',
  4072. visibility: 'visible',
  4073. left: -j*(width/cells),
  4074. top: -i*(height/rows)
  4075. })
  4076. .parent()
  4077. .addClass('ui-effects-explode')
  4078. .css({
  4079. position: 'absolute',
  4080. overflow: 'hidden',
  4081. width: width/cells,
  4082. height: height/rows,
  4083. left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0),
  4084. top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0),
  4085. opacity: o.options.mode == 'show' ? 0 : 1
  4086. }).animate({
  4087. left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)),
  4088. top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)),
  4089. opacity: o.options.mode == 'show' ? 1 : 0
  4090. }, o.duration || 500);
  4091. }
  4092. }
  4093. // Set a timeout, to call the callback approx. when the other animations have finished
  4094. setTimeout(function() {
  4095. o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide();
  4096. if(o.callback) o.callback.apply(el[0]); // Callback
  4097. el.dequeue();
  4098. $('div.ui-effects-explode').remove();
  4099. }, o.duration || 500);
  4100. });
  4101. };
  4102. })(jQuery);
  4103. /*
  4104. * Note: While Microsoft is not the author of this file, Microsoft is
  4105. * offering you a license subject to the terms of the Microsoft Software
  4106. * License Terms for Microsoft ASP.NET Model View Controller 3.
  4107. * Microsoft reserves all other rights. The notices below are provided
  4108. * for informational purposes only and are not the license terms under
  4109. * which Microsoft distributed this file.
  4110. *
  4111. * jQuery UI Effects Fade 1.8.7
  4112. *
  4113. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  4114. *
  4115. * http://docs.jquery.com/UI/Effects/Fade
  4116. *
  4117. * Depends:
  4118. * jquery.effects.core.js
  4119. */
  4120. (function( $, undefined ) {
  4121. $.effects.fade = function(o) {
  4122. return this.queue(function() {
  4123. var elem = $(this),
  4124. mode = $.effects.setMode(elem, o.options.mode || 'hide');
  4125. elem.animate({ opacity: mode }, {
  4126. queue: false,
  4127. duration: o.duration,
  4128. easing: o.options.easing,
  4129. complete: function() {
  4130. (o.callback && o.callback.apply(this, arguments));
  4131. elem.dequeue();
  4132. }
  4133. });
  4134. });
  4135. };
  4136. })(jQuery);
  4137. /*
  4138. * Note: While Microsoft is not the author of this file, Microsoft is
  4139. * offering you a license subject to the terms of the Microsoft Software
  4140. * License Terms for Microsoft ASP.NET Model View Controller 3.
  4141. * Microsoft reserves all other rights. The notices below are provided
  4142. * for informational purposes only and are not the license terms under
  4143. * which Microsoft distributed this file.
  4144. *
  4145. * jQuery UI Effects Fold 1.8.7
  4146. *
  4147. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  4148. *
  4149. * http://docs.jquery.com/UI/Effects/Fold
  4150. *
  4151. * Depends:
  4152. * jquery.effects.core.js
  4153. */
  4154. (function( $, undefined ) {
  4155. $.effects.fold = function(o) {
  4156. return this.queue(function() {
  4157. // Create element
  4158. var el = $(this), props = ['position','top','left'];
  4159. // Set options
  4160. var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
  4161. var size = o.options.size || 15; // Default fold size
  4162. var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value
  4163. var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;
  4164. // Adjust
  4165. $.effects.save(el, props); el.show(); // Save & Show
  4166. var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
  4167. var widthFirst = ((mode == 'show') != horizFirst);
  4168. var ref = widthFirst ? ['width', 'height'] : ['height', 'width'];
  4169. var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()];
  4170. var percent = /([0-9]+)%/.exec(size);
  4171. if(percent) size = parseInt(percent[1],10) / 100 * distance[mode == 'hide' ? 0 : 1];
  4172. if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift
  4173. // Animation
  4174. var animation1 = {}, animation2 = {};
  4175. animation1[ref[0]] = mode == 'show' ? distance[0] : size;
  4176. animation2[ref[1]] = mode == 'show' ? distance[1] : 0;
  4177. // Animate
  4178. wrapper.animate(animation1, duration, o.options.easing)
  4179. .animate(animation2, duration, o.options.easing, function() {
  4180. if(mode == 'hide') el.hide(); // Hide
  4181. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  4182. if(o.callback) o.callback.apply(el[0], arguments); // Callback
  4183. el.dequeue();
  4184. });
  4185. });
  4186. };
  4187. })(jQuery);
  4188. /*
  4189. * Note: While Microsoft is not the author of this file, Microsoft is
  4190. * offering you a license subject to the terms of the Microsoft Software
  4191. * License Terms for Microsoft ASP.NET Model View Controller 3.
  4192. * Microsoft reserves all other rights. The notices below are provided
  4193. * for informational purposes only and are not the license terms under
  4194. * which Microsoft distributed this file.
  4195. *
  4196. * jQuery UI Effects Highlight 1.8.7
  4197. *
  4198. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  4199. *
  4200. * http://docs.jquery.com/UI/Effects/Highlight
  4201. *
  4202. * Depends:
  4203. * jquery.effects.core.js
  4204. */
  4205. (function( $, undefined ) {
  4206. $.effects.highlight = function(o) {
  4207. return this.queue(function() {
  4208. var elem = $(this),
  4209. props = ['backgroundImage', 'backgroundColor', 'opacity'],
  4210. mode = $.effects.setMode(elem, o.options.mode || 'show'),
  4211. animation = {
  4212. backgroundColor: elem.css('backgroundColor')
  4213. };
  4214. if (mode == 'hide') {
  4215. animation.opacity = 0;
  4216. }
  4217. $.effects.save(elem, props);
  4218. elem
  4219. .show()
  4220. .css({
  4221. backgroundImage: 'none',
  4222. backgroundColor: o.options.color || '#ffff99'
  4223. })
  4224. .animate(animation, {
  4225. queue: false,
  4226. duration: o.duration,
  4227. easing: o.options.easing,
  4228. complete: function() {
  4229. (mode == 'hide' && elem.hide());
  4230. $.effects.restore(elem, props);
  4231. (mode == 'show' && !$.support.opacity && this.style.removeAttribute('filter'));
  4232. (o.callback && o.callback.apply(this, arguments));
  4233. elem.dequeue();
  4234. }
  4235. });
  4236. });
  4237. };
  4238. })(jQuery);
  4239. /*
  4240. * Note: While Microsoft is not the author of this file, Microsoft is
  4241. * offering you a license subject to the terms of the Microsoft Software
  4242. * License Terms for Microsoft ASP.NET Model View Controller 3.
  4243. * Microsoft reserves all other rights. The notices below are provided
  4244. * for informational purposes only and are not the license terms under
  4245. * which Microsoft distributed this file.
  4246. *
  4247. * jQuery UI Effects Pulsate 1.8.7
  4248. *
  4249. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  4250. *
  4251. * http://docs.jquery.com/UI/Effects/Pulsate
  4252. *
  4253. * Depends:
  4254. * jquery.effects.core.js
  4255. */
  4256. (function( $, undefined ) {
  4257. $.effects.pulsate = function(o) {
  4258. return this.queue(function() {
  4259. var elem = $(this),
  4260. mode = $.effects.setMode(elem, o.options.mode || 'show');
  4261. times = ((o.options.times || 5) * 2) - 1;
  4262. duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2,
  4263. isVisible = elem.is(':visible'),
  4264. animateTo = 0;
  4265. if (!isVisible) {
  4266. elem.css('opacity', 0).show();
  4267. animateTo = 1;
  4268. }
  4269. if ((mode == 'hide' && isVisible) || (mode == 'show' && !isVisible)) {
  4270. times--;
  4271. }
  4272. for (var i = 0; i < times; i++) {
  4273. elem.animate({ opacity: animateTo }, duration, o.options.easing);
  4274. animateTo = (animateTo + 1) % 2;
  4275. }
  4276. elem.animate({ opacity: animateTo }, duration, o.options.easing, function() {
  4277. if (animateTo == 0) {
  4278. elem.hide();
  4279. }
  4280. (o.callback && o.callback.apply(this, arguments));
  4281. });
  4282. elem
  4283. .queue('fx', function() { elem.dequeue(); })
  4284. .dequeue();
  4285. });
  4286. };
  4287. })(jQuery);
  4288. /*
  4289. * Note: While Microsoft is not the author of this file, Microsoft is
  4290. * offering you a license subject to the terms of the Microsoft Software
  4291. * License Terms for Microsoft ASP.NET Model View Controller 3.
  4292. * Microsoft reserves all other rights. The notices below are provided
  4293. * for informational purposes only and are not the license terms under
  4294. * which Microsoft distributed this file.
  4295. *
  4296. * jQuery UI Effects Scale 1.8.7
  4297. *
  4298. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  4299. *
  4300. * http://docs.jquery.com/UI/Effects/Scale
  4301. *
  4302. * Depends:
  4303. * jquery.effects.core.js
  4304. */
  4305. (function( $, undefined ) {
  4306. $.effects.puff = function(o) {
  4307. return this.queue(function() {
  4308. var elem = $(this),
  4309. mode = $.effects.setMode(elem, o.options.mode || 'hide'),
  4310. percent = parseInt(o.options.percent, 10) || 150,
  4311. factor = percent / 100,
  4312. original = { height: elem.height(), width: elem.width() };
  4313. $.extend(o.options, {
  4314. fade: true,
  4315. mode: mode,
  4316. percent: mode == 'hide' ? percent : 100,
  4317. from: mode == 'hide'
  4318. ? original
  4319. : {
  4320. height: original.height * factor,
  4321. width: original.width * factor
  4322. }
  4323. });
  4324. elem.effect('scale', o.options, o.duration, o.callback);
  4325. elem.dequeue();
  4326. });
  4327. };
  4328. $.effects.scale = function(o) {
  4329. return this.queue(function() {
  4330. // Create element
  4331. var el = $(this);
  4332. // Set options
  4333. var options = $.extend(true, {}, o.options);
  4334. var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
  4335. var percent = parseInt(o.options.percent,10) || (parseInt(o.options.percent,10) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set default scaling percent
  4336. var direction = o.options.direction || 'both'; // Set default axis
  4337. var origin = o.options.origin; // The origin of the scaling
  4338. if (mode != 'effect') { // Set default origin and restore for show/hide
  4339. options.origin = origin || ['middle','center'];
  4340. options.restore = true;
  4341. }
  4342. var original = {height: el.height(), width: el.width()}; // Save original
  4343. el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state
  4344. // Adjust
  4345. var factor = { // Set scaling factor
  4346. y: direction != 'horizontal' ? (percent / 100) : 1,
  4347. x: direction != 'vertical' ? (percent / 100) : 1
  4348. };
  4349. el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state
  4350. if (o.options.fade) { // Fade option to support puff
  4351. if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;};
  4352. if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;};
  4353. };
  4354. // Animation
  4355. options.from = el.from; options.to = el.to; options.mode = mode;
  4356. // Animate
  4357. el.effect('size', options, o.duration, o.callback);
  4358. el.dequeue();
  4359. });
  4360. };
  4361. $.effects.size = function(o) {
  4362. return this.queue(function() {
  4363. // Create element
  4364. var el = $(this), props = ['position','top','left','width','height','overflow','opacity'];
  4365. var props1 = ['position','top','left','overflow','opacity']; // Always restore
  4366. var props2 = ['width','height','overflow']; // Copy for children
  4367. var cProps = ['fontSize'];
  4368. var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom'];
  4369. var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight'];
  4370. // Set options
  4371. var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
  4372. var restore = o.options.restore || false; // Default restore
  4373. var scale = o.options.scale || 'both'; // Default scale mode
  4374. var origin = o.options.origin; // The origin of the sizing
  4375. var original = {height: el.height(), width: el.width()}; // Save original
  4376. el.from = o.options.from || original; // Default from state
  4377. el.to = o.options.to || original; // Default to state
  4378. // Adjust
  4379. if (origin) { // Calculate baseline shifts
  4380. var baseline = $.effects.getBaseline(origin, original);
  4381. el.from.top = (original.height - el.from.height) * baseline.y;
  4382. el.from.left = (original.width - el.from.width) * baseline.x;
  4383. el.to.top = (original.height - el.to.height) * baseline.y;
  4384. el.to.left = (original.width - el.to.width) * baseline.x;
  4385. };
  4386. var factor = { // Set scaling factor
  4387. from: {y: el.from.height / original.height, x: el.from.width / original.width},
  4388. to: {y: el.to.height / original.height, x: el.to.width / original.width}
  4389. };
  4390. if (scale == 'box' || scale == 'both') { // Scale the css box
  4391. if (factor.from.y != factor.to.y) { // Vertical props scaling
  4392. props = props.concat(vProps);
  4393. el.from = $.effects.setTransition(el, vProps, factor.from.y, el.from);
  4394. el.to = $.effects.setTransition(el, vProps, factor.to.y, el.to);
  4395. };
  4396. if (factor.from.x != factor.to.x) { // Horizontal props scaling
  4397. props = props.concat(hProps);
  4398. el.from = $.effects.setTransition(el, hProps, factor.from.x, el.from);
  4399. el.to = $.effects.setTransition(el, hProps, factor.to.x, el.to);
  4400. };
  4401. };
  4402. if (scale == 'content' || scale == 'both') { // Scale the content
  4403. if (factor.from.y != factor.to.y) { // Vertical props scaling
  4404. props = props.concat(cProps);
  4405. el.from = $.effects.setTransition(el, cProps, factor.from.y, el.from);
  4406. el.to = $.effects.setTransition(el, cProps, factor.to.y, el.to);
  4407. };
  4408. };
  4409. $.effects.save(el, restore ? props : props1); el.show(); // Save & Show
  4410. $.effects.createWrapper(el); // Create Wrapper
  4411. el.css('overflow','hidden').css(el.from); // Shift
  4412. // Animate
  4413. if (scale == 'content' || scale == 'both') { // Scale the children
  4414. vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size
  4415. hProps = hProps.concat(['marginLeft','marginRight']); // Add margins
  4416. props2 = props.concat(vProps).concat(hProps); // Concat
  4417. el.find("*[width]").each(function(){
  4418. child = $(this);
  4419. if (restore) $.effects.save(child, props2);
  4420. var c_original = {height: child.height(), width: child.width()}; // Save original
  4421. child.from = {height: c_original.height * factor.from.y, width: c_original.width * factor.from.x};
  4422. child.to = {height: c_original.height * factor.to.y, width: c_original.width * factor.to.x};
  4423. if (factor.from.y != factor.to.y) { // Vertical props scaling
  4424. child.from = $.effects.setTransition(child, vProps, factor.from.y, child.from);
  4425. child.to = $.effects.setTransition(child, vProps, factor.to.y, child.to);
  4426. };
  4427. if (factor.from.x != factor.to.x) { // Horizontal props scaling
  4428. child.from = $.effects.setTransition(child, hProps, factor.from.x, child.from);
  4429. child.to = $.effects.setTransition(child, hProps, factor.to.x, child.to);
  4430. };
  4431. child.css(child.from); // Shift children
  4432. child.animate(child.to, o.duration, o.options.easing, function(){
  4433. if (restore) $.effects.restore(child, props2); // Restore children
  4434. }); // Animate children
  4435. });
  4436. };
  4437. // Animate
  4438. el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
  4439. if (el.to.opacity === 0) {
  4440. el.css('opacity', el.from.opacity);
  4441. }
  4442. if(mode == 'hide') el.hide(); // Hide
  4443. $.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore
  4444. if(o.callback) o.callback.apply(this, arguments); // Callback
  4445. el.dequeue();
  4446. }});
  4447. });
  4448. };
  4449. })(jQuery);
  4450. /*
  4451. * Note: While Microsoft is not the author of this file, Microsoft is
  4452. * offering you a license subject to the terms of the Microsoft Software
  4453. * License Terms for Microsoft ASP.NET Model View Controller 3.
  4454. * Microsoft reserves all other rights. The notices below are provided
  4455. * for informational purposes only and are not the license terms under
  4456. * which Microsoft distributed this file.
  4457. *
  4458. * jQuery UI Effects Shake 1.8.7
  4459. *
  4460. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  4461. *
  4462. * http://docs.jquery.com/UI/Effects/Shake
  4463. *
  4464. * Depends:
  4465. * jquery.effects.core.js
  4466. */
  4467. (function( $, undefined ) {
  4468. $.effects.shake = function(o) {
  4469. return this.queue(function() {
  4470. // Create element
  4471. var el = $(this), props = ['position','top','left'];
  4472. // Set options
  4473. var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
  4474. var direction = o.options.direction || 'left'; // Default direction
  4475. var distance = o.options.distance || 20; // Default distance
  4476. var times = o.options.times || 3; // Default # of times
  4477. var speed = o.duration || o.options.duration || 140; // Default speed per shake
  4478. // Adjust
  4479. $.effects.save(el, props); el.show(); // Save & Show
  4480. $.effects.createWrapper(el); // Create Wrapper
  4481. var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
  4482. var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
  4483. // Animation
  4484. var animation = {}, animation1 = {}, animation2 = {};
  4485. animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
  4486. animation1[ref] = (motion == 'pos' ? '+=' : '-=') + distance * 2;
  4487. animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2;
  4488. // Animate
  4489. el.animate(animation, speed, o.options.easing);
  4490. for (var i = 1; i < times; i++) { // Shakes
  4491. el.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing);
  4492. };
  4493. el.animate(animation1, speed, o.options.easing).
  4494. animate(animation, speed / 2, o.options.easing, function(){ // Last shake
  4495. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  4496. if(o.callback) o.callback.apply(this, arguments); // Callback
  4497. });
  4498. el.queue('fx', function() { el.dequeue(); });
  4499. el.dequeue();
  4500. });
  4501. };
  4502. })(jQuery);
  4503. /*
  4504. * Note: While Microsoft is not the author of this file, Microsoft is
  4505. * offering you a license subject to the terms of the Microsoft Software
  4506. * License Terms for Microsoft ASP.NET Model View Controller 3.
  4507. * Microsoft reserves all other rights. The notices below are provided
  4508. * for informational purposes only and are not the license terms under
  4509. * which Microsoft distributed this file.
  4510. *
  4511. * jQuery UI Effects Slide 1.8.7
  4512. *
  4513. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  4514. *
  4515. * http://docs.jquery.com/UI/Effects/Slide
  4516. *
  4517. * Depends:
  4518. * jquery.effects.core.js
  4519. */
  4520. (function( $, undefined ) {
  4521. $.effects.slide = function(o) {
  4522. return this.queue(function() {
  4523. // Create element
  4524. var el = $(this), props = ['position','top','left'];
  4525. // Set options
  4526. var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
  4527. var direction = o.options.direction || 'left'; // Default Direction
  4528. // Adjust
  4529. $.effects.save(el, props); el.show(); // Save & Show
  4530. $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
  4531. var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
  4532. var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
  4533. var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));
  4534. if (mode == 'show') el.css(ref, motion == 'pos' ? (isNaN(distance) ? "-" + distance : -distance) : distance); // Shift
  4535. // Animation
  4536. var animation = {};
  4537. animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
  4538. // Animate
  4539. el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
  4540. if(mode == 'hide') el.hide(); // Hide
  4541. $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
  4542. if(o.callback) o.callback.apply(this, arguments); // Callback
  4543. el.dequeue();
  4544. }});
  4545. });
  4546. };
  4547. })(jQuery);
  4548. /*
  4549. * Note: While Microsoft is not the author of this file, Microsoft is
  4550. * offering you a license subject to the terms of the Microsoft Software
  4551. * License Terms for Microsoft ASP.NET Model View Controller 3.
  4552. * Microsoft reserves all other rights. The notices below are provided
  4553. * for informational purposes only and are not the license terms under
  4554. * which Microsoft distributed this file.
  4555. *
  4556. * jQuery UI Effects Transfer 1.8.7
  4557. *
  4558. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  4559. *
  4560. * http://docs.jquery.com/UI/Effects/Transfer
  4561. *
  4562. * Depends:
  4563. * jquery.effects.core.js
  4564. */
  4565. (function( $, undefined ) {
  4566. $.effects.transfer = function(o) {
  4567. return this.queue(function() {
  4568. var elem = $(this),
  4569. target = $(o.options.to),
  4570. endPosition = target.offset(),
  4571. animation = {
  4572. top: endPosition.top,
  4573. left: endPosition.left,
  4574. height: target.innerHeight(),
  4575. width: target.innerWidth()
  4576. },
  4577. startPosition = elem.offset(),
  4578. transfer = $('<div class="ui-effects-transfer"></div>')
  4579. .appendTo(document.body)
  4580. .addClass(o.options.className)
  4581. .css({
  4582. top: startPosition.top,
  4583. left: startPosition.left,
  4584. height: elem.innerHeight(),
  4585. width: elem.innerWidth(),
  4586. position: 'absolute'
  4587. })
  4588. .animate(animation, o.duration, o.options.easing, function() {
  4589. transfer.remove();
  4590. (o.callback && o.callback.apply(elem[0], arguments));
  4591. elem.dequeue();
  4592. });
  4593. });
  4594. };
  4595. })(jQuery);
  4596. /*
  4597. * Note: While Microsoft is not the author of this file, Microsoft is
  4598. * offering you a license subject to the terms of the Microsoft Software
  4599. * License Terms for Microsoft ASP.NET Model View Controller 3.
  4600. * Microsoft reserves all other rights. The notices below are provided
  4601. * for informational purposes only and are not the license terms under
  4602. * which Microsoft distributed this file.
  4603. *
  4604. * jQuery UI Accordion 1.8.7
  4605. *
  4606. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  4607. *
  4608. * http://docs.jquery.com/UI/Accordion
  4609. *
  4610. * Depends:
  4611. * jquery.ui.core.js
  4612. * jquery.ui.widget.js
  4613. */
  4614. (function( $, undefined ) {
  4615. $.widget( "ui.accordion", {
  4616. options: {
  4617. active: 0,
  4618. animated: "slide",
  4619. autoHeight: true,
  4620. clearStyle: false,
  4621. collapsible: false,
  4622. event: "click",
  4623. fillSpace: false,
  4624. header: "> li > :first-child,> :not(li):even",
  4625. icons: {
  4626. header: "ui-icon-triangle-1-e",
  4627. headerSelected: "ui-icon-triangle-1-s"
  4628. },
  4629. navigation: false,
  4630. navigationFilter: function() {
  4631. return this.href.toLowerCase() === location.href.toLowerCase();
  4632. }
  4633. },
  4634. _create: function() {
  4635. var self = this,
  4636. options = self.options;
  4637. self.running = 0;
  4638. self.element
  4639. .addClass( "ui-accordion ui-widget ui-helper-reset" )
  4640. // in lack of child-selectors in CSS
  4641. // we need to mark top-LIs in a UL-accordion for some IE-fix
  4642. .children( "li" )
  4643. .addClass( "ui-accordion-li-fix" );
  4644. self.headers = self.element.find( options.header )
  4645. .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" )
  4646. .bind( "mouseenter.accordion", function() {
  4647. if ( options.disabled ) {
  4648. return;
  4649. }
  4650. $( this ).addClass( "ui-state-hover" );
  4651. })
  4652. .bind( "mouseleave.accordion", function() {
  4653. if ( options.disabled ) {
  4654. return;
  4655. }
  4656. $( this ).removeClass( "ui-state-hover" );
  4657. })
  4658. .bind( "focus.accordion", function() {
  4659. if ( options.disabled ) {
  4660. return;
  4661. }
  4662. $( this ).addClass( "ui-state-focus" );
  4663. })
  4664. .bind( "blur.accordion", function() {
  4665. if ( options.disabled ) {
  4666. return;
  4667. }
  4668. $( this ).removeClass( "ui-state-focus" );
  4669. });
  4670. self.headers.next()
  4671. .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" );
  4672. if ( options.navigation ) {
  4673. var current = self.element.find( "a" ).filter( options.navigationFilter ).eq( 0 );
  4674. if ( current.length ) {
  4675. var header = current.closest( ".ui-accordion-header" );
  4676. if ( header.length ) {
  4677. // anchor within header
  4678. self.active = header;
  4679. } else {
  4680. // anchor within content
  4681. self.active = current.closest( ".ui-accordion-content" ).prev();
  4682. }
  4683. }
  4684. }
  4685. self.active = self._findActive( self.active || options.active )
  4686. .addClass( "ui-state-default ui-state-active" )
  4687. .toggleClass( "ui-corner-all" )
  4688. .toggleClass( "ui-corner-top" );
  4689. self.active.next().addClass( "ui-accordion-content-active" );
  4690. self._createIcons();
  4691. self.resize();
  4692. // ARIA
  4693. self.element.attr( "role", "tablist" );
  4694. self.headers
  4695. .attr( "role", "tab" )
  4696. .bind( "keydown.accordion", function( event ) {
  4697. return self._keydown( event );
  4698. })
  4699. .next()
  4700. .attr( "role", "tabpanel" );
  4701. self.headers
  4702. .not( self.active || "" )
  4703. .attr({
  4704. "aria-expanded": "false",
  4705. tabIndex: -1
  4706. })
  4707. .next()
  4708. .hide();
  4709. // make sure at least one header is in the tab order
  4710. if ( !self.active.length ) {
  4711. self.headers.eq( 0 ).attr( "tabIndex", 0 );
  4712. } else {
  4713. self.active
  4714. .attr({
  4715. "aria-expanded": "true",
  4716. tabIndex: 0
  4717. });
  4718. }
  4719. // only need links in tab order for Safari
  4720. if ( !$.browser.safari ) {
  4721. self.headers.find( "a" ).attr( "tabIndex", -1 );
  4722. }
  4723. if ( options.event ) {
  4724. self.headers.bind( options.event.split(" ").join(".accordion ") + ".accordion", function(event) {
  4725. self._clickHandler.call( self, event, this );
  4726. event.preventDefault();
  4727. });
  4728. }
  4729. },
  4730. _createIcons: function() {
  4731. var options = this.options;
  4732. if ( options.icons ) {
  4733. $( "<span></span>" )
  4734. .addClass( "ui-icon " + options.icons.header )
  4735. .prependTo( this.headers );
  4736. this.active.children( ".ui-icon" )
  4737. .toggleClass(options.icons.header)
  4738. .toggleClass(options.icons.headerSelected);
  4739. this.element.addClass( "ui-accordion-icons" );
  4740. }
  4741. },
  4742. _destroyIcons: function() {
  4743. this.headers.children( ".ui-icon" ).remove();
  4744. this.element.removeClass( "ui-accordion-icons" );
  4745. },
  4746. destroy: function() {
  4747. var options = this.options;
  4748. this.element
  4749. .removeClass( "ui-accordion ui-widget ui-helper-reset" )
  4750. .removeAttr( "role" );
  4751. this.headers
  4752. .unbind( ".accordion" )
  4753. .removeClass( "ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
  4754. .removeAttr( "role" )
  4755. .removeAttr( "aria-expanded" )
  4756. .removeAttr( "tabIndex" );
  4757. this.headers.find( "a" ).removeAttr( "tabIndex" );
  4758. this._destroyIcons();
  4759. var contents = this.headers.next()
  4760. .css( "display", "" )
  4761. .removeAttr( "role" )
  4762. .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled" );
  4763. if ( options.autoHeight || options.fillHeight ) {
  4764. contents.css( "height", "" );
  4765. }
  4766. return $.Widget.prototype.destroy.call( this );
  4767. },
  4768. _setOption: function( key, value ) {
  4769. $.Widget.prototype._setOption.apply( this, arguments );
  4770. if ( key == "active" ) {
  4771. this.activate( value );
  4772. }
  4773. if ( key == "icons" ) {
  4774. this._destroyIcons();
  4775. if ( value ) {
  4776. this._createIcons();
  4777. }
  4778. }
  4779. // #5332 - opacity doesn't cascade to positioned elements in IE
  4780. // so we need to add the disabled class to the headers and panels
  4781. if ( key == "disabled" ) {
  4782. this.headers.add(this.headers.next())
  4783. [ value ? "addClass" : "removeClass" ](
  4784. "ui-accordion-disabled ui-state-disabled" );
  4785. }
  4786. },
  4787. _keydown: function( event ) {
  4788. if ( this.options.disabled || event.altKey || event.ctrlKey ) {
  4789. return;
  4790. }
  4791. var keyCode = $.ui.keyCode,
  4792. length = this.headers.length,
  4793. currentIndex = this.headers.index( event.target ),
  4794. toFocus = false;
  4795. switch ( event.keyCode ) {
  4796. case keyCode.RIGHT:
  4797. case keyCode.DOWN:
  4798. toFocus = this.headers[ ( currentIndex + 1 ) % length ];
  4799. break;
  4800. case keyCode.LEFT:
  4801. case keyCode.UP:
  4802. toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
  4803. break;
  4804. case keyCode.SPACE:
  4805. case keyCode.ENTER:
  4806. this._clickHandler( { target: event.target }, event.target );
  4807. event.preventDefault();
  4808. }
  4809. if ( toFocus ) {
  4810. $( event.target ).attr( "tabIndex", -1 );
  4811. $( toFocus ).attr( "tabIndex", 0 );
  4812. toFocus.focus();
  4813. return false;
  4814. }
  4815. return true;
  4816. },
  4817. resize: function() {
  4818. var options = this.options,
  4819. maxHeight;
  4820. if ( options.fillSpace ) {
  4821. if ( $.browser.msie ) {
  4822. var defOverflow = this.element.parent().css( "overflow" );
  4823. this.element.parent().css( "overflow", "hidden");
  4824. }
  4825. maxHeight = this.element.parent().height();
  4826. if ($.browser.msie) {
  4827. this.element.parent().css( "overflow", defOverflow );
  4828. }
  4829. this.headers.each(function() {
  4830. maxHeight -= $( this ).outerHeight( true );
  4831. });
  4832. this.headers.next()
  4833. .each(function() {
  4834. $( this ).height( Math.max( 0, maxHeight -
  4835. $( this ).innerHeight() + $( this ).height() ) );
  4836. })
  4837. .css( "overflow", "auto" );
  4838. } else if ( options.autoHeight ) {
  4839. maxHeight = 0;
  4840. this.headers.next()
  4841. .each(function() {
  4842. maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
  4843. })
  4844. .height( maxHeight );
  4845. }
  4846. return this;
  4847. },
  4848. activate: function( index ) {
  4849. // TODO this gets called on init, changing the option without an explicit call for that
  4850. this.options.active = index;
  4851. // call clickHandler with custom event
  4852. var active = this._findActive( index )[ 0 ];
  4853. this._clickHandler( { target: active }, active );
  4854. return this;
  4855. },
  4856. _findActive: function( selector ) {
  4857. return selector
  4858. ? typeof selector === "number"
  4859. ? this.headers.filter( ":eq(" + selector + ")" )
  4860. : this.headers.not( this.headers.not( selector ) )
  4861. : selector === false
  4862. ? $( [] )
  4863. : this.headers.filter( ":eq(0)" );
  4864. },
  4865. // TODO isn't event.target enough? why the separate target argument?
  4866. _clickHandler: function( event, target ) {
  4867. var options = this.options;
  4868. if ( options.disabled ) {
  4869. return;
  4870. }
  4871. // called only when using activate(false) to close all parts programmatically
  4872. if ( !event.target ) {
  4873. if ( !options.collapsible ) {
  4874. return;
  4875. }
  4876. this.active
  4877. .removeClass( "ui-state-active ui-corner-top" )
  4878. .addClass( "ui-state-default ui-corner-all" )
  4879. .children( ".ui-icon" )
  4880. .removeClass( options.icons.headerSelected )
  4881. .addClass( options.icons.header );
  4882. this.active.next().addClass( "ui-accordion-content-active" );
  4883. var toHide = this.active.next(),
  4884. data = {
  4885. options: options,
  4886. newHeader: $( [] ),
  4887. oldHeader: options.active,
  4888. newContent: $( [] ),
  4889. oldContent: toHide
  4890. },
  4891. toShow = ( this.active = $( [] ) );
  4892. this._toggle( toShow, toHide, data );
  4893. return;
  4894. }
  4895. // get the click target
  4896. var clicked = $( event.currentTarget || target ),
  4897. clickedIsActive = clicked[0] === this.active[0];
  4898. // TODO the option is changed, is that correct?
  4899. // TODO if it is correct, shouldn't that happen after determining that the click is valid?
  4900. options.active = options.collapsible && clickedIsActive ?
  4901. false :
  4902. this.headers.index( clicked );
  4903. // if animations are still active, or the active header is the target, ignore click
  4904. if ( this.running || ( !options.collapsible && clickedIsActive ) ) {
  4905. return;
  4906. }
  4907. // switch classes
  4908. this.active
  4909. .removeClass( "ui-state-active ui-corner-top" )
  4910. .addClass( "ui-state-default ui-corner-all" )
  4911. .children( ".ui-icon" )
  4912. .removeClass( options.icons.headerSelected )
  4913. .addClass( options.icons.header );
  4914. if ( !clickedIsActive ) {
  4915. clicked
  4916. .removeClass( "ui-state-default ui-corner-all" )
  4917. .addClass( "ui-state-active ui-corner-top" )
  4918. .children( ".ui-icon" )
  4919. .removeClass( options.icons.header )
  4920. .addClass( options.icons.headerSelected );
  4921. clicked
  4922. .next()
  4923. .addClass( "ui-accordion-content-active" );
  4924. }
  4925. // find elements to show and hide
  4926. var toShow = clicked.next(),
  4927. toHide = this.active.next(),
  4928. data = {
  4929. options: options,
  4930. newHeader: clickedIsActive && options.collapsible ? $([]) : clicked,
  4931. oldHeader: this.active,
  4932. newContent: clickedIsActive && options.collapsible ? $([]) : toShow,
  4933. oldContent: toHide
  4934. },
  4935. down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] );
  4936. this.active = clickedIsActive ? $([]) : clicked;
  4937. this._toggle( toShow, toHide, data, clickedIsActive, down );
  4938. return;
  4939. },
  4940. _toggle: function( toShow, toHide, data, clickedIsActive, down ) {
  4941. var self = this,
  4942. options = self.options;
  4943. self.toShow = toShow;
  4944. self.toHide = toHide;
  4945. self.data = data;
  4946. var complete = function() {
  4947. if ( !self ) {
  4948. return;
  4949. }
  4950. return self._completed.apply( self, arguments );
  4951. };
  4952. // trigger changestart event
  4953. self._trigger( "changestart", null, self.data );
  4954. // count elements to animate
  4955. self.running = toHide.size() === 0 ? toShow.size() : toHide.size();
  4956. if ( options.animated ) {
  4957. var animOptions = {};
  4958. if ( options.collapsible && clickedIsActive ) {
  4959. animOptions = {
  4960. toShow: $( [] ),
  4961. toHide: toHide,
  4962. complete: complete,
  4963. down: down,
  4964. autoHeight: options.autoHeight || options.fillSpace
  4965. };
  4966. } else {
  4967. animOptions = {
  4968. toShow: toShow,
  4969. toHide: toHide,
  4970. complete: complete,
  4971. down: down,
  4972. autoHeight: options.autoHeight || options.fillSpace
  4973. };
  4974. }
  4975. if ( !options.proxied ) {
  4976. options.proxied = options.animated;
  4977. }
  4978. if ( !options.proxiedDuration ) {
  4979. options.proxiedDuration = options.duration;
  4980. }
  4981. options.animated = $.isFunction( options.proxied ) ?
  4982. options.proxied( animOptions ) :
  4983. options.proxied;
  4984. options.duration = $.isFunction( options.proxiedDuration ) ?
  4985. options.proxiedDuration( animOptions ) :
  4986. options.proxiedDuration;
  4987. var animations = $.ui.accordion.animations,
  4988. duration = options.duration,
  4989. easing = options.animated;
  4990. if ( easing && !animations[ easing ] && !$.easing[ easing ] ) {
  4991. easing = "slide";
  4992. }
  4993. if ( !animations[ easing ] ) {
  4994. animations[ easing ] = function( options ) {
  4995. this.slide( options, {
  4996. easing: easing,
  4997. duration: duration || 700
  4998. });
  4999. };
  5000. }
  5001. animations[ easing ]( animOptions );
  5002. } else {
  5003. if ( options.collapsible && clickedIsActive ) {
  5004. toShow.toggle();
  5005. } else {
  5006. toHide.hide();
  5007. toShow.show();
  5008. }
  5009. complete( true );
  5010. }
  5011. // TODO assert that the blur and focus triggers are really necessary, remove otherwise
  5012. toHide.prev()
  5013. .attr({
  5014. "aria-expanded": "false",
  5015. tabIndex: -1
  5016. })
  5017. .blur();
  5018. toShow.prev()
  5019. .attr({
  5020. "aria-expanded": "true",
  5021. tabIndex: 0
  5022. })
  5023. .focus();
  5024. },
  5025. _completed: function( cancel ) {
  5026. this.running = cancel ? 0 : --this.running;
  5027. if ( this.running ) {
  5028. return;
  5029. }
  5030. if ( this.options.clearStyle ) {
  5031. this.toShow.add( this.toHide ).css({
  5032. height: "",
  5033. overflow: ""
  5034. });
  5035. }
  5036. // other classes are removed before the animation; this one needs to stay until completed
  5037. this.toHide.removeClass( "ui-accordion-content-active" );
  5038. this._trigger( "change", null, this.data );
  5039. }
  5040. });
  5041. $.extend( $.ui.accordion, {
  5042. version: "1.8.7",
  5043. animations: {
  5044. slide: function( options, additions ) {
  5045. options = $.extend({
  5046. easing: "swing",
  5047. duration: 300
  5048. }, options, additions );
  5049. if ( !options.toHide.size() ) {
  5050. options.toShow.animate({
  5051. height: "show",
  5052. paddingTop: "show",
  5053. paddingBottom: "show"
  5054. }, options );
  5055. return;
  5056. }
  5057. if ( !options.toShow.size() ) {
  5058. options.toHide.animate({
  5059. height: "hide",
  5060. paddingTop: "hide",
  5061. paddingBottom: "hide"
  5062. }, options );
  5063. return;
  5064. }
  5065. var overflow = options.toShow.css( "overflow" ),
  5066. percentDone = 0,
  5067. showProps = {},
  5068. hideProps = {},
  5069. fxAttrs = [ "height", "paddingTop", "paddingBottom" ],
  5070. originalWidth;
  5071. // fix width before calculating height of hidden element
  5072. var s = options.toShow;
  5073. originalWidth = s[0].style.width;
  5074. s.width( parseInt( s.parent().width(), 10 )
  5075. - parseInt( s.css( "paddingLeft" ), 10 )
  5076. - parseInt( s.css( "paddingRight" ), 10 )
  5077. - ( parseInt( s.css( "borderLeftWidth" ), 10 ) || 0 )
  5078. - ( parseInt( s.css( "borderRightWidth" ), 10) || 0 ) );
  5079. $.each( fxAttrs, function( i, prop ) {
  5080. hideProps[ prop ] = "hide";
  5081. var parts = ( "" + $.css( options.toShow[0], prop ) ).match( /^([\d+-.]+)(.*)$/ );
  5082. showProps[ prop ] = {
  5083. value: parts[ 1 ],
  5084. unit: parts[ 2 ] || "px"
  5085. };
  5086. });
  5087. options.toShow.css({ height: 0, overflow: "hidden" }).show();
  5088. options.toHide
  5089. .filter( ":hidden" )
  5090. .each( options.complete )
  5091. .end()
  5092. .filter( ":visible" )
  5093. .animate( hideProps, {
  5094. step: function( now, settings ) {
  5095. // only calculate the percent when animating height
  5096. // IE gets very inconsistent results when animating elements
  5097. // with small values, which is common for padding
  5098. if ( settings.prop == "height" ) {
  5099. percentDone = ( settings.end - settings.start === 0 ) ? 0 :
  5100. ( settings.now - settings.start ) / ( settings.end - settings.start );
  5101. }
  5102. options.toShow[ 0 ].style[ settings.prop ] =
  5103. ( percentDone * showProps[ settings.prop ].value )
  5104. + showProps[ settings.prop ].unit;
  5105. },
  5106. duration: options.duration,
  5107. easing: options.easing,
  5108. complete: function() {
  5109. if ( !options.autoHeight ) {
  5110. options.toShow.css( "height", "" );
  5111. }
  5112. options.toShow.css({
  5113. width: originalWidth,
  5114. overflow: overflow
  5115. });
  5116. options.complete();
  5117. }
  5118. });
  5119. },
  5120. bounceslide: function( options ) {
  5121. this.slide( options, {
  5122. easing: options.down ? "easeOutBounce" : "swing",
  5123. duration: options.down ? 1000 : 200
  5124. });
  5125. }
  5126. }
  5127. });
  5128. })( jQuery );
  5129. /*
  5130. * Note: While Microsoft is not the author of this file, Microsoft is
  5131. * offering you a license subject to the terms of the Microsoft Software
  5132. * License Terms for Microsoft ASP.NET Model View Controller 3.
  5133. * Microsoft reserves all other rights. The notices below are provided
  5134. * for informational purposes only and are not the license terms under
  5135. * which Microsoft distributed this file.
  5136. *
  5137. * jQuery UI Autocomplete 1.8.7
  5138. *
  5139. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  5140. *
  5141. * http://docs.jquery.com/UI/Autocomplete
  5142. *
  5143. * Depends:
  5144. * jquery.ui.core.js
  5145. * jquery.ui.widget.js
  5146. * jquery.ui.position.js
  5147. */
  5148. (function( $, undefined ) {
  5149. $.widget( "ui.autocomplete", {
  5150. options: {
  5151. appendTo: "body",
  5152. delay: 300,
  5153. minLength: 1,
  5154. position: {
  5155. my: "left top",
  5156. at: "left bottom",
  5157. collision: "none"
  5158. },
  5159. source: null
  5160. },
  5161. _create: function() {
  5162. var self = this,
  5163. doc = this.element[ 0 ].ownerDocument,
  5164. suppressKeyPress;
  5165. this.element
  5166. .addClass( "ui-autocomplete-input" )
  5167. .attr( "autocomplete", "off" )
  5168. // TODO verify these actually work as intended
  5169. .attr({
  5170. role: "textbox",
  5171. "aria-autocomplete": "list",
  5172. "aria-haspopup": "true"
  5173. })
  5174. .bind( "keydown.autocomplete", function( event ) {
  5175. if ( self.options.disabled || self.element.attr( "readonly" ) ) {
  5176. return;
  5177. }
  5178. suppressKeyPress = false;
  5179. var keyCode = $.ui.keyCode;
  5180. switch( event.keyCode ) {
  5181. case keyCode.PAGE_UP:
  5182. self._move( "previousPage", event );
  5183. break;
  5184. case keyCode.PAGE_DOWN:
  5185. self._move( "nextPage", event );
  5186. break;
  5187. case keyCode.UP:
  5188. self._move( "previous", event );
  5189. // prevent moving cursor to beginning of text field in some browsers
  5190. event.preventDefault();
  5191. break;
  5192. case keyCode.DOWN:
  5193. self._move( "next", event );
  5194. // prevent moving cursor to end of text field in some browsers
  5195. event.preventDefault();
  5196. break;
  5197. case keyCode.ENTER:
  5198. case keyCode.NUMPAD_ENTER:
  5199. // when menu is open and has focus
  5200. if ( self.menu.active ) {
  5201. // #6055 - Opera still allows the keypress to occur
  5202. // which causes forms to submit
  5203. suppressKeyPress = true;
  5204. event.preventDefault();
  5205. }
  5206. //passthrough - ENTER and TAB both select the current element
  5207. case keyCode.TAB:
  5208. if ( !self.menu.active ) {
  5209. return;
  5210. }
  5211. self.menu.select( event );
  5212. break;
  5213. case keyCode.ESCAPE:
  5214. self.element.val( self.term );
  5215. self.close( event );
  5216. break;
  5217. default:
  5218. // keypress is triggered before the input value is changed
  5219. clearTimeout( self.searching );
  5220. self.searching = setTimeout(function() {
  5221. // only search if the value has changed
  5222. if ( self.term != self.element.val() ) {
  5223. self.selectedItem = null;
  5224. self.search( null, event );
  5225. }
  5226. }, self.options.delay );
  5227. break;
  5228. }
  5229. })
  5230. .bind( "keypress.autocomplete", function( event ) {
  5231. if ( suppressKeyPress ) {
  5232. suppressKeyPress = false;
  5233. event.preventDefault();
  5234. }
  5235. })
  5236. .bind( "focus.autocomplete", function() {
  5237. if ( self.options.disabled ) {
  5238. return;
  5239. }
  5240. self.selectedItem = null;
  5241. self.previous = self.element.val();
  5242. })
  5243. .bind( "blur.autocomplete", function( event ) {
  5244. if ( self.options.disabled ) {
  5245. return;
  5246. }
  5247. clearTimeout( self.searching );
  5248. // clicks on the menu (or a button to trigger a search) will cause a blur event
  5249. self.closing = setTimeout(function() {
  5250. self.close( event );
  5251. self._change( event );
  5252. }, 150 );
  5253. });
  5254. this._initSource();
  5255. this.response = function() {
  5256. return self._response.apply( self, arguments );
  5257. };
  5258. this.menu = $( "<ul></ul>" )
  5259. .addClass( "ui-autocomplete" )
  5260. .appendTo( $( this.options.appendTo || "body", doc )[0] )
  5261. // prevent the close-on-blur in case of a "slow" click on the menu (long mousedown)
  5262. .mousedown(function( event ) {
  5263. // clicking on the scrollbar causes focus to shift to the body
  5264. // but we can't detect a mouseup or a click immediately afterward
  5265. // so we have to track the next mousedown and close the menu if
  5266. // the user clicks somewhere outside of the autocomplete
  5267. var menuElement = self.menu.element[ 0 ];
  5268. if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
  5269. setTimeout(function() {
  5270. $( document ).one( 'mousedown', function( event ) {
  5271. if ( event.target !== self.element[ 0 ] &&
  5272. event.target !== menuElement &&
  5273. !$.ui.contains( menuElement, event.target ) ) {
  5274. self.close();
  5275. }
  5276. });
  5277. }, 1 );
  5278. }
  5279. // use another timeout to make sure the blur-event-handler on the input was already triggered
  5280. setTimeout(function() {
  5281. clearTimeout( self.closing );
  5282. }, 13);
  5283. })
  5284. .menu({
  5285. focus: function( event, ui ) {
  5286. var item = ui.item.data( "item.autocomplete" );
  5287. if ( false !== self._trigger( "focus", event, { item: item } ) ) {
  5288. // use value to match what will end up in the input, if it was a key event
  5289. if ( /^key/.test(event.originalEvent.type) ) {
  5290. self.element.val( item.value );
  5291. }
  5292. }
  5293. },
  5294. selected: function( event, ui ) {
  5295. var item = ui.item.data( "item.autocomplete" ),
  5296. previous = self.previous;
  5297. // only trigger when focus was lost (click on menu)
  5298. if ( self.element[0] !== doc.activeElement ) {
  5299. self.element.focus();
  5300. self.previous = previous;
  5301. // #6109 - IE triggers two focus events and the second
  5302. // is asynchronous, so we need to reset the previous
  5303. // term synchronously and asynchronously :-(
  5304. setTimeout(function() {
  5305. self.previous = previous;
  5306. self.selectedItem = item;
  5307. }, 1);
  5308. }
  5309. if ( false !== self._trigger( "select", event, { item: item } ) ) {
  5310. self.element.val( item.value );
  5311. }
  5312. // reset the term after the select event
  5313. // this allows custom select handling to work properly
  5314. self.term = self.element.val();
  5315. self.close( event );
  5316. self.selectedItem = item;
  5317. },
  5318. blur: function( event, ui ) {
  5319. // don't set the value of the text field if it's already correct
  5320. // this prevents moving the cursor unnecessarily
  5321. if ( self.menu.element.is(":visible") &&
  5322. ( self.element.val() !== self.term ) ) {
  5323. self.element.val( self.term );
  5324. }
  5325. }
  5326. })
  5327. .zIndex( this.element.zIndex() + 1 )
  5328. // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
  5329. .css({ top: 0, left: 0 })
  5330. .hide()
  5331. .data( "menu" );
  5332. if ( $.fn.bgiframe ) {
  5333. this.menu.element.bgiframe();
  5334. }
  5335. },
  5336. destroy: function() {
  5337. this.element
  5338. .removeClass( "ui-autocomplete-input" )
  5339. .removeAttr( "autocomplete" )
  5340. .removeAttr( "role" )
  5341. .removeAttr( "aria-autocomplete" )
  5342. .removeAttr( "aria-haspopup" );
  5343. this.menu.element.remove();
  5344. $.Widget.prototype.destroy.call( this );
  5345. },
  5346. _setOption: function( key, value ) {
  5347. $.Widget.prototype._setOption.apply( this, arguments );
  5348. if ( key === "source" ) {
  5349. this._initSource();
  5350. }
  5351. if ( key === "appendTo" ) {
  5352. this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] )
  5353. }
  5354. },
  5355. _initSource: function() {
  5356. var self = this,
  5357. array,
  5358. url;
  5359. if ( $.isArray(this.options.source) ) {
  5360. array = this.options.source;
  5361. this.source = function( request, response ) {
  5362. response( $.ui.autocomplete.filter(array, request.term) );
  5363. };
  5364. } else if ( typeof this.options.source === "string" ) {
  5365. url = this.options.source;
  5366. this.source = function( request, response ) {
  5367. if (self.xhr) {
  5368. self.xhr.abort();
  5369. }
  5370. self.xhr = $.ajax({
  5371. url: url,
  5372. data: request,
  5373. dataType: "json",
  5374. success: function( data, status, xhr ) {
  5375. if ( xhr === self.xhr ) {
  5376. response( data );
  5377. }
  5378. self.xhr = null;
  5379. },
  5380. error: function( xhr ) {
  5381. if ( xhr === self.xhr ) {
  5382. response( [] );
  5383. }
  5384. self.xhr = null;
  5385. }
  5386. });
  5387. };
  5388. } else {
  5389. this.source = this.options.source;
  5390. }
  5391. },
  5392. search: function( value, event ) {
  5393. value = value != null ? value : this.element.val();
  5394. // always save the actual value, not the one passed as an argument
  5395. this.term = this.element.val();
  5396. if ( value.length < this.options.minLength ) {
  5397. return this.close( event );
  5398. }
  5399. clearTimeout( this.closing );
  5400. if ( this._trigger( "search", event ) === false ) {
  5401. return;
  5402. }
  5403. return this._search( value );
  5404. },
  5405. _search: function( value ) {
  5406. this.element.addClass( "ui-autocomplete-loading" );
  5407. this.source( { term: value }, this.response );
  5408. },
  5409. _response: function( content ) {
  5410. if ( content && content.length ) {
  5411. content = this._normalize( content );
  5412. this._suggest( content );
  5413. this._trigger( "open" );
  5414. } else {
  5415. this.close();
  5416. }
  5417. this.element.removeClass( "ui-autocomplete-loading" );
  5418. },
  5419. close: function( event ) {
  5420. clearTimeout( this.closing );
  5421. if ( this.menu.element.is(":visible") ) {
  5422. this.menu.element.hide();
  5423. this.menu.deactivate();
  5424. this._trigger( "close", event );
  5425. }
  5426. },
  5427. _change: function( event ) {
  5428. if ( this.previous !== this.element.val() ) {
  5429. this._trigger( "change", event, { item: this.selectedItem } );
  5430. }
  5431. },
  5432. _normalize: function( items ) {
  5433. // assume all items have the right format when the first item is complete
  5434. if ( items.length && items[0].label && items[0].value ) {
  5435. return items;
  5436. }
  5437. return $.map( items, function(item) {
  5438. if ( typeof item === "string" ) {
  5439. return {
  5440. label: item,
  5441. value: item
  5442. };
  5443. }
  5444. return $.extend({
  5445. label: item.label || item.value,
  5446. value: item.value || item.label
  5447. }, item );
  5448. });
  5449. },
  5450. _suggest: function( items ) {
  5451. var ul = this.menu.element
  5452. .empty()
  5453. .zIndex( this.element.zIndex() + 1 );
  5454. this._renderMenu( ul, items );
  5455. // TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate
  5456. this.menu.deactivate();
  5457. this.menu.refresh();
  5458. // size and position menu
  5459. ul.show();
  5460. this._resizeMenu();
  5461. ul.position( $.extend({
  5462. of: this.element
  5463. }, this.options.position ));
  5464. },
  5465. _resizeMenu: function() {
  5466. var ul = this.menu.element;
  5467. ul.outerWidth( Math.max(
  5468. ul.width( "" ).outerWidth(),
  5469. this.element.outerWidth()
  5470. ) );
  5471. },
  5472. _renderMenu: function( ul, items ) {
  5473. var self = this;
  5474. $.each( items, function( index, item ) {
  5475. self._renderItem( ul, item );
  5476. });
  5477. },
  5478. _renderItem: function( ul, item) {
  5479. return $( "<li></li>" )
  5480. .data( "item.autocomplete", item )
  5481. .append( $( "<a></a>" ).text( item.label ) )
  5482. .appendTo( ul );
  5483. },
  5484. _move: function( direction, event ) {
  5485. if ( !this.menu.element.is(":visible") ) {
  5486. this.search( null, event );
  5487. return;
  5488. }
  5489. if ( this.menu.first() && /^previous/.test(direction) ||
  5490. this.menu.last() && /^next/.test(direction) ) {
  5491. this.element.val( this.term );
  5492. this.menu.deactivate();
  5493. return;
  5494. }
  5495. this.menu[ direction ]( event );
  5496. },
  5497. widget: function() {
  5498. return this.menu.element;
  5499. }
  5500. });
  5501. $.extend( $.ui.autocomplete, {
  5502. escapeRegex: function( value ) {
  5503. return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
  5504. },
  5505. filter: function(array, term) {
  5506. var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
  5507. return $.grep( array, function(value) {
  5508. return matcher.test( value.label || value.value || value );
  5509. });
  5510. }
  5511. });
  5512. }( jQuery ));
  5513. /*
  5514. * Note: While Microsoft is not the author of this file, Microsoft is
  5515. * offering you a license subject to the terms of the Microsoft Software
  5516. * License Terms for Microsoft ASP.NET Model View Controller 3.
  5517. * Microsoft reserves all other rights. The notices below are provided
  5518. * for informational purposes only and are not the license terms under
  5519. * which Microsoft distributed this file.
  5520. *
  5521. * jQuery UI Menu (not officially released)
  5522. *
  5523. * This widget isn't yet finished and the API is subject to change. We plan to finish
  5524. * it for the next release. You're welcome to give it a try anyway and give us feedback,
  5525. * as long as you're okay with migrating your code later on. We can help with that, too.
  5526. *
  5527. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  5528. *
  5529. * http://docs.jquery.com/UI/Menu
  5530. *
  5531. * Depends:
  5532. * jquery.ui.core.js
  5533. * jquery.ui.widget.js
  5534. */
  5535. (function($) {
  5536. $.widget("ui.menu", {
  5537. _create: function() {
  5538. var self = this;
  5539. this.element
  5540. .addClass("ui-menu ui-widget ui-widget-content ui-corner-all")
  5541. .attr({
  5542. role: "listbox",
  5543. "aria-activedescendant": "ui-active-menuitem"
  5544. })
  5545. .click(function( event ) {
  5546. if ( !$( event.target ).closest( ".ui-menu-item a" ).length ) {
  5547. return;
  5548. }
  5549. // temporary
  5550. event.preventDefault();
  5551. self.select( event );
  5552. });
  5553. this.refresh();
  5554. },
  5555. refresh: function() {
  5556. var self = this;
  5557. // don't refresh list items that are already adapted
  5558. var items = this.element.children("li:not(.ui-menu-item):has(a)")
  5559. .addClass("ui-menu-item")
  5560. .attr("role", "menuitem");
  5561. items.children("a")
  5562. .addClass("ui-corner-all")
  5563. .attr("tabindex", -1)
  5564. // mouseenter doesn't work with event delegation
  5565. .mouseenter(function( event ) {
  5566. self.activate( event, $(this).parent() );
  5567. })
  5568. .mouseleave(function() {
  5569. self.deactivate();
  5570. });
  5571. },
  5572. activate: function( event, item ) {
  5573. this.deactivate();
  5574. if (this.hasScroll()) {
  5575. var offset = item.offset().top - this.element.offset().top,
  5576. scroll = this.element.attr("scrollTop"),
  5577. elementHeight = this.element.height();
  5578. if (offset < 0) {
  5579. this.element.attr("scrollTop", scroll + offset);
  5580. } else if (offset >= elementHeight) {
  5581. this.element.attr("scrollTop", scroll + offset - elementHeight + item.height());
  5582. }
  5583. }
  5584. this.active = item.eq(0)
  5585. .children("a")
  5586. .addClass("ui-state-hover")
  5587. .attr("id", "ui-active-menuitem")
  5588. .end();
  5589. this._trigger("focus", event, { item: item });
  5590. },
  5591. deactivate: function() {
  5592. if (!this.active) { return; }
  5593. this.active.children("a")
  5594. .removeClass("ui-state-hover")
  5595. .removeAttr("id");
  5596. this._trigger("blur");
  5597. this.active = null;
  5598. },
  5599. next: function(event) {
  5600. this.move("next", ".ui-menu-item:first", event);
  5601. },
  5602. previous: function(event) {
  5603. this.move("prev", ".ui-menu-item:last", event);
  5604. },
  5605. first: function() {
  5606. return this.active && !this.active.prevAll(".ui-menu-item").length;
  5607. },
  5608. last: function() {
  5609. return this.active && !this.active.nextAll(".ui-menu-item").length;
  5610. },
  5611. move: function(direction, edge, event) {
  5612. if (!this.active) {
  5613. this.activate(event, this.element.children(edge));
  5614. return;
  5615. }
  5616. var next = this.active[direction + "All"](".ui-menu-item").eq(0);
  5617. if (next.length) {
  5618. this.activate(event, next);
  5619. } else {
  5620. this.activate(event, this.element.children(edge));
  5621. }
  5622. },
  5623. // TODO merge with previousPage
  5624. nextPage: function(event) {
  5625. if (this.hasScroll()) {
  5626. // TODO merge with no-scroll-else
  5627. if (!this.active || this.last()) {
  5628. this.activate(event, this.element.children(".ui-menu-item:first"));
  5629. return;
  5630. }
  5631. var base = this.active.offset().top,
  5632. height = this.element.height(),
  5633. result = this.element.children(".ui-menu-item").filter(function() {
  5634. var close = $(this).offset().top - base - height + $(this).height();
  5635. // TODO improve approximation
  5636. return close < 10 && close > -10;
  5637. });
  5638. // TODO try to catch this earlier when scrollTop indicates the last page anyway
  5639. if (!result.length) {
  5640. result = this.element.children(".ui-menu-item:last");
  5641. }
  5642. this.activate(event, result);
  5643. } else {
  5644. this.activate(event, this.element.children(".ui-menu-item")
  5645. .filter(!this.active || this.last() ? ":first" : ":last"));
  5646. }
  5647. },
  5648. // TODO merge with nextPage
  5649. previousPage: function(event) {
  5650. if (this.hasScroll()) {
  5651. // TODO merge with no-scroll-else
  5652. if (!this.active || this.first()) {
  5653. this.activate(event, this.element.children(".ui-menu-item:last"));
  5654. return;
  5655. }
  5656. var base = this.active.offset().top,
  5657. height = this.element.height();
  5658. result = this.element.children(".ui-menu-item").filter(function() {
  5659. var close = $(this).offset().top - base + height - $(this).height();
  5660. // TODO improve approximation
  5661. return close < 10 && close > -10;
  5662. });
  5663. // TODO try to catch this earlier when scrollTop indicates the last page anyway
  5664. if (!result.length) {
  5665. result = this.element.children(".ui-menu-item:first");
  5666. }
  5667. this.activate(event, result);
  5668. } else {
  5669. this.activate(event, this.element.children(".ui-menu-item")
  5670. .filter(!this.active || this.first() ? ":last" : ":first"));
  5671. }
  5672. },
  5673. hasScroll: function() {
  5674. return this.element.height() < this.element.attr("scrollHeight");
  5675. },
  5676. select: function( event ) {
  5677. this._trigger("selected", event, { item: this.active });
  5678. }
  5679. });
  5680. }(jQuery));
  5681. /*
  5682. * Note: While Microsoft is not the author of this file, Microsoft is
  5683. * offering you a license subject to the terms of the Microsoft Software
  5684. * License Terms for Microsoft ASP.NET Model View Controller 3.
  5685. * Microsoft reserves all other rights. The notices below are provided
  5686. * for informational purposes only and are not the license terms under
  5687. * which Microsoft distributed this file.
  5688. *
  5689. * jQuery UI Button 1.8.7
  5690. *
  5691. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  5692. *
  5693. * http://docs.jquery.com/UI/Button
  5694. *
  5695. * Depends:
  5696. * jquery.ui.core.js
  5697. * jquery.ui.widget.js
  5698. */
  5699. (function( $, undefined ) {
  5700. var lastActive,
  5701. baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
  5702. stateClasses = "ui-state-hover ui-state-active ",
  5703. typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
  5704. formResetHandler = function( event ) {
  5705. $( ":ui-button", event.target.form ).each(function() {
  5706. var inst = $( this ).data( "button" );
  5707. setTimeout(function() {
  5708. inst.refresh();
  5709. }, 1 );
  5710. });
  5711. },
  5712. radioGroup = function( radio ) {
  5713. var name = radio.name,
  5714. form = radio.form,
  5715. radios = $( [] );
  5716. if ( name ) {
  5717. if ( form ) {
  5718. radios = $( form ).find( "[name='" + name + "']" );
  5719. } else {
  5720. radios = $( "[name='" + name + "']", radio.ownerDocument )
  5721. .filter(function() {
  5722. return !this.form;
  5723. });
  5724. }
  5725. }
  5726. return radios;
  5727. };
  5728. $.widget( "ui.button", {
  5729. options: {
  5730. disabled: null,
  5731. text: true,
  5732. label: null,
  5733. icons: {
  5734. primary: null,
  5735. secondary: null
  5736. }
  5737. },
  5738. _create: function() {
  5739. this.element.closest( "form" )
  5740. .unbind( "reset.button" )
  5741. .bind( "reset.button", formResetHandler );
  5742. if ( typeof this.options.disabled !== "boolean" ) {
  5743. this.options.disabled = this.element.attr( "disabled" );
  5744. }
  5745. this._determineButtonType();
  5746. this.hasTitle = !!this.buttonElement.attr( "title" );
  5747. var self = this,
  5748. options = this.options,
  5749. toggleButton = this.type === "checkbox" || this.type === "radio",
  5750. hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ),
  5751. focusClass = "ui-state-focus";
  5752. if ( options.label === null ) {
  5753. options.label = this.buttonElement.html();
  5754. }
  5755. if ( this.element.is( ":disabled" ) ) {
  5756. options.disabled = true;
  5757. }
  5758. this.buttonElement
  5759. .addClass( baseClasses )
  5760. .attr( "role", "button" )
  5761. .bind( "mouseenter.button", function() {
  5762. if ( options.disabled ) {
  5763. return;
  5764. }
  5765. $( this ).addClass( "ui-state-hover" );
  5766. if ( this === lastActive ) {
  5767. $( this ).addClass( "ui-state-active" );
  5768. }
  5769. })
  5770. .bind( "mouseleave.button", function() {
  5771. if ( options.disabled ) {
  5772. return;
  5773. }
  5774. $( this ).removeClass( hoverClass );
  5775. })
  5776. .bind( "focus.button", function() {
  5777. // no need to check disabled, focus won't be triggered anyway
  5778. $( this ).addClass( focusClass );
  5779. })
  5780. .bind( "blur.button", function() {
  5781. $( this ).removeClass( focusClass );
  5782. });
  5783. if ( toggleButton ) {
  5784. this.element.bind( "change.button", function() {
  5785. self.refresh();
  5786. });
  5787. }
  5788. if ( this.type === "checkbox" ) {
  5789. this.buttonElement.bind( "click.button", function() {
  5790. if ( options.disabled ) {
  5791. return false;
  5792. }
  5793. $( this ).toggleClass( "ui-state-active" );
  5794. self.buttonElement.attr( "aria-pressed", self.element[0].checked );
  5795. });
  5796. } else if ( this.type === "radio" ) {
  5797. this.buttonElement.bind( "click.button", function() {
  5798. if ( options.disabled ) {
  5799. return false;
  5800. }
  5801. $( this ).addClass( "ui-state-active" );
  5802. self.buttonElement.attr( "aria-pressed", true );
  5803. var radio = self.element[ 0 ];
  5804. radioGroup( radio )
  5805. .not( radio )
  5806. .map(function() {
  5807. return $( this ).button( "widget" )[ 0 ];
  5808. })
  5809. .removeClass( "ui-state-active" )
  5810. .attr( "aria-pressed", false );
  5811. });
  5812. } else {
  5813. this.buttonElement
  5814. .bind( "mousedown.button", function() {
  5815. if ( options.disabled ) {
  5816. return false;
  5817. }
  5818. $( this ).addClass( "ui-state-active" );
  5819. lastActive = this;
  5820. $( document ).one( "mouseup", function() {
  5821. lastActive = null;
  5822. });
  5823. })
  5824. .bind( "mouseup.button", function() {
  5825. if ( options.disabled ) {
  5826. return false;
  5827. }
  5828. $( this ).removeClass( "ui-state-active" );
  5829. })
  5830. .bind( "keydown.button", function(event) {
  5831. if ( options.disabled ) {
  5832. return false;
  5833. }
  5834. if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) {
  5835. $( this ).addClass( "ui-state-active" );
  5836. }
  5837. })
  5838. .bind( "keyup.button", function() {
  5839. $( this ).removeClass( "ui-state-active" );
  5840. });
  5841. if ( this.buttonElement.is("a") ) {
  5842. this.buttonElement.keyup(function(event) {
  5843. if ( event.keyCode === $.ui.keyCode.SPACE ) {
  5844. // TODO pass through original event correctly (just as 2nd argument doesn't work)
  5845. $( this ).click();
  5846. }
  5847. });
  5848. }
  5849. }
  5850. // TODO: pull out $.Widget's handling for the disabled option into
  5851. // $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
  5852. // be overridden by individual plugins
  5853. this._setOption( "disabled", options.disabled );
  5854. },
  5855. _determineButtonType: function() {
  5856. if ( this.element.is(":checkbox") ) {
  5857. this.type = "checkbox";
  5858. } else {
  5859. if ( this.element.is(":radio") ) {
  5860. this.type = "radio";
  5861. } else {
  5862. if ( this.element.is("input") ) {
  5863. this.type = "input";
  5864. } else {
  5865. this.type = "button";
  5866. }
  5867. }
  5868. }
  5869. if ( this.type === "checkbox" || this.type === "radio" ) {
  5870. // we don't search against the document in case the element
  5871. // is disconnected from the DOM
  5872. this.buttonElement = this.element.parents().last()
  5873. .find( "label[for=" + this.element.attr("id") + "]" );
  5874. this.element.addClass( "ui-helper-hidden-accessible" );
  5875. var checked = this.element.is( ":checked" );
  5876. if ( checked ) {
  5877. this.buttonElement.addClass( "ui-state-active" );
  5878. }
  5879. this.buttonElement.attr( "aria-pressed", checked );
  5880. } else {
  5881. this.buttonElement = this.element;
  5882. }
  5883. },
  5884. widget: function() {
  5885. return this.buttonElement;
  5886. },
  5887. destroy: function() {
  5888. this.element
  5889. .removeClass( "ui-helper-hidden-accessible" );
  5890. this.buttonElement
  5891. .removeClass( baseClasses + " " + stateClasses + " " + typeClasses )
  5892. .removeAttr( "role" )
  5893. .removeAttr( "aria-pressed" )
  5894. .html( this.buttonElement.find(".ui-button-text").html() );
  5895. if ( !this.hasTitle ) {
  5896. this.buttonElement.removeAttr( "title" );
  5897. }
  5898. $.Widget.prototype.destroy.call( this );
  5899. },
  5900. _setOption: function( key, value ) {
  5901. $.Widget.prototype._setOption.apply( this, arguments );
  5902. if ( key === "disabled" ) {
  5903. if ( value ) {
  5904. this.element.attr( "disabled", true );
  5905. } else {
  5906. this.element.removeAttr( "disabled" );
  5907. }
  5908. }
  5909. this._resetButton();
  5910. },
  5911. refresh: function() {
  5912. var isDisabled = this.element.is( ":disabled" );
  5913. if ( isDisabled !== this.options.disabled ) {
  5914. this._setOption( "disabled", isDisabled );
  5915. }
  5916. if ( this.type === "radio" ) {
  5917. radioGroup( this.element[0] ).each(function() {
  5918. if ( $( this ).is( ":checked" ) ) {
  5919. $( this ).button( "widget" )
  5920. .addClass( "ui-state-active" )
  5921. .attr( "aria-pressed", true );
  5922. } else {
  5923. $( this ).button( "widget" )
  5924. .removeClass( "ui-state-active" )
  5925. .attr( "aria-pressed", false );
  5926. }
  5927. });
  5928. } else if ( this.type === "checkbox" ) {
  5929. if ( this.element.is( ":checked" ) ) {
  5930. this.buttonElement
  5931. .addClass( "ui-state-active" )
  5932. .attr( "aria-pressed", true );
  5933. } else {
  5934. this.buttonElement
  5935. .removeClass( "ui-state-active" )
  5936. .attr( "aria-pressed", false );
  5937. }
  5938. }
  5939. },
  5940. _resetButton: function() {
  5941. if ( this.type === "input" ) {
  5942. if ( this.options.label ) {
  5943. this.element.val( this.options.label );
  5944. }
  5945. return;
  5946. }
  5947. var buttonElement = this.buttonElement.removeClass( typeClasses ),
  5948. buttonText = $( "<span></span>" )
  5949. .addClass( "ui-button-text" )
  5950. .html( this.options.label )
  5951. .appendTo( buttonElement.empty() )
  5952. .text(),
  5953. icons = this.options.icons,
  5954. multipleIcons = icons.primary && icons.secondary;
  5955. if ( icons.primary || icons.secondary ) {
  5956. buttonElement.addClass( "ui-button-text-icon" +
  5957. ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
  5958. if ( icons.primary ) {
  5959. buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
  5960. }
  5961. if ( icons.secondary ) {
  5962. buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
  5963. }
  5964. if ( !this.options.text ) {
  5965. buttonElement
  5966. .addClass( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" )
  5967. .removeClass( "ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary" );
  5968. if ( !this.hasTitle ) {
  5969. buttonElement.attr( "title", buttonText );
  5970. }
  5971. }
  5972. } else {
  5973. buttonElement.addClass( "ui-button-text-only" );
  5974. }
  5975. }
  5976. });
  5977. $.widget( "ui.buttonset", {
  5978. options: {
  5979. items: ":button, :submit, :reset, :checkbox, :radio, a, :data(button)"
  5980. },
  5981. _create: function() {
  5982. this.element.addClass( "ui-buttonset" );
  5983. },
  5984. _init: function() {
  5985. this.refresh();
  5986. },
  5987. _setOption: function( key, value ) {
  5988. if ( key === "disabled" ) {
  5989. this.buttons.button( "option", key, value );
  5990. }
  5991. $.Widget.prototype._setOption.apply( this, arguments );
  5992. },
  5993. refresh: function() {
  5994. this.buttons = this.element.find( this.options.items )
  5995. .filter( ":ui-button" )
  5996. .button( "refresh" )
  5997. .end()
  5998. .not( ":ui-button" )
  5999. .button()
  6000. .end()
  6001. .map(function() {
  6002. return $( this ).button( "widget" )[ 0 ];
  6003. })
  6004. .removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
  6005. .filter( ":first" )
  6006. .addClass( "ui-corner-left" )
  6007. .end()
  6008. .filter( ":last" )
  6009. .addClass( "ui-corner-right" )
  6010. .end()
  6011. .end();
  6012. },
  6013. destroy: function() {
  6014. this.element.removeClass( "ui-buttonset" );
  6015. this.buttons
  6016. .map(function() {
  6017. return $( this ).button( "widget" )[ 0 ];
  6018. })
  6019. .removeClass( "ui-corner-left ui-corner-right" )
  6020. .end()
  6021. .button( "destroy" );
  6022. $.Widget.prototype.destroy.call( this );
  6023. }
  6024. });
  6025. }( jQuery ) );
  6026. /*
  6027. * Note: While Microsoft is not the author of this file, Microsoft is
  6028. * offering you a license subject to the terms of the Microsoft Software
  6029. * License Terms for Microsoft ASP.NET Model View Controller 3.
  6030. * Microsoft reserves all other rights. The notices below are provided
  6031. * for informational purposes only and are not the license terms under
  6032. * which Microsoft distributed this file.
  6033. *
  6034. * jQuery UI Datepicker 1.8.7
  6035. *
  6036. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  6037. *
  6038. * http://docs.jquery.com/UI/Datepicker
  6039. *
  6040. * Depends:
  6041. * jquery.ui.core.js
  6042. */
  6043. (function( $, undefined ) {
  6044. $.extend($.ui, { datepicker: { version: "1.8.7" } });
  6045. var PROP_NAME = 'datepicker';
  6046. var dpuuid = new Date().getTime();
  6047. /* Date picker manager.
  6048. Use the singleton instance of this class, $.datepicker, to interact with the date picker.
  6049. Settings for (groups of) date pickers are maintained in an instance object,
  6050. allowing multiple different settings on the same page. */
  6051. function Datepicker() {
  6052. this.debug = false; // Change this to true to start debugging
  6053. this._curInst = null; // The current instance in use
  6054. this._keyEvent = false; // If the last event was a key event
  6055. this._disabledInputs = []; // List of date picker inputs that have been disabled
  6056. this._datepickerShowing = false; // True if the popup picker is showing , false if not
  6057. this._inDialog = false; // True if showing within a "dialog", false if not
  6058. this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
  6059. this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
  6060. this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
  6061. this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
  6062. this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
  6063. this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
  6064. this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
  6065. this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
  6066. this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class
  6067. this.regional = []; // Available regional settings, indexed by language code
  6068. this.regional[''] = { // Default regional settings
  6069. closeText: 'Done', // Display text for close link
  6070. prevText: 'Prev', // Display text for previous month link
  6071. nextText: 'Next', // Display text for next month link
  6072. currentText: 'Today', // Display text for current month link
  6073. monthNames: ['January','February','March','April','May','June',
  6074. 'July','August','September','October','November','December'], // Names of months for drop-down and formatting
  6075. monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
  6076. dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
  6077. dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
  6078. dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
  6079. weekHeader: 'Wk', // Column header for week of the year
  6080. dateFormat: 'mm/dd/yy', // See format options on parseDate
  6081. firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
  6082. isRTL: false, // True if right-to-left language, false if left-to-right
  6083. showMonthAfterYear: false, // True if the year select precedes month, false for month then year
  6084. yearSuffix: '' // Additional text to append to the year in the month headers
  6085. };
  6086. this._defaults = { // Global defaults for all the date picker instances
  6087. showOn: 'focus', // 'focus' for popup on focus,
  6088. // 'button' for trigger button, or 'both' for either
  6089. showAnim: 'fadeIn', // Name of jQuery animation for popup
  6090. showOptions: {}, // Options for enhanced animations
  6091. defaultDate: null, // Used when field is blank: actual date,
  6092. // +/-number for offset from today, null for today
  6093. appendText: '', // Display text following the input box, e.g. showing the format
  6094. buttonText: '...', // Text for trigger button
  6095. buttonImage: '', // URL for trigger button image
  6096. buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
  6097. hideIfNoPrevNext: false, // True to hide next/previous month links
  6098. // if not applicable, false to just disable them
  6099. navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
  6100. gotoCurrent: false, // True if today link goes back to current selection instead
  6101. changeMonth: false, // True if month can be selected directly, false if only prev/next
  6102. changeYear: false, // True if year can be selected directly, false if only prev/next
  6103. yearRange: 'c-10:c+10', // Range of years to display in drop-down,
  6104. // either relative to today's year (-nn:+nn), relative to currently displayed year
  6105. // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
  6106. showOtherMonths: false, // True to show dates in other months, false to leave blank
  6107. selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
  6108. showWeek: false, // True to show week of the year, false to not show it
  6109. calculateWeek: this.iso8601Week, // How to calculate the week of the year,
  6110. // takes a Date and returns the number of the week for it
  6111. shortYearCutoff: '+10', // Short year values < this are in the current century,
  6112. // > this are in the previous century,
  6113. // string value starting with '+' for current year + value
  6114. minDate: null, // The earliest selectable date, or null for no limit
  6115. maxDate: null, // The latest selectable date, or null for no limit
  6116. duration: 'fast', // Duration of display/closure
  6117. beforeShowDay: null, // Function that takes a date and returns an array with
  6118. // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
  6119. // [2] = cell title (optional), e.g. $.datepicker.noWeekends
  6120. beforeShow: null, // Function that takes an input field and
  6121. // returns a set of custom settings for the date picker
  6122. onSelect: null, // Define a callback function when a date is selected
  6123. onChangeMonthYear: null, // Define a callback function when the month or year is changed
  6124. onClose: null, // Define a callback function when the datepicker is closed
  6125. numberOfMonths: 1, // Number of months to show at a time
  6126. showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
  6127. stepMonths: 1, // Number of months to step back/forward
  6128. stepBigMonths: 12, // Number of months to step back/forward for the big links
  6129. altField: '', // Selector for an alternate field to store selected dates into
  6130. altFormat: '', // The date format to use for the alternate field
  6131. constrainInput: true, // The input is constrained by the current date format
  6132. showButtonPanel: false, // True to show button panel, false to not show it
  6133. autoSize: false // True to size the input for the date format, false to leave as is
  6134. };
  6135. $.extend(this._defaults, this.regional['']);
  6136. this.dpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>');
  6137. }
  6138. $.extend(Datepicker.prototype, {
  6139. /* Class name added to elements to indicate already configured with a date picker. */
  6140. markerClassName: 'hasDatepicker',
  6141. /* Debug logging (if enabled). */
  6142. log: function () {
  6143. if (this.debug)
  6144. console.log.apply('', arguments);
  6145. },
  6146. // TODO rename to "widget" when switching to widget factory
  6147. _widgetDatepicker: function() {
  6148. return this.dpDiv;
  6149. },
  6150. /* Override the default settings for all instances of the date picker.
  6151. @param settings object - the new settings to use as defaults (anonymous object)
  6152. @return the manager object */
  6153. setDefaults: function(settings) {
  6154. extendRemove(this._defaults, settings || {});
  6155. return this;
  6156. },
  6157. /* Attach the date picker to a jQuery selection.
  6158. @param target element - the target input field or division or span
  6159. @param settings object - the new settings to use for this date picker instance (anonymous) */
  6160. _attachDatepicker: function(target, settings) {
  6161. // check for settings on the control itself - in namespace 'date:'
  6162. var inlineSettings = null;
  6163. for (var attrName in this._defaults) {
  6164. var attrValue = target.getAttribute('date:' + attrName);
  6165. if (attrValue) {
  6166. inlineSettings = inlineSettings || {};
  6167. try {
  6168. inlineSettings[attrName] = eval(attrValue);
  6169. } catch (err) {
  6170. inlineSettings[attrName] = attrValue;
  6171. }
  6172. }
  6173. }
  6174. var nodeName = target.nodeName.toLowerCase();
  6175. var inline = (nodeName == 'div' || nodeName == 'span');
  6176. if (!target.id) {
  6177. this.uuid += 1;
  6178. target.id = 'dp' + this.uuid;
  6179. }
  6180. var inst = this._newInst($(target), inline);
  6181. inst.settings = $.extend({}, settings || {}, inlineSettings || {});
  6182. if (nodeName == 'input') {
  6183. this._connectDatepicker(target, inst);
  6184. } else if (inline) {
  6185. this._inlineDatepicker(target, inst);
  6186. }
  6187. },
  6188. /* Create a new instance object. */
  6189. _newInst: function(target, inline) {
  6190. var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars
  6191. return {id: id, input: target, // associated target
  6192. selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
  6193. drawMonth: 0, drawYear: 0, // month being drawn
  6194. inline: inline, // is datepicker inline or not
  6195. dpDiv: (!inline ? this.dpDiv : // presentation div
  6196. $('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))};
  6197. },
  6198. /* Attach the date picker to an input field. */
  6199. _connectDatepicker: function(target, inst) {
  6200. var input = $(target);
  6201. inst.append = $([]);
  6202. inst.trigger = $([]);
  6203. if (input.hasClass(this.markerClassName))
  6204. return;
  6205. this._attachments(input, inst);
  6206. input.addClass(this.markerClassName).keydown(this._doKeyDown).
  6207. keypress(this._doKeyPress).keyup(this._doKeyUp).
  6208. bind("setData.datepicker", function(event, key, value) {
  6209. inst.settings[key] = value;
  6210. }).bind("getData.datepicker", function(event, key) {
  6211. return this._get(inst, key);
  6212. });
  6213. this._autoSize(inst);
  6214. $.data(target, PROP_NAME, inst);
  6215. },
  6216. /* Make attachments based on settings. */
  6217. _attachments: function(input, inst) {
  6218. var appendText = this._get(inst, 'appendText');
  6219. var isRTL = this._get(inst, 'isRTL');
  6220. if (inst.append)
  6221. inst.append.remove();
  6222. if (appendText) {
  6223. inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>');
  6224. input[isRTL ? 'before' : 'after'](inst.append);
  6225. }
  6226. input.unbind('focus', this._showDatepicker);
  6227. if (inst.trigger)
  6228. inst.trigger.remove();
  6229. var showOn = this._get(inst, 'showOn');
  6230. if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
  6231. input.focus(this._showDatepicker);
  6232. if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
  6233. var buttonText = this._get(inst, 'buttonText');
  6234. var buttonImage = this._get(inst, 'buttonImage');
  6235. inst.trigger = $(this._get(inst, 'buttonImageOnly') ?
  6236. $('<img/>').addClass(this._triggerClass).
  6237. attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
  6238. $('<button type="button"></button>').addClass(this._triggerClass).
  6239. html(buttonImage == '' ? buttonText : $('<img/>').attr(
  6240. { src:buttonImage, alt:buttonText, title:buttonText })));
  6241. input[isRTL ? 'before' : 'after'](inst.trigger);
  6242. inst.trigger.click(function() {
  6243. if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0])
  6244. $.datepicker._hideDatepicker();
  6245. else
  6246. $.datepicker._showDatepicker(input[0]);
  6247. return false;
  6248. });
  6249. }
  6250. },
  6251. /* Apply the maximum length for the date format. */
  6252. _autoSize: function(inst) {
  6253. if (this._get(inst, 'autoSize') && !inst.inline) {
  6254. var date = new Date(2009, 12 - 1, 20); // Ensure double digits
  6255. var dateFormat = this._get(inst, 'dateFormat');
  6256. if (dateFormat.match(/[DM]/)) {
  6257. var findMax = function(names) {
  6258. var max = 0;
  6259. var maxI = 0;
  6260. for (var i = 0; i < names.length; i++) {
  6261. if (names[i].length > max) {
  6262. max = names[i].length;
  6263. maxI = i;
  6264. }
  6265. }
  6266. return maxI;
  6267. };
  6268. date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
  6269. 'monthNames' : 'monthNamesShort'))));
  6270. date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
  6271. 'dayNames' : 'dayNamesShort'))) + 20 - date.getDay());
  6272. }
  6273. inst.input.attr('size', this._formatDate(inst, date).length);
  6274. }
  6275. },
  6276. /* Attach an inline date picker to a div. */
  6277. _inlineDatepicker: function(target, inst) {
  6278. var divSpan = $(target);
  6279. if (divSpan.hasClass(this.markerClassName))
  6280. return;
  6281. divSpan.addClass(this.markerClassName).append(inst.dpDiv).
  6282. bind("setData.datepicker", function(event, key, value){
  6283. inst.settings[key] = value;
  6284. }).bind("getData.datepicker", function(event, key){
  6285. return this._get(inst, key);
  6286. });
  6287. $.data(target, PROP_NAME, inst);
  6288. this._setDate(inst, this._getDefaultDate(inst), true);
  6289. this._updateDatepicker(inst);
  6290. this._updateAlternate(inst);
  6291. inst.dpDiv.show();
  6292. },
  6293. /* Pop-up the date picker in a "dialog" box.
  6294. @param input element - ignored
  6295. @param date string or Date - the initial date to display
  6296. @param onSelect function - the function to call when a date is selected
  6297. @param settings object - update the dialog date picker instance's settings (anonymous object)
  6298. @param pos int[2] - coordinates for the dialog's position within the screen or
  6299. event - with x/y coordinates or
  6300. leave empty for default (screen centre)
  6301. @return the manager object */
  6302. _dialogDatepicker: function(input, date, onSelect, settings, pos) {
  6303. var inst = this._dialogInst; // internal instance
  6304. if (!inst) {
  6305. this.uuid += 1;
  6306. var id = 'dp' + this.uuid;
  6307. this._dialogInput = $('<input type="text" id="' + id +
  6308. '" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');
  6309. this._dialogInput.keydown(this._doKeyDown);
  6310. $('body').append(this._dialogInput);
  6311. inst = this._dialogInst = this._newInst(this._dialogInput, false);
  6312. inst.settings = {};
  6313. $.data(this._dialogInput[0], PROP_NAME, inst);
  6314. }
  6315. extendRemove(inst.settings, settings || {});
  6316. date = (date && date.constructor == Date ? this._formatDate(inst, date) : date);
  6317. this._dialogInput.val(date);
  6318. this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
  6319. if (!this._pos) {
  6320. var browserWidth = document.documentElement.clientWidth;
  6321. var browserHeight = document.documentElement.clientHeight;
  6322. var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
  6323. var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
  6324. this._pos = // should use actual width/height below
  6325. [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
  6326. }
  6327. // move input on screen for focus, but hidden behind dialog
  6328. this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px');
  6329. inst.settings.onSelect = onSelect;
  6330. this._inDialog = true;
  6331. this.dpDiv.addClass(this._dialogClass);
  6332. this._showDatepicker(this._dialogInput[0]);
  6333. if ($.blockUI)
  6334. $.blockUI(this.dpDiv);
  6335. $.data(this._dialogInput[0], PROP_NAME, inst);
  6336. return this;
  6337. },
  6338. /* Detach a datepicker from its control.
  6339. @param target element - the target input field or division or span */
  6340. _destroyDatepicker: function(target) {
  6341. var $target = $(target);
  6342. var inst = $.data(target, PROP_NAME);
  6343. if (!$target.hasClass(this.markerClassName)) {
  6344. return;
  6345. }
  6346. var nodeName = target.nodeName.toLowerCase();
  6347. $.removeData(target, PROP_NAME);
  6348. if (nodeName == 'input') {
  6349. inst.append.remove();
  6350. inst.trigger.remove();
  6351. $target.removeClass(this.markerClassName).
  6352. unbind('focus', this._showDatepicker).
  6353. unbind('keydown', this._doKeyDown).
  6354. unbind('keypress', this._doKeyPress).
  6355. unbind('keyup', this._doKeyUp);
  6356. } else if (nodeName == 'div' || nodeName == 'span')
  6357. $target.removeClass(this.markerClassName).empty();
  6358. },
  6359. /* Enable the date picker to a jQuery selection.
  6360. @param target element - the target input field or division or span */
  6361. _enableDatepicker: function(target) {
  6362. var $target = $(target);
  6363. var inst = $.data(target, PROP_NAME);
  6364. if (!$target.hasClass(this.markerClassName)) {
  6365. return;
  6366. }
  6367. var nodeName = target.nodeName.toLowerCase();
  6368. if (nodeName == 'input') {
  6369. target.disabled = false;
  6370. inst.trigger.filter('button').
  6371. each(function() { this.disabled = false; }).end().
  6372. filter('img').css({opacity: '1.0', cursor: ''});
  6373. }
  6374. else if (nodeName == 'div' || nodeName == 'span') {
  6375. var inline = $target.children('.' + this._inlineClass);
  6376. inline.children().removeClass('ui-state-disabled');
  6377. }
  6378. this._disabledInputs = $.map(this._disabledInputs,
  6379. function(value) { return (value == target ? null : value); }); // delete entry
  6380. },
  6381. /* Disable the date picker to a jQuery selection.
  6382. @param target element - the target input field or division or span */
  6383. _disableDatepicker: function(target) {
  6384. var $target = $(target);
  6385. var inst = $.data(target, PROP_NAME);
  6386. if (!$target.hasClass(this.markerClassName)) {
  6387. return;
  6388. }
  6389. var nodeName = target.nodeName.toLowerCase();
  6390. if (nodeName == 'input') {
  6391. target.disabled = true;
  6392. inst.trigger.filter('button').
  6393. each(function() { this.disabled = true; }).end().
  6394. filter('img').css({opacity: '0.5', cursor: 'default'});
  6395. }
  6396. else if (nodeName == 'div' || nodeName == 'span') {
  6397. var inline = $target.children('.' + this._inlineClass);
  6398. inline.children().addClass('ui-state-disabled');
  6399. }
  6400. this._disabledInputs = $.map(this._disabledInputs,
  6401. function(value) { return (value == target ? null : value); }); // delete entry
  6402. this._disabledInputs[this._disabledInputs.length] = target;
  6403. },
  6404. /* Is the first field in a jQuery collection disabled as a datepicker?
  6405. @param target element - the target input field or division or span
  6406. @return boolean - true if disabled, false if enabled */
  6407. _isDisabledDatepicker: function(target) {
  6408. if (!target) {
  6409. return false;
  6410. }
  6411. for (var i = 0; i < this._disabledInputs.length; i++) {
  6412. if (this._disabledInputs[i] == target)
  6413. return true;
  6414. }
  6415. return false;
  6416. },
  6417. /* Retrieve the instance data for the target control.
  6418. @param target element - the target input field or division or span
  6419. @return object - the associated instance data
  6420. @throws error if a jQuery problem getting data */
  6421. _getInst: function(target) {
  6422. try {
  6423. return $.data(target, PROP_NAME);
  6424. }
  6425. catch (err) {
  6426. throw 'Missing instance data for this datepicker';
  6427. }
  6428. },
  6429. /* Update or retrieve the settings for a date picker attached to an input field or division.
  6430. @param target element - the target input field or division or span
  6431. @param name object - the new settings to update or
  6432. string - the name of the setting to change or retrieve,
  6433. when retrieving also 'all' for all instance settings or
  6434. 'defaults' for all global defaults
  6435. @param value any - the new value for the setting
  6436. (omit if above is an object or to retrieve a value) */
  6437. _optionDatepicker: function(target, name, value) {
  6438. var inst = this._getInst(target);
  6439. if (arguments.length == 2 && typeof name == 'string') {
  6440. return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) :
  6441. (inst ? (name == 'all' ? $.extend({}, inst.settings) :
  6442. this._get(inst, name)) : null));
  6443. }
  6444. var settings = name || {};
  6445. if (typeof name == 'string') {
  6446. settings = {};
  6447. settings[name] = value;
  6448. }
  6449. if (inst) {
  6450. if (this._curInst == inst) {
  6451. this._hideDatepicker();
  6452. }
  6453. var date = this._getDateDatepicker(target, true);
  6454. extendRemove(inst.settings, settings);
  6455. this._attachments($(target), inst);
  6456. this._autoSize(inst);
  6457. this._setDateDatepicker(target, date);
  6458. this._updateDatepicker(inst);
  6459. }
  6460. },
  6461. // change method deprecated
  6462. _changeDatepicker: function(target, name, value) {
  6463. this._optionDatepicker(target, name, value);
  6464. },
  6465. /* Redraw the date picker attached to an input field or division.
  6466. @param target element - the target input field or division or span */
  6467. _refreshDatepicker: function(target) {
  6468. var inst = this._getInst(target);
  6469. if (inst) {
  6470. this._updateDatepicker(inst);
  6471. }
  6472. },
  6473. /* Set the dates for a jQuery selection.
  6474. @param target element - the target input field or division or span
  6475. @param date Date - the new date */
  6476. _setDateDatepicker: function(target, date) {
  6477. var inst = this._getInst(target);
  6478. if (inst) {
  6479. this._setDate(inst, date);
  6480. this._updateDatepicker(inst);
  6481. this._updateAlternate(inst);
  6482. }
  6483. },
  6484. /* Get the date(s) for the first entry in a jQuery selection.
  6485. @param target element - the target input field or division or span
  6486. @param noDefault boolean - true if no default date is to be used
  6487. @return Date - the current date */
  6488. _getDateDatepicker: function(target, noDefault) {
  6489. var inst = this._getInst(target);
  6490. if (inst && !inst.inline)
  6491. this._setDateFromField(inst, noDefault);
  6492. return (inst ? this._getDate(inst) : null);
  6493. },
  6494. /* Handle keystrokes. */
  6495. _doKeyDown: function(event) {
  6496. var inst = $.datepicker._getInst(event.target);
  6497. var handled = true;
  6498. var isRTL = inst.dpDiv.is('.ui-datepicker-rtl');
  6499. inst._keyEvent = true;
  6500. if ($.datepicker._datepickerShowing)
  6501. switch (event.keyCode) {
  6502. case 9: $.datepicker._hideDatepicker();
  6503. handled = false;
  6504. break; // hide on tab out
  6505. case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' +
  6506. $.datepicker._currentClass + ')', inst.dpDiv);
  6507. if (sel[0])
  6508. $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
  6509. else
  6510. $.datepicker._hideDatepicker();
  6511. return false; // don't submit the form
  6512. break; // select the value on enter
  6513. case 27: $.datepicker._hideDatepicker();
  6514. break; // hide on escape
  6515. case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  6516. -$.datepicker._get(inst, 'stepBigMonths') :
  6517. -$.datepicker._get(inst, 'stepMonths')), 'M');
  6518. break; // previous month/year on page up/+ ctrl
  6519. case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  6520. +$.datepicker._get(inst, 'stepBigMonths') :
  6521. +$.datepicker._get(inst, 'stepMonths')), 'M');
  6522. break; // next month/year on page down/+ ctrl
  6523. case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target);
  6524. handled = event.ctrlKey || event.metaKey;
  6525. break; // clear on ctrl or command +end
  6526. case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target);
  6527. handled = event.ctrlKey || event.metaKey;
  6528. break; // current on ctrl or command +home
  6529. case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D');
  6530. handled = event.ctrlKey || event.metaKey;
  6531. // -1 day on ctrl or command +left
  6532. if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  6533. -$.datepicker._get(inst, 'stepBigMonths') :
  6534. -$.datepicker._get(inst, 'stepMonths')), 'M');
  6535. // next month/year on alt +left on Mac
  6536. break;
  6537. case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D');
  6538. handled = event.ctrlKey || event.metaKey;
  6539. break; // -1 week on ctrl or command +up
  6540. case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D');
  6541. handled = event.ctrlKey || event.metaKey;
  6542. // +1 day on ctrl or command +right
  6543. if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
  6544. +$.datepicker._get(inst, 'stepBigMonths') :
  6545. +$.datepicker._get(inst, 'stepMonths')), 'M');
  6546. // next month/year on alt +right
  6547. break;
  6548. case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D');
  6549. handled = event.ctrlKey || event.metaKey;
  6550. break; // +1 week on ctrl or command +down
  6551. default: handled = false;
  6552. }
  6553. else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home
  6554. $.datepicker._showDatepicker(this);
  6555. else {
  6556. handled = false;
  6557. }
  6558. if (handled) {
  6559. event.preventDefault();
  6560. event.stopPropagation();
  6561. }
  6562. },
  6563. /* Filter entered characters - based on date format. */
  6564. _doKeyPress: function(event) {
  6565. var inst = $.datepicker._getInst(event.target);
  6566. if ($.datepicker._get(inst, 'constrainInput')) {
  6567. var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
  6568. var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
  6569. return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
  6570. }
  6571. },
  6572. /* Synchronise manual entry and field/alternate field. */
  6573. _doKeyUp: function(event) {
  6574. var inst = $.datepicker._getInst(event.target);
  6575. if (inst.input.val() != inst.lastVal) {
  6576. try {
  6577. var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
  6578. (inst.input ? inst.input.val() : null),
  6579. $.datepicker._getFormatConfig(inst));
  6580. if (date) { // only if valid
  6581. $.datepicker._setDateFromField(inst);
  6582. $.datepicker._updateAlternate(inst);
  6583. $.datepicker._updateDatepicker(inst);
  6584. }
  6585. }
  6586. catch (event) {
  6587. $.datepicker.log(event);
  6588. }
  6589. }
  6590. return true;
  6591. },
  6592. /* Pop-up the date picker for a given input field.
  6593. @param input element - the input field attached to the date picker or
  6594. event - if triggered by focus */
  6595. _showDatepicker: function(input) {
  6596. input = input.target || input;
  6597. if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
  6598. input = $('input', input.parentNode)[0];
  6599. if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
  6600. return;
  6601. var inst = $.datepicker._getInst(input);
  6602. if ($.datepicker._curInst && $.datepicker._curInst != inst) {
  6603. $.datepicker._curInst.dpDiv.stop(true, true);
  6604. }
  6605. var beforeShow = $.datepicker._get(inst, 'beforeShow');
  6606. extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
  6607. inst.lastVal = null;
  6608. $.datepicker._lastInput = input;
  6609. $.datepicker._setDateFromField(inst);
  6610. if ($.datepicker._inDialog) // hide cursor
  6611. input.value = '';
  6612. if (!$.datepicker._pos) { // position below input
  6613. $.datepicker._pos = $.datepicker._findPos(input);
  6614. $.datepicker._pos[1] += input.offsetHeight; // add the height
  6615. }
  6616. var isFixed = false;
  6617. $(input).parents().each(function() {
  6618. isFixed |= $(this).css('position') == 'fixed';
  6619. return !isFixed;
  6620. });
  6621. if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled
  6622. $.datepicker._pos[0] -= document.documentElement.scrollLeft;
  6623. $.datepicker._pos[1] -= document.documentElement.scrollTop;
  6624. }
  6625. var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
  6626. $.datepicker._pos = null;
  6627. //to avoid flashes on Firefox
  6628. inst.dpDiv.empty();
  6629. // determine sizing offscreen
  6630. inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
  6631. $.datepicker._updateDatepicker(inst);
  6632. // fix width for dynamic number of date pickers
  6633. // and adjust position before showing
  6634. offset = $.datepicker._checkOffset(inst, offset, isFixed);
  6635. inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
  6636. 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
  6637. left: offset.left + 'px', top: offset.top + 'px'});
  6638. if (!inst.inline) {
  6639. var showAnim = $.datepicker._get(inst, 'showAnim');
  6640. var duration = $.datepicker._get(inst, 'duration');
  6641. var postProcess = function() {
  6642. $.datepicker._datepickerShowing = true;
  6643. var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
  6644. if( !! cover.length ){
  6645. var borders = $.datepicker._getBorders(inst.dpDiv);
  6646. cover.css({left: -borders[0], top: -borders[1],
  6647. width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()});
  6648. }
  6649. };
  6650. inst.dpDiv.zIndex($(input).zIndex()+1);
  6651. if ($.effects && $.effects[showAnim])
  6652. inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
  6653. else
  6654. inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);
  6655. if (!showAnim || !duration)
  6656. postProcess();
  6657. if (inst.input.is(':visible') && !inst.input.is(':disabled'))
  6658. inst.input.focus();
  6659. $.datepicker._curInst = inst;
  6660. }
  6661. },
  6662. /* Generate the date picker content. */
  6663. _updateDatepicker: function(inst) {
  6664. var self = this;
  6665. var borders = $.datepicker._getBorders(inst.dpDiv);
  6666. inst.dpDiv.empty().append(this._generateHTML(inst));
  6667. var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
  6668. if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6
  6669. cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
  6670. }
  6671. inst.dpDiv.find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a')
  6672. .bind('mouseout', function(){
  6673. $(this).removeClass('ui-state-hover');
  6674. if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');
  6675. if(this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover');
  6676. })
  6677. .bind('mouseover', function(){
  6678. if (!self._isDisabledDatepicker( inst.inline ? inst.dpDiv.parent()[0] : inst.input[0])) {
  6679. $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
  6680. $(this).addClass('ui-state-hover');
  6681. if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover');
  6682. if(this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover');
  6683. }
  6684. })
  6685. .end()
  6686. .find('.' + this._dayOverClass + ' a')
  6687. .trigger('mouseover')
  6688. .end();
  6689. var numMonths = this._getNumberOfMonths(inst);
  6690. var cols = numMonths[1];
  6691. var width = 17;
  6692. if (cols > 1)
  6693. inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
  6694. else
  6695. inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
  6696. inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
  6697. 'Class']('ui-datepicker-multi');
  6698. inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
  6699. 'Class']('ui-datepicker-rtl');
  6700. if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
  6701. inst.input.is(':visible') && !inst.input.is(':disabled'))
  6702. inst.input.focus();
  6703. // deffered render of the years select (to avoid flashes on Firefox)
  6704. if( inst.yearshtml ){
  6705. var origyearshtml = inst.yearshtml;
  6706. setTimeout(function(){
  6707. //assure that inst.yearshtml didn't change.
  6708. if( origyearshtml === inst.yearshtml ){
  6709. inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml);
  6710. }
  6711. origyearshtml = inst.yearshtml = null;
  6712. }, 0);
  6713. }
  6714. },
  6715. /* Retrieve the size of left and top borders for an element.
  6716. @param elem (jQuery object) the element of interest
  6717. @return (number[2]) the left and top borders */
  6718. _getBorders: function(elem) {
  6719. var convert = function(value) {
  6720. return {thin: 1, medium: 2, thick: 3}[value] || value;
  6721. };
  6722. return [parseFloat(convert(elem.css('border-left-width'))),
  6723. parseFloat(convert(elem.css('border-top-width')))];
  6724. },
  6725. /* Check positioning to remain on screen. */
  6726. _checkOffset: function(inst, offset, isFixed) {
  6727. var dpWidth = inst.dpDiv.outerWidth();
  6728. var dpHeight = inst.dpDiv.outerHeight();
  6729. var inputWidth = inst.input ? inst.input.outerWidth() : 0;
  6730. var inputHeight = inst.input ? inst.input.outerHeight() : 0;
  6731. var viewWidth = document.documentElement.clientWidth + $(document).scrollLeft();
  6732. var viewHeight = document.documentElement.clientHeight + $(document).scrollTop();
  6733. offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
  6734. offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
  6735. offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
  6736. // now check if datepicker is showing outside window viewport - move to a better place if so.
  6737. offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
  6738. Math.abs(offset.left + dpWidth - viewWidth) : 0);
  6739. offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
  6740. Math.abs(dpHeight + inputHeight) : 0);
  6741. return offset;
  6742. },
  6743. /* Find an object's position on the screen. */
  6744. _findPos: function(obj) {
  6745. var inst = this._getInst(obj);
  6746. var isRTL = this._get(inst, 'isRTL');
  6747. while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
  6748. obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
  6749. }
  6750. var position = $(obj).offset();
  6751. return [position.left, position.top];
  6752. },
  6753. /* Hide the date picker from view.
  6754. @param input element - the input field attached to the date picker */
  6755. _hideDatepicker: function(input) {
  6756. var inst = this._curInst;
  6757. if (!inst || (input && inst != $.data(input, PROP_NAME)))
  6758. return;
  6759. if (this._datepickerShowing) {
  6760. var showAnim = this._get(inst, 'showAnim');
  6761. var duration = this._get(inst, 'duration');
  6762. var postProcess = function() {
  6763. $.datepicker._tidyDialog(inst);
  6764. this._curInst = null;
  6765. };
  6766. if ($.effects && $.effects[showAnim])
  6767. inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
  6768. else
  6769. inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' :
  6770. (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
  6771. if (!showAnim)
  6772. postProcess();
  6773. var onClose = this._get(inst, 'onClose');
  6774. if (onClose)
  6775. onClose.apply((inst.input ? inst.input[0] : null),
  6776. [(inst.input ? inst.input.val() : ''), inst]); // trigger custom callback
  6777. this._datepickerShowing = false;
  6778. this._lastInput = null;
  6779. if (this._inDialog) {
  6780. this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
  6781. if ($.blockUI) {
  6782. $.unblockUI();
  6783. $('body').append(this.dpDiv);
  6784. }
  6785. }
  6786. this._inDialog = false;
  6787. }
  6788. },
  6789. /* Tidy up after a dialog display. */
  6790. _tidyDialog: function(inst) {
  6791. inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');
  6792. },
  6793. /* Close date picker if clicked elsewhere. */
  6794. _checkExternalClick: function(event) {
  6795. if (!$.datepicker._curInst)
  6796. return;
  6797. var $target = $(event.target);
  6798. if ($target[0].id != $.datepicker._mainDivId &&
  6799. $target.parents('#' + $.datepicker._mainDivId).length == 0 &&
  6800. !$target.hasClass($.datepicker.markerClassName) &&
  6801. !$target.hasClass($.datepicker._triggerClass) &&
  6802. $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))
  6803. $.datepicker._hideDatepicker();
  6804. },
  6805. /* Adjust one of the date sub-fields. */
  6806. _adjustDate: function(id, offset, period) {
  6807. var target = $(id);
  6808. var inst = this._getInst(target[0]);
  6809. if (this._isDisabledDatepicker(target[0])) {
  6810. return;
  6811. }
  6812. this._adjustInstDate(inst, offset +
  6813. (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning
  6814. period);
  6815. this._updateDatepicker(inst);
  6816. },
  6817. /* Action for current link. */
  6818. _gotoToday: function(id) {
  6819. var target = $(id);
  6820. var inst = this._getInst(target[0]);
  6821. if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
  6822. inst.selectedDay = inst.currentDay;
  6823. inst.drawMonth = inst.selectedMonth = inst.currentMonth;
  6824. inst.drawYear = inst.selectedYear = inst.currentYear;
  6825. }
  6826. else {
  6827. var date = new Date();
  6828. inst.selectedDay = date.getDate();
  6829. inst.drawMonth = inst.selectedMonth = date.getMonth();
  6830. inst.drawYear = inst.selectedYear = date.getFullYear();
  6831. }
  6832. this._notifyChange(inst);
  6833. this._adjustDate(target);
  6834. },
  6835. /* Action for selecting a new month/year. */
  6836. _selectMonthYear: function(id, select, period) {
  6837. var target = $(id);
  6838. var inst = this._getInst(target[0]);
  6839. inst._selectingMonthYear = false;
  6840. inst['selected' + (period == 'M' ? 'Month' : 'Year')] =
  6841. inst['draw' + (period == 'M' ? 'Month' : 'Year')] =
  6842. parseInt(select.options[select.selectedIndex].value,10);
  6843. this._notifyChange(inst);
  6844. this._adjustDate(target);
  6845. },
  6846. /* Restore input focus after not changing month/year. */
  6847. _clickMonthYear: function(id) {
  6848. var target = $(id);
  6849. var inst = this._getInst(target[0]);
  6850. if (inst.input && inst._selectingMonthYear) {
  6851. setTimeout(function() {
  6852. inst.input.focus();
  6853. }, 0);
  6854. }
  6855. inst._selectingMonthYear = !inst._selectingMonthYear;
  6856. },
  6857. /* Action for selecting a day. */
  6858. _selectDay: function(id, month, year, td) {
  6859. var target = $(id);
  6860. if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
  6861. return;
  6862. }
  6863. var inst = this._getInst(target[0]);
  6864. inst.selectedDay = inst.currentDay = $('a', td).html();
  6865. inst.selectedMonth = inst.currentMonth = month;
  6866. inst.selectedYear = inst.currentYear = year;
  6867. this._selectDate(id, this._formatDate(inst,
  6868. inst.currentDay, inst.currentMonth, inst.currentYear));
  6869. },
  6870. /* Erase the input field and hide the date picker. */
  6871. _clearDate: function(id) {
  6872. var target = $(id);
  6873. var inst = this._getInst(target[0]);
  6874. this._selectDate(target, '');
  6875. },
  6876. /* Update the input field with the selected date. */
  6877. _selectDate: function(id, dateStr) {
  6878. var target = $(id);
  6879. var inst = this._getInst(target[0]);
  6880. dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
  6881. if (inst.input)
  6882. inst.input.val(dateStr);
  6883. this._updateAlternate(inst);
  6884. var onSelect = this._get(inst, 'onSelect');
  6885. if (onSelect)
  6886. onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
  6887. else if (inst.input)
  6888. inst.input.trigger('change'); // fire the change event
  6889. if (inst.inline)
  6890. this._updateDatepicker(inst);
  6891. else {
  6892. this._hideDatepicker();
  6893. this._lastInput = inst.input[0];
  6894. if (typeof(inst.input[0]) != 'object')
  6895. inst.input.focus(); // restore focus
  6896. this._lastInput = null;
  6897. }
  6898. },
  6899. /* Update any alternate field to synchronise with the main field. */
  6900. _updateAlternate: function(inst) {
  6901. var altField = this._get(inst, 'altField');
  6902. if (altField) { // update alternate field too
  6903. var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');
  6904. var date = this._getDate(inst);
  6905. var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
  6906. $(altField).each(function() { $(this).val(dateStr); });
  6907. }
  6908. },
  6909. /* Set as beforeShowDay function to prevent selection of weekends.
  6910. @param date Date - the date to customise
  6911. @return [boolean, string] - is this date selectable?, what is its CSS class? */
  6912. noWeekends: function(date) {
  6913. var day = date.getDay();
  6914. return [(day > 0 && day < 6), ''];
  6915. },
  6916. /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
  6917. @param date Date - the date to get the week for
  6918. @return number - the number of the week within the year that contains this date */
  6919. iso8601Week: function(date) {
  6920. var checkDate = new Date(date.getTime());
  6921. // Find Thursday of this week starting on Monday
  6922. checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
  6923. var time = checkDate.getTime();
  6924. checkDate.setMonth(0); // Compare with Jan 1
  6925. checkDate.setDate(1);
  6926. return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
  6927. },
  6928. /* Parse a string value into a date object.
  6929. See formatDate below for the possible formats.
  6930. @param format string - the expected format of the date
  6931. @param value string - the date in the above format
  6932. @param settings Object - attributes include:
  6933. shortYearCutoff number - the cutoff year for determining the century (optional)
  6934. dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
  6935. dayNames string[7] - names of the days from Sunday (optional)
  6936. monthNamesShort string[12] - abbreviated names of the months (optional)
  6937. monthNames string[12] - names of the months (optional)
  6938. @return Date - the extracted date value or null if value is blank */
  6939. parseDate: function (format, value, settings) {
  6940. if (format == null || value == null)
  6941. throw 'Invalid arguments';
  6942. value = (typeof value == 'object' ? value.toString() : value + '');
  6943. if (value == '')
  6944. return null;
  6945. var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
  6946. var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
  6947. var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
  6948. var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
  6949. var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
  6950. var year = -1;
  6951. var month = -1;
  6952. var day = -1;
  6953. var doy = -1;
  6954. var literal = false;
  6955. // Check whether a format character is doubled
  6956. var lookAhead = function(match) {
  6957. var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
  6958. if (matches)
  6959. iFormat++;
  6960. return matches;
  6961. };
  6962. // Extract a number from the string value
  6963. var getNumber = function(match) {
  6964. var isDoubled = lookAhead(match);
  6965. var size = (match == '@' ? 14 : (match == '!' ? 20 :
  6966. (match == 'y' && isDoubled ? 4 : (match == 'o' ? 3 : 2))));
  6967. var digits = new RegExp('^\\d{1,' + size + '}');
  6968. var num = value.substring(iValue).match(digits);
  6969. if (!num)
  6970. throw 'Missing number at position ' + iValue;
  6971. iValue += num[0].length;
  6972. return parseInt(num[0], 10);
  6973. };
  6974. // Extract a name from the string value and convert to an index
  6975. var getName = function(match, shortNames, longNames) {
  6976. var names = (lookAhead(match) ? longNames : shortNames);
  6977. for (var i = 0; i < names.length; i++) {
  6978. if (value.substr(iValue, names[i].length).toLowerCase() == names[i].toLowerCase()) {
  6979. iValue += names[i].length;
  6980. return i + 1;
  6981. }
  6982. }
  6983. throw 'Unknown name at position ' + iValue;
  6984. };
  6985. // Confirm that a literal character matches the string value
  6986. var checkLiteral = function() {
  6987. if (value.charAt(iValue) != format.charAt(iFormat))
  6988. throw 'Unexpected literal at position ' + iValue;
  6989. iValue++;
  6990. };
  6991. var iValue = 0;
  6992. for (var iFormat = 0; iFormat < format.length; iFormat++) {
  6993. if (literal)
  6994. if (format.charAt(iFormat) == "'" && !lookAhead("'"))
  6995. literal = false;
  6996. else
  6997. checkLiteral();
  6998. else
  6999. switch (format.charAt(iFormat)) {
  7000. case 'd':
  7001. day = getNumber('d');
  7002. break;
  7003. case 'D':
  7004. getName('D', dayNamesShort, dayNames);
  7005. break;
  7006. case 'o':
  7007. doy = getNumber('o');
  7008. break;
  7009. case 'm':
  7010. month = getNumber('m');
  7011. break;
  7012. case 'M':
  7013. month = getName('M', monthNamesShort, monthNames);
  7014. break;
  7015. case 'y':
  7016. year = getNumber('y');
  7017. break;
  7018. case '@':
  7019. var date = new Date(getNumber('@'));
  7020. year = date.getFullYear();
  7021. month = date.getMonth() + 1;
  7022. day = date.getDate();
  7023. break;
  7024. case '!':
  7025. var date = new Date((getNumber('!') - this._ticksTo1970) / 10000);
  7026. year = date.getFullYear();
  7027. month = date.getMonth() + 1;
  7028. day = date.getDate();
  7029. break;
  7030. case "'":
  7031. if (lookAhead("'"))
  7032. checkLiteral();
  7033. else
  7034. literal = true;
  7035. break;
  7036. default:
  7037. checkLiteral();
  7038. }
  7039. }
  7040. if (year == -1)
  7041. year = new Date().getFullYear();
  7042. else if (year < 100)
  7043. year += new Date().getFullYear() - new Date().getFullYear() % 100 +
  7044. (year <= shortYearCutoff ? 0 : -100);
  7045. if (doy > -1) {
  7046. month = 1;
  7047. day = doy;
  7048. do {
  7049. var dim = this._getDaysInMonth(year, month - 1);
  7050. if (day <= dim)
  7051. break;
  7052. month++;
  7053. day -= dim;
  7054. } while (true);
  7055. }
  7056. var date = this._daylightSavingAdjust(new Date(year, month - 1, day));
  7057. if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)
  7058. throw 'Invalid date'; // E.g. 31/02/*
  7059. return date;
  7060. },
  7061. /* Standard date formats. */
  7062. ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
  7063. COOKIE: 'D, dd M yy',
  7064. ISO_8601: 'yy-mm-dd',
  7065. RFC_822: 'D, d M y',
  7066. RFC_850: 'DD, dd-M-y',
  7067. RFC_1036: 'D, d M y',
  7068. RFC_1123: 'D, d M yy',
  7069. RFC_2822: 'D, d M yy',
  7070. RSS: 'D, d M y', // RFC 822
  7071. TICKS: '!',
  7072. TIMESTAMP: '@',
  7073. W3C: 'yy-mm-dd', // ISO 8601
  7074. _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
  7075. Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
  7076. /* Format a date object into a string value.
  7077. The format can be combinations of the following:
  7078. d - day of month (no leading zero)
  7079. dd - day of month (two digit)
  7080. o - day of year (no leading zeros)
  7081. oo - day of year (three digit)
  7082. D - day name short
  7083. DD - day name long
  7084. m - month of year (no leading zero)
  7085. mm - month of year (two digit)
  7086. M - month name short
  7087. MM - month name long
  7088. y - year (two digit)
  7089. yy - year (four digit)
  7090. @ - Unix timestamp (ms since 01/01/1970)
  7091. ! - Windows ticks (100ns since 01/01/0001)
  7092. '...' - literal text
  7093. '' - single quote
  7094. @param format string - the desired format of the date
  7095. @param date Date - the date value to format
  7096. @param settings Object - attributes include:
  7097. dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
  7098. dayNames string[7] - names of the days from Sunday (optional)
  7099. monthNamesShort string[12] - abbreviated names of the months (optional)
  7100. monthNames string[12] - names of the months (optional)
  7101. @return string - the date in the above format */
  7102. formatDate: function (format, date, settings) {
  7103. if (!date)
  7104. return '';
  7105. var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
  7106. var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
  7107. var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
  7108. var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
  7109. // Check whether a format character is doubled
  7110. var lookAhead = function(match) {
  7111. var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
  7112. if (matches)
  7113. iFormat++;
  7114. return matches;
  7115. };
  7116. // Format a number, with leading zero if necessary
  7117. var formatNumber = function(match, value, len) {
  7118. var num = '' + value;
  7119. if (lookAhead(match))
  7120. while (num.length < len)
  7121. num = '0' + num;
  7122. return num;
  7123. };
  7124. // Format a name, short or long as requested
  7125. var formatName = function(match, value, shortNames, longNames) {
  7126. return (lookAhead(match) ? longNames[value] : shortNames[value]);
  7127. };
  7128. var output = '';
  7129. var literal = false;
  7130. if (date)
  7131. for (var iFormat = 0; iFormat < format.length; iFormat++) {
  7132. if (literal)
  7133. if (format.charAt(iFormat) == "'" && !lookAhead("'"))
  7134. literal = false;
  7135. else
  7136. output += format.charAt(iFormat);
  7137. else
  7138. switch (format.charAt(iFormat)) {
  7139. case 'd':
  7140. output += formatNumber('d', date.getDate(), 2);
  7141. break;
  7142. case 'D':
  7143. output += formatName('D', date.getDay(), dayNamesShort, dayNames);
  7144. break;
  7145. case 'o':
  7146. output += formatNumber('o',
  7147. (date.getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000, 3);
  7148. break;
  7149. case 'm':
  7150. output += formatNumber('m', date.getMonth() + 1, 2);
  7151. break;
  7152. case 'M':
  7153. output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
  7154. break;
  7155. case 'y':
  7156. output += (lookAhead('y') ? date.getFullYear() :
  7157. (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
  7158. break;
  7159. case '@':
  7160. output += date.getTime();
  7161. break;
  7162. case '!':
  7163. output += date.getTime() * 10000 + this._ticksTo1970;
  7164. break;
  7165. case "'":
  7166. if (lookAhead("'"))
  7167. output += "'";
  7168. else
  7169. literal = true;
  7170. break;
  7171. default:
  7172. output += format.charAt(iFormat);
  7173. }
  7174. }
  7175. return output;
  7176. },
  7177. /* Extract all possible characters from the date format. */
  7178. _possibleChars: function (format) {
  7179. var chars = '';
  7180. var literal = false;
  7181. // Check whether a format character is doubled
  7182. var lookAhead = function(match) {
  7183. var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
  7184. if (matches)
  7185. iFormat++;
  7186. return matches;
  7187. };
  7188. for (var iFormat = 0; iFormat < format.length; iFormat++)
  7189. if (literal)
  7190. if (format.charAt(iFormat) == "'" && !lookAhead("'"))
  7191. literal = false;
  7192. else
  7193. chars += format.charAt(iFormat);
  7194. else
  7195. switch (format.charAt(iFormat)) {
  7196. case 'd': case 'm': case 'y': case '@':
  7197. chars += '0123456789';
  7198. break;
  7199. case 'D': case 'M':
  7200. return null; // Accept anything
  7201. case "'":
  7202. if (lookAhead("'"))
  7203. chars += "'";
  7204. else
  7205. literal = true;
  7206. break;
  7207. default:
  7208. chars += format.charAt(iFormat);
  7209. }
  7210. return chars;
  7211. },
  7212. /* Get a setting value, defaulting if necessary. */
  7213. _get: function(inst, name) {
  7214. return inst.settings[name] !== undefined ?
  7215. inst.settings[name] : this._defaults[name];
  7216. },
  7217. /* Parse existing date and initialise date picker. */
  7218. _setDateFromField: function(inst, noDefault) {
  7219. if (inst.input.val() == inst.lastVal) {
  7220. return;
  7221. }
  7222. var dateFormat = this._get(inst, 'dateFormat');
  7223. var dates = inst.lastVal = inst.input ? inst.input.val() : null;
  7224. var date, defaultDate;
  7225. date = defaultDate = this._getDefaultDate(inst);
  7226. var settings = this._getFormatConfig(inst);
  7227. try {
  7228. date = this.parseDate(dateFormat, dates, settings) || defaultDate;
  7229. } catch (event) {
  7230. this.log(event);
  7231. dates = (noDefault ? '' : dates);
  7232. }
  7233. inst.selectedDay = date.getDate();
  7234. inst.drawMonth = inst.selectedMonth = date.getMonth();
  7235. inst.drawYear = inst.selectedYear = date.getFullYear();
  7236. inst.currentDay = (dates ? date.getDate() : 0);
  7237. inst.currentMonth = (dates ? date.getMonth() : 0);
  7238. inst.currentYear = (dates ? date.getFullYear() : 0);
  7239. this._adjustInstDate(inst);
  7240. },
  7241. /* Retrieve the default date shown on opening. */
  7242. _getDefaultDate: function(inst) {
  7243. return this._restrictMinMax(inst,
  7244. this._determineDate(inst, this._get(inst, 'defaultDate'), new Date()));
  7245. },
  7246. /* A date may be specified as an exact value or a relative one. */
  7247. _determineDate: function(inst, date, defaultDate) {
  7248. var offsetNumeric = function(offset) {
  7249. var date = new Date();
  7250. date.setDate(date.getDate() + offset);
  7251. return date;
  7252. };
  7253. var offsetString = function(offset) {
  7254. try {
  7255. return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
  7256. offset, $.datepicker._getFormatConfig(inst));
  7257. }
  7258. catch (e) {
  7259. // Ignore
  7260. }
  7261. var date = (offset.toLowerCase().match(/^c/) ?
  7262. $.datepicker._getDate(inst) : null) || new Date();
  7263. var year = date.getFullYear();
  7264. var month = date.getMonth();
  7265. var day = date.getDate();
  7266. var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
  7267. var matches = pattern.exec(offset);
  7268. while (matches) {
  7269. switch (matches[2] || 'd') {
  7270. case 'd' : case 'D' :
  7271. day += parseInt(matches[1],10); break;
  7272. case 'w' : case 'W' :
  7273. day += parseInt(matches[1],10) * 7; break;
  7274. case 'm' : case 'M' :
  7275. month += parseInt(matches[1],10);
  7276. day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
  7277. break;
  7278. case 'y': case 'Y' :
  7279. year += parseInt(matches[1],10);
  7280. day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
  7281. break;
  7282. }
  7283. matches = pattern.exec(offset);
  7284. }
  7285. return new Date(year, month, day);
  7286. };
  7287. var newDate = (date == null || date === '' ? defaultDate : (typeof date == 'string' ? offsetString(date) :
  7288. (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
  7289. newDate = (newDate && newDate.toString() == 'Invalid Date' ? defaultDate : newDate);
  7290. if (newDate) {
  7291. newDate.setHours(0);
  7292. newDate.setMinutes(0);
  7293. newDate.setSeconds(0);
  7294. newDate.setMilliseconds(0);
  7295. }
  7296. return this._daylightSavingAdjust(newDate);
  7297. },
  7298. /* Handle switch to/from daylight saving.
  7299. Hours may be non-zero on daylight saving cut-over:
  7300. > 12 when midnight changeover, but then cannot generate
  7301. midnight datetime, so jump to 1AM, otherwise reset.
  7302. @param date (Date) the date to check
  7303. @return (Date) the corrected date */
  7304. _daylightSavingAdjust: function(date) {
  7305. if (!date) return null;
  7306. date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
  7307. return date;
  7308. },
  7309. /* Set the date(s) directly. */
  7310. _setDate: function(inst, date, noChange) {
  7311. var clear = !date;
  7312. var origMonth = inst.selectedMonth;
  7313. var origYear = inst.selectedYear;
  7314. var newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
  7315. inst.selectedDay = inst.currentDay = newDate.getDate();
  7316. inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
  7317. inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
  7318. if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange)
  7319. this._notifyChange(inst);
  7320. this._adjustInstDate(inst);
  7321. if (inst.input) {
  7322. inst.input.val(clear ? '' : this._formatDate(inst));
  7323. }
  7324. },
  7325. /* Retrieve the date(s) directly. */
  7326. _getDate: function(inst) {
  7327. var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
  7328. this._daylightSavingAdjust(new Date(
  7329. inst.currentYear, inst.currentMonth, inst.currentDay)));
  7330. return startDate;
  7331. },
  7332. /* Generate the HTML for the current state of the date picker. */
  7333. _generateHTML: function(inst) {
  7334. var today = new Date();
  7335. today = this._daylightSavingAdjust(
  7336. new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time
  7337. var isRTL = this._get(inst, 'isRTL');
  7338. var showButtonPanel = this._get(inst, 'showButtonPanel');
  7339. var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
  7340. var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
  7341. var numMonths = this._getNumberOfMonths(inst);
  7342. var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
  7343. var stepMonths = this._get(inst, 'stepMonths');
  7344. var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
  7345. var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
  7346. new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
  7347. var minDate = this._getMinMaxDate(inst, 'min');
  7348. var maxDate = this._getMinMaxDate(inst, 'max');
  7349. var drawMonth = inst.drawMonth - showCurrentAtPos;
  7350. var drawYear = inst.drawYear;
  7351. if (drawMonth < 0) {
  7352. drawMonth += 12;
  7353. drawYear--;
  7354. }
  7355. if (maxDate) {
  7356. var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
  7357. maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
  7358. maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
  7359. while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
  7360. drawMonth--;
  7361. if (drawMonth < 0) {
  7362. drawMonth = 11;
  7363. drawYear--;
  7364. }
  7365. }
  7366. }
  7367. inst.drawMonth = drawMonth;
  7368. inst.drawYear = drawYear;
  7369. var prevText = this._get(inst, 'prevText');
  7370. prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
  7371. this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
  7372. this._getFormatConfig(inst)));
  7373. var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
  7374. '<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_' + dpuuid +
  7375. '.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' +
  7376. ' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' :
  7377. (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>'));
  7378. var nextText = this._get(inst, 'nextText');
  7379. nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
  7380. this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
  7381. this._getFormatConfig(inst)));
  7382. var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
  7383. '<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_' + dpuuid +
  7384. '.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' +
  7385. ' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' :
  7386. (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>'));
  7387. var currentText = this._get(inst, 'currentText');
  7388. var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
  7389. currentText = (!navigationAsDateFormat ? currentText :
  7390. this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
  7391. var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_' + dpuuid +
  7392. '.datepicker._hideDatepicker();">' + this._get(inst, 'closeText') + '</button>' : '');
  7393. var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') +
  7394. (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_' + dpuuid +
  7395. '.datepicker._gotoToday(\'#' + inst.id + '\');"' +
  7396. '>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
  7397. var firstDay = parseInt(this._get(inst, 'firstDay'),10);
  7398. firstDay = (isNaN(firstDay) ? 0 : firstDay);
  7399. var showWeek = this._get(inst, 'showWeek');
  7400. var dayNames = this._get(inst, 'dayNames');
  7401. var dayNamesShort = this._get(inst, 'dayNamesShort');
  7402. var dayNamesMin = this._get(inst, 'dayNamesMin');
  7403. var monthNames = this._get(inst, 'monthNames');
  7404. var monthNamesShort = this._get(inst, 'monthNamesShort');
  7405. var beforeShowDay = this._get(inst, 'beforeShowDay');
  7406. var showOtherMonths = this._get(inst, 'showOtherMonths');
  7407. var selectOtherMonths = this._get(inst, 'selectOtherMonths');
  7408. var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
  7409. var defaultDate = this._getDefaultDate(inst);
  7410. var html = '';
  7411. for (var row = 0; row < numMonths[0]; row++) {
  7412. var group = '';
  7413. for (var col = 0; col < numMonths[1]; col++) {
  7414. var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
  7415. var cornerClass = ' ui-corner-all';
  7416. var calender = '';
  7417. if (isMultiMonth) {
  7418. calender += '<div class="ui-datepicker-group';
  7419. if (numMonths[1] > 1)
  7420. switch (col) {
  7421. case 0: calender += ' ui-datepicker-group-first';
  7422. cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;
  7423. case numMonths[1]-1: calender += ' ui-datepicker-group-last';
  7424. cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;
  7425. default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break;
  7426. }
  7427. calender += '">';
  7428. }
  7429. calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' +
  7430. (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +
  7431. (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +
  7432. this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
  7433. row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
  7434. '</div><table class="ui-datepicker-calendar"><thead>' +
  7435. '<tr>';
  7436. var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : '');
  7437. for (var dow = 0; dow < 7; dow++) { // days of the week
  7438. var day = (dow + firstDay) % 7;
  7439. thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' +
  7440. '<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>';
  7441. }
  7442. calender += thead + '</tr></thead><tbody>';
  7443. var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
  7444. if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
  7445. inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
  7446. var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
  7447. var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate
  7448. var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
  7449. for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
  7450. calender += '<tr>';
  7451. var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' +
  7452. this._get(inst, 'calculateWeek')(printDate) + '</td>');
  7453. for (var dow = 0; dow < 7; dow++) { // create date picker days
  7454. var daySettings = (beforeShowDay ?
  7455. beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
  7456. var otherMonth = (printDate.getMonth() != drawMonth);
  7457. var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
  7458. (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
  7459. tbody += '<td class="' +
  7460. ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends
  7461. (otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
  7462. ((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key
  7463. (defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ?
  7464. // or defaultDate is current printedDate and defaultDate is selectedDate
  7465. ' ' + this._dayOverClass : '') + // highlight selected day
  7466. (unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable days
  7467. (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
  7468. (printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day
  7469. (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
  7470. ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
  7471. (unselectable ? '' : ' onclick="DP_jQuery_' + dpuuid + '.datepicker._selectDay(\'#' +
  7472. inst.id + '\',' + printDate.getMonth() + ',' + printDate.getFullYear() + ', this);return false;"') + '>' + // actions
  7473. (otherMonth && !showOtherMonths ? '&#xa0;' : // display for other months
  7474. (unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' +
  7475. (printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +
  7476. (printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day
  7477. (otherMonth ? ' ui-priority-secondary' : '') + // distinguish dates from other months
  7478. '" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display selectable date
  7479. printDate.setDate(printDate.getDate() + 1);
  7480. printDate = this._daylightSavingAdjust(printDate);
  7481. }
  7482. calender += tbody + '</tr>';
  7483. }
  7484. drawMonth++;
  7485. if (drawMonth > 11) {
  7486. drawMonth = 0;
  7487. drawYear++;
  7488. }
  7489. calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
  7490. ((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
  7491. group += calender;
  7492. }
  7493. html += group;
  7494. }
  7495. html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
  7496. '<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : '');
  7497. inst._keyEvent = false;
  7498. return html;
  7499. },
  7500. /* Generate the month and year header. */
  7501. _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
  7502. secondary, monthNames, monthNamesShort) {
  7503. var changeMonth = this._get(inst, 'changeMonth');
  7504. var changeYear = this._get(inst, 'changeYear');
  7505. var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');
  7506. var html = '<div class="ui-datepicker-title">';
  7507. var monthHtml = '';
  7508. // month selection
  7509. if (secondary || !changeMonth)
  7510. monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span>';
  7511. else {
  7512. var inMinYear = (minDate && minDate.getFullYear() == drawYear);
  7513. var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
  7514. monthHtml += '<select class="ui-datepicker-month" ' +
  7515. 'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' +
  7516. 'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
  7517. '>';
  7518. for (var month = 0; month < 12; month++) {
  7519. if ((!inMinYear || month >= minDate.getMonth()) &&
  7520. (!inMaxYear || month <= maxDate.getMonth()))
  7521. monthHtml += '<option value="' + month + '"' +
  7522. (month == drawMonth ? ' selected="selected"' : '') +
  7523. '>' + monthNamesShort[month] + '</option>';
  7524. }
  7525. monthHtml += '</select>';
  7526. }
  7527. if (!showMonthAfterYear)
  7528. html += monthHtml + (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '');
  7529. // year selection
  7530. inst.yearshtml = '';
  7531. if (secondary || !changeYear)
  7532. html += '<span class="ui-datepicker-year">' + drawYear + '</span>';
  7533. else {
  7534. // determine range of years to display
  7535. var years = this._get(inst, 'yearRange').split(':');
  7536. var thisYear = new Date().getFullYear();
  7537. var determineYear = function(value) {
  7538. var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) :
  7539. (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) :
  7540. parseInt(value, 10)));
  7541. return (isNaN(year) ? thisYear : year);
  7542. };
  7543. var year = determineYear(years[0]);
  7544. var endYear = Math.max(year, determineYear(years[1] || ''));
  7545. year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
  7546. endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
  7547. inst.yearshtml += '<select class="ui-datepicker-year" ' +
  7548. 'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
  7549. 'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
  7550. '>';
  7551. for (; year <= endYear; year++) {
  7552. inst.yearshtml += '<option value="' + year + '"' +
  7553. (year == drawYear ? ' selected="selected"' : '') +
  7554. '>' + year + '</option>';
  7555. }
  7556. inst.yearshtml += '</select>';
  7557. //when showing there is no need for later update
  7558. if( ! $.browser.mozilla ){
  7559. html += inst.yearshtml;
  7560. inst.yearshtml = null;
  7561. } else {
  7562. // will be replaced later with inst.yearshtml
  7563. html += '<select class="ui-datepicker-year"><option value="' + drawYear + '" selected="selected">' + drawYear + '</option></select>';
  7564. }
  7565. }
  7566. html += this._get(inst, 'yearSuffix');
  7567. if (showMonthAfterYear)
  7568. html += (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '') + monthHtml;
  7569. html += '</div>'; // Close datepicker_header
  7570. return html;
  7571. },
  7572. /* Adjust one of the date sub-fields. */
  7573. _adjustInstDate: function(inst, offset, period) {
  7574. var year = inst.drawYear + (period == 'Y' ? offset : 0);
  7575. var month = inst.drawMonth + (period == 'M' ? offset : 0);
  7576. var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
  7577. (period == 'D' ? offset : 0);
  7578. var date = this._restrictMinMax(inst,
  7579. this._daylightSavingAdjust(new Date(year, month, day)));
  7580. inst.selectedDay = date.getDate();
  7581. inst.drawMonth = inst.selectedMonth = date.getMonth();
  7582. inst.drawYear = inst.selectedYear = date.getFullYear();
  7583. if (period == 'M' || period == 'Y')
  7584. this._notifyChange(inst);
  7585. },
  7586. /* Ensure a date is within any min/max bounds. */
  7587. _restrictMinMax: function(inst, date) {
  7588. var minDate = this._getMinMaxDate(inst, 'min');
  7589. var maxDate = this._getMinMaxDate(inst, 'max');
  7590. var newDate = (minDate && date < minDate ? minDate : date);
  7591. newDate = (maxDate && newDate > maxDate ? maxDate : newDate);
  7592. return newDate;
  7593. },
  7594. /* Notify change of month/year. */
  7595. _notifyChange: function(inst) {
  7596. var onChange = this._get(inst, 'onChangeMonthYear');
  7597. if (onChange)
  7598. onChange.apply((inst.input ? inst.input[0] : null),
  7599. [inst.selectedYear, inst.selectedMonth + 1, inst]);
  7600. },
  7601. /* Determine the number of months to show. */
  7602. _getNumberOfMonths: function(inst) {
  7603. var numMonths = this._get(inst, 'numberOfMonths');
  7604. return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
  7605. },
  7606. /* Determine the current maximum date - ensure no time components are set. */
  7607. _getMinMaxDate: function(inst, minMax) {
  7608. return this._determineDate(inst, this._get(inst, minMax + 'Date'), null);
  7609. },
  7610. /* Find the number of days in a given month. */
  7611. _getDaysInMonth: function(year, month) {
  7612. return 32 - new Date(year, month, 32).getDate();
  7613. },
  7614. /* Find the day of the week of the first of a month. */
  7615. _getFirstDayOfMonth: function(year, month) {
  7616. return new Date(year, month, 1).getDay();
  7617. },
  7618. /* Determines if we should allow a "next/prev" month display change. */
  7619. _canAdjustMonth: function(inst, offset, curYear, curMonth) {
  7620. var numMonths = this._getNumberOfMonths(inst);
  7621. var date = this._daylightSavingAdjust(new Date(curYear,
  7622. curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
  7623. if (offset < 0)
  7624. date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
  7625. return this._isInRange(inst, date);
  7626. },
  7627. /* Is the given date in the accepted range? */
  7628. _isInRange: function(inst, date) {
  7629. var minDate = this._getMinMaxDate(inst, 'min');
  7630. var maxDate = this._getMinMaxDate(inst, 'max');
  7631. return ((!minDate || date.getTime() >= minDate.getTime()) &&
  7632. (!maxDate || date.getTime() <= maxDate.getTime()));
  7633. },
  7634. /* Provide the configuration settings for formatting/parsing. */
  7635. _getFormatConfig: function(inst) {
  7636. var shortYearCutoff = this._get(inst, 'shortYearCutoff');
  7637. shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
  7638. new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
  7639. return {shortYearCutoff: shortYearCutoff,
  7640. dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
  7641. monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
  7642. },
  7643. /* Format the given date for display. */
  7644. _formatDate: function(inst, day, month, year) {
  7645. if (!day) {
  7646. inst.currentDay = inst.selectedDay;
  7647. inst.currentMonth = inst.selectedMonth;
  7648. inst.currentYear = inst.selectedYear;
  7649. }
  7650. var date = (day ? (typeof day == 'object' ? day :
  7651. this._daylightSavingAdjust(new Date(year, month, day))) :
  7652. this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
  7653. return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
  7654. }
  7655. });
  7656. /* jQuery extend now ignores nulls! */
  7657. function extendRemove(target, props) {
  7658. $.extend(target, props);
  7659. for (var name in props)
  7660. if (props[name] == null || props[name] == undefined)
  7661. target[name] = props[name];
  7662. return target;
  7663. };
  7664. /* Determine whether an object is an array. */
  7665. function isArray(a) {
  7666. return (a && (($.browser.safari && typeof a == 'object' && a.length) ||
  7667. (a.constructor && a.constructor.toString().match(/\Array\(\)/))));
  7668. };
  7669. /* Invoke the datepicker functionality.
  7670. @param options string - a command, optionally followed by additional parameters or
  7671. Object - settings for attaching new datepicker functionality
  7672. @return jQuery object */
  7673. $.fn.datepicker = function(options){
  7674. /* Initialise the date picker. */
  7675. if (!$.datepicker.initialized) {
  7676. $(document).mousedown($.datepicker._checkExternalClick).
  7677. find('body').append($.datepicker.dpDiv);
  7678. $.datepicker.initialized = true;
  7679. }
  7680. var otherArgs = Array.prototype.slice.call(arguments, 1);
  7681. if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget'))
  7682. return $.datepicker['_' + options + 'Datepicker'].
  7683. apply($.datepicker, [this[0]].concat(otherArgs));
  7684. if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
  7685. return $.datepicker['_' + options + 'Datepicker'].
  7686. apply($.datepicker, [this[0]].concat(otherArgs));
  7687. return this.each(function() {
  7688. typeof options == 'string' ?
  7689. $.datepicker['_' + options + 'Datepicker'].
  7690. apply($.datepicker, [this].concat(otherArgs)) :
  7691. $.datepicker._attachDatepicker(this, options);
  7692. });
  7693. };
  7694. $.datepicker = new Datepicker(); // singleton instance
  7695. $.datepicker.initialized = false;
  7696. $.datepicker.uuid = new Date().getTime();
  7697. $.datepicker.version = "1.8.7";
  7698. // Workaround for #4055
  7699. // Add another global to avoid noConflict issues with inline event handlers
  7700. window['DP_jQuery_' + dpuuid] = $;
  7701. })(jQuery);
  7702. /*
  7703. * Note: While Microsoft is not the author of this file, Microsoft is
  7704. * offering you a license subject to the terms of the Microsoft Software
  7705. * License Terms for Microsoft ASP.NET Model View Controller 3.
  7706. * Microsoft reserves all other rights. The notices below are provided
  7707. * for informational purposes only and are not the license terms under
  7708. * which Microsoft distributed this file.
  7709. *
  7710. * jQuery UI Dialog 1.8.7
  7711. *
  7712. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  7713. *
  7714. * http://docs.jquery.com/UI/Dialog
  7715. *
  7716. * Depends:
  7717. * jquery.ui.core.js
  7718. * jquery.ui.widget.js
  7719. * jquery.ui.button.js
  7720. * jquery.ui.draggable.js
  7721. * jquery.ui.mouse.js
  7722. * jquery.ui.position.js
  7723. * jquery.ui.resizable.js
  7724. */
  7725. (function( $, undefined ) {
  7726. var uiDialogClasses =
  7727. 'ui-dialog ' +
  7728. 'ui-widget ' +
  7729. 'ui-widget-content ' +
  7730. 'ui-corner-all ',
  7731. sizeRelatedOptions = {
  7732. buttons: true,
  7733. height: true,
  7734. maxHeight: true,
  7735. maxWidth: true,
  7736. minHeight: true,
  7737. minWidth: true,
  7738. width: true
  7739. },
  7740. resizableRelatedOptions = {
  7741. maxHeight: true,
  7742. maxWidth: true,
  7743. minHeight: true,
  7744. minWidth: true
  7745. };
  7746. $.widget("ui.dialog", {
  7747. options: {
  7748. autoOpen: true,
  7749. buttons: {},
  7750. closeOnEscape: true,
  7751. closeText: 'close',
  7752. dialogClass: '',
  7753. draggable: true,
  7754. hide: null,
  7755. height: 'auto',
  7756. maxHeight: false,
  7757. maxWidth: false,
  7758. minHeight: 150,
  7759. minWidth: 150,
  7760. modal: false,
  7761. position: {
  7762. my: 'center',
  7763. at: 'center',
  7764. collision: 'fit',
  7765. // ensure that the titlebar is never outside the document
  7766. using: function(pos) {
  7767. var topOffset = $(this).css(pos).offset().top;
  7768. if (topOffset < 0) {
  7769. $(this).css('top', pos.top - topOffset);
  7770. }
  7771. }
  7772. },
  7773. resizable: true,
  7774. show: null,
  7775. stack: true,
  7776. title: '',
  7777. width: 300,
  7778. zIndex: 1000
  7779. },
  7780. _create: function() {
  7781. this.originalTitle = this.element.attr('title');
  7782. // #5742 - .attr() might return a DOMElement
  7783. if ( typeof this.originalTitle !== "string" ) {
  7784. this.originalTitle = "";
  7785. }
  7786. this.options.title = this.options.title || this.originalTitle;
  7787. var self = this,
  7788. options = self.options,
  7789. title = options.title || '&#160;',
  7790. titleId = $.ui.dialog.getTitleId(self.element),
  7791. uiDialog = (self.uiDialog = $('<div></div>'))
  7792. .appendTo(document.body)
  7793. .hide()
  7794. .addClass(uiDialogClasses + options.dialogClass)
  7795. .css({
  7796. zIndex: options.zIndex
  7797. })
  7798. // setting tabIndex makes the div focusable
  7799. // setting outline to 0 prevents a border on focus in Mozilla
  7800. .attr('tabIndex', -1).css('outline', 0).keydown(function(event) {
  7801. if (options.closeOnEscape && event.keyCode &&
  7802. event.keyCode === $.ui.keyCode.ESCAPE) {
  7803. self.close(event);
  7804. event.preventDefault();
  7805. }
  7806. })
  7807. .attr({
  7808. role: 'dialog',
  7809. 'aria-labelledby': titleId
  7810. })
  7811. .mousedown(function(event) {
  7812. self.moveToTop(false, event);
  7813. }),
  7814. uiDialogContent = self.element
  7815. .show()
  7816. .removeAttr('title')
  7817. .addClass(
  7818. 'ui-dialog-content ' +
  7819. 'ui-widget-content')
  7820. .appendTo(uiDialog),
  7821. uiDialogTitlebar = (self.uiDialogTitlebar = $('<div></div>'))
  7822. .addClass(
  7823. 'ui-dialog-titlebar ' +
  7824. 'ui-widget-header ' +
  7825. 'ui-corner-all ' +
  7826. 'ui-helper-clearfix'
  7827. )
  7828. .prependTo(uiDialog),
  7829. uiDialogTitlebarClose = $('<a href="#"></a>')
  7830. .addClass(
  7831. 'ui-dialog-titlebar-close ' +
  7832. 'ui-corner-all'
  7833. )
  7834. .attr('role', 'button')
  7835. .hover(
  7836. function() {
  7837. uiDialogTitlebarClose.addClass('ui-state-hover');
  7838. },
  7839. function() {
  7840. uiDialogTitlebarClose.removeClass('ui-state-hover');
  7841. }
  7842. )
  7843. .focus(function() {
  7844. uiDialogTitlebarClose.addClass('ui-state-focus');
  7845. })
  7846. .blur(function() {
  7847. uiDialogTitlebarClose.removeClass('ui-state-focus');
  7848. })
  7849. .click(function(event) {
  7850. self.close(event);
  7851. return false;
  7852. })
  7853. .appendTo(uiDialogTitlebar),
  7854. uiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $('<span></span>'))
  7855. .addClass(
  7856. 'ui-icon ' +
  7857. 'ui-icon-closethick'
  7858. )
  7859. .text(options.closeText)
  7860. .appendTo(uiDialogTitlebarClose),
  7861. uiDialogTitle = $('<span></span>')
  7862. .addClass('ui-dialog-title')
  7863. .attr('id', titleId)
  7864. .html(title)
  7865. .prependTo(uiDialogTitlebar);
  7866. //handling of deprecated beforeclose (vs beforeClose) option
  7867. //Ticket #4669 http://dev.jqueryui.com/ticket/4669
  7868. //TODO: remove in 1.9pre
  7869. if ($.isFunction(options.beforeclose) && !$.isFunction(options.beforeClose)) {
  7870. options.beforeClose = options.beforeclose;
  7871. }
  7872. uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
  7873. if (options.draggable && $.fn.draggable) {
  7874. self._makeDraggable();
  7875. }
  7876. if (options.resizable && $.fn.resizable) {
  7877. self._makeResizable();
  7878. }
  7879. self._createButtons(options.buttons);
  7880. self._isOpen = false;
  7881. if ($.fn.bgiframe) {
  7882. uiDialog.bgiframe();
  7883. }
  7884. },
  7885. _init: function() {
  7886. if ( this.options.autoOpen ) {
  7887. this.open();
  7888. }
  7889. },
  7890. destroy: function() {
  7891. var self = this;
  7892. if (self.overlay) {
  7893. self.overlay.destroy();
  7894. }
  7895. self.uiDialog.hide();
  7896. self.element
  7897. .unbind('.dialog')
  7898. .removeData('dialog')
  7899. .removeClass('ui-dialog-content ui-widget-content')
  7900. .hide().appendTo('body');
  7901. self.uiDialog.remove();
  7902. if (self.originalTitle) {
  7903. self.element.attr('title', self.originalTitle);
  7904. }
  7905. return self;
  7906. },
  7907. widget: function() {
  7908. return this.uiDialog;
  7909. },
  7910. close: function(event) {
  7911. var self = this,
  7912. maxZ, thisZ;
  7913. if (false === self._trigger('beforeClose', event)) {
  7914. return;
  7915. }
  7916. if (self.overlay) {
  7917. self.overlay.destroy();
  7918. }
  7919. self.uiDialog.unbind('keypress.ui-dialog');
  7920. self._isOpen = false;
  7921. if (self.options.hide) {
  7922. self.uiDialog.hide(self.options.hide, function() {
  7923. self._trigger('close', event);
  7924. });
  7925. } else {
  7926. self.uiDialog.hide();
  7927. self._trigger('close', event);
  7928. }
  7929. $.ui.dialog.overlay.resize();
  7930. // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
  7931. if (self.options.modal) {
  7932. maxZ = 0;
  7933. $('.ui-dialog').each(function() {
  7934. if (this !== self.uiDialog[0]) {
  7935. thisZ = $(this).css('z-index');
  7936. if(!isNaN(thisZ)) {
  7937. maxZ = Math.max(maxZ, thisZ);
  7938. }
  7939. }
  7940. });
  7941. $.ui.dialog.maxZ = maxZ;
  7942. }
  7943. return self;
  7944. },
  7945. isOpen: function() {
  7946. return this._isOpen;
  7947. },
  7948. // the force parameter allows us to move modal dialogs to their correct
  7949. // position on open
  7950. moveToTop: function(force, event) {
  7951. var self = this,
  7952. options = self.options,
  7953. saveScroll;
  7954. if ((options.modal && !force) ||
  7955. (!options.stack && !options.modal)) {
  7956. return self._trigger('focus', event);
  7957. }
  7958. if (options.zIndex > $.ui.dialog.maxZ) {
  7959. $.ui.dialog.maxZ = options.zIndex;
  7960. }
  7961. if (self.overlay) {
  7962. $.ui.dialog.maxZ += 1;
  7963. self.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ);
  7964. }
  7965. //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
  7966. // http://ui.jquery.com/bugs/ticket/3193
  7967. saveScroll = { scrollTop: self.element.attr('scrollTop'), scrollLeft: self.element.attr('scrollLeft') };
  7968. $.ui.dialog.maxZ += 1;
  7969. self.uiDialog.css('z-index', $.ui.dialog.maxZ);
  7970. self.element.attr(saveScroll);
  7971. self._trigger('focus', event);
  7972. return self;
  7973. },
  7974. open: function() {
  7975. if (this._isOpen) { return; }
  7976. var self = this,
  7977. options = self.options,
  7978. uiDialog = self.uiDialog;
  7979. self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null;
  7980. self._size();
  7981. self._position(options.position);
  7982. uiDialog.show(options.show);
  7983. self.moveToTop(true);
  7984. // prevent tabbing out of modal dialogs
  7985. if (options.modal) {
  7986. uiDialog.bind('keypress.ui-dialog', function(event) {
  7987. if (event.keyCode !== $.ui.keyCode.TAB) {
  7988. return;
  7989. }
  7990. var tabbables = $(':tabbable', this),
  7991. first = tabbables.filter(':first'),
  7992. last = tabbables.filter(':last');
  7993. if (event.target === last[0] && !event.shiftKey) {
  7994. first.focus(1);
  7995. return false;
  7996. } else if (event.target === first[0] && event.shiftKey) {
  7997. last.focus(1);
  7998. return false;
  7999. }
  8000. });
  8001. }
  8002. // set focus to the first tabbable element in the content area or the first button
  8003. // if there are no tabbable elements, set focus on the dialog itself
  8004. $(self.element.find(':tabbable').get().concat(
  8005. uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat(
  8006. uiDialog.get()))).eq(0).focus();
  8007. self._isOpen = true;
  8008. self._trigger('open');
  8009. return self;
  8010. },
  8011. _createButtons: function(buttons) {
  8012. var self = this,
  8013. hasButtons = false,
  8014. uiDialogButtonPane = $('<div></div>')
  8015. .addClass(
  8016. 'ui-dialog-buttonpane ' +
  8017. 'ui-widget-content ' +
  8018. 'ui-helper-clearfix'
  8019. ),
  8020. uiButtonSet = $( "<div></div>" )
  8021. .addClass( "ui-dialog-buttonset" )
  8022. .appendTo( uiDialogButtonPane );
  8023. // if we already have a button pane, remove it
  8024. self.uiDialog.find('.ui-dialog-buttonpane').remove();
  8025. if (typeof buttons === 'object' && buttons !== null) {
  8026. $.each(buttons, function() {
  8027. return !(hasButtons = true);
  8028. });
  8029. }
  8030. if (hasButtons) {
  8031. $.each(buttons, function(name, props) {
  8032. props = $.isFunction( props ) ?
  8033. { click: props, text: name } :
  8034. props;
  8035. var button = $('<button type="button"></button>')
  8036. .attr( props, true )
  8037. .unbind('click')
  8038. .click(function() {
  8039. props.click.apply(self.element[0], arguments);
  8040. })
  8041. .appendTo(uiButtonSet);
  8042. if ($.fn.button) {
  8043. button.button();
  8044. }
  8045. });
  8046. uiDialogButtonPane.appendTo(self.uiDialog);
  8047. }
  8048. },
  8049. _makeDraggable: function() {
  8050. var self = this,
  8051. options = self.options,
  8052. doc = $(document),
  8053. heightBeforeDrag;
  8054. function filteredUi(ui) {
  8055. return {
  8056. position: ui.position,
  8057. offset: ui.offset
  8058. };
  8059. }
  8060. self.uiDialog.draggable({
  8061. cancel: '.ui-dialog-content, .ui-dialog-titlebar-close',
  8062. handle: '.ui-dialog-titlebar',
  8063. containment: 'document',
  8064. start: function(event, ui) {
  8065. heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height();
  8066. $(this).height($(this).height()).addClass("ui-dialog-dragging");
  8067. self._trigger('dragStart', event, filteredUi(ui));
  8068. },
  8069. drag: function(event, ui) {
  8070. self._trigger('drag', event, filteredUi(ui));
  8071. },
  8072. stop: function(event, ui) {
  8073. options.position = [ui.position.left - doc.scrollLeft(),
  8074. ui.position.top - doc.scrollTop()];
  8075. $(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);
  8076. self._trigger('dragStop', event, filteredUi(ui));
  8077. $.ui.dialog.overlay.resize();
  8078. }
  8079. });
  8080. },
  8081. _makeResizable: function(handles) {
  8082. handles = (handles === undefined ? this.options.resizable : handles);
  8083. var self = this,
  8084. options = self.options,
  8085. // .ui-resizable has position: relative defined in the stylesheet
  8086. // but dialogs have to use absolute or fixed positioning
  8087. position = self.uiDialog.css('position'),
  8088. resizeHandles = (typeof handles === 'string' ?
  8089. handles :
  8090. 'n,e,s,w,se,sw,ne,nw'
  8091. );
  8092. function filteredUi(ui) {
  8093. return {
  8094. originalPosition: ui.originalPosition,
  8095. originalSize: ui.originalSize,
  8096. position: ui.position,
  8097. size: ui.size
  8098. };
  8099. }
  8100. self.uiDialog.resizable({
  8101. cancel: '.ui-dialog-content',
  8102. containment: 'document',
  8103. alsoResize: self.element,
  8104. maxWidth: options.maxWidth,
  8105. maxHeight: options.maxHeight,
  8106. minWidth: options.minWidth,
  8107. minHeight: self._minHeight(),
  8108. handles: resizeHandles,
  8109. start: function(event, ui) {
  8110. $(this).addClass("ui-dialog-resizing");
  8111. self._trigger('resizeStart', event, filteredUi(ui));
  8112. },
  8113. resize: function(event, ui) {
  8114. self._trigger('resize', event, filteredUi(ui));
  8115. },
  8116. stop: function(event, ui) {
  8117. $(this).removeClass("ui-dialog-resizing");
  8118. options.height = $(this).height();
  8119. options.width = $(this).width();
  8120. self._trigger('resizeStop', event, filteredUi(ui));
  8121. $.ui.dialog.overlay.resize();
  8122. }
  8123. })
  8124. .css('position', position)
  8125. .find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');
  8126. },
  8127. _minHeight: function() {
  8128. var options = this.options;
  8129. if (options.height === 'auto') {
  8130. return options.minHeight;
  8131. } else {
  8132. return Math.min(options.minHeight, options.height);
  8133. }
  8134. },
  8135. _position: function(position) {
  8136. var myAt = [],
  8137. offset = [0, 0],
  8138. isVisible;
  8139. if (position) {
  8140. // deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
  8141. // if (typeof position == 'string' || $.isArray(position)) {
  8142. // myAt = $.isArray(position) ? position : position.split(' ');
  8143. if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) {
  8144. myAt = position.split ? position.split(' ') : [position[0], position[1]];
  8145. if (myAt.length === 1) {
  8146. myAt[1] = myAt[0];
  8147. }
  8148. $.each(['left', 'top'], function(i, offsetPosition) {
  8149. if (+myAt[i] === myAt[i]) {
  8150. offset[i] = myAt[i];
  8151. myAt[i] = offsetPosition;
  8152. }
  8153. });
  8154. position = {
  8155. my: myAt.join(" "),
  8156. at: myAt.join(" "),
  8157. offset: offset.join(" ")
  8158. };
  8159. }
  8160. position = $.extend({}, $.ui.dialog.prototype.options.position, position);
  8161. } else {
  8162. position = $.ui.dialog.prototype.options.position;
  8163. }
  8164. // need to show the dialog to get the actual offset in the position plugin
  8165. isVisible = this.uiDialog.is(':visible');
  8166. if (!isVisible) {
  8167. this.uiDialog.show();
  8168. }
  8169. this.uiDialog
  8170. // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
  8171. .css({ top: 0, left: 0 })
  8172. .position($.extend({ of: window }, position));
  8173. if (!isVisible) {
  8174. this.uiDialog.hide();
  8175. }
  8176. },
  8177. _setOptions: function( options ) {
  8178. var self = this,
  8179. resizableOptions = {},
  8180. resize = false;
  8181. $.each( options, function( key, value ) {
  8182. self._setOption( key, value );
  8183. if ( key in sizeRelatedOptions ) {
  8184. resize = true;
  8185. }
  8186. if ( key in resizableRelatedOptions ) {
  8187. resizableOptions[ key ] = value;
  8188. }
  8189. });
  8190. if ( resize ) {
  8191. this._size();
  8192. }
  8193. if ( this.uiDialog.is( ":data(resizable)" ) ) {
  8194. this.uiDialog.resizable( "option", resizableOptions );
  8195. }
  8196. },
  8197. _setOption: function(key, value){
  8198. var self = this,
  8199. uiDialog = self.uiDialog;
  8200. switch (key) {
  8201. //handling of deprecated beforeclose (vs beforeClose) option
  8202. //Ticket #4669 http://dev.jqueryui.com/ticket/4669
  8203. //TODO: remove in 1.9pre
  8204. case "beforeclose":
  8205. key = "beforeClose";
  8206. break;
  8207. case "buttons":
  8208. self._createButtons(value);
  8209. break;
  8210. case "closeText":
  8211. // ensure that we always pass a string
  8212. self.uiDialogTitlebarCloseText.text("" + value);
  8213. break;
  8214. case "dialogClass":
  8215. uiDialog
  8216. .removeClass(self.options.dialogClass)
  8217. .addClass(uiDialogClasses + value);
  8218. break;
  8219. case "disabled":
  8220. if (value) {
  8221. uiDialog.addClass('ui-dialog-disabled');
  8222. } else {
  8223. uiDialog.removeClass('ui-dialog-disabled');
  8224. }
  8225. break;
  8226. case "draggable":
  8227. var isDraggable = uiDialog.is( ":data(draggable)" );
  8228. if ( isDraggable && !value ) {
  8229. uiDialog.draggable( "destroy" );
  8230. }
  8231. if ( !isDraggable && value ) {
  8232. self._makeDraggable();
  8233. }
  8234. break;
  8235. case "position":
  8236. self._position(value);
  8237. break;
  8238. case "resizable":
  8239. // currently resizable, becoming non-resizable
  8240. var isResizable = uiDialog.is( ":data(resizable)" );
  8241. if (isResizable && !value) {
  8242. uiDialog.resizable('destroy');
  8243. }
  8244. // currently resizable, changing handles
  8245. if (isResizable && typeof value === 'string') {
  8246. uiDialog.resizable('option', 'handles', value);
  8247. }
  8248. // currently non-resizable, becoming resizable
  8249. if (!isResizable && value !== false) {
  8250. self._makeResizable(value);
  8251. }
  8252. break;
  8253. case "title":
  8254. // convert whatever was passed in o a string, for html() to not throw up
  8255. $(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || '&#160;'));
  8256. break;
  8257. }
  8258. $.Widget.prototype._setOption.apply(self, arguments);
  8259. },
  8260. _size: function() {
  8261. /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
  8262. * divs will both have width and height set, so we need to reset them
  8263. */
  8264. var options = this.options,
  8265. nonContentHeight,
  8266. minContentHeight,
  8267. isVisible = this.uiDialog.is( ":visible" );
  8268. // reset content sizing
  8269. this.element.show().css({
  8270. width: 'auto',
  8271. minHeight: 0,
  8272. height: 0
  8273. });
  8274. if (options.minWidth > options.width) {
  8275. options.width = options.minWidth;
  8276. }
  8277. // reset wrapper sizing
  8278. // determine the height of all the non-content elements
  8279. nonContentHeight = this.uiDialog.css({
  8280. height: 'auto',
  8281. width: options.width
  8282. })
  8283. .height();
  8284. minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
  8285. if ( options.height === "auto" ) {
  8286. // only needed for IE6 support
  8287. if ( $.support.minHeight ) {
  8288. this.element.css({
  8289. minHeight: minContentHeight,
  8290. height: "auto"
  8291. });
  8292. } else {
  8293. this.uiDialog.show();
  8294. var autoHeight = this.element.css( "height", "auto" ).height();
  8295. if ( !isVisible ) {
  8296. this.uiDialog.hide();
  8297. }
  8298. this.element.height( Math.max( autoHeight, minContentHeight ) );
  8299. }
  8300. } else {
  8301. this.element.height( Math.max( options.height - nonContentHeight, 0 ) );
  8302. }
  8303. if (this.uiDialog.is(':data(resizable)')) {
  8304. this.uiDialog.resizable('option', 'minHeight', this._minHeight());
  8305. }
  8306. }
  8307. });
  8308. $.extend($.ui.dialog, {
  8309. version: "1.8.7",
  8310. uuid: 0,
  8311. maxZ: 0,
  8312. getTitleId: function($el) {
  8313. var id = $el.attr('id');
  8314. if (!id) {
  8315. this.uuid += 1;
  8316. id = this.uuid;
  8317. }
  8318. return 'ui-dialog-title-' + id;
  8319. },
  8320. overlay: function(dialog) {
  8321. this.$el = $.ui.dialog.overlay.create(dialog);
  8322. }
  8323. });
  8324. $.extend($.ui.dialog.overlay, {
  8325. instances: [],
  8326. // reuse old instances due to IE memory leak with alpha transparency (see #5185)
  8327. oldInstances: [],
  8328. maxZ: 0,
  8329. events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
  8330. function(event) { return event + '.dialog-overlay'; }).join(' '),
  8331. create: function(dialog) {
  8332. if (this.instances.length === 0) {
  8333. // prevent use of anchors and inputs
  8334. // we use a setTimeout in case the overlay is created from an
  8335. // event that we're going to be cancelling (see #2804)
  8336. setTimeout(function() {
  8337. // handle $(el).dialog().dialog('close') (see #4065)
  8338. if ($.ui.dialog.overlay.instances.length) {
  8339. $(document).bind($.ui.dialog.overlay.events, function(event) {
  8340. // stop events if the z-index of the target is < the z-index of the overlay
  8341. // we cannot return true when we don't want to cancel the event (#3523)
  8342. if ($(event.target).zIndex() < $.ui.dialog.overlay.maxZ) {
  8343. return false;
  8344. }
  8345. });
  8346. }
  8347. }, 1);
  8348. // allow closing by pressing the escape key
  8349. $(document).bind('keydown.dialog-overlay', function(event) {
  8350. if (dialog.options.closeOnEscape && event.keyCode &&
  8351. event.keyCode === $.ui.keyCode.ESCAPE) {
  8352. dialog.close(event);
  8353. event.preventDefault();
  8354. }
  8355. });
  8356. // handle window resize
  8357. $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
  8358. }
  8359. var $el = (this.oldInstances.pop() || $('<div></div>').addClass('ui-widget-overlay'))
  8360. .appendTo(document.body)
  8361. .css({
  8362. width: this.width(),
  8363. height: this.height()
  8364. });
  8365. if ($.fn.bgiframe) {
  8366. $el.bgiframe();
  8367. }
  8368. this.instances.push($el);
  8369. return $el;
  8370. },
  8371. destroy: function($el) {
  8372. var indexOf = $.inArray($el, this.instances);
  8373. if (indexOf != -1){
  8374. this.oldInstances.push(this.instances.splice(indexOf, 1)[0]);
  8375. }
  8376. if (this.instances.length === 0) {
  8377. $([document, window]).unbind('.dialog-overlay');
  8378. }
  8379. $el.remove();
  8380. // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
  8381. var maxZ = 0;
  8382. $.each(this.instances, function() {
  8383. maxZ = Math.max(maxZ, this.css('z-index'));
  8384. });
  8385. this.maxZ = maxZ;
  8386. },
  8387. height: function() {
  8388. var scrollHeight,
  8389. offsetHeight;
  8390. // handle IE 6
  8391. if ($.browser.msie && $.browser.version < 7) {
  8392. scrollHeight = Math.max(
  8393. document.documentElement.scrollHeight,
  8394. document.body.scrollHeight
  8395. );
  8396. offsetHeight = Math.max(
  8397. document.documentElement.offsetHeight,
  8398. document.body.offsetHeight
  8399. );
  8400. if (scrollHeight < offsetHeight) {
  8401. return $(window).height() + 'px';
  8402. } else {
  8403. return scrollHeight + 'px';
  8404. }
  8405. // handle "good" browsers
  8406. } else {
  8407. return $(document).height() + 'px';
  8408. }
  8409. },
  8410. width: function() {
  8411. var scrollWidth,
  8412. offsetWidth;
  8413. // handle IE 6
  8414. if ($.browser.msie && $.browser.version < 7) {
  8415. scrollWidth = Math.max(
  8416. document.documentElement.scrollWidth,
  8417. document.body.scrollWidth
  8418. );
  8419. offsetWidth = Math.max(
  8420. document.documentElement.offsetWidth,
  8421. document.body.offsetWidth
  8422. );
  8423. if (scrollWidth < offsetWidth) {
  8424. return $(window).width() + 'px';
  8425. } else {
  8426. return scrollWidth + 'px';
  8427. }
  8428. // handle "good" browsers
  8429. } else {
  8430. return $(document).width() + 'px';
  8431. }
  8432. },
  8433. resize: function() {
  8434. /* If the dialog is draggable and the user drags it past the
  8435. * right edge of the window, the document becomes wider so we
  8436. * need to stretch the overlay. If the user then drags the
  8437. * dialog back to the left, the document will become narrower,
  8438. * so we need to shrink the overlay to the appropriate size.
  8439. * This is handled by shrinking the overlay before setting it
  8440. * to the full document size.
  8441. */
  8442. var $overlays = $([]);
  8443. $.each($.ui.dialog.overlay.instances, function() {
  8444. $overlays = $overlays.add(this);
  8445. });
  8446. $overlays.css({
  8447. width: 0,
  8448. height: 0
  8449. }).css({
  8450. width: $.ui.dialog.overlay.width(),
  8451. height: $.ui.dialog.overlay.height()
  8452. });
  8453. }
  8454. });
  8455. $.extend($.ui.dialog.overlay.prototype, {
  8456. destroy: function() {
  8457. $.ui.dialog.overlay.destroy(this.$el);
  8458. }
  8459. });
  8460. }(jQuery));
  8461. /*
  8462. * Note: While Microsoft is not the author of this file, Microsoft is
  8463. * offering you a license subject to the terms of the Microsoft Software
  8464. * License Terms for Microsoft ASP.NET Model View Controller 3.
  8465. * Microsoft reserves all other rights. The notices below are provided
  8466. * for informational purposes only and are not the license terms under
  8467. * which Microsoft distributed this file.
  8468. *
  8469. * jQuery UI Position 1.8.7
  8470. *
  8471. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  8472. *
  8473. * http://docs.jquery.com/UI/Position
  8474. */
  8475. (function( $, undefined ) {
  8476. $.ui = $.ui || {};
  8477. var horizontalPositions = /left|center|right/,
  8478. verticalPositions = /top|center|bottom/,
  8479. center = "center",
  8480. _position = $.fn.position,
  8481. _offset = $.fn.offset;
  8482. $.fn.position = function( options ) {
  8483. if ( !options || !options.of ) {
  8484. return _position.apply( this, arguments );
  8485. }
  8486. // make a copy, we don't want to modify arguments
  8487. options = $.extend( {}, options );
  8488. var target = $( options.of ),
  8489. targetElem = target[0],
  8490. collision = ( options.collision || "flip" ).split( " " ),
  8491. offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
  8492. targetWidth,
  8493. targetHeight,
  8494. basePosition;
  8495. if ( targetElem.nodeType === 9 ) {
  8496. targetWidth = target.width();
  8497. targetHeight = target.height();
  8498. basePosition = { top: 0, left: 0 };
  8499. // TODO: use $.isWindow() in 1.9
  8500. } else if ( targetElem.setTimeout ) {
  8501. targetWidth = target.width();
  8502. targetHeight = target.height();
  8503. basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
  8504. } else if ( targetElem.preventDefault ) {
  8505. // force left top to allow flipping
  8506. options.at = "left top";
  8507. targetWidth = targetHeight = 0;
  8508. basePosition = { top: options.of.pageY, left: options.of.pageX };
  8509. } else {
  8510. targetWidth = target.outerWidth();
  8511. targetHeight = target.outerHeight();
  8512. basePosition = target.offset();
  8513. }
  8514. // force my and at to have valid horizontal and veritcal positions
  8515. // if a value is missing or invalid, it will be converted to center
  8516. $.each( [ "my", "at" ], function() {
  8517. var pos = ( options[this] || "" ).split( " " );
  8518. if ( pos.length === 1) {
  8519. pos = horizontalPositions.test( pos[0] ) ?
  8520. pos.concat( [center] ) :
  8521. verticalPositions.test( pos[0] ) ?
  8522. [ center ].concat( pos ) :
  8523. [ center, center ];
  8524. }
  8525. pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center;
  8526. pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center;
  8527. options[ this ] = pos;
  8528. });
  8529. // normalize collision option
  8530. if ( collision.length === 1 ) {
  8531. collision[ 1 ] = collision[ 0 ];
  8532. }
  8533. // normalize offset option
  8534. offset[ 0 ] = parseInt( offset[0], 10 ) || 0;
  8535. if ( offset.length === 1 ) {
  8536. offset[ 1 ] = offset[ 0 ];
  8537. }
  8538. offset[ 1 ] = parseInt( offset[1], 10 ) || 0;
  8539. if ( options.at[0] === "right" ) {
  8540. basePosition.left += targetWidth;
  8541. } else if (options.at[0] === center ) {
  8542. basePosition.left += targetWidth / 2;
  8543. }
  8544. if ( options.at[1] === "bottom" ) {
  8545. basePosition.top += targetHeight;
  8546. } else if ( options.at[1] === center ) {
  8547. basePosition.top += targetHeight / 2;
  8548. }
  8549. basePosition.left += offset[ 0 ];
  8550. basePosition.top += offset[ 1 ];
  8551. return this.each(function() {
  8552. var elem = $( this ),
  8553. elemWidth = elem.outerWidth(),
  8554. elemHeight = elem.outerHeight(),
  8555. marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0,
  8556. marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0,
  8557. collisionWidth = elemWidth + marginLeft +
  8558. parseInt( $.curCSS( this, "marginRight", true ) ) || 0,
  8559. collisionHeight = elemHeight + marginTop +
  8560. parseInt( $.curCSS( this, "marginBottom", true ) ) || 0,
  8561. position = $.extend( {}, basePosition ),
  8562. collisionPosition;
  8563. if ( options.my[0] === "right" ) {
  8564. position.left -= elemWidth;
  8565. } else if ( options.my[0] === center ) {
  8566. position.left -= elemWidth / 2;
  8567. }
  8568. if ( options.my[1] === "bottom" ) {
  8569. position.top -= elemHeight;
  8570. } else if ( options.my[1] === center ) {
  8571. position.top -= elemHeight / 2;
  8572. }
  8573. // prevent fractions (see #5280)
  8574. position.left = Math.round( position.left );
  8575. position.top = Math.round( position.top );
  8576. collisionPosition = {
  8577. left: position.left - marginLeft,
  8578. top: position.top - marginTop
  8579. };
  8580. $.each( [ "left", "top" ], function( i, dir ) {
  8581. if ( $.ui.position[ collision[i] ] ) {
  8582. $.ui.position[ collision[i] ][ dir ]( position, {
  8583. targetWidth: targetWidth,
  8584. targetHeight: targetHeight,
  8585. elemWidth: elemWidth,
  8586. elemHeight: elemHeight,
  8587. collisionPosition: collisionPosition,
  8588. collisionWidth: collisionWidth,
  8589. collisionHeight: collisionHeight,
  8590. offset: offset,
  8591. my: options.my,
  8592. at: options.at
  8593. });
  8594. }
  8595. });
  8596. if ( $.fn.bgiframe ) {
  8597. elem.bgiframe();
  8598. }
  8599. elem.offset( $.extend( position, { using: options.using } ) );
  8600. });
  8601. };
  8602. $.ui.position = {
  8603. fit: {
  8604. left: function( position, data ) {
  8605. var win = $( window ),
  8606. over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft();
  8607. position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left );
  8608. },
  8609. top: function( position, data ) {
  8610. var win = $( window ),
  8611. over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop();
  8612. position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top );
  8613. }
  8614. },
  8615. flip: {
  8616. left: function( position, data ) {
  8617. if ( data.at[0] === center ) {
  8618. return;
  8619. }
  8620. var win = $( window ),
  8621. over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(),
  8622. myOffset = data.my[ 0 ] === "left" ?
  8623. -data.elemWidth :
  8624. data.my[ 0 ] === "right" ?
  8625. data.elemWidth :
  8626. 0,
  8627. atOffset = data.at[ 0 ] === "left" ?
  8628. data.targetWidth :
  8629. -data.targetWidth,
  8630. offset = -2 * data.offset[ 0 ];
  8631. position.left += data.collisionPosition.left < 0 ?
  8632. myOffset + atOffset + offset :
  8633. over > 0 ?
  8634. myOffset + atOffset + offset :
  8635. 0;
  8636. },
  8637. top: function( position, data ) {
  8638. if ( data.at[1] === center ) {
  8639. return;
  8640. }
  8641. var win = $( window ),
  8642. over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(),
  8643. myOffset = data.my[ 1 ] === "top" ?
  8644. -data.elemHeight :
  8645. data.my[ 1 ] === "bottom" ?
  8646. data.elemHeight :
  8647. 0,
  8648. atOffset = data.at[ 1 ] === "top" ?
  8649. data.targetHeight :
  8650. -data.targetHeight,
  8651. offset = -2 * data.offset[ 1 ];
  8652. position.top += data.collisionPosition.top < 0 ?
  8653. myOffset + atOffset + offset :
  8654. over > 0 ?
  8655. myOffset + atOffset + offset :
  8656. 0;
  8657. }
  8658. }
  8659. };
  8660. // offset setter from jQuery 1.4
  8661. if ( !$.offset.setOffset ) {
  8662. $.offset.setOffset = function( elem, options ) {
  8663. // set position first, in-case top/left are set even on static elem
  8664. if ( /static/.test( $.curCSS( elem, "position" ) ) ) {
  8665. elem.style.position = "relative";
  8666. }
  8667. var curElem = $( elem ),
  8668. curOffset = curElem.offset(),
  8669. curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0,
  8670. curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0,
  8671. props = {
  8672. top: (options.top - curOffset.top) + curTop,
  8673. left: (options.left - curOffset.left) + curLeft
  8674. };
  8675. if ( 'using' in options ) {
  8676. options.using.call( elem, props );
  8677. } else {
  8678. curElem.css( props );
  8679. }
  8680. };
  8681. $.fn.offset = function( options ) {
  8682. var elem = this[ 0 ];
  8683. if ( !elem || !elem.ownerDocument ) { return null; }
  8684. if ( options ) {
  8685. return this.each(function() {
  8686. $.offset.setOffset( this, options );
  8687. });
  8688. }
  8689. return _offset.call( this );
  8690. };
  8691. }
  8692. }( jQuery ));
  8693. /*
  8694. * Note: While Microsoft is not the author of this file, Microsoft is
  8695. * offering you a license subject to the terms of the Microsoft Software
  8696. * License Terms for Microsoft ASP.NET Model View Controller 3.
  8697. * Microsoft reserves all other rights. The notices below are provided
  8698. * for informational purposes only and are not the license terms under
  8699. * which Microsoft distributed this file.
  8700. *
  8701. * jQuery UI Progressbar 1.8.7
  8702. *
  8703. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  8704. *
  8705. * http://docs.jquery.com/UI/Progressbar
  8706. *
  8707. * Depends:
  8708. * jquery.ui.core.js
  8709. * jquery.ui.widget.js
  8710. */
  8711. (function( $, undefined ) {
  8712. $.widget( "ui.progressbar", {
  8713. options: {
  8714. value: 0,
  8715. max: 100
  8716. },
  8717. min: 0,
  8718. _create: function() {
  8719. this.element
  8720. .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
  8721. .attr({
  8722. role: "progressbar",
  8723. "aria-valuemin": this.min,
  8724. "aria-valuemax": this.options.max,
  8725. "aria-valuenow": this._value()
  8726. });
  8727. this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
  8728. .appendTo( this.element );
  8729. this.oldValue = this._value();
  8730. this._refreshValue();
  8731. },
  8732. destroy: function() {
  8733. this.element
  8734. .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
  8735. .removeAttr( "role" )
  8736. .removeAttr( "aria-valuemin" )
  8737. .removeAttr( "aria-valuemax" )
  8738. .removeAttr( "aria-valuenow" );
  8739. this.valueDiv.remove();
  8740. $.Widget.prototype.destroy.apply( this, arguments );
  8741. },
  8742. value: function( newValue ) {
  8743. if ( newValue === undefined ) {
  8744. return this._value();
  8745. }
  8746. this._setOption( "value", newValue );
  8747. return this;
  8748. },
  8749. _setOption: function( key, value ) {
  8750. if ( key === "value" ) {
  8751. this.options.value = value;
  8752. this._refreshValue();
  8753. if ( this._value() === this.options.max ) {
  8754. this._trigger( "complete" );
  8755. }
  8756. }
  8757. $.Widget.prototype._setOption.apply( this, arguments );
  8758. },
  8759. _value: function() {
  8760. var val = this.options.value;
  8761. // normalize invalid value
  8762. if ( typeof val !== "number" ) {
  8763. val = 0;
  8764. }
  8765. return Math.min( this.options.max, Math.max( this.min, val ) );
  8766. },
  8767. _percentage: function() {
  8768. return 100 * this._value() / this.options.max;
  8769. },
  8770. _refreshValue: function() {
  8771. var value = this.value();
  8772. var percentage = this._percentage();
  8773. if ( this.oldValue !== value ) {
  8774. this.oldValue = value;
  8775. this._trigger( "change" );
  8776. }
  8777. this.valueDiv
  8778. .toggleClass( "ui-corner-right", value === this.options.max )
  8779. .width( percentage.toFixed(0) + "%" );
  8780. this.element.attr( "aria-valuenow", value );
  8781. }
  8782. });
  8783. $.extend( $.ui.progressbar, {
  8784. version: "1.8.7"
  8785. });
  8786. })( jQuery );
  8787. /*
  8788. * Note: While Microsoft is not the author of this file, Microsoft is
  8789. * offering you a license subject to the terms of the Microsoft Software
  8790. * License Terms for Microsoft ASP.NET Model View Controller 3.
  8791. * Microsoft reserves all other rights. The notices below are provided
  8792. * for informational purposes only and are not the license terms under
  8793. * which Microsoft distributed this file.
  8794. *
  8795. * jQuery UI Slider 1.8.7
  8796. *
  8797. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  8798. *
  8799. * http://docs.jquery.com/UI/Slider
  8800. *
  8801. * Depends:
  8802. * jquery.ui.core.js
  8803. * jquery.ui.mouse.js
  8804. * jquery.ui.widget.js
  8805. */
  8806. (function( $, undefined ) {
  8807. // number of pages in a slider
  8808. // (how many times can you page up/down to go through the whole range)
  8809. var numPages = 5;
  8810. $.widget( "ui.slider", $.ui.mouse, {
  8811. widgetEventPrefix: "slide",
  8812. options: {
  8813. animate: false,
  8814. distance: 0,
  8815. max: 100,
  8816. min: 0,
  8817. orientation: "horizontal",
  8818. range: false,
  8819. step: 1,
  8820. value: 0,
  8821. values: null
  8822. },
  8823. _create: function() {
  8824. var self = this,
  8825. o = this.options;
  8826. this._keySliding = false;
  8827. this._mouseSliding = false;
  8828. this._animateOff = true;
  8829. this._handleIndex = null;
  8830. this._detectOrientation();
  8831. this._mouseInit();
  8832. this.element
  8833. .addClass( "ui-slider" +
  8834. " ui-slider-" + this.orientation +
  8835. " ui-widget" +
  8836. " ui-widget-content" +
  8837. " ui-corner-all" );
  8838. if ( o.disabled ) {
  8839. this.element.addClass( "ui-slider-disabled ui-disabled" );
  8840. }
  8841. this.range = $([]);
  8842. if ( o.range ) {
  8843. if ( o.range === true ) {
  8844. this.range = $( "<div></div>" );
  8845. if ( !o.values ) {
  8846. o.values = [ this._valueMin(), this._valueMin() ];
  8847. }
  8848. if ( o.values.length && o.values.length !== 2 ) {
  8849. o.values = [ o.values[0], o.values[0] ];
  8850. }
  8851. } else {
  8852. this.range = $( "<div></div>" );
  8853. }
  8854. this.range
  8855. .appendTo( this.element )
  8856. .addClass( "ui-slider-range" );
  8857. if ( o.range === "min" || o.range === "max" ) {
  8858. this.range.addClass( "ui-slider-range-" + o.range );
  8859. }
  8860. // note: this isn't the most fittingly semantic framework class for this element,
  8861. // but worked best visually with a variety of themes
  8862. this.range.addClass( "ui-widget-header" );
  8863. }
  8864. if ( $( ".ui-slider-handle", this.element ).length === 0 ) {
  8865. $( "<a href='#'></a>" )
  8866. .appendTo( this.element )
  8867. .addClass( "ui-slider-handle" );
  8868. }
  8869. if ( o.values && o.values.length ) {
  8870. while ( $(".ui-slider-handle", this.element).length < o.values.length ) {
  8871. $( "<a href='#'></a>" )
  8872. .appendTo( this.element )
  8873. .addClass( "ui-slider-handle" );
  8874. }
  8875. }
  8876. this.handles = $( ".ui-slider-handle", this.element )
  8877. .addClass( "ui-state-default" +
  8878. " ui-corner-all" );
  8879. this.handle = this.handles.eq( 0 );
  8880. this.handles.add( this.range ).filter( "a" )
  8881. .click(function( event ) {
  8882. event.preventDefault();
  8883. })
  8884. .hover(function() {
  8885. if ( !o.disabled ) {
  8886. $( this ).addClass( "ui-state-hover" );
  8887. }
  8888. }, function() {
  8889. $( this ).removeClass( "ui-state-hover" );
  8890. })
  8891. .focus(function() {
  8892. if ( !o.disabled ) {
  8893. $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" );
  8894. $( this ).addClass( "ui-state-focus" );
  8895. } else {
  8896. $( this ).blur();
  8897. }
  8898. })
  8899. .blur(function() {
  8900. $( this ).removeClass( "ui-state-focus" );
  8901. });
  8902. this.handles.each(function( i ) {
  8903. $( this ).data( "index.ui-slider-handle", i );
  8904. });
  8905. this.handles
  8906. .keydown(function( event ) {
  8907. var ret = true,
  8908. index = $( this ).data( "index.ui-slider-handle" ),
  8909. allowed,
  8910. curVal,
  8911. newVal,
  8912. step;
  8913. if ( self.options.disabled ) {
  8914. return;
  8915. }
  8916. switch ( event.keyCode ) {
  8917. case $.ui.keyCode.HOME:
  8918. case $.ui.keyCode.END:
  8919. case $.ui.keyCode.PAGE_UP:
  8920. case $.ui.keyCode.PAGE_DOWN:
  8921. case $.ui.keyCode.UP:
  8922. case $.ui.keyCode.RIGHT:
  8923. case $.ui.keyCode.DOWN:
  8924. case $.ui.keyCode.LEFT:
  8925. ret = false;
  8926. if ( !self._keySliding ) {
  8927. self._keySliding = true;
  8928. $( this ).addClass( "ui-state-active" );
  8929. allowed = self._start( event, index );
  8930. if ( allowed === false ) {
  8931. return;
  8932. }
  8933. }
  8934. break;
  8935. }
  8936. step = self.options.step;
  8937. if ( self.options.values && self.options.values.length ) {
  8938. curVal = newVal = self.values( index );
  8939. } else {
  8940. curVal = newVal = self.value();
  8941. }
  8942. switch ( event.keyCode ) {
  8943. case $.ui.keyCode.HOME:
  8944. newVal = self._valueMin();
  8945. break;
  8946. case $.ui.keyCode.END:
  8947. newVal = self._valueMax();
  8948. break;
  8949. case $.ui.keyCode.PAGE_UP:
  8950. newVal = self._trimAlignValue( curVal + ( (self._valueMax() - self._valueMin()) / numPages ) );
  8951. break;
  8952. case $.ui.keyCode.PAGE_DOWN:
  8953. newVal = self._trimAlignValue( curVal - ( (self._valueMax() - self._valueMin()) / numPages ) );
  8954. break;
  8955. case $.ui.keyCode.UP:
  8956. case $.ui.keyCode.RIGHT:
  8957. if ( curVal === self._valueMax() ) {
  8958. return;
  8959. }
  8960. newVal = self._trimAlignValue( curVal + step );
  8961. break;
  8962. case $.ui.keyCode.DOWN:
  8963. case $.ui.keyCode.LEFT:
  8964. if ( curVal === self._valueMin() ) {
  8965. return;
  8966. }
  8967. newVal = self._trimAlignValue( curVal - step );
  8968. break;
  8969. }
  8970. self._slide( event, index, newVal );
  8971. return ret;
  8972. })
  8973. .keyup(function( event ) {
  8974. var index = $( this ).data( "index.ui-slider-handle" );
  8975. if ( self._keySliding ) {
  8976. self._keySliding = false;
  8977. self._stop( event, index );
  8978. self._change( event, index );
  8979. $( this ).removeClass( "ui-state-active" );
  8980. }
  8981. });
  8982. this._refreshValue();
  8983. this._animateOff = false;
  8984. },
  8985. destroy: function() {
  8986. this.handles.remove();
  8987. this.range.remove();
  8988. this.element
  8989. .removeClass( "ui-slider" +
  8990. " ui-slider-horizontal" +
  8991. " ui-slider-vertical" +
  8992. " ui-slider-disabled" +
  8993. " ui-widget" +
  8994. " ui-widget-content" +
  8995. " ui-corner-all" )
  8996. .removeData( "slider" )
  8997. .unbind( ".slider" );
  8998. this._mouseDestroy();
  8999. return this;
  9000. },
  9001. _mouseCapture: function( event ) {
  9002. var o = this.options,
  9003. position,
  9004. normValue,
  9005. distance,
  9006. closestHandle,
  9007. self,
  9008. index,
  9009. allowed,
  9010. offset,
  9011. mouseOverHandle;
  9012. if ( o.disabled ) {
  9013. return false;
  9014. }
  9015. this.elementSize = {
  9016. width: this.element.outerWidth(),
  9017. height: this.element.outerHeight()
  9018. };
  9019. this.elementOffset = this.element.offset();
  9020. position = { x: event.pageX, y: event.pageY };
  9021. normValue = this._normValueFromMouse( position );
  9022. distance = this._valueMax() - this._valueMin() + 1;
  9023. self = this;
  9024. this.handles.each(function( i ) {
  9025. var thisDistance = Math.abs( normValue - self.values(i) );
  9026. if ( distance > thisDistance ) {
  9027. distance = thisDistance;
  9028. closestHandle = $( this );
  9029. index = i;
  9030. }
  9031. });
  9032. // workaround for bug #3736 (if both handles of a range are at 0,
  9033. // the first is always used as the one with least distance,
  9034. // and moving it is obviously prevented by preventing negative ranges)
  9035. if( o.range === true && this.values(1) === o.min ) {
  9036. index += 1;
  9037. closestHandle = $( this.handles[index] );
  9038. }
  9039. allowed = this._start( event, index );
  9040. if ( allowed === false ) {
  9041. return false;
  9042. }
  9043. this._mouseSliding = true;
  9044. self._handleIndex = index;
  9045. closestHandle
  9046. .addClass( "ui-state-active" )
  9047. .focus();
  9048. offset = closestHandle.offset();
  9049. mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" );
  9050. this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
  9051. left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
  9052. top: event.pageY - offset.top -
  9053. ( closestHandle.height() / 2 ) -
  9054. ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
  9055. ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
  9056. ( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
  9057. };
  9058. if ( !this.handles.hasClass( "ui-state-hover" ) ) {
  9059. this._slide( event, index, normValue );
  9060. }
  9061. this._animateOff = true;
  9062. return true;
  9063. },
  9064. _mouseStart: function( event ) {
  9065. return true;
  9066. },
  9067. _mouseDrag: function( event ) {
  9068. var position = { x: event.pageX, y: event.pageY },
  9069. normValue = this._normValueFromMouse( position );
  9070. this._slide( event, this._handleIndex, normValue );
  9071. return false;
  9072. },
  9073. _mouseStop: function( event ) {
  9074. this.handles.removeClass( "ui-state-active" );
  9075. this._mouseSliding = false;
  9076. this._stop( event, this._handleIndex );
  9077. this._change( event, this._handleIndex );
  9078. this._handleIndex = null;
  9079. this._clickOffset = null;
  9080. this._animateOff = false;
  9081. return false;
  9082. },
  9083. _detectOrientation: function() {
  9084. this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
  9085. },
  9086. _normValueFromMouse: function( position ) {
  9087. var pixelTotal,
  9088. pixelMouse,
  9089. percentMouse,
  9090. valueTotal,
  9091. valueMouse;
  9092. if ( this.orientation === "horizontal" ) {
  9093. pixelTotal = this.elementSize.width;
  9094. pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
  9095. } else {
  9096. pixelTotal = this.elementSize.height;
  9097. pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
  9098. }
  9099. percentMouse = ( pixelMouse / pixelTotal );
  9100. if ( percentMouse > 1 ) {
  9101. percentMouse = 1;
  9102. }
  9103. if ( percentMouse < 0 ) {
  9104. percentMouse = 0;
  9105. }
  9106. if ( this.orientation === "vertical" ) {
  9107. percentMouse = 1 - percentMouse;
  9108. }
  9109. valueTotal = this._valueMax() - this._valueMin();
  9110. valueMouse = this._valueMin() + percentMouse * valueTotal;
  9111. return this._trimAlignValue( valueMouse );
  9112. },
  9113. _start: function( event, index ) {
  9114. var uiHash = {
  9115. handle: this.handles[ index ],
  9116. value: this.value()
  9117. };
  9118. if ( this.options.values && this.options.values.length ) {
  9119. uiHash.value = this.values( index );
  9120. uiHash.values = this.values();
  9121. }
  9122. return this._trigger( "start", event, uiHash );
  9123. },
  9124. _slide: function( event, index, newVal ) {
  9125. var otherVal,
  9126. newValues,
  9127. allowed;
  9128. if ( this.options.values && this.options.values.length ) {
  9129. otherVal = this.values( index ? 0 : 1 );
  9130. if ( ( this.options.values.length === 2 && this.options.range === true ) &&
  9131. ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
  9132. ) {
  9133. newVal = otherVal;
  9134. }
  9135. if ( newVal !== this.values( index ) ) {
  9136. newValues = this.values();
  9137. newValues[ index ] = newVal;
  9138. // A slide can be canceled by returning false from the slide callback
  9139. allowed = this._trigger( "slide", event, {
  9140. handle: this.handles[ index ],
  9141. value: newVal,
  9142. values: newValues
  9143. } );
  9144. otherVal = this.values( index ? 0 : 1 );
  9145. if ( allowed !== false ) {
  9146. this.values( index, newVal, true );
  9147. }
  9148. }
  9149. } else {
  9150. if ( newVal !== this.value() ) {
  9151. // A slide can be canceled by returning false from the slide callback
  9152. allowed = this._trigger( "slide", event, {
  9153. handle: this.handles[ index ],
  9154. value: newVal
  9155. } );
  9156. if ( allowed !== false ) {
  9157. this.value( newVal );
  9158. }
  9159. }
  9160. }
  9161. },
  9162. _stop: function( event, index ) {
  9163. var uiHash = {
  9164. handle: this.handles[ index ],
  9165. value: this.value()
  9166. };
  9167. if ( this.options.values && this.options.values.length ) {
  9168. uiHash.value = this.values( index );
  9169. uiHash.values = this.values();
  9170. }
  9171. this._trigger( "stop", event, uiHash );
  9172. },
  9173. _change: function( event, index ) {
  9174. if ( !this._keySliding && !this._mouseSliding ) {
  9175. var uiHash = {
  9176. handle: this.handles[ index ],
  9177. value: this.value()
  9178. };
  9179. if ( this.options.values && this.options.values.length ) {
  9180. uiHash.value = this.values( index );
  9181. uiHash.values = this.values();
  9182. }
  9183. this._trigger( "change", event, uiHash );
  9184. }
  9185. },
  9186. value: function( newValue ) {
  9187. if ( arguments.length ) {
  9188. this.options.value = this._trimAlignValue( newValue );
  9189. this._refreshValue();
  9190. this._change( null, 0 );
  9191. }
  9192. return this._value();
  9193. },
  9194. values: function( index, newValue ) {
  9195. var vals,
  9196. newValues,
  9197. i;
  9198. if ( arguments.length > 1 ) {
  9199. this.options.values[ index ] = this._trimAlignValue( newValue );
  9200. this._refreshValue();
  9201. this._change( null, index );
  9202. }
  9203. if ( arguments.length ) {
  9204. if ( $.isArray( arguments[ 0 ] ) ) {
  9205. vals = this.options.values;
  9206. newValues = arguments[ 0 ];
  9207. for ( i = 0; i < vals.length; i += 1 ) {
  9208. vals[ i ] = this._trimAlignValue( newValues[ i ] );
  9209. this._change( null, i );
  9210. }
  9211. this._refreshValue();
  9212. } else {
  9213. if ( this.options.values && this.options.values.length ) {
  9214. return this._values( index );
  9215. } else {
  9216. return this.value();
  9217. }
  9218. }
  9219. } else {
  9220. return this._values();
  9221. }
  9222. },
  9223. _setOption: function( key, value ) {
  9224. var i,
  9225. valsLength = 0;
  9226. if ( $.isArray( this.options.values ) ) {
  9227. valsLength = this.options.values.length;
  9228. }
  9229. $.Widget.prototype._setOption.apply( this, arguments );
  9230. switch ( key ) {
  9231. case "disabled":
  9232. if ( value ) {
  9233. this.handles.filter( ".ui-state-focus" ).blur();
  9234. this.handles.removeClass( "ui-state-hover" );
  9235. this.handles.attr( "disabled", "disabled" );
  9236. this.element.addClass( "ui-disabled" );
  9237. } else {
  9238. this.handles.removeAttr( "disabled" );
  9239. this.element.removeClass( "ui-disabled" );
  9240. }
  9241. break;
  9242. case "orientation":
  9243. this._detectOrientation();
  9244. this.element
  9245. .removeClass( "ui-slider-horizontal ui-slider-vertical" )
  9246. .addClass( "ui-slider-" + this.orientation );
  9247. this._refreshValue();
  9248. break;
  9249. case "value":
  9250. this._animateOff = true;
  9251. this._refreshValue();
  9252. this._change( null, 0 );
  9253. this._animateOff = false;
  9254. break;
  9255. case "values":
  9256. this._animateOff = true;
  9257. this._refreshValue();
  9258. for ( i = 0; i < valsLength; i += 1 ) {
  9259. this._change( null, i );
  9260. }
  9261. this._animateOff = false;
  9262. break;
  9263. }
  9264. },
  9265. //internal value getter
  9266. // _value() returns value trimmed by min and max, aligned by step
  9267. _value: function() {
  9268. var val = this.options.value;
  9269. val = this._trimAlignValue( val );
  9270. return val;
  9271. },
  9272. //internal values getter
  9273. // _values() returns array of values trimmed by min and max, aligned by step
  9274. // _values( index ) returns single value trimmed by min and max, aligned by step
  9275. _values: function( index ) {
  9276. var val,
  9277. vals,
  9278. i;
  9279. if ( arguments.length ) {
  9280. val = this.options.values[ index ];
  9281. val = this._trimAlignValue( val );
  9282. return val;
  9283. } else {
  9284. // .slice() creates a copy of the array
  9285. // this copy gets trimmed by min and max and then returned
  9286. vals = this.options.values.slice();
  9287. for ( i = 0; i < vals.length; i+= 1) {
  9288. vals[ i ] = this._trimAlignValue( vals[ i ] );
  9289. }
  9290. return vals;
  9291. }
  9292. },
  9293. // returns the step-aligned value that val is closest to, between (inclusive) min and max
  9294. _trimAlignValue: function( val ) {
  9295. if ( val <= this._valueMin() ) {
  9296. return this._valueMin();
  9297. }
  9298. if ( val >= this._valueMax() ) {
  9299. return this._valueMax();
  9300. }
  9301. var step = ( this.options.step > 0 ) ? this.options.step : 1,
  9302. valModStep = (val - this._valueMin()) % step;
  9303. alignValue = val - valModStep;
  9304. if ( Math.abs(valModStep) * 2 >= step ) {
  9305. alignValue += ( valModStep > 0 ) ? step : ( -step );
  9306. }
  9307. // Since JavaScript has problems with large floats, round
  9308. // the final value to 5 digits after the decimal point (see #4124)
  9309. return parseFloat( alignValue.toFixed(5) );
  9310. },
  9311. _valueMin: function() {
  9312. return this.options.min;
  9313. },
  9314. _valueMax: function() {
  9315. return this.options.max;
  9316. },
  9317. _refreshValue: function() {
  9318. var oRange = this.options.range,
  9319. o = this.options,
  9320. self = this,
  9321. animate = ( !this._animateOff ) ? o.animate : false,
  9322. valPercent,
  9323. _set = {},
  9324. lastValPercent,
  9325. value,
  9326. valueMin,
  9327. valueMax;
  9328. if ( this.options.values && this.options.values.length ) {
  9329. this.handles.each(function( i, j ) {
  9330. valPercent = ( self.values(i) - self._valueMin() ) / ( self._valueMax() - self._valueMin() ) * 100;
  9331. _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  9332. $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  9333. if ( self.options.range === true ) {
  9334. if ( self.orientation === "horizontal" ) {
  9335. if ( i === 0 ) {
  9336. self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
  9337. }
  9338. if ( i === 1 ) {
  9339. self.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
  9340. }
  9341. } else {
  9342. if ( i === 0 ) {
  9343. self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
  9344. }
  9345. if ( i === 1 ) {
  9346. self.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
  9347. }
  9348. }
  9349. }
  9350. lastValPercent = valPercent;
  9351. });
  9352. } else {
  9353. value = this.value();
  9354. valueMin = this._valueMin();
  9355. valueMax = this._valueMax();
  9356. valPercent = ( valueMax !== valueMin ) ?
  9357. ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
  9358. 0;
  9359. _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  9360. this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  9361. if ( oRange === "min" && this.orientation === "horizontal" ) {
  9362. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
  9363. }
  9364. if ( oRange === "max" && this.orientation === "horizontal" ) {
  9365. this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
  9366. }
  9367. if ( oRange === "min" && this.orientation === "vertical" ) {
  9368. this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
  9369. }
  9370. if ( oRange === "max" && this.orientation === "vertical" ) {
  9371. this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
  9372. }
  9373. }
  9374. }
  9375. });
  9376. $.extend( $.ui.slider, {
  9377. version: "1.8.7"
  9378. });
  9379. }(jQuery));
  9380. /*
  9381. * Note: While Microsoft is not the author of this file, Microsoft is
  9382. * offering you a license subject to the terms of the Microsoft Software
  9383. * License Terms for Microsoft ASP.NET Model View Controller 3.
  9384. * Microsoft reserves all other rights. The notices below are provided
  9385. * for informational purposes only and are not the license terms under
  9386. * which Microsoft distributed this file.
  9387. *
  9388. * jQuery UI Tabs 1.8.7
  9389. *
  9390. * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
  9391. *
  9392. * http://docs.jquery.com/UI/Tabs
  9393. *
  9394. * Depends:
  9395. * jquery.ui.core.js
  9396. * jquery.ui.widget.js
  9397. */
  9398. (function( $, undefined ) {
  9399. var tabId = 0,
  9400. listId = 0;
  9401. function getNextTabId() {
  9402. return ++tabId;
  9403. }
  9404. function getNextListId() {
  9405. return ++listId;
  9406. }
  9407. $.widget( "ui.tabs", {
  9408. options: {
  9409. add: null,
  9410. ajaxOptions: null,
  9411. cache: false,
  9412. cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
  9413. collapsible: false,
  9414. disable: null,
  9415. disabled: [],
  9416. enable: null,
  9417. event: "click",
  9418. fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
  9419. idPrefix: "ui-tabs-",
  9420. load: null,
  9421. panelTemplate: "<div></div>",
  9422. remove: null,
  9423. select: null,
  9424. show: null,
  9425. spinner: "<em>Loading&#8230;</em>",
  9426. tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
  9427. },
  9428. _create: function() {
  9429. this._tabify( true );
  9430. },
  9431. _setOption: function( key, value ) {
  9432. if ( key == "selected" ) {
  9433. if (this.options.collapsible && value == this.options.selected ) {
  9434. return;
  9435. }
  9436. this.select( value );
  9437. } else {
  9438. this.options[ key ] = value;
  9439. this._tabify();
  9440. }
  9441. },
  9442. _tabId: function( a ) {
  9443. return a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF-]/g, "" ) ||
  9444. this.options.idPrefix + getNextTabId();
  9445. },
  9446. _sanitizeSelector: function( hash ) {
  9447. // we need this because an id may contain a ":"
  9448. return hash.replace( /:/g, "\\:" );
  9449. },
  9450. _cookie: function() {
  9451. var cookie = this.cookie ||
  9452. ( this.cookie = this.options.cookie.name || "ui-tabs-" + getNextListId() );
  9453. return $.cookie.apply( null, [ cookie ].concat( $.makeArray( arguments ) ) );
  9454. },
  9455. _ui: function( tab, panel ) {
  9456. return {
  9457. tab: tab,
  9458. panel: panel,
  9459. index: this.anchors.index( tab )
  9460. };
  9461. },
  9462. _cleanup: function() {
  9463. // restore all former loading tabs labels
  9464. this.lis.filter( ".ui-state-processing" )
  9465. .removeClass( "ui-state-processing" )
  9466. .find( "span:data(label.tabs)" )
  9467. .each(function() {
  9468. var el = $( this );
  9469. el.html( el.data( "label.tabs" ) ).removeData( "label.tabs" );
  9470. });
  9471. },
  9472. _tabify: function( init ) {
  9473. var self = this,
  9474. o = this.options,
  9475. fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash
  9476. this.list = this.element.find( "ol,ul" ).eq( 0 );
  9477. this.lis = $( " > li:has(a[href])", this.list );
  9478. this.anchors = this.lis.map(function() {
  9479. return $( "a", this )[ 0 ];
  9480. });
  9481. this.panels = $( [] );
  9482. this.anchors.each(function( i, a ) {
  9483. var href = $( a ).attr( "href" );
  9484. // For dynamically created HTML that contains a hash as href IE < 8 expands
  9485. // such href to the full page url with hash and then misinterprets tab as ajax.
  9486. // Same consideration applies for an added tab with a fragment identifier
  9487. // since a[href=#fragment-identifier] does unexpectedly not match.
  9488. // Thus normalize href attribute...
  9489. var hrefBase = href.split( "#" )[ 0 ],
  9490. baseEl;
  9491. if ( hrefBase && ( hrefBase === location.toString().split( "#" )[ 0 ] ||
  9492. ( baseEl = $( "base" )[ 0 ]) && hrefBase === baseEl.href ) ) {
  9493. href = a.hash;
  9494. a.href = href;
  9495. }
  9496. // inline tab
  9497. if ( fragmentId.test( href ) ) {
  9498. self.panels = self.panels.add( self.element.find( self._sanitizeSelector( href ) ) );
  9499. // remote tab
  9500. // prevent loading the page itself if href is just "#"
  9501. } else if ( href && href !== "#" ) {
  9502. // required for restore on destroy
  9503. $.data( a, "href.tabs", href );
  9504. // TODO until #3808 is fixed strip fragment identifier from url
  9505. // (IE fails to load from such url)
  9506. $.data( a, "load.tabs", href.replace( /#.*$/, "" ) );
  9507. var id = self._tabId( a );
  9508. a.href = "#" + id;
  9509. var $panel = self.element.find( "#" + id );
  9510. if ( !$panel.length ) {
  9511. $panel = $( o.panelTemplate )
  9512. .attr( "id", id )
  9513. .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
  9514. .insertAfter( self.panels[ i - 1 ] || self.list );
  9515. $panel.data( "destroy.tabs", true );
  9516. }
  9517. self.panels = self.panels.add( $panel );
  9518. // invalid tab href
  9519. } else {
  9520. o.disabled.push( i );
  9521. }
  9522. });
  9523. // initialization from scratch
  9524. if ( init ) {
  9525. // attach necessary classes for styling
  9526. this.element.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" );
  9527. this.list.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" );
  9528. this.lis.addClass( "ui-state-default ui-corner-top" );
  9529. this.panels.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" );
  9530. // Selected tab
  9531. // use "selected" option or try to retrieve:
  9532. // 1. from fragment identifier in url
  9533. // 2. from cookie
  9534. // 3. from selected class attribute on <li>
  9535. if ( o.selected === undefined ) {
  9536. if ( location.hash ) {
  9537. this.anchors.each(function( i, a ) {
  9538. if ( a.hash == location.hash ) {
  9539. o.selected = i;
  9540. return false;
  9541. }
  9542. });
  9543. }
  9544. if ( typeof o.selected !== "number" && o.cookie ) {
  9545. o.selected = parseInt( self._cookie(), 10 );
  9546. }
  9547. if ( typeof o.selected !== "number" && this.lis.filter( ".ui-tabs-selected" ).length ) {
  9548. o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) );
  9549. }
  9550. o.selected = o.selected || ( this.lis.length ? 0 : -1 );
  9551. } else if ( o.selected === null ) { // usage of null is deprecated, TODO remove in next release
  9552. o.selected = -1;
  9553. }
  9554. // sanity check - default to first tab...
  9555. o.selected = ( ( o.selected >= 0 && this.anchors[ o.selected ] ) || o.selected < 0 )
  9556. ? o.selected
  9557. : 0;
  9558. // Take disabling tabs via class attribute from HTML
  9559. // into account and update option properly.
  9560. // A selected tab cannot become disabled.
  9561. o.disabled = $.unique( o.disabled.concat(
  9562. $.map( this.lis.filter( ".ui-state-disabled" ), function( n, i ) {
  9563. return self.lis.index( n );
  9564. })
  9565. ) ).sort();
  9566. if ( $.inArray( o.selected, o.disabled ) != -1 ) {
  9567. o.disabled.splice( $.inArray( o.selected, o.disabled ), 1 );
  9568. }
  9569. // highlight selected tab
  9570. this.panels.addClass( "ui-tabs-hide" );
  9571. this.lis.removeClass( "ui-tabs-selected ui-state-active" );
  9572. // check for length avoids error when initializing empty list
  9573. if ( o.selected >= 0 && this.anchors.length ) {
  9574. self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ).removeClass( "ui-tabs-hide" );
  9575. this.lis.eq( o.selected ).addClass( "ui-tabs-selected ui-state-active" );
  9576. // seems to be expected behavior that the show callback is fired
  9577. self.element.queue( "tabs", function() {
  9578. self._trigger( "show", null,
  9579. self._ui( self.anchors[ o.selected ], self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ) ) );
  9580. });
  9581. this.load( o.selected );
  9582. }
  9583. // clean up to avoid memory leaks in certain versions of IE 6
  9584. // TODO: namespace this event
  9585. $( window ).bind( "unload", function() {
  9586. self.lis.add( self.anchors ).unbind( ".tabs" );
  9587. self.lis = self.anchors = self.panels = null;
  9588. });
  9589. // update selected after add/remove
  9590. } else {
  9591. o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) );
  9592. }
  9593. // update collapsible
  9594. // TODO: use .toggleClass()
  9595. this.element[ o.collapsible ? "addClass" : "removeClass" ]( "ui-tabs-collapsible" );
  9596. // set or update cookie after init and add/remove respectively
  9597. if ( o.cookie ) {
  9598. this._cookie( o.selected, o.cookie );
  9599. }
  9600. // disable tabs
  9601. for ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) {
  9602. $( li )[ $.inArray( i, o.disabled ) != -1 &&
  9603. // TODO: use .toggleClass()
  9604. !$( li ).hasClass( "ui-tabs-selected" ) ? "addClass" : "removeClass" ]( "ui-state-disabled" );
  9605. }
  9606. // reset cache if switching from cached to not cached
  9607. if ( o.cache === false ) {
  9608. this.anchors.removeData( "cache.tabs" );
  9609. }
  9610. // remove all handlers before, tabify may run on existing tabs after add or option change
  9611. this.lis.add( this.anchors ).unbind( ".tabs" );
  9612. if ( o.event !== "mouseover" ) {
  9613. var addState = function( state, el ) {
  9614. if ( el.is( ":not(.ui-state-disabled)" ) ) {
  9615. el.addClass( "ui-state-" + state );
  9616. }
  9617. };
  9618. var removeState = function( state, el ) {
  9619. el.removeClass( "ui-state-" + state );
  9620. };
  9621. this.lis.bind( "mouseover.tabs" , function() {
  9622. addState( "hover", $( this ) );
  9623. });
  9624. this.lis.bind( "mouseout.tabs", function() {
  9625. removeState( "hover", $( this ) );
  9626. });
  9627. this.anchors.bind( "focus.tabs", function() {
  9628. addState( "focus", $( this ).closest( "li" ) );
  9629. });
  9630. this.anchors.bind( "blur.tabs", function() {
  9631. removeState( "focus", $( this ).closest( "li" ) );
  9632. });
  9633. }
  9634. // set up animations
  9635. var hideFx, showFx;
  9636. if ( o.fx ) {
  9637. if ( $.isArray( o.fx ) ) {
  9638. hideFx = o.fx[ 0 ];
  9639. showFx = o.fx[ 1 ];
  9640. } else {
  9641. hideFx = showFx = o.fx;
  9642. }
  9643. }
  9644. // Reset certain styles left over from animation
  9645. // and prevent IE's ClearType bug...
  9646. function resetStyle( $el, fx ) {
  9647. $el.css( "display", "" );
  9648. if ( !$.support.opacity && fx.opacity ) {
  9649. $el[ 0 ].style.removeAttribute( "filter" );
  9650. }
  9651. }
  9652. // Show a tab...
  9653. var showTab = showFx
  9654. ? function( clicked, $show ) {
  9655. $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" );
  9656. $show.hide().removeClass( "ui-tabs-hide" ) // avoid flicker that way
  9657. .animate( showFx, showFx.duration || "normal", function() {
  9658. resetStyle( $show, showFx );
  9659. self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) );
  9660. });
  9661. }
  9662. : function( clicked, $show ) {
  9663. $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" );
  9664. $show.removeClass( "ui-tabs-hide" );
  9665. self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) );
  9666. };
  9667. // Hide a tab, $show is optional...
  9668. var hideTab = hideFx
  9669. ? function( clicked, $hide ) {
  9670. $hide.animate( hideFx, hideFx.duration || "normal", function() {
  9671. self.lis.removeClass( "ui-tabs-selected ui-state-active" );
  9672. $hide.addClass( "ui-tabs-hide" );
  9673. resetStyle( $hide, hideFx );
  9674. self.element.dequeue( "tabs" );
  9675. });
  9676. }
  9677. : function( clicked, $hide, $show ) {
  9678. self.lis.removeClass( "ui-tabs-selected ui-state-active" );
  9679. $hide.addClass( "ui-tabs-hide" );
  9680. self.element.dequeue( "tabs" );
  9681. };
  9682. // attach tab event handler, unbind to avoid duplicates from former tabifying...
  9683. this.anchors.bind( o.event + ".tabs", function() {
  9684. var el = this,
  9685. $li = $(el).closest( "li" ),
  9686. $hide = self.panels.filter( ":not(.ui-tabs-hide)" ),
  9687. $show = self.element.find( self._sanitizeSelector( el.hash ) );
  9688. // If tab is already selected and not collapsible or tab disabled or
  9689. // or is already loading or click callback returns false stop here.
  9690. // Check if click handler returns false last so that it is not executed
  9691. // for a disabled or loading tab!
  9692. if ( ( $li.hasClass( "ui-tabs-selected" ) && !o.collapsible) ||
  9693. $li.hasClass( "ui-state-disabled" ) ||
  9694. $li.hasClass( "ui-state-processing" ) ||
  9695. self.panels.filter( ":animated" ).length ||
  9696. self._trigger( "select", null, self._ui( this, $show[ 0 ] ) ) === false ) {
  9697. this.blur();
  9698. return false;
  9699. }
  9700. o.selected = self.anchors.index( this );
  9701. self.abort();
  9702. // if tab may be closed
  9703. if ( o.collapsible ) {
  9704. if ( $li.hasClass( "ui-tabs-selected" ) ) {
  9705. o.selected = -1;
  9706. if ( o.cookie ) {
  9707. self._cookie( o.selected, o.cookie );
  9708. }
  9709. self.element.queue( "tabs", function() {
  9710. hideTab( el, $hide );
  9711. }).dequeue( "tabs" );
  9712. this.blur();
  9713. return false;
  9714. } else if ( !$hide.length ) {
  9715. if ( o.cookie ) {
  9716. self._cookie( o.selected, o.cookie );
  9717. }
  9718. self.element.queue( "tabs", function() {
  9719. showTab( el, $show );
  9720. });
  9721. // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171
  9722. self.load( self.anchors.index( this ) );
  9723. this.blur();
  9724. return false;
  9725. }
  9726. }
  9727. if ( o.cookie ) {
  9728. self._cookie( o.selected, o.cookie );
  9729. }
  9730. // show new tab
  9731. if ( $show.length ) {
  9732. if ( $hide.length ) {
  9733. self.element.queue( "tabs", function() {
  9734. hideTab( el, $hide );
  9735. });
  9736. }
  9737. self.element.queue( "tabs", function() {
  9738. showTab( el, $show );
  9739. });
  9740. self.load( self.anchors.index( this ) );
  9741. } else {
  9742. throw "jQuery UI Tabs: Mismatching fragment identifier.";
  9743. }
  9744. // Prevent IE from keeping other link focussed when using the back button
  9745. // and remove dotted border from clicked link. This is controlled via CSS
  9746. // in modern browsers; blur() removes focus from address bar in Firefox
  9747. // which can become a usability and annoying problem with tabs('rotate').
  9748. if ( $.browser.msie ) {
  9749. this.blur();
  9750. }
  9751. });
  9752. // disable click in any case
  9753. this.anchors.bind( "click.tabs", function(){
  9754. return false;
  9755. });
  9756. },
  9757. _getIndex: function( index ) {
  9758. // meta-function to give users option to provide a href string instead of a numerical index.
  9759. // also sanitizes numerical indexes to valid values.
  9760. if ( typeof index == "string" ) {
  9761. index = this.anchors.index( this.anchors.filter( "[href$=" + index + "]" ) );
  9762. }
  9763. return index;
  9764. },
  9765. destroy: function() {
  9766. var o = this.options;
  9767. this.abort();
  9768. this.element
  9769. .unbind( ".tabs" )
  9770. .removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" )
  9771. .removeData( "tabs" );
  9772. this.list.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" );
  9773. this.anchors.each(function() {
  9774. var href = $.data( this, "href.tabs" );
  9775. if ( href ) {
  9776. this.href = href;
  9777. }
  9778. var $this = $( this ).unbind( ".tabs" );
  9779. $.each( [ "href", "load", "cache" ], function( i, prefix ) {
  9780. $this.removeData( prefix + ".tabs" );
  9781. });
  9782. });
  9783. this.lis.unbind( ".tabs" ).add( this.panels ).each(function() {
  9784. if ( $.data( this, "destroy.tabs" ) ) {
  9785. $( this ).remove();
  9786. } else {
  9787. $( this ).removeClass([
  9788. "ui-state-default",
  9789. "ui-corner-top",
  9790. "ui-tabs-selected",
  9791. "ui-state-active",
  9792. "ui-state-hover",
  9793. "ui-state-focus",
  9794. "ui-state-disabled",
  9795. "ui-tabs-panel",
  9796. "ui-widget-content",
  9797. "ui-corner-bottom",
  9798. "ui-tabs-hide"
  9799. ].join( " " ) );
  9800. }
  9801. });
  9802. if ( o.cookie ) {
  9803. this._cookie( null, o.cookie );
  9804. }
  9805. return this;
  9806. },
  9807. add: function( url, label, index ) {
  9808. if ( index === undefined ) {
  9809. index = this.anchors.length;
  9810. }
  9811. var self = this,
  9812. o = this.options,
  9813. $li = $( o.tabTemplate.replace( /#\{href\}/g, url ).replace( /#\{label\}/g, label ) ),
  9814. id = !url.indexOf( "#" ) ? url.replace( "#", "" ) : this._tabId( $( "a", $li )[ 0 ] );
  9815. $li.addClass( "ui-state-default ui-corner-top" ).data( "destroy.tabs", true );
  9816. // try to find an existing element before creating a new one
  9817. var $panel = self.element.find( "#" + id );
  9818. if ( !$panel.length ) {
  9819. $panel = $( o.panelTemplate )
  9820. .attr( "id", id )
  9821. .data( "destroy.tabs", true );
  9822. }
  9823. $panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" );
  9824. if ( index >= this.lis.length ) {
  9825. $li.appendTo( this.list );
  9826. $panel.appendTo( this.list[ 0 ].parentNode );
  9827. } else {
  9828. $li.insertBefore( this.lis[ index ] );
  9829. $panel.insertBefore( this.panels[ index ] );
  9830. }
  9831. o.disabled = $.map( o.disabled, function( n, i ) {
  9832. return n >= index ? ++n : n;
  9833. });
  9834. this._tabify();
  9835. if ( this.anchors.length == 1 ) {
  9836. o.selected = 0;
  9837. $li.addClass( "ui-tabs-selected ui-state-active" );
  9838. $panel.removeClass( "ui-tabs-hide" );
  9839. this.element.queue( "tabs", function() {
  9840. self._trigger( "show", null, self._ui( self.anchors[ 0 ], self.panels[ 0 ] ) );
  9841. });
  9842. this.load( 0 );
  9843. }
  9844. this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
  9845. return this;
  9846. },
  9847. remove: function( index ) {
  9848. index = this._getIndex( index );
  9849. var o = this.options,
  9850. $li = this.lis.eq( index ).remove(),
  9851. $panel = this.panels.eq( index ).remove();
  9852. // If selected tab was removed focus tab to the right or
  9853. // in case the last tab was removed the tab to the left.
  9854. if ( $li.hasClass( "ui-tabs-selected" ) && this.anchors.length > 1) {
  9855. this.select( index + ( index + 1 < this.anchors.length ? 1 : -1 ) );
  9856. }
  9857. o.disabled = $.map(
  9858. $.grep( o.disabled, function(n, i) {
  9859. return n != index;
  9860. }),
  9861. function( n, i ) {
  9862. return n >= index ? --n : n;
  9863. });
  9864. this._tabify();
  9865. this._trigger( "remove", null, this._ui( $li.find( "a" )[ 0 ], $panel[ 0 ] ) );
  9866. return this;
  9867. },
  9868. enable: function( index ) {
  9869. index = this._getIndex( index );
  9870. var o = this.options;
  9871. if ( $.inArray( index, o.disabled ) == -1 ) {
  9872. return;
  9873. }
  9874. this.lis.eq( index ).removeClass( "ui-state-disabled" );
  9875. o.disabled = $.grep( o.disabled, function( n, i ) {
  9876. return n != index;
  9877. });
  9878. this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
  9879. return this;
  9880. },
  9881. disable: function( index ) {
  9882. index = this._getIndex( index );
  9883. var self = this, o = this.options;
  9884. // cannot disable already selected tab
  9885. if ( index != o.selected ) {
  9886. this.lis.eq( index ).addClass( "ui-state-disabled" );
  9887. o.disabled.push( index );
  9888. o.disabled.sort();
  9889. this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
  9890. }
  9891. return this;
  9892. },
  9893. select: function( index ) {
  9894. index = this._getIndex( index );
  9895. if ( index == -1 ) {
  9896. if ( this.options.collapsible && this.options.selected != -1 ) {
  9897. index = this.options.selected;
  9898. } else {
  9899. return this;
  9900. }
  9901. }
  9902. this.anchors.eq( index ).trigger( this.options.event + ".tabs" );
  9903. return this;
  9904. },
  9905. load: function( index ) {
  9906. index = this._getIndex( index );
  9907. var self = this,
  9908. o = this.options,
  9909. a = this.anchors.eq( index )[ 0 ],
  9910. url = $.data( a, "load.tabs" );
  9911. this.abort();
  9912. // not remote or from cache
  9913. if ( !url || this.element.queue( "tabs" ).length !== 0 && $.data( a, "cache.tabs" ) ) {
  9914. this.element.dequeue( "tabs" );
  9915. return;
  9916. }
  9917. // load remote from here on
  9918. this.lis.eq( index ).addClass( "ui-state-processing" );
  9919. if ( o.spinner ) {
  9920. var span = $( "span", a );
  9921. span.data( "label.tabs", span.html() ).html( o.spinner );
  9922. }
  9923. this.xhr = $.ajax( $.extend( {}, o.ajaxOptions, {
  9924. url: url,
  9925. success: function( r, s ) {
  9926. self.element.find( self._sanitizeSelector( a.hash ) ).html( r );
  9927. // take care of tab labels
  9928. self._cleanup();
  9929. if ( o.cache ) {
  9930. $.data( a, "cache.tabs", true );
  9931. }
  9932. self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );
  9933. try {
  9934. o.ajaxOptions.success( r, s );
  9935. }
  9936. catch ( e ) {}
  9937. },
  9938. error: function( xhr, s, e ) {
  9939. // take care of tab labels
  9940. self._cleanup();
  9941. self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );
  9942. try {
  9943. // Passing index avoid a race condition when this method is
  9944. // called after the user has selected another tab.
  9945. // Pass the anchor that initiated this request allows
  9946. // loadError to manipulate the tab content panel via $(a.hash)
  9947. o.ajaxOptions.error( xhr, s, index, a );
  9948. }
  9949. catch ( e ) {}
  9950. }
  9951. } ) );
  9952. // last, so that load event is fired before show...
  9953. self.element.dequeue( "tabs" );
  9954. return this;
  9955. },
  9956. abort: function() {
  9957. // stop possibly running animations
  9958. this.element.queue( [] );
  9959. this.panels.stop( false, true );
  9960. // "tabs" queue must not contain more than two elements,
  9961. // which are the callbacks for the latest clicked tab...
  9962. this.element.queue( "tabs", this.element.queue( "tabs" ).splice( -2, 2 ) );
  9963. // terminate pending requests from other tabs
  9964. if ( this.xhr ) {
  9965. this.xhr.abort();
  9966. delete this.xhr;
  9967. }
  9968. // take care of tab labels
  9969. this._cleanup();
  9970. return this;
  9971. },
  9972. url: function( index, url ) {
  9973. this.anchors.eq( index ).removeData( "cache.tabs" ).data( "load.tabs", url );
  9974. return this;
  9975. },
  9976. length: function() {
  9977. return this.anchors.length;
  9978. }
  9979. });
  9980. $.extend( $.ui.tabs, {
  9981. version: "1.8.7"
  9982. });
  9983. /*
  9984. * Tabs Extensions
  9985. */
  9986. /*
  9987. * Rotate
  9988. */
  9989. $.extend( $.ui.tabs.prototype, {
  9990. rotation: null,
  9991. rotate: function( ms, continuing ) {
  9992. var self = this,
  9993. o = this.options;
  9994. var rotate = self._rotate || ( self._rotate = function( e ) {
  9995. clearTimeout( self.rotation );
  9996. self.rotation = setTimeout(function() {
  9997. var t = o.selected;
  9998. self.select( ++t < self.anchors.length ? t : 0 );
  9999. }, ms );
  10000. if ( e ) {
  10001. e.stopPropagation();
  10002. }
  10003. });
  10004. var stop = self._unrotate || ( self._unrotate = !continuing
  10005. ? function(e) {
  10006. if (e.clientX) { // in case of a true click
  10007. self.rotate(null);
  10008. }
  10009. }
  10010. : function( e ) {
  10011. t = o.selected;
  10012. rotate();
  10013. });
  10014. // start rotation
  10015. if ( ms ) {
  10016. this.element.bind( "tabsshow", rotate );
  10017. this.anchors.bind( o.event + ".tabs", stop );
  10018. rotate();
  10019. // stop rotation
  10020. } else {
  10021. clearTimeout( self.rotation );
  10022. this.element.unbind( "tabsshow", rotate );
  10023. this.anchors.unbind( o.event + ".tabs", stop );
  10024. delete this._rotate;
  10025. delete this._unrotate;
  10026. }
  10027. return this;
  10028. }
  10029. });
  10030. })( jQuery );