uikit_custom.js 308 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931
  1. /*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  2. (function(core) {
  3. if (typeof define == "function" && define.amd) { // AMD
  4. define("uikit", function(){
  5. var uikit = window.UIkit || core(window, window.jQuery, window.document);
  6. uikit.load = function(res, req, onload, config) {
  7. var resources = res.split(','), load = [], i, base = (config.config && config.config.uikit && config.config.uikit.base ? config.config.uikit.base : "").replace(/\/+$/g, "");
  8. if (!base) {
  9. throw new Error( "Please define base path to UIkit in the requirejs config." );
  10. }
  11. for (i = 0; i < resources.length; i += 1) {
  12. var resource = resources[i].replace(/\./g, '/');
  13. load.push(base+'/components/'+resource);
  14. }
  15. req(load, function() {
  16. onload(uikit);
  17. });
  18. };
  19. return uikit;
  20. });
  21. }
  22. if (!window.jQuery) {
  23. throw new Error( "UIkit requires jQuery" );
  24. }
  25. if (window && window.jQuery) {
  26. core(window, window.jQuery, window.document);
  27. }
  28. })(function(global, $, doc) {
  29. "use strict";
  30. var UI = {}, _UI = global.UIkit ? Object.create(global.UIkit) : undefined;
  31. UI.version = '2.27.1';
  32. UI.noConflict = function() {
  33. // restore UIkit version
  34. if (_UI) {
  35. global.UIkit = _UI;
  36. $.UIkit = _UI;
  37. $.fn.uk = _UI.fn;
  38. }
  39. return UI;
  40. };
  41. UI.prefix = function(str) {
  42. return str;
  43. };
  44. // cache jQuery
  45. UI.$ = $;
  46. UI.$doc = UI.$(document);
  47. UI.$win = UI.$(window);
  48. UI.$html = UI.$('html');
  49. UI.support = {};
  50. UI.support.transition = (function() {
  51. var transitionEnd = (function() {
  52. var element = doc.body || doc.documentElement,
  53. transEndEventNames = {
  54. WebkitTransition : 'webkitTransitionEnd',
  55. MozTransition : 'transitionend',
  56. OTransition : 'oTransitionEnd otransitionend',
  57. transition : 'transitionend'
  58. }, name;
  59. for (name in transEndEventNames) {
  60. if (element.style[name] !== undefined) return transEndEventNames[name];
  61. }
  62. }());
  63. return transitionEnd && { end: transitionEnd };
  64. })();
  65. UI.support.animation = (function() {
  66. var animationEnd = (function() {
  67. var element = doc.body || doc.documentElement,
  68. animEndEventNames = {
  69. WebkitAnimation : 'webkitAnimationEnd',
  70. MozAnimation : 'animationend',
  71. OAnimation : 'oAnimationEnd oanimationend',
  72. animation : 'animationend'
  73. }, name;
  74. for (name in animEndEventNames) {
  75. if (element.style[name] !== undefined) return animEndEventNames[name];
  76. }
  77. }());
  78. return animationEnd && { end: animationEnd };
  79. })();
  80. // requestAnimationFrame polyfill
  81. //https://github.com/darius/requestAnimationFrame
  82. (function() {
  83. Date.now = Date.now || function() { return new Date().getTime(); };
  84. var vendors = ['webkit', 'moz'];
  85. for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) {
  86. var vp = vendors[i];
  87. window.requestAnimationFrame = window[vp+'RequestAnimationFrame'];
  88. window.cancelAnimationFrame = (window[vp+'CancelAnimationFrame']
  89. || window[vp+'CancelRequestAnimationFrame']);
  90. }
  91. if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) // iOS6 is buggy
  92. || !window.requestAnimationFrame || !window.cancelAnimationFrame) {
  93. var lastTime = 0;
  94. window.requestAnimationFrame = function(callback) {
  95. var now = Date.now();
  96. var nextTime = Math.max(lastTime + 16, now);
  97. return setTimeout(function() { callback(lastTime = nextTime); },
  98. nextTime - now);
  99. };
  100. window.cancelAnimationFrame = clearTimeout;
  101. }
  102. }());
  103. UI.support.touch = (
  104. ('ontouchstart' in document) ||
  105. (global.DocumentTouch && document instanceof global.DocumentTouch) ||
  106. (global.navigator.msPointerEnabled && global.navigator.msMaxTouchPoints > 0) || //IE 10
  107. (global.navigator.pointerEnabled && global.navigator.maxTouchPoints > 0) || //IE >=11
  108. false
  109. );
  110. UI.support.mutationobserver = (global.MutationObserver || global.WebKitMutationObserver || null);
  111. UI.Utils = {};
  112. UI.Utils.isFullscreen = function() {
  113. return document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement || document.fullscreenElement || false;
  114. };
  115. UI.Utils.str2json = function(str, notevil) {
  116. try {
  117. if (notevil) {
  118. return JSON.parse(str
  119. // wrap keys without quote with valid double quote
  120. .replace(/([\$\w]+)\s*:/g, function(_, $1){return '"'+$1+'":';})
  121. // replacing single quote wrapped ones to double quote
  122. .replace(/'([^']+)'/g, function(_, $1){return '"'+$1+'"';})
  123. );
  124. } else {
  125. return (new Function("", "var json = " + str + "; return JSON.parse(JSON.stringify(json));"))();
  126. }
  127. } catch(e) { return false; }
  128. };
  129. UI.Utils.debounce = function(func, wait, immediate) {
  130. var timeout;
  131. return function() {
  132. var context = this, args = arguments;
  133. var later = function() {
  134. timeout = null;
  135. if (!immediate) func.apply(context, args);
  136. };
  137. var callNow = immediate && !timeout;
  138. clearTimeout(timeout);
  139. timeout = setTimeout(later, wait);
  140. if (callNow) func.apply(context, args);
  141. };
  142. };
  143. UI.Utils.throttle = function (func, limit) {
  144. var wait = false;
  145. return function () {
  146. if (!wait) {
  147. func.call();
  148. wait = true;
  149. setTimeout(function () {
  150. wait = false;
  151. }, limit);
  152. }
  153. }
  154. };
  155. UI.Utils.removeCssRules = function(selectorRegEx) {
  156. var idx, idxs, stylesheet, _i, _j, _k, _len, _len1, _len2, _ref;
  157. if(!selectorRegEx) return;
  158. setTimeout(function(){
  159. try {
  160. _ref = document.styleSheets;
  161. for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  162. stylesheet = _ref[_i];
  163. idxs = [];
  164. stylesheet.cssRules = stylesheet.cssRules;
  165. for (idx = _j = 0, _len1 = stylesheet.cssRules.length; _j < _len1; idx = ++_j) {
  166. if (stylesheet.cssRules[idx].type === CSSRule.STYLE_RULE && selectorRegEx.test(stylesheet.cssRules[idx].selectorText)) {
  167. idxs.unshift(idx);
  168. }
  169. }
  170. for (_k = 0, _len2 = idxs.length; _k < _len2; _k++) {
  171. stylesheet.deleteRule(idxs[_k]);
  172. }
  173. }
  174. } catch (_error) {}
  175. }, 0);
  176. };
  177. UI.Utils.isInView = function(element, options) {
  178. var $element = $(element);
  179. if (!$element.is(':visible')) {
  180. return false;
  181. }
  182. var window_left = UI.$win.scrollLeft(), window_top = UI.$win.scrollTop(), offset = $element.offset(), left = offset.left, top = offset.top;
  183. options = $.extend({topoffset:0, leftoffset:0}, options);
  184. if (top + $element.height() >= window_top && top - options.topoffset <= window_top + UI.$win.height() &&
  185. left + $element.width() >= window_left && left - options.leftoffset <= window_left + UI.$win.width()) {
  186. return true;
  187. } else {
  188. return false;
  189. }
  190. };
  191. UI.Utils.checkDisplay = function(context, initanimation) {
  192. var elements = UI.$('[data-uk-margin], [data-uk-grid-match], [data-uk-grid-margin], [data-uk-check-display]', context || document), animated;
  193. if (context && !elements.length) {
  194. elements = $(context);
  195. }
  196. elements.trigger('display.uk.check');
  197. // fix firefox / IE animations
  198. if (initanimation) {
  199. if (typeof(initanimation)!='string') {
  200. initanimation = '[class*="uk-animation-"]';
  201. }
  202. elements.find(initanimation).each(function(){
  203. var ele = UI.$(this),
  204. cls = ele.attr('class'),
  205. anim = cls.match(/uk-animation-(.+)/);
  206. ele.removeClass(anim[0]).width();
  207. ele.addClass(anim[0]);
  208. });
  209. }
  210. return elements;
  211. };
  212. UI.Utils.options = function(string) {
  213. if ($.type(string)!='string') return string;
  214. if (string.indexOf(':') != -1 && string.trim().substr(-1) != '}') {
  215. string = '{'+string+'}';
  216. }
  217. var start = (string ? string.indexOf("{") : -1), options = {};
  218. if (start != -1) {
  219. try {
  220. options = UI.Utils.str2json(string.substr(start));
  221. } catch (e) {}
  222. }
  223. return options;
  224. };
  225. UI.Utils.animate = function(element, cls) {
  226. var d = $.Deferred();
  227. element = UI.$(element);
  228. element.css('display', 'none').addClass(cls).one(UI.support.animation.end, function() {
  229. element.removeClass(cls);
  230. d.resolve();
  231. });
  232. element.css('display', '');
  233. return d.promise();
  234. };
  235. UI.Utils.uid = function(prefix) {
  236. return (prefix || 'id') + (new Date().getTime())+"RAND"+(Math.ceil(Math.random() * 100000));
  237. };
  238. UI.Utils.template = function(str, data) {
  239. var tokens = str.replace(/\n/g, '\\n').replace(/\{\{\{\s*(.+?)\s*\}\}\}/g, "{{!$1}}").split(/(\{\{\s*(.+?)\s*\}\})/g),
  240. i=0, toc, cmd, prop, val, fn, output = [], openblocks = 0;
  241. while(i < tokens.length) {
  242. toc = tokens[i];
  243. if(toc.match(/\{\{\s*(.+?)\s*\}\}/)) {
  244. i = i + 1;
  245. toc = tokens[i];
  246. cmd = toc[0];
  247. prop = toc.substring(toc.match(/^(\^|\#|\!|\~|\:)/) ? 1:0);
  248. switch(cmd) {
  249. case '~':
  250. output.push("for(var $i=0;$i<"+prop+".length;$i++) { var $item = "+prop+"[$i];");
  251. openblocks++;
  252. break;
  253. case ':':
  254. output.push("for(var $key in "+prop+") { var $val = "+prop+"[$key];");
  255. openblocks++;
  256. break;
  257. case '#':
  258. output.push("if("+prop+") {");
  259. openblocks++;
  260. break;
  261. case '^':
  262. output.push("if(!"+prop+") {");
  263. openblocks++;
  264. break;
  265. case '/':
  266. output.push("}");
  267. openblocks--;
  268. break;
  269. case '!':
  270. output.push("__ret.push("+prop+");");
  271. break;
  272. default:
  273. output.push("__ret.push(escape("+prop+"));");
  274. break;
  275. }
  276. } else {
  277. output.push("__ret.push('"+toc.replace(/\'/g, "\\'")+"');");
  278. }
  279. i = i + 1;
  280. }
  281. fn = new Function('$data', [
  282. 'var __ret = [];',
  283. 'try {',
  284. 'with($data){', (!openblocks ? output.join('') : '__ret = ["Not all blocks are closed correctly."]'), '};',
  285. '}catch(e){__ret = [e.message];}',
  286. 'return __ret.join("").replace(/\\n\\n/g, "\\n");',
  287. "function escape(html) { return String(html).replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');}"
  288. ].join("\n"));
  289. return data ? fn(data) : fn;
  290. };
  291. UI.Utils.focus = function(element, extra) {
  292. element = $(element);
  293. var autofocus = element.find('[autofocus]:first'), tabidx;
  294. if (autofocus.length) {
  295. return autofocus.focus();
  296. }
  297. autofocus = element.find(':input'+(extra && (','+extra) || '')).first();
  298. if (autofocus.length) {
  299. return autofocus.focus();
  300. }
  301. if (!element.attr('tabindex')) {
  302. tabidx = 1000;
  303. element.attr('tabindex', tabidx);
  304. }
  305. element[0].focus();
  306. if (tabidx) {
  307. element.attr('tabindex', '');
  308. }
  309. return element;
  310. }
  311. UI.Utils.events = {};
  312. UI.Utils.events.click = UI.support.touch ? 'tap' : 'click';
  313. global.UIkit = UI;
  314. // deprecated
  315. UI.fn = function(command, options) {
  316. var args = arguments, cmd = command.match(/^([a-z\-]+)(?:\.([a-z]+))?/i), component = cmd[1], method = cmd[2];
  317. if (!UI[component]) {
  318. $.error("UIkit component [" + component + "] does not exist.");
  319. return this;
  320. }
  321. return this.each(function() {
  322. var $this = $(this), data = $this.data(component);
  323. if (!data) $this.data(component, (data = UI[component](this, method ? undefined : options)));
  324. if (method) data[method].apply(data, Array.prototype.slice.call(args, 1));
  325. });
  326. };
  327. $.UIkit = UI;
  328. $.fn.uk = UI.fn;
  329. UI.langdirection = UI.$html.attr("dir") == "rtl" ? "right" : "left";
  330. UI.components = {};
  331. UI.component = function(name, def) {
  332. var fn = function(element, options) {
  333. var $this = this;
  334. this.UIkit = UI;
  335. this.element = element ? UI.$(element) : null;
  336. this.options = $.extend(true, {}, this.defaults, options);
  337. this.plugins = {};
  338. if (this.element) {
  339. this.element.data(name, this);
  340. }
  341. this.init();
  342. (this.options.plugins.length ? this.options.plugins : Object.keys(fn.plugins)).forEach(function(plugin) {
  343. if (fn.plugins[plugin].init) {
  344. fn.plugins[plugin].init($this);
  345. $this.plugins[plugin] = true;
  346. }
  347. });
  348. this.trigger('init.uk.component', [name, this]);
  349. return this;
  350. };
  351. fn.plugins = {};
  352. $.extend(true, fn.prototype, {
  353. defaults : {plugins: []},
  354. boot: function(){},
  355. init: function(){},
  356. on: function(a1,a2,a3){
  357. return UI.$(this.element || this).on(a1,a2,a3);
  358. },
  359. one: function(a1,a2,a3){
  360. return UI.$(this.element || this).one(a1,a2,a3);
  361. },
  362. off: function(evt){
  363. return UI.$(this.element || this).off(evt);
  364. },
  365. trigger: function(evt, params) {
  366. return UI.$(this.element || this).trigger(evt, params);
  367. },
  368. find: function(selector) {
  369. return UI.$(this.element ? this.element: []).find(selector);
  370. },
  371. proxy: function(obj, methods) {
  372. var $this = this;
  373. methods.split(' ').forEach(function(method) {
  374. if (!$this[method]) $this[method] = function() { return obj[method].apply(obj, arguments); };
  375. });
  376. },
  377. mixin: function(obj, methods) {
  378. var $this = this;
  379. methods.split(' ').forEach(function(method) {
  380. if (!$this[method]) $this[method] = obj[method].bind($this);
  381. });
  382. },
  383. option: function() {
  384. if (arguments.length == 1) {
  385. return this.options[arguments[0]] || undefined;
  386. } else if (arguments.length == 2) {
  387. this.options[arguments[0]] = arguments[1];
  388. }
  389. }
  390. }, def);
  391. this.components[name] = fn;
  392. this[name] = function() {
  393. var element, options;
  394. if (arguments.length) {
  395. switch(arguments.length) {
  396. case 1:
  397. if (typeof arguments[0] === "string" || arguments[0].nodeType || arguments[0] instanceof jQuery) {
  398. element = $(arguments[0]);
  399. } else {
  400. options = arguments[0];
  401. }
  402. break;
  403. case 2:
  404. element = $(arguments[0]);
  405. options = arguments[1];
  406. break;
  407. }
  408. }
  409. if (element && element.data(name)) {
  410. return element.data(name);
  411. }
  412. return (new UI.components[name](element, options));
  413. };
  414. if (UI.domready) {
  415. UI.component.boot(name);
  416. }
  417. return fn;
  418. };
  419. UI.plugin = function(component, name, def) {
  420. this.components[component].plugins[name] = def;
  421. };
  422. UI.component.boot = function(name) {
  423. if (UI.components[name].prototype && UI.components[name].prototype.boot && !UI.components[name].booted) {
  424. UI.components[name].prototype.boot.apply(UI, []);
  425. UI.components[name].booted = true;
  426. }
  427. };
  428. UI.component.bootComponents = function() {
  429. for (var component in UI.components) {
  430. UI.component.boot(component);
  431. }
  432. };
  433. // DOM mutation save ready helper function
  434. UI.domObservers = [];
  435. UI.domready = false;
  436. UI.ready = function(fn) {
  437. UI.domObservers.push(fn);
  438. if (UI.domready) {
  439. fn(document);
  440. }
  441. };
  442. UI.on = function(a1,a2,a3){
  443. if (a1 && a1.indexOf('ready.uk.dom') > -1 && UI.domready) {
  444. a2.apply(UI.$doc);
  445. }
  446. return UI.$doc.on(a1,a2,a3);
  447. };
  448. UI.one = function(a1,a2,a3){
  449. if (a1 && a1.indexOf('ready.uk.dom') > -1 && UI.domready) {
  450. a2.apply(UI.$doc);
  451. return UI.$doc;
  452. }
  453. return UI.$doc.one(a1,a2,a3);
  454. };
  455. UI.trigger = function(evt, params) {
  456. return UI.$doc.trigger(evt, params);
  457. };
  458. UI.domObserve = function(selector, fn) {
  459. if(!UI.support.mutationobserver) return;
  460. fn = fn || function() {};
  461. UI.$(selector).each(function() {
  462. var element = this,
  463. $element = UI.$(element);
  464. if ($element.data('observer')) {
  465. return;
  466. }
  467. try {
  468. var observer = new UI.support.mutationobserver(UI.Utils.debounce(function(mutations) {
  469. fn.apply(element, [$element]);
  470. $element.trigger('changed.uk.dom');
  471. }, 50), {childList: true, subtree: true});
  472. // pass in the target node, as well as the observer options
  473. observer.observe(element, { childList: true, subtree: true });
  474. $element.data('observer', observer);
  475. } catch(e) {}
  476. });
  477. };
  478. UI.init = function(root) {
  479. root = root || document;
  480. UI.domObservers.forEach(function(fn){
  481. fn(root);
  482. });
  483. };
  484. UI.on('domready.uk.dom', function(){
  485. UI.init();
  486. if (UI.domready) UI.Utils.checkDisplay();
  487. });
  488. document.addEventListener('DOMContentLoaded', function(){
  489. var domReady = function() {
  490. UI.$body = UI.$('body');
  491. UI.trigger('beforeready.uk.dom');
  492. UI.component.bootComponents();
  493. // custom scroll observer
  494. var rafToken = requestAnimationFrame((function(){
  495. var memory = {dir: {x:0, y:0}, x: window.pageXOffset, y:window.pageYOffset};
  496. var fn = function(){
  497. // reading this (window.page[X|Y]Offset) causes a full page recalc of the layout in Chrome,
  498. // so we only want to do this once
  499. var wpxo = window.pageXOffset;
  500. var wpyo = window.pageYOffset;
  501. // Did the scroll position change since the last time we were here?
  502. if (memory.x != wpxo || memory.y != wpyo) {
  503. // Set the direction of the scroll and store the new position
  504. if (wpxo != memory.x) {memory.dir.x = wpxo > memory.x ? 1:-1; } else { memory.dir.x = 0; }
  505. if (wpyo != memory.y) {memory.dir.y = wpyo > memory.y ? 1:-1; } else { memory.dir.y = 0; }
  506. memory.x = wpxo;
  507. memory.y = wpyo;
  508. // Trigger the scroll event, this could probably be sent using memory.clone() but this is
  509. // more explicit and easier to see exactly what is being sent in the event.
  510. UI.$doc.trigger('scrolling.uk.document', [{
  511. dir: {x: memory.dir.x, y: memory.dir.y}, x: wpxo, y: wpyo
  512. }]);
  513. }
  514. cancelAnimationFrame(rafToken);
  515. rafToken = requestAnimationFrame(fn);
  516. };
  517. if (UI.support.touch) {
  518. UI.$html.on('touchmove touchend MSPointerMove MSPointerUp pointermove pointerup', fn);
  519. }
  520. if (memory.x || memory.y) fn();
  521. return fn;
  522. })());
  523. // run component init functions on dom
  524. UI.trigger('domready.uk.dom');
  525. if (UI.support.touch) {
  526. // remove css hover rules for touch devices
  527. // UI.Utils.removeCssRules(/\.uk-(?!navbar).*:hover/);
  528. // viewport unit fix for uk-height-viewport - should be fixed in iOS 8
  529. if (navigator.userAgent.match(/(iPad|iPhone|iPod)/g)) {
  530. UI.$win.on('load orientationchange resize', UI.Utils.debounce((function(){
  531. var fn = function() {
  532. $('.uk-height-viewport').css('height', window.innerHeight);
  533. return fn;
  534. };
  535. return fn();
  536. })(), 100));
  537. }
  538. }
  539. UI.trigger('afterready.uk.dom');
  540. // mark that domready is left behind
  541. UI.domready = true;
  542. // auto init js components
  543. if (UI.support.mutationobserver) {
  544. var initFn = UI.Utils.debounce(function(){
  545. requestAnimationFrame(function(){ UI.init(document.body);});
  546. }, 10);
  547. (new UI.support.mutationobserver(function(mutations) {
  548. var init = false;
  549. mutations.every(function(mutation){
  550. if (mutation.type != 'childList') return true;
  551. for (var i = 0, node; i < mutation.addedNodes.length; ++i) {
  552. node = mutation.addedNodes[i];
  553. if (node.outerHTML && node.outerHTML.indexOf('data-uk-') !== -1) {
  554. return (init = true) && false;
  555. }
  556. }
  557. return true;
  558. });
  559. if (init) initFn();
  560. })).observe(document.body, {childList: true, subtree: true});
  561. }
  562. };
  563. if (document.readyState == 'complete' || document.readyState == 'interactive') {
  564. setTimeout(domReady);
  565. }
  566. return domReady;
  567. }());
  568. // add touch identifier class
  569. UI.$html.addClass(UI.support.touch ? "uk-touch" : "uk-notouch");
  570. // add uk-hover class on tap to support overlays on touch devices
  571. if (UI.support.touch) {
  572. var hoverset = false,
  573. exclude,
  574. hovercls = 'uk-hover',
  575. selector = '.uk-overlay, .uk-overlay-hover, .uk-overlay-toggle, .uk-animation-hover, .uk-has-hover';
  576. UI.$html.on('mouseenter touchstart MSPointerDown pointerdown', selector, function() {
  577. if (hoverset) $('.'+hovercls).removeClass(hovercls);
  578. hoverset = $(this).addClass(hovercls);
  579. }).on('mouseleave touchend MSPointerUp pointerup', function(e) {
  580. exclude = $(e.target).parents(selector);
  581. if (hoverset) {
  582. hoverset.not(exclude).removeClass(hovercls);
  583. }
  584. });
  585. }
  586. return UI;
  587. });
  588. // Based on Zeptos touch.js
  589. // https://raw.github.com/madrobby/zepto/master/src/touch.js
  590. // Zepto.js may be freely distributed under the MIT license.
  591. ;(function($){
  592. if ($.fn.swipeLeft) {
  593. return;
  594. }
  595. var touch = {}, touchTimeout, tapTimeout, swipeTimeout, longTapTimeout, longTapDelay = 750, gesture;
  596. function swipeDirection(x1, x2, y1, y2) {
  597. return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down');
  598. }
  599. function longTap() {
  600. longTapTimeout = null;
  601. if (touch.last) {
  602. if ( touch.el !== undefined ) touch.el.trigger('longTap');
  603. touch = {};
  604. }
  605. }
  606. function cancelLongTap() {
  607. if (longTapTimeout) clearTimeout(longTapTimeout);
  608. longTapTimeout = null;
  609. }
  610. function cancelAll() {
  611. if (touchTimeout) clearTimeout(touchTimeout);
  612. if (tapTimeout) clearTimeout(tapTimeout);
  613. if (swipeTimeout) clearTimeout(swipeTimeout);
  614. if (longTapTimeout) clearTimeout(longTapTimeout);
  615. touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null;
  616. touch = {};
  617. }
  618. function isPrimaryTouch(event){
  619. return event.pointerType == event.MSPOINTER_TYPE_TOUCH && event.isPrimary;
  620. }
  621. $(function(){
  622. var now, delta, deltaX = 0, deltaY = 0, firstTouch;
  623. if ('MSGesture' in window) {
  624. gesture = new MSGesture();
  625. gesture.target = document.body;
  626. }
  627. $(document)
  628. .on('MSGestureEnd gestureend', function(e){
  629. var swipeDirectionFromVelocity = e.originalEvent.velocityX > 1 ? 'Right' : e.originalEvent.velocityX < -1 ? 'Left' : e.originalEvent.velocityY > 1 ? 'Down' : e.originalEvent.velocityY < -1 ? 'Up' : null;
  630. if (swipeDirectionFromVelocity && touch.el !== undefined) {
  631. touch.el.trigger('swipe');
  632. touch.el.trigger('swipe'+ swipeDirectionFromVelocity);
  633. }
  634. })
  635. // MSPointerDown: for IE10
  636. // pointerdown: for IE11
  637. .on('touchstart MSPointerDown pointerdown', function(e){
  638. if(e.type == 'MSPointerDown' && !isPrimaryTouch(e.originalEvent)) return;
  639. firstTouch = (e.type == 'MSPointerDown' || e.type == 'pointerdown') ? e : e.originalEvent.touches[0];
  640. now = Date.now();
  641. delta = now - (touch.last || now);
  642. touch.el = $('tagName' in firstTouch.target ? firstTouch.target : firstTouch.target.parentNode);
  643. if(touchTimeout) clearTimeout(touchTimeout);
  644. touch.x1 = firstTouch.pageX;
  645. touch.y1 = firstTouch.pageY;
  646. if (delta > 0 && delta <= 250) touch.isDoubleTap = true;
  647. touch.last = now;
  648. longTapTimeout = setTimeout(longTap, longTapDelay);
  649. // adds the current touch contact for IE gesture recognition
  650. if (gesture && ( e.type == 'MSPointerDown' || e.type == 'pointerdown' || e.type == 'touchstart' ) ) {
  651. gesture.addPointer(e.originalEvent.pointerId);
  652. }
  653. })
  654. // MSPointerMove: for IE10
  655. // pointermove: for IE11
  656. .on('touchmove MSPointerMove pointermove', function(e){
  657. if (e.type == 'MSPointerMove' && !isPrimaryTouch(e.originalEvent)) return;
  658. firstTouch = (e.type == 'MSPointerMove' || e.type == 'pointermove') ? e : e.originalEvent.touches[0];
  659. cancelLongTap();
  660. touch.x2 = firstTouch.pageX;
  661. touch.y2 = firstTouch.pageY;
  662. deltaX += Math.abs(touch.x1 - touch.x2);
  663. deltaY += Math.abs(touch.y1 - touch.y2);
  664. })
  665. // MSPointerUp: for IE10
  666. // pointerup: for IE11
  667. .on('touchend MSPointerUp pointerup', function(e){
  668. if (e.type == 'MSPointerUp' && !isPrimaryTouch(e.originalEvent)) return;
  669. cancelLongTap();
  670. // swipe
  671. if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) || (touch.y2 && Math.abs(touch.y1 - touch.y2) > 30)){
  672. swipeTimeout = setTimeout(function() {
  673. if ( touch.el !== undefined ) {
  674. touch.el.trigger('swipe');
  675. touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2)));
  676. }
  677. touch = {};
  678. }, 0);
  679. // normal tap
  680. } else if ('last' in touch) {
  681. // don't fire tap when delta position changed by more than 30 pixels,
  682. // for instance when moving to a point and back to origin
  683. if (isNaN(deltaX) || (deltaX < 30 && deltaY < 30)) {
  684. // delay by one tick so we can cancel the 'tap' event if 'scroll' fires
  685. // ('tap' fires before 'scroll')
  686. tapTimeout = setTimeout(function() {
  687. // trigger universal 'tap' with the option to cancelTouch()
  688. // (cancelTouch cancels processing of single vs double taps for faster 'tap' response)
  689. var event = $.Event('tap');
  690. event.cancelTouch = cancelAll;
  691. if ( touch.el !== undefined ) touch.el.trigger(event);
  692. // trigger double tap immediately
  693. if (touch.isDoubleTap) {
  694. if ( touch.el !== undefined ) touch.el.trigger('doubleTap');
  695. touch = {};
  696. }
  697. // trigger single tap after 250ms of inactivity
  698. else {
  699. touchTimeout = setTimeout(function(){
  700. touchTimeout = null;
  701. if ( touch.el !== undefined ) touch.el.trigger('singleTap');
  702. touch = {};
  703. }, 250);
  704. }
  705. }, 0);
  706. } else {
  707. touch = {};
  708. }
  709. deltaX = deltaY = 0;
  710. }
  711. })
  712. // when the browser window loses focus,
  713. // for example when a modal dialog is shown,
  714. // cancel all ongoing events
  715. .on('touchcancel MSPointerCancel pointercancel', cancelAll);
  716. // scrolling the window indicates intention of the user
  717. // to scroll, not tap or swipe, so cancel all ongoing events
  718. $(window).on('scroll', cancelAll);
  719. });
  720. ['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown', 'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function(eventName){
  721. $.fn[eventName] = function(callback){ return $(this).on(eventName, callback); };
  722. });
  723. })(jQuery);
  724. (function(UI) {
  725. "use strict";
  726. var stacks = [];
  727. UI.component('stackMargin', {
  728. defaults: {
  729. cls: 'uk-margin-small-top',
  730. rowfirst: false,
  731. observe: false
  732. },
  733. boot: function() {
  734. // init code
  735. UI.ready(function(context) {
  736. UI.$("[data-uk-margin]", context).each(function() {
  737. var ele = UI.$(this);
  738. if (!ele.data("stackMargin")) {
  739. UI.stackMargin(ele, UI.Utils.options(ele.attr("data-uk-margin")));
  740. }
  741. });
  742. });
  743. },
  744. init: function() {
  745. var $this = this;
  746. UI.$win.on('resize orientationchange', (function() {
  747. var fn = function() {
  748. $this.process();
  749. };
  750. UI.$(function() {
  751. fn();
  752. UI.$win.on("load", fn);
  753. });
  754. return UI.Utils.debounce(fn, 20);
  755. })());
  756. this.on("display.uk.check", function(e) {
  757. if (this.element.is(":visible")) this.process();
  758. }.bind(this));
  759. if (this.options.observe) {
  760. UI.domObserve(this.element, function(e) {
  761. if ($this.element.is(":visible")) $this.process();
  762. });
  763. }
  764. stacks.push(this);
  765. },
  766. process: function() {
  767. var $this = this, columns = this.element.children();
  768. UI.Utils.stackMargin(columns, this.options);
  769. if (!this.options.rowfirst || !columns.length) {
  770. return this;
  771. }
  772. // Mark first column elements
  773. var group = {}, minleft = false;
  774. columns.removeClass(this.options.rowfirst).each(function(offset, $ele){
  775. $ele = UI.$(this);
  776. if (this.style.display != 'none') {
  777. offset = $ele.offset().left;
  778. ((group[offset] = group[offset] || []) && group[offset]).push(this);
  779. minleft = minleft === false ? offset : Math.min(minleft, offset);
  780. }
  781. });
  782. UI.$(group[minleft]).addClass(this.options.rowfirst);
  783. return this;
  784. }
  785. });
  786. // responsive element e.g. iframes
  787. (function(){
  788. var elements = [], check = function(ele) {
  789. if (!ele.is(':visible')) return;
  790. var width = ele.parent().width(),
  791. iwidth = ele.data('width'),
  792. ratio = (width / iwidth),
  793. height = Math.floor(ratio * ele.data('height'));
  794. ele.css({'height': (width < iwidth) ? height : ele.data('height')});
  795. };
  796. UI.component('responsiveElement', {
  797. defaults: {},
  798. boot: function() {
  799. // init code
  800. UI.ready(function(context) {
  801. UI.$("iframe.uk-responsive-width, [data-uk-responsive]", context).each(function() {
  802. var ele = UI.$(this), obj;
  803. if (!ele.data("responsiveElement")) {
  804. obj = UI.responsiveElement(ele, {});
  805. }
  806. });
  807. });
  808. },
  809. init: function() {
  810. var ele = this.element;
  811. if (ele.attr('width') && ele.attr('height')) {
  812. ele.data({
  813. 'width' : ele.attr('width'),
  814. 'height': ele.attr('height')
  815. }).on('display.uk.check', function(){
  816. check(ele);
  817. });
  818. check(ele);
  819. elements.push(ele);
  820. }
  821. }
  822. });
  823. UI.$win.on('resize load', UI.Utils.debounce(function(){
  824. elements.forEach(function(ele){
  825. check(ele);
  826. });
  827. }, 15));
  828. })();
  829. // helper
  830. UI.Utils.stackMargin = function(elements, options) {
  831. options = UI.$.extend({
  832. cls: 'uk-margin-small-top'
  833. }, options);
  834. elements = UI.$(elements).removeClass(options.cls);
  835. var min = false;
  836. elements.each(function(offset, height, pos, $ele){
  837. $ele = UI.$(this);
  838. if ($ele.css('display') != 'none') {
  839. offset = $ele.offset();
  840. height = $ele.outerHeight();
  841. pos = offset.top + height;
  842. $ele.data({
  843. 'ukMarginPos': pos,
  844. 'ukMarginTop': offset.top
  845. });
  846. if (min === false || (offset.top < min.top) ) {
  847. min = {
  848. top : offset.top,
  849. left : offset.left,
  850. pos : pos
  851. };
  852. }
  853. }
  854. }).each(function($ele) {
  855. $ele = UI.$(this);
  856. if ($ele.css('display') != 'none' && $ele.data('ukMarginTop') > min.top && $ele.data('ukMarginPos') > min.pos) {
  857. $ele.addClass(options.cls);
  858. }
  859. });
  860. };
  861. UI.Utils.matchHeights = function(elements, options) {
  862. elements = UI.$(elements).css('min-height', '');
  863. options = UI.$.extend({ row : true }, options);
  864. var matchHeights = function(group){
  865. if (group.length < 2) return;
  866. var max = 0;
  867. group.each(function() {
  868. max = Math.max(max, UI.$(this).outerHeight());
  869. }).each(function() {
  870. var element = UI.$(this),
  871. height = max - (element.css('box-sizing') == 'border-box' ? 0 : (element.outerHeight() - element.height()));
  872. element.css('min-height', height + 'px');
  873. });
  874. };
  875. if (options.row) {
  876. elements.first().width(); // force redraw
  877. setTimeout(function(){
  878. var lastoffset = false, group = [];
  879. elements.each(function() {
  880. var ele = UI.$(this), offset = ele.offset().top;
  881. if (offset != lastoffset && group.length) {
  882. matchHeights(UI.$(group));
  883. group = [];
  884. offset = ele.offset().top;
  885. }
  886. group.push(ele);
  887. lastoffset = offset;
  888. });
  889. if (group.length) {
  890. matchHeights(UI.$(group));
  891. }
  892. }, 0);
  893. } else {
  894. matchHeights(elements);
  895. }
  896. };
  897. (function(cacheSvgs){
  898. UI.Utils.inlineSvg = function(selector, root) {
  899. var images = UI.$(selector || 'img[src$=".svg"]', root || document).each(function(){
  900. var img = UI.$(this),
  901. src = img.attr('src');
  902. if (!cacheSvgs[src]) {
  903. var d = UI.$.Deferred();
  904. UI.$.get(src, {nc: Math.random()}, function(data){
  905. d.resolve(UI.$(data).find('svg'));
  906. });
  907. cacheSvgs[src] = d.promise();
  908. }
  909. cacheSvgs[src].then(function(svg) {
  910. var $svg = UI.$(svg).clone();
  911. if (img.attr('id')) $svg.attr('id', img.attr('id'));
  912. if (img.attr('class')) $svg.attr('class', img.attr('class'));
  913. if (img.attr('style')) $svg.attr('style', img.attr('style'));
  914. if (img.attr('width')) {
  915. $svg.attr('width', img.attr('width'));
  916. if (!img.attr('height')) $svg.removeAttr('height');
  917. }
  918. if (img.attr('height')){
  919. $svg.attr('height', img.attr('height'));
  920. if (!img.attr('width')) $svg.removeAttr('width');
  921. }
  922. img.replaceWith($svg);
  923. });
  924. });
  925. };
  926. // init code
  927. UI.ready(function(context) {
  928. UI.Utils.inlineSvg('[data-uk-svg]', context);
  929. });
  930. })({});
  931. UI.Utils.getCssVar = function(name) {
  932. /* usage in css: .var-name:before { content:"xyz" } */
  933. var val, doc = document.documentElement, element = doc.appendChild(document.createElement('div'));
  934. element.classList.add('var-'+name);
  935. try {
  936. val = JSON.parse(val = getComputedStyle(element, ':before').content.replace(/^["'](.*)["']$/, '$1'));
  937. } catch (e) {
  938. val = undefined;
  939. }
  940. doc.removeChild(element);
  941. return val;
  942. }
  943. })(UIkit);
  944. (function(UI) {
  945. "use strict";
  946. UI.component('smoothScroll', {
  947. boot: function() {
  948. // init code
  949. UI.$html.on("click.smooth-scroll.uikit", "[data-uk-smooth-scroll]", function(e) {
  950. var ele = UI.$(this);
  951. if (!ele.data("smoothScroll")) {
  952. var obj = UI.smoothScroll(ele, UI.Utils.options(ele.attr("data-uk-smooth-scroll")));
  953. ele.trigger("click");
  954. }
  955. return false;
  956. });
  957. },
  958. init: function() {
  959. var $this = this;
  960. this.on("click", function(e) {
  961. e.preventDefault();
  962. scrollToElement(UI.$(this.hash).length ? UI.$(this.hash) : UI.$("body"), $this.options);
  963. });
  964. }
  965. });
  966. function scrollToElement(ele, options) {
  967. options = UI.$.extend({
  968. duration: 1000,
  969. transition: 'easeOutExpo',
  970. offset: 0,
  971. complete: function(){}
  972. }, options);
  973. // get / set parameters
  974. var target = ele.offset().top - options.offset,
  975. docheight = UI.$doc.height(),
  976. winheight = window.innerHeight;
  977. if ((target + winheight) > docheight) {
  978. target = docheight - winheight;
  979. }
  980. // animate to target, fire callback when done
  981. UI.$("html,body").stop().animate({scrollTop: target}, options.duration, options.transition).promise().done(options.complete);
  982. }
  983. UI.Utils.scrollToElement = scrollToElement;
  984. if (!UI.$.easing.easeOutExpo) {
  985. UI.$.easing.easeOutExpo = function(x, t, b, c, d) { return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b; };
  986. }
  987. })(UIkit);
  988. (function(UI) {
  989. "use strict";
  990. var $win = UI.$win,
  991. $doc = UI.$doc,
  992. scrollspies = [],
  993. checkScrollSpy = function() {
  994. for(var i=0; i < scrollspies.length; i++) {
  995. window.requestAnimationFrame.apply(window, [scrollspies[i].check]);
  996. }
  997. };
  998. UI.component('scrollspy', {
  999. defaults: {
  1000. target : false,
  1001. cls : "uk-scrollspy-inview",
  1002. initcls : "uk-scrollspy-init-inview",
  1003. topoffset : 0,
  1004. leftoffset : 0,
  1005. repeat : false,
  1006. delay : 0
  1007. },
  1008. boot: function() {
  1009. // listen to scroll and resize
  1010. $doc.on("scrolling.uk.document", checkScrollSpy);
  1011. $win.on("load resize orientationchange", UI.Utils.debounce(checkScrollSpy, 50));
  1012. // init code
  1013. UI.ready(function(context) {
  1014. UI.$("[data-uk-scrollspy]", context).each(function() {
  1015. var element = UI.$(this);
  1016. if (!element.data("scrollspy")) {
  1017. var obj = UI.scrollspy(element, UI.Utils.options(element.attr("data-uk-scrollspy")));
  1018. }
  1019. });
  1020. });
  1021. },
  1022. init: function() {
  1023. var $this = this, inviewstate, initinview, togglecls = this.options.cls.split(/,/), fn = function(){
  1024. var elements = $this.options.target ? $this.element.find($this.options.target) : $this.element,
  1025. delayIdx = elements.length === 1 ? 1 : 0,
  1026. toggleclsIdx = 0;
  1027. elements.each(function(idx){
  1028. var element = UI.$(this),
  1029. inviewstate = element.data('inviewstate'),
  1030. inview = UI.Utils.isInView(element, $this.options),
  1031. toggle = element.data('ukScrollspyCls') || togglecls[toggleclsIdx].trim();
  1032. if (inview && !inviewstate && !element.data('scrollspy-idle')) {
  1033. if (!initinview) {
  1034. element.addClass($this.options.initcls);
  1035. $this.offset = element.offset();
  1036. initinview = true;
  1037. element.trigger("init.uk.scrollspy");
  1038. }
  1039. element.data('scrollspy-idle', setTimeout(function(){
  1040. element.addClass("uk-scrollspy-inview").toggleClass(toggle).width();
  1041. element.trigger("inview.uk.scrollspy");
  1042. element.data('scrollspy-idle', false);
  1043. element.data('inviewstate', true);
  1044. }, $this.options.delay * delayIdx));
  1045. delayIdx++;
  1046. }
  1047. if (!inview && inviewstate && $this.options.repeat) {
  1048. if (element.data('scrollspy-idle')) {
  1049. clearTimeout(element.data('scrollspy-idle'));
  1050. element.data('scrollspy-idle', false);
  1051. }
  1052. element.removeClass("uk-scrollspy-inview").toggleClass(toggle);
  1053. element.data('inviewstate', false);
  1054. element.trigger("outview.uk.scrollspy");
  1055. }
  1056. toggleclsIdx = togglecls[toggleclsIdx + 1] ? (toggleclsIdx + 1) : 0;
  1057. });
  1058. };
  1059. fn();
  1060. this.check = fn;
  1061. scrollspies.push(this);
  1062. }
  1063. });
  1064. var scrollspynavs = [],
  1065. checkScrollSpyNavs = function() {
  1066. for(var i=0; i < scrollspynavs.length; i++) {
  1067. window.requestAnimationFrame.apply(window, [scrollspynavs[i].check]);
  1068. }
  1069. };
  1070. UI.component('scrollspynav', {
  1071. defaults: {
  1072. "cls" : 'uk-active',
  1073. "closest" : false,
  1074. "topoffset" : 0,
  1075. "leftoffset" : 0,
  1076. "smoothscroll" : false
  1077. },
  1078. boot: function() {
  1079. // listen to scroll and resize
  1080. $doc.on("scrolling.uk.document", checkScrollSpyNavs);
  1081. $win.on("resize orientationchange", UI.Utils.debounce(checkScrollSpyNavs, 50));
  1082. // init code
  1083. UI.ready(function(context) {
  1084. UI.$("[data-uk-scrollspy-nav]", context).each(function() {
  1085. var element = UI.$(this);
  1086. if (!element.data("scrollspynav")) {
  1087. var obj = UI.scrollspynav(element, UI.Utils.options(element.attr("data-uk-scrollspy-nav")));
  1088. }
  1089. });
  1090. });
  1091. },
  1092. init: function() {
  1093. var ids = [],
  1094. links = this.find("a[href^='#']").each(function(){ if(this.getAttribute("href").trim()!=='#') ids.push(this.getAttribute("href")); }),
  1095. targets = UI.$(ids.join(",")),
  1096. clsActive = this.options.cls,
  1097. clsClosest = this.options.closest || this.options.closest;
  1098. var $this = this, inviews, fn = function(){
  1099. inviews = [];
  1100. for (var i=0 ; i < targets.length ; i++) {
  1101. if (UI.Utils.isInView(targets.eq(i), $this.options)) {
  1102. inviews.push(targets.eq(i));
  1103. }
  1104. }
  1105. if (inviews.length) {
  1106. var navitems,
  1107. scrollTop = $win.scrollTop(),
  1108. target = (function(){
  1109. for(var i=0; i< inviews.length;i++){
  1110. if (inviews[i].offset().top - $this.options.topoffset >= scrollTop){
  1111. return inviews[i];
  1112. }
  1113. }
  1114. })();
  1115. if (!target) return;
  1116. if ($this.options.closest) {
  1117. links.blur().closest(clsClosest).removeClass(clsActive);
  1118. navitems = links.filter("a[href='#"+target.attr("id")+"']").closest(clsClosest).addClass(clsActive);
  1119. } else {
  1120. navitems = links.removeClass(clsActive).filter("a[href='#"+target.attr("id")+"']").addClass(clsActive);
  1121. }
  1122. $this.element.trigger("inview.uk.scrollspynav", [target, navitems]);
  1123. }
  1124. };
  1125. if (this.options.smoothscroll && UI.smoothScroll) {
  1126. links.each(function(){
  1127. UI.smoothScroll(this, $this.options.smoothscroll);
  1128. });
  1129. }
  1130. fn();
  1131. this.element.data("scrollspynav", this);
  1132. this.check = fn;
  1133. scrollspynavs.push(this);
  1134. }
  1135. });
  1136. })(UIkit);
  1137. (function(UI){
  1138. "use strict";
  1139. var toggles = [];
  1140. UI.component('toggle', {
  1141. defaults: {
  1142. target : false,
  1143. cls : 'uk-hidden',
  1144. animation : false,
  1145. duration : 200
  1146. },
  1147. boot: function(){
  1148. // init code
  1149. UI.ready(function(context) {
  1150. UI.$("[data-uk-toggle]", context).each(function() {
  1151. var ele = UI.$(this);
  1152. if (!ele.data("toggle")) {
  1153. var obj = UI.toggle(ele, UI.Utils.options(ele.attr("data-uk-toggle")));
  1154. }
  1155. });
  1156. setTimeout(function(){
  1157. toggles.forEach(function(toggle){
  1158. toggle.getToggles();
  1159. });
  1160. }, 0);
  1161. });
  1162. },
  1163. init: function() {
  1164. var $this = this;
  1165. this.aria = (this.options.cls.indexOf('uk-hidden') !== -1);
  1166. this.on("click", function(e) {
  1167. if ($this.element.is('a[href="javascript:void(0);"]')) {
  1168. e.preventDefault();
  1169. }
  1170. $this.toggle();
  1171. });
  1172. toggles.push(this);
  1173. },
  1174. toggle: function() {
  1175. this.getToggles();
  1176. if(!this.totoggle.length) return;
  1177. if (this.options.animation && UI.support.animation) {
  1178. var $this = this, animations = this.options.animation.split(',');
  1179. if (animations.length == 1) {
  1180. animations[1] = animations[0];
  1181. }
  1182. animations[0] = animations[0].trim();
  1183. animations[1] = animations[1].trim();
  1184. this.totoggle.css('animation-duration', this.options.duration+'ms');
  1185. this.totoggle.each(function(){
  1186. var ele = UI.$(this);
  1187. if (ele.hasClass($this.options.cls)) {
  1188. ele.toggleClass($this.options.cls);
  1189. UI.Utils.animate(ele, animations[0]).then(function(){
  1190. ele.css('animation-duration', '');
  1191. UI.Utils.checkDisplay(ele);
  1192. });
  1193. } else {
  1194. UI.Utils.animate(this, animations[1]+' uk-animation-reverse').then(function(){
  1195. ele.toggleClass($this.options.cls).css('animation-duration', '');
  1196. UI.Utils.checkDisplay(ele);
  1197. });
  1198. }
  1199. });
  1200. } else {
  1201. this.totoggle.toggleClass(this.options.cls);
  1202. UI.Utils.checkDisplay(this.totoggle);
  1203. }
  1204. this.updateAria();
  1205. },
  1206. getToggles: function() {
  1207. this.totoggle = this.options.target ? UI.$(this.options.target):[];
  1208. this.updateAria();
  1209. },
  1210. updateAria: function() {
  1211. if (this.aria && this.totoggle.length) {
  1212. this.totoggle.not('[aria-hidden]').each(function(){
  1213. UI.$(this).attr('aria-hidden', UI.$(this).hasClass('uk-hidden'));
  1214. });
  1215. }
  1216. }
  1217. });
  1218. })(UIkit);
  1219. (function(UI) {
  1220. "use strict";
  1221. UI.component('alert', {
  1222. defaults: {
  1223. fade: true,
  1224. duration: 200,
  1225. trigger: '.uk-alert-close'
  1226. },
  1227. boot: function() {
  1228. // init code
  1229. UI.$html.on("click.alert.uikit", "[data-uk-alert]", function(e) {
  1230. var ele = UI.$(this);
  1231. if (!ele.data("alert")) {
  1232. var alert = UI.alert(ele, UI.Utils.options(ele.attr("data-uk-alert")));
  1233. if (UI.$(e.target).is(alert.options.trigger)) {
  1234. e.preventDefault();
  1235. alert.close();
  1236. }
  1237. }
  1238. });
  1239. },
  1240. init: function() {
  1241. var $this = this;
  1242. this.on("click", this.options.trigger, function(e) {
  1243. e.preventDefault();
  1244. $this.close();
  1245. });
  1246. },
  1247. close: function() {
  1248. var element = this.trigger("close.uk.alert"),
  1249. removeElement = function () {
  1250. this.trigger("closed.uk.alert").remove();
  1251. }.bind(this);
  1252. if (this.options.fade) {
  1253. element.css("overflow", "hidden").css("max-height", element.height()).animate({
  1254. "height" : 0,
  1255. "opacity" : 0,
  1256. "padding-top" : 0,
  1257. "padding-bottom" : 0,
  1258. "margin-top" : 0,
  1259. "margin-bottom" : 0
  1260. }, this.options.duration, removeElement);
  1261. } else {
  1262. removeElement();
  1263. }
  1264. }
  1265. });
  1266. })(UIkit);
  1267. (function(UI) {
  1268. "use strict";
  1269. UI.component('buttonRadio', {
  1270. defaults: {
  1271. activeClass: 'uk-active',
  1272. target: '.uk-button'
  1273. },
  1274. boot: function() {
  1275. // init code
  1276. UI.$html.on("click.buttonradio.uikit", "[data-uk-button-radio]", function(e) {
  1277. var ele = UI.$(this);
  1278. if (!ele.data("buttonRadio")) {
  1279. var obj = UI.buttonRadio(ele, UI.Utils.options(ele.attr("data-uk-button-radio"))),
  1280. target = UI.$(e.target);
  1281. if (target.is(obj.options.target)) {
  1282. target.trigger("click");
  1283. }
  1284. }
  1285. });
  1286. },
  1287. init: function() {
  1288. var $this = this;
  1289. // Init ARIA
  1290. this.find($this.options.target).attr('aria-checked', 'false').filter('.' + $this.options.activeClass).attr('aria-checked', 'true');
  1291. this.on("click", this.options.target, function(e) {
  1292. var ele = UI.$(this);
  1293. if (ele.is('a[href="javascript:void(0);"]')) e.preventDefault();
  1294. $this.find($this.options.target).not(ele).removeClass($this.options.activeClass).blur();
  1295. ele.addClass($this.options.activeClass);
  1296. // Update ARIA
  1297. $this.find($this.options.target).not(ele).attr('aria-checked', 'false');
  1298. ele.attr('aria-checked', 'true');
  1299. $this.trigger("change.uk.button", [ele]);
  1300. });
  1301. },
  1302. getSelected: function() {
  1303. return this.find('.' + this.options.activeClass);
  1304. }
  1305. });
  1306. UI.component('buttonCheckbox', {
  1307. defaults: {
  1308. activeClass: 'uk-active',
  1309. target: '.uk-button'
  1310. },
  1311. boot: function() {
  1312. UI.$html.on("click.buttoncheckbox.uikit", "[data-uk-button-checkbox]", function(e) {
  1313. var ele = UI.$(this);
  1314. if (!ele.data("buttonCheckbox")) {
  1315. var obj = UI.buttonCheckbox(ele, UI.Utils.options(ele.attr("data-uk-button-checkbox"))),
  1316. target = UI.$(e.target);
  1317. if (target.is(obj.options.target)) {
  1318. target.trigger("click");
  1319. }
  1320. }
  1321. });
  1322. },
  1323. init: function() {
  1324. var $this = this;
  1325. // Init ARIA
  1326. this.find($this.options.target).attr('aria-checked', 'false').filter('.' + $this.options.activeClass).attr('aria-checked', 'true');
  1327. this.on("click", this.options.target, function(e) {
  1328. var ele = UI.$(this);
  1329. if (ele.is('a[href="javascript:void(0);"]')) e.preventDefault();
  1330. ele.toggleClass($this.options.activeClass).blur();
  1331. // Update ARIA
  1332. ele.attr('aria-checked', ele.hasClass($this.options.activeClass));
  1333. $this.trigger("change.uk.button", [ele]);
  1334. });
  1335. },
  1336. getSelected: function() {
  1337. return this.find('.' + this.options.activeClass);
  1338. }
  1339. });
  1340. UI.component('button', {
  1341. defaults: {},
  1342. boot: function() {
  1343. UI.$html.on("click.button.uikit", "[data-uk-button]", function(e) {
  1344. var ele = UI.$(this);
  1345. if (!ele.data("button")) {
  1346. var obj = UI.button(ele, UI.Utils.options(ele.attr("data-uk-button")));
  1347. ele.trigger("click");
  1348. }
  1349. });
  1350. },
  1351. init: function() {
  1352. var $this = this;
  1353. // Init ARIA
  1354. this.element.attr('aria-pressed', this.element.hasClass("uk-active"));
  1355. this.on("click", function(e) {
  1356. if ($this.element.is('a[href="javascript:void(0);"]')) e.preventDefault();
  1357. $this.toggle();
  1358. $this.trigger("change.uk.button", [$this.element.blur().hasClass("uk-active")]);
  1359. });
  1360. },
  1361. toggle: function() {
  1362. this.element.toggleClass("uk-active");
  1363. // Update ARIA
  1364. this.element.attr('aria-pressed', this.element.hasClass("uk-active"));
  1365. }
  1366. });
  1367. })(UIkit);
  1368. (function(UI) {
  1369. "use strict";
  1370. var active = false, hoverIdle, flips = {
  1371. x: {
  1372. "bottom-left" : 'bottom-right',
  1373. "bottom-right" : 'bottom-left',
  1374. "bottom-center" : 'bottom-center',
  1375. "top-left" : 'top-right',
  1376. "top-right" : 'top-left',
  1377. "top-center" : 'top-center',
  1378. "left-top" : 'right-top',
  1379. "left-bottom" : 'right-bottom',
  1380. "left-center" : 'right-center',
  1381. "right-top" : 'left-top',
  1382. "right-bottom" : 'left-bottom',
  1383. "right-center" : 'left-center'
  1384. },
  1385. y: {
  1386. "bottom-left" : 'top-left',
  1387. "bottom-right" : 'top-right',
  1388. "bottom-center" : 'top-center',
  1389. "top-left" : 'bottom-left',
  1390. "top-right" : 'bottom-right',
  1391. "top-center" : 'bottom-center',
  1392. "left-top" : 'left-bottom',
  1393. "left-bottom" : 'left-top',
  1394. "left-center" : 'left-center',
  1395. "right-top" : 'right-bottom',
  1396. "right-bottom" : 'right-top',
  1397. "right-center" : 'right-center'
  1398. },
  1399. xy: {
  1400. "bottom-left" : 'top-right',
  1401. "bottom-right" : 'top-left',
  1402. "bottom-center" : 'top-center',
  1403. "top-left" : 'bottom-right',
  1404. "top-right" : 'bottom-left',
  1405. "top-center" : 'bottom-center',
  1406. "left-top" : 'right-bottom',
  1407. "left-bottom" : 'right-top',
  1408. "left-center" : 'right-center',
  1409. "right-top" : 'left-bottom',
  1410. "right-bottom" : 'left-top',
  1411. "right-center" : 'left-center'
  1412. }
  1413. };
  1414. UI.component('dropdown', {
  1415. defaults: {
  1416. mode : 'hover',
  1417. pos : 'bottom-left',
  1418. offset : 0,
  1419. remaintime : 800,
  1420. justify : false,
  1421. boundary : UI.$win,
  1422. delay : 0,
  1423. dropdownSelector: '.uk-dropdown,.uk-dropdown-blank',
  1424. hoverDelayIdle : 250,
  1425. preventflip : false
  1426. },
  1427. remainIdle: false,
  1428. boot: function() {
  1429. var triggerevent = UI.support.touch ? "click" : "mouseenter";
  1430. // init code
  1431. UI.$html.on(triggerevent+".dropdown.uikit focus", "[data-uk-dropdown]", function(e) {
  1432. var ele = UI.$(this);
  1433. if (!ele.data("dropdown")) {
  1434. var dropdown = UI.dropdown(ele, UI.Utils.options(ele.attr("data-uk-dropdown")));
  1435. if (triggerevent=="click" || (triggerevent=="mouseenter" && dropdown.options.mode=="hover")) {
  1436. dropdown.element.trigger(triggerevent);
  1437. }
  1438. if (dropdown.element.find(dropdown.options.dropdownSelector).length) {
  1439. e.preventDefault();
  1440. }
  1441. }
  1442. });
  1443. },
  1444. init: function() {
  1445. var $this = this;
  1446. this.dropdown = this.find(this.options.dropdownSelector);
  1447. this.offsetParent = this.dropdown.parents().filter(function() {
  1448. return UI.$.inArray(UI.$(this).css('position'), ['relative', 'fixed', 'absolute']) !== -1;
  1449. }).slice(0,1);
  1450. this.centered = this.dropdown.hasClass('uk-dropdown-center');
  1451. this.justified = this.options.justify ? UI.$(this.options.justify) : false;
  1452. this.boundary = UI.$(this.options.boundary);
  1453. if (!this.boundary.length) {
  1454. this.boundary = UI.$win;
  1455. }
  1456. // legacy DEPRECATED!
  1457. if (this.dropdown.hasClass('uk-dropdown-up')) {
  1458. this.options.pos = 'top-left';
  1459. }
  1460. if (this.dropdown.hasClass('uk-dropdown-flip')) {
  1461. this.options.pos = this.options.pos.replace('left','right');
  1462. }
  1463. if (this.dropdown.hasClass('uk-dropdown-center')) {
  1464. this.options.pos = this.options.pos.replace(/(left|right)/,'center');
  1465. }
  1466. //-- end legacy
  1467. // Init ARIA
  1468. this.element.attr('aria-haspopup', 'true');
  1469. this.element.attr('aria-expanded', this.element.hasClass('uk-open'));
  1470. this.dropdown.attr('aria-hidden', 'true');
  1471. if (this.options.mode == "click" || UI.support.touch) {
  1472. this.on("click.uk.dropdown", function(e) {
  1473. var $target = UI.$(e.target);
  1474. if (!$target.parents($this.options.dropdownSelector).length) {
  1475. if ($target.is("a[href='javascript:void(0);']") || $target.parent().is("a[href='javascript:void(0);']") || ($this.dropdown.length && !$this.dropdown.is(":visible")) ){
  1476. e.preventDefault();
  1477. }
  1478. $target.blur();
  1479. }
  1480. if (!$this.element.hasClass('uk-open')) {
  1481. $this.show();
  1482. } else {
  1483. if (!$this.dropdown.find(e.target).length || $target.is(".uk-dropdown-close") || $target.parents(".uk-dropdown-close").length) {
  1484. $this.hide();
  1485. }
  1486. }
  1487. });
  1488. } else {
  1489. this.on("mouseenter", function(e) {
  1490. $this.trigger('pointerenter.uk.dropdown', [$this]);
  1491. if ($this.remainIdle) {
  1492. clearTimeout($this.remainIdle);
  1493. }
  1494. if (hoverIdle) {
  1495. clearTimeout(hoverIdle);
  1496. }
  1497. if (active && active == $this) {
  1498. return;
  1499. }
  1500. // pseudo manuAim
  1501. if (active && active != $this) {
  1502. hoverIdle = setTimeout(function() {
  1503. hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
  1504. }, $this.options.hoverDelayIdle);
  1505. } else {
  1506. hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
  1507. }
  1508. }).on("mouseleave", function() {
  1509. if (hoverIdle) {
  1510. clearTimeout(hoverIdle);
  1511. }
  1512. $this.remainIdle = setTimeout(function() {
  1513. if (active && active == $this) $this.hide();
  1514. }, $this.options.remaintime);
  1515. $this.trigger('pointerleave.uk.dropdown', [$this]);
  1516. }).on("click", function(e){
  1517. var $target = UI.$(e.target);
  1518. if ($this.remainIdle) {
  1519. clearTimeout($this.remainIdle);
  1520. }
  1521. if (active && active == $this) {
  1522. if (!$this.dropdown.find(e.target).length || $target.is(".uk-dropdown-close") || $target.parents(".uk-dropdown-close").length) {
  1523. $this.hide();
  1524. }
  1525. return;
  1526. }
  1527. if ($target.is("a[href='javascript:void(0);']") || $target.parent().is("a[href='javascript:void(0);']")){
  1528. e.preventDefault();
  1529. }
  1530. $this.show();
  1531. });
  1532. }
  1533. },
  1534. show: function(){
  1535. UI.$html.off("click.outer.dropdown");
  1536. if (active && active != this) {
  1537. active.hide(true);
  1538. }
  1539. if (hoverIdle) {
  1540. clearTimeout(hoverIdle);
  1541. }
  1542. this.trigger('beforeshow.uk.dropdown', [this]);
  1543. this.checkDimensions();
  1544. this.element.addClass('uk-open');
  1545. // Update ARIA
  1546. this.element.attr('aria-expanded', 'true');
  1547. this.dropdown.attr('aria-hidden', 'false');
  1548. this.trigger('show.uk.dropdown', [this]);
  1549. UI.Utils.checkDisplay(this.dropdown, true);
  1550. UI.Utils.focus(this.dropdown);
  1551. active = this;
  1552. this.registerOuterClick();
  1553. },
  1554. hide: function(force) {
  1555. this.trigger('beforehide.uk.dropdown', [this, force]);
  1556. this.element.removeClass('uk-open');
  1557. if (this.remainIdle) {
  1558. clearTimeout(this.remainIdle);
  1559. }
  1560. this.remainIdle = false;
  1561. // Update ARIA
  1562. this.element.attr('aria-expanded', 'false');
  1563. this.dropdown.attr('aria-hidden', 'true');
  1564. this.trigger('hide.uk.dropdown', [this, force]);
  1565. if (active == this) active = false;
  1566. },
  1567. registerOuterClick: function(){
  1568. var $this = this;
  1569. UI.$html.off("click.outer.dropdown");
  1570. setTimeout(function() {
  1571. UI.$html.on("click.outer.dropdown", function(e) {
  1572. if (hoverIdle) {
  1573. clearTimeout(hoverIdle);
  1574. }
  1575. var $target = UI.$(e.target);
  1576. if (active == $this && !$this.element.find(e.target).length) {
  1577. $this.hide(true);
  1578. UI.$html.off("click.outer.dropdown");
  1579. }
  1580. });
  1581. }, 10);
  1582. },
  1583. checkDimensions: function() {
  1584. if (!this.dropdown.length) return;
  1585. // reset
  1586. this.dropdown.removeClass('uk-dropdown-top uk-dropdown-bottom uk-dropdown-left uk-dropdown-right uk-dropdown-stack').css({
  1587. 'top-left':'',
  1588. 'left':'',
  1589. 'margin-left' :'',
  1590. 'margin-right':''
  1591. });
  1592. if (this.justified && this.justified.length) {
  1593. this.dropdown.css("min-width", "");
  1594. }
  1595. var $this = this,
  1596. pos = UI.$.extend({}, this.offsetParent.offset(), {width: this.offsetParent[0].offsetWidth, height: this.offsetParent[0].offsetHeight}),
  1597. posoffset = this.options.offset,
  1598. dropdown = this.dropdown,
  1599. offset = dropdown.show().offset() || {left: 0, top: 0},
  1600. width = dropdown.outerWidth(),
  1601. height = dropdown.outerHeight(),
  1602. boundarywidth = this.boundary.width(),
  1603. boundaryoffset = this.boundary[0] !== window && this.boundary.offset() ? this.boundary.offset(): {top:0, left:0},
  1604. dpos = this.options.pos;
  1605. var variants = {
  1606. "bottom-left" : {top: 0 + pos.height + posoffset, left: 0},
  1607. "bottom-right" : {top: 0 + pos.height + posoffset, left: 0 + pos.width - width},
  1608. "bottom-center" : {top: 0 + pos.height + posoffset, left: 0 + pos.width / 2 - width / 2},
  1609. "top-left" : {top: 0 - height - posoffset, left: 0},
  1610. "top-right" : {top: 0 - height - posoffset, left: 0 + pos.width - width},
  1611. "top-center" : {top: 0 - height - posoffset, left: 0 + pos.width / 2 - width / 2},
  1612. "left-top" : {top: 0, left: 0 - width - posoffset},
  1613. "left-bottom" : {top: 0 + pos.height - height, left: 0 - width - posoffset},
  1614. "left-center" : {top: 0 + pos.height / 2 - height / 2, left: 0 - width - posoffset},
  1615. "right-top" : {top: 0, left: 0 + pos.width + posoffset},
  1616. "right-bottom" : {top: 0 + pos.height - height, left: 0 + pos.width + posoffset},
  1617. "right-center" : {top: 0 + pos.height / 2 - height / 2, left: 0 + pos.width + posoffset}
  1618. },
  1619. css = {},
  1620. pp;
  1621. pp = dpos.split('-');
  1622. css = variants[dpos] ? variants[dpos] : variants['bottom-left'];
  1623. // justify dropdown
  1624. if (this.justified && this.justified.length) {
  1625. justify(dropdown.css({left:0}), this.justified, boundarywidth);
  1626. } else {
  1627. if (this.options.preventflip !== true) {
  1628. var fdpos;
  1629. switch(this.checkBoundary(pos.left + css.left, pos.top + css.top, width, height, boundarywidth)) {
  1630. case "x":
  1631. if(this.options.preventflip !=='x') fdpos = flips['x'][dpos] || 'right-top';
  1632. break;
  1633. case "y":
  1634. if(this.options.preventflip !=='y') fdpos = flips['y'][dpos] || 'top-left';
  1635. break;
  1636. case "xy":
  1637. if(!this.options.preventflip) fdpos = flips['xy'][dpos] || 'right-bottom';
  1638. break;
  1639. }
  1640. if (fdpos) {
  1641. pp = fdpos.split('-');
  1642. css = variants[fdpos] ? variants[fdpos] : variants['bottom-left'];
  1643. // check flipped
  1644. if (this.checkBoundary(pos.left + css.left, pos.top + css.top, width, height, boundarywidth)) {
  1645. pp = dpos.split('-');
  1646. css = variants[dpos] ? variants[dpos] : variants['bottom-left'];
  1647. }
  1648. }
  1649. }
  1650. }
  1651. if (width > boundarywidth) {
  1652. dropdown.addClass("uk-dropdown-stack");
  1653. this.trigger('stack.uk.dropdown', [this]);
  1654. }
  1655. dropdown.css(css).css("display", "").addClass('uk-dropdown-'+pp[0]);
  1656. },
  1657. checkBoundary: function(left, top, width, height, boundarywidth) {
  1658. var axis = "";
  1659. if (left < 0 || ((left - UI.$win.scrollLeft())+width) > boundarywidth) {
  1660. axis += "x";
  1661. }
  1662. if ((top - UI.$win.scrollTop()) < 0 || ((top - UI.$win.scrollTop())+height) > window.innerHeight) {
  1663. axis += "y";
  1664. }
  1665. return axis;
  1666. }
  1667. });
  1668. UI.component('dropdownOverlay', {
  1669. defaults: {
  1670. justify : false,
  1671. cls : '',
  1672. duration: 200
  1673. },
  1674. boot: function() {
  1675. // init code
  1676. UI.ready(function(context) {
  1677. UI.$("[data-uk-dropdown-overlay]", context).each(function() {
  1678. var ele = UI.$(this);
  1679. if (!ele.data("dropdownOverlay")) {
  1680. UI.dropdownOverlay(ele, UI.Utils.options(ele.attr("data-uk-dropdown-overlay")));
  1681. }
  1682. });
  1683. });
  1684. },
  1685. init: function() {
  1686. var $this = this;
  1687. this.justified = this.options.justify ? UI.$(this.options.justify) : false;
  1688. this.overlay = this.element.find('uk-dropdown-overlay');
  1689. if (!this.overlay.length) {
  1690. this.overlay = UI.$('<div class="uk-dropdown-overlay"></div>').appendTo(this.element);
  1691. }
  1692. this.overlay.addClass(this.options.cls);
  1693. this.on({
  1694. 'beforeshow.uk.dropdown': function(e, dropdown) {
  1695. $this.dropdown = dropdown;
  1696. if ($this.justified && $this.justified.length) {
  1697. justify($this.overlay.css({'display':'block', 'margin-left':'','margin-right':''}), $this.justified, $this.justified.outerWidth());
  1698. }
  1699. },
  1700. 'show.uk.dropdown': function(e, dropdown) {
  1701. var h = $this.dropdown.dropdown.outerHeight(true);
  1702. $this.dropdown.element.removeClass('uk-open');
  1703. $this.overlay.stop().css('display', 'block').animate({height: h}, $this.options.duration, function() {
  1704. $this.dropdown.dropdown.css('visibility', '');
  1705. $this.dropdown.element.addClass('uk-open');
  1706. UI.Utils.checkDisplay($this.dropdown.dropdown, true);
  1707. });
  1708. $this.pointerleave = false;
  1709. },
  1710. 'hide.uk.dropdown': function() {
  1711. $this.overlay.stop().animate({height: 0}, $this.options.duration);
  1712. },
  1713. 'pointerenter.uk.dropdown': function(e, dropdown) {
  1714. clearTimeout($this.remainIdle);
  1715. },
  1716. 'pointerleave.uk.dropdown': function(e, dropdown) {
  1717. $this.pointerleave = true;
  1718. }
  1719. });
  1720. this.overlay.on({
  1721. 'mouseenter': function() {
  1722. if ($this.remainIdle) {
  1723. clearTimeout($this.dropdown.remainIdle);
  1724. clearTimeout($this.remainIdle);
  1725. }
  1726. },
  1727. 'mouseleave': function(){
  1728. if ($this.pointerleave && active) {
  1729. $this.remainIdle = setTimeout(function() {
  1730. if(active) active.hide();
  1731. }, active.options.remaintime);
  1732. }
  1733. }
  1734. })
  1735. }
  1736. });
  1737. function justify(ele, justifyTo, boundarywidth, offset) {
  1738. ele = UI.$(ele);
  1739. justifyTo = UI.$(justifyTo);
  1740. boundarywidth = boundarywidth || window.innerWidth;
  1741. offset = offset || ele.offset();
  1742. if (justifyTo.length) {
  1743. var jwidth = justifyTo.outerWidth();
  1744. ele.css("min-width", jwidth);
  1745. if (UI.langdirection == 'right') {
  1746. var right1 = boundarywidth - (justifyTo.offset().left + jwidth),
  1747. right2 = boundarywidth - (ele.offset().left + ele.outerWidth());
  1748. ele.css("margin-right", right1 - right2);
  1749. } else {
  1750. ele.css("margin-left", justifyTo.offset().left - offset.left);
  1751. }
  1752. }
  1753. }
  1754. })(UIkit);
  1755. (function(UI) {
  1756. "use strict";
  1757. var grids = [];
  1758. UI.component('gridMatchHeight', {
  1759. defaults: {
  1760. target : false,
  1761. row : true,
  1762. ignorestacked : false,
  1763. observe : false
  1764. },
  1765. boot: function() {
  1766. // init code
  1767. UI.ready(function(context) {
  1768. UI.$("[data-uk-grid-match]", context).each(function() {
  1769. var grid = UI.$(this), obj;
  1770. if (!grid.data("gridMatchHeight")) {
  1771. obj = UI.gridMatchHeight(grid, UI.Utils.options(grid.attr("data-uk-grid-match")));
  1772. }
  1773. });
  1774. });
  1775. },
  1776. init: function() {
  1777. var $this = this;
  1778. this.columns = this.element.children();
  1779. this.elements = this.options.target ? this.find(this.options.target) : this.columns;
  1780. if (!this.columns.length) return;
  1781. UI.$win.on('load resize orientationchange', (function() {
  1782. var fn = function() {
  1783. if ($this.element.is(":visible")) $this.match();
  1784. };
  1785. UI.$(function() { fn(); });
  1786. return UI.Utils.debounce(fn, 50);
  1787. })());
  1788. if (this.options.observe) {
  1789. UI.domObserve(this.element, function(e) {
  1790. if ($this.element.is(":visible")) $this.match();
  1791. });
  1792. }
  1793. this.on("display.uk.check", function(e) {
  1794. if(this.element.is(":visible")) this.match();
  1795. }.bind(this));
  1796. grids.push(this);
  1797. },
  1798. match: function() {
  1799. var firstvisible = this.columns.filter(":visible:first");
  1800. if (!firstvisible.length) return;
  1801. var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100;
  1802. if (stacked && !this.options.ignorestacked) {
  1803. this.revert();
  1804. } else {
  1805. UI.Utils.matchHeights(this.elements, this.options);
  1806. }
  1807. return this;
  1808. },
  1809. revert: function() {
  1810. this.elements.css('min-height', '');
  1811. return this;
  1812. }
  1813. });
  1814. UI.component('gridMargin', {
  1815. defaults: {
  1816. cls : 'uk-grid-margin',
  1817. rowfirst : 'uk-row-first'
  1818. },
  1819. boot: function() {
  1820. // init code
  1821. UI.ready(function(context) {
  1822. UI.$("[data-uk-grid-margin]", context).each(function() {
  1823. var grid = UI.$(this), obj;
  1824. if (!grid.data("gridMargin")) {
  1825. obj = UI.gridMargin(grid, UI.Utils.options(grid.attr("data-uk-grid-margin")));
  1826. }
  1827. });
  1828. });
  1829. },
  1830. init: function() {
  1831. var stackMargin = UI.stackMargin(this.element, this.options);
  1832. }
  1833. });
  1834. })(UIkit);
  1835. (function(UI) {
  1836. "use strict";
  1837. var active = false, activeCount = 0, $html = UI.$html, body;
  1838. UI.$win.on("resize orientationchange", UI.Utils.debounce(function(){
  1839. UI.$('.uk-modal.uk-open').each(function(){
  1840. return UI.$(this).data('modal') && UI.$(this).data('modal').resize();
  1841. });
  1842. }, 150));
  1843. UI.component('modal', {
  1844. defaults: {
  1845. keyboard: true,
  1846. bgclose: true,
  1847. minScrollHeight: 150,
  1848. center: false,
  1849. modal: true
  1850. },
  1851. scrollable: false,
  1852. transition: false,
  1853. hasTransitioned: true,
  1854. init: function() {
  1855. if (!body) body = UI.$('body');
  1856. if (!this.element.length) return;
  1857. var $this = this;
  1858. this.paddingdir = "padding-" + (UI.langdirection == 'left' ? "right":"left");
  1859. this.dialog = this.find(".uk-modal-dialog");
  1860. this.active = false;
  1861. // Update ARIA
  1862. this.element.attr('aria-hidden', this.element.hasClass("uk-open"));
  1863. this.on("click", ".uk-modal-close", function(e) {
  1864. e.preventDefault();
  1865. $this.hide();
  1866. }).on("click", function(e) {
  1867. var target = UI.$(e.target);
  1868. if (target[0] == $this.element[0] && $this.options.bgclose) {
  1869. $this.hide();
  1870. }
  1871. });
  1872. UI.domObserve(this.element, function(e) { $this.resize(); });
  1873. },
  1874. toggle: function() {
  1875. return this[this.isActive() ? "hide" : "show"]();
  1876. },
  1877. show: function() {
  1878. if (!this.element.length) return;
  1879. var $this = this;
  1880. if (this.isActive()) return;
  1881. if (this.options.modal && active) {
  1882. active.hide(true);
  1883. }
  1884. this.element.removeClass("uk-open").show();
  1885. this.resize(true);
  1886. if (this.options.modal) {
  1887. active = this;
  1888. }
  1889. this.active = true;
  1890. activeCount++;
  1891. if (UI.support.transition) {
  1892. this.hasTransitioned = false;
  1893. this.element.one(UI.support.transition.end, function(){
  1894. $this.hasTransitioned = true;
  1895. UI.Utils.focus($this.dialog, 'a[href]');
  1896. }).addClass("uk-open");
  1897. } else {
  1898. this.element.addClass("uk-open");
  1899. UI.Utils.focus(this.dialog, 'a[href]');
  1900. }
  1901. $html.addClass("uk-modal-page").height(); // force browser engine redraw
  1902. // Update ARIA
  1903. this.element.attr('aria-hidden', 'false');
  1904. this.element.trigger("show.uk.modal");
  1905. UI.Utils.checkDisplay(this.dialog, true);
  1906. return this;
  1907. },
  1908. hide: function(force) {
  1909. if (!force && UI.support.transition && this.hasTransitioned) {
  1910. var $this = this;
  1911. this.one(UI.support.transition.end, function() {
  1912. $this._hide();
  1913. }).removeClass("uk-open");
  1914. } else {
  1915. this._hide();
  1916. }
  1917. return this;
  1918. },
  1919. resize: function(force) {
  1920. if (!this.isActive() && !force) return;
  1921. var bodywidth = body.width();
  1922. this.scrollbarwidth = window.innerWidth - bodywidth;
  1923. body.css(this.paddingdir, this.scrollbarwidth);
  1924. this.element.css('overflow-y', this.scrollbarwidth ? 'scroll' : 'auto');
  1925. if (!this.updateScrollable() && this.options.center) {
  1926. var dh = this.dialog.outerHeight(),
  1927. pad = parseInt(this.dialog.css('margin-top'), 10) + parseInt(this.dialog.css('margin-bottom'), 10);
  1928. if ((dh + pad) < window.innerHeight) {
  1929. this.dialog.css({'top': (window.innerHeight/2 - dh/2) - pad });
  1930. } else {
  1931. this.dialog.css({'top': ''});
  1932. }
  1933. }
  1934. },
  1935. updateScrollable: function() {
  1936. // has scrollable?
  1937. var scrollable = this.dialog.find('.uk-overflow-container:visible:first');
  1938. if (scrollable.length) {
  1939. scrollable.css('height', 0);
  1940. var offset = Math.abs(parseInt(this.dialog.css('margin-top'), 10)),
  1941. dh = this.dialog.outerHeight(),
  1942. wh = window.innerHeight,
  1943. h = wh - 2*(offset < 20 ? 20:offset) - dh;
  1944. scrollable.css({
  1945. 'max-height': (h < this.options.minScrollHeight ? '':h),
  1946. 'height':''
  1947. });
  1948. return true;
  1949. }
  1950. return false;
  1951. },
  1952. _hide: function() {
  1953. this.active = false;
  1954. if (activeCount > 0) activeCount--;
  1955. else activeCount = 0;
  1956. this.element.hide().removeClass('uk-open');
  1957. // Update ARIA
  1958. this.element.attr('aria-hidden', 'true');
  1959. if (!activeCount) {
  1960. $html.removeClass('uk-modal-page');
  1961. body.css(this.paddingdir, "");
  1962. }
  1963. if (active===this) active = false;
  1964. this.trigger('hide.uk.modal');
  1965. },
  1966. isActive: function() {
  1967. return this.element.hasClass('uk-open');
  1968. }
  1969. });
  1970. UI.component('modalTrigger', {
  1971. boot: function() {
  1972. // init code
  1973. UI.$html.on("click.modal.uikit", "[data-uk-modal]", function(e) {
  1974. var ele = UI.$(this);
  1975. if (ele.is("a")) {
  1976. e.preventDefault();
  1977. }
  1978. if (!ele.data("modalTrigger")) {
  1979. var modal = UI.modalTrigger(ele, UI.Utils.options(ele.attr("data-uk-modal")));
  1980. modal.show();
  1981. }
  1982. });
  1983. // close modal on esc button
  1984. UI.$html.on('keydown.modal.uikit', function (e) {
  1985. if (active && e.keyCode === 27 && active.options.keyboard) { // ESC
  1986. e.preventDefault();
  1987. active.hide();
  1988. }
  1989. });
  1990. },
  1991. init: function() {
  1992. var $this = this;
  1993. this.options = UI.$.extend({
  1994. "target": $this.element.is("a") ? $this.element.attr("href") : false
  1995. }, this.options);
  1996. this.modal = UI.modal(this.options.target, this.options);
  1997. this.on("click", function(e) {
  1998. e.preventDefault();
  1999. $this.show();
  2000. });
  2001. //methods
  2002. this.proxy(this.modal, "show hide isActive");
  2003. }
  2004. });
  2005. UI.modal.dialog = function(content, options) {
  2006. var modal = UI.modal(UI.$(UI.modal.dialog.template).appendTo("body"), options);
  2007. modal.on("hide.uk.modal", function(){
  2008. if (modal.persist) {
  2009. modal.persist.appendTo(modal.persist.data("modalPersistParent"));
  2010. modal.persist = false;
  2011. }
  2012. modal.element.remove();
  2013. });
  2014. setContent(content, modal);
  2015. return modal;
  2016. };
  2017. UI.modal.dialog.template = '<div class="uk-modal"><div class="uk-modal-dialog" style="min-height:0;"></div></div>';
  2018. UI.modal.alert = function(content, options) {
  2019. options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, options);
  2020. var modal = UI.modal.dialog(([
  2021. '<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
  2022. '<div class="uk-modal-footer uk-text-right"><button class="uk-button uk-button-primary uk-modal-close">'+options.labels.Ok+'</button></div>'
  2023. ]).join(""), options);
  2024. modal.on('show.uk.modal', function(){
  2025. setTimeout(function(){
  2026. modal.element.find('button:first').focus();
  2027. }, 50);
  2028. });
  2029. return modal.show();
  2030. };
  2031. UI.modal.confirm = function(content, onconfirm, oncancel) {
  2032. var options = arguments.length > 1 && arguments[arguments.length-1] ? arguments[arguments.length-1] : {};
  2033. onconfirm = UI.$.isFunction(onconfirm) ? onconfirm : function(){};
  2034. oncancel = UI.$.isFunction(oncancel) ? oncancel : function(){};
  2035. options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, UI.$.isFunction(options) ? {}:options);
  2036. var modal = UI.modal.dialog(([
  2037. '<div class="uk-margin uk-modal-content">'+String(content)+'</div>',
  2038. '<div class="uk-modal-footer uk-text-right"><button class="uk-button js-modal-confirm-cancel">'+options.labels.Cancel+'</button> <button class="uk-button uk-button-primary js-modal-confirm">'+options.labels.Ok+'</button></div>'
  2039. ]).join(""), options);
  2040. modal.element.find(".js-modal-confirm, .js-modal-confirm-cancel").on("click", function(){
  2041. UI.$(this).is('.js-modal-confirm') ? onconfirm() : oncancel();
  2042. modal.hide();
  2043. });
  2044. modal.on('show.uk.modal', function(){
  2045. setTimeout(function(){
  2046. modal.element.find('.js-modal-confirm').focus();
  2047. }, 50);
  2048. });
  2049. return modal.show();
  2050. };
  2051. UI.modal.prompt = function(text, value, onsubmit, options) {
  2052. onsubmit = UI.$.isFunction(onsubmit) ? onsubmit : function(value){};
  2053. options = UI.$.extend(true, {bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}, options);
  2054. var modal = UI.modal.dialog(([
  2055. text ? '<div class="uk-modal-content uk-form">'+String(text)+'</div>':'',
  2056. '<div class="uk-margin-small-top uk-modal-content uk-form"><p><input type="text" class="uk-width-1-1"></p></div>',
  2057. '<div class="uk-modal-footer uk-text-right"><button class="uk-button uk-modal-close">'+options.labels.Cancel+'</button> <button class="uk-button uk-button-primary js-modal-ok">'+options.labels.Ok+'</button></div>'
  2058. ]).join(""), options),
  2059. input = modal.element.find("input[type='text']").val(value || '').on('keyup', function(e){
  2060. if (e.keyCode == 13) {
  2061. modal.element.find(".js-modal-ok").trigger('click');
  2062. }
  2063. });
  2064. modal.element.find(".js-modal-ok").on("click", function(){
  2065. if (onsubmit(input.val())!==false){
  2066. modal.hide();
  2067. }
  2068. });
  2069. return modal.show();
  2070. };
  2071. UI.modal.blockUI = function(content, options) {
  2072. var modal = UI.modal.dialog(([
  2073. '<div class="uk-margin uk-modal-content">'+String(content || '<div class="uk-text-center">...</div>')+'</div>'
  2074. ]).join(""), UI.$.extend({bgclose:false, keyboard:false, modal:false}, options));
  2075. modal.content = modal.element.find('.uk-modal-content:first');
  2076. return modal.show();
  2077. };
  2078. UI.modal.labels = {
  2079. 'Ok': 'Ok',
  2080. 'Cancel': 'Cancel'
  2081. };
  2082. // helper functions
  2083. function setContent(content, modal){
  2084. if(!modal) return;
  2085. if (typeof content === 'object') {
  2086. // convert DOM object to a jQuery object
  2087. content = content instanceof jQuery ? content : UI.$(content);
  2088. if(content.parent().length) {
  2089. modal.persist = content;
  2090. modal.persist.data("modalPersistParent", content.parent());
  2091. }
  2092. }else if (typeof content === 'string' || typeof content === 'number') {
  2093. // just insert the data as innerHTML
  2094. content = UI.$('<div></div>').html(content);
  2095. }else {
  2096. // unsupported data type!
  2097. content = UI.$('<div></div>').html('UIkit.modal Error: Unsupported data type: ' + typeof content);
  2098. }
  2099. content.appendTo(modal.element.find('.uk-modal-dialog'));
  2100. return modal;
  2101. }
  2102. })(UIkit);
  2103. (function(UI) {
  2104. "use strict";
  2105. UI.component('nav', {
  2106. defaults: {
  2107. toggle: ">li.uk-parent > a[href='javascript:void(0);']",
  2108. lists: ">li.uk-parent > ul",
  2109. multiple: false
  2110. },
  2111. boot: function() {
  2112. // init code
  2113. UI.ready(function(context) {
  2114. UI.$("[data-uk-nav]", context).each(function() {
  2115. var nav = UI.$(this);
  2116. if (!nav.data("nav")) {
  2117. var obj = UI.nav(nav, UI.Utils.options(nav.attr("data-uk-nav")));
  2118. }
  2119. });
  2120. });
  2121. },
  2122. init: function() {
  2123. var $this = this;
  2124. this.on("click.uk.nav", this.options.toggle, function(e) {
  2125. e.preventDefault();
  2126. var ele = UI.$(this);
  2127. $this.open(ele.parent()[0] == $this.element[0] ? ele : ele.parent("li"));
  2128. });
  2129. this.update(true);
  2130. UI.domObserve(this.element, function(e) {
  2131. if ($this.element.find(this.options.lists).not('[role]').length) {
  2132. $this.update();
  2133. }
  2134. });
  2135. },
  2136. update: function(init) {
  2137. var $this = this;
  2138. this.find(this.options.lists).each(function() {
  2139. var $ele = UI.$(this).attr('role', 'menu'),
  2140. parent = $ele.closest('li'),
  2141. active = parent.hasClass("uk-active");
  2142. if (!parent.data('list-container')) {
  2143. $ele.wrap('<div style="overflow:hidden;height:0;position:relative;"></div>');
  2144. parent.data('list-container', $ele.parent()[active ? 'removeClass':'addClass']('uk-hidden'));
  2145. }
  2146. // Init ARIA
  2147. parent.attr('aria-expanded', parent.hasClass("uk-open"));
  2148. if (active) $this.open(parent, true);
  2149. });
  2150. },
  2151. open: function(li, noanimation) {
  2152. var $this = this, element = this.element, $li = UI.$(li), $container = $li.data('list-container');
  2153. if (!this.options.multiple) {
  2154. element.children('.uk-open').not(li).each(function() {
  2155. var ele = UI.$(this);
  2156. if (ele.data('list-container')) {
  2157. ele.data('list-container').stop().animate({height: 0}, function() {
  2158. UI.$(this).parent().removeClass('uk-open').end().addClass('uk-hidden');
  2159. });
  2160. }
  2161. });
  2162. }
  2163. $li.toggleClass('uk-open');
  2164. // Update ARIA
  2165. $li.attr('aria-expanded', $li.hasClass('uk-open'));
  2166. if ($container) {
  2167. if ($li.hasClass('uk-open')) {
  2168. $container.removeClass('uk-hidden');
  2169. }
  2170. if (noanimation) {
  2171. $container.stop().height($li.hasClass('uk-open') ? 'auto' : 0);
  2172. if (!$li.hasClass('uk-open')) {
  2173. $container.addClass('uk-hidden');
  2174. }
  2175. this.trigger('display.uk.check');
  2176. } else {
  2177. $container.stop().animate({
  2178. height: ($li.hasClass('uk-open') ? getHeight($container.find('ul:first')) : 0)
  2179. }, function() {
  2180. if (!$li.hasClass('uk-open')) {
  2181. $container.addClass('uk-hidden');
  2182. } else {
  2183. $container.css('height', '');
  2184. }
  2185. $this.trigger('display.uk.check');
  2186. });
  2187. }
  2188. }
  2189. }
  2190. });
  2191. // helper
  2192. function getHeight(ele) {
  2193. var $ele = UI.$(ele), height = "auto";
  2194. if ($ele.is(":visible")) {
  2195. height = $ele.outerHeight();
  2196. } else {
  2197. var tmp = {
  2198. position: $ele.css("position"),
  2199. visibility: $ele.css("visibility"),
  2200. display: $ele.css("display")
  2201. };
  2202. height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
  2203. $ele.css(tmp); // reset element
  2204. }
  2205. return height;
  2206. }
  2207. })(UIkit);
  2208. (function(UI) {
  2209. "use strict";
  2210. var scrollpos = {x: window.scrollX, y: window.scrollY},
  2211. $win = UI.$win,
  2212. $doc = UI.$doc,
  2213. $html = UI.$html,
  2214. Offcanvas = {
  2215. show: function(element, options) {
  2216. element = UI.$(element);
  2217. if (!element.length) return;
  2218. options = UI.$.extend({mode: 'push'}, options);
  2219. var $body = UI.$('body'),
  2220. bar = element.find('.uk-offcanvas-bar:first'),
  2221. rtl = (UI.langdirection == 'right'),
  2222. flip = bar.hasClass('uk-offcanvas-bar-flip') ? -1:1,
  2223. dir = flip * (rtl ? -1 : 1),
  2224. scrollbarwidth = window.innerWidth - $body.width();
  2225. scrollpos = {x: window.pageXOffset, y: window.pageYOffset};
  2226. bar.attr('mode', options.mode);
  2227. element.addClass("uk-active");
  2228. $body.css({width: window.innerWidth - scrollbarwidth, height: window.innerHeight}).addClass("uk-offcanvas-page");
  2229. if (options.mode == 'push' || options.mode == 'reveal') {
  2230. $body.css((rtl ? "margin-right" : "margin-left"), (rtl ? -1 : 1) * (bar.outerWidth() * dir));
  2231. }
  2232. if (options.mode == 'reveal') {
  2233. bar.css('clip', 'rect(0, '+bar.outerWidth()+'px, 100vh, 0)');
  2234. }
  2235. $html.css('margin-top', scrollpos.y * -1).width(); // .width() - force redraw
  2236. bar.addClass("uk-offcanvas-bar-show");
  2237. this._initElement(element);
  2238. bar.trigger('show.uk.offcanvas', [element, bar]);
  2239. // Update ARIA
  2240. element.attr('aria-hidden', 'false');
  2241. },
  2242. hide: function(force) {
  2243. var $body = UI.$('body'),
  2244. panel = UI.$(".uk-offcanvas.uk-active"),
  2245. rtl = (UI.langdirection == "right"),
  2246. bar = panel.find(".uk-offcanvas-bar:first"),
  2247. finalize = function() {
  2248. $body.removeClass("uk-offcanvas-page").css({"width": "", "height": "", "margin-left": "", "margin-right": ""});
  2249. panel.removeClass("uk-active");
  2250. bar.removeClass("uk-offcanvas-bar-show");
  2251. $html.css('margin-top', '');
  2252. window.scrollTo(scrollpos.x, scrollpos.y);
  2253. bar.trigger('hide.uk.offcanvas', [panel, bar]);
  2254. // Update ARIA
  2255. panel.attr('aria-hidden', 'true');
  2256. };
  2257. if (!panel.length) return;
  2258. if (bar.attr('mode') == 'none') force = true;
  2259. if (UI.support.transition && !force) {
  2260. $body.one(UI.support.transition.end, function() {
  2261. finalize();
  2262. }).css((rtl ? 'margin-right' : 'margin-left'), '');
  2263. if (bar.attr('mode') == 'reveal') {
  2264. bar.css('clip', '');
  2265. }
  2266. setTimeout(function(){
  2267. bar.removeClass('uk-offcanvas-bar-show');
  2268. }, 0);
  2269. } else {
  2270. finalize();
  2271. }
  2272. },
  2273. _initElement: function(element) {
  2274. if (element.data('OffcanvasInit')) return;
  2275. element.on('click.uk.offcanvas swipeRight.uk.offcanvas swipeLeft.uk.offcanvas', function(e) {
  2276. var target = UI.$(e.target);
  2277. if (!e.type.match(/swipe/)) {
  2278. if (!target.hasClass('uk-offcanvas-close')) {
  2279. if (target.hasClass('uk-offcanvas-bar')) return;
  2280. if (target.parents('.uk-offcanvas-bar:first').length) return;
  2281. }
  2282. }
  2283. e.stopImmediatePropagation();
  2284. Offcanvas.hide();
  2285. });
  2286. element.on('click', "a[href*='#']", function(e){
  2287. var link = UI.$(this),
  2288. href = link.attr('href');
  2289. if (href == '#') {
  2290. return;
  2291. }
  2292. UI.$doc.one('hide.uk.offcanvas', function() {
  2293. var target;
  2294. try {
  2295. target = UI.$(link[0].hash);
  2296. } catch (e){
  2297. target = '';
  2298. }
  2299. if (!target.length) {
  2300. target = UI.$('[name="'+link[0].hash.replace('#','')+'"]');
  2301. }
  2302. if (target.length && UI.Utils.scrollToElement) {
  2303. UI.Utils.scrollToElement(target, UI.Utils.options(link.attr('data-uk-smooth-scroll') || '{}'));
  2304. } else {
  2305. window.location.href = href;
  2306. }
  2307. });
  2308. Offcanvas.hide();
  2309. });
  2310. element.data('OffcanvasInit', true);
  2311. }
  2312. };
  2313. UI.component('offcanvasTrigger', {
  2314. boot: function() {
  2315. // init code
  2316. $html.on('click.offcanvas.uikit', '[data-uk-offcanvas]', function(e) {
  2317. e.preventDefault();
  2318. var ele = UI.$(this);
  2319. if (!ele.data('offcanvasTrigger')) {
  2320. var obj = UI.offcanvasTrigger(ele, UI.Utils.options(ele.attr('data-uk-offcanvas')));
  2321. ele.trigger("click");
  2322. }
  2323. });
  2324. $html.on('keydown.uk.offcanvas', function(e) {
  2325. if (e.keyCode === 27) { // ESC
  2326. Offcanvas.hide();
  2327. }
  2328. });
  2329. },
  2330. init: function() {
  2331. var $this = this;
  2332. this.options = UI.$.extend({
  2333. target: $this.element.is('a') ? $this.element.attr('href') : false,
  2334. mode: 'push'
  2335. }, this.options);
  2336. this.on('click', function(e) {
  2337. e.preventDefault();
  2338. Offcanvas.show($this.options.target, $this.options);
  2339. });
  2340. }
  2341. });
  2342. UI.offcanvas = Offcanvas;
  2343. })(UIkit);
  2344. (function(UI) {
  2345. "use strict";
  2346. var Animations;
  2347. UI.component('switcher', {
  2348. defaults: {
  2349. connect : false,
  2350. toggle : ">*",
  2351. active : 0,
  2352. animation : false,
  2353. duration : 200,
  2354. swiping : true
  2355. },
  2356. animating: false,
  2357. boot: function() {
  2358. // init code
  2359. UI.ready(function(context) {
  2360. UI.$("[data-uk-switcher]", context).each(function() {
  2361. var switcher = UI.$(this);
  2362. if (!switcher.data("switcher")) {
  2363. var obj = UI.switcher(switcher, UI.Utils.options(switcher.attr("data-uk-switcher")));
  2364. }
  2365. });
  2366. });
  2367. },
  2368. init: function() {
  2369. var $this = this;
  2370. this.on('click.uk.switcher', this.options.toggle, function(e) {
  2371. e.preventDefault();
  2372. $this.show(this);
  2373. });
  2374. if (!this.options.connect) {
  2375. return;
  2376. }
  2377. this.connect = UI.$(this.options.connect);
  2378. if (!this.connect.length) {
  2379. return;
  2380. }
  2381. this.connect.on('click.uk.switcher', '[data-uk-switcher-item]', function(e) {
  2382. e.preventDefault();
  2383. var item = UI.$(this).attr('data-uk-switcher-item');
  2384. if ($this.index == item) return;
  2385. switch(item) {
  2386. case 'next':
  2387. case 'previous':
  2388. $this.show($this.index + (item=='next' ? 1:-1));
  2389. break;
  2390. default:
  2391. $this.show(parseInt(item, 10));
  2392. }
  2393. });
  2394. if (this.options.swiping) {
  2395. this.connect.on('swipeRight swipeLeft', function(e) {
  2396. e.preventDefault();
  2397. if (!window.getSelection().toString()) {
  2398. $this.show($this.index + (e.type == 'swipeLeft' ? 1 : -1));
  2399. }
  2400. });
  2401. }
  2402. this.update();
  2403. },
  2404. update: function() {
  2405. this.connect.children().removeClass('uk-active').attr('aria-hidden', 'true');
  2406. var toggles = this.find(this.options.toggle),
  2407. active = toggles.filter(".uk-active");
  2408. if (active.length) {
  2409. this.show(active, false);
  2410. } else {
  2411. if (this.options.active===false) return;
  2412. active = toggles.eq(this.options.active);
  2413. this.show(active.length ? active : toggles.eq(0), false);
  2414. }
  2415. // Init ARIA for toggles
  2416. toggles.not(active).attr('aria-expanded', 'false');
  2417. active.attr('aria-expanded', 'true');
  2418. },
  2419. show: function(tab, animate) {
  2420. if (this.animating) {
  2421. return;
  2422. }
  2423. if (isNaN(tab)) {
  2424. tab = UI.$(tab);
  2425. } else {
  2426. var toggles = this.find(this.options.toggle);
  2427. tab = tab < 0 ? toggles.length-1 : tab;
  2428. tab = toggles.eq(toggles[tab] ? tab : 0);
  2429. }
  2430. var $this = this,
  2431. toggles = this.find(this.options.toggle),
  2432. active = UI.$(tab),
  2433. animation = Animations[this.options.animation] || function(current, next) {
  2434. if (!$this.options.animation) {
  2435. return Animations.none.apply($this);
  2436. }
  2437. var anim = $this.options.animation.split(',');
  2438. if (anim.length == 1) {
  2439. anim[1] = anim[0];
  2440. }
  2441. anim[0] = anim[0].trim();
  2442. anim[1] = anim[1].trim();
  2443. return coreAnimation.apply($this, [anim, current, next]);
  2444. };
  2445. if (animate===false || !UI.support.animation) {
  2446. animation = Animations.none;
  2447. }
  2448. if (active.hasClass("uk-disabled")) return;
  2449. // Update ARIA for Toggles
  2450. toggles.attr('aria-expanded', 'false');
  2451. active.attr('aria-expanded', 'true');
  2452. toggles.filter(".uk-active").removeClass("uk-active");
  2453. active.addClass("uk-active");
  2454. if (this.options.connect && this.connect.length) {
  2455. this.index = this.find(this.options.toggle).index(active);
  2456. if (this.index == -1 ) {
  2457. this.index = 0;
  2458. }
  2459. this.connect.each(function() {
  2460. var container = UI.$(this),
  2461. children = UI.$(container.children()),
  2462. current = UI.$(children.filter('.uk-active')),
  2463. next = UI.$(children.eq($this.index));
  2464. $this.animating = true;
  2465. animation.apply($this, [current, next]).then(function(){
  2466. current.removeClass("uk-active");
  2467. next.addClass("uk-active");
  2468. // Update ARIA for connect
  2469. current.attr('aria-hidden', 'true');
  2470. next.attr('aria-hidden', 'false');
  2471. UI.Utils.checkDisplay(next, true);
  2472. $this.animating = false;
  2473. });
  2474. });
  2475. }
  2476. this.trigger("show.uk.switcher", [active]);
  2477. }
  2478. });
  2479. Animations = {
  2480. 'none': function() {
  2481. var d = UI.$.Deferred();
  2482. d.resolve();
  2483. return d.promise();
  2484. },
  2485. 'fade': function(current, next) {
  2486. return coreAnimation.apply(this, ['uk-animation-fade', current, next]);
  2487. },
  2488. 'slide-bottom': function(current, next) {
  2489. return coreAnimation.apply(this, ['uk-animation-slide-bottom', current, next]);
  2490. },
  2491. 'slide-top': function(current, next) {
  2492. return coreAnimation.apply(this, ['uk-animation-slide-top', current, next]);
  2493. },
  2494. 'slide-vertical': function(current, next, dir) {
  2495. var anim = ['uk-animation-slide-top', 'uk-animation-slide-bottom'];
  2496. if (current && current.index() > next.index()) {
  2497. anim.reverse();
  2498. }
  2499. return coreAnimation.apply(this, [anim, current, next]);
  2500. },
  2501. 'slide-left': function(current, next) {
  2502. return coreAnimation.apply(this, ['uk-animation-slide-left', current, next]);
  2503. },
  2504. 'slide-right': function(current, next) {
  2505. return coreAnimation.apply(this, ['uk-animation-slide-right', current, next]);
  2506. },
  2507. 'slide-horizontal': function(current, next, dir) {
  2508. var anim = ['uk-animation-slide-right', 'uk-animation-slide-left'];
  2509. if (current && current.index() > next.index()) {
  2510. anim.reverse();
  2511. }
  2512. return coreAnimation.apply(this, [anim, current, next]);
  2513. },
  2514. 'scale': function(current, next) {
  2515. return coreAnimation.apply(this, ['uk-animation-scale-up', current, next]);
  2516. }
  2517. };
  2518. UI.switcher.animations = Animations;
  2519. // helpers
  2520. function coreAnimation(cls, current, next) {
  2521. var d = UI.$.Deferred(), clsIn = cls, clsOut = cls, release;
  2522. if (next[0]===current[0]) {
  2523. d.resolve();
  2524. return d.promise();
  2525. }
  2526. if (typeof(cls) == 'object') {
  2527. clsIn = cls[0];
  2528. clsOut = cls[1] || cls[0];
  2529. }
  2530. UI.$body.css('overflow-x', 'hidden'); // fix scroll jumping in iOS
  2531. release = function() {
  2532. if (current) current.hide().removeClass('uk-active '+clsOut+' uk-animation-reverse');
  2533. next.addClass(clsIn).one(UI.support.animation.end, function() {
  2534. setTimeout(function () {
  2535. next.removeClass(''+clsIn+'').css({opacity:'', display:''});
  2536. }, 0);
  2537. d.resolve();
  2538. UI.$body.css('overflow-x', '');
  2539. if (current) current.css({opacity:'', display:''});
  2540. }.bind(this)).show();
  2541. };
  2542. next.css('animation-duration', this.options.duration+'ms');
  2543. if (current && current.length) {
  2544. current.css('animation-duration', this.options.duration+'ms');
  2545. current.css('display', 'none').addClass(clsOut+' uk-animation-reverse').one(UI.support.animation.end, function() {
  2546. release();
  2547. }.bind(this)).css('display', '');
  2548. } else {
  2549. next.addClass('uk-active');
  2550. release();
  2551. }
  2552. return d.promise();
  2553. }
  2554. })(UIkit);
  2555. (function(UI) {
  2556. "use strict";
  2557. UI.component('tab', {
  2558. defaults: {
  2559. target : '>li:not(.uk-tab-responsive, .uk-disabled)',
  2560. connect : false,
  2561. active : 0,
  2562. animation : false,
  2563. duration : 200,
  2564. swiping : true
  2565. },
  2566. boot: function() {
  2567. // init code
  2568. UI.ready(function(context) {
  2569. UI.$("[data-uk-tab]", context).each(function() {
  2570. var tab = UI.$(this);
  2571. if (!tab.data("tab")) {
  2572. var obj = UI.tab(tab, UI.Utils.options(tab.attr("data-uk-tab")));
  2573. }
  2574. });
  2575. });
  2576. },
  2577. init: function() {
  2578. var $this = this;
  2579. this.current = false;
  2580. this.on("click.uk.tab", this.options.target, function(e) {
  2581. e.preventDefault();
  2582. if ($this.switcher && $this.switcher.animating) {
  2583. return;
  2584. }
  2585. var current = $this.find($this.options.target).not(this);
  2586. current.removeClass("uk-active").blur();
  2587. $this.trigger("change.uk.tab", [UI.$(this).addClass("uk-active"), $this.current]);
  2588. $this.current = UI.$(this);
  2589. // Update ARIA
  2590. if (!$this.options.connect) {
  2591. current.attr('aria-expanded', 'false');
  2592. UI.$(this).attr('aria-expanded', 'true');
  2593. }
  2594. });
  2595. if (this.options.connect) {
  2596. this.connect = UI.$(this.options.connect);
  2597. }
  2598. // init responsive tab
  2599. this.responsivetab = UI.$('<li class="uk-tab-responsive uk-active"><a></a></li>').append('<div class="uk-dropdown uk-dropdown-small"><ul class="uk-nav uk-nav-dropdown"></ul><div>');
  2600. this.responsivetab.dropdown = this.responsivetab.find('.uk-dropdown');
  2601. this.responsivetab.lst = this.responsivetab.dropdown.find('ul');
  2602. this.responsivetab.caption = this.responsivetab.find('a:first');
  2603. if (this.element.hasClass("uk-tab-bottom")) this.responsivetab.dropdown.addClass("uk-dropdown-up");
  2604. // handle click
  2605. this.responsivetab.lst.on('click.uk.tab', 'a', function(e) {
  2606. e.preventDefault();
  2607. e.stopPropagation();
  2608. var link = UI.$(this);
  2609. $this.element.children('li:not(.uk-tab-responsive)').eq(link.data('index')).trigger('click');
  2610. });
  2611. this.on('show.uk.switcher change.uk.tab', function(e, tab) {
  2612. $this.responsivetab.caption.html(tab.text());
  2613. });
  2614. this.element.append(this.responsivetab);
  2615. // init UIkit components
  2616. if (this.options.connect) {
  2617. this.switcher = UI.switcher(this.element, {
  2618. 'toggle' : '>li:not(.uk-tab-responsive)',
  2619. 'connect' : this.options.connect,
  2620. 'active' : this.options.active,
  2621. 'animation' : this.options.animation,
  2622. 'duration' : this.options.duration,
  2623. 'swiping' : this.options.swiping
  2624. });
  2625. }
  2626. UI.dropdown(this.responsivetab, {"mode": "click", "preventflip": "y"});
  2627. // init
  2628. $this.trigger("change.uk.tab", [this.element.find(this.options.target).not('.uk-tab-responsive').filter('.uk-active')]);
  2629. this.check();
  2630. UI.$win.on('resize orientationchange', UI.Utils.debounce(function(){
  2631. if ($this.element.is(":visible")) $this.check();
  2632. }, 100));
  2633. this.on('display.uk.check', function(){
  2634. if ($this.element.is(":visible")) $this.check();
  2635. });
  2636. },
  2637. check: function() {
  2638. var children = this.element.children('li:not(.uk-tab-responsive)').removeClass('uk-hidden');
  2639. if (!children.length) {
  2640. this.responsivetab.addClass('uk-hidden');
  2641. return;
  2642. }
  2643. var top = (children.eq(0).offset().top + Math.ceil(children.eq(0).height()/2)),
  2644. doresponsive = false,
  2645. item, link, clone;
  2646. this.responsivetab.lst.empty();
  2647. children.each(function(){
  2648. if (UI.$(this).offset().top > top) {
  2649. doresponsive = true;
  2650. }
  2651. });
  2652. if (doresponsive) {
  2653. for (var i = 0; i < children.length; i++) {
  2654. item = UI.$(children.eq(i));
  2655. link = item.find('a');
  2656. if (item.css('float') != 'none' && !item.attr('uk-dropdown')) {
  2657. if (!item.hasClass('uk-disabled')) {
  2658. clone = item[0].outerHTML.replace('<a ', '<a data-index="'+i+'" ');
  2659. this.responsivetab.lst.append(clone);
  2660. }
  2661. item.addClass('uk-hidden');
  2662. }
  2663. }
  2664. }
  2665. this.responsivetab[this.responsivetab.lst.children('li').length ? 'removeClass':'addClass']('uk-hidden');
  2666. }
  2667. });
  2668. })(UIkit);
  2669. (function(UI){
  2670. "use strict";
  2671. UI.component('cover', {
  2672. defaults: {
  2673. automute : true
  2674. },
  2675. boot: function() {
  2676. // auto init
  2677. UI.ready(function(context) {
  2678. UI.$("[data-uk-cover]", context).each(function(){
  2679. var ele = UI.$(this);
  2680. if(!ele.data("cover")) {
  2681. var plugin = UI.cover(ele, UI.Utils.options(ele.attr("data-uk-cover")));
  2682. }
  2683. });
  2684. });
  2685. },
  2686. init: function() {
  2687. this.parent = this.element.parent();
  2688. UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(){
  2689. this.check();
  2690. }.bind(this), 100));
  2691. this.on("display.uk.check", function(e) {
  2692. if(this.element.is(":visible")) this.check();
  2693. }.bind(this));
  2694. this.check();
  2695. if (this.element.is('iframe') && this.options.automute) {
  2696. var src = this.element.attr('src');
  2697. this.element.attr('src', '').on('load', function(){
  2698. this.contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}', '*');
  2699. }).attr('src', [src, (src.indexOf('?') > -1 ? '&':'?'), 'enablejsapi=1&api=1'].join(''));
  2700. }
  2701. },
  2702. check: function() {
  2703. this.element.css({
  2704. width : '',
  2705. height : ''
  2706. });
  2707. this.dimension = {w: this.element.width(), h: this.element.height()};
  2708. if (this.element.attr('width') && !isNaN(this.element.attr('width'))) {
  2709. this.dimension.w = this.element.attr('width');
  2710. }
  2711. if (this.element.attr('height') && !isNaN(this.element.attr('height'))) {
  2712. this.dimension.h = this.element.attr('height');
  2713. }
  2714. this.ratio = this.dimension.w / this.dimension.h;
  2715. var w = this.parent.width(), h = this.parent.height(), width, height;
  2716. // if element height < parent height (gap underneath)
  2717. if ((w / this.ratio) < h) {
  2718. width = Math.ceil(h * this.ratio);
  2719. height = h;
  2720. // element width < parent width (gap to right)
  2721. } else {
  2722. width = w;
  2723. height = Math.ceil(w / this.ratio);
  2724. }
  2725. this.element.css({
  2726. 'width' : width,
  2727. 'height' : height
  2728. });
  2729. }
  2730. });
  2731. })(UIkit);
  2732. /*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  2733. (function(addon) {
  2734. var component;
  2735. if (window.UIkit) {
  2736. component = addon(UIkit);
  2737. }
  2738. if (typeof define == "function" && define.amd) {
  2739. define("uikit-accordion", ["uikit"], function(){
  2740. return component || addon(UIkit);
  2741. });
  2742. }
  2743. })(function(UI){
  2744. "use strict";
  2745. UI.component('accordion', {
  2746. defaults: {
  2747. showfirst : true,
  2748. collapse : true,
  2749. animate : true,
  2750. easing : 'swing',
  2751. duration : 300,
  2752. toggle : '.uk-accordion-title',
  2753. containers : '.uk-accordion-content',
  2754. clsactive : 'uk-active'
  2755. },
  2756. boot: function() {
  2757. // init code
  2758. UI.ready(function(context) {
  2759. setTimeout(function(){
  2760. UI.$("[data-uk-accordion]", context).each(function(){
  2761. var ele = UI.$(this);
  2762. if (!ele.data("accordion")) {
  2763. UI.accordion(ele, UI.Utils.options(ele.attr('data-uk-accordion')));
  2764. }
  2765. });
  2766. }, 0);
  2767. });
  2768. },
  2769. init: function() {
  2770. var $this = this;
  2771. this.element.on('click.uk.accordion', this.options.toggle, function(e) {
  2772. e.preventDefault();
  2773. $this.toggleItem(UI.$(this).data('wrapper'), $this.options.animate, $this.options.collapse);
  2774. });
  2775. this.update(true);
  2776. UI.domObserve(this.element, function(e) {
  2777. if ($this.element.children($this.options.containers).length) {
  2778. $this.update();
  2779. }
  2780. });
  2781. },
  2782. toggleItem: function(wrapper, animated, collapse) {
  2783. var $this = this;
  2784. wrapper.data('toggle').toggleClass(this.options.clsactive);
  2785. wrapper.data('content').toggleClass(this.options.clsactive);
  2786. var active = wrapper.data('toggle').hasClass(this.options.clsactive);
  2787. if (collapse) {
  2788. this.toggle.not(wrapper.data('toggle')).removeClass(this.options.clsactive);
  2789. this.content.not(wrapper.data('content')).removeClass(this.options.clsactive)
  2790. .parent().stop().css('overflow', 'hidden').animate({ height: 0 }, {easing: this.options.easing, duration: animated ? this.options.duration : 0}).attr('aria-expanded', 'false');
  2791. }
  2792. wrapper.stop().css('overflow', 'hidden');
  2793. if (animated) {
  2794. wrapper.animate({ height: active ? getHeight(wrapper.data('content')) : 0 }, {easing: this.options.easing, duration: this.options.duration, complete: function() {
  2795. if (active) {
  2796. wrapper.css({'overflow': '', 'height': 'auto'});
  2797. UI.Utils.checkDisplay(wrapper.data('content'));
  2798. }
  2799. $this.trigger('display.uk.check');
  2800. }});
  2801. } else {
  2802. wrapper.height(active ? 'auto' : 0);
  2803. if (active) {
  2804. wrapper.css({'overflow': ''});
  2805. UI.Utils.checkDisplay(wrapper.data('content'));
  2806. }
  2807. this.trigger('display.uk.check');
  2808. }
  2809. // Update ARIA
  2810. wrapper.attr('aria-expanded', active);
  2811. this.element.trigger('toggle.uk.accordion', [active, wrapper.data('toggle'), wrapper.data('content')]);
  2812. },
  2813. update: function(init) {
  2814. var $this = this, $content, $wrapper, $toggle;
  2815. this.toggle = this.find(this.options.toggle);
  2816. this.content = this.find(this.options.containers);
  2817. this.content.each(function(index) {
  2818. $content = UI.$(this);
  2819. if ($content.parent().data('wrapper')) {
  2820. $wrapper = $content.parent();
  2821. } else {
  2822. $wrapper = UI.$(this).wrap('<div data-wrapper="true" style="overflow:hidden;height:0;position:relative;"></div>').parent();
  2823. // Init ARIA
  2824. $wrapper.attr('aria-expanded', 'false');
  2825. }
  2826. $toggle = $this.toggle.eq(index);
  2827. $wrapper.data('toggle', $toggle);
  2828. $wrapper.data('content', $content);
  2829. $toggle.data('wrapper', $wrapper);
  2830. $content.data('wrapper', $wrapper);
  2831. });
  2832. this.element.trigger('update.uk.accordion', [this]);
  2833. if (init && this.options.showfirst) {
  2834. this.toggleItem(this.toggle.eq(0).data('wrapper'), false, false);
  2835. }
  2836. }
  2837. });
  2838. // helper
  2839. function getHeight(ele) {
  2840. var $ele = UI.$(ele), height = "auto";
  2841. if ($ele.is(":visible")) {
  2842. height = $ele.outerHeight();
  2843. } else {
  2844. var tmp = {
  2845. position : $ele.css("position"),
  2846. visibility : $ele.css("visibility"),
  2847. display : $ele.css("display")
  2848. };
  2849. height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
  2850. $ele.css(tmp); // reset element
  2851. }
  2852. return height;
  2853. }
  2854. return UI.accordion;
  2855. });
  2856. /*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  2857. (function(addon) {
  2858. var component;
  2859. if (window.UIkit) {
  2860. component = addon(UIkit);
  2861. }
  2862. if (typeof define == "function" && define.amd) {
  2863. define("uikit-autocomplete", ["uikit"], function(){
  2864. return component || addon(UIkit);
  2865. });
  2866. }
  2867. })(function(UI){
  2868. "use strict";
  2869. var active;
  2870. UI.component('autocomplete', {
  2871. defaults: {
  2872. minLength: 3,
  2873. param: 'search',
  2874. method: 'post',
  2875. delay: 300,
  2876. loadingClass: 'uk-loading',
  2877. flipDropdown: false,
  2878. skipClass: 'uk-skip',
  2879. hoverClass: 'uk-active',
  2880. source: null,
  2881. renderer: null,
  2882. // template
  2883. template: '<ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a>{{$item.value}}</a></li>{{/items}}</ul>'
  2884. },
  2885. visible : false,
  2886. value : null,
  2887. selected : null,
  2888. boot: function() {
  2889. // init code
  2890. UI.$html.on("focus.autocomplete.uikit", "[data-uk-autocomplete]", function(e) {
  2891. var ele = UI.$(this);
  2892. if (!ele.data("autocomplete")) {
  2893. UI.autocomplete(ele, UI.Utils.options(ele.attr("data-uk-autocomplete")));
  2894. }
  2895. });
  2896. // register outer click for autocompletes
  2897. UI.$html.on("click.autocomplete.uikit", function(e) {
  2898. if (active && e.target!=active.input[0]) active.hide();
  2899. });
  2900. },
  2901. init: function() {
  2902. var $this = this,
  2903. select = false,
  2904. trigger = UI.Utils.debounce(function(e) {
  2905. if (select) {
  2906. return (select = false);
  2907. }
  2908. $this.handle();
  2909. }, this.options.delay);
  2910. this.dropdown = this.find('.uk-dropdown');
  2911. this.template = this.find('script[type="text/autocomplete"]').html();
  2912. this.template = UI.Utils.template(this.template || this.options.template);
  2913. this.input = this.find("input:first").attr("autocomplete", "off");
  2914. if (!this.dropdown.length) {
  2915. this.dropdown = UI.$('<div class="uk-dropdown"></div>').appendTo(this.element);
  2916. }
  2917. if (this.options.flipDropdown) {
  2918. this.dropdown.addClass('uk-dropdown-flip');
  2919. }
  2920. this.dropdown.attr('aria-expanded', 'false');
  2921. this.input.on({
  2922. keydown: function(e) {
  2923. if (e && e.which && !e.shiftKey && $this.visible) {
  2924. switch (e.which) {
  2925. case 13: // enter
  2926. select = true;
  2927. if ($this.selected) {
  2928. e.preventDefault();
  2929. $this.select();
  2930. }
  2931. break;
  2932. case 38: // up
  2933. e.preventDefault();
  2934. $this.pick('prev', true);
  2935. break;
  2936. case 40: // down
  2937. e.preventDefault();
  2938. $this.pick('next', true);
  2939. break;
  2940. case 27:
  2941. case 9: // esc, tab
  2942. $this.hide();
  2943. break;
  2944. default:
  2945. break;
  2946. }
  2947. }
  2948. },
  2949. keyup: trigger
  2950. });
  2951. this.dropdown.on("click", ".uk-autocomplete-results > *", function(){
  2952. $this.select();
  2953. });
  2954. this.dropdown.on("mouseover", ".uk-autocomplete-results > *", function(){
  2955. $this.pick(UI.$(this));
  2956. });
  2957. this.triggercomplete = trigger;
  2958. },
  2959. handle: function() {
  2960. var $this = this, old = this.value;
  2961. this.value = this.input.val();
  2962. if (this.value.length < this.options.minLength) return this.hide();
  2963. if (this.value != old) {
  2964. $this.request();
  2965. }
  2966. return this;
  2967. },
  2968. pick: function(item, scrollinview) {
  2969. var $this = this,
  2970. items = UI.$(this.dropdown.find('.uk-autocomplete-results').children(':not(.'+this.options.skipClass+')')),
  2971. selected = false;
  2972. if (typeof item !== "string" && !item.hasClass(this.options.skipClass)) {
  2973. selected = item;
  2974. } else if (item == 'next' || item == 'prev') {
  2975. if (this.selected) {
  2976. var index = items.index(this.selected);
  2977. if (item == 'next') {
  2978. selected = items.eq(index + 1 < items.length ? index + 1 : 0);
  2979. } else {
  2980. selected = items.eq(index - 1 < 0 ? items.length - 1 : index - 1);
  2981. }
  2982. } else {
  2983. selected = items[(item == 'next') ? 'first' : 'last']();
  2984. }
  2985. selected = UI.$(selected);
  2986. }
  2987. if (selected && selected.length) {
  2988. this.selected = selected;
  2989. items.removeClass(this.options.hoverClass);
  2990. this.selected.addClass(this.options.hoverClass);
  2991. // jump to selected if not in view
  2992. if (scrollinview) {
  2993. var top = selected.position().top,
  2994. scrollTop = $this.dropdown.scrollTop(),
  2995. dpheight = $this.dropdown.height();
  2996. if (top > dpheight || top < 0) {
  2997. $this.dropdown.scrollTop(scrollTop + top);
  2998. }
  2999. }
  3000. }
  3001. },
  3002. select: function() {
  3003. if(!this.selected) return;
  3004. var data = this.selected.data();
  3005. this.trigger("selectitem.uk.autocomplete", [data, this]);
  3006. if (data.value) {
  3007. this.input.val(data.value).trigger('change');
  3008. }
  3009. this.hide();
  3010. },
  3011. show: function() {
  3012. if (this.visible) return;
  3013. this.visible = true;
  3014. this.element.addClass("uk-open");
  3015. if (active && active!==this) {
  3016. active.hide();
  3017. }
  3018. active = this;
  3019. // Update aria
  3020. this.dropdown.attr('aria-expanded', 'true');
  3021. return this;
  3022. },
  3023. hide: function() {
  3024. if (!this.visible) return;
  3025. this.visible = false;
  3026. this.element.removeClass("uk-open");
  3027. if (active === this) {
  3028. active = false;
  3029. }
  3030. // Update aria
  3031. this.dropdown.attr('aria-expanded', 'false');
  3032. return this;
  3033. },
  3034. request: function() {
  3035. var $this = this,
  3036. release = function(data) {
  3037. if(data) {
  3038. $this.render(data);
  3039. }
  3040. $this.element.removeClass($this.options.loadingClass);
  3041. };
  3042. this.element.addClass(this.options.loadingClass);
  3043. if (this.options.source) {
  3044. var source = this.options.source;
  3045. switch(typeof(this.options.source)) {
  3046. case 'function':
  3047. this.options.source.apply(this, [release]);
  3048. break;
  3049. case 'object':
  3050. if(source.length) {
  3051. var items = [];
  3052. source.forEach(function(item){
  3053. if(item.value && item.value.toLowerCase().indexOf($this.value.toLowerCase())!=-1) {
  3054. items.push(item);
  3055. }
  3056. });
  3057. release(items);
  3058. }
  3059. break;
  3060. case 'string':
  3061. var params ={};
  3062. params[this.options.param] = this.value;
  3063. UI.$.ajax({
  3064. url: this.options.source,
  3065. data: params,
  3066. type: this.options.method,
  3067. dataType: 'json'
  3068. }).done(function(json) {
  3069. release(json || []);
  3070. });
  3071. break;
  3072. default:
  3073. release(null);
  3074. }
  3075. } else {
  3076. this.element.removeClass($this.options.loadingClass);
  3077. }
  3078. },
  3079. render: function(data) {
  3080. this.dropdown.empty();
  3081. this.selected = false;
  3082. if (this.options.renderer) {
  3083. this.options.renderer.apply(this, [data]);
  3084. } else if(data && data.length) {
  3085. this.dropdown.append(this.template({"items":data}));
  3086. this.show();
  3087. this.trigger('show.uk.autocomplete');
  3088. }
  3089. return this;
  3090. }
  3091. });
  3092. return UI.autocomplete;
  3093. });
  3094. /*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  3095. // removed moment_js from core
  3096. // customized by tzd
  3097. (function(addon) {
  3098. var component;
  3099. if (window.UIkit) {
  3100. component = addon(UIkit);
  3101. }
  3102. if (typeof define == "function" && define.amd) {
  3103. define("uikit-datepicker", ["uikit"], function(){
  3104. return component || addon(UIkit);
  3105. });
  3106. }
  3107. })(function(UI){
  3108. "use strict";
  3109. // Datepicker
  3110. var active = false, dropdown;
  3111. UI.component('datepicker', {
  3112. defaults: {
  3113. mobile: false,
  3114. weekstart: 1,
  3115. i18n: {
  3116. months : ['January','February','March','April','May','June','July','August','September','October','November','December'],
  3117. weekdays : ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
  3118. },
  3119. format: "DD.MM.YYYY",
  3120. offsettop: 5,
  3121. maxDate: false,
  3122. minDate: false,
  3123. pos: 'auto',
  3124. addClass: '',
  3125. template: function(data, opts) {
  3126. var content = '', i;
  3127. content += '<div class="uk-datepicker-nav uk-clearfix">';
  3128. content += '<a href="" class="uk-datepicker-previous"></a>';
  3129. content += '<a href="" class="uk-datepicker-next"></a>';
  3130. if (UI.formSelect) {
  3131. var currentyear = (new Date()).getFullYear(), options = [], months, years, minYear, maxYear;
  3132. for (i=0;i<opts.i18n.months.length;i++) {
  3133. if(i==data.month) {
  3134. options.push('<option value="'+i+'" selected>'+opts.i18n.months[i]+'</option>');
  3135. } else {
  3136. options.push('<option value="'+i+'">'+opts.i18n.months[i]+'</option>');
  3137. }
  3138. }
  3139. months = '<span class="uk-form-select">'+ opts.i18n.months[data.month] + '<select class="update-picker-month">'+options.join('')+'</select></span>';
  3140. // --
  3141. options = [];
  3142. minYear = data.minDate ? data.minDate.year() : currentyear - 50;
  3143. maxYear = data.maxDate ? data.maxDate.year() : currentyear + 20;
  3144. for (i=minYear;i<=maxYear;i++) {
  3145. if (i == data.year) {
  3146. options.push('<option value="'+i+'" selected>'+i+'</option>');
  3147. } else {
  3148. options.push('<option value="'+i+'">'+i+'</option>');
  3149. }
  3150. }
  3151. years = '<span class="uk-form-select">'+ data.year + '<select class="update-picker-year">'+options.join('')+'</select></span>';
  3152. content += '<div class="uk-datepicker-heading">'+ months + ' ' + years +'</div>';
  3153. } else {
  3154. content += '<div class="uk-datepicker-heading">'+ opts.i18n.months[data.month] +' '+ data.year+'</div>';
  3155. }
  3156. content += '</div>';
  3157. content += '<table class="uk-datepicker-table">';
  3158. content += '<thead>';
  3159. for(i = 0; i < data.weekdays.length; i++) {
  3160. if (data.weekdays[i]) {
  3161. content += '<th>'+data.weekdays[i]+'</th>';
  3162. }
  3163. }
  3164. content += '</thead>';
  3165. content += '<tbody>';
  3166. for(i = 0; i < data.days.length; i++) {
  3167. if (data.days[i] && data.days[i].length){
  3168. content += '<tr>';
  3169. for(var d = 0; d < data.days[i].length; d++) {
  3170. if (data.days[i][d]) {
  3171. var day = data.days[i][d],
  3172. cls = [];
  3173. if(!day.inmonth) cls.push("uk-datepicker-table-muted");
  3174. if(day.selected) cls.push("uk-active");
  3175. if(day.disabled) cls.push('uk-datepicker-date-disabled uk-datepicker-table-muted');
  3176. content += '<td><a href="" class="'+cls.join(" ")+'" data-date="'+day.day.format()+'">'+day.day.format("D")+'</a></td>';
  3177. }
  3178. }
  3179. content += '</tr>';
  3180. }
  3181. }
  3182. content += '</tbody>';
  3183. content += '</table>';
  3184. return content;
  3185. }
  3186. },
  3187. boot: function() {
  3188. UI.$win.on("resize orientationchange", function() {
  3189. if (active) {
  3190. active.hide();
  3191. }
  3192. });
  3193. // init code
  3194. UI.$html.on("focus.datepicker.uikit", "[data-uk-datepicker]", function(e) {
  3195. var ele = UI.$(this);
  3196. if (!ele.data("datepicker")) {
  3197. e.preventDefault();
  3198. UI.datepicker(ele, UI.Utils.options(ele.attr("data-uk-datepicker")));
  3199. ele.trigger("focus");
  3200. }
  3201. });
  3202. UI.$html.on("click focus", '*', function(e) {
  3203. var target = UI.$(e.target);
  3204. if (active && target[0] != dropdown[0] && !target.data("datepicker") && !target.parents(".uk-datepicker:first").length) {
  3205. active.hide();
  3206. }
  3207. });
  3208. },
  3209. init: function() {
  3210. // use native datepicker on touch devices
  3211. if (UI.support.touch && this.element.attr('type')=='date' && !this.options.mobile) {
  3212. return;
  3213. }
  3214. var $this = this;
  3215. this.current = this.element.val() ? moment(this.element.val(), this.options.format) : moment();
  3216. this.on("click focus", function(){
  3217. if (active!==$this) $this.pick(this.value ? this.value:($this.options.minDate ? $this.options.minDate :''));
  3218. }).on("change", function(){
  3219. if ($this.element.val() && !moment($this.element.val(), $this.options.format).isValid()) {
  3220. $this.element.val(moment().format($this.options.format));
  3221. }
  3222. });
  3223. // init dropdown
  3224. if (!dropdown) {
  3225. dropdown = UI.$('<div class="uk-dropdown uk-datepicker '+$this.options.addClass+'"></div>');
  3226. dropdown.on("click", ".uk-datepicker-next, .uk-datepicker-previous, [data-date]", function(e){
  3227. e.stopPropagation();
  3228. e.preventDefault();
  3229. var ele = UI.$(this);
  3230. if (ele.hasClass('uk-datepicker-date-disabled')) return false;
  3231. if (ele.is('[data-date]')) {
  3232. active.current = moment(ele.data("date"));
  3233. active.element.val(active.current.isValid() ? active.current.format(active.options.format) : null).trigger("change");
  3234. dropdown.removeClass('uk-dropdown-shown');
  3235. setTimeout(function() {
  3236. dropdown.removeClass('uk-dropdown-active')
  3237. },280);
  3238. active.hide();
  3239. } else {
  3240. active.add((ele.hasClass("uk-datepicker-next") ? 1:-1), "months");
  3241. }
  3242. });
  3243. dropdown.on('change', '.update-picker-month, .update-picker-year', function(){
  3244. var select = UI.$(this);
  3245. active[select.is('.update-picker-year') ? 'setYear':'setMonth'](Number(select.val()));
  3246. });
  3247. dropdown.appendTo("body");
  3248. }
  3249. },
  3250. pick: function(initdate) {
  3251. var offset = this.element.offset(),
  3252. offset_left = parseInt(offset.left),
  3253. offset_top = parseInt(offset.top),
  3254. css = {
  3255. 'left': offset_left,
  3256. 'right': ""
  3257. };
  3258. this.current = isNaN(initdate) ? moment(initdate, this.options.format):moment();
  3259. this.initdate = this.current.format("YYYY-MM-DD");
  3260. this.update();
  3261. // check if datepicker input is in modal
  3262. if(($(this.element[0]).closest('.ui-dialog').length || $(this.element[0]).closest('.uk-modal').length) && !dropdown.hasClass('dropdown-modal')) {
  3263. dropdown.addClass('dropdown-modal');
  3264. }
  3265. if (UI.langdirection == 'right' || ( window.innerWidth - offset_left - dropdown.outerWidth() < 0 ) ) {
  3266. css.right = (window.innerWidth - (window.innerWidth - $('body').width())) - (css.left + this.element.outerWidth());
  3267. css.left = "";
  3268. }
  3269. var posTop = (offset_top - this.element.outerHeight() + this.element.height()) - this.options.offsettop - dropdown.outerHeight(),
  3270. posBottom = offset_top + this.element.outerHeight() + this.options.offsettop;
  3271. css.top = posBottom;
  3272. if (this.options.pos == 'top') {
  3273. css.top = posTop;
  3274. dropdown.addClass('dp-top');
  3275. } else if(this.options.pos == 'auto' && (window.innerHeight - posBottom - dropdown.outerHeight() + UI.$win.scrollTop() < 0 && posTop >= 0) ) {
  3276. css.top = posTop;
  3277. dropdown.addClass('dp-top');
  3278. }
  3279. css.minWidth = dropdown.actual('outerWidth');
  3280. dropdown.css(css).addClass('uk-dropdown-active uk-dropdown-shown');
  3281. this.trigger('show.uk.datepicker');
  3282. active = this;
  3283. },
  3284. add: function(unit, value) {
  3285. this.current.add(unit, value);
  3286. this.update();
  3287. },
  3288. setMonth: function(month) {
  3289. this.current.month(month);
  3290. this.update();
  3291. },
  3292. setYear: function(year) {
  3293. this.current.year(year);
  3294. this.update();
  3295. },
  3296. update: function() {
  3297. var data = this.getRows(this.current.year(), this.current.month()),
  3298. tpl = this.options.template(data, this.options);
  3299. dropdown.html(tpl);
  3300. this.trigger('update.uk.datepicker');
  3301. },
  3302. getRows: function(year, month) {
  3303. var opts = this.options,
  3304. now = moment().format('YYYY-MM-DD'),
  3305. days = [31, (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month],
  3306. before = new Date(year, month, 1, 12).getDay(),
  3307. data = {"month":month, "year":year,"weekdays":[],"days":[], "maxDate": false, "minDate": false},
  3308. row = [];
  3309. // We need these to be midday to avoid issues from DST transition protection.
  3310. if (opts.maxDate!==false){
  3311. data.maxDate = isNaN(opts.maxDate) ? moment(opts.maxDate, opts.format).startOf('day').hours(12) : moment().add(opts.maxDate, 'days').startOf('day').hours(12);
  3312. }
  3313. if (opts.minDate!==false){
  3314. data.minDate = isNaN(opts.minDate) ? moment(opts.minDate, opts.format).startOf('day').hours(12) : moment().add(opts.minDate-1, 'days').startOf('day').hours(12);
  3315. }
  3316. data.weekdays = (function(){
  3317. for (var i=0, arr=[]; i < 7; i++) {
  3318. var day = i + (opts.weekstart || 0);
  3319. while (day >= 7) {
  3320. day -= 7;
  3321. }
  3322. arr.push(opts.i18n.weekdays[day]);
  3323. }
  3324. return arr;
  3325. })();
  3326. if (opts.weekstart && opts.weekstart > 0) {
  3327. before -= opts.weekstart;
  3328. if (before < 0) {
  3329. before += 7;
  3330. }
  3331. }
  3332. var cells = days + before, after = cells;
  3333. while(after > 7) { after -= 7; }
  3334. cells += 7 - after;
  3335. var day, isDisabled, isSelected, isToday, isInMonth;
  3336. for (var i = 0, r = 0; i < cells; i++) {
  3337. day = new Date(year, month, 1 + (i - before), 12);
  3338. isDisabled = (data.minDate && data.minDate > day) || (data.maxDate && day > data.maxDate);
  3339. isInMonth = !(i < before || i >= (days + before));
  3340. day = moment(day);
  3341. isSelected = this.initdate == day.format("YYYY-MM-DD");
  3342. isToday = now == day.format("YYYY-MM-DD");
  3343. row.push({"selected": isSelected, "today": isToday, "disabled": isDisabled, "day":day, "inmonth":isInMonth});
  3344. if (++r === 7) {
  3345. data.days.push(row);
  3346. row = [];
  3347. r = 0;
  3348. }
  3349. }
  3350. return data;
  3351. },
  3352. hide: function() {
  3353. if (active && active === this) {
  3354. dropdown.removeClass('uk-dropdown-shown');
  3355. setTimeout(function() {
  3356. dropdown.removeClass('uk-dropdown-active dp-top')
  3357. },280);
  3358. active = false;
  3359. this.trigger('hide.uk.datepicker');
  3360. }
  3361. }
  3362. });
  3363. UI.Utils.moment = moment();
  3364. return UI.datepicker;
  3365. });
  3366. /*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  3367. (function(addon) {
  3368. var component;
  3369. if (window.UIkit) {
  3370. component = addon(UIkit);
  3371. }
  3372. if (typeof define == "function" && define.amd) {
  3373. define("uikit-form-password", ["uikit"], function(){
  3374. return component || addon(UIkit);
  3375. });
  3376. }
  3377. })(function(UI){
  3378. "use strict";
  3379. UI.component('formPassword', {
  3380. defaults: {
  3381. "lblShow": "Show",
  3382. "lblHide": "Hide"
  3383. },
  3384. boot: function() {
  3385. // init code
  3386. UI.$html.on("click.formpassword.uikit", "[data-uk-form-password]", function(e) {
  3387. var ele = UI.$(this);
  3388. if (!ele.data("formPassword")) {
  3389. e.preventDefault();
  3390. UI.formPassword(ele, UI.Utils.options(ele.attr("data-uk-form-password")));
  3391. ele.trigger("click");
  3392. }
  3393. });
  3394. },
  3395. init: function() {
  3396. var $this = this;
  3397. this.on("click", function(e) {
  3398. e.preventDefault();
  3399. if($this.input.length) {
  3400. var type = $this.input.attr("type");
  3401. $this.input.attr("type", type=="text" ? "password":"text");
  3402. $this.element.html($this.options[type=="text" ? "lblShow":"lblHide"]);
  3403. }
  3404. });
  3405. this.input = this.element.next("input").length ? this.element.next("input") : this.element.prev("input");
  3406. this.element.html(this.options[this.input.is("[type='password']") ? "lblShow":"lblHide"]);
  3407. this.element.data("formPassword", this);
  3408. }
  3409. });
  3410. return UI.formPassword;
  3411. });
  3412. /*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  3413. (function(addon) {
  3414. var component;
  3415. if (window.UIkit) {
  3416. component = addon(UIkit);
  3417. }
  3418. if (typeof define == "function" && define.amd) {
  3419. define("uikit-form-select", ["uikit"], function(){
  3420. return component || addon(UIkit);
  3421. });
  3422. }
  3423. })(function(UI){
  3424. "use strict";
  3425. UI.component('formSelect', {
  3426. defaults: {
  3427. 'target': '>span:first',
  3428. 'activeClass': 'uk-active'
  3429. },
  3430. boot: function() {
  3431. // init code
  3432. UI.ready(function(context) {
  3433. UI.$("[data-uk-form-select]", context).each(function(){
  3434. var ele = UI.$(this);
  3435. if (!ele.data("formSelect")) {
  3436. UI.formSelect(ele, UI.Utils.options(ele.attr("data-uk-form-select")));
  3437. }
  3438. });
  3439. });
  3440. },
  3441. init: function() {
  3442. var $this = this;
  3443. this.target = this.find(this.options.target);
  3444. this.select = this.find('select');
  3445. // init + on change event
  3446. this.select.on({
  3447. change: (function(){
  3448. var select = $this.select[0], fn = function(){
  3449. try {
  3450. if($this.options.target === 'input') {
  3451. $this.target.val(select.options[select.selectedIndex].text);
  3452. } else {
  3453. $this.target.text(select.options[select.selectedIndex].text);
  3454. }
  3455. } catch(e) {}
  3456. $this.element[$this.select.val() ? 'addClass':'removeClass']($this.options.activeClass);
  3457. return fn;
  3458. };
  3459. return fn();
  3460. })(),
  3461. focus: function(){ $this.target.addClass('uk-focus') },
  3462. blur: function(){ $this.target.removeClass('uk-focus') },
  3463. mouseenter: function(){ $this.target.addClass('uk-hover') },
  3464. mouseleave: function(){ $this.target.removeClass('uk-hover') }
  3465. });
  3466. this.element.data("formSelect", this);
  3467. }
  3468. });
  3469. return UI.formSelect;
  3470. });
  3471. /*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  3472. (function(addon) {
  3473. var component;
  3474. if (window.UIkit) {
  3475. component = addon(UIkit);
  3476. }
  3477. if (typeof define == "function" && define.amd) {
  3478. define("uikit-grid", ["uikit"], function(){
  3479. return component || addon(UIkit);
  3480. });
  3481. }
  3482. })(function(UI){
  3483. "use strict";
  3484. UI.component('grid', {
  3485. defaults: {
  3486. colwidth : 'auto',
  3487. animation : true,
  3488. duration : 300,
  3489. gutter : 0,
  3490. controls : false,
  3491. filter : false,
  3492. origin : UI.langdirection
  3493. },
  3494. boot: function() {
  3495. // init code
  3496. UI.ready(function(context) {
  3497. UI.$('[data-uk-grid]', context).each(function(){
  3498. var ele = UI.$(this);
  3499. if(!ele.data("grid")) {
  3500. UI.grid(ele, UI.Utils.options(ele.attr('data-uk-grid')));
  3501. }
  3502. });
  3503. });
  3504. },
  3505. init: function() {
  3506. var $this = this, gutter = String(this.options.gutter).trim().split(' ');
  3507. this.gutterv = parseInt(gutter[0], 10);
  3508. this.gutterh = parseInt((gutter[1] || gutter[0]), 10);
  3509. // make sure parent element has the right position property
  3510. this.element.css({'position': 'relative'});
  3511. this.controls = null;
  3512. this.origin = this.options.origin;
  3513. if (this.options.controls) {
  3514. this.controls = UI.$(this.options.controls);
  3515. // filter
  3516. this.controls.on('click', '[data-uk-filter]', function(e){
  3517. e.preventDefault();
  3518. $this.filter(UI.$(this).attr('data-uk-filter'));
  3519. });
  3520. // sort
  3521. this.controls.on('click', '[data-uk-sort]', function(e){
  3522. e.preventDefault();
  3523. var cmd = UI.$(this).attr('data-uk-sort').split(':');
  3524. $this.sort(cmd[0], cmd[1]);
  3525. });
  3526. }
  3527. UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(){
  3528. if ($this.currentfilter) {
  3529. $this.filter($this.currentfilter);
  3530. } else {
  3531. this.update();
  3532. }
  3533. }.bind(this), 100));
  3534. this.on('display.uk.check', function(){
  3535. if ($this.element.is(":visible")) $this.update();
  3536. });
  3537. UI.domObserve(this.element, function(e) {
  3538. $this.update();
  3539. });
  3540. if (this.options.filter !== false) {
  3541. this.filter(this.options.filter);
  3542. } else {
  3543. this.update();
  3544. }
  3545. },
  3546. _prepareElements: function() {
  3547. var children = this.element.children(':not([data-grid-prepared])'), css;
  3548. // exit if no already prepared elements found
  3549. if (!children.length) {
  3550. return;
  3551. }
  3552. css = {
  3553. 'position' : 'absolute',
  3554. 'box-sizing' : 'border-box',
  3555. 'width' : this.options.colwidth == 'auto' ? '' : this.options.colwidth
  3556. };
  3557. if (this.options.gutter) {
  3558. css['padding-'+this.origin] = this.gutterh;
  3559. css['padding-bottom'] = this.gutterv;
  3560. this.element.css('margin-'+this.origin, this.gutterh * -1);
  3561. }
  3562. children.attr('data-grid-prepared', 'true').css(css);
  3563. },
  3564. update: function(elements) {
  3565. var $this = this;
  3566. this._prepareElements();
  3567. elements = elements || this.element.children(':visible');
  3568. var children = elements,
  3569. maxwidth = this.element.width() + (2*this.gutterh) + 2,
  3570. left = 0,
  3571. top = 0,
  3572. positions = [],
  3573. item, width, height, pos, posi, i, z, max, size;
  3574. this.trigger('beforeupdate.uk.grid', [children]);
  3575. children.each(function(index){
  3576. size = getElementSize(this);
  3577. item = UI.$(this);
  3578. width = size.outerWidth;
  3579. height = size.outerHeight;
  3580. left = 0;
  3581. top = 0;
  3582. for (i=0,max=positions.length;i<max;i++) {
  3583. pos = positions[i];
  3584. if (left <= pos.aX) { left = pos.aX; }
  3585. if (maxwidth < (left + width)) { left = 0; }
  3586. if (top <= pos.aY) { top = pos.aY; }
  3587. }
  3588. posi = {
  3589. "ele" : item,
  3590. "top" : top,
  3591. "width" : width,
  3592. "height" : height,
  3593. "aY" : (top + height),
  3594. "aX" : (left + width)
  3595. };
  3596. posi[$this.origin] = left;
  3597. positions.push(posi);
  3598. });
  3599. var posPrev, maxHeight = 0, positionto;
  3600. // fix top
  3601. for (i=0,max=positions.length;i<max;i++) {
  3602. pos = positions[i];
  3603. top = 0;
  3604. for (z=0;z<i;z++) {
  3605. posPrev = positions[z];
  3606. // (posPrev.left + 1) fixex 1px bug when using % based widths
  3607. if (pos[this.origin] < posPrev.aX && (posPrev[this.origin] +1) < pos.aX) {
  3608. top = posPrev.aY;
  3609. }
  3610. }
  3611. pos.top = top;
  3612. pos.aY = top + pos.height;
  3613. maxHeight = Math.max(maxHeight, pos.aY);
  3614. }
  3615. maxHeight = maxHeight - this.gutterv;
  3616. if (this.options.animation) {
  3617. this.element.stop().animate({'height': maxHeight}, 100);
  3618. positions.forEach(function(pos){
  3619. positionto = {"top": pos.top, opacity: 1};
  3620. positionto[$this.origin] = pos[$this.origin];
  3621. pos.ele.stop().animate(positionto, this.options.duration);
  3622. }.bind(this));
  3623. } else {
  3624. this.element.css('height', maxHeight);
  3625. positions.forEach(function(pos){
  3626. positionto = {"top": pos.top, opacity: 1};
  3627. positionto[$this.origin] = pos[$this.origin];
  3628. pos.ele.css(positionto);
  3629. }.bind(this));
  3630. }
  3631. // make sure to trigger possible scrollpies etc.
  3632. setTimeout(function() {
  3633. UI.$doc.trigger('scrolling.uk.document');
  3634. }, 2 * this.options.duration * (this.options.animation ? 1:0));
  3635. this.trigger('afterupdate.uk.grid', [children]);
  3636. },
  3637. filter: function(filter) {
  3638. this.currentfilter = filter;
  3639. filter = filter || [];
  3640. if (typeof(filter) === 'number') {
  3641. filter = filter.toString();
  3642. }
  3643. if (typeof(filter) === 'string') {
  3644. filter = filter.split(/,/).map(function(item){ return item.trim(); });
  3645. }
  3646. var $this = this, children = this.element.children(), elements = {"visible": [], "hidden": []}, visible, hidden;
  3647. children.each(function(index){
  3648. var ele = UI.$(this), f = ele.attr('data-uk-filter'), infilter = filter.length ? false : true;
  3649. if (f) {
  3650. f = f.split(/,/).map(function(item){ return item.trim(); });
  3651. filter.forEach(function(item){
  3652. if (f.indexOf(item) > -1) infilter = true;
  3653. });
  3654. }
  3655. elements[infilter ? "visible":"hidden"].push(ele);
  3656. });
  3657. // convert to jQuery collections
  3658. elements.hidden = UI.$(elements.hidden).map(function () {return this[0];});
  3659. elements.visible = UI.$(elements.visible).map(function () {return this[0];});
  3660. elements.hidden.attr('aria-hidden', 'true').filter(':visible').fadeOut(this.options.duration);
  3661. elements.visible.attr('aria-hidden', 'false').filter(':hidden').css('opacity', 0).show();
  3662. $this.update(elements.visible);
  3663. if (this.controls && this.controls.length) {
  3664. this.controls.find('[data-uk-filter]').removeClass('uk-active').filter('[data-uk-filter="'+filter+'"]').addClass('uk-active');
  3665. }
  3666. },
  3667. sort: function(by, order){
  3668. order = order || 1;
  3669. // covert from string (asc|desc) to number
  3670. if (typeof(order) === 'string') {
  3671. order = order.toLowerCase() == 'desc' ? -1 : 1;
  3672. }
  3673. var elements = this.element.children();
  3674. elements.sort(function(a, b){
  3675. a = UI.$(a);
  3676. b = UI.$(b);
  3677. return (b.data(by) || '') < (a.data(by) || '') ? order : (order*-1);
  3678. }).appendTo(this.element);
  3679. this.update(elements.filter(':visible'));
  3680. if (this.controls && this.controls.length) {
  3681. this.controls.find('[data-uk-sort]').removeClass('uk-active').filter('[data-uk-sort="'+by+':'+(order == -1 ? 'desc':'asc')+'"]').addClass('uk-active');
  3682. }
  3683. }
  3684. });
  3685. /*!
  3686. * getSize v1.2.2
  3687. * measure size of elements
  3688. * MIT license
  3689. * https://github.com/desandro/get-size
  3690. */
  3691. function _getSize() {
  3692. var prefixes = 'Webkit Moz ms Ms O'.split(' ');
  3693. var docElemStyle = document.documentElement.style;
  3694. function getStyleProperty( propName ) {
  3695. if ( !propName ) {
  3696. return;
  3697. }
  3698. // test standard property first
  3699. if ( typeof docElemStyle[ propName ] === 'string' ) {
  3700. return propName;
  3701. }
  3702. // capitalize
  3703. propName = propName.charAt(0).toUpperCase() + propName.slice(1);
  3704. // test vendor specific properties
  3705. var prefixed;
  3706. for ( var i=0, len = prefixes.length; i < len; i++ ) {
  3707. prefixed = prefixes[i] + propName;
  3708. if ( typeof docElemStyle[ prefixed ] === 'string' ) {
  3709. return prefixed;
  3710. }
  3711. }
  3712. }
  3713. // -------------------------- helpers -------------------------- //
  3714. // get a number from a string, not a percentage
  3715. function getStyleSize( value ) {
  3716. var num = parseFloat( value );
  3717. // not a percent like '100%', and a number
  3718. var isValid = value.indexOf('%') === -1 && !isNaN( num );
  3719. return isValid && num;
  3720. }
  3721. function noop() {}
  3722. var logError = typeof console === 'undefined' ? noop : function( message ) {
  3723. console.error( message );
  3724. };
  3725. // -------------------------- measurements -------------------------- //
  3726. var measurements = [
  3727. 'paddingLeft',
  3728. 'paddingRight',
  3729. 'paddingTop',
  3730. 'paddingBottom',
  3731. 'marginLeft',
  3732. 'marginRight',
  3733. 'marginTop',
  3734. 'marginBottom',
  3735. 'borderLeftWidth',
  3736. 'borderRightWidth',
  3737. 'borderTopWidth',
  3738. 'borderBottomWidth'
  3739. ];
  3740. function getZeroSize() {
  3741. var size = {
  3742. width: 0,
  3743. height: 0,
  3744. innerWidth: 0,
  3745. innerHeight: 0,
  3746. outerWidth: 0,
  3747. outerHeight: 0
  3748. };
  3749. for ( var i=0, len = measurements.length; i < len; i++ ) {
  3750. var measurement = measurements[i];
  3751. size[ measurement ] = 0;
  3752. }
  3753. return size;
  3754. }
  3755. // -------------------------- setup -------------------------- //
  3756. var isSetup = false;
  3757. var getStyle, boxSizingProp, isBoxSizeOuter;
  3758. /**
  3759. * setup vars and functions
  3760. * do it on initial getSize(), rather than on script load
  3761. * For Firefox bug https://bugzilla.mozilla.org/show_bug.cgi?id=548397
  3762. */
  3763. function setup() {
  3764. // setup once
  3765. if ( isSetup ) {
  3766. return;
  3767. }
  3768. isSetup = true;
  3769. var getComputedStyle = window.getComputedStyle;
  3770. getStyle = ( function() {
  3771. var getStyleFn = getComputedStyle ?
  3772. function( elem ) {
  3773. return getComputedStyle( elem, null );
  3774. } :
  3775. function( elem ) {
  3776. return elem.currentStyle;
  3777. };
  3778. return function getStyle( elem ) {
  3779. var style = getStyleFn( elem );
  3780. if ( !style ) {
  3781. logError( 'Style returned ' + style +
  3782. '. Are you running this code in a hidden iframe on Firefox? ' +
  3783. 'See http://bit.ly/getsizebug1' );
  3784. }
  3785. return style;
  3786. };
  3787. })();
  3788. // -------------------------- box sizing -------------------------- //
  3789. boxSizingProp = getStyleProperty('boxSizing');
  3790. /**
  3791. * WebKit measures the outer-width on style.width on border-box elems
  3792. * IE & Firefox measures the inner-width
  3793. */
  3794. if ( boxSizingProp ) {
  3795. var div = document.createElement('div');
  3796. div.style.width = '200px';
  3797. div.style.padding = '1px 2px 3px 4px';
  3798. div.style.borderStyle = 'solid';
  3799. div.style.borderWidth = '1px 2px 3px 4px';
  3800. div.style[ boxSizingProp ] = 'border-box';
  3801. var body = document.body || document.documentElement;
  3802. body.appendChild( div );
  3803. var style = getStyle( div );
  3804. isBoxSizeOuter = getStyleSize( style.width ) === 200;
  3805. body.removeChild( div );
  3806. }
  3807. }
  3808. // -------------------------- getSize -------------------------- //
  3809. function getSize( elem ) {
  3810. setup();
  3811. // use querySeletor if elem is string
  3812. if ( typeof elem === 'string' ) {
  3813. elem = document.querySelector( elem );
  3814. }
  3815. // do not proceed on non-objects
  3816. if ( !elem || typeof elem !== 'object' || !elem.nodeType ) {
  3817. return;
  3818. }
  3819. var style = getStyle( elem );
  3820. // if hidden, everything is 0
  3821. if ( style.display === 'none' ) {
  3822. return getZeroSize();
  3823. }
  3824. var size = {};
  3825. size.width = elem.offsetWidth;
  3826. size.height = elem.offsetHeight;
  3827. var isBorderBox = size.isBorderBox = !!( boxSizingProp &&
  3828. style[ boxSizingProp ] && style[ boxSizingProp ] === 'border-box' );
  3829. // get all measurements
  3830. for ( var i=0, len = measurements.length; i < len; i++ ) {
  3831. var measurement = measurements[i];
  3832. var value = style[ measurement ];
  3833. var num = parseFloat( value );
  3834. // any 'auto', 'medium' value will be 0
  3835. size[ measurement ] = !isNaN( num ) ? num : 0;
  3836. }
  3837. var paddingWidth = size.paddingLeft + size.paddingRight;
  3838. var paddingHeight = size.paddingTop + size.paddingBottom;
  3839. var marginWidth = size.marginLeft + size.marginRight;
  3840. var marginHeight = size.marginTop + size.marginBottom;
  3841. var borderWidth = size.borderLeftWidth + size.borderRightWidth;
  3842. var borderHeight = size.borderTopWidth + size.borderBottomWidth;
  3843. var isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter;
  3844. // overwrite width and height if we can get it from style
  3845. var styleWidth = getStyleSize( style.width );
  3846. if ( styleWidth !== false ) {
  3847. size.width = styleWidth +
  3848. // add padding and border unless it's already including it
  3849. ( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth );
  3850. }
  3851. var styleHeight = getStyleSize( style.height );
  3852. if ( styleHeight !== false ) {
  3853. size.height = styleHeight +
  3854. // add padding and border unless it's already including it
  3855. ( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight );
  3856. }
  3857. size.innerWidth = size.width - ( paddingWidth + borderWidth );
  3858. size.innerHeight = size.height - ( paddingHeight + borderHeight );
  3859. size.outerWidth = size.width + marginWidth;
  3860. size.outerHeight = size.height + marginHeight;
  3861. return size;
  3862. }
  3863. return getSize;
  3864. }
  3865. function getElementSize(ele) {
  3866. return _getSize()(ele);
  3867. }
  3868. });
  3869. /*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  3870. (function(addon) {
  3871. var component;
  3872. if (window.UIkit) {
  3873. component = addon(UIkit);
  3874. }
  3875. if (typeof define == "function" && define.amd) { // AMD
  3876. define("uikit-lightbox", ["uikit"], function(){
  3877. return component || addon(UIkit);
  3878. });
  3879. }
  3880. })(function(UI){
  3881. "use strict";
  3882. var modal, cache = {};
  3883. UI.component('lightbox', {
  3884. defaults: {
  3885. allowfullscreen : true,
  3886. duration : 400,
  3887. group : false,
  3888. keyboard : true
  3889. },
  3890. index : 0,
  3891. items : false,
  3892. boot: function() {
  3893. UI.$html.on('click', '[data-uk-lightbox]', function(e){
  3894. e.preventDefault();
  3895. var link = UI.$(this);
  3896. if (!link.data("lightbox")) {
  3897. UI.lightbox(link, UI.Utils.options(link.attr("data-uk-lightbox")));
  3898. }
  3899. link.data("lightbox").show(link);
  3900. });
  3901. // keyboard navigation
  3902. UI.$doc.on('keyup', function(e) {
  3903. if (modal && modal.is(':visible') && modal.lightbox.options.keyboard) {
  3904. e.preventDefault();
  3905. switch(e.keyCode) {
  3906. case 37:
  3907. modal.lightbox.previous();
  3908. break;
  3909. case 39:
  3910. modal.lightbox.next();
  3911. break;
  3912. }
  3913. }
  3914. });
  3915. },
  3916. init: function() {
  3917. var siblings = [];
  3918. this.index = 0;
  3919. this.siblings = [];
  3920. if (this.element && this.element.length) {
  3921. var domSiblings = this.options.group ? UI.$([
  3922. '[data-uk-lightbox*="'+this.options.group+'"]',
  3923. "[data-uk-lightbox*='"+this.options.group+"']"
  3924. ].join(',')) : this.element;
  3925. domSiblings.each(function() {
  3926. var ele = UI.$(this);
  3927. siblings.push({
  3928. 'source': ele.attr('href'),
  3929. 'title' : ele.attr('data-title') || ele.attr('title'),
  3930. 'type' : ele.attr("data-lightbox-type") || 'auto',
  3931. 'link' : ele
  3932. });
  3933. });
  3934. this.index = domSiblings.index(this.element);
  3935. this.siblings = siblings;
  3936. } else if (this.options.group && this.options.group.length) {
  3937. this.siblings = this.options.group;
  3938. }
  3939. this.trigger('lightbox-init', [this]);
  3940. },
  3941. show: function(index) {
  3942. this.modal = getModal(this);
  3943. // stop previous animation
  3944. this.modal.dialog.stop();
  3945. this.modal.content.stop();
  3946. var $this = this, promise = UI.$.Deferred(), data, item;
  3947. index = index || 0;
  3948. // index is a jQuery object or DOM element
  3949. if (typeof(index) == 'object') {
  3950. this.siblings.forEach(function(s, idx){
  3951. if (index[0] === s.link[0]) {
  3952. index = idx;
  3953. }
  3954. });
  3955. }
  3956. // fix index if needed
  3957. if ( index < 0 ) {
  3958. index = this.siblings.length - index;
  3959. } else if (!this.siblings[index]) {
  3960. index = 0;
  3961. }
  3962. item = this.siblings[index];
  3963. data = {
  3964. lightbox : $this,
  3965. source : item.source,
  3966. type : item.type,
  3967. index : index,
  3968. promise : promise,
  3969. title : item.title,
  3970. item : item,
  3971. meta : {
  3972. content : '',
  3973. width : null,
  3974. height : null
  3975. }
  3976. };
  3977. this.index = index;
  3978. this.modal.content.empty();
  3979. if (!this.modal.is(':visible')) {
  3980. this.modal.content.css({width:'', height:''}).empty();
  3981. this.modal.modal.show();
  3982. }
  3983. this.modal.loader.removeClass('uk-hidden');
  3984. promise.promise().done(function() {
  3985. $this.data = data;
  3986. $this.fitSize(data);
  3987. }).fail(function(){
  3988. data.meta.content = '<div class="uk-position-cover uk-flex uk-flex-middle uk-flex-center"><strong>Loading resource failed!</strong></div>';
  3989. data.meta.width = 400;
  3990. data.meta.height = 300;
  3991. $this.data = data;
  3992. $this.fitSize(data);
  3993. });
  3994. $this.trigger('showitem.uk.lightbox', [data]);
  3995. },
  3996. fitSize: function() {
  3997. var $this = this,
  3998. data = this.data,
  3999. pad = this.modal.dialog.outerWidth() - this.modal.dialog.width(),
  4000. dpadTop = parseInt(this.modal.dialog.css('margin-top'), 10),
  4001. dpadBot = parseInt(this.modal.dialog.css('margin-bottom'), 10),
  4002. dpad = dpadTop + dpadBot,
  4003. content = data.meta.content,
  4004. duration = $this.options.duration;
  4005. if (this.siblings.length > 1) {
  4006. content = [
  4007. content,
  4008. '<a href="javascript:void(0);" class="uk-slidenav uk-slidenav-contrast uk-slidenav-previous uk-hidden-touch" data-lightbox-previous></a>',
  4009. '<a href="javascript:void(0);" class="uk-slidenav uk-slidenav-contrast uk-slidenav-next uk-hidden-touch" data-lightbox-next></a>'
  4010. ].join('');
  4011. }
  4012. // calculate width
  4013. var tmp = UI.$('<div>&nbsp;</div>').css({
  4014. opacity : 0,
  4015. position : 'absolute',
  4016. top : 0,
  4017. left : 0,
  4018. width : '100%',
  4019. 'max-width' : $this.modal.dialog.css('max-width'),
  4020. padding : $this.modal.dialog.css('padding'),
  4021. margin : $this.modal.dialog.css('margin')
  4022. }), maxwidth, maxheight, w = data.meta.width, h = data.meta.height;
  4023. tmp.appendTo('body').width();
  4024. maxwidth = tmp.width();
  4025. maxheight = window.innerHeight - dpad;
  4026. tmp.remove();
  4027. this.modal.dialog.find('.uk-modal-caption').remove();
  4028. if (data.title) {
  4029. this.modal.dialog.append('<div class="uk-modal-caption">'+data.title+'</div>');
  4030. maxheight -= this.modal.dialog.find('.uk-modal-caption').outerHeight();
  4031. }
  4032. if (maxwidth < data.meta.width) {
  4033. h = Math.floor( h * (maxwidth / w) );
  4034. w = maxwidth;
  4035. }
  4036. if (maxheight < h) {
  4037. h = Math.floor(maxheight);
  4038. w = Math.ceil(data.meta.width * (maxheight/data.meta.height));
  4039. }
  4040. this.modal.content.css('opacity', 0).width(w).html(content);
  4041. if (data.type == 'iframe') {
  4042. this.modal.content.find('iframe:first').height(h);
  4043. }
  4044. var dh = h + pad,
  4045. t = Math.floor(window.innerHeight/2 - dh/2) - dpad;
  4046. if (t < 0) { t = 0; }
  4047. this.modal.closer.addClass('uk-hidden');
  4048. if ($this.modal.data('mwidth') == w && $this.modal.data('mheight') == h) {
  4049. duration = 0;
  4050. }
  4051. this.modal.dialog.animate({width: w + pad, height: h + pad, top: t }, duration, 'swing', function() {
  4052. $this.modal.loader.addClass('uk-hidden');
  4053. $this.modal.content.css({width:''}).animate({'opacity': 1}, function() {
  4054. $this.modal.closer.removeClass('uk-hidden');
  4055. });
  4056. $this.modal.data({'mwidth': w, 'mheight': h});
  4057. });
  4058. },
  4059. next: function() {
  4060. this.show(this.siblings[(this.index+1)] ? (this.index+1) : 0);
  4061. },
  4062. previous: function() {
  4063. this.show(this.siblings[(this.index-1)] ? (this.index-1) : this.siblings.length-1);
  4064. }
  4065. });
  4066. // Plugins
  4067. UI.plugin('lightbox', 'image', {
  4068. init: function(lightbox) {
  4069. lightbox.on("showitem.uk.lightbox", function(e, data){
  4070. if (data.type == 'image' || data.source && data.source.match(/\.(jpg|jpeg|png|gif|svg)$/i)) {
  4071. var resolve = function(source, width, height) {
  4072. data.meta = {
  4073. content : '<img class="uk-responsive-width" width="'+width+'" height="'+height+'" src ="'+source+'">',
  4074. width : width,
  4075. height : height
  4076. };
  4077. data.type = 'image';
  4078. data.promise.resolve();
  4079. };
  4080. if (!cache[data.source]) {
  4081. var img = new Image();
  4082. img.onerror = function(){
  4083. data.promise.reject('Loading image failed');
  4084. };
  4085. img.onload = function(){
  4086. cache[data.source] = {width: img.width, height: img.height};
  4087. resolve(data.source, cache[data.source].width, cache[data.source].height);
  4088. };
  4089. img.src = data.source;
  4090. } else {
  4091. resolve(data.source, cache[data.source].width, cache[data.source].height);
  4092. }
  4093. }
  4094. });
  4095. }
  4096. });
  4097. UI.plugin("lightbox", "youtube", {
  4098. init: function(lightbox) {
  4099. var youtubeRegExp = /(\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)&?(.*)/,
  4100. youtubeRegExpShort = /youtu\.be\/(.*)/;
  4101. lightbox.on("showitem.uk.lightbox", function(e, data){
  4102. var id, matches, resolve = function(id, width, height) {
  4103. data.meta = {
  4104. content: '<iframe src="//www.youtube.com/embed/'+id+'" width="'+width+'" height="'+height+'" style="max-width:100%;"'+(modal.lightbox.options.allowfullscreen?' allowfullscreen':'')+'></iframe>',
  4105. width: width,
  4106. height: height
  4107. };
  4108. data.type = 'iframe';
  4109. data.promise.resolve();
  4110. };
  4111. if (matches = data.source.match(youtubeRegExp)) {
  4112. id = matches[2];
  4113. }
  4114. if (matches = data.source.match(youtubeRegExpShort)) {
  4115. id = matches[1];
  4116. }
  4117. if (id) {
  4118. if(!cache[id]) {
  4119. var img = new Image(), lowres = false;
  4120. img.onerror = function(){
  4121. cache[id] = {width:640, height:320};
  4122. resolve(id, cache[id].width, cache[id].height);
  4123. };
  4124. img.onload = function(){
  4125. //youtube default 404 thumb, fall back to lowres
  4126. if (img.width == 120 && img.height == 90) {
  4127. if (!lowres) {
  4128. lowres = true;
  4129. img.src = '//img.youtube.com/vi/' + id + '/0.jpg';
  4130. } else {
  4131. cache[id] = {width: 640, height: 320};
  4132. resolve(id, cache[id].width, cache[id].height);
  4133. }
  4134. } else {
  4135. cache[id] = {width: img.width, height: img.height};
  4136. resolve(id, img.width, img.height);
  4137. }
  4138. };
  4139. img.src = '//img.youtube.com/vi/'+id+'/maxresdefault.jpg';
  4140. } else {
  4141. resolve(id, cache[id].width, cache[id].height);
  4142. }
  4143. e.stopImmediatePropagation();
  4144. }
  4145. });
  4146. }
  4147. });
  4148. UI.plugin("lightbox", "vimeo", {
  4149. init: function(lightbox) {
  4150. var regex = /(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/, matches;
  4151. lightbox.on("showitem.uk.lightbox", function(e, data){
  4152. var id, resolve = function(id, width, height) {
  4153. data.meta = {
  4154. content: '<iframe src="//player.vimeo.com/video/'+id+'" width="'+width+'" height="'+height+'" style="width:100%;box-sizing:border-box;"'+(modal.lightbox.options.allowfullscreen?' allowfullscreen':'')+'></iframe>',
  4155. width: width,
  4156. height: height
  4157. };
  4158. data.type = 'iframe';
  4159. data.promise.resolve();
  4160. };
  4161. if (matches = data.source.match(regex)) {
  4162. id = matches[2];
  4163. if(!cache[id]) {
  4164. UI.$.ajax({
  4165. type : 'GET',
  4166. url : '//vimeo.com/api/oembed.json?url=' + encodeURI(data.source),
  4167. jsonp : 'callback',
  4168. dataType : 'jsonp',
  4169. success : function(data) {
  4170. cache[id] = {width:data.width, height:data.height};
  4171. resolve(id, cache[id].width, cache[id].height);
  4172. }
  4173. });
  4174. } else {
  4175. resolve(id, cache[id].width, cache[id].height);
  4176. }
  4177. e.stopImmediatePropagation();
  4178. }
  4179. });
  4180. }
  4181. });
  4182. UI.plugin("lightbox", "video", {
  4183. init: function(lightbox) {
  4184. lightbox.on("showitem.uk.lightbox", function(e, data){
  4185. var resolve = function(source, width, height) {
  4186. data.meta = {
  4187. content: '<video class="uk-responsive-width" src="'+source+'" width="'+width+'" height="'+height+'" controls></video>',
  4188. width: width,
  4189. height: height
  4190. };
  4191. data.type = 'video';
  4192. data.promise.resolve();
  4193. };
  4194. if (data.type == 'video' || data.source.match(/\.(mp4|webm|ogv)$/i)) {
  4195. if (!cache[data.source]) {
  4196. var vid = UI.$('<video style="position:fixed;visibility:hidden;top:-10000px;"></video>').attr('src', data.source).appendTo('body');
  4197. var idle = setInterval(function() {
  4198. if (vid[0].videoWidth) {
  4199. clearInterval(idle);
  4200. cache[data.source] = {width: vid[0].videoWidth, height: vid[0].videoHeight};
  4201. resolve(data.source, cache[data.source].width, cache[data.source].height);
  4202. vid.remove();
  4203. }
  4204. }, 20);
  4205. } else {
  4206. resolve(data.source, cache[data.source].width, cache[data.source].height);
  4207. }
  4208. }
  4209. });
  4210. }
  4211. });
  4212. UIkit.plugin("lightbox", "iframe", {
  4213. init: function (lightbox) {
  4214. lightbox.on("showitem.uk.lightbox", function (e, data) {
  4215. var resolve = function (source, width, height) {
  4216. data.meta = {
  4217. content: '<iframe class="uk-responsive-width" src="' + source + '" width="' + width + '" height="' + height + '"'+(modal.lightbox.options.allowfullscreen?' allowfullscreen':'')+'></iframe>',
  4218. width: width,
  4219. height: height
  4220. };
  4221. data.type = 'iframe';
  4222. data.promise.resolve();
  4223. };
  4224. if (data.type === 'iframe' || data.source.match(/\.(html|php)$/)) {
  4225. resolve(data.source, (lightbox.options.width || 800), (lightbox.options.height || 600));
  4226. }
  4227. });
  4228. }
  4229. });
  4230. function getModal(lightbox) {
  4231. if (modal) {
  4232. modal.lightbox = lightbox;
  4233. return modal;
  4234. }
  4235. // init lightbox container
  4236. modal = UI.$([
  4237. '<div class="uk-modal">',
  4238. '<div class="uk-modal-dialog uk-modal-dialog-lightbox uk-slidenav-position" style="margin-left:auto;margin-right:auto;width:200px;height:200px;top:'+Math.abs(window.innerHeight/2 - 200)+'px;">',
  4239. '<a href="javascript:void(0);" class="uk-modal-close uk-close uk-close-alt"></a>',
  4240. '<div class="uk-lightbox-content"></div>',
  4241. '<div class="uk-modal-spinner uk-hidden"></div>',
  4242. '</div>',
  4243. '</div>'
  4244. ].join('')).appendTo('body');
  4245. modal.dialog = modal.find('.uk-modal-dialog:first');
  4246. modal.content = modal.find('.uk-lightbox-content:first');
  4247. modal.loader = modal.find('.uk-modal-spinner:first');
  4248. modal.closer = modal.find('.uk-close.uk-close-alt');
  4249. modal.modal = UI.modal(modal, {modal:false});
  4250. // next / previous
  4251. modal.on("swipeRight swipeLeft", function(e) {
  4252. modal.lightbox[e.type=='swipeLeft' ? 'next':'previous']();
  4253. }).on("click", "[data-lightbox-previous], [data-lightbox-next]", function(e){
  4254. e.preventDefault();
  4255. modal.lightbox[UI.$(this).is('[data-lightbox-next]') ? 'next':'previous']();
  4256. });
  4257. // destroy content on modal hide
  4258. modal.on("hide.uk.modal", function(e) {
  4259. modal.content.html('');
  4260. });
  4261. var resizeCache = {w: window.innerWidth, h:window.innerHeight};
  4262. UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(e){
  4263. if (resizeCache.w !== window.innerWidth && modal.is(':visible') && !UI.Utils.isFullscreen()) {
  4264. modal.lightbox.fitSize();
  4265. }
  4266. resizeCache = {w: window.innerWidth, h:window.innerHeight};
  4267. }, 100));
  4268. modal.lightbox = lightbox;
  4269. return modal;
  4270. }
  4271. UI.lightbox.create = function(items, options) {
  4272. if (!items) return;
  4273. var group = [], o;
  4274. items.forEach(function(item) {
  4275. group.push(UI.$.extend({
  4276. source : '',
  4277. title : '',
  4278. type : 'auto',
  4279. link : false
  4280. }, (typeof(item) == 'string' ? {'source': item} : item)));
  4281. });
  4282. o = UI.lightbox(UI.$.extend({}, options, {'group':group}));
  4283. return o;
  4284. };
  4285. return UI.lightbox;
  4286. });
  4287. /*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  4288. /*
  4289. * Based on Nestable jQuery Plugin - Copyright (c) 2012 David Bushell - http://dbushell.com/
  4290. */
  4291. (function(addon) {
  4292. var component;
  4293. if (window.UIkit) {
  4294. component = addon(UIkit);
  4295. }
  4296. if (typeof define == "function" && define.amd) {
  4297. define("uikit-nestable", ["uikit"], function(){
  4298. return component || addon(UIkit);
  4299. });
  4300. }
  4301. })(function(UI) {
  4302. "use strict";
  4303. var hasTouch = 'ontouchstart' in window,
  4304. html = UI.$html,
  4305. touchedlists = [],
  4306. $win = UI.$win,
  4307. draggingElement;
  4308. var eStart = hasTouch ? 'touchstart' : 'mousedown',
  4309. eMove = hasTouch ? 'touchmove' : 'mousemove',
  4310. eEnd = hasTouch ? 'touchend' : 'mouseup',
  4311. eCancel = hasTouch ? 'touchcancel' : 'mouseup';
  4312. UI.component('nestable', {
  4313. defaults: {
  4314. listBaseClass : 'uk-nestable',
  4315. listClass : 'uk-nestable-list',
  4316. listItemClass : 'uk-nestable-item',
  4317. dragClass : 'uk-nestable-dragged',
  4318. movingClass : 'uk-nestable-moving',
  4319. noChildrenClass : 'uk-nestable-nochildren',
  4320. emptyClass : 'uk-nestable-empty',
  4321. handleClass : '',
  4322. collapsedClass : 'uk-collapsed',
  4323. placeholderClass: 'uk-nestable-placeholder',
  4324. noDragClass : 'uk-nestable-nodrag',
  4325. group : false,
  4326. maxDepth : 10,
  4327. threshold : 20,
  4328. idlethreshold : 10,
  4329. },
  4330. boot: function() {
  4331. // adjust document scrolling
  4332. UI.$html.on('mousemove touchmove', function(e) {
  4333. if (draggingElement) {
  4334. var top = draggingElement.offset().top;
  4335. if (top < UI.$win.scrollTop()) {
  4336. UI.$win.scrollTop(UI.$win.scrollTop() - Math.ceil(draggingElement.height()/2));
  4337. } else if ( (top + draggingElement.height()) > (window.innerHeight + UI.$win.scrollTop()) ) {
  4338. UI.$win.scrollTop(UI.$win.scrollTop() + Math.ceil(draggingElement.height()/2));
  4339. }
  4340. }
  4341. });
  4342. // init code
  4343. UI.ready(function(context) {
  4344. UI.$("[data-uk-nestable]", context).each(function(){
  4345. var ele = UI.$(this);
  4346. if (!ele.data("nestable")) {
  4347. UI.nestable(ele, UI.Utils.options(ele.attr("data-uk-nestable")));
  4348. }
  4349. });
  4350. });
  4351. },
  4352. init: function() {
  4353. var $this = this;
  4354. Object.keys(this.options).forEach(function(key){
  4355. if(String(key).indexOf('Class')!=-1) {
  4356. $this.options['_'+key] = '.' + $this.options[key];
  4357. }
  4358. });
  4359. this.find(this.options._listItemClass).find(">ul").addClass(this.options.listClass);
  4360. this.checkEmptyList();
  4361. this.reset();
  4362. this.element.data('nestable-group', this.options.group || UI.Utils.uid('nestable-group'));
  4363. this.find(this.options._listItemClass).each(function() {
  4364. $this.setParent(UI.$(this));
  4365. });
  4366. this.on('click', '[data-nestable-action]', function(e) {
  4367. if ($this.dragEl || (!hasTouch && e.button !== 0)) {
  4368. return;
  4369. }
  4370. e.preventDefault();
  4371. var target = UI.$(e.currentTarget),
  4372. action = target.data('nestableAction'),
  4373. item = target.closest($this.options._listItemClass);
  4374. if (action === 'collapse') {
  4375. $this.collapseItem(item);
  4376. }
  4377. if (action === 'expand') {
  4378. $this.expandItem(item);
  4379. }
  4380. if (action === 'toggle') {
  4381. $this.toggleItem(item);
  4382. }
  4383. });
  4384. var onStartEvent = function(e) {
  4385. var handle = UI.$(e.target),
  4386. link = handle.is('a[href]') ? handle:handle.parents('a[href]');
  4387. if (e.target === $this.element[0]) {
  4388. return;
  4389. }
  4390. if (handle.is($this.options._noDragClass) || handle.closest($this.options._noDragClass).length) {
  4391. return;
  4392. }
  4393. if (handle.is('[data-nestable-action]') || handle.closest('[data-nestable-action]').length) {
  4394. return;
  4395. }
  4396. if ($this.options.handleClass && !handle.hasClass($this.options.handleClass)) {
  4397. if ($this.options.handleClass) {
  4398. handle = handle.closest($this.options._handleClass);
  4399. }
  4400. }
  4401. if (!handle.length || $this.dragEl || (!hasTouch && e.button !== 0) || (hasTouch && e.touches.length !== 1)) {
  4402. return;
  4403. }
  4404. if (e.originalEvent && e.originalEvent.touches) {
  4405. e = evt.originalEvent.touches[0];
  4406. }
  4407. $this.delayMove = function(evt) {
  4408. link = false;
  4409. evt.preventDefault();
  4410. $this.dragStart(e);
  4411. $this.trigger('start.uk.nestable', [$this]);
  4412. $this.delayMove = false;
  4413. };
  4414. $this.delayMove.x = parseInt(e.pageX, 10);
  4415. $this.delayMove.y = parseInt(e.pageY, 10);
  4416. $this.delayMove.threshold = $this.options.idlethreshold;
  4417. if (link.length && eEnd == 'touchend') {
  4418. $this.one(eEnd, function(){
  4419. if (link && link.attr('href').trim()) {
  4420. location.href = link.attr('href');
  4421. }
  4422. });
  4423. }
  4424. e.preventDefault();
  4425. };
  4426. var onMoveEvent = function(e) {
  4427. if (e.originalEvent && e.originalEvent.touches) {
  4428. e = e.originalEvent.touches[0];
  4429. }
  4430. if ($this.delayMove && (Math.abs(e.pageX - $this.delayMove.x) > $this.delayMove.threshold || Math.abs(e.pageY - $this.delayMove.y) > $this.delayMove.threshold)) {
  4431. if (!window.getSelection().toString()) {
  4432. $this.delayMove(e);
  4433. } else {
  4434. $this.delayMove = false;
  4435. }
  4436. }
  4437. if ($this.dragEl) {
  4438. e.preventDefault();
  4439. $this.dragMove(e);
  4440. $this.trigger('move.uk.nestable', [$this]);
  4441. }
  4442. };
  4443. var onEndEvent = function(e) {
  4444. if ($this.dragEl) {
  4445. e.preventDefault();
  4446. $this.dragStop(hasTouch ? e.touches[0] : e);
  4447. }
  4448. draggingElement = false;
  4449. $this.delayMove = false;
  4450. };
  4451. if (hasTouch) {
  4452. this.element[0].addEventListener(eStart, onStartEvent, false);
  4453. window.addEventListener(eMove, onMoveEvent, false);
  4454. window.addEventListener(eEnd, onEndEvent, false);
  4455. window.addEventListener(eCancel, onEndEvent, false);
  4456. } else {
  4457. this.on(eStart, onStartEvent);
  4458. $win.on(eMove, onMoveEvent);
  4459. $win.on(eEnd, onEndEvent);
  4460. }
  4461. },
  4462. serialize: function() {
  4463. var data,
  4464. depth = 0,
  4465. list = this,
  4466. step = function(level, depth) {
  4467. var array = [ ], items = level.children(list.options._listItemClass);
  4468. items.each(function() {
  4469. var li = UI.$(this),
  4470. item = {}, attribute,
  4471. sub = li.children(list.options._listClass);
  4472. for (var i = 0, attr, val; i < li[0].attributes.length; i++) {
  4473. attribute = li[0].attributes[i];
  4474. if (attribute.name.indexOf('data-') === 0) {
  4475. attr = attribute.name.substr(5);
  4476. val = UI.Utils.str2json(attribute.value);
  4477. item[attr] = (val || attribute.value=='false' || attribute.value=='0') ? val:attribute.value;
  4478. }
  4479. }
  4480. if (sub.length) {
  4481. item.children = step(sub, depth + 1);
  4482. }
  4483. array.push(item);
  4484. });
  4485. return array;
  4486. };
  4487. data = step(list.element, depth);
  4488. return data;
  4489. },
  4490. list: function(options) {
  4491. var data = [],
  4492. list = this,
  4493. depth = 0,
  4494. step = function(level, depth, parent) {
  4495. var items = level.children(options._listItemClass);
  4496. items.each(function(index) {
  4497. var li = UI.$(this),
  4498. item = UI.$.extend({parent_id: (parent ? parent : null), depth: depth, order: index}, li.data()),
  4499. sub = li.children(options._listClass);
  4500. data.push(item);
  4501. if (sub.length) {
  4502. step(sub, depth + 1, li.data(options.idProperty || 'id'));
  4503. }
  4504. });
  4505. };
  4506. options = UI.$.extend({}, list.options, options);
  4507. step(list.element, depth);
  4508. return data;
  4509. },
  4510. reset: function() {
  4511. this.mouse = {
  4512. offsetX : 0,
  4513. offsetY : 0,
  4514. startX : 0,
  4515. startY : 0,
  4516. lastX : 0,
  4517. lastY : 0,
  4518. nowX : 0,
  4519. nowY : 0,
  4520. distX : 0,
  4521. distY : 0,
  4522. dirAx : 0,
  4523. dirX : 0,
  4524. dirY : 0,
  4525. lastDirX : 0,
  4526. lastDirY : 0,
  4527. distAxX : 0,
  4528. distAxY : 0
  4529. };
  4530. this.moving = false;
  4531. this.dragEl = null;
  4532. this.dragRootEl = null;
  4533. this.dragDepth = 0;
  4534. this.hasNewRoot = false;
  4535. this.pointEl = null;
  4536. for (var i=0; i<touchedlists.length; i++) {
  4537. this.checkEmptyList(touchedlists[i]);
  4538. }
  4539. touchedlists = [];
  4540. },
  4541. toggleItem: function(li) {
  4542. this[li.hasClass(this.options.collapsedClass) ? "expandItem":"collapseItem"](li);
  4543. },
  4544. expandItem: function(li) {
  4545. li.removeClass(this.options.collapsedClass);
  4546. },
  4547. collapseItem: function(li) {
  4548. var lists = li.children(this.options._listClass);
  4549. if (lists.length) {
  4550. li.addClass(this.options.collapsedClass);
  4551. }
  4552. },
  4553. expandAll: function() {
  4554. var list = this;
  4555. this.find(list.options._listItemClass).each(function() {
  4556. list.expandItem(UI.$(this));
  4557. });
  4558. },
  4559. collapseAll: function() {
  4560. var list = this;
  4561. this.find(list.options._listItemClass).each(function() {
  4562. list.collapseItem(UI.$(this));
  4563. });
  4564. },
  4565. setParent: function(li) {
  4566. if (li.children(this.options._listClass).length) {
  4567. li.addClass("uk-parent");
  4568. }
  4569. },
  4570. unsetParent: function(li) {
  4571. li.removeClass('uk-parent '+this.options.collapsedClass);
  4572. li.children(this.options._listClass).remove();
  4573. },
  4574. dragStart: function(e) {
  4575. var mouse = this.mouse,
  4576. target = UI.$(e.target),
  4577. dragItem = target.closest(this.options._listItemClass),
  4578. offset = dragItem.offset();
  4579. this.placeEl = dragItem;
  4580. mouse.offsetX = e.pageX - offset.left;
  4581. mouse.offsetY = e.pageY - offset.top;
  4582. mouse.startX = mouse.lastX = offset.left;
  4583. mouse.startY = mouse.lastY = offset.top;
  4584. this.dragRootEl = this.element;
  4585. this.dragEl = UI.$('<ul></ul>').addClass(this.options.listClass + ' ' + this.options.dragClass).append(dragItem.clone());
  4586. this.dragEl.css('width', dragItem.width());
  4587. this.placeEl.addClass(this.options.placeholderClass);
  4588. draggingElement = this.dragEl;
  4589. this.tmpDragOnSiblings = [dragItem[0].previousSibling, dragItem[0].nextSibling];
  4590. UI.$body.append(this.dragEl);
  4591. this.dragEl.css({
  4592. left : offset.left,
  4593. top : offset.top
  4594. });
  4595. // total depth of dragging item
  4596. var i, depth, items = this.dragEl.find(this.options._listItemClass);
  4597. for (i = 0; i < items.length; i++) {
  4598. depth = UI.$(items[i]).parents(this.options._listClass+','+this.options._listBaseClass).length;
  4599. if (depth > this.dragDepth) {
  4600. this.dragDepth = depth;
  4601. }
  4602. }
  4603. html.addClass(this.options.movingClass);
  4604. },
  4605. dragStop: function(e) {
  4606. var el = UI.$(this.placeEl),
  4607. root = this.placeEl.parents(this.options._listBaseClass+':first');
  4608. this.placeEl.removeClass(this.options.placeholderClass);
  4609. this.dragEl.remove();
  4610. if (this.element[0] !== root[0]) {
  4611. root.trigger('change.uk.nestable',[root.data('nestable'), el, 'added']);
  4612. this.element.trigger('change.uk.nestable', [this, el, 'removed']);
  4613. } else {
  4614. this.element.trigger('change.uk.nestable',[this, el, "moved"]);
  4615. }
  4616. this.trigger('stop.uk.nestable', [this, el]);
  4617. this.reset();
  4618. html.removeClass(this.options.movingClass);
  4619. },
  4620. dragMove: function(e) {
  4621. var list, parent, prev, next, depth,
  4622. opt = this.options,
  4623. mouse = this.mouse,
  4624. maxDepth = this.dragRootEl ? this.dragRootEl.data('nestable').options.maxDepth : opt.maxDepth;
  4625. this.dragEl.css({
  4626. left : e.pageX - mouse.offsetX,
  4627. top : e.pageY - mouse.offsetY
  4628. });
  4629. // mouse position last events
  4630. mouse.lastX = mouse.nowX;
  4631. mouse.lastY = mouse.nowY;
  4632. // mouse position this events
  4633. mouse.nowX = e.pageX;
  4634. mouse.nowY = e.pageY;
  4635. // distance mouse moved between events
  4636. mouse.distX = mouse.nowX - mouse.lastX;
  4637. mouse.distY = mouse.nowY - mouse.lastY;
  4638. // direction mouse was moving
  4639. mouse.lastDirX = mouse.dirX;
  4640. mouse.lastDirY = mouse.dirY;
  4641. // direction mouse is now moving (on both axis)
  4642. mouse.dirX = mouse.distX === 0 ? 0 : mouse.distX > 0 ? 1 : -1;
  4643. mouse.dirY = mouse.distY === 0 ? 0 : mouse.distY > 0 ? 1 : -1;
  4644. // axis mouse is now moving on
  4645. var newAx = Math.abs(mouse.distX) > Math.abs(mouse.distY) ? 1 : 0;
  4646. // do nothing on first move
  4647. if (!mouse.moving) {
  4648. mouse.dirAx = newAx;
  4649. mouse.moving = true;
  4650. return;
  4651. }
  4652. // calc distance moved on this axis (and direction)
  4653. if (mouse.dirAx !== newAx) {
  4654. mouse.distAxX = 0;
  4655. mouse.distAxY = 0;
  4656. } else {
  4657. mouse.distAxX += Math.abs(mouse.distX);
  4658. if (mouse.dirX !== 0 && mouse.dirX !== mouse.lastDirX) {
  4659. mouse.distAxX = 0;
  4660. }
  4661. mouse.distAxY += Math.abs(mouse.distY);
  4662. if (mouse.dirY !== 0 && mouse.dirY !== mouse.lastDirY) {
  4663. mouse.distAxY = 0;
  4664. }
  4665. }
  4666. mouse.dirAx = newAx;
  4667. /**
  4668. * move horizontal
  4669. */
  4670. if (mouse.dirAx && mouse.distAxX >= opt.threshold) {
  4671. // reset move distance on x-axis for new phase
  4672. mouse.distAxX = 0;
  4673. prev = this.placeEl.prev('li');
  4674. // increase horizontal level if previous sibling exists, is not collapsed, and does not have a 'no children' class
  4675. if (mouse.distX > 0 && prev.length && !prev.hasClass(opt.collapsedClass) && !prev.hasClass(opt.noChildrenClass)) {
  4676. // cannot increase level when item above is collapsed
  4677. list = prev.find(opt._listClass).last();
  4678. // check if depth limit has reached
  4679. depth = this.placeEl.parents(opt._listClass+','+opt._listBaseClass).length;
  4680. if (depth + this.dragDepth <= maxDepth) {
  4681. // create new sub-level if one doesn't exist
  4682. if (!list.length) {
  4683. list = UI.$('<ul/>').addClass(opt.listClass);
  4684. list.append(this.placeEl);
  4685. prev.append(list);
  4686. this.setParent(prev);
  4687. } else {
  4688. // else append to next level up
  4689. list = prev.children(opt._listClass).last();
  4690. list.append(this.placeEl);
  4691. }
  4692. }
  4693. }
  4694. // decrease horizontal level
  4695. if (mouse.distX < 0) {
  4696. // we cannot decrease the level if an item precedes the current one
  4697. next = this.placeEl.next(opt._listItemClass);
  4698. if (!next.length) {
  4699. // get parent ul of the list item
  4700. var parentUl = this.placeEl.closest([opt._listBaseClass, opt._listClass].join(','));
  4701. // try to get the li surrounding the ul
  4702. var surroundingLi = parentUl.closest(opt._listItemClass);
  4703. // if the ul is inside of a li (meaning it is nested)
  4704. if (surroundingLi.length) {
  4705. // we can decrease the horizontal level
  4706. surroundingLi.after(this.placeEl);
  4707. // if the previous parent ul is now empty
  4708. if (!parentUl.children().length) {
  4709. this.unsetParent(surroundingLi);
  4710. }
  4711. }
  4712. }
  4713. }
  4714. }
  4715. var isEmpty = false;
  4716. // find list item under cursor
  4717. var pointX = e.pageX - (window.pageXOffset || document.scrollLeft || 0),
  4718. pointY = e.pageY - (window.pageYOffset || document.documentElement.scrollTop);
  4719. this.pointEl = UI.$(document.elementFromPoint(pointX, pointY));
  4720. if (opt.handleClass && this.pointEl.hasClass(opt.handleClass)) {
  4721. this.pointEl = this.pointEl.closest(opt._listItemClass);
  4722. } else {
  4723. var nestableitem = this.pointEl.closest(opt._listItemClass);
  4724. if (nestableitem.length) {
  4725. this.pointEl = nestableitem;
  4726. }
  4727. }
  4728. if (this.placeEl.find(this.pointEl).length) {
  4729. return;
  4730. }
  4731. if (this.pointEl.data('nestable') && !this.pointEl.children().length) {
  4732. isEmpty = true;
  4733. this.checkEmptyList(this.pointEl);
  4734. } else if (!this.pointEl.length || !this.pointEl.hasClass(opt.listItemClass)) {
  4735. return;
  4736. }
  4737. // find parent list of item under cursor
  4738. var pointElRoot = this.element,
  4739. tmpRoot = this.pointEl.closest(this.options._listBaseClass),
  4740. isNewRoot = pointElRoot[0] != tmpRoot[0];
  4741. /**
  4742. * move vertical
  4743. */
  4744. if (!mouse.dirAx || isNewRoot || isEmpty) {
  4745. // check if groups match if dragging over new root
  4746. if (isNewRoot && opt.group !== tmpRoot.data('nestable-group')) {
  4747. return;
  4748. } else {
  4749. touchedlists.push(pointElRoot);
  4750. }
  4751. // check depth limit
  4752. depth = this.dragDepth - 1 + this.pointEl.parents(opt._listClass+','+opt._listBaseClass).length;
  4753. if (depth > maxDepth) {
  4754. return;
  4755. }
  4756. var before = e.pageY < (this.pointEl.offset().top + this.pointEl.height() / 2);
  4757. parent = this.placeEl.parent();
  4758. if (isEmpty) {
  4759. this.pointEl.append(this.placeEl);
  4760. } else if (before) {
  4761. this.pointEl.before(this.placeEl);
  4762. } else {
  4763. this.pointEl.after(this.placeEl);
  4764. }
  4765. if (!parent.children().length) {
  4766. if (!parent.data("nestable")) this.unsetParent(parent.parent());
  4767. }
  4768. this.checkEmptyList(this.dragRootEl);
  4769. this.checkEmptyList(pointElRoot);
  4770. // parent root list has changed
  4771. if (isNewRoot) {
  4772. this.dragRootEl = tmpRoot;
  4773. this.hasNewRoot = this.element[0] !== this.dragRootEl[0];
  4774. }
  4775. }
  4776. },
  4777. checkEmptyList: function(list) {
  4778. list = list ? UI.$(list) : this.element;
  4779. if (this.options.emptyClass) {
  4780. list[!list.children().length ? 'addClass':'removeClass'](this.options.emptyClass);
  4781. }
  4782. }
  4783. });
  4784. return UI.nestable;
  4785. });
  4786. /*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  4787. (function(addon) {
  4788. var component;
  4789. if (window.UIkit) {
  4790. component = addon(UIkit);
  4791. }
  4792. if (typeof define == "function" && define.amd) {
  4793. define("uikit-notify", ["uikit"], function(){
  4794. return component || addon(UIkit);
  4795. });
  4796. }
  4797. })(function(UI){
  4798. "use strict";
  4799. var containers = {},
  4800. messages = {},
  4801. notify = function(options){
  4802. if (UI.$.type(options) == 'string') {
  4803. options = { message: options };
  4804. }
  4805. if (arguments[1]) {
  4806. options = UI.$.extend(options, UI.$.type(arguments[1]) == 'string' ? {status:arguments[1]} : arguments[1]);
  4807. }
  4808. return (new Message(options)).show();
  4809. },
  4810. closeAll = function(group, instantly){
  4811. var id;
  4812. if (group) {
  4813. for(id in messages) { if(group===messages[id].group) messages[id].close(instantly); }
  4814. } else {
  4815. for(id in messages) { messages[id].close(instantly); }
  4816. }
  4817. };
  4818. var Message = function(options){
  4819. this.options = UI.$.extend({}, Message.defaults, options);
  4820. this.uuid = UI.Utils.uid("notifymsg");
  4821. this.element = UI.$([
  4822. '<div class="uk-notify-message">',
  4823. '<a class="uk-close"></a>',
  4824. '<div></div>',
  4825. '</div>'
  4826. ].join('')).data("notifyMessage", this);
  4827. this.content(this.options.message);
  4828. // status
  4829. if (this.options.status) {
  4830. this.element.addClass('uk-notify-message-'+this.options.status);
  4831. this.currentstatus = this.options.status;
  4832. }
  4833. this.group = this.options.group;
  4834. messages[this.uuid] = this;
  4835. if(!containers[this.options.pos]) {
  4836. containers[this.options.pos] = UI.$('<div class="uk-notify uk-notify-'+this.options.pos+'"></div>').appendTo('body').on("click", ".uk-notify-message", function(){
  4837. var message = UI.$(this).data("notifyMessage");
  4838. message.element.trigger('manualclose.uk.notify', [message]);
  4839. message.close();
  4840. });
  4841. }
  4842. };
  4843. UI.$.extend(Message.prototype, {
  4844. uuid: false,
  4845. element: false,
  4846. timout: false,
  4847. currentstatus: "",
  4848. group: false,
  4849. show: function() {
  4850. if (this.element.is(":visible")) return;
  4851. var $this = this;
  4852. containers[this.options.pos].show().prepend(this.element);
  4853. var marginbottom = parseInt(this.element.css("margin-bottom"), 10);
  4854. this.element.css({"opacity":0, "margin-top": -1*this.element.outerHeight(), "margin-bottom":0}).animate({"opacity":1, "margin-top": 0, "margin-bottom":marginbottom}, function(){
  4855. if ($this.options.timeout) {
  4856. var closefn = function(){ $this.close(); };
  4857. $this.timeout = setTimeout(closefn, $this.options.timeout);
  4858. $this.element.hover(
  4859. function() { clearTimeout($this.timeout); },
  4860. function() { $this.timeout = setTimeout(closefn, $this.options.timeout); }
  4861. );
  4862. }
  4863. });
  4864. return this;
  4865. },
  4866. close: function(instantly) {
  4867. var $this = this,
  4868. finalize = function(){
  4869. $this.element.remove();
  4870. if (!containers[$this.options.pos].children().length) {
  4871. containers[$this.options.pos].hide();
  4872. }
  4873. $this.options.onClose.apply($this, []);
  4874. $this.element.trigger('close.uk.notify', [$this]);
  4875. delete messages[$this.uuid];
  4876. };
  4877. if (this.timeout) clearTimeout(this.timeout);
  4878. if (instantly) {
  4879. finalize();
  4880. } else {
  4881. this.element.animate({"opacity":0, "margin-top": -1* this.element.outerHeight(), "margin-bottom":0}, function(){
  4882. finalize();
  4883. });
  4884. }
  4885. },
  4886. content: function(html){
  4887. var container = this.element.find(">div");
  4888. if(!html) {
  4889. return container.html();
  4890. }
  4891. container.html(html);
  4892. return this;
  4893. },
  4894. status: function(status) {
  4895. if (!status) {
  4896. return this.currentstatus;
  4897. }
  4898. this.element.removeClass('uk-notify-message-'+this.currentstatus).addClass('uk-notify-message-'+status);
  4899. this.currentstatus = status;
  4900. return this;
  4901. }
  4902. });
  4903. Message.defaults = {
  4904. message: "",
  4905. status: "",
  4906. timeout: 5000,
  4907. group: null,
  4908. pos: 'top-center',
  4909. onClose: function() {}
  4910. };
  4911. UI.notify = notify;
  4912. UI.notify.message = Message;
  4913. UI.notify.closeAll = closeAll;
  4914. return notify;
  4915. });
  4916. /*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  4917. (function(addon) {
  4918. var component;
  4919. if (window.UIkit) {
  4920. component = addon(UIkit);
  4921. }
  4922. if (typeof define == "function" && define.amd) {
  4923. define("uikit-slideshow", ["uikit"], function() {
  4924. return component || addon(UIkit);
  4925. });
  4926. }
  4927. })(function(UI) {
  4928. "use strict";
  4929. var Animations, playerId = 0;
  4930. UI.component('slideshow', {
  4931. defaults: {
  4932. animation : "fade",
  4933. duration : 500,
  4934. height : "auto",
  4935. start : 0,
  4936. autoplay : false,
  4937. autoplayInterval : 7000,
  4938. videoautoplay : true,
  4939. videomute : true,
  4940. slices : 15,
  4941. pauseOnHover : true,
  4942. kenburns : false,
  4943. kenburnsanimations : [
  4944. 'uk-animation-middle-left',
  4945. 'uk-animation-top-right',
  4946. 'uk-animation-bottom-left',
  4947. 'uk-animation-top-center',
  4948. '', // middle-center
  4949. 'uk-animation-bottom-right'
  4950. ]
  4951. },
  4952. current : false,
  4953. interval : null,
  4954. hovering : false,
  4955. boot: function() {
  4956. // init code
  4957. UI.ready(function(context) {
  4958. UI.$('[data-uk-slideshow]', context).each(function() {
  4959. var slideshow = UI.$(this);
  4960. if (!slideshow.data("slideshow")) {
  4961. UI.slideshow(slideshow, UI.Utils.options(slideshow.attr("data-uk-slideshow")));
  4962. }
  4963. });
  4964. });
  4965. },
  4966. init: function() {
  4967. var $this = this;
  4968. this.container = this.element.hasClass('uk-slideshow') ? this.element : UI.$(this.find('.uk-slideshow:first'));
  4969. this.current = this.options.start;
  4970. this.animating = false;
  4971. this.fixFullscreen = navigator.userAgent.match(/(iPad|iPhone|iPod)/g) && this.container.hasClass('uk-slideshow-fullscreen'); // viewport unit fix for height:100vh - should be fixed in iOS 8
  4972. if (this.options.kenburns) {
  4973. this.kbanimduration = this.options.kenburns === true ? '15s': this.options.kenburns;
  4974. if (!String(this.kbanimduration).match(/(ms|s)$/)) {
  4975. this.kbanimduration += 'ms';
  4976. }
  4977. if (typeof(this.options.kenburnsanimations) == 'string') {
  4978. this.options.kenburnsanimations = this.options.kenburnsanimations.split(',');
  4979. }
  4980. }
  4981. this.update();
  4982. this.on("click.uk.slideshow", '[data-uk-slideshow-item]', function(e) {
  4983. e.preventDefault();
  4984. var slide = UI.$(this).attr('data-uk-slideshow-item');
  4985. if ($this.current == slide) return;
  4986. switch(slide) {
  4987. case 'next':
  4988. case 'previous':
  4989. $this[slide=='next' ? 'next':'previous']();
  4990. break;
  4991. default:
  4992. $this.show(parseInt(slide, 10));
  4993. }
  4994. $this.stop();
  4995. });
  4996. UI.$win.on("resize load", UI.Utils.debounce(function() {
  4997. $this.resize();
  4998. if ($this.fixFullscreen) {
  4999. $this.container.css('height', window.innerHeight);
  5000. $this.slides.css('height', window.innerHeight);
  5001. }
  5002. }, 100));
  5003. // chrome image load fix
  5004. setTimeout(function(){
  5005. $this.resize();
  5006. }, 80);
  5007. // Set autoplay
  5008. if (this.options.autoplay) {
  5009. this.start();
  5010. }
  5011. if (this.options.videoautoplay && this.slides.eq(this.current).data('media')) {
  5012. this.playmedia(this.slides.eq(this.current).data('media'));
  5013. }
  5014. if (this.options.kenburns) {
  5015. this.applyKenBurns(this.slides.eq(this.current));
  5016. }
  5017. this.container.on({
  5018. mouseenter: function() { if ($this.options.pauseOnHover) $this.hovering = true; },
  5019. mouseleave: function() { $this.hovering = false; }
  5020. });
  5021. this.on('swipeRight swipeLeft', function(e) {
  5022. $this[e.type=='swipeLeft' ? 'next' : 'previous']();
  5023. });
  5024. this.on('display.uk.check', function(){
  5025. if ($this.element.is(":visible")) {
  5026. $this.resize();
  5027. if ($this.fixFullscreen) {
  5028. $this.container.css('height', window.innerHeight);
  5029. $this.slides.css('height', window.innerHeight);
  5030. }
  5031. }
  5032. });
  5033. UI.domObserve(this.element, function(e) {
  5034. if ($this.container.children(':not([data-slide])').length) {
  5035. $this.update(true);
  5036. }
  5037. });
  5038. },
  5039. update: function(resize) {
  5040. var $this = this, canvas, processed = 0;
  5041. this.slides = this.container.children();
  5042. this.slidesCount = this.slides.length;
  5043. if (!this.slides.eq(this.current).length) {
  5044. this.current = 0;
  5045. }
  5046. this.slides.each(function(index) {
  5047. var slide = UI.$(this);
  5048. if (slide.data('processed')) {
  5049. return;
  5050. }
  5051. var media = slide.children('img,video,iframe').eq(0), type = 'html';
  5052. slide.data('media', media);
  5053. slide.data('sizer', media);
  5054. if (media.length) {
  5055. var placeholder;
  5056. type = media[0].nodeName.toLowerCase();
  5057. switch(media[0].nodeName) {
  5058. case 'IMG':
  5059. var cover = UI.$('<div class="uk-cover-background uk-position-cover"></div>').css({'background-image':'url('+ media.attr('src') + ')'});
  5060. if (media.attr('width') && media.attr('height')) {
  5061. placeholder = UI.$('<canvas></canvas>').attr({width:media.attr('width'), height:media.attr('height')});
  5062. media.replaceWith(placeholder);
  5063. media = placeholder;
  5064. placeholder = undefined;
  5065. }
  5066. media.css({width: '100%',height: 'auto', opacity:0});
  5067. slide.prepend(cover).data('cover', cover);
  5068. break;
  5069. case 'IFRAME':
  5070. var src = media[0].src, iframeId = 'sw-'+(++playerId);
  5071. media
  5072. .attr('src', '').on('load', function(){
  5073. if (index !== $this.current || (index == $this.current && !$this.options.videoautoplay)) {
  5074. $this.pausemedia(media);
  5075. }
  5076. if ($this.options.videomute) {
  5077. $this.mutemedia(media);
  5078. var inv = setInterval((function(ic) {
  5079. return function() {
  5080. $this.mutemedia(media);
  5081. if (++ic >= 4) clearInterval(inv);
  5082. }
  5083. })(0), 250);
  5084. }
  5085. })
  5086. .data('slideshow', $this) // add self-reference for the vimeo-ready listener
  5087. .attr('data-player-id', iframeId) // add frameId for the vimeo-ready listener
  5088. .attr('src', [src, (src.indexOf('?') > -1 ? '&':'?'), 'enablejsapi=1&api=1&player_id='+iframeId].join(''))
  5089. .addClass('uk-position-absolute');
  5090. // disable pointer events
  5091. if(!UI.support.touch) media.css('pointer-events', 'none');
  5092. placeholder = true;
  5093. if (UI.cover) {
  5094. UI.cover(media);
  5095. media.attr('data-uk-cover', '{}');
  5096. }
  5097. break;
  5098. case 'VIDEO':
  5099. media.addClass('uk-cover-object uk-position-absolute');
  5100. placeholder = true;
  5101. if ($this.options.videomute) $this.mutemedia(media);
  5102. }
  5103. if (placeholder) {
  5104. canvas = UI.$('<canvas></canvas>').attr({'width': media[0].width, 'height': media[0].height});
  5105. var img = UI.$('<img style="width:100%;height:auto;">').attr('src', canvas[0].toDataURL());
  5106. slide.prepend(img);
  5107. slide.data('sizer', img);
  5108. }
  5109. } else {
  5110. slide.data('sizer', slide);
  5111. }
  5112. if ($this.hasKenBurns(slide)) {
  5113. slide.data('cover').css({
  5114. '-webkit-animation-duration': $this.kbanimduration,
  5115. 'animation-duration': $this.kbanimduration
  5116. });
  5117. }
  5118. slide.data('processed', ++processed);
  5119. slide.attr('data-slide', type);
  5120. });
  5121. if (processed) {
  5122. this.triggers = this.find('[data-uk-slideshow-item]');
  5123. // Set start slide
  5124. this.slides.attr('aria-hidden', 'true').removeClass('uk-active').eq(this.current).addClass('uk-active').attr('aria-hidden', 'false');
  5125. this.triggers.filter('[data-uk-slideshow-item="'+this.current+'"]').addClass('uk-active');
  5126. }
  5127. if (resize && processed) {
  5128. this.resize();
  5129. }
  5130. },
  5131. resize: function() {
  5132. if (this.container.hasClass('uk-slideshow-fullscreen')) return;
  5133. var height = this.options.height;
  5134. if (this.options.height === 'auto') {
  5135. height = 0;
  5136. this.slides.css('height', '').each(function() {
  5137. height = Math.max(height, UI.$(this).height());
  5138. });
  5139. }
  5140. this.container.css('height', height);
  5141. this.slides.css('height', height);
  5142. },
  5143. show: function(index, direction) {
  5144. if (this.animating || this.current == index) return;
  5145. this.animating = true;
  5146. var $this = this,
  5147. current = this.slides.eq(this.current),
  5148. next = this.slides.eq(index),
  5149. dir = direction ? direction : this.current < index ? 1 : -1,
  5150. currentmedia = current.data('media'),
  5151. animation = Animations[this.options.animation] ? this.options.animation : 'fade',
  5152. nextmedia = next.data('media'),
  5153. finalize = function() {
  5154. if (!$this.animating) return;
  5155. if (currentmedia && currentmedia.is('video,iframe')) {
  5156. $this.pausemedia(currentmedia);
  5157. }
  5158. if (nextmedia && nextmedia.is('video,iframe')) {
  5159. $this.playmedia(nextmedia);
  5160. }
  5161. next.addClass("uk-active").attr('aria-hidden', 'false');
  5162. current.removeClass("uk-active").attr('aria-hidden', 'true');
  5163. $this.animating = false;
  5164. $this.current = index;
  5165. UI.Utils.checkDisplay(next, '[class*="uk-animation-"]:not(.uk-cover-background.uk-position-cover)');
  5166. $this.trigger('show.uk.slideshow', [next, current, $this]);
  5167. };
  5168. $this.applyKenBurns(next);
  5169. // animation fallback
  5170. if (!UI.support.animation) {
  5171. animation = 'none';
  5172. }
  5173. current = UI.$(current);
  5174. next = UI.$(next);
  5175. $this.trigger('beforeshow.uk.slideshow', [next, current, $this]);
  5176. Animations[animation].apply(this, [current, next, dir]).then(finalize);
  5177. $this.triggers.removeClass('uk-active');
  5178. $this.triggers.filter('[data-uk-slideshow-item="'+index+'"]').addClass('uk-active');
  5179. },
  5180. applyKenBurns: function(slide) {
  5181. if (!this.hasKenBurns(slide)) {
  5182. return;
  5183. }
  5184. var animations = this.options.kenburnsanimations,
  5185. index = this.kbindex || 0;
  5186. slide.data('cover').attr('class', 'uk-cover-background uk-position-cover').width();
  5187. slide.data('cover').addClass(['uk-animation-scale', 'uk-animation-reverse', animations[index].trim()].join(' '));
  5188. this.kbindex = animations[index + 1] ? (index+1):0;
  5189. },
  5190. hasKenBurns: function(slide) {
  5191. return (this.options.kenburns && slide.data('cover'));
  5192. },
  5193. next: function() {
  5194. this.show(this.slides[this.current + 1] ? (this.current + 1) : 0, 1);
  5195. },
  5196. previous: function() {
  5197. this.show(this.slides[this.current - 1] ? (this.current - 1) : (this.slides.length - 1), -1);
  5198. },
  5199. start: function() {
  5200. this.stop();
  5201. var $this = this;
  5202. this.interval = setInterval(function() {
  5203. if (!$this.hovering) $this.next();
  5204. }, this.options.autoplayInterval);
  5205. },
  5206. stop: function() {
  5207. if (this.interval) clearInterval(this.interval);
  5208. },
  5209. playmedia: function(media) {
  5210. if (!(media && media[0])) return;
  5211. switch(media[0].nodeName) {
  5212. case 'VIDEO':
  5213. if (!this.options.videomute) {
  5214. media[0].muted = false;
  5215. }
  5216. media[0].play();
  5217. break;
  5218. case 'IFRAME':
  5219. if (!this.options.videomute) {
  5220. media[0].contentWindow.postMessage('{ "event": "command", "func": "unmute", "method":"setVolume", "value":1}', '*');
  5221. }
  5222. media[0].contentWindow.postMessage('{ "event": "command", "func": "playVideo", "method":"play"}', '*');
  5223. break;
  5224. }
  5225. },
  5226. pausemedia: function(media) {
  5227. switch(media[0].nodeName) {
  5228. case 'VIDEO':
  5229. media[0].pause();
  5230. break;
  5231. case 'IFRAME':
  5232. media[0].contentWindow.postMessage('{ "event": "command", "func": "pauseVideo", "method":"pause"}', '*');
  5233. break;
  5234. }
  5235. },
  5236. mutemedia: function(media) {
  5237. switch(media[0].nodeName) {
  5238. case 'VIDEO':
  5239. media[0].muted = true;
  5240. break;
  5241. case 'IFRAME':
  5242. media[0].contentWindow.postMessage('{ "event": "command", "func": "mute", "method":"setVolume", "value":0}', '*');
  5243. break;
  5244. }
  5245. }
  5246. });
  5247. Animations = {
  5248. 'none': function() {
  5249. var d = UI.$.Deferred();
  5250. d.resolve();
  5251. return d.promise();
  5252. },
  5253. 'scroll': function(current, next, dir) {
  5254. var d = UI.$.Deferred();
  5255. current.css('animation-duration', this.options.duration+'ms');
  5256. next.css('animation-duration', this.options.duration+'ms');
  5257. next.css('opacity', 1).one(UI.support.animation.end, function() {
  5258. current.css('opacity', 0).removeClass(dir == -1 ? 'uk-slideshow-scroll-backward-out' : 'uk-slideshow-scroll-forward-out');
  5259. next.removeClass(dir == -1 ? 'uk-slideshow-scroll-backward-in' : 'uk-slideshow-scroll-forward-in');
  5260. d.resolve();
  5261. }.bind(this));
  5262. current.addClass(dir == -1 ? 'uk-slideshow-scroll-backward-out' : 'uk-slideshow-scroll-forward-out');
  5263. next.addClass(dir == -1 ? 'uk-slideshow-scroll-backward-in' : 'uk-slideshow-scroll-forward-in');
  5264. next.width(); // force redraw
  5265. return d.promise();
  5266. },
  5267. 'swipe': function(current, next, dir) {
  5268. var d = UI.$.Deferred();
  5269. current.css('animation-duration', this.options.duration+'ms');
  5270. next.css('animation-duration', this.options.duration+'ms');
  5271. next.css('opacity', 1).one(UI.support.animation.end, function() {
  5272. current.css('opacity', 0).removeClass(dir === -1 ? 'uk-slideshow-swipe-backward-out' : 'uk-slideshow-swipe-forward-out');
  5273. next.removeClass(dir === -1 ? 'uk-slideshow-swipe-backward-in' : 'uk-slideshow-swipe-forward-in');
  5274. d.resolve();
  5275. }.bind(this));
  5276. current.addClass(dir == -1 ? 'uk-slideshow-swipe-backward-out' : 'uk-slideshow-swipe-forward-out');
  5277. next.addClass(dir == -1 ? 'uk-slideshow-swipe-backward-in' : 'uk-slideshow-swipe-forward-in');
  5278. next.width(); // force redraw
  5279. return d.promise();
  5280. },
  5281. 'scale': function(current, next, dir) {
  5282. var d = UI.$.Deferred();
  5283. current.css('animation-duration', this.options.duration+'ms');
  5284. next.css('animation-duration', this.options.duration+'ms');
  5285. next.css('opacity', 1);
  5286. current.one(UI.support.animation.end, function() {
  5287. current.css('opacity', 0).removeClass('uk-slideshow-scale-out');
  5288. d.resolve();
  5289. }.bind(this));
  5290. current.addClass('uk-slideshow-scale-out');
  5291. current.width(); // force redraw
  5292. return d.promise();
  5293. },
  5294. 'fade': function(current, next, dir) {
  5295. var d = UI.$.Deferred();
  5296. current.css('animation-duration', this.options.duration+'ms');
  5297. next.css('animation-duration', this.options.duration+'ms');
  5298. next.css('opacity', 1);
  5299. // for plain text content slides - looks smoother
  5300. if (!(next.data('cover') || next.data('placeholder'))) {
  5301. next.css('opacity', 1).one(UI.support.animation.end, function() {
  5302. next.removeClass('uk-slideshow-fade-in');
  5303. }).addClass('uk-slideshow-fade-in');
  5304. }
  5305. current.one(UI.support.animation.end, function() {
  5306. current.css('opacity', 0).removeClass('uk-slideshow-fade-out');
  5307. d.resolve();
  5308. }.bind(this));
  5309. current.addClass('uk-slideshow-fade-out');
  5310. current.width(); // force redraw
  5311. return d.promise();
  5312. }
  5313. };
  5314. UI.slideshow.animations = Animations;
  5315. // Listen for messages from the vimeo player
  5316. window.addEventListener('message', function onMessageReceived(e) {
  5317. var data = e.data, iframe;
  5318. if (typeof(data) == 'string') {
  5319. try {
  5320. data = JSON.parse(data);
  5321. } catch(err) {
  5322. data = {};
  5323. }
  5324. }
  5325. if (e.origin && e.origin.indexOf('vimeo') > -1 && data.event == 'ready' && data.player_id) {
  5326. iframe = UI.$('[data-player-id="'+ data.player_id+'"]');
  5327. if (iframe.length) {
  5328. iframe.data('slideshow').mutemedia(iframe);
  5329. }
  5330. }
  5331. }, false);
  5332. });
  5333. /*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  5334. (function(addon) {
  5335. var component;
  5336. if (window.UIkit) {
  5337. component = addon(UIkit);
  5338. }
  5339. if (typeof define == "function" && define.amd) {
  5340. define("uikit-slider", ["uikit"], function(){
  5341. return component || addon(UIkit);
  5342. });
  5343. }
  5344. })(function(UI){
  5345. "use strict";
  5346. var dragging, delayIdle, anchor, dragged, store = {};
  5347. UI.component('slider', {
  5348. defaults: {
  5349. center : false,
  5350. threshold : 10,
  5351. infinite : true,
  5352. autoplay : false,
  5353. autoplayInterval : 7000,
  5354. pauseOnHover : true,
  5355. activecls : 'uk-active'
  5356. },
  5357. boot: function() {
  5358. // init code
  5359. UI.ready(function(context) {
  5360. setTimeout(function(){
  5361. UI.$('[data-uk-slider]', context).each(function(){
  5362. var ele = UI.$(this);
  5363. if (!ele.data('slider')) {
  5364. UI.slider(ele, UI.Utils.options(ele.attr('data-uk-slider')));
  5365. }
  5366. });
  5367. }, 0);
  5368. });
  5369. },
  5370. init: function() {
  5371. var $this = this;
  5372. this.container = this.element.find('.uk-slider');
  5373. this.focus = 0;
  5374. UI.$win.on('resize load', UI.Utils.debounce(function() {
  5375. $this.update(true);
  5376. }, 100));
  5377. this.on('click.uk.slider', '[data-uk-slider-item]', function(e) {
  5378. e.preventDefault();
  5379. var item = UI.$(this).attr('data-uk-slider-item');
  5380. if ($this.focus == item) return;
  5381. // stop autoplay
  5382. $this.stop();
  5383. switch(item) {
  5384. case 'next':
  5385. case 'previous':
  5386. $this[item=='next' ? 'next':'previous']();
  5387. break;
  5388. default:
  5389. $this.updateFocus(parseInt(item, 10));
  5390. }
  5391. });
  5392. this.container.on({
  5393. 'touchstart mousedown': function(evt) {
  5394. if (evt.originalEvent && evt.originalEvent.touches) {
  5395. evt = evt.originalEvent.touches[0];
  5396. }
  5397. // ignore right click button
  5398. if (evt.button && evt.button==2 || !$this.active) {
  5399. return;
  5400. }
  5401. // stop autoplay
  5402. $this.stop();
  5403. anchor = UI.$(evt.target).is('a') ? UI.$(evt.target) : UI.$(evt.target).parents('a:first');
  5404. dragged = false;
  5405. if (anchor.length) {
  5406. anchor.one('click', function(e){
  5407. if (dragged) e.preventDefault();
  5408. });
  5409. }
  5410. delayIdle = function(e) {
  5411. dragged = true;
  5412. dragging = $this;
  5413. store = {
  5414. touchx : parseInt(e.pageX, 10),
  5415. dir : 1,
  5416. focus : $this.focus,
  5417. base : $this.options.center ? 'center':'area'
  5418. };
  5419. if (e.originalEvent && e.originalEvent.touches) {
  5420. e = e.originalEvent.touches[0];
  5421. }
  5422. dragging.element.data({
  5423. 'pointer-start': {x: parseInt(e.pageX, 10), y: parseInt(e.pageY, 10)},
  5424. 'pointer-pos-start': $this.pos
  5425. });
  5426. $this.container.addClass('uk-drag');
  5427. delayIdle = false;
  5428. };
  5429. delayIdle.x = parseInt(evt.pageX, 10);
  5430. delayIdle.threshold = $this.options.threshold;
  5431. },
  5432. mouseenter: function() { if ($this.options.pauseOnHover) $this.hovering = true; },
  5433. mouseleave: function() { $this.hovering = false; }
  5434. });
  5435. this.update(true);
  5436. this.on('display.uk.check', function(){
  5437. if ($this.element.is(":visible")) {
  5438. $this.update(true);
  5439. }
  5440. });
  5441. // prevent dragging links + images
  5442. this.element.find('a,img').attr('draggable', 'false');
  5443. // Set autoplay
  5444. if (this.options.autoplay) {
  5445. this.start();
  5446. }
  5447. UI.domObserve(this.element, function(e) {
  5448. if ($this.element.children(':not([data-slide])').length) {
  5449. $this.update(true);
  5450. }
  5451. });
  5452. },
  5453. update: function(focus) {
  5454. var $this = this, pos = 0, maxheight = 0, item, width, cwidth, size;
  5455. this.items = this.container.children().filter(':visible');
  5456. this.vp = this.element[0].getBoundingClientRect().width;
  5457. this.container.css({'min-width': '', 'min-height': ''});
  5458. this.items.each(function(idx){
  5459. item = UI.$(this).attr('data-slide', idx);
  5460. size = item.css({'left': '', 'width':''})[0].getBoundingClientRect();
  5461. width = size.width;
  5462. cwidth = item.width();
  5463. maxheight = Math.max(maxheight, size.height);
  5464. item.css({'left': pos, 'width':width}).data({'idx':idx, 'left': pos, 'width': width, 'cwidth':cwidth, 'area': (pos+width), 'center':(pos - ($this.vp/2 - cwidth/2))});
  5465. pos += width;
  5466. });
  5467. this.container.css({'min-width': pos, 'min-height': maxheight});
  5468. if (this.options.infinite && (pos <= (2*this.vp) || this.items.length < 5) && !this.itemsResized) {
  5469. // fill with cloned items
  5470. this.container.children().each(function(idx){
  5471. $this.container.append($this.items.eq(idx).clone(true).attr('id', ''));
  5472. }).each(function(idx){
  5473. $this.container.append($this.items.eq(idx).clone(true).attr('id', ''));
  5474. });
  5475. this.itemsResized = true;
  5476. return this.update();
  5477. }
  5478. this.cw = pos;
  5479. this.pos = 0;
  5480. this.active = pos >= this.vp;
  5481. this.container.css({
  5482. '-ms-transform': '',
  5483. '-webkit-transform': '',
  5484. 'transform': ''
  5485. });
  5486. if (focus) this.updateFocus(this.focus);
  5487. },
  5488. updatePos: function(pos) {
  5489. this.pos = pos;
  5490. this.container.css({
  5491. '-ms-transform': 'translateX('+pos+'px)',
  5492. '-webkit-transform': 'translateX('+pos+'px)',
  5493. 'transform': 'translateX('+pos+'px)'
  5494. });
  5495. },
  5496. updateFocus: function(idx, dir) {
  5497. if (!this.active) {
  5498. return;
  5499. }
  5500. dir = dir || (idx > this.focus ? 1:-1);
  5501. var item = this.items.eq(idx), area, i;
  5502. if (this.options.infinite) {
  5503. this.infinite(idx, dir);
  5504. }
  5505. if (this.options.center) {
  5506. this.updatePos(item.data('center')*-1);
  5507. this.items.filter('.'+this.options.activecls).removeClass(this.options.activecls);
  5508. item.addClass(this.options.activecls);
  5509. } else {
  5510. if (this.options.infinite) {
  5511. this.updatePos(item.data('left')*-1);
  5512. } else {
  5513. area = 0;
  5514. for (i=idx;i<this.items.length;i++) {
  5515. area += this.items.eq(i).data('width');
  5516. }
  5517. if (area > this.vp) {
  5518. this.updatePos(item.data('left')*-1);
  5519. } else {
  5520. if (dir == 1) {
  5521. area = 0;
  5522. for (i=this.items.length-1;i>=0;i--) {
  5523. area += this.items.eq(i).data('width');
  5524. if (area == this.vp) {
  5525. idx = i;
  5526. break;
  5527. }
  5528. if (area > this.vp) {
  5529. idx = (i < this.items.length-1) ? i+1 : i;
  5530. break;
  5531. }
  5532. }
  5533. if (area > this.vp) {
  5534. this.updatePos((this.container.width() - this.vp) * -1);
  5535. } else {
  5536. this.updatePos(this.items.eq(idx).data('left')*-1);
  5537. }
  5538. }
  5539. }
  5540. }
  5541. }
  5542. // mark elements
  5543. var left = this.items.eq(idx).data('left');
  5544. this.items.removeClass('uk-slide-before uk-slide-after').each(function(i){
  5545. if (i!==idx) {
  5546. UI.$(this).addClass(UI.$(this).data('left') < left ? 'uk-slide-before':'uk-slide-after');
  5547. }
  5548. });
  5549. this.focus = idx;
  5550. this.trigger('focusitem.uk.slider', [idx,this.items.eq(idx),this]);
  5551. },
  5552. next: function() {
  5553. var focus = this.items[this.focus + 1] ? (this.focus + 1) : (this.options.infinite ? 0:this.focus);
  5554. this.updateFocus(focus, 1);
  5555. },
  5556. previous: function() {
  5557. var focus = this.items[this.focus - 1] ? (this.focus - 1) : (this.options.infinite ? (this.items[this.focus - 1] ? this.items-1:this.items.length-1):this.focus);
  5558. this.updateFocus(focus, -1);
  5559. },
  5560. start: function() {
  5561. this.stop();
  5562. var $this = this;
  5563. this.interval = setInterval(function() {
  5564. if (!$this.hovering) $this.next();
  5565. }, this.options.autoplayInterval);
  5566. },
  5567. stop: function() {
  5568. if (this.interval) clearInterval(this.interval);
  5569. },
  5570. infinite: function(baseidx, direction) {
  5571. var $this = this, item = this.items.eq(baseidx), i, z = baseidx, move = [], area = 0;
  5572. if (direction == 1) {
  5573. for (i=0;i<this.items.length;i++) {
  5574. if (z != baseidx) {
  5575. area += this.items.eq(z).data('width');
  5576. move.push(this.items.eq(z));
  5577. }
  5578. if (area > this.vp) {
  5579. break;
  5580. }
  5581. z = z+1 == this.items.length ? 0:z+1;
  5582. }
  5583. if (move.length) {
  5584. move.forEach(function(itm){
  5585. var left = item.data('area');
  5586. itm.css({'left': left}).data({
  5587. 'left' : left,
  5588. 'area' : (left+itm.data('width')),
  5589. 'center': (left - ($this.vp/2 - itm.data('cwidth')/2))
  5590. });
  5591. item = itm;
  5592. });
  5593. }
  5594. } else {
  5595. for (i=this.items.length-1;i >-1 ;i--) {
  5596. area += this.items.eq(z).data('width');
  5597. if (z != baseidx) {
  5598. move.push(this.items.eq(z));
  5599. }
  5600. if (area > this.vp) {
  5601. break;
  5602. }
  5603. z = z-1 == -1 ? this.items.length-1:z-1;
  5604. }
  5605. if (move.length) {
  5606. move.forEach(function(itm){
  5607. var left = item.data('left') - itm.data('width');
  5608. itm.css({'left': left}).data({
  5609. 'left' : left,
  5610. 'area' : (left+itm.data('width')),
  5611. 'center': (left - ($this.vp/2 - itm.data('cwidth')/2))
  5612. });
  5613. item = itm;
  5614. });
  5615. }
  5616. }
  5617. }
  5618. });
  5619. // handle dragging
  5620. UI.$doc.on('mousemove.uk.slider touchmove.uk.slider', function(e) {
  5621. if (e.originalEvent && e.originalEvent.touches) {
  5622. e = e.originalEvent.touches[0];
  5623. }
  5624. if (delayIdle && Math.abs(e.pageX - delayIdle.x) > delayIdle.threshold) {
  5625. if (!window.getSelection().toString()) {
  5626. delayIdle(e);
  5627. } else {
  5628. dragging = delayIdle = false;
  5629. }
  5630. }
  5631. if (!dragging) {
  5632. return;
  5633. }
  5634. var x, xDiff, pos, dir, focus, item, next, diff, i, z, itm;
  5635. if (e.clientX || e.clientY) {
  5636. x = e.clientX;
  5637. } else if (e.pageX || e.pageY) {
  5638. x = e.pageX - document.body.scrollLeft - document.documentElement.scrollLeft;
  5639. }
  5640. focus = store.focus;
  5641. xDiff = x - dragging.element.data('pointer-start').x;
  5642. pos = dragging.element.data('pointer-pos-start') + xDiff;
  5643. dir = x > dragging.element.data('pointer-start').x ? -1:1;
  5644. item = dragging.items.eq(store.focus);
  5645. if (dir == 1) {
  5646. diff = item.data('left') + Math.abs(xDiff);
  5647. for (i=0,z=store.focus;i<dragging.items.length;i++) {
  5648. itm = dragging.items.eq(z);
  5649. if (z != store.focus && itm.data('left') < diff && itm.data('area') > diff) {
  5650. focus = z;
  5651. break;
  5652. }
  5653. z = z+1 == dragging.items.length ? 0:z+1;
  5654. }
  5655. } else {
  5656. diff = item.data('left') - Math.abs(xDiff);
  5657. for (i=0,z=store.focus;i<dragging.items.length;i++) {
  5658. itm = dragging.items.eq(z);
  5659. if (z != store.focus && itm.data('area') <= item.data('left') && itm.data('center') < diff) {
  5660. focus = z;
  5661. break;
  5662. }
  5663. z = z-1 == -1 ? dragging.items.length-1:z-1;
  5664. }
  5665. }
  5666. if (dragging.options.infinite && focus!=store._focus) {
  5667. dragging.infinite(focus, dir);
  5668. }
  5669. dragging.updatePos(pos);
  5670. store.dir = dir;
  5671. store._focus = focus;
  5672. store.touchx = parseInt(e.pageX, 10);
  5673. store.diff = diff;
  5674. });
  5675. UI.$doc.on('mouseup.uk.slider touchend.uk.slider', function(e) {
  5676. if (dragging) {
  5677. dragging.container.removeClass('uk-drag');
  5678. // TODO is this needed?
  5679. dragging.items.eq(store.focus);
  5680. var itm, focus = false, i, z;
  5681. if (store.dir == 1) {
  5682. for (i=0,z=store.focus;i<dragging.items.length;i++) {
  5683. itm = dragging.items.eq(z);
  5684. if (z != store.focus && itm.data('left') > store.diff) {
  5685. focus = z;
  5686. break;
  5687. }
  5688. z = z+1 == dragging.items.length ? 0:z+1;
  5689. }
  5690. if (!dragging.options.infinite && !focus) {
  5691. focus = dragging.items.length;
  5692. }
  5693. } else {
  5694. for (i=0,z=store.focus;i<dragging.items.length;i++) {
  5695. itm = dragging.items.eq(z);
  5696. if (z != store.focus && itm.data('left') < store.diff) {
  5697. focus = z;
  5698. break;
  5699. }
  5700. z = z-1 == -1 ? dragging.items.length-1:z-1;
  5701. }
  5702. if (!dragging.options.infinite && !focus) {
  5703. focus = 0
  5704. }
  5705. }
  5706. dragging.updateFocus(focus!==false ? focus:store._focus);
  5707. }
  5708. dragging = delayIdle = false;
  5709. });
  5710. return UI.slider;
  5711. });
  5712. /*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  5713. /*
  5714. * Based on nativesortable - Copyright (c) Brian Grinstead - https://github.com/bgrins/nativesortable
  5715. */
  5716. (function(addon) {
  5717. var component;
  5718. if (window.UIkit) {
  5719. component = addon(UIkit);
  5720. }
  5721. if (typeof define == "function" && define.amd) {
  5722. define("uikit-sortable", ["uikit"], function(){
  5723. return component || addon(UIkit);
  5724. });
  5725. }
  5726. })(function(UI){
  5727. "use strict";
  5728. var supportsTouch = ('ontouchstart' in window || 'MSGesture' in window) || (window.DocumentTouch && document instanceof DocumentTouch),
  5729. draggingPlaceholder, currentlyDraggingElement, currentlyDraggingTarget, dragging, moving, clickedlink, delayIdle, touchedlists, moved, overElement, startEvent;
  5730. var POINTER_DOWN = supportsTouch ? ('MSGesture' in window ? 'pointerdown':'touchstart') : 'mousedown',
  5731. POINTER_MOVE = supportsTouch ? ('MSGesture' in window ? 'pointermove':'touchmove') : 'mousemove',
  5732. POINTER_UP = supportsTouch ? ('MSGesture' in window ? 'pointerup':'touchend') : 'mouseup';
  5733. function closestSortable(ele) {
  5734. ele = UI.$(ele);
  5735. do {
  5736. if (ele.data('sortable')) {
  5737. return ele;
  5738. }
  5739. ele = UI.$(ele).parent();
  5740. } while(ele.length);
  5741. return ele;
  5742. }
  5743. UI.component('sortable', {
  5744. defaults: {
  5745. animation : 150,
  5746. threshold : 10,
  5747. childClass : 'uk-sortable-item',
  5748. placeholderClass : 'uk-sortable-placeholder',
  5749. overClass : 'uk-sortable-over',
  5750. draggingClass : 'uk-sortable-dragged',
  5751. dragMovingClass : 'uk-sortable-moving',
  5752. baseClass : 'uk-sortable',
  5753. noDragClass : 'uk-sortable-nodrag',
  5754. emptyClass : 'uk-sortable-empty',
  5755. dragCustomClass : '',
  5756. handleClass : false,
  5757. group : false,
  5758. stop : function() {},
  5759. start : function() {},
  5760. change : function() {}
  5761. },
  5762. boot: function() {
  5763. // auto init
  5764. UI.ready(function(context) {
  5765. UI.$("[data-uk-sortable]", context).each(function(){
  5766. var ele = UI.$(this);
  5767. if(!ele.data("sortable")) {
  5768. UI.sortable(ele, UI.Utils.options(ele.attr("data-uk-sortable")));
  5769. }
  5770. });
  5771. });
  5772. UI.$html.on(POINTER_MOVE, function(e) {
  5773. if (delayIdle) {
  5774. var src = e.originalEvent.targetTouches ? e.originalEvent.targetTouches[0] : e;
  5775. if (Math.abs(src.pageX - delayIdle.pos.x) > delayIdle.threshold || Math.abs(src.pageY - delayIdle.pos.y) > delayIdle.threshold) {
  5776. delayIdle.apply(src);
  5777. }
  5778. }
  5779. if (draggingPlaceholder) {
  5780. if (!moving) {
  5781. moving = true;
  5782. draggingPlaceholder.show();
  5783. draggingPlaceholder.$current.addClass(draggingPlaceholder.$sortable.options.placeholderClass);
  5784. draggingPlaceholder.$sortable.element.children().addClass(draggingPlaceholder.$sortable.options.childClass);
  5785. UI.$html.addClass(draggingPlaceholder.$sortable.options.dragMovingClass);
  5786. }
  5787. var offset = draggingPlaceholder.data('mouse-offset'),
  5788. ev = e.originalEvent.touches && e.originalEvent.touches[0] || e.originalEvent,
  5789. left = parseInt(ev.pageX, 10) + offset.left,
  5790. top = parseInt(ev.pageY, 10) + offset.top;
  5791. draggingPlaceholder.css({'left': left, 'top': top });
  5792. // adjust document scrolling
  5793. if (top + (draggingPlaceholder.height()/3) > document.body.offsetHeight) {
  5794. return;
  5795. }
  5796. if (top < UI.$win.scrollTop()) {
  5797. UI.$win.scrollTop(UI.$win.scrollTop() - Math.ceil(draggingPlaceholder.height()/3));
  5798. } else if ( (top + (draggingPlaceholder.height()/3)) > (window.innerHeight + UI.$win.scrollTop()) ) {
  5799. UI.$win.scrollTop(UI.$win.scrollTop() + Math.ceil(draggingPlaceholder.height()/3));
  5800. }
  5801. }
  5802. });
  5803. UI.$html.on(POINTER_UP, function(e) {
  5804. delayIdle = clickedlink = false;
  5805. // dragging?
  5806. if (!currentlyDraggingElement || !draggingPlaceholder) {
  5807. // completely reset dragging attempt. will cause weird delay behavior elsewise
  5808. currentlyDraggingElement = draggingPlaceholder = null;
  5809. return;
  5810. }
  5811. // inside or outside of sortable?
  5812. var sortable = closestSortable(currentlyDraggingElement),
  5813. component = draggingPlaceholder.$sortable,
  5814. ev = { type: e.type };
  5815. if (sortable[0]) {
  5816. component.dragDrop(ev, component.element);
  5817. }
  5818. component.dragEnd(ev, component.element);
  5819. });
  5820. },
  5821. init: function() {
  5822. var $this = this,
  5823. element = this.element[0];
  5824. touchedlists = [];
  5825. this.checkEmptyList();
  5826. this.element.data('sortable-group', this.options.group ? this.options.group : UI.Utils.uid('sortable-group'));
  5827. var handleDragStart = delegate(function(e) {
  5828. if (e.data && e.data.sortable) {
  5829. return;
  5830. }
  5831. var $target = UI.$(e.target),
  5832. $link = $target.is('a[href]') ? $target:$target.parents('a[href]');
  5833. if ($target.is(':input')) {
  5834. return;
  5835. }
  5836. if ($this.options.handleClass) {
  5837. var handle = $target.hasClass($this.options.handleClass) ? $target : $target.closest('.'+$this.options.handleClass, $this.element);
  5838. if (!handle.length) return;
  5839. }
  5840. e.preventDefault();
  5841. if ($link.length) {
  5842. $link.one('click', function(e){
  5843. e.preventDefault();
  5844. }).one(POINTER_UP, function(){
  5845. if (!moved) {
  5846. $link.trigger('click');
  5847. if (supportsTouch && $link.attr('href').trim()) {
  5848. location.href = $link.attr('href');
  5849. }
  5850. }
  5851. });
  5852. }
  5853. e.data = e.data || {};
  5854. e.data.sortable = element;
  5855. return $this.dragStart(e, this);
  5856. });
  5857. var handleDragEnter = delegate(UI.Utils.debounce(function(e) {
  5858. return $this.dragEnter(e, this);
  5859. }), 40);
  5860. var handleDragLeave = delegate(function(e) {
  5861. // Prevent dragenter on a child from allowing a dragleave on the container
  5862. var previousCounter = $this.dragenterData(this);
  5863. $this.dragenterData(this, previousCounter - 1);
  5864. // This is a fix for child elements firing dragenter before the parent fires dragleave
  5865. if (!$this.dragenterData(this)) {
  5866. UI.$(this).removeClass($this.options.overClass);
  5867. $this.dragenterData(this, false);
  5868. }
  5869. });
  5870. var handleTouchMove = delegate(function(e) {
  5871. if (!currentlyDraggingElement ||
  5872. currentlyDraggingElement === this ||
  5873. currentlyDraggingTarget === this) {
  5874. return true;
  5875. }
  5876. $this.element.children().removeClass($this.options.overClass);
  5877. currentlyDraggingTarget = this;
  5878. $this.moveElementNextTo(currentlyDraggingElement, this);
  5879. return prevent(e);
  5880. });
  5881. // Bind/unbind standard mouse/touch events as a polyfill.
  5882. function addDragHandlers() {
  5883. if (supportsTouch && startEvent.touches && startEvent.touches.length) {
  5884. element.addEventListener(POINTER_MOVE, handleTouchMove, false);
  5885. } else {
  5886. element.addEventListener('mouseover', handleDragEnter, false);
  5887. element.addEventListener('mouseout', handleDragLeave, false);
  5888. }
  5889. // document.addEventListener("selectstart", prevent, false);
  5890. }
  5891. function removeDragHandlers() {
  5892. if (supportsTouch && startEvent.touches && startEvent.touches.length) {
  5893. element.removeEventListener(POINTER_MOVE, handleTouchMove, false);
  5894. } else {
  5895. element.removeEventListener('mouseover', handleDragEnter, false);
  5896. element.removeEventListener('mouseout', handleDragLeave, false);
  5897. }
  5898. // document.removeEventListener("selectstart", prevent, false);
  5899. }
  5900. this.addDragHandlers = addDragHandlers;
  5901. this.removeDragHandlers = removeDragHandlers;
  5902. function handleDragMove(e) {
  5903. if (!currentlyDraggingElement) {
  5904. return;
  5905. }
  5906. $this.dragMove(e, $this);
  5907. }
  5908. function delegate(fn) {
  5909. return function(e) {
  5910. var touch, target, context;
  5911. startEvent = e;
  5912. if (e) {
  5913. touch = e.touches && e.touches[0] || e;
  5914. target = touch.target || e.target;
  5915. // Fix event.target for a touch event
  5916. if (supportsTouch && document.elementFromPoint) {
  5917. target = document.elementFromPoint(touch.pageX - document.body.scrollLeft, touch.pageY - document.body.scrollTop);
  5918. }
  5919. overElement = UI.$(target);
  5920. }
  5921. if (UI.$(target).hasClass('.'+$this.options.childClass)) {
  5922. fn.apply(target, [e]);
  5923. } else if (target !== element) {
  5924. // If a child is initiating the event or ending it, then use the container as context for the callback.
  5925. context = moveUpToChildNode(element, target);
  5926. if (context) {
  5927. fn.apply(context, [e]);
  5928. }
  5929. }
  5930. };
  5931. }
  5932. window.addEventListener(POINTER_MOVE, handleDragMove, false);
  5933. element.addEventListener(POINTER_DOWN, handleDragStart, false);
  5934. },
  5935. dragStart: function(e, elem) {
  5936. moved = false;
  5937. moving = false;
  5938. dragging = false;
  5939. var $this = this,
  5940. target = UI.$(e.target);
  5941. if (!supportsTouch && e.button==2) {
  5942. return;
  5943. }
  5944. if (target.is('.'+$this.options.noDragClass) || target.closest('.'+$this.options.noDragClass).length) {
  5945. return;
  5946. }
  5947. // prevent dragging if taget is a form field
  5948. if (target.is(':input')) {
  5949. return;
  5950. }
  5951. currentlyDraggingElement = elem;
  5952. // init drag placeholder
  5953. if (draggingPlaceholder) {
  5954. draggingPlaceholder.remove();
  5955. }
  5956. var $current = UI.$(currentlyDraggingElement), offset = $current.offset(), ev = e.touches && e.touches[0] || e;
  5957. delayIdle = {
  5958. pos : { x:ev.pageX, y:ev.pageY },
  5959. threshold : $this.options.handleClass ? 1 : $this.options.threshold,
  5960. apply : function(evt) {
  5961. draggingPlaceholder = UI.$('<div class="'+([$this.options.draggingClass, $this.options.dragCustomClass].join(' '))+'"></div>').css({
  5962. display : 'none',
  5963. top : offset.top,
  5964. left : offset.left,
  5965. width : $current.width(),
  5966. height : $current.height(),
  5967. padding : $current.css('padding')
  5968. }).data({
  5969. 'mouse-offset': {
  5970. 'left' : offset.left - parseInt(ev.pageX, 10),
  5971. 'top' : offset.top - parseInt(ev.pageY, 10)
  5972. },
  5973. 'origin' : $this.element,
  5974. 'index' : $current.index()
  5975. }).append($current.html()).appendTo('body');
  5976. draggingPlaceholder.$current = $current;
  5977. draggingPlaceholder.$sortable = $this;
  5978. $current.data({
  5979. 'start-list': $current.parent(),
  5980. 'start-index': $current.index(),
  5981. 'sortable-group': $this.options.group
  5982. });
  5983. $this.addDragHandlers();
  5984. $this.options.start(this, currentlyDraggingElement);
  5985. $this.trigger('start.uk.sortable', [$this, currentlyDraggingElement, draggingPlaceholder]);
  5986. moved = true;
  5987. delayIdle = false;
  5988. }
  5989. };
  5990. },
  5991. dragMove: function(e, elem) {
  5992. overElement = UI.$(document.elementFromPoint(e.pageX - (document.body.scrollLeft || document.scrollLeft || 0), e.pageY - (document.body.scrollTop || document.documentElement.scrollTop || 0)));
  5993. var overRoot = overElement.closest('.'+this.options.baseClass),
  5994. groupOver = overRoot.data("sortable-group"),
  5995. $current = UI.$(currentlyDraggingElement),
  5996. currentRoot = $current.parent(),
  5997. groupCurrent = $current.data("sortable-group"),
  5998. overChild;
  5999. if (overRoot[0] !== currentRoot[0] && groupCurrent !== undefined && groupOver === groupCurrent) {
  6000. overRoot.data('sortable').addDragHandlers();
  6001. touchedlists.push(overRoot);
  6002. overRoot.children().addClass(this.options.childClass);
  6003. // swap root
  6004. if (overRoot.children().length > 0) {
  6005. overChild = overElement.closest('.'+this.options.childClass);
  6006. if (overChild.length) {
  6007. overChild.before($current);
  6008. } else {
  6009. overRoot.append($current);
  6010. }
  6011. } else { // empty list
  6012. overElement.append($current);
  6013. }
  6014. UIkit.$doc.trigger('mouseover');
  6015. }
  6016. this.checkEmptyList();
  6017. this.checkEmptyList(currentRoot);
  6018. },
  6019. dragEnter: function(e, elem) {
  6020. if (!currentlyDraggingElement || currentlyDraggingElement === elem) {
  6021. return true;
  6022. }
  6023. var previousCounter = this.dragenterData(elem);
  6024. this.dragenterData(elem, previousCounter + 1);
  6025. // Prevent dragenter on a child from allowing a dragleave on the container
  6026. if (previousCounter === 0) {
  6027. var currentlist = UI.$(elem).parent(),
  6028. startlist = UI.$(currentlyDraggingElement).data("start-list");
  6029. if (currentlist[0] !== startlist[0]) {
  6030. var groupOver = currentlist.data('sortable-group'),
  6031. groupCurrent = UI.$(currentlyDraggingElement).data("sortable-group");
  6032. if ((groupOver || groupCurrent) && (groupOver != groupCurrent)) {
  6033. return false;
  6034. }
  6035. }
  6036. UI.$(elem).addClass(this.options.overClass);
  6037. this.moveElementNextTo(currentlyDraggingElement, elem);
  6038. }
  6039. return false;
  6040. },
  6041. dragEnd: function(e, elem) {
  6042. var $this = this;
  6043. // avoid triggering event twice
  6044. if (currentlyDraggingElement) {
  6045. // TODO: trigger on right element?
  6046. this.options.stop(elem);
  6047. this.trigger('stop.uk.sortable', [this]);
  6048. }
  6049. currentlyDraggingElement = null;
  6050. currentlyDraggingTarget = null;
  6051. touchedlists.push(this.element);
  6052. touchedlists.forEach(function(el, i) {
  6053. UI.$(el).children().each(function() {
  6054. if (this.nodeType === 1) {
  6055. UI.$(this).removeClass($this.options.overClass)
  6056. .removeClass($this.options.placeholderClass)
  6057. .removeClass($this.options.childClass);
  6058. $this.dragenterData(this, false);
  6059. }
  6060. });
  6061. });
  6062. touchedlists = [];
  6063. UI.$html.removeClass(this.options.dragMovingClass);
  6064. this.removeDragHandlers();
  6065. if (draggingPlaceholder) {
  6066. draggingPlaceholder.remove();
  6067. draggingPlaceholder = null;
  6068. }
  6069. },
  6070. dragDrop: function(e, elem) {
  6071. if (e.type === 'drop') {
  6072. if (e.stopPropagation) {
  6073. e.stopPropagation();
  6074. }
  6075. if (e.preventDefault) {
  6076. e.preventDefault();
  6077. }
  6078. }
  6079. this.triggerChangeEvents();
  6080. },
  6081. triggerChangeEvents: function() {
  6082. // trigger events once
  6083. if (!currentlyDraggingElement) return;
  6084. var $current = UI.$(currentlyDraggingElement),
  6085. oldRoot = draggingPlaceholder.data("origin"),
  6086. newRoot = $current.closest('.'+this.options.baseClass),
  6087. triggers = [],
  6088. el = UI.$(currentlyDraggingElement);
  6089. // events depending on move inside lists or across lists
  6090. if (oldRoot[0] === newRoot[0] && draggingPlaceholder.data('index') != $current.index() ) {
  6091. triggers.push({sortable: this, mode: 'moved'});
  6092. } else if (oldRoot[0] != newRoot[0]) {
  6093. triggers.push({sortable: UI.$(newRoot).data('sortable'), mode: 'added'}, {sortable: UI.$(oldRoot).data('sortable'), mode: 'removed'});
  6094. }
  6095. triggers.forEach(function (trigger, i) {
  6096. if (trigger.sortable) {
  6097. trigger.sortable.element.trigger('change.uk.sortable', [trigger.sortable, el, trigger.mode]);
  6098. }
  6099. });
  6100. },
  6101. dragenterData: function(element, val) {
  6102. element = UI.$(element);
  6103. if (arguments.length == 1) {
  6104. return parseInt(element.data('child-dragenter'), 10) || 0;
  6105. } else if (!val) {
  6106. element.removeData('child-dragenter');
  6107. } else {
  6108. element.data('child-dragenter', Math.max(0, val));
  6109. }
  6110. },
  6111. moveElementNextTo: function(element, elementToMoveNextTo) {
  6112. dragging = true;
  6113. var $this = this,
  6114. list = UI.$(element).parent().css('min-height', ''),
  6115. next = isBelow(element, elementToMoveNextTo) ? elementToMoveNextTo : elementToMoveNextTo.nextSibling,
  6116. children = list.children(),
  6117. count = children.length;
  6118. if (!$this.options.animation) {
  6119. elementToMoveNextTo.parentNode.insertBefore(element, next);
  6120. UI.Utils.checkDisplay($this.element.parent());
  6121. return;
  6122. }
  6123. list.css('min-height', list.height());
  6124. children.stop().each(function(){
  6125. var ele = UI.$(this),
  6126. offset = ele.position();
  6127. offset.width = ele.width();
  6128. ele.data('offset-before', offset);
  6129. });
  6130. elementToMoveNextTo.parentNode.insertBefore(element, next);
  6131. UI.Utils.checkDisplay($this.element.parent());
  6132. children = list.children().each(function() {
  6133. var ele = UI.$(this);
  6134. ele.data('offset-after', ele.position());
  6135. }).each(function() {
  6136. var ele = UI.$(this),
  6137. before = ele.data('offset-before');
  6138. ele.css({'position':'absolute', 'top':before.top, 'left':before.left, 'min-width':before.width });
  6139. });
  6140. children.each(function(){
  6141. var ele = UI.$(this),
  6142. before = ele.data('offset-before'),
  6143. offset = ele.data('offset-after');
  6144. ele.css('pointer-events', 'none').width();
  6145. setTimeout(function(){
  6146. ele.animate({'top':offset.top, 'left':offset.left}, $this.options.animation, function() {
  6147. ele.css({'position':'','top':'', 'left':'', 'min-width': '', 'pointer-events':''}).removeClass($this.options.overClass).removeData('child-dragenter');
  6148. count--;
  6149. if (!count) {
  6150. list.css('min-height', '');
  6151. UI.Utils.checkDisplay($this.element.parent());
  6152. }
  6153. });
  6154. }, 0);
  6155. });
  6156. },
  6157. serialize: function() {
  6158. var data = [], item, attribute;
  6159. this.element.children().each(function(j, child) {
  6160. item = {};
  6161. for (var i = 0, attr, val; i < child.attributes.length; i++) {
  6162. attribute = child.attributes[i];
  6163. if (attribute.name.indexOf('data-') === 0) {
  6164. attr = attribute.name.substr(5);
  6165. val = UI.Utils.str2json(attribute.value);
  6166. item[attr] = (val || attribute.value=='false' || attribute.value=='0') ? val:attribute.value;
  6167. }
  6168. }
  6169. data.push(item);
  6170. });
  6171. return data;
  6172. },
  6173. checkEmptyList: function(list) {
  6174. list = list ? UI.$(list) : this.element;
  6175. if (this.options.emptyClass) {
  6176. list[!list.children().length ? 'addClass':'removeClass'](this.options.emptyClass);
  6177. }
  6178. }
  6179. });
  6180. // helpers
  6181. function isBelow(el1, el2) {
  6182. var parent = el1.parentNode;
  6183. if (el2.parentNode != parent) {
  6184. return false;
  6185. }
  6186. var cur = el1.previousSibling;
  6187. while (cur && cur.nodeType !== 9) {
  6188. if (cur === el2) {
  6189. return true;
  6190. }
  6191. cur = cur.previousSibling;
  6192. }
  6193. return false;
  6194. }
  6195. function moveUpToChildNode(parent, child) {
  6196. var cur = child;
  6197. if (cur == parent) { return null; }
  6198. while (cur) {
  6199. if (cur.parentNode === parent) {
  6200. return cur;
  6201. }
  6202. cur = cur.parentNode;
  6203. if ( !cur || !cur.ownerDocument || cur.nodeType === 11 ) {
  6204. break;
  6205. }
  6206. }
  6207. return null;
  6208. }
  6209. function prevent(e) {
  6210. if (e.stopPropagation) {
  6211. e.stopPropagation();
  6212. }
  6213. if (e.preventDefault) {
  6214. e.preventDefault();
  6215. }
  6216. e.returnValue = false;
  6217. }
  6218. return UI.sortable;
  6219. });
  6220. /*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  6221. (function(addon) {
  6222. var component;
  6223. if (window.UIkit) {
  6224. component = addon(UIkit);
  6225. }
  6226. if (typeof define == "function" && define.amd) {
  6227. define("uikit-sticky", ["uikit"], function(){
  6228. return component || addon(UIkit);
  6229. });
  6230. }
  6231. })(function(UI){
  6232. "use strict";
  6233. var $win = UI.$win,
  6234. $doc = UI.$doc,
  6235. sticked = [],
  6236. direction = 1;
  6237. UI.component('sticky', {
  6238. defaults: {
  6239. top : 0,
  6240. bottom : 0,
  6241. animation : '',
  6242. clsinit : 'uk-sticky-init',
  6243. clsactive : 'uk-active',
  6244. clsinactive : '',
  6245. getWidthFrom : '',
  6246. showup : false,
  6247. boundary : false,
  6248. media : false,
  6249. target : false,
  6250. disabled : false
  6251. },
  6252. boot: function() {
  6253. // should be more efficient than using $win.scroll(checkscrollposition):
  6254. UI.$doc.on('scrolling.uk.document', function(e, data) {
  6255. if (!data || !data.dir) return;
  6256. direction = data.dir.y;
  6257. checkscrollposition();
  6258. });
  6259. UI.$win.on('resize orientationchange', UI.Utils.debounce(function() {
  6260. if (!sticked.length) return;
  6261. for (var i = 0; i < sticked.length; i++) {
  6262. sticked[i].reset(true);
  6263. sticked[i].self.computeWrapper();
  6264. }
  6265. checkscrollposition();
  6266. }, 100));
  6267. // init code
  6268. UI.ready(function(context) {
  6269. setTimeout(function(){
  6270. UI.$("[data-uk-sticky]", context).each(function(){
  6271. var $ele = UI.$(this);
  6272. if (!$ele.data("sticky")) {
  6273. UI.sticky($ele, UI.Utils.options($ele.attr('data-uk-sticky')));
  6274. }
  6275. });
  6276. checkscrollposition();
  6277. }, 0);
  6278. });
  6279. },
  6280. init: function() {
  6281. var boundary = this.options.boundary, boundtoparent;
  6282. this.wrapper = this.element.wrap('<div class="uk-sticky-placeholder"></div>').parent();
  6283. this.computeWrapper();
  6284. this.wrapper.css({
  6285. 'margin-top' : this.element.css('margin-top'),
  6286. 'margin-bottom' : this.element.css('margin-bottom'),
  6287. 'margin-left' : this.element.css('margin-left'),
  6288. 'margin-right' : this.element.css('margin-right')
  6289. })
  6290. this.element.css('margin', 0);
  6291. if (boundary) {
  6292. if (boundary === true || boundary[0] === '!') {
  6293. boundary = boundary === true ? this.wrapper.parent() : this.wrapper.closest(boundary.substr(1));
  6294. boundtoparent = true;
  6295. } else if (typeof boundary === "string") {
  6296. boundary = UI.$(boundary);
  6297. }
  6298. }
  6299. this.sticky = {
  6300. self : this,
  6301. options : this.options,
  6302. element : this.element,
  6303. currentTop : null,
  6304. wrapper : this.wrapper,
  6305. init : false,
  6306. getWidthFrom : UI.$(this.options.getWidthFrom || this.wrapper),
  6307. boundary : boundary,
  6308. boundtoparent : boundtoparent,
  6309. top : 0,
  6310. calcTop : function() {
  6311. var top = this.options.top;
  6312. // dynamic top parameter
  6313. if (this.options.top && typeof(this.options.top) == 'string') {
  6314. // e.g. 50vh
  6315. if (this.options.top.match(/^(-|)(\d+)vh$/)) {
  6316. top = window.innerHeight * parseInt(this.options.top, 10)/100;
  6317. // e.g. #elementId, or .class-1,class-2,.class-3 (first found is used)
  6318. } else {
  6319. var topElement = UI.$(this.options.top).first();
  6320. if (topElement.length && topElement.is(':visible')) {
  6321. top = -1 * ((topElement.offset().top + topElement.outerHeight()) - this.wrapper.offset().top);
  6322. }
  6323. }
  6324. }
  6325. this.top = top;
  6326. },
  6327. reset: function(force) {
  6328. this.calcTop();
  6329. var finalize = function() {
  6330. this.element.css({"position":"", "top":"", "width":"", "left":"", "margin":"0"});
  6331. this.element.removeClass([this.options.animation, 'uk-animation-reverse', this.options.clsactive].join(' '));
  6332. this.element.addClass(this.options.clsinactive);
  6333. this.element.trigger('inactive.uk.sticky');
  6334. this.currentTop = null;
  6335. this.animate = false;
  6336. }.bind(this);
  6337. if (!force && this.options.animation && UI.support.animation && !UI.Utils.isInView(this.wrapper)) {
  6338. this.animate = true;
  6339. this.element.removeClass(this.options.animation).one(UI.support.animation.end, function(){
  6340. finalize();
  6341. }).width(); // force redraw
  6342. this.element.addClass(this.options.animation+' '+'uk-animation-reverse');
  6343. } else {
  6344. finalize();
  6345. }
  6346. },
  6347. check: function() {
  6348. if (this.options.disabled) {
  6349. return false;
  6350. }
  6351. if (this.options.media) {
  6352. switch(typeof(this.options.media)) {
  6353. case 'number':
  6354. if (window.innerWidth < this.options.media) {
  6355. return false;
  6356. }
  6357. break;
  6358. case 'string':
  6359. if (window.matchMedia && !window.matchMedia(this.options.media).matches) {
  6360. return false;
  6361. }
  6362. break;
  6363. }
  6364. }
  6365. var scrollTop = $win.scrollTop(),
  6366. documentHeight = $doc.height(),
  6367. dwh = documentHeight - window.innerHeight,
  6368. extra = (scrollTop > dwh) ? dwh - scrollTop : 0,
  6369. elementTop = this.wrapper.offset().top,
  6370. etse = elementTop - this.top - extra,
  6371. active = (scrollTop >= etse);
  6372. if (active && this.options.showup) {
  6373. // set inactiv if scrolling down
  6374. if (direction == 1) {
  6375. active = false;
  6376. }
  6377. // set inactive when wrapper is still in view
  6378. if (direction == -1 && !this.element.hasClass(this.options.clsactive) && UI.Utils.isInView(this.wrapper)) {
  6379. active = false;
  6380. }
  6381. }
  6382. return active;
  6383. }
  6384. };
  6385. this.sticky.calcTop();
  6386. sticked.push(this.sticky);
  6387. },
  6388. update: function() {
  6389. checkscrollposition(this.sticky);
  6390. },
  6391. enable: function() {
  6392. this.options.disabled = false;
  6393. this.update();
  6394. },
  6395. disable: function(force) {
  6396. this.options.disabled = true;
  6397. this.sticky.reset(force);
  6398. },
  6399. computeWrapper: function() {
  6400. this.wrapper.css({
  6401. 'height' : ['absolute','fixed'].indexOf(this.element.css('position')) == -1 ? this.element.outerHeight() : '',
  6402. 'float' : this.element.css('float') != 'none' ? this.element.css('float') : ''
  6403. });
  6404. if (this.element.css('position') == 'fixed') {
  6405. this.element.css({
  6406. width: this.sticky.getWidthFrom.length ? this.sticky.getWidthFrom.width() : this.element.width()
  6407. });
  6408. }
  6409. }
  6410. });
  6411. function checkscrollposition(direction) {
  6412. var stickies = arguments.length ? arguments : sticked;
  6413. if (!stickies.length || $win.scrollTop() < 0) return;
  6414. var scrollTop = $win.scrollTop(),
  6415. documentHeight = $doc.height(),
  6416. windowHeight = $win.height(),
  6417. dwh = documentHeight - windowHeight,
  6418. extra = (scrollTop > dwh) ? dwh - scrollTop : 0,
  6419. newTop, containerBottom, stickyHeight, sticky;
  6420. for (var i = 0; i < stickies.length; i++) {
  6421. sticky = stickies[i];
  6422. if (!sticky.element.is(":visible") || sticky.animate) {
  6423. continue;
  6424. }
  6425. if (!sticky.check()) {
  6426. if (sticky.currentTop !== null) {
  6427. sticky.reset();
  6428. }
  6429. } else {
  6430. if (sticky.top < 0) {
  6431. newTop = 0;
  6432. } else {
  6433. stickyHeight = sticky.element.outerHeight();
  6434. newTop = documentHeight - stickyHeight - sticky.top - sticky.options.bottom - scrollTop - extra;
  6435. newTop = newTop < 0 ? newTop + sticky.top : sticky.top;
  6436. }
  6437. if (sticky.boundary && sticky.boundary.length) {
  6438. var bTop = sticky.boundary.offset().top;
  6439. if (sticky.boundtoparent) {
  6440. containerBottom = documentHeight - (bTop + sticky.boundary.outerHeight()) + parseInt(sticky.boundary.css('padding-bottom'));
  6441. } else {
  6442. containerBottom = documentHeight - bTop;
  6443. }
  6444. newTop = (scrollTop + stickyHeight) > (documentHeight - containerBottom - (sticky.top < 0 ? 0 : sticky.top)) ? (documentHeight - containerBottom) - (scrollTop + stickyHeight) : newTop;
  6445. }
  6446. if (sticky.currentTop != newTop) {
  6447. sticky.element.css({
  6448. position : "fixed",
  6449. top : newTop,
  6450. width : sticky.getWidthFrom.length ? sticky.getWidthFrom.width() : sticky.element.width()
  6451. });
  6452. if (!sticky.init) {
  6453. sticky.element.addClass(sticky.options.clsinit);
  6454. if (location.hash && scrollTop > 0 && sticky.options.target) {
  6455. var $target = UI.$(location.hash);
  6456. if ($target.length) {
  6457. setTimeout((function($target, sticky){
  6458. return function() {
  6459. sticky.element.width(); // force redraw
  6460. var offset = $target.offset(),
  6461. maxoffset = offset.top + $target.outerHeight(),
  6462. stickyOffset = sticky.element.offset(),
  6463. stickyHeight = sticky.element.outerHeight(),
  6464. stickyMaxOffset = stickyOffset.top + stickyHeight;
  6465. if (stickyOffset.top < maxoffset && offset.top < stickyMaxOffset) {
  6466. scrollTop = offset.top - stickyHeight - sticky.options.target;
  6467. window.scrollTo(0, scrollTop);
  6468. }
  6469. };
  6470. })($target, sticky), 0);
  6471. }
  6472. }
  6473. }
  6474. sticky.element.addClass(sticky.options.clsactive).removeClass(sticky.options.clsinactive);
  6475. sticky.element.trigger('active.uk.sticky');
  6476. sticky.element.css('margin', '');
  6477. if (sticky.options.animation && sticky.init && !UI.Utils.isInView(sticky.wrapper)) {
  6478. sticky.element.addClass(sticky.options.animation);
  6479. }
  6480. sticky.currentTop = newTop;
  6481. }
  6482. }
  6483. sticky.init = true;
  6484. }
  6485. }
  6486. return UI.sticky;
  6487. });
  6488. /*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  6489. (function(addon) {
  6490. var component;
  6491. if (window.UIkit) {
  6492. component = addon(UIkit);
  6493. }
  6494. if (typeof define == "function" && define.amd) {
  6495. define("uikit-tooltip", ["uikit"], function(){
  6496. return component || addon(UIkit);
  6497. });
  6498. }
  6499. })(function(UI){
  6500. "use strict";
  6501. var $tooltip, // tooltip container
  6502. tooltipdelay, checkdelay;
  6503. UI.component('tooltip', {
  6504. defaults: {
  6505. offset: 5,
  6506. pos: 'top',
  6507. animation: false,
  6508. delay: 0, // in miliseconds
  6509. cls: "",
  6510. activeClass: "uk-active",
  6511. src: function(ele) {
  6512. var title = ele.attr('title');
  6513. if (title !== undefined) {
  6514. ele.data('cached-title', title).removeAttr('title');
  6515. }
  6516. return ele.data("cached-title");
  6517. }
  6518. },
  6519. tip: "",
  6520. boot: function() {
  6521. // init code
  6522. UI.$html.on("mouseenter.tooltip.uikit focus.tooltip.uikit", "[data-uk-tooltip]", function(e) {
  6523. var ele = UI.$(this);
  6524. if (!ele.data("tooltip")) {
  6525. UI.tooltip(ele, UI.Utils.options(ele.attr("data-uk-tooltip")));
  6526. ele.trigger("mouseenter");
  6527. }
  6528. });
  6529. },
  6530. init: function() {
  6531. var $this = this;
  6532. if (!$tooltip) {
  6533. $tooltip = UI.$('<div class="uk-tooltip"></div>').appendTo("body");
  6534. }
  6535. this.on({
  6536. focus : function(e) { $this.show(); },
  6537. blur : function(e) { $this.hide(); },
  6538. mouseenter : function(e) { $this.show(); },
  6539. mouseleave : function(e) { $this.hide(); }
  6540. });
  6541. },
  6542. show: function() {
  6543. this.tip = typeof(this.options.src) === "function" ? this.options.src(this.element) : this.options.src;
  6544. if (tooltipdelay) clearTimeout(tooltipdelay);
  6545. if (checkdelay) clearTimeout(checkdelay);
  6546. if (typeof(this.tip) === 'string' ? !this.tip.length:true) return;
  6547. $tooltip.stop().css({"top": -2000, "visibility": "hidden"}).removeClass(this.options.activeClass).show();
  6548. $tooltip.html('<div class="uk-tooltip-inner">' + this.tip + '</div>');
  6549. var $this = this,
  6550. pos = UI.$.extend({}, this.element.offset(), {width: this.element[0].offsetWidth, height: this.element[0].offsetHeight}),
  6551. width = $tooltip[0].offsetWidth,
  6552. height = $tooltip[0].offsetHeight,
  6553. offset = typeof(this.options.offset) === "function" ? this.options.offset.call(this.element) : this.options.offset,
  6554. position = typeof(this.options.pos) === "function" ? this.options.pos.call(this.element) : this.options.pos,
  6555. tmppos = position.split("-"),
  6556. tcss = {
  6557. "display" : "none",
  6558. "visibility" : "visible",
  6559. "top" : (pos.top + pos.height + height),
  6560. "left" : pos.left
  6561. };
  6562. // prevent strange position
  6563. // when tooltip is in offcanvas etc.
  6564. if (UI.$html.css('position')=='fixed' || UI.$body.css('position')=='fixed'){
  6565. var bodyoffset = UI.$('body').offset(),
  6566. htmloffset = UI.$('html').offset(),
  6567. docoffset = {'top': (htmloffset.top + bodyoffset.top), 'left': (htmloffset.left + bodyoffset.left)};
  6568. pos.left -= docoffset.left;
  6569. pos.top -= docoffset.top;
  6570. }
  6571. if ((tmppos[0] == "left" || tmppos[0] == "right") && UI.langdirection == 'right') {
  6572. tmppos[0] = tmppos[0] == "left" ? "right" : "left";
  6573. }
  6574. var variants = {
  6575. "bottom" : {top: pos.top + pos.height + offset, left: pos.left + pos.width / 2 - width / 2},
  6576. "top" : {top: pos.top - height - offset, left: pos.left + pos.width / 2 - width / 2},
  6577. "left" : {top: pos.top + pos.height / 2 - height / 2, left: pos.left - width - offset},
  6578. "right" : {top: pos.top + pos.height / 2 - height / 2, left: pos.left + pos.width + offset}
  6579. };
  6580. UI.$.extend(tcss, variants[tmppos[0]]);
  6581. if (tmppos.length == 2) tcss.left = (tmppos[1] == 'left') ? (pos.left) : ((pos.left + pos.width) - width);
  6582. var boundary = this.checkBoundary(tcss.left, tcss.top, width, height);
  6583. if(boundary) {
  6584. switch(boundary) {
  6585. case "x":
  6586. if (tmppos.length == 2) {
  6587. position = tmppos[0]+"-"+(tcss.left < 0 ? "left": "right");
  6588. } else {
  6589. position = tcss.left < 0 ? "right": "left";
  6590. }
  6591. break;
  6592. case "y":
  6593. if (tmppos.length == 2) {
  6594. position = (tcss.top < 0 ? "bottom": "top")+"-"+tmppos[1];
  6595. } else {
  6596. position = (tcss.top < 0 ? "bottom": "top");
  6597. }
  6598. break;
  6599. case "xy":
  6600. if (tmppos.length == 2) {
  6601. position = (tcss.top < 0 ? "bottom": "top")+"-"+(tcss.left < 0 ? "left": "right");
  6602. } else {
  6603. position = tcss.left < 0 ? "right": "left";
  6604. }
  6605. break;
  6606. }
  6607. tmppos = position.split("-");
  6608. UI.$.extend(tcss, variants[tmppos[0]]);
  6609. if (tmppos.length == 2) tcss.left = (tmppos[1] == 'left') ? (pos.left) : ((pos.left + pos.width) - width);
  6610. }
  6611. tcss.left -= UI.$body.position().left;
  6612. tooltipdelay = setTimeout(function(){
  6613. $tooltip.css(tcss).attr("class", ["uk-tooltip", "uk-tooltip-"+position, $this.options.cls].join(' '));
  6614. if ($this.options.animation) {
  6615. $tooltip.css({opacity: 0, display: 'block'}).addClass($this.options.activeClass).animate({opacity: 1}, parseInt($this.options.animation, 10) || 400);
  6616. } else {
  6617. $tooltip.show().addClass($this.options.activeClass);
  6618. }
  6619. tooltipdelay = false;
  6620. // close tooltip if element was removed or hidden
  6621. checkdelay = setInterval(function(){
  6622. if(!$this.element.is(':visible')) $this.hide();
  6623. }, 150);
  6624. }, parseInt(this.options.delay, 10) || 0);
  6625. },
  6626. hide: function() {
  6627. if(this.element.is("input") && this.element[0]===document.activeElement) return;
  6628. if(tooltipdelay) clearTimeout(tooltipdelay);
  6629. if (checkdelay) clearTimeout(checkdelay);
  6630. $tooltip.stop();
  6631. if (this.options.animation) {
  6632. var $this = this;
  6633. $tooltip.fadeOut(parseInt(this.options.animation, 10) || 400, function(){
  6634. $tooltip.removeClass($this.options.activeClass)
  6635. });
  6636. } else {
  6637. $tooltip.hide().removeClass(this.options.activeClass);
  6638. }
  6639. },
  6640. content: function() {
  6641. return this.tip;
  6642. },
  6643. checkBoundary: function(left, top, width, height) {
  6644. var axis = "";
  6645. if(left < 0 || ((left - UI.$win.scrollLeft())+width) > window.innerWidth) {
  6646. axis += "x";
  6647. }
  6648. if(top < 0 || ((top - UI.$win.scrollTop())+height) > window.innerHeight) {
  6649. axis += "y";
  6650. }
  6651. return axis;
  6652. }
  6653. });
  6654. return UI.tooltip;
  6655. });
  6656. /*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  6657. (function(addon) {
  6658. var component;
  6659. if (window.UIkit) {
  6660. component = addon(UIkit);
  6661. }
  6662. if (typeof define == "function" && define.amd) {
  6663. define("uikit-timepicker", ["uikit"], function(){
  6664. return component || addon(UIkit);
  6665. });
  6666. }
  6667. })(function(UI){
  6668. "use strict";
  6669. UI.component('timepicker', {
  6670. defaults: {
  6671. format : '24h',
  6672. delay : 0,
  6673. start : 0,
  6674. end : 24
  6675. },
  6676. boot: function() {
  6677. // init code
  6678. UI.$html.on("focus.timepicker.uikit", "[data-uk-timepicker]", function(e) {
  6679. var ele = UI.$(this);
  6680. if (!ele.data("timepicker")) {
  6681. var obj = UI.timepicker(ele, UI.Utils.options(ele.attr("data-uk-timepicker")));
  6682. setTimeout(function(){
  6683. obj.autocomplete.input.focus();
  6684. }, 40);
  6685. }
  6686. });
  6687. },
  6688. init: function() {
  6689. var $this = this, times = getTimeRange(this.options.start, this.options.end), container;
  6690. this.options.minLength = 0;
  6691. this.options.template = '<ul class="uk-nav uk-nav-autocomplete uk-autocomplete-results">{{~items}}<li data-value="{{$item.value}}"><a class="needsclick">{{$item.value}}</a></li>{{/items}}</ul>';
  6692. this.options.source = function(release) {
  6693. release(times[$this.options.format] || times['12h']);
  6694. };
  6695. if (this.element.is('input')) {
  6696. this.element.wrap('<div class="uk-autocomplete"></div>');
  6697. container = this.element.parent();
  6698. } else {
  6699. container = this.element.addClass('uk-autocomplete');
  6700. }
  6701. this.autocomplete = UI.autocomplete(container, this.options);
  6702. this.autocomplete.dropdown.addClass('uk-dropdown-small uk-dropdown-scrollable');
  6703. this.autocomplete.on('show.uk.autocomplete', function() {
  6704. var selected = $this.autocomplete.dropdown.find('[data-value="'+$this.autocomplete.input.val()+'"]');
  6705. setTimeout(function(){
  6706. $this.autocomplete.pick(selected, true);
  6707. }, 10);
  6708. });
  6709. this.autocomplete.input.on('focus', function(){
  6710. $this.autocomplete.value = Math.random();
  6711. $this.autocomplete.triggercomplete();
  6712. }).on('blur', UI.Utils.debounce(function() {
  6713. $this.checkTime();
  6714. }, 100));
  6715. this.element.data("timepicker", this);
  6716. },
  6717. checkTime: function() {
  6718. var arr, timeArray, meridian = 'AM', hour, minute, time = this.autocomplete.input.val();
  6719. if (this.options.format == '12h') {
  6720. arr = time.split(' ');
  6721. timeArray = arr[0].split(':');
  6722. meridian = arr[1];
  6723. } else {
  6724. timeArray = time.split(':');
  6725. }
  6726. hour = parseInt(timeArray[0], 10);
  6727. minute = parseInt(timeArray[1], 10);
  6728. if (isNaN(hour)) hour = 0;
  6729. if (isNaN(minute)) minute = 0;
  6730. if (this.options.format == '12h') {
  6731. if (hour > 12) {
  6732. hour = 12;
  6733. } else if (hour < 0) {
  6734. hour = 12;
  6735. }
  6736. if (meridian === 'am' || meridian === 'a') {
  6737. meridian = 'AM';
  6738. } else if (meridian === 'pm' || meridian === 'p') {
  6739. meridian = 'PM';
  6740. }
  6741. if (meridian !== 'AM' && meridian !== 'PM') {
  6742. meridian = 'AM';
  6743. }
  6744. } else {
  6745. if (hour >= 24) {
  6746. hour = 23;
  6747. } else if (hour < 0) {
  6748. hour = 0;
  6749. }
  6750. }
  6751. if (minute < 0) {
  6752. minute = 0;
  6753. } else if (minute >= 60) {
  6754. minute = 0;
  6755. }
  6756. this.autocomplete.input.val(this.formatTime(hour, minute, meridian)).trigger('change');
  6757. },
  6758. formatTime: function(hour, minute, meridian) {
  6759. hour = hour < 10 ? '0' + hour : hour;
  6760. minute = minute < 10 ? '0' + minute : minute;
  6761. return hour + ':' + minute + (this.options.format == '12h' ? ' ' + meridian : '');
  6762. }
  6763. });
  6764. // helper
  6765. function getTimeRange(start, end) {
  6766. start = start || 0;
  6767. end = end || 24;
  6768. var times = {'12h':[], '24h':[]}, i, h;
  6769. for (i = start, h=''; i<end; i++) {
  6770. h = ''+i;
  6771. if (i<10) h = '0'+h;
  6772. times['24h'].push({value: (h+':00')});
  6773. times['24h'].push({value: (h+':30')});
  6774. if (i === 0) {
  6775. h = 12;
  6776. times['12h'].push({value: (h+':00 AM')});
  6777. times['12h'].push({value: (h+':30 AM')});
  6778. }
  6779. if (i > 0 && i<13 && i!==12) {
  6780. times['12h'].push({value: (h+':00 AM')});
  6781. times['12h'].push({value: (h+':30 AM')});
  6782. }
  6783. if (i >= 12) {
  6784. h = h-12;
  6785. if (h === 0) h = 12;
  6786. if (h < 10) h = '0'+String(h);
  6787. times['12h'].push({value: (h+':00 PM')});
  6788. times['12h'].push({value: (h+':30 PM')});
  6789. }
  6790. }
  6791. return times;
  6792. }
  6793. });
  6794. /*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  6795. (function(addon) {
  6796. var component;
  6797. if (window.UIkit) {
  6798. component = addon(UIkit);
  6799. }
  6800. if (typeof define == "function" && define.amd) {
  6801. define("uikit-upload", ["uikit"], function(){
  6802. return component || addon(UIkit);
  6803. });
  6804. }
  6805. })(function(UI){
  6806. "use strict";
  6807. UI.component('uploadSelect', {
  6808. init: function() {
  6809. var $this = this;
  6810. this.on("change", function() {
  6811. xhrupload($this.element[0].files, $this.options);
  6812. var twin = $this.element.clone(true).data('uploadSelect', $this);
  6813. $this.element.replaceWith(twin);
  6814. $this.element = twin;
  6815. });
  6816. }
  6817. });
  6818. UI.component('uploadDrop', {
  6819. defaults: {
  6820. 'dragoverClass': 'uk-dragover'
  6821. },
  6822. init: function() {
  6823. var $this = this, hasdragCls = false;
  6824. this.on("drop", function(e){
  6825. if (e.originalEvent.dataTransfer && e.originalEvent.dataTransfer.files) {
  6826. e.stopPropagation();
  6827. e.preventDefault();
  6828. $this.element.removeClass($this.options.dragoverClass);
  6829. $this.element.trigger('dropped.uk.upload', [e.originalEvent.dataTransfer.files]);
  6830. xhrupload(e.originalEvent.dataTransfer.files, $this.options);
  6831. }
  6832. }).on("dragenter", function(e){
  6833. e.stopPropagation();
  6834. e.preventDefault();
  6835. }).on("dragover", function(e){
  6836. e.stopPropagation();
  6837. e.preventDefault();
  6838. if (!hasdragCls) {
  6839. $this.element.addClass($this.options.dragoverClass);
  6840. hasdragCls = true;
  6841. }
  6842. }).on("dragleave", function(e){
  6843. e.stopPropagation();
  6844. e.preventDefault();
  6845. $this.element.removeClass($this.options.dragoverClass);
  6846. hasdragCls = false;
  6847. });
  6848. }
  6849. });
  6850. UI.support.ajaxupload = (function() {
  6851. function supportFileAPI() {
  6852. var fi = document.createElement('INPUT'); fi.type = 'file'; return 'files' in fi;
  6853. }
  6854. function supportAjaxUploadProgressEvents() {
  6855. var xhr = new XMLHttpRequest(); return !! (xhr && ('upload' in xhr) && ('onprogress' in xhr.upload));
  6856. }
  6857. function supportFormData() {
  6858. return !! window.FormData;
  6859. }
  6860. return supportFileAPI() && supportAjaxUploadProgressEvents() && supportFormData();
  6861. })();
  6862. function xhrupload(files, settings) {
  6863. if (!UI.support.ajaxupload){
  6864. return this;
  6865. }
  6866. settings = UI.$.extend({}, xhrupload.defaults, settings);
  6867. if (!files.length){
  6868. return;
  6869. }
  6870. if (settings.allow !== '*.*') {
  6871. for(var i=0,file;file=files[i];i++) {
  6872. if(!matchName(settings.allow, file.name)) {
  6873. if(typeof(settings.notallowed) == 'string') {
  6874. alert(settings.notallowed);
  6875. } else {
  6876. settings.notallowed(file, settings);
  6877. }
  6878. return;
  6879. }
  6880. }
  6881. }
  6882. var complete = settings.complete;
  6883. if (settings.single){
  6884. var count = files.length,
  6885. uploaded = 0,
  6886. allow = true;
  6887. settings.beforeAll(files);
  6888. settings.complete = function(response, xhr){
  6889. uploaded = uploaded + 1;
  6890. complete(response, xhr);
  6891. if (settings.filelimit && uploaded >= settings.filelimit){
  6892. allow = false;
  6893. }
  6894. if (allow && uploaded<count){
  6895. upload([files[uploaded]], settings);
  6896. } else {
  6897. settings.allcomplete(response, xhr);
  6898. }
  6899. };
  6900. upload([files[0]], settings);
  6901. } else {
  6902. settings.complete = function(response, xhr){
  6903. complete(response, xhr);
  6904. settings.allcomplete(response, xhr);
  6905. };
  6906. upload(files, settings);
  6907. }
  6908. function upload(files, settings){
  6909. // upload all at once
  6910. var formData = new FormData(), xhr = new XMLHttpRequest();
  6911. if (settings.before(settings, files)===false) return;
  6912. for (var i = 0, f; f = files[i]; i++) { formData.append(settings.param, f); }
  6913. for (var p in settings.params) { formData.append(p, settings.params[p]); }
  6914. // Add any event handlers here...
  6915. xhr.upload.addEventListener("progress", function(e){
  6916. var percent = (e.loaded / e.total)*100;
  6917. settings.progress(percent, e);
  6918. }, false);
  6919. xhr.addEventListener("loadstart", function(e){ settings.loadstart(e); }, false);
  6920. xhr.addEventListener("load", function(e){ settings.load(e); }, false);
  6921. xhr.addEventListener("loadend", function(e){ settings.loadend(e); }, false);
  6922. xhr.addEventListener("error", function(e){ settings.error(e); }, false);
  6923. xhr.addEventListener("abort", function(e){ settings.abort(e); }, false);
  6924. xhr.open(settings.method, settings.action, true);
  6925. if (settings.type=="json") {
  6926. xhr.setRequestHeader("Accept", "application/json");
  6927. }
  6928. for (var h in settings.headers) {
  6929. xhr.setRequestHeader(h, settings.headers[h]);
  6930. }
  6931. xhr.onreadystatechange = function() {
  6932. settings.readystatechange(xhr);
  6933. if (xhr.readyState==4){
  6934. var response = xhr.responseText;
  6935. if (settings.type=="json") {
  6936. try {
  6937. response = UI.$.parseJSON(response);
  6938. } catch(e) {
  6939. response = false;
  6940. }
  6941. }
  6942. settings.complete(response, xhr);
  6943. }
  6944. };
  6945. settings.beforeSend(xhr);
  6946. xhr.send(formData);
  6947. }
  6948. }
  6949. xhrupload.defaults = {
  6950. action: '',
  6951. single: true,
  6952. method: 'POST',
  6953. param : 'files[]',
  6954. params: {},
  6955. allow : '*.*',
  6956. type : 'text',
  6957. filelimit: false,
  6958. headers: {},
  6959. // events
  6960. before : function(o){},
  6961. beforeSend : function(xhr){},
  6962. beforeAll : function(){},
  6963. loadstart : function(){},
  6964. load : function(){},
  6965. loadend : function(){},
  6966. error : function(){},
  6967. abort : function(){},
  6968. progress : function(){},
  6969. complete : function(){},
  6970. allcomplete : function(){},
  6971. readystatechange: function(){},
  6972. notallowed : function(file, settings){ alert('Only the following file types are allowed: '+settings.allow); }
  6973. };
  6974. function matchName(pattern, path) {
  6975. var parsedPattern = '^' + pattern.replace(/\//g, '\\/').
  6976. replace(/\*\*/g, '(\\/[^\\/]+)*').
  6977. replace(/\*/g, '[^\\/]+').
  6978. replace(/((?!\\))\?/g, '$1.') + '$';
  6979. parsedPattern = '^' + parsedPattern + '$';
  6980. return (path.match(new RegExp(parsedPattern, 'i')) !== null);
  6981. }
  6982. UI.Utils.xhrupload = xhrupload;
  6983. return xhrupload;
  6984. });
  6985. // http://getuikit.com/docs/documentation_javascript.html#js-override
  6986. if (typeof UIkit !== 'undefined') {
  6987. UIkit.on('beforeready.uk.dom', function () {
  6988. // accrodion
  6989. if (typeof UIkit.components.accordion !== "undefined") { // check if accordion component is defined
  6990. $.extend(UIkit.components.accordion.prototype.defaults, {
  6991. easing: $.bez([ 0.35,0,0.25,1 ]),
  6992. duration: 200
  6993. });
  6994. }
  6995. // dropdown
  6996. if (typeof UIkit.components.dropdown.prototype !== "undefined") { // check if dropdown component is defined
  6997. $.extend(UIkit.components.dropdown.prototype.defaults, {
  6998. remaintime: 150,
  6999. delay: 50
  7000. });
  7001. (function() {
  7002. var old_show_function = UIkit.components.dropdown.prototype.show;
  7003. UIkit.components.dropdown.prototype.show = function() {
  7004. this.dropdown
  7005. .css({
  7006. 'min-width': this.dropdown.outerWidth()
  7007. })
  7008. .addClass('uk-dropdown-active uk-dropdown-shown');
  7009. return old_show_function.apply(this, arguments);
  7010. }
  7011. })();
  7012. (function() {
  7013. var old_hide_function = UIkit.components.dropdown.prototype.hide;
  7014. UIkit.components.dropdown.prototype.hide = function() {
  7015. var this_dropdown = this.dropdown;
  7016. this_dropdown.removeClass('uk-dropdown-shown');
  7017. var dropdown_timeout = setTimeout(function() {
  7018. this_dropdown.removeClass('uk-dropdown-active')
  7019. },280);
  7020. return old_hide_function.apply(this, arguments);
  7021. }
  7022. })();
  7023. }
  7024. // modal
  7025. if (typeof UIkit.components.modal !== "undefined") { // check if modal component is defined
  7026. $.extend(UIkit.components.modal.prototype.defaults, {
  7027. center: true
  7028. });
  7029. UIkit.modal.dialog.template = '<div class="uk-modal uk-modal-dialog-replace"><div class="uk-modal-dialog" style="min-height:0;"></div></div>';
  7030. $body
  7031. .on('show.uk.modal', '.uk-modal-dialog-replace', function () {
  7032. // customize uikit dialog
  7033. setTimeout(function () {
  7034. var dialogReplace = $('.uk-modal-dialog-replace');
  7035. if (dialogReplace.find('.uk-button-primary').length) {
  7036. var actionBtn = dialogReplace.find('.uk-button-primary').toggleClass('uk-button-primary md-btn-flat-primary');
  7037. if (actionBtn.next('button')) {
  7038. actionBtn.next('button').after(actionBtn);
  7039. }
  7040. }
  7041. if (dialogReplace.find('.uk-button').length) {
  7042. dialogReplace.find('.uk-button').toggleClass('uk-button md-btn md-btn-flat');
  7043. }
  7044. if (dialogReplace.find('.uk-margin-small-top').length) {
  7045. dialogReplace.find('.uk-margin-small-top').toggleClass('uk-margin-small-top uk-margin-top');
  7046. }
  7047. if (dialogReplace.find('input.uk-width-1-1').length) {
  7048. dialogReplace.find('input.uk-width-1-1').toggleClass('uk-width-1-1 md-input');
  7049. // reinitialize md inputs
  7050. altair_md.inputs();
  7051. }
  7052. if (dialogReplace.find('.uk-form').length) {
  7053. dialogReplace.find('.uk-form').removeClass('uk-form');
  7054. }
  7055. }, 50)
  7056. });
  7057. }
  7058. // tooltip
  7059. if (typeof UIkit.components.tooltip !== "undefined") { // check if tooltip component is defined
  7060. $.extend(UIkit.components.tooltip.prototype.defaults, {
  7061. animation: 280,
  7062. offset: 8
  7063. });
  7064. }
  7065. // sortable
  7066. if (typeof UIkit.components.sortable !== "undefined") { // check if sortable component is defined
  7067. if(Modernizr.touch) {
  7068. $('[data-uk-sortable]').children().addClass('needsclick');
  7069. }
  7070. }
  7071. });
  7072. }