1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818 |
- /* 11:53:30 29/03/2017 [http://oystatic.ignimgs.com/src/core/js/lib/leaflet/leaflet-0.5.1.src.js, http://oystatic.ignimgs.com/src/core/js/bootstrap/bootstrap.js, http://oystatic.ignimgs.com/src/ignmedia/js/maps/maps.js, http://oystatic.ignimgs.com/src/core/js/widgets/../lib/leaflet/modules/leaflet.markercluster-src.js, http://oystatic.ignimgs.com/src/core/js/widgets/../external/jquery/plugins/jquery.lionbars.0.3.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/mixins/api.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/mixins/icon.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/mixins/types.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/mixins/maps.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/mixins/markers.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/ign/type.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/ign/marker.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/ign/pendingmarker.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/ign/markerclustergroup.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/ign/popupcontent/clustercontent.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/ign/popupcontent/content.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/ign/popupcontent/editcontent.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/ign/popupcontent/wikicontent.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/ign/popupcontent/pendingcontent.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/ign/map.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/ign/interactivemap.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/controls/fullscreen.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/controls/slidingview.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/controls/title.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/controls/loadingindicator.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/controls/searchbar.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/controls/overlayfilter.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/controls/contextmenu.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/controls/persistence.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/controls/moderation.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/controls/eventtracker.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/controls/externallink.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/controls/markeradder.js, http://oystatic.ignimgs.com/src/core/js/widgets/tools/maps/ign/interface.js, http://oystatic.ignimgs.com/src/core/js/widgets/global/page/footer.js, http://oystatic.ignimgs.com/src/core/js/widgets/global/page/optimizely.js, http://oystatic.ignimgs.com/src/core/js/widgets/global/page/globalheader/global-header.js, http://oystatic.ignimgs.com/src/core/js/widgets/global/page/globalheader/section_layout.js]*/
- (function (k, i, l) {
- var b, o;
- typeof exports !== l + "" ? b = exports : (o = k.L, b = {
- noConflict: function () {
- k.L = o;
- return this
- }
- }, k.L = b);
- b.version = "0.5.1";
- b.Util = {
- extend: function (a) {
- var c = Array.prototype.slice.call(arguments, 1),
- b, d, f, g;
- for (d = 0, f = c.length; d < f; d++)
- for (b in g = c[d] || {}, g) g.hasOwnProperty(b) && (a[b] = g[b]);
- return a
- },
- bind: function (a, c) {
- var b = 2 < arguments.length ? Array.prototype.slice.call(arguments, 2) : null;
- return function () {
- return a.apply(c, b || arguments)
- }
- },
- stamp: function () {
- var a = 0;
- return function (c) {
- c._leaflet_id =
- c._leaflet_id || ++a;
- return c._leaflet_id
- }
- }(),
- limitExecByInterval: function (a, c, b) {
- var d, f;
- return function h() {
- var j = arguments;
- d ? f = !0 : (d = !0, setTimeout(function () {
- d = !1;
- f && (h.apply(b, j), f = !1)
- }, c), a.apply(b, j))
- }
- },
- falseFn: function () {
- return !1
- },
- formatNum: function (a, c) {
- var b = Math.pow(10, c || 5);
- return Math.round(a * b) / b
- },
- splitWords: function (a) {
- return a.replace(/^\s+|\s+$/g, "").split(/\s+/)
- },
- setOptions: function (a, c) {
- a.options = b.extend({}, a.options, c);
- return a.options
- },
- getParamString: function (a, c) {
- var b = [],
- d;
- for (d in a) a.hasOwnProperty(d) &&
- b.push(d + "=" + a[d]);
- return (!c || -1 === c.indexOf("?") ? "?" : "&") + b.join("&")
- },
- template: function (a, c) {
- return a.replace(/\{ *([\w_]+) *\}/g, function (a, b) {
- var f = c[b];
- if (!c.hasOwnProperty(b)) throw Error("No value provided for variable " + a);
- return f
- })
- },
- isArray: function (a) {
- return "[object Array]" === Object.prototype.toString.call(a)
- },
- emptyImageUrl: "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="
- };
- (function () {
- function a(a) {
- var c, b, e = ["webkit", "moz", "o", "ms"];
- for (c = 0; c < e.length && !b; c++) b = k[e[c] + a];
- return b
- }
- function c(a) {
- var c = +new Date,
- b = Math.max(0, 16 - (c - e));
- e = c + b;
- return k.setTimeout(a, b)
- }
- var e = 0,
- d = k.requestAnimationFrame || a("RequestAnimationFrame") || c,
- f = k.cancelAnimationFrame || a("CancelAnimationFrame") || a("CancelRequestAnimationFrame") || function (a) {
- k.clearTimeout(a)
- };
- b.Util.requestAnimFrame = function (a, e, f, i) {
- a = b.bind(a, e);
- if (f && d === c) a();
- else return d.call(k, a, i)
- };
- b.Util.cancelAnimFrame = function (a) {
- a && f.call(k, a)
- }
- })();
- b.extend = b.Util.extend;
- b.bind = b.Util.bind;
- b.stamp = b.Util.stamp;
- b.setOptions = b.Util.setOptions;
- b.Class = function () {};
- b.Class.extend = function (a) {
- var c = function () {
- this.initialize && this.initialize.apply(this, arguments);
- this._initHooks && this.callInitHooks()
- },
- e = function () {};
- e.prototype = this.prototype;
- var d = new e;
- d.constructor = c;
- c.prototype = d;
- for (var f in this) this.hasOwnProperty(f) && "prototype" !== f && (c[f] = this[f]);
- a.statics && (b.extend(c, a.statics), delete a.statics);
- a.includes && (b.Util.extend.apply(null, [d].concat(a.includes)), delete a.includes);
- if (a.options && d.options) a.options = b.extend({}, d.options,
- a.options);
- b.extend(d, a);
- d._initHooks = [];
- var g = this;
- d.callInitHooks = function () {
- if (!this._initHooksCalled) {
- g.prototype.callInitHooks && g.prototype.callInitHooks.call(this);
- this._initHooksCalled = !0;
- for (var a = 0, c = d._initHooks.length; a < c; a++) d._initHooks[a].call(this)
- }
- };
- return c
- };
- b.Class.include = function (a) {
- b.extend(this.prototype, a)
- };
- b.Class.mergeOptions = function (a) {
- b.extend(this.prototype.options, a)
- };
- b.Class.addInitHook = function (a) {
- var c = Array.prototype.slice.call(arguments, 1),
- b;
- this.prototype._initHooks =
- this.prototype._initHooks || [];
- this.prototype._initHooks.push("function" === typeof a ? a : function () {
- this[a].apply(this, c)
- })
- };
- b.Mixin = {};
- b.Mixin.Events = {
- addEventListener: function (a, c, e) {
- var d = this._leaflet_events = this._leaflet_events || {},
- f, g;
- if ("object" === typeof a) {
- for (f in a) a.hasOwnProperty(f) && this.addEventListener(f, a[f], c);
- return this
- }
- a = b.Util.splitWords(a);
- for (f = 0, g = a.length; f < g; f++) d[a[f]] = d[a[f]] || [], d[a[f]].push({
- action: c,
- context: e || this
- });
- return this
- },
- hasEventListeners: function (a) {
- return "_leaflet_events" in
- this && a in this._leaflet_events && 0 < this._leaflet_events[a].length
- },
- removeEventListener: function (a, c, e) {
- var d = this._leaflet_events,
- f, g, h, j;
- if ("object" === typeof a) {
- for (f in a) a.hasOwnProperty(f) && this.removeEventListener(f, a[f], c);
- return this
- }
- a = b.Util.splitWords(a);
- for (f = 0, g = a.length; f < g; f++)
- if (this.hasEventListeners(a[f])) {
- h = d[a[f]];
- for (j = h.length - 1; 0 <= j; j--)(!c || h[j].action === c) && (!e || h[j].context === e) && h.splice(j, 1)
- }
- return this
- },
- fireEvent: function (a, c) {
- if (!this.hasEventListeners(a)) return this;
- for (var e =
- b.extend({
- type: a,
- target: this
- }, c), d = this._leaflet_events[a].slice(), f = 0, g = d.length; f < g; f++) d[f].action.call(d[f].context || this, e);
- return this
- }
- };
- b.Mixin.Events.on = b.Mixin.Events.addEventListener;
- b.Mixin.Events.off = b.Mixin.Events.removeEventListener;
- b.Mixin.Events.fire = b.Mixin.Events.fireEvent;
- (function () {
- var a = !!k.ActiveXObject,
- c = a && !k.XMLHttpRequest,
- e = a && !i.querySelector,
- d = navigator.userAgent.toLowerCase(),
- f = -1 !== d.indexOf("webkit"),
- g = -1 !== d.indexOf("chrome"),
- h = -1 !== d.indexOf("android"),
- d = -1 !== d.search("android [23]"),
- j = typeof orientation !== l + "",
- q = k.navigator && k.navigator.msPointerEnabled && k.navigator.msMaxTouchPoints,
- t = "devicePixelRatio" in k && 1 < k.devicePixelRatio || "matchMedia" in k && k.matchMedia("(min-resolution:144dpi)") && k.matchMedia("(min-resolution:144dpi)").matches,
- m = i.documentElement,
- n = a && "transition" in m.style,
- p = "WebKitCSSMatrix" in k && "m11" in new k.WebKitCSSMatrix,
- r = "MozPerspective" in m.style,
- s = "OTransition" in m.style,
- o = !k.L_DISABLE_3D && (n || p || r || s),
- u = !k.L_NO_TOUCH && function () {
- if (q || "ontouchstart" in m) return !0;
- var a = i.createElement("div"),
- c = !1;
- if (!a.setAttribute) return !1;
- a.setAttribute("ontouchstart", "return;");
- "function" === typeof a.ontouchstart && (c = !0);
- a.removeAttribute("ontouchstart");
- return c
- }();
- b.Browser = {
- ie: a,
- ie6: c,
- ie7: e,
- webkit: f,
- android: h,
- android23: d,
- chrome: g,
- ie3d: n,
- webkit3d: p,
- gecko3d: r,
- opera3d: s,
- any3d: o,
- mobile: j,
- mobileWebkit: j && f,
- mobileWebkit3d: j && p,
- mobileOpera: j && k.opera,
- touch: u,
- msTouch: q,
- retina: t
- }
- })();
- b.Point = function (a, c, b) {
- this.x = b ? Math.round(a) : a;
- this.y = b ? Math.round(c) : c
- };
- b.Point.prototype = {
- clone: function () {
- return new b.Point(this.x, this.y)
- },
- add: function (a) {
- return this.clone()._add(b.point(a))
- },
- _add: function (a) {
- this.x += a.x;
- this.y += a.y;
- return this
- },
- subtract: function (a) {
- return this.clone()._subtract(b.point(a))
- },
- _subtract: function (a) {
- this.x -= a.x;
- this.y -= a.y;
- return this
- },
- divideBy: function (a) {
- return this.clone()._divideBy(a)
- },
- _divideBy: function (a) {
- this.x /= a;
- this.y /= a;
- return this
- },
- multiplyBy: function (a) {
- return this.clone()._multiplyBy(a)
- },
- _multiplyBy: function (a) {
- this.x *= a;
- this.y *= a;
- return this
- },
- round: function () {
- return this.clone()._round()
- },
- _round: function () {
- this.x = Math.round(this.x);
- this.y = Math.round(this.y);
- return this
- },
- floor: function () {
- return this.clone()._floor()
- },
- _floor: function () {
- this.x = Math.floor(this.x);
- this.y = Math.floor(this.y);
- return this
- },
- distanceTo: function (a) {
- var a = b.point(a),
- c = a.x - this.x,
- a = a.y - this.y;
- return Math.sqrt(c * c + a * a)
- },
- equals: function (a) {
- return a.x === this.x && a.y === this.y
- },
- toString: function () {
- return "Point(" + b.Util.formatNum(this.x) + ", " + b.Util.formatNum(this.y) + ")"
- }
- };
- b.point = function (a, c, e) {
- return a instanceof b.Point ? a : b.Util.isArray(a) ? new b.Point(a[0], a[1]) : isNaN(a) ? a : new b.Point(a, c, e)
- };
- b.Bounds = function (a, c) {
- if (a)
- for (var b = c ? [a, c] : a, d = 0, f = b.length; d < f; d++) this.extend(b[d])
- };
- b.Bounds.prototype = {
- extend: function (a) {
- a = b.point(a);
- !this.min && !this.max ? (this.min = a.clone(), this.max = a.clone()) : (this.min.x = Math.min(a.x, this.min.x), this.max.x = Math.max(a.x, this.max.x), this.min.y = Math.min(a.y, this.min.y), this.max.y = Math.max(a.y, this.max.y));
- return this
- },
- getCenter: function (a) {
- return new b.Point((this.min.x +
- this.max.x) / 2, (this.min.y + this.max.y) / 2, a)
- },
- getBottomLeft: function () {
- return new b.Point(this.min.x, this.max.y)
- },
- getTopRight: function () {
- return new b.Point(this.max.x, this.min.y)
- },
- getSize: function () {
- return this.max.subtract(this.min)
- },
- contains: function (a) {
- var c, a = "number" === typeof a[0] || a instanceof b.Point ? b.point(a) : b.bounds(a);
- a instanceof b.Bounds ? (c = a.min, a = a.max) : c = a;
- return c.x >= this.min.x && a.x <= this.max.x && c.y >= this.min.y && a.y <= this.max.y
- },
- intersects: function (a) {
- var a = b.bounds(a),
- c = this.min,
- e = this.max,
- d = a.min,
- a = a.max,
- f = a.y >= c.y && d.y <= e.y;
- return a.x >= c.x && d.x <= e.x && f
- },
- isValid: function () {
- return !(!this.min || !this.max)
- }
- };
- b.bounds = function (a, c) {
- return !a || a instanceof b.Bounds ? a : new b.Bounds(a, c)
- };
- b.Transformation = function (a, c, b, d) {
- this._a = a;
- this._b = c;
- this._c = b;
- this._d = d
- };
- b.Transformation.prototype = {
- transform: function (a, c) {
- return this._transform(a.clone(), c)
- },
- _transform: function (a, c) {
- c = c || 1;
- a.x = c * (this._a * a.x + this._b);
- a.y = c * (this._c * a.y + this._d);
- return a
- },
- untransform: function (a, c) {
- c = c || 1;
- return new b.Point((a.x / c - this._b) / this._a, (a.y / c - this._d) / this._c)
- }
- };
- b.DomUtil = {
- get: function (a) {
- return "string" === typeof a ? i.getElementById(a) : a
- },
- getStyle: function (a, c) {
- var b = a.style[c];
- !b && a.currentStyle && (b = a.currentStyle[c]);
- if ((!b || "auto" === b) && i.defaultView) b = (b = i.defaultView.getComputedStyle(a, null)) ? b[c] : null;
- return "auto" === b ? null : b
- },
- getViewportOffset: function (a) {
- var c = 0,
- e = 0,
- d = a,
- f = i.body,
- g, h = b.Browser.ie7;
- do {
- c += d.offsetTop || 0;
- e += d.offsetLeft || 0;
- c += parseInt(b.DomUtil.getStyle(d, "borderTopWidth"),
- 10) || 0;
- e += parseInt(b.DomUtil.getStyle(d, "borderLeftWidth"), 10) || 0;
- g = b.DomUtil.getStyle(d, "position");
- if (d.offsetParent === f && "absolute" === g) break;
- if ("fixed" === g) {
- c += f.scrollTop || 0;
- e += f.scrollLeft || 0;
- break
- }
- d = d.offsetParent
- } while (d);
- d = a;
- do {
- if (d === f) break;
- c -= d.scrollTop || 0;
- e -= d.scrollLeft || 0;
- if (!b.DomUtil.documentIsLtr() && (b.Browser.webkit || h)) e += d.scrollWidth - d.clientWidth, h && "hidden" !== b.DomUtil.getStyle(d, "overflow-y") && "hidden" !== b.DomUtil.getStyle(d, "overflow") && (e += 17);
- d = d.parentNode
- } while (d);
- return new b.Point(e,
- c)
- },
- documentIsLtr: function () {
- if (!b.DomUtil._docIsLtrCached) b.DomUtil._docIsLtrCached = !0, b.DomUtil._docIsLtr = "ltr" === b.DomUtil.getStyle(i.body, "direction");
- return b.DomUtil._docIsLtr
- },
- create: function (a, c, b) {
- a = i.createElement(a);
- a.className = c;
- b && b.appendChild(a);
- return a
- },
- disableTextSelection: function () {
- i.selection && i.selection.empty && i.selection.empty();
- if (!this._onselectstart) this._onselectstart = i.onselectstart || null, i.onselectstart = b.Util.falseFn
- },
- enableTextSelection: function () {
- if (i.onselectstart ===
- b.Util.falseFn) i.onselectstart = this._onselectstart, this._onselectstart = null
- },
- hasClass: function (a, c) {
- return 0 < a.className.length && RegExp("(^|\\s)" + c + "(\\s|$)").test(a.className)
- },
- addClass: function (a, c) {
- b.DomUtil.hasClass(a, c) || (a.className += (a.className ? " " : "") + c)
- },
- removeClass: function (a, c) {
- a.className = a.className.replace(/(\S+)\s*/g, function (a, b) {
- return b === c ? "" : a
- }).replace(/(^\s+|\s+$)/, "")
- },
- setOpacity: function (a, c) {
- if ("opacity" in a.style) a.style.opacity = c;
- else if ("filter" in a.style) {
- var b = !1;
- try {
- b =
- a.filters.item("DXImageTransform.Microsoft.Alpha")
- } catch (d) {}
- c = Math.round(100 * c);
- b ? (b.Enabled = 100 !== c, b.Opacity = c) : a.style.filter += " progid:DXImageTransform.Microsoft.Alpha(opacity=" + c + ")"
- }
- },
- testProp: function (a) {
- for (var c = i.documentElement.style, b = 0; b < a.length; b++)
- if (a[b] in c) return a[b];
- return !1
- },
- getTranslateString: function (a) {
- var c = b.Browser.webkit3d;
- return "translate" + (c ? "3d" : "") + "(" + a.x + "px," + a.y + "px" + ((c ? ",0" : "") + ")")
- },
- getScaleString: function (a, c) {
- return b.DomUtil.getTranslateString(c.add(c.multiplyBy(-1 *
- a))) + (" scale(" + a + ") ")
- },
- setPosition: function (a, c, e) {
- a._leaflet_pos = c;
- if (!e && b.Browser.any3d) {
- if (a.style[b.DomUtil.TRANSFORM] = b.DomUtil.getTranslateString(c), b.Browser.mobileWebkit3d) a.style.WebkitBackfaceVisibility = "hidden"
- } else a.style.left = c.x + "px", a.style.top = c.y + "px"
- },
- getPosition: function (a) {
- return a._leaflet_pos
- }
- };
- b.DomUtil.TRANSFORM = b.DomUtil.testProp(["transform", "WebkitTransform", "OTransform", "MozTransform", "msTransform"]);
- b.DomUtil.TRANSITION = b.DomUtil.testProp(["webkitTransition", "transition",
- "OTransition", "MozTransition", "msTransition"
- ]);
- b.DomUtil.TRANSITION_END = "webkitTransition" === b.DomUtil.TRANSITION || "OTransition" === b.DomUtil.TRANSITION ? b.DomUtil.TRANSITION + "End" : "transitionend";
- b.LatLng = function (a, c) {
- var b = parseFloat(a),
- d = parseFloat(c);
- if (isNaN(b) || isNaN(d)) throw Error("Invalid LatLng object: (" + a + ", " + c + ")");
- this.lat = b;
- this.lng = d
- };
- b.extend(b.LatLng, {
- DEG_TO_RAD: Math.PI / 180,
- RAD_TO_DEG: 180 / Math.PI,
- MAX_MARGIN: 1.0E-9
- });
- b.LatLng.prototype = {
- equals: function (a) {
- if (!a) return !1;
- a = b.latLng(a);
- return Math.max(Math.abs(this.lat - a.lat), Math.abs(this.lng - a.lng)) <= b.LatLng.MAX_MARGIN
- },
- toString: function (a) {
- return "LatLng(" + b.Util.formatNum(this.lat, a) + ", " + b.Util.formatNum(this.lng, a) + ")"
- },
- distanceTo: function (a) {
- var a = b.latLng(a),
- c = b.LatLng.DEG_TO_RAD,
- e = (a.lng - this.lng) * c,
- d = this.lat * c,
- f = a.lat * c,
- a = Math.sin((a.lat - this.lat) * c / 2),
- e = Math.sin(e / 2),
- d = a * a + e * e * Math.cos(d) * Math.cos(f);
- return 12756274 * Math.atan2(Math.sqrt(d), Math.sqrt(1 - d))
- },
- wrap: function (a, c) {
- var e = this.lng,
- a = a || -180,
- c = c || 180;
- return new b.LatLng(this.lat,
- (e + c) % (c - a) + (e < a || e === c ? c : a))
- }
- };
- b.latLng = function (a, c) {
- return a instanceof b.LatLng ? a : b.Util.isArray(a) ? new b.LatLng(a[0], a[1]) : isNaN(a) ? a : new b.LatLng(a, c)
- };
- b.LatLngBounds = function (a, c) {
- if (a)
- for (var b = c ? [a, c] : a, d = 0, f = b.length; d < f; d++) this.extend(b[d])
- };
- b.LatLngBounds.prototype = {
- extend: function (a) {
- a = "number" === typeof a[0] || "string" === typeof a[0] || a instanceof b.LatLng ? b.latLng(a) : b.latLngBounds(a);
- a instanceof b.LatLng ? !this._southWest && !this._northEast ? (this._southWest = new b.LatLng(a.lat, a.lng),
- this._northEast = new b.LatLng(a.lat, a.lng)) : (this._southWest.lat = Math.min(a.lat, this._southWest.lat), this._southWest.lng = Math.min(a.lng, this._southWest.lng), this._northEast.lat = Math.max(a.lat, this._northEast.lat), this._northEast.lng = Math.max(a.lng, this._northEast.lng)) : a instanceof b.LatLngBounds && (this.extend(a._southWest), this.extend(a._northEast));
- return this
- },
- pad: function (a) {
- var c = this._southWest,
- e = this._northEast,
- d = Math.abs(c.lat - e.lat) * a,
- a = Math.abs(c.lng - e.lng) * a;
- return new b.LatLngBounds(new b.LatLng(c.lat -
- d, c.lng - a), new b.LatLng(e.lat + d, e.lng + a))
- },
- getCenter: function () {
- return new b.LatLng((this._southWest.lat + this._northEast.lat) / 2, (this._southWest.lng + this._northEast.lng) / 2)
- },
- getSouthWest: function () {
- return this._southWest
- },
- getNorthEast: function () {
- return this._northEast
- },
- getNorthWest: function () {
- return new b.LatLng(this._northEast.lat, this._southWest.lng)
- },
- getSouthEast: function () {
- return new b.LatLng(this._southWest.lat, this._northEast.lng)
- },
- contains: function (a) {
- var a = "number" === typeof a[0] || a instanceof
- b.LatLng ? b.latLng(a) : b.latLngBounds(a), c = this._southWest, e = this._northEast, d;
- a instanceof b.LatLngBounds ? (d = a.getSouthWest(), a = a.getNorthEast()) : d = a;
- return d.lat >= c.lat && a.lat <= e.lat && d.lng >= c.lng && a.lng <= e.lng
- },
- intersects: function (a) {
- var a = b.latLngBounds(a),
- c = this._southWest,
- e = this._northEast,
- d = a.getSouthWest(),
- a = a.getNorthEast(),
- f = a.lng >= c.lng && d.lng <= e.lng;
- return a.lat >= c.lat && d.lat <= e.lat && f
- },
- toBBoxString: function () {
- var a = this._southWest,
- c = this._northEast;
- return [a.lng, a.lat, c.lng, c.lat].join()
- },
- equals: function (a) {
- if (!a) return !1;
- a = b.latLngBounds(a);
- return this._southWest.equals(a.getSouthWest()) && this._northEast.equals(a.getNorthEast())
- },
- isValid: function () {
- return !(!this._southWest || !this._northEast)
- }
- };
- b.latLngBounds = function (a, c) {
- return !a || a instanceof b.LatLngBounds ? a : new b.LatLngBounds(a, c)
- };
- b.Projection = {};
- b.Projection.SphericalMercator = {
- MAX_LATITUDE: 85.0511287798,
- project: function (a) {
- var c = b.LatLng.DEG_TO_RAD,
- e = this.MAX_LATITUDE,
- e = Math.max(Math.min(e, a.lat), -e),
- a = a.lng * c,
- c = Math.log(Math.tan(Math.PI /
- 4 + e * c / 2));
- return new b.Point(a, c)
- },
- unproject: function (a) {
- var c = b.LatLng.RAD_TO_DEG,
- e = a.x * c,
- a = (2 * Math.atan(Math.exp(a.y)) - Math.PI / 2) * c;
- return new b.LatLng(a, e)
- }
- };
- b.Projection.LonLat = {
- project: function (a) {
- return new b.Point(a.lng, a.lat)
- },
- unproject: function (a) {
- return new b.LatLng(a.y, a.x)
- }
- };
- b.CRS = {
- latLngToPoint: function (a, c) {
- var b = this.projection.project(a),
- d = this.scale(c);
- return this.transformation._transform(b, d)
- },
- pointToLatLng: function (a, c) {
- var b = this.scale(c);
- return this.projection.unproject(this.transformation.untransform(a,
- b))
- },
- project: function (a) {
- return this.projection.project(a)
- },
- scale: function (a) {
- return 256 * Math.pow(2, a)
- }
- };
- b.CRS.Simple = b.extend({}, b.CRS, {
- projection: b.Projection.LonLat,
- transformation: new b.Transformation(1, 0, -1, 0),
- scale: function (a) {
- return Math.pow(2, a)
- }
- });
- b.CRS.EPSG3857 = b.extend({}, b.CRS, {
- code: "EPSG:3857",
- projection: b.Projection.SphericalMercator,
- transformation: new b.Transformation(0.5 / Math.PI, 0.5, -0.5 / Math.PI, 0.5),
- project: function (a) {
- return this.projection.project(a).multiplyBy(6378137)
- }
- });
- b.CRS.EPSG900913 =
- b.extend({}, b.CRS.EPSG3857, {
- code: "EPSG:900913"
- });
- b.CRS.EPSG4326 = b.extend({}, b.CRS, {
- code: "EPSG:4326",
- projection: b.Projection.LonLat,
- transformation: new b.Transformation(1 / 360, 0.5, -1 / 360, 0.5)
- });
- b.Map = b.Class.extend({
- includes: b.Mixin.Events,
- options: {
- crs: b.CRS.EPSG3857,
- fadeAnimation: b.DomUtil.TRANSITION && !b.Browser.android23,
- trackResize: !0,
- markerZoomAnimation: b.DomUtil.TRANSITION && b.Browser.any3d
- },
- initialize: function (a, c) {
- c = b.setOptions(this, c);
- this._initContainer(a);
- this._initLayout();
- this.callInitHooks();
- this._initEvents();
- c.maxBounds && this.setMaxBounds(c.maxBounds);
- c.center && c.zoom !== l && this.setView(b.latLng(c.center), c.zoom, !0);
- this._initLayers(c.layers)
- },
- setView: function (a, c) {
- this._resetView(b.latLng(a), this._limitZoom(c));
- return this
- },
- setZoom: function (a) {
- return this.setView(this.getCenter(), a)
- },
- zoomIn: function (a) {
- return this.setZoom(this._zoom + (a || 1))
- },
- zoomOut: function (a) {
- return this.setZoom(this._zoom - (a || 1))
- },
- fitBounds: function (a) {
- var c = this.getBoundsZoom(a);
- return this.setView(b.latLngBounds(a).getCenter(),
- c)
- },
- fitWorld: function () {
- var a = new b.LatLng(-60, -170),
- c = new b.LatLng(85, 179);
- return this.fitBounds(new b.LatLngBounds(a, c))
- },
- panTo: function (a) {
- return this.setView(a, this._zoom)
- },
- panBy: function (a) {
- this.fire("movestart");
- this._rawPanBy(b.point(a));
- this.fire("move");
- return this.fire("moveend")
- },
- setMaxBounds: function (a) {
- a = b.latLngBounds(a);
- this.options.maxBounds = a;
- if (!a) return this._boundsMinZoom = null, this;
- var c = this.getBoundsZoom(a, !0);
- this._boundsMinZoom = c;
- this._loaded && (this._zoom < c ? this.setView(a.getCenter(),
- c) : this.panInsideBounds(a));
- return this
- },
- panInsideBounds: function (a) {
- var a = b.latLngBounds(a),
- c = this.getBounds(),
- e = this.project(c.getSouthWest()),
- c = this.project(c.getNorthEast()),
- d = this.project(a.getSouthWest()),
- a = this.project(a.getNorthEast()),
- f = 0,
- g = 0;
- c.y < a.y && (g = a.y - c.y);
- c.x > a.x && (f = a.x - c.x);
- e.y > d.y && (g = d.y - e.y);
- e.x < d.x && (f = d.x - e.x);
- return this.panBy(new b.Point(f, g, !0))
- },
- addLayer: function (a) {
- var c = b.stamp(a);
- if (this._layers[c]) return this;
- this._layers[c] = a;
- if (a.options && (!isNaN(a.options.maxZoom) ||
- !isNaN(a.options.minZoom))) this._zoomBoundLayers[c] = a, this._updateZoomLevels();
- this.options.zoomAnimation && b.TileLayer && a instanceof b.TileLayer && (this._tileLayersNum++, this._tileLayersToLoad++, a.on("load", this._onTileLayerLoad, this));
- this.whenReady(function () {
- a.onAdd(this);
- this.fire("layeradd", {
- layer: a
- })
- }, this);
- return this
- },
- removeLayer: function (a) {
- var c = b.stamp(a);
- if (this._layers[c]) return a.onRemove(this), delete this._layers[c], this._zoomBoundLayers[c] && (delete this._zoomBoundLayers[c], this._updateZoomLevels()),
- this.options.zoomAnimation && b.TileLayer && a instanceof b.TileLayer && (this._tileLayersNum--, this._tileLayersToLoad--, a.off("load", this._onTileLayerLoad, this)), this.fire("layerremove", {
- layer: a
- })
- },
- hasLayer: function (a) {
- return this._layers.hasOwnProperty(b.stamp(a))
- },
- invalidateSize: function (a) {
- var c = this.getSize();
- this._sizeChanged = !0;
- this.options.maxBounds && this.setMaxBounds(this.options.maxBounds);
- if (!this._loaded) return this;
- c = c._subtract(this.getSize())._divideBy(2)._round();
- !0 === a ? this.panBy(c) : (this._rawPanBy(c),
- this.fire("move"), clearTimeout(this._sizeTimer), this._sizeTimer = setTimeout(b.bind(this.fire, this, "moveend"), 200));
- return this
- },
- addHandler: function (a, c) {
- if (c) return this[a] = new c(this), this.options[a] && this[a].enable(), this
- },
- getCenter: function () {
- return this.layerPointToLatLng(this._getCenterLayerPoint())
- },
- getZoom: function () {
- return this._zoom
- },
- getBounds: function () {
- var a = this.getPixelBounds(),
- c = this.unproject(a.getBottomLeft()),
- a = this.unproject(a.getTopRight());
- return new b.LatLngBounds(c, a)
- },
- getMinZoom: function () {
- return Math.max(this.options.minZoom ||
- 0, this._layersMinZoom || 0, this._boundsMinZoom || 0)
- },
- getMaxZoom: function () {
- return Math.min(this.options.maxZoom === l ? Infinity : this.options.maxZoom, this._layersMaxZoom === l ? Infinity : this._layersMaxZoom)
- },
- getBoundsZoom: function (a, c) {
- var a = b.latLngBounds(a),
- e = this.getSize(),
- d = this.options.minZoom || 0,
- f = this.getMaxZoom(),
- g = a.getNorthEast(),
- h = a.getSouthWest(),
- j, i;
- j = !0;
- c && d--;
- do d++, j = this.project(g, d), i = this.project(h, d), j = new b.Point(Math.abs(j.x - i.x), Math.abs(i.y - j.y)), j = c ? j.x < e.x || j.y < e.y : j.x <= e.x && j.y <=
- e.y; while (j && d <= f);
- return j && c ? null : c ? d : d - 1
- },
- getSize: function () {
- if (!this._size || this._sizeChanged) this._size = new b.Point(this._container.clientWidth, this._container.clientHeight), this._sizeChanged = !1;
- return this._size.clone()
- },
- getPixelBounds: function () {
- var a = this._getTopLeftPoint();
- return new b.Bounds(a, a.add(this.getSize()))
- },
- getPixelOrigin: function () {
- return this._initialTopLeftPoint
- },
- getPanes: function () {
- return this._panes
- },
- getContainer: function () {
- return this._container
- },
- getZoomScale: function (a) {
- var c =
- this.options.crs;
- return c.scale(a) / c.scale(this._zoom)
- },
- getScaleZoom: function (a) {
- return this._zoom + Math.log(a) / Math.LN2
- },
- project: function (a, c) {
- c = c === l ? this._zoom : c;
- return this.options.crs.latLngToPoint(b.latLng(a), c)
- },
- unproject: function (a, c) {
- c = c === l ? this._zoom : c;
- return this.options.crs.pointToLatLng(b.point(a), c)
- },
- layerPointToLatLng: function (a) {
- return this.unproject(b.point(a).add(this._initialTopLeftPoint))
- },
- latLngToLayerPoint: function (a) {
- return this.project(b.latLng(a))._round()._subtract(this._initialTopLeftPoint)
- },
- containerPointToLayerPoint: function (a) {
- return b.point(a).subtract(this._getMapPanePos())
- },
- layerPointToContainerPoint: function (a) {
- return b.point(a).add(this._getMapPanePos())
- },
- containerPointToLatLng: function (a) {
- return this.layerPointToLatLng(this.containerPointToLayerPoint(b.point(a)))
- },
- latLngToContainerPoint: function (a) {
- return this.layerPointToContainerPoint(this.latLngToLayerPoint(b.latLng(a)))
- },
- mouseEventToContainerPoint: function (a) {
- return b.DomEvent.getMousePosition(a, this._container)
- },
- mouseEventToLayerPoint: function (a) {
- return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(a))
- },
- mouseEventToLatLng: function (a) {
- return this.layerPointToLatLng(this.mouseEventToLayerPoint(a))
- },
- _initContainer: function (a) {
- a = this._container = b.DomUtil.get(a);
- if (a._leaflet) throw Error("Map container is already initialized.");
- a._leaflet = !0
- },
- _initLayout: function () {
- var a = this._container;
- b.DomUtil.addClass(a, "leaflet-container");
- b.Browser.touch && b.DomUtil.addClass(a, "leaflet-touch");
- this.options.fadeAnimation && b.DomUtil.addClass(a, "leaflet-fade-anim");
- var c = b.DomUtil.getStyle(a, "position");
- if ("absolute" !==
- c && "relative" !== c && "fixed" !== c) a.style.position = "relative";
- this._initPanes();
- this._initControlPos && this._initControlPos()
- },
- _initPanes: function () {
- var a = this._panes = {};
- this._mapPane = a.mapPane = this._createPane("leaflet-map-pane", this._container);
- this._tilePane = a.tilePane = this._createPane("leaflet-tile-pane", this._mapPane);
- a.objectsPane = this._createPane("leaflet-objects-pane", this._mapPane);
- a.shadowPane = this._createPane("leaflet-shadow-pane");
- a.overlayPane = this._createPane("leaflet-overlay-pane");
- a.markerPane =
- this._createPane("leaflet-marker-pane");
- a.popupPane = this._createPane("leaflet-popup-pane");
- this.options.markerZoomAnimation || (b.DomUtil.addClass(a.markerPane, " leaflet-zoom-hide"), b.DomUtil.addClass(a.shadowPane, " leaflet-zoom-hide"), b.DomUtil.addClass(a.popupPane, " leaflet-zoom-hide"))
- },
- _createPane: function (a, c) {
- return b.DomUtil.create("div", a, c || this._panes.objectsPane)
- },
- _initLayers: function (a) {
- a = a ? b.Util.isArray(a) ? a : [a] : [];
- this._layers = {};
- this._zoomBoundLayers = {};
- this._tileLayersNum = 0;
- var c, e;
- for (c = 0, e = a.length; c < e; c++) this.addLayer(a[c])
- },
- _resetView: function (a, c, e, d) {
- var f = this._zoom !== c;
- d || (this.fire("movestart"), f && this.fire("zoomstart"));
- this._zoom = c;
- this._initialTopLeftPoint = this._getNewTopLeftPoint(a);
- e ? this._initialTopLeftPoint._add(this._getMapPanePos()) : b.DomUtil.setPosition(this._mapPane, new b.Point(0, 0));
- this._tileLayersToLoad = this._tileLayersNum;
- a = !this._loaded;
- this._loaded = !0;
- this.fire("viewreset", {
- hard: !e
- });
- this.fire("move");
- (f || d) && this.fire("zoomend");
- this.fire("moveend", {
- hard: !e
- });
- a && this.fire("load")
- },
- _rawPanBy: function (a) {
- b.DomUtil.setPosition(this._mapPane, this._getMapPanePos().subtract(a))
- },
- _updateZoomLevels: function () {
- var a, c = Infinity,
- b = -Infinity;
- for (a in this._zoomBoundLayers)
- if (this._zoomBoundLayers.hasOwnProperty(a)) {
- var d = this._zoomBoundLayers[a];
- isNaN(d.options.minZoom) || (c = Math.min(c, d.options.minZoom));
- isNaN(d.options.maxZoom) || (b = Math.max(b, d.options.maxZoom))
- }
- a === l ? this._layersMaxZoom = this._layersMinZoom = l : (this._layersMaxZoom = b, this._layersMinZoom =
- c)
- },
- _initEvents: function () {
- if (b.DomEvent) {
- b.DomEvent.on(this._container, "click", this._onMouseClick, this);
- var a = "dblclick,mousedown,mouseup,mouseenter,mouseleave,mousemove,contextmenu".split(","),
- c, e;
- for (c = 0, e = a.length; c < e; c++) b.DomEvent.on(this._container, a[c], this._fireMouseEvent, this);
- if (this.options.trackResize) b.DomEvent.on(k, "resize", this._onResize, this)
- }
- },
- _onResize: function () {
- b.Util.cancelAnimFrame(this._resizeRequest);
- this._resizeRequest = b.Util.requestAnimFrame(this.invalidateSize, this, !1,
- this._container)
- },
- _onMouseClick: function (a) {
- if (this._loaded && (!this.dragging || !this.dragging.moved())) this.fire("preclick"), this._fireMouseEvent(a)
- },
- _fireMouseEvent: function (a) {
- if (this._loaded) {
- var c = a.type,
- c = "mouseenter" === c ? "mouseover" : "mouseleave" === c ? "mouseout" : c;
- if (this.hasEventListeners(c)) {
- "contextmenu" === c && b.DomEvent.preventDefault(a);
- var e = this.mouseEventToContainerPoint(a),
- d = this.containerPointToLayerPoint(e),
- f = this.layerPointToLatLng(d);
- this.fire(c, {
- latlng: f,
- layerPoint: d,
- containerPoint: e,
- originalEvent: a
- })
- }
- }
- },
- _onTileLayerLoad: function () {
- this._tileLayersToLoad--;
- if (this._tileLayersNum && !this._tileLayersToLoad && this._tileBg) clearTimeout(this._clearTileBgTimer), this._clearTileBgTimer = setTimeout(b.bind(this._clearTileBg, this), 500)
- },
- whenReady: function (a, c) {
- if (this._loaded) a.call(c || this, this);
- else this.on("load", a, c);
- return this
- },
- _getMapPanePos: function () {
- return b.DomUtil.getPosition(this._mapPane)
- },
- _getTopLeftPoint: function () {
- if (!this._loaded) throw Error("Set map center and zoom first.");
- return this._initialTopLeftPoint.subtract(this._getMapPanePos())
- },
- _getNewTopLeftPoint: function (a, c) {
- var b = this.getSize()._divideBy(2);
- return this.project(a, c)._subtract(b)._round()
- },
- _latLngToNewLayerPoint: function (a, c, b) {
- b = this._getNewTopLeftPoint(b, c).add(this._getMapPanePos());
- return this.project(a, c)._subtract(b)
- },
- _getCenterLayerPoint: function () {
- return this.containerPointToLayerPoint(this.getSize()._divideBy(2))
- },
- _getCenterOffset: function (a) {
- return this.latLngToLayerPoint(a).subtract(this._getCenterLayerPoint())
- },
- _limitZoom: function (a) {
- var c = this.getMinZoom(),
- b = this.getMaxZoom();
- return Math.max(c, Math.min(b, a))
- }
- });
- b.map = function (a, c) {
- return new b.Map(a, c)
- };
- b.Projection.Mercator = {
- MAX_LATITUDE: 85.0840591556,
- R_MINOR: 6356752.3142,
- R_MAJOR: 6378137,
- project: function (a) {
- var c = b.LatLng.DEG_TO_RAD,
- e = this.MAX_LATITUDE,
- d = Math.max(Math.min(e, a.lat), -e),
- f = this.R_MAJOR,
- e = this.R_MINOR,
- a = a.lng * c * f,
- c = d * c,
- f = e / f,
- f = Math.sqrt(1 - f * f),
- d = f * Math.sin(c),
- d = Math.pow((1 - d) / (1 + d), 0.5 * f),
- c = Math.tan(0.5 * (0.5 * Math.PI - c)) / d,
- c = -e * Math.log(c);
- return new b.Point(a, c)
- },
- unproject: function (a) {
- for (var c = b.LatLng.RAD_TO_DEG, e = this.R_MAJOR, d = this.R_MINOR, f = a.x * c / e, e = d / e, e = Math.sqrt(1 - e * e), a = Math.exp(-a.y / d), d = Math.PI / 2 - 2 * Math.atan(a), g = 15, h = 0.1; 1.0E-7 < Math.abs(h) && 0 < --g;) h = e * Math.sin(d), h = Math.PI / 2 - 2 * Math.atan(a * Math.pow((1 - h) / (1 + h), 0.5 * e)) - d, d += h;
- return new b.LatLng(d * c, f)
- }
- };
- b.CRS.EPSG3395 = b.extend({}, b.CRS, {
- code: "EPSG:3395",
- projection: b.Projection.Mercator,
- transformation: function () {
- var a = b.Projection.Mercator;
- return new b.Transformation(0.5 /
- (Math.PI * a.R_MAJOR), 0.5, -0.5 / (Math.PI * a.R_MINOR), 0.5)
- }()
- });
- b.TileLayer = b.Class.extend({
- includes: b.Mixin.Events,
- options: {
- minZoom: 0,
- maxZoom: 18,
- tileSize: 256,
- subdomains: "abc",
- errorTileUrl: "",
- attribution: "",
- zoomOffset: 0,
- opacity: 1,
- unloadInvisibleTiles: b.Browser.mobile,
- updateWhenIdle: b.Browser.mobile
- },
- initialize: function (a, c) {
- c = b.setOptions(this, c);
- if (c.detectRetina && b.Browser.retina && 0 < c.maxZoom) c.tileSize = Math.floor(c.tileSize / 2), c.zoomOffset++, 0 < c.minZoom && c.minZoom--, this.options.maxZoom--;
- this._url =
- a;
- var e = this.options.subdomains;
- if ("string" === typeof e) this.options.subdomains = e.split("")
- },
- onAdd: function (a) {
- this._map = a;
- this._initContainer();
- this._createTileProto();
- a.on({
- viewreset: this._resetCallback,
- moveend: this._update
- }, this);
- if (!this.options.updateWhenIdle) this._limitedUpdate = b.Util.limitExecByInterval(this._update, 150, this), a.on("move", this._limitedUpdate, this);
- this._reset();
- this._update()
- },
- addTo: function (a) {
- a.addLayer(this);
- return this
- },
- onRemove: function (a) {
- this._container.parentNode.removeChild(this._container);
- a.off({
- viewreset: this._resetCallback,
- moveend: this._update
- }, this);
- this.options.updateWhenIdle || a.off("move", this._limitedUpdate, this);
- this._map = this._container = null
- },
- bringToFront: function () {
- var a = this._map._panes.tilePane;
- this._container && (a.appendChild(this._container), this._setAutoZIndex(a, Math.max));
- return this
- },
- bringToBack: function () {
- var a = this._map._panes.tilePane;
- this._container && (a.insertBefore(this._container, a.firstChild), this._setAutoZIndex(a, Math.min));
- return this
- },
- getAttribution: function () {
- return this.options.attribution
- },
- setOpacity: function (a) {
- this.options.opacity = a;
- this._map && this._updateOpacity();
- return this
- },
- setZIndex: function (a) {
- this.options.zIndex = a;
- this._updateZIndex();
- return this
- },
- setUrl: function (a, c) {
- this._url = a;
- c || this.redraw();
- return this
- },
- redraw: function () {
- if (this._map) this._map._panes.tilePane.empty = !1, this._reset(!0), this._update();
- return this
- },
- _updateZIndex: function () {
- if (this._container && this.options.zIndex !== l) this._container.style.zIndex = this.options.zIndex
- },
- _setAutoZIndex: function (a, c) {
- var b = a.children,
- d = -c(Infinity, -Infinity),
- f, g, h;
- for (g = 0, h = b.length; g < h; g++) b[g] !== this._container && (f = parseInt(b[g].style.zIndex, 10), isNaN(f) || (d = c(d, f)));
- this.options.zIndex = this._container.style.zIndex = (isFinite(d) ? d : 0) + c(1, -1)
- },
- _updateOpacity: function () {
- b.DomUtil.setOpacity(this._container, this.options.opacity);
- var a, c = this._tiles;
- if (b.Browser.webkit)
- for (a in c) c.hasOwnProperty(a) && (c[a].style.webkitTransform += " translate(0,0)")
- },
- _initContainer: function () {
- var a = this._map._panes.tilePane;
- if (!this._container || a.empty) this._container =
- b.DomUtil.create("div", "leaflet-layer"), this._updateZIndex(), a.appendChild(this._container), 1 > this.options.opacity && this._updateOpacity()
- },
- _resetCallback: function (a) {
- this._reset(a.hard)
- },
- _reset: function (a) {
- var c = this._tiles,
- b;
- for (b in c) c.hasOwnProperty(b) && this.fire("tileunload", {
- tile: c[b]
- });
- this._tiles = {};
- this._tilesToLoad = 0;
- if (this.options.reuseTiles) this._unusedTiles = [];
- if (a && this._container) this._container.innerHTML = "";
- this._initContainer()
- },
- _update: function () {
- if (this._map) {
- var a = this._map.getPixelBounds(),
- c = this._map.getZoom(),
- e = this.options.tileSize;
- c > this.options.maxZoom || c < this.options.minZoom || (c = new b.Point(Math.floor(a.min.x / e), Math.floor(a.min.y / e)), a = new b.Point(Math.floor(a.max.x / e), Math.floor(a.max.y / e)), a = new b.Bounds(c, a), this._addTilesFromCenterOut(a), (this.options.unloadInvisibleTiles || this.options.reuseTiles) && this._removeOtherTiles(a))
- }
- },
- _addTilesFromCenterOut: function (a) {
- var c = [],
- e = a.getCenter(),
- d, f, g;
- for (d = a.min.y; d <= a.max.y; d++)
- for (f = a.min.x; f <= a.max.x; f++) g = new b.Point(f, d), this._tileShouldBeLoaded(g) &&
- c.push(g);
- a = c.length;
- if (0 !== a) {
- c.sort(function (a, c) {
- return a.distanceTo(e) - c.distanceTo(e)
- });
- d = i.createDocumentFragment();
- this._tilesToLoad || this.fire("loading");
- this._tilesToLoad += a;
- for (f = 0; f < a; f++) this._addTile(c[f], d);
- this._container.appendChild(d)
- }
- },
- _tileShouldBeLoaded: function (a) {
- if (a.x + ":" + a.y in this._tiles) return !1;
- if (!this.options.continuousWorld) {
- var c = this._getWrapTileNum();
- if (this.options.noWrap && (0 > a.x || a.x >= c) || 0 > a.y || a.y >= c) return !1
- }
- return !0
- },
- _removeOtherTiles: function (a) {
- var c, b, d;
- for (d in this._tiles) this._tiles.hasOwnProperty(d) && (c = d.split(":"), b = parseInt(c[0], 10), c = parseInt(c[1], 10), (b < a.min.x || b > a.max.x || c < a.min.y || c > a.max.y) && this._removeTile(d))
- },
- _removeTile: function (a) {
- var c = this._tiles[a];
- this.fire("tileunload", {
- tile: c,
- url: c.src
- });
- this.options.reuseTiles ? (b.DomUtil.removeClass(c, "leaflet-tile-loaded"), this._unusedTiles.push(c)) : c.parentNode === this._container && this._container.removeChild(c);
- if (!b.Browser.android) c.src = b.Util.emptyImageUrl;
- delete this._tiles[a]
- },
- _addTile: function (a,
- c) {
- var e = this._getTilePos(a),
- d = this._getTile();
- b.DomUtil.setPosition(d, e, b.Browser.chrome || b.Browser.android23);
- this._tiles[a.x + ":" + a.y] = d;
- this._loadTile(d, a);
- d.parentNode !== this._container && c.appendChild(d)
- },
- _getZoomForUrl: function () {
- var a = this.options,
- c = this._map.getZoom();
- a.zoomReverse && (c = a.maxZoom - c);
- return c + a.zoomOffset
- },
- _getTilePos: function (a) {
- var c = this._map.getPixelOrigin();
- return a.multiplyBy(this.options.tileSize).subtract(c)
- },
- getTileUrl: function (a) {
- this._adjustTilePoint(a);
- return b.Util.template(this._url,
- b.extend({
- s: this._getSubdomain(a),
- z: this._getZoomForUrl(),
- x: a.x,
- y: a.y
- }, this.options))
- },
- _getWrapTileNum: function () {
- return Math.pow(2, this._getZoomForUrl())
- },
- _adjustTilePoint: function (a) {
- var c = this._getWrapTileNum();
- if (!this.options.continuousWorld && !this.options.noWrap) a.x = (a.x % c + c) % c;
- if (this.options.tms) a.y = c - a.y - 1
- },
- _getSubdomain: function (a) {
- return this.options.subdomains[(a.x + a.y) % this.options.subdomains.length]
- },
- _createTileProto: function () {
- var a = this._tileImg = b.DomUtil.create("img", "leaflet-tile");
- a.style.width = a.style.height = this.options.tileSize + "px";
- a.galleryimg = "no"
- },
- _getTile: function () {
- if (this.options.reuseTiles && 0 < this._unusedTiles.length) {
- var a = this._unusedTiles.pop();
- this._resetTile(a);
- return a
- }
- return this._createTile()
- },
- _resetTile: function () {},
- _createTile: function () {
- var a = this._tileImg.cloneNode(!1);
- a.onselectstart = a.onmousemove = b.Util.falseFn;
- return a
- },
- _loadTile: function (a, c) {
- a._layer = this;
- a.onload = this._tileOnLoad;
- a.onerror = this._tileOnError;
- a.src = this.getTileUrl(c)
- },
- _tileLoaded: function () {
- this._tilesToLoad--;
- this._tilesToLoad || this.fire("load")
- },
- _tileOnLoad: function () {
- var a = this._layer;
- this.src !== b.Util.emptyImageUrl && (b.DomUtil.addClass(this, "leaflet-tile-loaded"), a.fire("tileload", {
- tile: this,
- url: this.src
- }));
- a._tileLoaded()
- },
- _tileOnError: function () {
- var a = this._layer;
- a.fire("tileerror", {
- tile: this,
- url: this.src
- });
- var c = a.options.errorTileUrl;
- if (c) this.src = c;
- a._tileLoaded()
- }
- });
- b.tileLayer = function (a, c) {
- return new b.TileLayer(a, c)
- };
- b.TileLayer.WMS = b.TileLayer.extend({
- defaultWmsParams: {
- service: "WMS",
- request: "GetMap",
- version: "1.1.1",
- layers: "",
- styles: "",
- format: "image/jpeg",
- transparent: !1
- },
- initialize: function (a, c) {
- this._url = a;
- var e = b.extend({}, this.defaultWmsParams);
- e.width = c.detectRetina && b.Browser.retina ? e.height = 2 * this.options.tileSize : e.height = this.options.tileSize;
- for (var d in c) this.options.hasOwnProperty(d) || (e[d] = c[d]);
- this.wmsParams = e;
- b.setOptions(this, c)
- },
- onAdd: function (a) {
- this.wmsParams[1.3 <= parseFloat(this.wmsParams.version) ? "crs" : "srs"] = a.options.crs.code;
- b.TileLayer.prototype.onAdd.call(this, a)
- },
- getTileUrl: function (a,
- c) {
- this._adjustTilePoint(a);
- var e = this._map,
- d = e.options.crs,
- f = this.options.tileSize,
- g = a.multiplyBy(f),
- f = g.add(new b.Point(f, f)),
- g = d.project(e.unproject(g, c)),
- e = d.project(e.unproject(f, c)),
- e = [g.x, e.y, e.x, g.y].join(),
- d = b.Util.template(this._url, {
- s: this._getSubdomain(a)
- });
- return d + b.Util.getParamString(this.wmsParams, d) + "&bbox=" + e
- },
- setParams: function (a, c) {
- b.extend(this.wmsParams, a);
- c || this.redraw();
- return this
- }
- });
- b.tileLayer.wms = function (a, c) {
- return new b.TileLayer.WMS(a, c)
- };
- b.TileLayer.Canvas = b.TileLayer.extend({
- options: {
- async: !1
- },
- initialize: function (a) {
- b.setOptions(this, a)
- },
- redraw: function () {
- var a = this._tiles,
- c;
- for (c in a) a.hasOwnProperty(c) && this._redrawTile(a[c])
- },
- _redrawTile: function (a) {
- this.drawTile(a, a._tilePoint, this._map._zoom)
- },
- _createTileProto: function () {
- var a = this._canvasProto = b.DomUtil.create("canvas", "leaflet-tile");
- a.width = a.height = this.options.tileSize
- },
- _createTile: function () {
- var a = this._canvasProto.cloneNode(!1);
- a.onselectstart = a.onmousemove = b.Util.falseFn;
- return a
- },
- _loadTile: function (a, c) {
- a._layer = this;
- a._tilePoint =
- c;
- this._redrawTile(a);
- this.options.async || this.tileDrawn(a)
- },
- drawTile: function () {},
- tileDrawn: function (a) {
- this._tileOnLoad.call(a)
- }
- });
- b.tileLayer.canvas = function (a) {
- return new b.TileLayer.Canvas(a)
- };
- b.ImageOverlay = b.Class.extend({
- includes: b.Mixin.Events,
- options: {
- opacity: 1
- },
- initialize: function (a, c, e) {
- this._url = a;
- this._bounds = b.latLngBounds(c);
- b.setOptions(this, e)
- },
- onAdd: function (a) {
- this._map = a;
- this._image || this._initImage();
- a._panes.overlayPane.appendChild(this._image);
- a.on("viewreset", this._reset,
- this);
- if (a.options.zoomAnimation && b.Browser.any3d) a.on("zoomanim", this._animateZoom, this);
- this._reset()
- },
- onRemove: function (a) {
- a.getPanes().overlayPane.removeChild(this._image);
- a.off("viewreset", this._reset, this);
- a.options.zoomAnimation && a.off("zoomanim", this._animateZoom, this)
- },
- addTo: function (a) {
- a.addLayer(this);
- return this
- },
- setOpacity: function (a) {
- this.options.opacity = a;
- this._updateOpacity();
- return this
- },
- bringToFront: function () {
- this._image && this._map._panes.overlayPane.appendChild(this._image);
- return this
- },
- bringToBack: function () {
- var a = this._map._panes.overlayPane;
- this._image && a.insertBefore(this._image, a.firstChild);
- return this
- },
- _initImage: function () {
- this._image = b.DomUtil.create("img", "leaflet-image-layer");
- this._map.options.zoomAnimation && b.Browser.any3d ? b.DomUtil.addClass(this._image, "leaflet-zoom-animated") : b.DomUtil.addClass(this._image, "leaflet-zoom-hide");
- this._updateOpacity();
- b.extend(this._image, {
- galleryimg: "no",
- onselectstart: b.Util.falseFn,
- onmousemove: b.Util.falseFn,
- onload: b.bind(this._onImageLoad,
- this),
- src: this._url
- })
- },
- _animateZoom: function (a) {
- var c = this._map,
- e = this._image,
- d = c.getZoomScale(a.zoom),
- f = this._bounds.getNorthWest(),
- g = this._bounds.getSouthEast(),
- f = c._latLngToNewLayerPoint(f, a.zoom, a.center),
- a = c._latLngToNewLayerPoint(g, a.zoom, a.center)._subtract(f),
- a = f._add(a._multiplyBy(0.5 * (1 - 1 / d)));
- e.style[b.DomUtil.TRANSFORM] = b.DomUtil.getTranslateString(a) + " scale(" + d + ") "
- },
- _reset: function () {
- var a = this._image,
- c = this._map.latLngToLayerPoint(this._bounds.getNorthWest()),
- e = this._map.latLngToLayerPoint(this._bounds.getSouthEast())._subtract(c);
- b.DomUtil.setPosition(a, c);
- a.style.width = e.x + "px";
- a.style.height = e.y + "px"
- },
- _onImageLoad: function () {
- this.fire("load")
- },
- _updateOpacity: function () {
- b.DomUtil.setOpacity(this._image, this.options.opacity)
- }
- });
- b.imageOverlay = function (a, c, e) {
- return new b.ImageOverlay(a, c, e)
- };
- b.Icon = b.Class.extend({
- options: {
- className: ""
- },
- initialize: function (a) {
- b.setOptions(this, a)
- },
- createIcon: function () {
- return this._createIcon("icon")
- },
- createShadow: function () {
- return this._createIcon("shadow")
- },
- _createIcon: function (a) {
- var c =
- this._getIconUrl(a);
- if (!c) {
- if ("icon" === a) throw Error("iconUrl not set in Icon options (see the docs).");
- return null
- }
- c = this._createImg(c);
- this._setIconStyles(c, a);
- return c
- },
- _setIconStyles: function (a, c) {
- var e = this.options,
- d = b.point(e[c + "Size"]),
- f;
- f = "shadow" === c ? b.point(e.shadowAnchor || e.iconAnchor) : b.point(e.iconAnchor);
- !f && d && (f = d.divideBy(2, !0));
- a.className = "leaflet-marker-" + c + " " + e.className;
- if (f) a.style.marginLeft = -f.x + "px", a.style.marginTop = -f.y + "px";
- if (d) a.style.width = d.x + "px", a.style.height =
- d.y + "px"
- },
- _createImg: function (a) {
- var c;
- b.Browser.ie6 ? (c = i.createElement("div"), c.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + a + '")') : (c = i.createElement("img"), c.src = a);
- return c
- },
- _getIconUrl: function (a) {
- return b.Browser.retina && this.options[a + "RetinaUrl"] ? this.options[a + "RetinaUrl"] : this.options[a + "Url"]
- }
- });
- b.icon = function (a) {
- return new b.Icon(a)
- };
- b.Icon.Default = b.Icon.extend({
- options: {
- iconSize: new b.Point(25, 41),
- iconAnchor: new b.Point(12, 41),
- popupAnchor: new b.Point(1, -34),
- shadowSize: new b.Point(41, 41)
- },
- _getIconUrl: function (a) {
- var c = a + "Url";
- if (this.options[c]) return this.options[c];
- b.Browser.retina && "icon" === a && (a += "@2x");
- c = b.Icon.Default.imagePath;
- if (!c) throw Error("Couldn't autodetect L.Icon.Default.imagePath, set it manually.");
- return c + "/marker-" + a + ".png"
- }
- });
- b.Icon.Default.imagePath = function () {
- var a = i.getElementsByTagName("script"),
- c = /\/?leaflet[\-\._]?([\w\-\._]*)\.js\??/,
- b, d, f, g;
- for (b = 0, d = a.length; b < d; b++)
- if (f = a[b].src, g = f.match(c)) return f.split(c)[0] + "/images"
- }();
- b.Marker = b.Class.extend({
- includes: b.Mixin.Events,
- options: {
- icon: new b.Icon.Default,
- title: "",
- clickable: !0,
- draggable: !1,
- zIndexOffset: 0,
- opacity: 1,
- riseOnHover: !1,
- riseOffset: 250
- },
- initialize: function (a, c) {
- b.setOptions(this, c);
- this._latlng = b.latLng(a)
- },
- onAdd: function (a) {
- this._map = a;
- a.on("viewreset", this.update, this);
- this._initIcon();
- this.update();
- if (a.options.zoomAnimation && a.options.markerZoomAnimation) a.on("zoomanim", this._animateZoom, this)
- },
- addTo: function (a) {
- a.addLayer(this);
- return this
- },
- onRemove: function (a) {
- this._removeIcon();
- this.fire("remove");
- a.off({
- viewreset: this.update,
- zoomanim: this._animateZoom
- }, this);
- this._map = null
- },
- getLatLng: function () {
- return this._latlng
- },
- setLatLng: function (a) {
- this._latlng = b.latLng(a);
- this.update();
- return this.fire("move", {
- latlng: this._latlng
- })
- },
- setZIndexOffset: function (a) {
- this.options.zIndexOffset = a;
- this.update();
- return this
- },
- setIcon: function (a) {
- this._map && this._removeIcon();
- this.options.icon = a;
- this._map && (this._initIcon(), this.update());
- return this
- },
- update: function () {
- this._icon && this._setPos(this._map.latLngToLayerPoint(this._latlng).round());
- return this
- },
- _initIcon: function () {
- var a = this.options,
- c = this._map,
- c = c.options.zoomAnimation && c.options.markerZoomAnimation ? "leaflet-zoom-animated" : "leaflet-zoom-hide",
- e = !1;
- if (!this._icon) {
- this._icon = a.icon.createIcon();
- if (a.title) this._icon.title = a.title;
- this._initInteraction();
- e = 1 > this.options.opacity;
- b.DomUtil.addClass(this._icon, c);
- if (a.riseOnHover) b.DomEvent.on(this._icon, "mouseover", this._bringToFront, this).on(this._icon, "mouseout", this._resetZIndex, this)
- }
- if (!this._shadow && (this._shadow = a.icon.createShadow())) b.DomUtil.addClass(this._shadow,
- c), e = 1 > this.options.opacity;
- e && this._updateOpacity();
- a = this._map._panes;
- a.markerPane.appendChild(this._icon);
- this._shadow && a.shadowPane.appendChild(this._shadow)
- },
- _removeIcon: function () {
- var a = this._map._panes;
- this.options.riseOnHover && b.DomEvent.off(this._icon, "mouseover", this._bringToFront).off(this._icon, "mouseout", this._resetZIndex);
- a.markerPane.removeChild(this._icon);
- this._shadow && a.shadowPane.removeChild(this._shadow);
- this._icon = this._shadow = null
- },
- _setPos: function (a) {
- b.DomUtil.setPosition(this._icon,
- a);
- this._shadow && b.DomUtil.setPosition(this._shadow, a);
- this._zIndex = a.y + this.options.zIndexOffset;
- this._resetZIndex()
- },
- _updateZIndex: function (a) {
- this._icon.style.zIndex = this._zIndex + a
- },
- _animateZoom: function (a) {
- this._setPos(this._map._latLngToNewLayerPoint(this._latlng, a.zoom, a.center))
- },
- _initInteraction: function () {
- if (this.options.clickable) {
- var a = this._icon,
- c = ["dblclick", "mousedown", "mouseover", "mouseout", "contextmenu"];
- b.DomUtil.addClass(a, "leaflet-clickable");
- b.DomEvent.on(a, "click", this._onMouseClick,
- this);
- for (var e = 0; e < c.length; e++) b.DomEvent.on(a, c[e], this._fireMouseEvent, this);
- if (b.Handler.MarkerDrag) this.dragging = new b.Handler.MarkerDrag(this), this.options.draggable && this.dragging.enable()
- }
- },
- _onMouseClick: function (a) {
- var c = this.dragging && this.dragging.moved();
- (this.hasEventListeners(a.type) || c) && b.DomEvent.stopPropagation(a);
- c || (!this.dragging || !this.dragging._enabled) && this._map.dragging && this._map.dragging.moved() || this.fire(a.type, {
- originalEvent: a
- })
- },
- _fireMouseEvent: function (a) {
- this.fire(a.type, {
- originalEvent: a
- });
- "contextmenu" === a.type && this.hasEventListeners(a.type) && b.DomEvent.preventDefault(a);
- "mousedown" !== a.type && b.DomEvent.stopPropagation(a)
- },
- setOpacity: function (a) {
- this.options.opacity = a;
- this._map && this._updateOpacity()
- },
- _updateOpacity: function () {
- b.DomUtil.setOpacity(this._icon, this.options.opacity);
- this._shadow && b.DomUtil.setOpacity(this._shadow, this.options.opacity)
- },
- _bringToFront: function () {
- this._updateZIndex(this.options.riseOffset)
- },
- _resetZIndex: function () {
- this._updateZIndex(0)
- }
- });
- b.marker = function (a, c) {
- return new b.Marker(a, c)
- };
- b.DivIcon = b.Icon.extend({
- options: {
- iconSize: new b.Point(12, 12),
- className: "leaflet-div-icon"
- },
- createIcon: function () {
- var a = i.createElement("div"),
- c = this.options;
- if (c.html) a.innerHTML = c.html;
- if (c.bgPos) a.style.backgroundPosition = -c.bgPos.x + "px " + -c.bgPos.y + "px";
- this._setIconStyles(a, "icon");
- return a
- },
- createShadow: function () {
- return null
- }
- });
- b.divIcon = function (a) {
- return new b.DivIcon(a)
- };
- b.Map.mergeOptions({
- closePopupOnClick: !0
- });
- b.Popup = b.Class.extend({
- includes: b.Mixin.Events,
- options: {
- minWidth: 50,
- maxWidth: 300,
- maxHeight: null,
- autoPan: !0,
- closeButton: !0,
- offset: new b.Point(0, 6),
- autoPanPadding: new b.Point(5, 5),
- className: "",
- zoomAnimation: !0
- },
- initialize: function (a, c) {
- b.setOptions(this, a);
- this._source = c;
- this._animated = b.Browser.any3d && this.options.zoomAnimation
- },
- onAdd: function (a) {
- this._map = a;
- this._container || this._initLayout();
- this._updateContent();
- var c = a.options.fadeAnimation;
- c && b.DomUtil.setOpacity(this._container, 0);
- a._panes.popupPane.appendChild(this._container);
- a.on("viewreset",
- this._updatePosition, this);
- if (this._animated) a.on("zoomanim", this._zoomAnimation, this);
- if (a.options.closePopupOnClick) a.on("preclick", this._close, this);
- this._update();
- c && b.DomUtil.setOpacity(this._container, 1)
- },
- addTo: function (a) {
- a.addLayer(this);
- return this
- },
- openOn: function (a) {
- a.openPopup(this);
- return this
- },
- onRemove: function (a) {
- a._panes.popupPane.removeChild(this._container);
- b.Util.falseFn(this._container.offsetWidth);
- a.off({
- viewreset: this._updatePosition,
- preclick: this._close,
- zoomanim: this._zoomAnimation
- },
- this);
- a.options.fadeAnimation && b.DomUtil.setOpacity(this._container, 0);
- this._map = null
- },
- setLatLng: function (a) {
- this._latlng = b.latLng(a);
- this._update();
- return this
- },
- setContent: function (a) {
- this._content = a;
- this._update();
- return this
- },
- _close: function () {
- var a = this._map;
- if (a) a._popup = null, a.removeLayer(this).fire("popupclose", {
- popup: this
- })
- },
- _initLayout: function () {
- var a = this._container = b.DomUtil.create("div", "leaflet-popup " + this.options.className + " leaflet-zoom-" + (this._animated ? "animated" : "hide")),
- c;
- if (this.options.closeButton) c =
- this._closeButton = b.DomUtil.create("a", "leaflet-popup-close-button", a), c.href = "#close", c.innerHTML = "×", b.DomEvent.on(c, "click", this._onCloseButtonClick, this);
- c = this._wrapper = b.DomUtil.create("div", "leaflet-popup-content-wrapper", a);
- b.DomEvent.disableClickPropagation(c);
- this._contentNode = b.DomUtil.create("div", "leaflet-popup-content", c);
- b.DomEvent.on(this._contentNode, "mousewheel", b.DomEvent.stopPropagation);
- this._tipContainer = b.DomUtil.create("div", "leaflet-popup-tip-container", a);
- this._tip =
- b.DomUtil.create("div", "leaflet-popup-tip", this._tipContainer)
- },
- _update: function () {
- if (this._map) this._container.style.visibility = "hidden", this._updateContent(), this._updateLayout(), this._updatePosition(), this._container.style.visibility = "", this._adjustPan()
- },
- _updateContent: function () {
- if (this._content) {
- if ("string" === typeof this._content) this._contentNode.innerHTML = this._content;
- else {
- for (; this._contentNode.hasChildNodes();) this._contentNode.removeChild(this._contentNode.firstChild);
- this._contentNode.appendChild(this._content)
- }
- this.fire("contentupdate")
- }
- },
- _updateLayout: function () {
- var a = this._contentNode,
- c = a.style;
- c.width = "";
- c.whiteSpace = "nowrap";
- var e = a.offsetWidth,
- e = Math.min(e, this.options.maxWidth),
- e = Math.max(e, this.options.minWidth);
- c.width = e + 1 + "px";
- c.whiteSpace = "";
- c.height = "";
- var e = a.offsetHeight,
- d = this.options.maxHeight;
- d && e > d ? (c.height = d + "px", b.DomUtil.addClass(a, "leaflet-popup-scrolled")) : b.DomUtil.removeClass(a, "leaflet-popup-scrolled");
- this._containerWidth = this._container.offsetWidth
- },
- _updatePosition: function () {
- if (this._map) {
- var a = this._map.latLngToLayerPoint(this._latlng),
- c = this._animated,
- e = this.options.offset;
- c && b.DomUtil.setPosition(this._container, a);
- this._containerBottom = -e.y - (c ? 0 : a.y);
- this._containerLeft = -Math.round(this._containerWidth / 2) + e.x + (c ? 0 : a.x);
- this._container.style.bottom = this._containerBottom + "px";
- this._container.style.left = this._containerLeft + "px"
- }
- },
- _zoomAnimation: function (a) {
- a = this._map._latLngToNewLayerPoint(this._latlng, a.zoom, a.center);
- b.DomUtil.setPosition(this._container, a)
- },
- _adjustPan: function () {
- if (this.options.autoPan) {
- var a = this._map,
- c = this._container.offsetHeight,
- e = this._containerWidth,
- d = new b.Point(this._containerLeft, -c - this._containerBottom);
- this._animated && d._add(b.DomUtil.getPosition(this._container));
- var d = a.layerPointToContainerPoint(d),
- f = this.options.autoPanPadding,
- g = a.getSize(),
- h = 0,
- j = 0;
- 0 > d.x && (h = d.x - f.x);
- d.x + e > g.x && (h = d.x + e - g.x + f.x);
- 0 > d.y && (j = d.y - f.y);
- d.y + c > g.y && (j = d.y + c - g.y + f.y);
- (h || j) && a.panBy(new b.Point(h, j))
- }
- },
- _onCloseButtonClick: function (a) {
- this._close();
- b.DomEvent.stop(a)
- }
- });
- b.popup = function (a, c) {
- return new b.Popup(a, c)
- };
- b.Marker.include({
- openPopup: function () {
- this._popup &&
- this._map && (this._popup.setLatLng(this._latlng), this._map.openPopup(this._popup));
- return this
- },
- closePopup: function () {
- this._popup && this._popup._close();
- return this
- },
- bindPopup: function (a, c) {
- var e = b.point(this.options.icon.options.popupAnchor) || new b.Point(0, 0),
- e = e.add(b.Popup.prototype.options.offset);
- c && c.offset && (e = e.add(c.offset));
- c = b.extend({
- offset: e
- }, c);
- if (!this._popup) this.on("click", this.openPopup, this).on("remove", this.closePopup, this).on("move", this._movePopup, this);
- this._popup = (new b.Popup(c,
- this)).setContent(a);
- return this
- },
- unbindPopup: function () {
- if (this._popup) this._popup = null, this.off("click", this.openPopup).off("remove", this.closePopup).off("move", this._movePopup);
- return this
- },
- _movePopup: function (a) {
- this._popup.setLatLng(a.latlng)
- }
- });
- b.Map.include({
- openPopup: function (a) {
- this.closePopup();
- this._popup = a;
- return this.addLayer(a).fire("popupopen", {
- popup: this._popup
- })
- },
- closePopup: function () {
- this._popup && this._popup._close();
- return this
- }
- });
- b.LayerGroup = b.Class.extend({
- initialize: function (a) {
- this._layers = {};
- var c, b;
- if (a)
- for (c = 0, b = a.length; c < b; c++) this.addLayer(a[c])
- },
- addLayer: function (a) {
- this._layers[b.stamp(a)] = a;
- this._map && this._map.addLayer(a);
- return this
- },
- removeLayer: function (a) {
- delete this._layers[b.stamp(a)];
- this._map && this._map.removeLayer(a);
- return this
- },
- clearLayers: function () {
- this.eachLayer(this.removeLayer, this);
- return this
- },
- invoke: function (a) {
- var c = Array.prototype.slice.call(arguments, 1),
- b, d;
- for (b in this._layers) this._layers.hasOwnProperty(b) && (d = this._layers[b], d[a] && d[a].apply(d, c));
- return this
- },
- onAdd: function (a) {
- this._map = a;
- this.eachLayer(a.addLayer, a)
- },
- onRemove: function (a) {
- this.eachLayer(a.removeLayer, a);
- this._map = null
- },
- addTo: function (a) {
- a.addLayer(this);
- return this
- },
- eachLayer: function (a, c) {
- for (var b in this._layers) this._layers.hasOwnProperty(b) && a.call(c, this._layers[b])
- },
- setZIndex: function (a) {
- return this.invoke("setZIndex", a)
- }
- });
- b.layerGroup = function (a) {
- return new b.LayerGroup(a)
- };
- b.FeatureGroup = b.LayerGroup.extend({
- includes: b.Mixin.Events,
- statics: {
- EVENTS: "click dblclick mouseover mouseout mousemove contextmenu"
- },
- addLayer: function (a) {
- if (this._layers[b.stamp(a)]) return this;
- a.on(b.FeatureGroup.EVENTS, this._propagateEvent, this);
- b.LayerGroup.prototype.addLayer.call(this, a);
- this._popupContent && a.bindPopup && a.bindPopup(this._popupContent, this._popupOptions);
- return this.fire("layeradd", {
- layer: a
- })
- },
- removeLayer: function (a) {
- a.off(b.FeatureGroup.EVENTS, this._propagateEvent, this);
- b.LayerGroup.prototype.removeLayer.call(this, a);
- this._popupContent && this.invoke("unbindPopup");
- return this.fire("layerremove", {
- layer: a
- })
- },
- bindPopup: function (a, c) {
- this._popupContent = a;
- this._popupOptions = c;
- return this.invoke("bindPopup", a, c)
- },
- setStyle: function (a) {
- return this.invoke("setStyle", a)
- },
- bringToFront: function () {
- return this.invoke("bringToFront")
- },
- bringToBack: function () {
- return this.invoke("bringToBack")
- },
- getBounds: function () {
- var a = new b.LatLngBounds;
- this.eachLayer(function (c) {
- a.extend(c instanceof b.Marker ? c.getLatLng() : c.getBounds())
- });
- return a
- },
- _propagateEvent: function (a) {
- a.layer = a.target;
- a.target = this;
- this.fire(a.type, a)
- }
- });
- b.featureGroup = function (a) {
- return new b.FeatureGroup(a)
- };
- b.Path = b.Class.extend({
- includes: [b.Mixin.Events],
- statics: {
- CLIP_PADDING: b.Browser.mobile ? Math.max(0, Math.min(0.5, (1280 / Math.max(k.innerWidth, k.innerHeight) - 1) / 2)) : 0.5
- },
- options: {
- stroke: !0,
- color: "#0033ff",
- dashArray: null,
- weight: 5,
- opacity: 0.5,
- fill: !1,
- fillColor: null,
- fillOpacity: 0.2,
- clickable: !0
- },
- initialize: function (a) {
- b.setOptions(this, a)
- },
- onAdd: function (a) {
- this._map = a;
- this._container || (this._initElements(), this._initEvents());
- this.projectLatlngs();
- this._updatePath();
- this._container && this._map._pathRoot.appendChild(this._container);
- this.fire("add");
- a.on({
- viewreset: this.projectLatlngs,
- moveend: this._updatePath
- }, this)
- },
- addTo: function (a) {
- a.addLayer(this);
- return this
- },
- onRemove: function (a) {
- a._pathRoot.removeChild(this._container);
- this.fire("remove");
- this._map = null;
- if (b.Browser.vml) this._fill = this._stroke = this._container = null;
- a.off({
- viewreset: this.projectLatlngs,
- moveend: this._updatePath
- }, this)
- },
- projectLatlngs: function () {},
- setStyle: function (a) {
- b.setOptions(this,
- a);
- this._container && this._updateStyle();
- return this
- },
- redraw: function () {
- this._map && (this.projectLatlngs(), this._updatePath());
- return this
- }
- });
- b.Map.include({
- _updatePathViewport: function () {
- var a = b.Path.CLIP_PADDING,
- c = this.getSize(),
- e = b.DomUtil.getPosition(this._mapPane).multiplyBy(-1)._subtract(c.multiplyBy(a)._round()),
- a = e.add(c.multiplyBy(1 + 2 * a)._round());
- this._pathViewport = new b.Bounds(e, a)
- }
- });
- b.Path.SVG_NS = "http://www.w3.org/2000/svg";
- b.Browser.svg = !(!i.createElementNS || !i.createElementNS(b.Path.SVG_NS,
- "svg").createSVGRect);
- b.Path = b.Path.extend({
- statics: {
- SVG: b.Browser.svg
- },
- bringToFront: function () {
- var a = this._map._pathRoot,
- c = this._container;
- c && a.lastChild !== c && a.appendChild(c);
- return this
- },
- bringToBack: function () {
- var a = this._map._pathRoot,
- c = this._container,
- b = a.firstChild;
- c && b !== c && a.insertBefore(c, b);
- return this
- },
- getPathString: function () {},
- _createElement: function (a) {
- return i.createElementNS(b.Path.SVG_NS, a)
- },
- _initElements: function () {
- this._map._initPathRoot();
- this._initPath();
- this._initStyle()
- },
- _initPath: function () {
- this._container =
- this._createElement("g");
- this._path = this._createElement("path");
- this._container.appendChild(this._path)
- },
- _initStyle: function () {
- this.options.stroke && (this._path.setAttribute("stroke-linejoin", "round"), this._path.setAttribute("stroke-linecap", "round"));
- this.options.fill && this._path.setAttribute("fill-rule", "evenodd");
- this._updateStyle()
- },
- _updateStyle: function () {
- this.options.stroke ? (this._path.setAttribute("stroke", this.options.color), this._path.setAttribute("stroke-opacity", this.options.opacity), this._path.setAttribute("stroke-width",
- this.options.weight), this.options.dashArray ? this._path.setAttribute("stroke-dasharray", this.options.dashArray) : this._path.removeAttribute("stroke-dasharray")) : this._path.setAttribute("stroke", "none");
- this.options.fill ? (this._path.setAttribute("fill", this.options.fillColor || this.options.color), this._path.setAttribute("fill-opacity", this.options.fillOpacity)) : this._path.setAttribute("fill", "none")
- },
- _updatePath: function () {
- var a = this.getPathString();
- a || (a = "M0 0");
- this._path.setAttribute("d", a)
- },
- _initEvents: function () {
- if (this.options.clickable) {
- (b.Browser.svg ||
- !b.Browser.vml) && this._path.setAttribute("class", "leaflet-clickable");
- b.DomEvent.on(this._container, "click", this._onMouseClick, this);
- for (var a = "dblclick,mousedown,mouseover,mouseout,mousemove,contextmenu".split(","), c = 0; c < a.length; c++) b.DomEvent.on(this._container, a[c], this._fireMouseEvent, this)
- }
- },
- _onMouseClick: function (a) {
- (!this._map.dragging || !this._map.dragging.moved()) && this._fireMouseEvent(a)
- },
- _fireMouseEvent: function (a) {
- if (this.hasEventListeners(a.type)) {
- var c = this._map,
- e = c.mouseEventToContainerPoint(a),
- d = c.containerPointToLayerPoint(e),
- c = c.layerPointToLatLng(d);
- this.fire(a.type, {
- latlng: c,
- layerPoint: d,
- containerPoint: e,
- originalEvent: a
- });
- "contextmenu" === a.type && b.DomEvent.preventDefault(a);
- "mousemove" !== a.type && b.DomEvent.stopPropagation(a)
- }
- }
- });
- b.Map.include({
- _initPathRoot: function () {
- if (!this._pathRoot) this._pathRoot = b.Path.prototype._createElement("svg"), this._panes.overlayPane.appendChild(this._pathRoot), this.options.zoomAnimation && b.Browser.any3d ? (this._pathRoot.setAttribute("class", " leaflet-zoom-animated"),
- this.on({
- zoomanim: this._animatePathZoom,
- zoomend: this._endPathZoom
- })) : this._pathRoot.setAttribute("class", " leaflet-zoom-hide"), this.on("moveend", this._updateSvgViewport), this._updateSvgViewport()
- },
- _animatePathZoom: function (a) {
- var c = this.getZoomScale(a.zoom),
- a = this._getCenterOffset(a.center)._multiplyBy(-c)._add(this._pathViewport.min);
- this._pathRoot.style[b.DomUtil.TRANSFORM] = b.DomUtil.getTranslateString(a) + " scale(" + c + ") ";
- this._pathZooming = !0
- },
- _endPathZoom: function () {
- this._pathZooming = !1
- },
- _updateSvgViewport: function () {
- if (!this._pathZooming) {
- this._updatePathViewport();
- var a = this._pathViewport,
- c = a.min,
- e = a.max,
- a = e.x - c.x,
- e = e.y - c.y,
- d = this._pathRoot,
- f = this._panes.overlayPane;
- b.Browser.mobileWebkit && f.removeChild(d);
- b.DomUtil.setPosition(d, c);
- d.setAttribute("width", a);
- d.setAttribute("height", e);
- d.setAttribute("viewBox", [c.x, c.y, a, e].join(" "));
- b.Browser.mobileWebkit && f.appendChild(d)
- }
- }
- });
- b.Path.include({
- bindPopup: function (a, c) {
- if (!this._popup || c) this._popup = new b.Popup(c, this);
- this._popup.setContent(a);
- if (!this._popupHandlersAdded) this.on("click", this._openPopup, this).on("remove",
- this.closePopup, this), this._popupHandlersAdded = !0;
- return this
- },
- unbindPopup: function () {
- if (this._popup) this._popup = null, this.off("click", this._openPopup).off("remove", this.closePopup), this._popupHandlersAdded = !1;
- return this
- },
- openPopup: function (a) {
- this._popup && (a = a || this._latlng || this._latlngs[Math.floor(this._latlngs.length / 2)], this._openPopup({
- latlng: a
- }));
- return this
- },
- closePopup: function () {
- this._popup && this._popup._close();
- return this
- },
- _openPopup: function (a) {
- this._popup.setLatLng(a.latlng);
- this._map.openPopup(this._popup)
- }
- });
- b.Browser.vml = !b.Browser.svg && function () {
- try {
- var a = i.createElement("div");
- a.innerHTML = '<v:shape adj="1"/>';
- var c = a.firstChild;
- c.style.behavior = "url(#default#VML)";
- return c && "object" === typeof c.adj
- } catch (b) {
- return !1
- }
- }();
- b.Path = b.Browser.svg || !b.Browser.vml ? b.Path : b.Path.extend({
- statics: {
- VML: !0,
- CLIP_PADDING: 0.02
- },
- _createElement: function () {
- try {
- return i.namespaces.add("lvml", "urn:schemas-microsoft-com:vml"),
- function (a) {
- return i.createElement("<lvml:" + a + ' class="lvml">')
- }
- } catch (a) {
- return function (a) {
- return i.createElement("<" +
- a + ' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')
- }
- }
- }(),
- _initPath: function () {
- var a = this._container = this._createElement("shape");
- b.DomUtil.addClass(a, "leaflet-vml-shape");
- this.options.clickable && b.DomUtil.addClass(a, "leaflet-clickable");
- a.coordsize = "1 1";
- this._path = this._createElement("path");
- a.appendChild(this._path);
- this._map._pathRoot.appendChild(a)
- },
- _initStyle: function () {
- this._updateStyle()
- },
- _updateStyle: function () {
- var a = this._stroke,
- c = this._fill,
- b = this.options,
- d = this._container;
- d.stroked =
- b.stroke;
- d.filled = b.fill;
- if (b.stroke) {
- if (!a) a = this._stroke = this._createElement("stroke"), a.endcap = "round", d.appendChild(a);
- a.weight = b.weight + "px";
- a.color = b.color;
- a.opacity = b.opacity;
- a.dashStyle = b.dashArray ? b.dashArray instanceof Array ? b.dashArray.join(" ") : b.dashArray.replace(/ *, */g, " ") : ""
- } else if (a) d.removeChild(a), this._stroke = null;
- if (b.fill) {
- if (!c) c = this._fill = this._createElement("fill"), d.appendChild(c);
- c.color = b.fillColor || b.color;
- c.opacity = b.fillOpacity
- } else if (c) d.removeChild(c), this._fill =
- null
- },
- _updatePath: function () {
- var a = this._container.style;
- a.display = "none";
- this._path.v = this.getPathString() + " ";
- a.display = ""
- }
- });
- b.Map.include(b.Browser.svg || !b.Browser.vml ? {} : {
- _initPathRoot: function () {
- if (!this._pathRoot) {
- var a = this._pathRoot = i.createElement("div");
- a.className = "leaflet-vml-container";
- this._panes.overlayPane.appendChild(a);
- this.on("moveend", this._updatePathViewport);
- this._updatePathViewport()
- }
- }
- });
- b.Browser.canvas = !!i.createElement("canvas").getContext;
- b.Path = b.Path.SVG && !k.L_PREFER_CANVAS ||
- !b.Browser.canvas ? b.Path : b.Path.extend({
- statics: {
- CANVAS: !0,
- SVG: !1
- },
- redraw: function () {
- this._map && (this.projectLatlngs(), this._requestUpdate());
- return this
- },
- setStyle: function (a) {
- b.setOptions(this, a);
- this._map && (this._updateStyle(), this._requestUpdate());
- return this
- },
- onRemove: function (a) {
- a.off("viewreset", this.projectLatlngs, this).off("moveend", this._updatePath, this);
- this.options.clickable && this._map.off("click", this._onClick, this);
- this._requestUpdate();
- this._map = null
- },
- _requestUpdate: function () {
- if (this._map &&
- !b.Path._updateRequest) b.Path._updateRequest = b.Util.requestAnimFrame(this._fireMapMoveEnd, this._map)
- },
- _fireMapMoveEnd: function () {
- b.Path._updateRequest = null;
- this.fire("moveend")
- },
- _initElements: function () {
- this._map._initPathRoot();
- this._ctx = this._map._canvasCtx
- },
- _updateStyle: function () {
- var a = this.options;
- if (a.stroke) this._ctx.lineWidth = a.weight, this._ctx.strokeStyle = a.color;
- if (a.fill) this._ctx.fillStyle = a.fillColor || a.color
- },
- _drawPath: function () {
- var a, c, e, d, f, g;
- this._ctx.beginPath();
- for (a = 0, e = this._parts.length; a <
- e; a++) {
- for (c = 0, d = this._parts[a].length; c < d; c++) f = this._parts[a][c], g = (0 === c ? "move" : "line") + "To", this._ctx[g](f.x, f.y);
- this instanceof b.Polygon && this._ctx.closePath()
- }
- },
- _checkIfEmpty: function () {
- return !this._parts.length
- },
- _updatePath: function () {
- if (!this._checkIfEmpty()) {
- var a = this._ctx,
- c = this.options;
- this._drawPath();
- a.save();
- this._updateStyle();
- if (c.fill) a.globalAlpha = c.fillOpacity, a.fill();
- if (c.stroke) a.globalAlpha = c.opacity, a.stroke();
- a.restore()
- }
- },
- _initEvents: function () {
- if (this.options.clickable) this._map.on("click",
- this._onClick, this)
- },
- _onClick: function (a) {
- this._containsPoint(a.layerPoint) && this.fire("click", {
- latlng: a.latlng,
- layerPoint: a.layerPoint,
- containerPoint: a.containerPoint,
- originalEvent: a
- })
- }
- });
- b.Map.include(b.Path.SVG && !k.L_PREFER_CANVAS || !b.Browser.canvas ? {} : {
- _initPathRoot: function () {
- var a = this._pathRoot,
- c;
- if (!a) {
- a = this._pathRoot = i.createElement("canvas");
- a.style.position = "absolute";
- c = this._canvasCtx = a.getContext("2d");
- c.lineCap = "round";
- c.lineJoin = "round";
- this._panes.overlayPane.appendChild(a);
- if (this.options.zoomAnimation) this._pathRoot.className =
- "leaflet-zoom-animated", this.on("zoomanim", this._animatePathZoom), this.on("zoomend", this._endPathZoom);
- this.on("moveend", this._updateCanvasViewport);
- this._updateCanvasViewport()
- }
- },
- _updateCanvasViewport: function () {
- if (!this._pathZooming) {
- this._updatePathViewport();
- var a = this._pathViewport,
- c = a.min,
- a = a.max.subtract(c),
- e = this._pathRoot;
- b.DomUtil.setPosition(e, c);
- e.width = a.x;
- e.height = a.y;
- e.getContext("2d").translate(-c.x, -c.y)
- }
- }
- });
- b.LineUtil = {
- simplify: function (a, c) {
- if (!c || !a.length) return a.slice();
- var b =
- c * c,
- a = this._reducePoints(a, b);
- return a = this._simplifyDP(a, b)
- },
- pointToSegmentDistance: function (a, c, b) {
- return Math.sqrt(this._sqClosestPointOnSegment(a, c, b, !0))
- },
- closestPointOnSegment: function (a, c, b) {
- return this._sqClosestPointOnSegment(a, c, b)
- },
- _simplifyDP: function (a, c) {
- var b = a.length,
- d = new(typeof Uint8Array !== l + "" ? Uint8Array : Array)(b);
- d[0] = d[b - 1] = 1;
- this._simplifyDPStep(a, d, c, 0, b - 1);
- var f, g = [];
- for (f = 0; f < b; f++) d[f] && g.push(a[f]);
- return g
- },
- _simplifyDPStep: function (a, c, b, d, f) {
- var g = 0,
- h, j, i;
- for (j = d + 1; j <=
- f - 1; j++) i = this._sqClosestPointOnSegment(a[j], a[d], a[f], !0), i > g && (h = j, g = i);
- g > b && (c[h] = 1, this._simplifyDPStep(a, c, b, d, h), this._simplifyDPStep(a, c, b, h, f))
- },
- _reducePoints: function (a, c) {
- for (var b = [a[0]], d = 1, f = 0, g = a.length; d < g; d++) this._sqDist(a[d], a[f]) > c && (b.push(a[d]), f = d);
- f < g - 1 && b.push(a[g - 1]);
- return b
- },
- clipSegment: function (a, c, b, d) {
- var d = d ? this._lastCode : this._getBitCode(a, b),
- f = this._getBitCode(c, b),
- g, h, j;
- for (this._lastCode = f;;)
- if (d | f) {
- if (d & f) return !1;
- g = d || f;
- h = this._getEdgeIntersection(a, c, g, b);
- j =
- this._getBitCode(h, b);
- g === d ? (a = h, d = j) : (c = h, f = j)
- } else return [a, c]
- },
- _getEdgeIntersection: function (a, c, e, d) {
- var f = c.x - a.x,
- c = c.y - a.y,
- g = d.min,
- d = d.max;
- if (e & 8) return new b.Point(a.x + f * (d.y - a.y) / c, d.y);
- if (e & 4) return new b.Point(a.x + f * (g.y - a.y) / c, g.y);
- if (e & 2) return new b.Point(d.x, a.y + c * (d.x - a.x) / f);
- if (e & 1) return new b.Point(g.x, a.y + c * (g.x - a.x) / f)
- },
- _getBitCode: function (a, c) {
- var b = 0;
- a.x < c.min.x ? b |= 1 : a.x > c.max.x && (b |= 2);
- a.y < c.min.y ? b |= 4 : a.y > c.max.y && (b |= 8);
- return b
- },
- _sqDist: function (a, c) {
- var b = c.x - a.x,
- d = c.y -
- a.y;
- return b * b + d * d
- },
- _sqClosestPointOnSegment: function (a, c, e, d) {
- var f = c.x,
- c = c.y,
- g = e.x - f,
- h = e.y - c,
- j = g * g + h * h;
- if (0 < j) j = ((a.x - f) * g + (a.y - c) * h) / j, 1 < j ? (f = e.x, c = e.y) : 0 < j && (f += g * j, c += h * j);
- g = a.x - f;
- h = a.y - c;
- return d ? g * g + h * h : new b.Point(f, c)
- }
- };
- b.Polyline = b.Path.extend({
- initialize: function (a, c) {
- b.Path.prototype.initialize.call(this, c);
- this._latlngs = this._convertLatLngs(a)
- },
- options: {
- smoothFactor: 1,
- noClip: !1
- },
- projectLatlngs: function () {
- this._originalPoints = [];
- for (var a = 0, c = this._latlngs.length; a < c; a++) this._originalPoints[a] =
- this._map.latLngToLayerPoint(this._latlngs[a])
- },
- getPathString: function () {
- for (var a = 0, c = this._parts.length, b = ""; a < c; a++) b += this._getPathPartStr(this._parts[a]);
- return b
- },
- getLatLngs: function () {
- return this._latlngs
- },
- setLatLngs: function (a) {
- this._latlngs = this._convertLatLngs(a);
- return this.redraw()
- },
- addLatLng: function (a) {
- this._latlngs.push(b.latLng(a));
- return this.redraw()
- },
- spliceLatLngs: function () {
- var a = [].splice.apply(this._latlngs, arguments);
- this._convertLatLngs(this._latlngs);
- this.redraw();
- return a
- },
- closestLayerPoint: function (a) {
- for (var c = Infinity, e = this._parts, d, f, g = null, h = 0, j = e.length; h < j; h++)
- for (var i = e[h], k = 1, m = i.length; k < m; k++) {
- d = i[k - 1];
- f = i[k];
- var l = b.LineUtil._sqClosestPointOnSegment(a, d, f, !0);
- l < c && (c = l, g = b.LineUtil._sqClosestPointOnSegment(a, d, f))
- }
- if (g) g.distance = Math.sqrt(c);
- return g
- },
- getBounds: function () {
- var a = new b.LatLngBounds,
- c = this.getLatLngs(),
- e, d;
- for (e = 0, d = c.length; e < d; e++) a.extend(c[e]);
- return a
- },
- _convertLatLngs: function (a) {
- var c, e;
- for (c = 0, e = a.length; c < e; c++) {
- if (b.Util.isArray(a[c]) &&
- "number" !== typeof a[c][0]) return;
- a[c] = b.latLng(a[c])
- }
- return a
- },
- _initEvents: function () {
- b.Path.prototype._initEvents.call(this)
- },
- _getPathPartStr: function (a) {
- for (var c = b.Path.VML, e = 0, d = a.length, f = "", g; e < d; e++) g = a[e], c && g._round(), f += (e ? "L" : "M") + g.x + " " + g.y;
- return f
- },
- _clipPoints: function () {
- var a = this._originalPoints,
- c = a.length,
- e, d, f;
- if (this.options.noClip) this._parts = [a];
- else {
- var g = this._parts = [],
- h = this._map._pathViewport,
- j = b.LineUtil;
- for (e = 0, d = 0; e < c - 1; e++)
- if (f = j.clipSegment(a[e], a[e + 1], h, e))
- if (g[d] =
- g[d] || [], g[d].push(f[0]), f[1] !== a[e + 1] || e === c - 2) g[d].push(f[1]), d++
- }
- },
- _simplifyPoints: function () {
- for (var a = this._parts, c = b.LineUtil, e = 0, d = a.length; e < d; e++) a[e] = c.simplify(a[e], this.options.smoothFactor)
- },
- _updatePath: function () {
- this._map && (this._clipPoints(), this._simplifyPoints(), b.Path.prototype._updatePath.call(this))
- }
- });
- b.polyline = function (a, c) {
- return new b.Polyline(a, c)
- };
- b.PolyUtil = {};
- b.PolyUtil.clipPolygon = function (a, c) {
- var e, d = [1, 4, 2, 8],
- f, g, h, j, i, k, m = b.LineUtil;
- for (f = 0, i = a.length; f < i; f++) a[f]._code =
- m._getBitCode(a[f], c);
- for (h = 0; 4 > h; h++) {
- k = d[h];
- e = [];
- for (f = 0, i = a.length, g = i - 1; f < i; g = f++)
- if (j = a[f], g = a[g], j._code & k) {
- if (!(g._code & k)) g = m._getEdgeIntersection(g, j, k, c), g._code = m._getBitCode(g, c), e.push(g)
- } else {
- if (g._code & k) g = m._getEdgeIntersection(g, j, k, c), g._code = m._getBitCode(g, c), e.push(g);
- e.push(j)
- }
- a = e
- }
- return a
- };
- b.Polygon = b.Polyline.extend({
- options: {
- fill: !0
- },
- initialize: function (a, c) {
- b.Polyline.prototype.initialize.call(this, a, c);
- if (a && b.Util.isArray(a[0]) && "number" !== typeof a[0][0]) this._latlngs =
- this._convertLatLngs(a[0]), this._holes = a.slice(1)
- },
- projectLatlngs: function () {
- b.Polyline.prototype.projectLatlngs.call(this);
- this._holePoints = [];
- if (this._holes) {
- var a, c, e, d;
- for (a = 0, e = this._holes.length; a < e; a++) {
- this._holePoints[a] = [];
- for (c = 0, d = this._holes[a].length; c < d; c++) this._holePoints[a][c] = this._map.latLngToLayerPoint(this._holes[a][c])
- }
- }
- },
- _clipPoints: function () {
- var a = [];
- this._parts = [this._originalPoints].concat(this._holePoints);
- if (!this.options.noClip) {
- for (var c = 0, e = this._parts.length; c < e; c++) {
- var d =
- b.PolyUtil.clipPolygon(this._parts[c], this._map._pathViewport);
- d.length && a.push(d)
- }
- this._parts = a
- }
- },
- _getPathPartStr: function (a) {
- return b.Polyline.prototype._getPathPartStr.call(this, a) + (b.Browser.svg ? "z" : "x")
- }
- });
- b.polygon = function (a, c) {
- return new b.Polygon(a, c)
- };
- (function () {
- function a(a) {
- return b.FeatureGroup.extend({
- initialize: function (a, c) {
- this._layers = {};
- this._options = c;
- this.setLatLngs(a)
- },
- setLatLngs: function (b) {
- var d = 0,
- f = b.length;
- for (this.eachLayer(function (a) {
- d < f ? a.setLatLngs(b[d++]) : this.removeLayer(a)
- },
- this); d < f;) this.addLayer(new a(b[d++], this._options));
- return this
- }
- })
- }
- b.MultiPolyline = a(b.Polyline);
- b.MultiPolygon = a(b.Polygon);
- b.multiPolyline = function (a, e) {
- return new b.MultiPolyline(a, e)
- };
- b.multiPolygon = function (a, e) {
- return new b.MultiPolygon(a, e)
- }
- })();
- b.Rectangle = b.Polygon.extend({
- initialize: function (a, c) {
- b.Polygon.prototype.initialize.call(this, this._boundsToLatLngs(a), c)
- },
- setBounds: function (a) {
- this.setLatLngs(this._boundsToLatLngs(a))
- },
- _boundsToLatLngs: function (a) {
- a = b.latLngBounds(a);
- return [a.getSouthWest(),
- a.getNorthWest(), a.getNorthEast(), a.getSouthEast()
- ]
- }
- });
- b.rectangle = function (a, c) {
- return new b.Rectangle(a, c)
- };
- b.Circle = b.Path.extend({
- initialize: function (a, c, e) {
- b.Path.prototype.initialize.call(this, e);
- this._latlng = b.latLng(a);
- this._mRadius = c
- },
- options: {
- fill: !0
- },
- setLatLng: function (a) {
- this._latlng = b.latLng(a);
- return this.redraw()
- },
- setRadius: function (a) {
- this._mRadius = a;
- return this.redraw()
- },
- projectLatlngs: function () {
- var a = this._getLngRadius(),
- a = this._map.latLngToLayerPoint(new b.LatLng(this._latlng.lat,
- this._latlng.lng - a));
- this._point = this._map.latLngToLayerPoint(this._latlng);
- this._radius = Math.max(Math.round(this._point.x - a.x), 1)
- },
- getBounds: function () {
- var a = this._getLngRadius(),
- c = 360 * (this._mRadius / 40075017),
- e = this._latlng,
- d = new b.LatLng(e.lat - c, e.lng - a),
- a = new b.LatLng(e.lat + c, e.lng + a);
- return new b.LatLngBounds(d, a)
- },
- getLatLng: function () {
- return this._latlng
- },
- getPathString: function () {
- var a = this._point,
- c = this._radius;
- if (this._checkIfEmpty()) return "";
- if (b.Browser.svg) return "M" + a.x + "," + (a.y - c) + "A" +
- c + "," + c + ",0,1,1," + (a.x - 0.1) + "," + (a.y - c) + " z";
- a._round();
- c = Math.round(c);
- return "AL " + a.x + "," + a.y + " " + c + "," + c + " 0,23592600"
- },
- getRadius: function () {
- return this._mRadius
- },
- _getLatRadius: function () {
- return 360 * (this._mRadius / 40075017)
- },
- _getLngRadius: function () {
- return this._getLatRadius() / Math.cos(b.LatLng.DEG_TO_RAD * this._latlng.lat)
- },
- _checkIfEmpty: function () {
- if (!this._map) return !1;
- var a = this._map._pathViewport,
- c = this._radius,
- b = this._point;
- return b.x - c > a.max.x || b.y - c > a.max.y || b.x + c < a.min.x || b.y + c < a.min.y
- }
- });
- b.circle = function (a, c, e) {
- return new b.Circle(a, c, e)
- };
- b.CircleMarker = b.Circle.extend({
- options: {
- radius: 10,
- weight: 2
- },
- initialize: function (a, c) {
- b.Circle.prototype.initialize.call(this, a, null, c);
- this._radius = this.options.radius
- },
- projectLatlngs: function () {
- this._point = this._map.latLngToLayerPoint(this._latlng)
- },
- _updateStyle: function () {
- b.Circle.prototype._updateStyle.call(this);
- this.setRadius(this.options.radius)
- },
- setRadius: function (a) {
- this.options.radius = this._radius = a;
- return this.redraw()
- }
- });
- b.circleMarker =
- function (a, c) {
- return new b.CircleMarker(a, c)
- };
- b.Polyline.include(!b.Path.CANVAS ? {} : {
- _containsPoint: function (a, c) {
- var e, d, f, g, h, j, i = this.options.weight / 2;
- b.Browser.touch && (i += 10);
- for (e = 0, g = this._parts.length; e < g; e++) {
- j = this._parts[e];
- for (d = 0, h = j.length, f = h - 1; d < h; f = d++)
- if (c || 0 !== d)
- if (f = b.LineUtil.pointToSegmentDistance(a, j[f], j[d]), f <= i) return !0
- }
- return !1
- }
- });
- b.Polygon.include(!b.Path.CANVAS ? {} : {
- _containsPoint: function (a) {
- var c = !1,
- e, d, f, g, h, j, i;
- if (b.Polyline.prototype._containsPoint.call(this, a, !0)) return !0;
- for (g = 0, j = this._parts.length; g < j; g++) {
- e = this._parts[g];
- for (h = 0, i = e.length, f = i - 1; h < i; f = h++) d = e[h], f = e[f], d.y > a.y !== f.y > a.y && a.x < (f.x - d.x) * (a.y - d.y) / (f.y - d.y) + d.x && (c = !c)
- }
- return c
- }
- });
- b.Circle.include(!b.Path.CANVAS ? {} : {
- _drawPath: function () {
- var a = this._point;
- this._ctx.beginPath();
- this._ctx.arc(a.x, a.y, this._radius, 0, 2 * Math.PI, !1)
- },
- _containsPoint: function (a) {
- var c = this.options.stroke ? this.options.weight / 2 : 0;
- return a.distanceTo(this._point) <= this._radius + c
- }
- });
- b.GeoJSON = b.FeatureGroup.extend({
- initialize: function (a,
- c) {
- b.setOptions(this, c);
- this._layers = {};
- a && this.addData(a)
- },
- addData: function (a) {
- var c = b.Util.isArray(a) ? a : a.features,
- e;
- if (c) {
- for (a = 0, e = c.length; a < e; a++)(c[a].geometries || c[a].geometry || c[a].features) && this.addData(c[a]);
- return this
- }
- c = this.options;
- if (!c.filter || c.filter(a)) {
- e = b.GeoJSON.geometryToLayer(a, c.pointToLayer);
- e.feature = a;
- e.defaultOptions = e.options;
- this.resetStyle(e);
- if (c.onEachFeature) c.onEachFeature(a, e);
- return this.addLayer(e)
- }
- },
- resetStyle: function (a) {
- var c = this.options.style;
- c && (b.Util.extend(a.options,
- a.defaultOptions), this._setLayerStyle(a, c))
- },
- setStyle: function (a) {
- this.eachLayer(function (c) {
- this._setLayerStyle(c, a)
- }, this)
- },
- _setLayerStyle: function (a, c) {
- "function" === typeof c && (c = c(a.feature));
- a.setStyle && a.setStyle(c)
- }
- });
- b.extend(b.GeoJSON, {
- geometryToLayer: function (a, c) {
- var e = "Feature" === a.type ? a.geometry : a,
- d = e.coordinates,
- f = [],
- g, h, j;
- switch (e.type) {
- case "Point":
- return e = this.coordsToLatLng(d), c ? c(a, e) : new b.Marker(e);
- case "MultiPoint":
- for (g = 0, h = d.length; g < h; g++) e = this.coordsToLatLng(d[g]), j = c ?
- c(a, e) : new b.Marker(e), f.push(j);
- return new b.FeatureGroup(f);
- case "LineString":
- return d = this.coordsToLatLngs(d), new b.Polyline(d);
- case "Polygon":
- return d = this.coordsToLatLngs(d, 1), new b.Polygon(d);
- case "MultiLineString":
- return d = this.coordsToLatLngs(d, 1), new b.MultiPolyline(d);
- case "MultiPolygon":
- return d = this.coordsToLatLngs(d, 2), new b.MultiPolygon(d);
- case "GeometryCollection":
- for (g = 0, h = e.geometries.length; g < h; g++) j = this.geometryToLayer({
- geometry: e.geometries[g],
- type: "Feature",
- properties: a.properties
- },
- c), f.push(j);
- return new b.FeatureGroup(f);
- default:
- throw Error("Invalid GeoJSON object.");
- }
- },
- coordsToLatLng: function (a, c) {
- var e = parseFloat(a[c ? 0 : 1]),
- d = parseFloat(a[c ? 1 : 0]);
- return new b.LatLng(e, d)
- },
- coordsToLatLngs: function (a, c, b) {
- var d, f = [],
- g, h;
- for (g = 0, h = a.length; g < h; g++) d = c ? this.coordsToLatLngs(a[g], c - 1, b) : this.coordsToLatLng(a[g], b), f.push(d);
- return f
- }
- });
- b.geoJson = function (a, c) {
- return new b.GeoJSON(a, c)
- };
- b.DomEvent = {
- addListener: function (a, c, e, d) {
- var f = b.stamp(e),
- g = "_leaflet_" + c + f,
- h, j;
- if (a[g]) return this;
- h = function (c) {
- return e.call(d || a, c || b.DomEvent._getEvent())
- };
- if (b.Browser.msTouch && 0 === c.indexOf("touch")) return this.addMsTouchListener(a, c, h, f);
- b.Browser.touch && "dblclick" === c && this.addDoubleTapListener && this.addDoubleTapListener(a, h, f);
- "addEventListener" in a ? "mousewheel" === c ? (a.addEventListener("DOMMouseScroll", h, !1), a.addEventListener(c, h, !1)) : "mouseenter" === c || "mouseleave" === c ? (j = h, h = function (c) {
- return !b.DomEvent._checkMouse(a, c) ? void 0 : j(c)
- }, a.addEventListener("mouseenter" === c ? "mouseover" : "mouseout",
- h, !1)) : a.addEventListener(c, h, !1) : "attachEvent" in a && a.attachEvent("on" + c, h);
- a[g] = h;
- return this
- },
- removeListener: function (a, c, e) {
- var e = b.stamp(e),
- d = "_leaflet_" + c + e,
- f = a[d];
- if (f) return b.Browser.msTouch && 0 === c.indexOf("touch") ? this.removeMsTouchListener(a, c, e) : b.Browser.touch && "dblclick" === c && this.removeDoubleTapListener ? this.removeDoubleTapListener(a, e) : "removeEventListener" in a ? "mousewheel" === c ? (a.removeEventListener("DOMMouseScroll", f, !1), a.removeEventListener(c, f, !1)) : "mouseenter" === c || "mouseleave" ===
- c ? a.removeEventListener("mouseenter" === c ? "mouseover" : "mouseout", f, !1) : a.removeEventListener(c, f, !1) : "detachEvent" in a && a.detachEvent("on" + c, f), a[d] = null, this
- },
- stopPropagation: function (a) {
- a.stopPropagation ? a.stopPropagation() : a.cancelBubble = !0;
- return this
- },
- disableClickPropagation: function (a) {
- for (var c = b.DomEvent.stopPropagation, e = b.Draggable.START.length - 1; 0 <= e; e--) b.DomEvent.addListener(a, b.Draggable.START[e], c);
- return b.DomEvent.addListener(a, "click", c).addListener(a, "dblclick", c)
- },
- preventDefault: function (a) {
- a.preventDefault ?
- a.preventDefault() : a.returnValue = !1;
- return this
- },
- stop: function (a) {
- return b.DomEvent.preventDefault(a).stopPropagation(a)
- },
- getMousePosition: function (a, c) {
- var e = i.body,
- d = i.documentElement,
- e = new b.Point(a.pageX ? a.pageX : a.clientX + e.scrollLeft + d.scrollLeft, a.pageY ? a.pageY : a.clientY + e.scrollTop + d.scrollTop);
- return c ? e._subtract(b.DomUtil.getViewportOffset(c)) : e
- },
- getWheelDelta: function (a) {
- var c = 0;
- a.wheelDelta && (c = a.wheelDelta / 120);
- a.detail && (c = -a.detail / 3);
- return c
- },
- _checkMouse: function (a, c) {
- var b = c.relatedTarget;
- if (!b) return !0;
- try {
- for (; b && b !== a;) b = b.parentNode
- } catch (d) {
- return !1
- }
- return b !== a
- },
- _getEvent: function () {
- var a = k.event;
- if (!a)
- for (var c = arguments.callee.caller; c && !((a = c.arguments[0]) && k.Event === a.constructor);) c = c.caller;
- return a
- }
- };
- b.DomEvent.on = b.DomEvent.addListener;
- b.DomEvent.off = b.DomEvent.removeListener;
- b.Draggable = b.Class.extend({
- includes: b.Mixin.Events,
- statics: {
- START: b.Browser.touch ? ["touchstart", "mousedown"] : ["mousedown"],
- END: {
- mousedown: "mouseup",
- touchstart: "touchend",
- MSPointerDown: "touchend"
- },
- MOVE: {
- mousedown: "mousemove",
- touchstart: "touchmove",
- MSPointerDown: "touchmove"
- },
- TAP_TOLERANCE: 15
- },
- initialize: function (a, c, e) {
- this._element = a;
- this._dragStartTarget = c || a;
- this._longPress = e && !b.Browser.msTouch
- },
- enable: function () {
- if (!this._enabled) {
- for (var a = b.Draggable.START.length - 1; 0 <= a; a--) b.DomEvent.on(this._dragStartTarget, b.Draggable.START[a], this._onDown, this);
- this._enabled = !0
- }
- },
- disable: function () {
- if (this._enabled) {
- for (var a = b.Draggable.START.length - 1; 0 <= a; a--) b.DomEvent.off(this._dragStartTarget,
- b.Draggable.START[a], this._onDown, this);
- this._moved = this._enabled = !1
- }
- },
- _onDown: function (a) {
- if (!(!b.Browser.touch && a.shiftKey || 1 !== a.which && 1 !== a.button && !a.touches))
- if (b.DomEvent.preventDefault(a), b.DomEvent.stopPropagation(a), !b.Draggable._disabled)
- if (this._simulateClick = !0, a.touches && 1 < a.touches.length) this._simulateClick = !1, clearTimeout(this._longPressTimeout);
- else {
- var c = a.touches && 1 === a.touches.length ? a.touches[0] : a,
- e = c.target;
- b.Browser.touch && "a" === e.tagName.toLowerCase() && b.DomUtil.addClass(e,
- "leaflet-active");
- this._moved = !1;
- if (!this._moving) {
- this._startPoint = new b.Point(c.clientX, c.clientY);
- this._startPos = this._newPos = b.DomUtil.getPosition(this._element);
- if (a.touches && 1 === a.touches.length && b.Browser.touch && this._longPress) this._longPressTimeout = setTimeout(b.bind(function () {
- if ((this._newPos && this._newPos.distanceTo(this._startPos) || 0) < b.Draggable.TAP_TOLERANCE) this._simulateClick = !1, this._onUp(), this._simulateEvent("contextmenu", c)
- }, this), 1E3);
- b.DomEvent.on(i, b.Draggable.MOVE[a.type],
- this._onMove, this);
- b.DomEvent.on(i, b.Draggable.END[a.type], this._onUp, this)
- }
- }
- },
- _onMove: function (a) {
- if (!(a.touches && 1 < a.touches.length)) {
- var c = a.touches && 1 === a.touches.length ? a.touches[0] : a,
- c = (new b.Point(c.clientX, c.clientY)).subtract(this._startPoint);
- if (c.x || c.y) {
- b.DomEvent.preventDefault(a);
- if (!this._moved) this.fire("dragstart"), this._moved = !0, this._startPos = b.DomUtil.getPosition(this._element).subtract(c), b.Browser.touch || (b.DomUtil.disableTextSelection(), this._setMovingCursor());
- this._newPos =
- this._startPos.add(c);
- this._moving = !0;
- b.Util.cancelAnimFrame(this._animRequest);
- this._animRequest = b.Util.requestAnimFrame(this._updatePosition, this, !0, this._dragStartTarget)
- }
- }
- },
- _updatePosition: function () {
- this.fire("predrag");
- b.DomUtil.setPosition(this._element, this._newPos);
- this.fire("drag")
- },
- _onUp: function (a) {
- var c;
- clearTimeout(this._longPressTimeout);
- if (this._simulateClick && a.changedTouches) {
- var a = a.changedTouches[0],
- e = a.target,
- d = this._newPos && this._newPos.distanceTo(this._startPos) || 0;
- "a" === e.tagName.toLowerCase() &&
- b.DomUtil.removeClass(e, "leaflet-active");
- d < b.Draggable.TAP_TOLERANCE && (c = a)
- }
- b.Browser.touch || (b.DomUtil.enableTextSelection(), this._restoreCursor());
- for (var f in b.Draggable.MOVE) b.Draggable.MOVE.hasOwnProperty(f) && (b.DomEvent.off(i, b.Draggable.MOVE[f], this._onMove), b.DomEvent.off(i, b.Draggable.END[f], this._onUp));
- this._moved && (b.Util.cancelAnimFrame(this._animRequest), this.fire("dragend"));
- this._moving = !1;
- if (c) this._moved = !1, this._simulateEvent("click", c)
- },
- _setMovingCursor: function () {
- b.DomUtil.addClass(i.body,
- "leaflet-dragging")
- },
- _restoreCursor: function () {
- b.DomUtil.removeClass(i.body, "leaflet-dragging")
- },
- _simulateEvent: function (a, c) {
- var b = i.createEvent("MouseEvents");
- b.initMouseEvent(a, !0, !0, k, 1, c.screenX, c.screenY, c.clientX, c.clientY, !1, !1, !1, !1, 0, null);
- c.target.dispatchEvent(b)
- }
- });
- b.Handler = b.Class.extend({
- initialize: function (a) {
- this._map = a
- },
- enable: function () {
- if (!this._enabled) this._enabled = !0, this.addHooks()
- },
- disable: function () {
- if (this._enabled) this._enabled = !1, this.removeHooks()
- },
- enabled: function () {
- return !!this._enabled
- }
- });
- b.Map.mergeOptions({
- dragging: !0,
- inertia: !b.Browser.android23,
- inertiaDeceleration: 3400,
- inertiaMaxSpeed: Infinity,
- inertiaThreshold: b.Browser.touch ? 32 : 18,
- easeLinearity: 0.25,
- longPress: !0,
- worldCopyJump: !1
- });
- b.Map.Drag = b.Handler.extend({
- addHooks: function () {
- if (!this._draggable) {
- var a = this._map;
- this._draggable = new b.Draggable(a._mapPane, a._container, a.options.longPress);
- this._draggable.on({
- dragstart: this._onDragStart,
- drag: this._onDrag,
- dragend: this._onDragEnd
- }, this);
- a.options.worldCopyJump && (this._draggable.on("predrag",
- this._onPreDrag, this), a.on("viewreset", this._onViewReset, this))
- }
- this._draggable.enable()
- },
- removeHooks: function () {
- this._draggable.disable()
- },
- moved: function () {
- return this._draggable && this._draggable._moved
- },
- _onDragStart: function () {
- var a = this._map;
- a._panAnim && a._panAnim.stop();
- a.fire("movestart").fire("dragstart");
- if (a.options.inertia) this._positions = [], this._times = []
- },
- _onDrag: function () {
- if (this._map.options.inertia) {
- var a = this._lastTime = +new Date;
- this._positions.push(this._lastPos = this._draggable._newPos);
- this._times.push(a);
- 200 < a - this._times[0] && (this._positions.shift(), this._times.shift())
- }
- this._map.fire("move").fire("drag")
- },
- _onViewReset: function () {
- var a = this._map.getSize()._divideBy(2);
- this._initialWorldOffset = this._map.latLngToLayerPoint(new b.LatLng(0, 0)).subtract(a).x;
- this._worldWidth = this._map.project(new b.LatLng(0, 180)).x
- },
- _onPreDrag: function () {
- var a = this._worldWidth,
- c = Math.round(a / 2),
- b = this._initialWorldOffset,
- d = this._draggable._newPos.x,
- f = (d - c + b) % a + c - b,
- a = (d + c + b) % a - c - b;
- this._draggable._newPos.x =
- Math.abs(f + b) < Math.abs(a + b) ? f : a
- },
- _onDragEnd: function () {
- var a = this._map,
- c = a.options,
- e = +new Date - this._lastTime;
- if (!c.inertia || e > c.inertiaThreshold || !this._positions[0]) a.fire("moveend");
- else {
- var d = this._lastPos.subtract(this._positions[0]),
- f = c.easeLinearity,
- d = d.multiplyBy(f / ((this._lastTime + e - this._times[0]) / 1E3)),
- g = d.distanceTo(new b.Point(0, 0)),
- e = Math.min(c.inertiaMaxSpeed, g),
- d = d.multiplyBy(e / g),
- h = e / (c.inertiaDeceleration * f),
- j = d.multiplyBy(-h / 2).round();
- b.Util.requestAnimFrame(function () {
- a.panBy(j,
- h, f)
- })
- }
- a.fire("dragend");
- c.maxBounds && b.Util.requestAnimFrame(this._panInsideMaxBounds, a, !0, a._container)
- },
- _panInsideMaxBounds: function () {
- this.panInsideBounds(this.options.maxBounds)
- }
- });
- b.Map.addInitHook("addHandler", "dragging", b.Map.Drag);
- b.Map.mergeOptions({
- doubleClickZoom: !0
- });
- b.Map.DoubleClickZoom = b.Handler.extend({
- addHooks: function () {
- this._map.on("dblclick", this._onDoubleClick)
- },
- removeHooks: function () {
- this._map.off("dblclick", this._onDoubleClick)
- },
- _onDoubleClick: function (a) {
- this.setView(a.latlng,
- this._zoom + 1)
- }
- });
- b.Map.addInitHook("addHandler", "doubleClickZoom", b.Map.DoubleClickZoom);
- b.Map.mergeOptions({
- scrollWheelZoom: !0
- });
- b.Map.ScrollWheelZoom = b.Handler.extend({
- addHooks: function () {
- b.DomEvent.on(this._map._container, "mousewheel", this._onWheelScroll, this);
- this._delta = 0
- },
- removeHooks: function () {
- b.DomEvent.off(this._map._container, "mousewheel", this._onWheelScroll)
- },
- _onWheelScroll: function (a) {
- this._delta += b.DomEvent.getWheelDelta(a);
- this._lastMousePos = this._map.mouseEventToContainerPoint(a);
- if (!this._startTime) this._startTime = +new Date;
- var c = Math.max(40 - (+new Date - this._startTime), 0);
- clearTimeout(this._timer);
- this._timer = setTimeout(b.bind(this._performZoom, this), c);
- b.DomEvent.preventDefault(a);
- b.DomEvent.stopPropagation(a)
- },
- _performZoom: function () {
- var a = this._map,
- c = this._delta,
- b = a.getZoom(),
- c = 0 < c ? Math.ceil(c) : Math.round(c),
- c = Math.max(Math.min(c, 4), -4),
- c = a._limitZoom(b + c) - b;
- this._delta = 0;
- this._startTime = null;
- c && (c = b + c, b = this._getCenterForScrollWheelZoom(c), a.setView(b, c))
- },
- _getCenterForScrollWheelZoom: function (a) {
- var c =
- this._map,
- b = c.getZoomScale(a),
- a = c.getSize()._divideBy(2),
- b = this._lastMousePos._subtract(a)._multiplyBy(1 - 1 / b),
- a = c._getTopLeftPoint()._add(a)._add(b);
- return c.unproject(a)
- }
- });
- b.Map.addInitHook("addHandler", "scrollWheelZoom", b.Map.ScrollWheelZoom);
- b.extend(b.DomEvent, {
- _touchstart: b.Browser.msTouch ? "MSPointerDown" : "touchstart",
- _touchend: b.Browser.msTouch ? "MSPointerUp" : "touchend",
- addDoubleTapListener: function (a, c, e) {
- function d(a) {
- var c;
- b.Browser.msTouch ? (n.push(a.pointerId), c = n.length) : c = a.touches.length;
- if (!(1 < c)) {
- c = Date.now();
- var e = c - (g || c);
- k = a.touches ? a.touches[0] : a;
- h = 0 < e && e <= j;
- g = c
- }
- }
- function f(a) {
- if (b.Browser.msTouch) {
- a = n.indexOf(a.pointerId);
- if (-1 === a) return;
- n.splice(a, 1)
- }
- if (h) {
- if (b.Browser.msTouch) {
- var a = {},
- e, d;
- for (d in k) e = k[d], a[d] = "function" === typeof e ? e.bind(k) : e;
- k = a
- }
- k.type = "dblclick";
- c(k);
- g = null
- }
- }
- var g, h = !1,
- j = 250,
- k, l = this._touchstart,
- m = this._touchend,
- n = [];
- a["_leaflet_" + l + e] = d;
- a["_leaflet_" + m + e] = f;
- e = b.Browser.msTouch ? i.documentElement : a;
- a.addEventListener(l, d, !1);
- e.addEventListener(m, f, !1);
- b.Browser.msTouch && e.addEventListener("MSPointerCancel", f, !1);
- return this
- },
- removeDoubleTapListener: function (a, c) {
- a.removeEventListener(this._touchstart, a["_leaflet_" + this._touchstart + c], !1);
- (b.Browser.msTouch ? i.documentElement : a).removeEventListener(this._touchend, a["_leaflet_" + this._touchend + c], !1);
- b.Browser.msTouch && i.documentElement.removeEventListener("MSPointerCancel", a["_leaflet_" + this._touchend + c], !1);
- return this
- }
- });
- b.extend(b.DomEvent, {
- _msTouches: [],
- _msDocumentListener: !1,
- addMsTouchListener: function (a,
- c, b, d) {
- switch (c) {
- case "touchstart":
- return this.addMsTouchListenerStart(a, c, b, d);
- case "touchend":
- return this.addMsTouchListenerEnd(a, c, b, d);
- case "touchmove":
- return this.addMsTouchListenerMove(a, c, b, d);
- default:
- throw "Unknown touch event type";
- }
- },
- addMsTouchListenerStart: function (a, c, b, d) {
- var f = this._msTouches,
- c = function (a) {
- for (var c = !1, d = 0; d < f.length; d++)
- if (f[d].pointerId === a.pointerId) {
- c = !0;
- break
- }
- c || f.push(a);
- a.touches = f.slice();
- a.changedTouches = [a];
- b(a)
- };
- a["_leaflet_touchstart" + d] = c;
- a.addEventListener("MSPointerDown",
- c, !1);
- if (!this._msDocumentListener) a = function (a) {
- for (var c = 0; c < f.length; c++)
- if (f[c].pointerId === a.pointerId) {
- f.splice(c, 1);
- break
- }
- }, i.documentElement.addEventListener("MSPointerUp", a, !1), i.documentElement.addEventListener("MSPointerCancel", a, !1), this._msDocumentListener = !0;
- return this
- },
- addMsTouchListenerMove: function (a, c, b, d) {
- function f(a) {
- if (!(a.pointerType === a.MSPOINTER_TYPE_MOUSE && 0 === a.buttons)) {
- for (var c = 0; c < g.length; c++)
- if (g[c].pointerId === a.pointerId) {
- g[c] = a;
- break
- }
- a.touches = g.slice();
- a.changedTouches = [a];
- b(a)
- }
- }
- var g = this._msTouches;
- a["_leaflet_touchmove" + d] = f;
- a.addEventListener("MSPointerMove", f, !1);
- return this
- },
- addMsTouchListenerEnd: function (a, c, b, d) {
- var f = this._msTouches,
- c = function (a) {
- for (var c = 0; c < f.length; c++)
- if (f[c].pointerId === a.pointerId) {
- f.splice(c, 1);
- break
- }
- a.touches = f.slice();
- a.changedTouches = [a];
- b(a)
- };
- a["_leaflet_touchend" + d] = c;
- a.addEventListener("MSPointerUp", c, !1);
- a.addEventListener("MSPointerCancel", c, !1);
- return this
- },
- removeMsTouchListener: function (a, c, b) {
- b = a["_leaflet_" + c + b];
- switch (c) {
- case "touchstart":
- a.removeEventListener("MSPointerDown",
- b, !1);
- break;
- case "touchmove":
- a.removeEventListener("MSPointerMove", b, !1);
- break;
- case "touchend":
- a.removeEventListener("MSPointerUp", b, !1), a.removeEventListener("MSPointerCancel", b, !1)
- }
- return this
- }
- });
- b.Map.mergeOptions({
- touchZoom: b.Browser.touch && !b.Browser.android23
- });
- b.Map.TouchZoom = b.Handler.extend({
- addHooks: function () {
- b.DomEvent.on(this._map._container, "touchstart", this._onTouchStart, this)
- },
- removeHooks: function () {
- b.DomEvent.off(this._map._container, "touchstart", this._onTouchStart, this)
- },
- _onTouchStart: function (a) {
- var c =
- this._map;
- if (a.touches && !(2 !== a.touches.length || c._animatingZoom || this._zooming)) {
- var e = c.mouseEventToLayerPoint(a.touches[0]),
- d = c.mouseEventToLayerPoint(a.touches[1]),
- f = c._getCenterLayerPoint();
- this._startCenter = e.add(d)._divideBy(2);
- this._startDist = e.distanceTo(d);
- this._moved = !1;
- this._zooming = !0;
- this._centerOffset = f.subtract(this._startCenter);
- c._panAnim && c._panAnim.stop();
- b.DomEvent.on(i, "touchmove", this._onTouchMove, this).on(i, "touchend", this._onTouchEnd, this);
- b.DomEvent.preventDefault(a)
- }
- },
- _onTouchMove: function (a) {
- if (a.touches &&
- 2 === a.touches.length) {
- var c = this._map,
- e = c.mouseEventToLayerPoint(a.touches[0]),
- d = c.mouseEventToLayerPoint(a.touches[1]);
- this._scale = e.distanceTo(d) / this._startDist;
- this._delta = e._add(d)._divideBy(2)._subtract(this._startCenter);
- if (1 !== this._scale) {
- if (!this._moved) b.DomUtil.addClass(c._mapPane, "leaflet-zoom-anim leaflet-touching"), c.fire("movestart").fire("zoomstart")._prepareTileBg(), this._moved = !0;
- b.Util.cancelAnimFrame(this._animRequest);
- this._animRequest = b.Util.requestAnimFrame(this._updateOnMove,
- this, !0, this._map._container);
- b.DomEvent.preventDefault(a)
- }
- }
- },
- _updateOnMove: function () {
- var a = this._map,
- c = this._getScaleOrigin(),
- c = a.layerPointToLatLng(c);
- a.fire("zoomanim", {
- center: c,
- zoom: a.getScaleZoom(this._scale)
- });
- a._tileBg.style[b.DomUtil.TRANSFORM] = b.DomUtil.getTranslateString(this._delta) + " " + b.DomUtil.getScaleString(this._scale, this._startCenter)
- },
- _onTouchEnd: function () {
- if (this._moved && this._zooming) {
- var a = this._map;
- this._zooming = !1;
- b.DomUtil.removeClass(a._mapPane, "leaflet-touching");
- b.DomEvent.off(i,
- "touchmove", this._onTouchMove).off(i, "touchend", this._onTouchEnd);
- var c = this._getScaleOrigin(),
- e = a.layerPointToLatLng(c),
- d = a.getZoom(),
- f = a.getScaleZoom(this._scale) - d,
- f = 0 < f ? Math.ceil(f) : Math.floor(f),
- d = a._limitZoom(d + f);
- a.fire("zoomanim", {
- center: e,
- zoom: d
- });
- a._runAnimation(e, d, a.getZoomScale(d) / this._scale, c, !0)
- }
- },
- _getScaleOrigin: function () {
- return this._startCenter.add(this._centerOffset.subtract(this._delta).divideBy(this._scale))
- }
- });
- b.Map.addInitHook("addHandler", "touchZoom", b.Map.TouchZoom);
- b.Map.mergeOptions({
- boxZoom: !0
- });
- b.Map.BoxZoom = b.Handler.extend({
- initialize: function (a) {
- this._map = a;
- this._container = a._container;
- this._pane = a._panes.overlayPane
- },
- addHooks: function () {
- b.DomEvent.on(this._container, "mousedown", this._onMouseDown, this)
- },
- removeHooks: function () {
- b.DomEvent.off(this._container, "mousedown", this._onMouseDown)
- },
- _onMouseDown: function (a) {
- if (!a.shiftKey || 1 !== a.which && 1 !== a.button) return !1;
- b.DomUtil.disableTextSelection();
- this._startLayerPoint = this._map.mouseEventToLayerPoint(a);
- this._box = b.DomUtil.create("div",
- "leaflet-zoom-box", this._pane);
- b.DomUtil.setPosition(this._box, this._startLayerPoint);
- this._container.style.cursor = "crosshair";
- b.DomEvent.on(i, "mousemove", this._onMouseMove, this).on(i, "mouseup", this._onMouseUp, this).preventDefault(a);
- this._map.fire("boxzoomstart")
- },
- _onMouseMove: function (a) {
- var c = this._startLayerPoint,
- e = this._box,
- d = this._map.mouseEventToLayerPoint(a),
- a = d.subtract(c),
- c = new b.Point(Math.min(d.x, c.x), Math.min(d.y, c.y));
- b.DomUtil.setPosition(e, c);
- e.style.width = Math.max(0, Math.abs(a.x) -
- 4) + "px";
- e.style.height = Math.max(0, Math.abs(a.y) - 4) + "px"
- },
- _onMouseUp: function (a) {
- this._pane.removeChild(this._box);
- this._container.style.cursor = "";
- b.DomUtil.enableTextSelection();
- b.DomEvent.off(i, "mousemove", this._onMouseMove).off(i, "mouseup", this._onMouseUp);
- var c = this._map,
- a = c.mouseEventToLayerPoint(a);
- this._startLayerPoint.equals(a) || (a = new b.LatLngBounds(c.layerPointToLatLng(this._startLayerPoint), c.layerPointToLatLng(a)), c.fitBounds(a), c.fire("boxzoomend", {
- boxZoomBounds: a
- }))
- }
- });
- b.Map.addInitHook("addHandler",
- "boxZoom", b.Map.BoxZoom);
- b.Map.mergeOptions({
- keyboard: !0,
- keyboardPanOffset: 80,
- keyboardZoomOffset: 1
- });
- b.Map.Keyboard = b.Handler.extend({
- keyCodes: {
- left: [37],
- right: [39],
- down: [40],
- up: [38],
- zoomIn: [187, 107, 61],
- zoomOut: [189, 109, 173]
- },
- initialize: function (a) {
- this._map = a;
- this._setPanOffset(a.options.keyboardPanOffset);
- this._setZoomOffset(a.options.keyboardZoomOffset)
- },
- addHooks: function () {
- var a = this._map._container;
- if (-1 === a.tabIndex) a.tabIndex = "0";
- b.DomEvent.on(a, "focus", this._onFocus, this).on(a, "blur", this._onBlur,
- this).on(a, "mousedown", this._onMouseDown, this);
- this._map.on("focus", this._addHooks, this).on("blur", this._removeHooks, this)
- },
- removeHooks: function () {
- this._removeHooks();
- var a = this._map._container;
- b.DomEvent.off(a, "focus", this._onFocus, this).off(a, "blur", this._onBlur, this).off(a, "mousedown", this._onMouseDown, this);
- this._map.off("focus", this._addHooks, this).off("blur", this._removeHooks, this)
- },
- _onMouseDown: function () {
- this._focused || this._map._container.focus()
- },
- _onFocus: function () {
- this._focused = !0;
- this._map.fire("focus")
- },
- _onBlur: function () {
- this._focused = !1;
- this._map.fire("blur")
- },
- _setPanOffset: function (a) {
- var c = this._panKeys = {},
- b = this.keyCodes,
- d, f;
- for (d = 0, f = b.left.length; d < f; d++) c[b.left[d]] = [-1 * a, 0];
- for (d = 0, f = b.right.length; d < f; d++) c[b.right[d]] = [a, 0];
- for (d = 0, f = b.down.length; d < f; d++) c[b.down[d]] = [0, a];
- for (d = 0, f = b.up.length; d < f; d++) c[b.up[d]] = [0, -1 * a]
- },
- _setZoomOffset: function (a) {
- var c = this._zoomKeys = {},
- b = this.keyCodes,
- d, f;
- for (d = 0, f = b.zoomIn.length; d < f; d++) c[b.zoomIn[d]] = a;
- for (d = 0, f = b.zoomOut.length; d < f; d++) c[b.zoomOut[d]] = -a
- },
- _addHooks: function () {
- b.DomEvent.on(i, "keydown", this._onKeyDown, this)
- },
- _removeHooks: function () {
- b.DomEvent.off(i, "keydown", this._onKeyDown, this)
- },
- _onKeyDown: function (a) {
- var c = a.keyCode,
- e = this._map;
- if (this._panKeys.hasOwnProperty(c)) e.panBy(this._panKeys[c]), e.options.maxBounds && e.panInsideBounds(e.options.maxBounds);
- else if (this._zoomKeys.hasOwnProperty(c)) e.setZoom(e.getZoom() + this._zoomKeys[c]);
- else return;
- b.DomEvent.stop(a)
- }
- });
- b.Map.addInitHook("addHandler", "keyboard", b.Map.Keyboard);
- b.Handler.MarkerDrag =
- b.Handler.extend({
- initialize: function (a) {
- this._marker = a
- },
- addHooks: function () {
- var a = this._marker._icon;
- if (!this._draggable) this._draggable = (new b.Draggable(a, a)).on("dragstart", this._onDragStart, this).on("drag", this._onDrag, this).on("dragend", this._onDragEnd, this);
- this._draggable.enable()
- },
- removeHooks: function () {
- this._draggable.disable()
- },
- moved: function () {
- return this._draggable && this._draggable._moved
- },
- _onDragStart: function () {
- this._marker.closePopup().fire("movestart").fire("dragstart")
- },
- _onDrag: function () {
- var a =
- this._marker,
- c = a._shadow,
- e = b.DomUtil.getPosition(a._icon),
- d = a._map.layerPointToLatLng(e);
- c && b.DomUtil.setPosition(c, e);
- a._latlng = d;
- a.fire("move", {
- latlng: d
- }).fire("drag")
- },
- _onDragEnd: function () {
- this._marker.fire("moveend").fire("dragend")
- }
- });
- b.Handler.PolyEdit = b.Handler.extend({
- options: {
- icon: new b.DivIcon({
- iconSize: new b.Point(8, 8),
- className: "leaflet-div-icon leaflet-editing-icon"
- })
- },
- initialize: function (a, c) {
- this._poly = a;
- b.setOptions(this, c)
- },
- addHooks: function () {
- this._poly._map && (this._markerGroup ||
- this._initMarkers(), this._poly._map.addLayer(this._markerGroup))
- },
- removeHooks: function () {
- this._poly._map && (this._poly._map.removeLayer(this._markerGroup), delete this._markerGroup, delete this._markers)
- },
- updateMarkers: function () {
- this._markerGroup.clearLayers();
- this._initMarkers()
- },
- _initMarkers: function () {
- if (!this._markerGroup) this._markerGroup = new b.LayerGroup;
- this._markers = [];
- var a = this._poly._latlngs,
- c, e, d;
- for (c = 0, e = a.length; c < e; c++) d = this._createMarker(a[c], c), d.on("click", this._onMarkerClick, this),
- this._markers.push(d);
- for (c = 0, a = e - 1; c < e; a = c++)
- if (0 !== c || b.Polygon && this._poly instanceof b.Polygon) a = this._markers[a], d = this._markers[c], this._createMiddleMarker(a, d), this._updatePrevNext(a, d)
- },
- _createMarker: function (a, c) {
- var e = new b.Marker(a, {
- draggable: !0,
- icon: this.options.icon
- });
- e._origLatLng = a;
- e._index = c;
- e.on("drag", this._onMarkerDrag, this);
- e.on("dragend", this._fireEdit, this);
- this._markerGroup.addLayer(e);
- return e
- },
- _fireEdit: function () {
- this._poly.fire("edit")
- },
- _onMarkerDrag: function (a) {
- a = a.target;
- b.extend(a._origLatLng, a._latlng);
- a._middleLeft && a._middleLeft.setLatLng(this._getMiddleLatLng(a._prev, a));
- a._middleRight && a._middleRight.setLatLng(this._getMiddleLatLng(a, a._next));
- this._poly.redraw()
- },
- _onMarkerClick: function (a) {
- if (!(3 > this._poly._latlngs.length)) {
- var a = a.target,
- c = a._index;
- this._markerGroup.removeLayer(a);
- this._markers.splice(c, 1);
- this._poly.spliceLatLngs(c, 1);
- this._updateIndexes(c, -1);
- this._updatePrevNext(a._prev, a._next);
- a._middleLeft && this._markerGroup.removeLayer(a._middleLeft);
- a._middleRight && this._markerGroup.removeLayer(a._middleRight);
- if (a._prev && a._next) this._createMiddleMarker(a._prev, a._next);
- else if (a._prev) {
- if (!a._next) a._prev._middleRight = null
- } else a._next._middleLeft = null;
- this._poly.fire("edit")
- }
- },
- _updateIndexes: function (a, c) {
- this._markerGroup.eachLayer(function (b) {
- b._index > a && (b._index += c)
- })
- },
- _createMiddleMarker: function (a, c) {
- var b = this._getMiddleLatLng(a, c),
- d = this._createMarker(b),
- f, g, h;
- d.setOpacity(0.6);
- a._middleRight = c._middleLeft = d;
- g = function () {
- var g = c._index;
- d._index = g;
- d.off("click", f).on("click", this._onMarkerClick, this);
- b.lat = d.getLatLng().lat;
- b.lng = d.getLatLng().lng;
- this._poly.spliceLatLngs(g, 0, b);
- this._markers.splice(g, 0, d);
- d.setOpacity(1);
- this._updateIndexes(g, 1);
- c._index++;
- this._updatePrevNext(a, d);
- this._updatePrevNext(d, c)
- };
- h = function () {
- d.off("dragstart", g, this);
- d.off("dragend", h, this);
- this._createMiddleMarker(a, d);
- this._createMiddleMarker(d, c)
- };
- f = function () {
- g.call(this);
- h.call(this);
- this._poly.fire("edit")
- };
- d.on("click", f, this).on("dragstart",
- g, this).on("dragend", h, this);
- this._markerGroup.addLayer(d)
- },
- _updatePrevNext: function (a, c) {
- if (a) a._next = c;
- if (c) c._prev = a
- },
- _getMiddleLatLng: function (a, c) {
- var b = this._poly._map,
- d = b.latLngToLayerPoint(a.getLatLng()),
- f = b.latLngToLayerPoint(c.getLatLng());
- return b.layerPointToLatLng(d._add(f)._divideBy(2))
- }
- });
- b.Polyline.addInitHook(function () {
- if (b.Handler.PolyEdit) this.editing = new b.Handler.PolyEdit(this), this.options.editable && this.editing.enable();
- this.on("add", function () {
- this.editing && this.editing.enabled() &&
- this.editing.addHooks()
- });
- this.on("remove", function () {
- this.editing && this.editing.enabled() && this.editing.removeHooks()
- })
- });
- b.Control = b.Class.extend({
- options: {
- position: "topright"
- },
- initialize: function (a) {
- b.setOptions(this, a)
- },
- getPosition: function () {
- return this.options.position
- },
- setPosition: function (a) {
- var c = this._map;
- c && c.removeControl(this);
- this.options.position = a;
- c && c.addControl(this);
- return this
- },
- addTo: function (a) {
- this._map = a;
- var c = this._container = this.onAdd(a),
- e = this.getPosition(),
- a = a._controlCorners[e];
- b.DomUtil.addClass(c, "leaflet-control"); - 1 !== e.indexOf("bottom") ? a.insertBefore(c, a.firstChild) : a.appendChild(c);
- return this
- },
- removeFrom: function (a) {
- var c = this.getPosition();
- a._controlCorners[c].removeChild(this._container);
- this._map = null;
- if (this.onRemove) this.onRemove(a);
- return this
- }
- });
- b.control = function (a) {
- return new b.Control(a)
- };
- b.Map.include({
- addControl: function (a) {
- a.addTo(this);
- return this
- },
- removeControl: function (a) {
- a.removeFrom(this);
- return this
- },
- _initControlPos: function () {
- function a(a, g) {
- c[a +
- g] = b.DomUtil.create("div", e + a + " " + e + g, d)
- }
- var c = this._controlCorners = {},
- e = "leaflet-",
- d = this._controlContainer = b.DomUtil.create("div", e + "control-container", this._container);
- a("top", "left");
- a("top", "right");
- a("bottom", "left");
- a("bottom", "right")
- }
- });
- b.Control.Zoom = b.Control.extend({
- options: {
- position: "topleft"
- },
- onAdd: function (a) {
- var c = b.DomUtil.create("div", "leaflet-control-zoom leaflet-bar");
- this._map = a;
- this._zoomInButton = this._createButton("+", "Zoom in", "leaflet-control-zoom-in leaflet-bar-part leaflet-bar-part-top",
- c, this._zoomIn, this);
- this._zoomOutButton = this._createButton("-", "Zoom out", "leaflet-control-zoom-out leaflet-bar-part leaflet-bar-part-bottom", c, this._zoomOut, this);
- a.on("zoomend", this._updateDisabled, this);
- return c
- },
- onRemove: function (a) {
- a.off("zoomend", this._updateDisabled, this)
- },
- _zoomIn: function (a) {
- this._map.zoomIn(a.shiftKey ? 3 : 1)
- },
- _zoomOut: function (a) {
- this._map.zoomOut(a.shiftKey ? 3 : 1)
- },
- _createButton: function (a, c, e, d, f, g) {
- e = b.DomUtil.create("a", e, d);
- e.innerHTML = a;
- e.href = "#";
- e.title = c;
- a = b.DomEvent.stopPropagation;
- b.DomEvent.on(e, "click", a).on(e, "mousedown", a).on(e, "dblclick", a).on(e, "click", b.DomEvent.preventDefault).on(e, "click", f, g);
- return e
- },
- _updateDisabled: function () {
- var a = this._map;
- b.DomUtil.removeClass(this._zoomInButton, "leaflet-control-zoom-disabled");
- b.DomUtil.removeClass(this._zoomOutButton, "leaflet-control-zoom-disabled");
- a._zoom === a.getMinZoom() && b.DomUtil.addClass(this._zoomOutButton, "leaflet-control-zoom-disabled");
- a._zoom === a.getMaxZoom() && b.DomUtil.addClass(this._zoomInButton, "leaflet-control-zoom-disabled")
- }
- });
- b.Map.mergeOptions({
- zoomControl: !0
- });
- b.Map.addInitHook(function () {
- if (this.options.zoomControl) this.zoomControl = new b.Control.Zoom, this.addControl(this.zoomControl)
- });
- b.control.zoom = function (a) {
- return new b.Control.Zoom(a)
- };
- b.Control.Attribution = b.Control.extend({
- options: {
- position: "bottomright",
- prefix: 'Powered by <a href="http://leafletjs.com">Leaflet</a>'
- },
- initialize: function (a) {
- b.setOptions(this, a);
- this._attributions = {}
- },
- onAdd: function (a) {
- this._container = b.DomUtil.create("div", "leaflet-control-attribution");
- b.DomEvent.disableClickPropagation(this._container);
- a.on("layeradd", this._onLayerAdd, this).on("layerremove", this._onLayerRemove, this);
- this._update();
- return this._container
- },
- onRemove: function (a) {
- a.off("layeradd", this._onLayerAdd).off("layerremove", this._onLayerRemove)
- },
- setPrefix: function (a) {
- this.options.prefix = a;
- this._update();
- return this
- },
- addAttribution: function (a) {
- if (a) return this._attributions[a] || (this._attributions[a] = 0), this._attributions[a]++, this._update(), this
- },
- removeAttribution: function (a) {
- if (a) return this._attributions[a]--,
- this._update(), this
- },
- _update: function () {
- if (this._map) {
- var a = [],
- c;
- for (c in this._attributions) this._attributions.hasOwnProperty(c) && this._attributions[c] && a.push(c);
- c = [];
- this.options.prefix && c.push(this.options.prefix);
- a.length && c.push(a.join(", "));
- this._container.innerHTML = c.join(" — ")
- }
- },
- _onLayerAdd: function (a) {
- a.layer.getAttribution && this.addAttribution(a.layer.getAttribution())
- },
- _onLayerRemove: function (a) {
- a.layer.getAttribution && this.removeAttribution(a.layer.getAttribution())
- }
- });
- b.Map.mergeOptions({
- attributionControl: !0
- });
- b.Map.addInitHook(function () {
- if (this.options.attributionControl) this.attributionControl = (new b.Control.Attribution).addTo(this)
- });
- b.control.attribution = function (a) {
- return new b.Control.Attribution(a)
- };
- b.Control.Scale = b.Control.extend({
- options: {
- position: "bottomleft",
- maxWidth: 100,
- metric: !0,
- imperial: !0,
- updateWhenIdle: !1
- },
- onAdd: function (a) {
- this._map = a;
- var c = b.DomUtil.create("div", "leaflet-control-scale"),
- e = this.options;
- this._addScales(e, "leaflet-control-scale", c);
- a.on(e.updateWhenIdle ? "moveend" : "move",
- this._update, this);
- a.whenReady(this._update, this);
- return c
- },
- onRemove: function (a) {
- a.off(this.options.updateWhenIdle ? "moveend" : "move", this._update, this)
- },
- _addScales: function (a, c, e) {
- if (a.metric) this._mScale = b.DomUtil.create("div", c + "-line", e);
- if (a.imperial) this._iScale = b.DomUtil.create("div", c + "-line", e)
- },
- _update: function () {
- var a = this._map.getBounds(),
- c = a.getCenter().lat,
- a = 6378137 * Math.PI * Math.cos(c * Math.PI / 180) * (a.getNorthEast().lng - a.getSouthWest().lng) / 180,
- c = this._map.getSize(),
- b = this.options,
- d = 0;
- 0 < c.x && (d = a * (b.maxWidth / c.x));
- this._updateScales(b, d)
- },
- _updateScales: function (a, c) {
- a.metric && c && this._updateMetric(c);
- a.imperial && c && this._updateImperial(c)
- },
- _updateMetric: function (a) {
- var c = this._getRoundNum(a);
- this._mScale.style.width = this._getScaleWidth(c / a) + "px";
- this._mScale.innerHTML = 1E3 > c ? c + " m" : c / 1E3 + " km"
- },
- _updateImperial: function (a) {
- var c = 3.2808399 * a,
- a = this._iScale,
- b;
- 5280 < c ? (c /= 5280, b = this._getRoundNum(c), a.style.width = this._getScaleWidth(b / c) + "px", a.innerHTML = b + " mi") : (b = this._getRoundNum(c),
- a.style.width = this._getScaleWidth(b / c) + "px", a.innerHTML = b + " ft")
- },
- _getScaleWidth: function (a) {
- return Math.round(this.options.maxWidth * a) - 10
- },
- _getRoundNum: function (a) {
- var b = Math.pow(10, (Math.floor(a) + "").length - 1),
- a = a / b;
- return b * (10 <= a ? 10 : 5 <= a ? 5 : 3 <= a ? 3 : 2 <= a ? 2 : 1)
- }
- });
- b.control.scale = function (a) {
- return new b.Control.Scale(a)
- };
- b.Control.Layers = b.Control.extend({
- options: {
- collapsed: !0,
- position: "topright",
- autoZIndex: !0
- },
- initialize: function (a, c, e) {
- b.setOptions(this, e);
- this._layers = {};
- this._lastZIndex = 0;
- this._handlingClick = !1;
- for (var d in a) a.hasOwnProperty(d) && this._addLayer(a[d], d);
- for (d in c) c.hasOwnProperty(d) && this._addLayer(c[d], d, !0)
- },
- onAdd: function (a) {
- this._initLayout();
- this._update();
- a.on("layeradd", this._onLayerChange, this).on("layerremove", this._onLayerChange, this);
- return this._container
- },
- onRemove: function (a) {
- a.off("layeradd", this._onLayerChange).off("layerremove", this._onLayerChange)
- },
- addBaseLayer: function (a, b) {
- this._addLayer(a, b);
- this._update();
- return this
- },
- addOverlay: function (a, b) {
- this._addLayer(a, b, !0);
- this._update();
- return this
- },
- removeLayer: function (a) {
- delete this._layers[b.stamp(a)];
- this._update();
- return this
- },
- _initLayout: function () {
- var a = this._container = b.DomUtil.create("div", "leaflet-control-layers");
- if (b.Browser.touch) b.DomEvent.on(a, "click", b.DomEvent.stopPropagation);
- else b.DomEvent.disableClickPropagation(a), b.DomEvent.on(a, "mousewheel", b.DomEvent.stopPropagation);
- var c = this._form = b.DomUtil.create("form", "leaflet-control-layers-list");
- if (this.options.collapsed) {
- b.DomEvent.on(a, "mouseover",
- this._expand, this).on(a, "mouseout", this._collapse, this);
- var e = this._layersLink = b.DomUtil.create("a", "leaflet-control-layers-toggle", a);
- e.href = "#";
- e.title = "Layers";
- if (b.Browser.touch) b.DomEvent.on(e, "click", b.DomEvent.stopPropagation).on(e, "click", b.DomEvent.preventDefault).on(e, "click", this._expand, this);
- else b.DomEvent.on(e, "focus", this._expand, this);
- this._map.on("movestart", this._collapse, this)
- } else this._expand();
- this._baseLayersList = b.DomUtil.create("div", "leaflet-control-layers-base", c);
- this._separator =
- b.DomUtil.create("div", "leaflet-control-layers-separator", c);
- this._overlaysList = b.DomUtil.create("div", "leaflet-control-layers-overlays", c);
- a.appendChild(c)
- },
- _addLayer: function (a, c, e) {
- this._layers[b.stamp(a)] = {
- layer: a,
- name: c,
- overlay: e
- };
- this.options.autoZIndex && a.setZIndex && (this._lastZIndex++, a.setZIndex(this._lastZIndex))
- },
- _update: function () {
- if (this._container) {
- this._baseLayersList.innerHTML = "";
- this._overlaysList.innerHTML = "";
- var a = !1,
- b = !1,
- e;
- for (e in this._layers)
- if (this._layers.hasOwnProperty(e)) {
- var d =
- this._layers[e];
- this._addItem(d);
- b = b || d.overlay;
- a = a || !d.overlay
- }
- this._separator.style.display = b && a ? "" : "none"
- }
- },
- _onLayerChange: function (a) {
- this._layers[b.stamp(a.layer)] && !this._handlingClick && this._update()
- },
- _createRadioElement: function (a, b) {
- var e = '<input type="radio" class="leaflet-control-layers-selector" name="' + a + '"';
- b && (e += ' checked="checked"');
- var e = e + "/>",
- d = i.createElement("div");
- d.innerHTML = e;
- return d.firstChild
- },
- _addItem: function (a) {
- var c = i.createElement("label"),
- e, d = this._map.hasLayer(a.layer);
- a.overlay ? (e = i.createElement("input"), e.type = "checkbox", e.className = "leaflet-control-layers-selector", e.defaultChecked = d) : e = this._createRadioElement("leaflet-base-layers", d);
- e.layerId = b.stamp(a.layer);
- b.DomEvent.on(e, "click", this._onInputClick, this);
- d = i.createElement("span");
- d.innerHTML = " " + a.name;
- c.appendChild(e);
- c.appendChild(d);
- (a.overlay ? this._overlaysList : this._baseLayersList).appendChild(c);
- return c
- },
- _onInputClick: function () {
- var a, b, e, d = this._form.getElementsByTagName("input"),
- f = d.length,
- g;
- this._handlingClick = !0;
- for (a = 0; a < f; a++)
- if (b = d[a], e = this._layers[b.layerId], b.checked && !this._map.hasLayer(e.layer)) {
- if (this._map.addLayer(e.layer), !e.overlay) g = e.layer
- } else !b.checked && this._map.hasLayer(e.layer) && this._map.removeLayer(e.layer);
- g && (this._map.setZoom(this._map.getZoom()), this._map.fire("baselayerchange", {
- layer: g
- }));
- this._handlingClick = !1
- },
- _expand: function () {
- b.DomUtil.addClass(this._container, "leaflet-control-layers-expanded")
- },
- _collapse: function () {
- this._container.className = this._container.className.replace(" leaflet-control-layers-expanded",
- "")
- }
- });
- b.control.layers = function (a, c, e) {
- return new b.Control.Layers(a, c, e)
- };
- b.PosAnimation = b.Class.extend({
- includes: b.Mixin.Events,
- run: function (a, c, e, d) {
- this.stop();
- this._el = a;
- this._inProgress = !0;
- this.fire("start");
- a.style[b.DomUtil.TRANSITION] = "all " + (e || 0.25) + "s cubic-bezier(0,0," + (d || 0.5) + ",1)";
- b.DomEvent.on(a, b.DomUtil.TRANSITION_END, this._onTransitionEnd, this);
- b.DomUtil.setPosition(a, c);
- b.Util.falseFn(a.offsetWidth);
- this._stepTimer = setInterval(b.bind(this.fire, this, "step"), 50)
- },
- stop: function () {
- this._inProgress &&
- (b.DomUtil.setPosition(this._el, this._getPos()), this._onTransitionEnd(), b.Util.falseFn(this._el.offsetWidth))
- },
- _transformRe: /(-?[\d\.]+), (-?[\d\.]+)\)/,
- _getPos: function () {
- var a, c;
- c = k.getComputedStyle(this._el);
- b.Browser.any3d ? (c = c[b.DomUtil.TRANSFORM].match(this._transformRe), a = parseFloat(c[1]), c = parseFloat(c[2])) : (a = parseFloat(c.left), c = parseFloat(c.top));
- console.log(a, c);
- return new b.Point(a, c, !0)
- },
- _onTransitionEnd: function () {
- b.DomEvent.off(this._el, b.DomUtil.TRANSITION_END, this._onTransitionEnd, this);
- if (this._inProgress) this._inProgress = !1, this._el.style[b.DomUtil.TRANSITION] = "", clearInterval(this._stepTimer), this.fire("step").fire("end")
- }
- });
- b.Map.include({
- setView: function (a, b, e) {
- var b = this._limitZoom(b),
- d = this._zoom !== b;
- if (this._loaded && !e && this._layers && (this._panAnim && this._panAnim.stop(), d ? this._zoomToIfClose && this._zoomToIfClose(a, b) : this._panByIfClose(a))) return clearTimeout(this._sizeTimer), this;
- this._resetView(a, b);
- return this
- },
- panBy: function (a, c, e) {
- a = b.point(a);
- if (!a.x && !a.y) return this;
- if (!this._panAnim) this._panAnim = new b.PosAnimation,
- this._panAnim.on({
- step: this._onPanTransitionStep,
- end: this._onPanTransitionEnd
- }, this);
- this.fire("movestart");
- b.DomUtil.addClass(this._mapPane, "leaflet-pan-anim");
- this._panAnim.run(this._mapPane, b.DomUtil.getPosition(this._mapPane).subtract(a)._round(), c || 0.25, e);
- return this
- },
- _onPanTransitionStep: function () {
- this.fire("move")
- },
- _onPanTransitionEnd: function () {
- b.DomUtil.removeClass(this._mapPane, "leaflet-pan-anim");
- this.fire("moveend")
- },
- _panByIfClose: function (a) {
- a = this._getCenterOffset(a)._floor();
- return this._offsetIsWithinView(a) ?
- (this.panBy(a), !0) : !1
- },
- _offsetIsWithinView: function (a, b) {
- var e = b || 1,
- d = this.getSize();
- return Math.abs(a.x) <= d.x * e && Math.abs(a.y) <= d.y * e
- }
- });
- b.PosAnimation = b.DomUtil.TRANSITION ? b.PosAnimation : b.PosAnimation.extend({
- run: function (a, c, e, d) {
- this.stop();
- this._el = a;
- this._inProgress = !0;
- this._duration = e || 0.25;
- this._easeOutPower = 1 / Math.max(d || 0.5, 0.2);
- this._startPos = b.DomUtil.getPosition(a);
- this._offset = c.subtract(this._startPos);
- this._startTime = +new Date;
- this.fire("start");
- this._animate()
- },
- stop: function () {
- this._inProgress &&
- (this._step(), this._complete())
- },
- _animate: function () {
- this._animId = b.Util.requestAnimFrame(this._animate, this);
- this._step()
- },
- _step: function () {
- var a = +new Date - this._startTime,
- b = 1E3 * this._duration;
- a < b ? this._runFrame(this._easeOut(a / b)) : (this._runFrame(1), this._complete())
- },
- _runFrame: function (a) {
- a = this._startPos.add(this._offset.multiplyBy(a));
- b.DomUtil.setPosition(this._el, a);
- this.fire("step")
- },
- _complete: function () {
- b.Util.cancelAnimFrame(this._animId);
- this._inProgress = !1;
- this.fire("end")
- },
- _easeOut: function (a) {
- return 1 -
- Math.pow(1 - a, this._easeOutPower)
- }
- });
- b.Map.mergeOptions({
- zoomAnimation: b.DomUtil.TRANSITION && !b.Browser.android23 && !b.Browser.mobileOpera
- });
- b.DomUtil.TRANSITION && b.Map.addInitHook(function () {
- b.DomEvent.on(this._mapPane, b.DomUtil.TRANSITION_END, this._catchTransitionEnd, this)
- });
- b.Map.include(!b.DomUtil.TRANSITION ? {} : {
- _zoomToIfClose: function (a, c) {
- if (this._animatingZoom) return !0;
- if (!this.options.zoomAnimation) return !1;
- var e = this.getZoomScale(c),
- d = this._getCenterOffset(a)._divideBy(1 - 1 / e);
- if (!this._offsetIsWithinView(d,
- 1)) return !1;
- b.DomUtil.addClass(this._mapPane, "leaflet-zoom-anim");
- this.fire("movestart").fire("zoomstart");
- this.fire("zoomanim", {
- center: a,
- zoom: c
- });
- d = this._getCenterLayerPoint().add(d);
- this._prepareTileBg();
- this._runAnimation(a, c, e, d);
- return !0
- },
- _catchTransitionEnd: function () {
- this._animatingZoom && this._onZoomTransitionEnd()
- },
- _runAnimation: function (a, c, e, d, f) {
- this._animateToCenter = a;
- this._animateToZoom = c;
- this._animatingZoom = !0;
- if (b.Draggable) b.Draggable._disabled = !0;
- a = b.DomUtil.TRANSFORM;
- c = this._tileBg;
- clearTimeout(this._clearTileBgTimer);
- b.Util.falseFn(c.offsetWidth);
- e = b.DomUtil.getScaleString(e, d);
- d = c.style[a];
- c.style[a] = f ? d + " " + e : e + " " + d
- },
- _prepareTileBg: function () {
- var a = this._tilePane,
- c = this._tileBg;
- if (c && 0.5 < this._getLoadedTilesPercentage(c) && 0.5 > this._getLoadedTilesPercentage(a)) a.style.visibility = "hidden", a.empty = !0;
- else {
- if (!c) c = this._tileBg = this._createPane("leaflet-tile-pane", this._mapPane), c.style.zIndex = 1;
- c.style[b.DomUtil.TRANSFORM] = "";
- c.style.visibility = "hidden";
- c.empty = !0;
- a.empty = !1;
- this._tilePane = this._panes.tilePane = c;
- a = this._tileBg = a;
- b.DomUtil.addClass(a, "leaflet-zoom-animated")
- }
- this._stopLoadingImages(a)
- },
- _getLoadedTilesPercentage: function (a) {
- var a = a.getElementsByTagName("img"),
- b, e, d = 0;
- for (b = 0, e = a.length; b < e; b++) a[b].complete && d++;
- return d / e
- },
- _stopLoadingImages: function (a) {
- var a = Array.prototype.slice.call(a.getElementsByTagName("img")),
- c, e, d;
- for (c = 0, e = a.length; c < e; c++)
- if (d = a[c], !d.complete) d.onload = b.Util.falseFn, d.onerror = b.Util.falseFn, d.src = b.Util.emptyImageUrl, d.parentNode.removeChild(d)
- },
- _onZoomTransitionEnd: function () {
- this._restoreTileFront();
- b.DomUtil.removeClass(this._mapPane, "leaflet-zoom-anim");
- b.Util.falseFn(this._tileBg.offsetWidth);
- this._animatingZoom = !1;
- this._resetView(this._animateToCenter, this._animateToZoom, !0, !0);
- if (b.Draggable) b.Draggable._disabled = !1
- },
- _restoreTileFront: function () {
- this._tilePane.innerHTML = "";
- this._tilePane.style.visibility = "";
- this._tilePane.style.zIndex = 2;
- this._tileBg.style.zIndex = 1
- },
- _clearTileBg: function () {
- if (!this._animatingZoom && !this.touchZoom._zooming) this._tileBg.innerHTML =
- ""
- }
- });
- b.Map.include({
- _defaultLocateOptions: {
- watch: !1,
- setView: !1,
- maxZoom: Infinity,
- timeout: 1E4,
- maximumAge: 0,
- enableHighAccuracy: !1
- },
- locate: function (a) {
- a = this._locationOptions = b.extend(this._defaultLocateOptions, a);
- if (!navigator.geolocation) return this._handleGeolocationError({
- code: 0,
- message: "Geolocation not supported."
- }), this;
- var c = b.bind(this._handleGeolocationResponse, this),
- e = b.bind(this._handleGeolocationError, this);
- a.watch ? this._locationWatchId = navigator.geolocation.watchPosition(c, e, a) : navigator.geolocation.getCurrentPosition(c,
- e, a);
- return this
- },
- stopLocate: function () {
- navigator.geolocation && navigator.geolocation.clearWatch(this._locationWatchId);
- return this
- },
- _handleGeolocationError: function (a) {
- var b = a.code,
- a = a.message || (1 === b ? "permission denied" : 2 === b ? "position unavailable" : "timeout");
- this._locationOptions.setView && !this._loaded && this.fitWorld();
- this.fire("locationerror", {
- code: b,
- message: "Geolocation error: " + a + "."
- })
- },
- _handleGeolocationResponse: function (a) {
- var c = 180 * a.coords.accuracy / 4E7,
- e = 2 * c,
- d = a.coords.latitude,
- f = a.coords.longitude,
- g = new b.LatLng(d, f),
- h = new b.LatLng(d - c, f - e),
- c = new b.LatLng(d + c, f + e),
- h = new b.LatLngBounds(h, c),
- c = this._locationOptions;
- c.setView && (c = Math.min(this.getBoundsZoom(h), c.maxZoom), this.setView(g, c));
- this.fire("locationfound", {
- latlng: g,
- bounds: h,
- accuracy: a.coords.accuracy
- })
- }
- })
- })(this, document);
- (function (b) {
- b(function () {
- var e = b.support,
- a;
- a: {
- a = document.createElement("bootstrap");
- var c = {
- WebkitTransition: "webkitTransitionEnd",
- MozTransition: "transitionend",
- OTransition: "oTransitionEnd",
- msTransition: "MSTransitionEnd",
- transition: "transitionend"
- },
- d;
- for (d in c)
- if (void 0 !== a.style[d]) {
- a = c[d];
- break a
- }
- a = void 0
- }
- e.transition = a && {
- end: a
- }
- })
- })(window.jQuery);
- (function (b) {
- var e = function (a) {
- b(a).on("click", '[data-dismiss="alert"]', this.close)
- };
- e.prototype.close = function (a) {
- function c() {
- e.trigger("closed").remove()
- }
- var d = b(this),
- f = d.attr("data-target"),
- e;
- f || (f = (f = d.attr("href")) && f.replace(/.*(?=#[^\s]*$)/, ""));
- e = b(f);
- a && a.preventDefault();
- e.length || (e = d.hasClass("alert") ? d : d.parent());
- e.trigger(a = b.Event("close"));
- a.isDefaultPrevented() || (e.removeClass("in"), b.support.transition && e.hasClass("fade") ? e.on(b.support.transition.end, c) : c())
- };
- b.fn.alert = function (a) {
- return this.each(function () {
- var c =
- b(this),
- d = c.data("alert");
- d || c.data("alert", d = new e(this));
- "string" == typeof a && d[a].call(c)
- })
- };
- b.fn.alert.Constructor = e;
- b(function () {
- b("body").on("click.alert.data-api", '[data-dismiss="alert"]', e.prototype.close)
- })
- })(window.jQuery);
- (function (b) {
- var e = function (a, c) {
- this.$element = b(a);
- this.options = b.extend({}, b.fn.button.defaults, c)
- };
- e.prototype.setState = function (a) {
- var b = this.$element,
- d = b.data(),
- f = b.is("input") ? "val" : "html",
- a = a + "Text";
- d.resetText || b.data("resetText", b[f]());
- b[f](d[a] || this.options[a]);
- setTimeout(function () {
- "loadingText" == a ? b.addClass("disabled").attr("disabled", "disabled") : b.removeClass("disabled").removeAttr("disabled")
- }, 0)
- };
- e.prototype.toggle = function () {
- var a = this.$element.parent('[data-toggle="buttons-radio"]');
- a && a.find(".active").removeClass("active");
- this.$element.toggleClass("active")
- };
- b.fn.button = function (a) {
- return this.each(function () {
- var c = b(this),
- d = c.data("button"),
- f = "object" == typeof a && a;
- d || c.data("button", d = new e(this, f));
- "toggle" == a ? d.toggle() : a && d.setState(a)
- })
- };
- b.fn.button.defaults = {
- loadingText: "loading..."
- };
- b.fn.button.Constructor = e;
- b(function () {
- b("body").on("click.button.data-api", "[data-toggle^=button]", function (a) {
- a = b(a.target);
- a.hasClass("btn") || (a = a.closest(".btn"));
- a.button("toggle")
- })
- })
- })(window.jQuery);
- (function (b) {
- var e = function (a, c) {
- this.$element = b(a);
- this.options = c;
- this.options.slide && this.slide(this.options.slide);
- "hover" == this.options.pause && this.$element.on("mouseenter", b.proxy(this.pause, this)).on("mouseleave", b.proxy(this.cycle, this))
- };
- e.prototype = {
- cycle: function (a) {
- if (!a) this.paused = !1;
- this.options.interval && !this.paused && (this.interval = setInterval(b.proxy(this.next, this), this.options.interval));
- return this
- },
- to: function (a) {
- var c = this.$element.find(".active"),
- d = c.parent().children(),
- c = d.index(c),
- f = this;
- if (!(a > d.length - 1 || 0 > a)) return this.sliding ? this.$element.one("slid", function () {
- f.to(a)
- }) : c == a ? this.pause().cycle() : this.slide(a > c ? "next" : "prev", b(d[a]))
- },
- pause: function (a) {
- if (!a) this.paused = !0;
- clearInterval(this.interval);
- this.interval = null;
- return this
- },
- next: function () {
- return this.sliding ? void 0 : this.slide("next")
- },
- prev: function () {
- return this.sliding ? void 0 : this.slide("prev")
- },
- slide: function (a, c) {
- var d = this.$element.find(".active"),
- f = c || d[a](),
- e = this.interval,
- g = "next" == a ? "left" : "right",
- i =
- "next" == a ? "first" : "last",
- k = this,
- j = b.Event("slide");
- this.sliding = !0;
- e && this.pause();
- f = f.length ? f : this.$element.find(".item")[i]();
- if (!f.hasClass("active")) {
- if (b.support.transition && this.$element.hasClass("slide")) {
- this.$element.trigger(j);
- if (j.isDefaultPrevented()) return;
- f.addClass(a);
- d.addClass(g);
- f.addClass(g);
- this.$element.one(b.support.transition.end, function () {
- f.removeClass([a, g].join(" ")).addClass("active");
- d.removeClass(["active", g].join(" "));
- k.sliding = !1;
- setTimeout(function () {
- k.$element.trigger("slid")
- },
- 0)
- })
- } else {
- this.$element.trigger(j);
- if (j.isDefaultPrevented()) return;
- d.removeClass("active");
- f.addClass("active");
- this.sliding = !1;
- this.$element.trigger("slid")
- }
- e && this.cycle();
- return this
- }
- }
- };
- b.fn.carousel = function (a) {
- return this.each(function () {
- var c = b(this),
- d = c.data("carousel"),
- f = b.extend({}, b.fn.carousel.defaults, "object" == typeof a && a);
- d || c.data("carousel", d = new e(this, f));
- if ("number" == typeof a) d.to(a);
- else if ("string" == typeof a || (a = f.slide)) d[a]();
- else f.interval && d.cycle()
- })
- };
- b.fn.carousel.defaults = {
- interval: 5E3,
- pause: "hover"
- };
- b.fn.carousel.Constructor = e;
- b(function () {
- b("body").on("click.carousel.data-api", "[data-slide]", function (a) {
- var c = b(this),
- d, f = b(c.attr("data-target") || (d = c.attr("href")) && d.replace(/.*(?=#[^\s]+$)/, "")),
- c = !f.data("modal") && b.extend({}, f.data(), c.data());
- f.carousel(c);
- a.preventDefault()
- })
- })
- })(window.jQuery);
- (function (b) {
- var e = function (a, c) {
- this.$element = b(a);
- this.options = b.extend({}, b.fn.collapse.defaults, c);
- if (this.options.parent) this.$parent = b(this.options.parent);
- this.options.toggle && this.toggle()
- };
- e.prototype = {
- constructor: e,
- dimension: function () {
- return this.$element.hasClass("width") ? "width" : "height"
- },
- show: function () {
- var a, c, d, f;
- if (!this.transitioning) {
- a = this.dimension();
- c = b.camelCase(["scroll", a].join("-"));
- if ((d = this.$parent && this.$parent.find("> .accordion-group > .in")) && d.length) {
- if ((f = d.data("collapse")) &&
- f.transitioning) return;
- d.collapse("hide");
- f || d.data("collapse", null)
- }
- this.$element[a](0);
- this.transition("addClass", b.Event("show"), "shown");
- this.$element[a](this.$element[0][c])
- }
- },
- hide: function () {
- var a;
- this.transitioning || (a = this.dimension(), this.reset(this.$element[a]()), this.transition("removeClass", b.Event("hide"), "hidden"), this.$element[a](0))
- },
- reset: function (a) {
- var b = this.dimension();
- this.$element.removeClass("collapse")[b](a || "auto");
- this.$element[null !== a ? "addClass" : "removeClass"]("collapse");
- return this
- },
- transition: function (a, c, d) {
- var f = this,
- e = function () {
- "show" == c.type && f.reset();
- f.transitioning = 0;
- f.$element.trigger(d)
- };
- this.$element.trigger(c);
- if (!c.isDefaultPrevented()) this.transitioning = 1, this.$element[a]("in"), b.support.transition && this.$element.hasClass("collapse") ? this.$element.one(b.support.transition.end, e) : e()
- },
- toggle: function () {
- this[this.$element.hasClass("in") ? "hide" : "show"]()
- }
- };
- b.fn.collapse = function (a) {
- return this.each(function () {
- var c = b(this),
- d = c.data("collapse"),
- f = "object" ==
- typeof a && a;
- d || c.data("collapse", d = new e(this, f));
- if ("string" == typeof a) d[a]()
- })
- };
- b.fn.collapse.defaults = {
- toggle: !0
- };
- b.fn.collapse.Constructor = e;
- b(function () {
- b("body").on("click.collapse.data-api", "[data-toggle=collapse]", function (a) {
- var c = b(this),
- d, a = c.attr("data-target") || a.preventDefault() || (d = c.attr("href")) && d.replace(/.*(?=#[^\s]+$)/, ""),
- c = b(a).data("collapse") ? "toggle" : c.data();
- b(a).collapse(c)
- })
- })
- })(window.jQuery);
- (function (b) {
- function e() {
- b(a).parent().removeClass("open")
- }
- var a = '[data-toggle="dropdown"]',
- c = function (a) {
- var c = b(a).on("click.dropdown.data-api", this.toggle);
- b("html").on("click.dropdown.data-api", function () {
- c.parent().removeClass("open")
- })
- };
- c.prototype = {
- constructor: c,
- toggle: function () {
- var a = b(this),
- c;
- if (!a.is(".disabled, :disabled")) return c = a.attr("data-target"), c || (c = (c = a.attr("href")) && c.replace(/.*(?=#[^\s]*$)/, "")), c = b(c), c.length || (c = a.parent()), a = c.hasClass("open"), e(), a || c.toggleClass("open"), !1
- }
- };
- b.fn.dropdown = function (a) {
- return this.each(function () {
- var f = b(this),
- e = f.data("dropdown");
- e || f.data("dropdown", e = new c(this));
- "string" == typeof a && e[a].call(f)
- })
- };
- b.fn.dropdown.Constructor = c;
- b(function () {
- b("html").on("click.dropdown.data-api", e);
- b("body").on("click.dropdown", ".dropdown form", function (a) {
- a.stopPropagation()
- }).on("click.dropdown.data-api", a, c.prototype.toggle)
- })
- })(window.jQuery);
- (function (b) {
- function e() {
- var c = this,
- d = setTimeout(function () {
- c.$element.off(b.support.transition.end);
- a.call(c)
- }, 500);
- this.$element.one(b.support.transition.end, function () {
- clearTimeout(d);
- a.call(c)
- })
- }
- function a() {
- this.$element.hide().trigger("hidden");
- c.call(this)
- }
- function c(a) {
- var c = this.$element.hasClass("fade") ? "fade" : "";
- if (this.isShown && this.options.backdrop) {
- var f = b.support.transition && c;
- this.$backdrop = b('<div class="modal-backdrop ' + c + '" />').appendTo(document.body);
- "static" != this.options.backdrop &&
- this.$backdrop.click(b.proxy(this.hide, this));
- this.$backdrop.addClass("in");
- f ? this.$backdrop.one(b.support.transition.end, a) : a()
- } else !this.isShown && this.$backdrop ? (this.$backdrop.removeClass("in"), b.support.transition && this.$element.hasClass("fade") ? this.$backdrop.one(b.support.transition.end, b.proxy(d, this)) : d.call(this)) : a && a()
- }
- function d() {
- this.$backdrop.remove();
- this.$backdrop = null
- }
- function f() {
- var a = this;
- if (this.isShown && this.options.keyboard) b(document).on("keyup.dismiss.modal", function (b) {
- 27 ==
- b.which && a.hide()
- });
- else this.isShown || b(document).off("keyup.dismiss.modal")
- }
- var h = function (a, c) {
- this.options = c;
- this.$element = b(a).delegate('[data-dismiss="modal"]', "click.dismiss.modal", b.proxy(this.hide, this))
- };
- h.prototype = {
- constructor: h,
- toggle: function () {
- return this[!this.isShown ? "show" : "hide"]()
- },
- show: function () {
- var a = this,
- d = b.Event("show");
- this.$element.trigger(d);
- if (!this.isShown && !d.isDefaultPrevented()) b("body").addClass("modal-open"), this.isShown = !0, f.call(this), c.call(this, function () {
- var c =
- b.support.transition && a.$element.hasClass("fade");
- a.$element.parent().length || a.$element.appendTo(document.body);
- a.$element.show();
- a.$element.addClass("in");
- c ? a.$element.one(b.support.transition.end, function () {
- a.$element.trigger("shown")
- }) : a.$element.trigger("shown")
- })
- },
- hide: function (c) {
- c && c.preventDefault();
- c = b.Event("hide");
- this.$element.trigger(c);
- if (this.isShown && !c.isDefaultPrevented()) this.isShown = !1, b("body").removeClass("modal-open"), f.call(this), this.$element.removeClass("in"), b.support.transition &&
- this.$element.hasClass("fade") ? e.call(this) : a.call(this)
- }
- };
- b.fn.modal = function (a) {
- return this.each(function () {
- var c = b(this),
- d = c.data("modal"),
- f = b.extend({}, b.fn.modal.defaults, c.data(), "object" == typeof a && a);
- d || c.data("modal", d = new h(this, f));
- if ("string" == typeof a) d[a]();
- else f.show && d.show()
- })
- };
- b.fn.modal.defaults = {
- backdrop: !0,
- keyboard: !0,
- show: !0
- };
- b.fn.modal.Constructor = h;
- b(function () {
- b("body").on("click.modal.data-api", '[data-toggle="modal"]', function (a) {
- var c = b(this),
- d, f = b(c.attr("data-target") ||
- (d = c.attr("href")) && d.replace(/.*(?=#[^\s]+$)/, "")),
- c = f.data("modal") ? "toggle" : b.extend({}, f.data(), c.data());
- a.preventDefault();
- f.modal(c)
- })
- })
- })(window.jQuery);
- (function (b) {
- var e = function (a, b) {
- this.init("tooltip", a, b)
- };
- e.prototype = {
- constructor: e,
- init: function (a, c, d) {
- this.type = a;
- this.$element = b(c);
- this.options = this.getOptions(d);
- this.enabled = !0;
- "manual" != this.options.trigger && (a = "hover" == this.options.trigger ? "mouseenter" : "focus", c = "hover" == this.options.trigger ? "mouseleave" : "blur", this.$element.on(a, this.options.selector, b.proxy(this.enter, this)), this.$element.on(c, this.options.selector, b.proxy(this.leave, this)));
- this.options.selector ? this._options = b.extend({},
- this.options, {
- trigger: "manual",
- selector: ""
- }) : this.fixTitle()
- },
- getOptions: function (a) {
- a = b.extend({}, b.fn[this.type].defaults, a, this.$element.data());
- if (a.delay && "number" == typeof a.delay) a.delay = {
- show: a.delay,
- hide: a.delay
- };
- return a
- },
- enter: function (a) {
- var c = b(a.currentTarget)[this.type](this._options).data(this.type);
- if (!c.options.delay || !c.options.delay.show) return c.show();
- clearTimeout(this.timeout);
- c.hoverState = "in";
- this.timeout = setTimeout(function () {
- "in" == c.hoverState && c.show()
- }, c.options.delay.show)
- },
- leave: function (a) {
- var c = b(a.currentTarget)[this.type](this._options).data(this.type);
- if (!c.options.delay || !c.options.delay.hide) return c.hide();
- clearTimeout(this.timeout);
- c.hoverState = "out";
- this.timeout = setTimeout(function () {
- "out" == c.hoverState && c.hide()
- }, c.options.delay.hide)
- },
- show: function () {
- var a, b, d, f, e, g, i;
- if (this.hasContent() && this.enabled) {
- a = this.tip();
- this.setContent();
- this.options.animation && a.addClass("fade");
- g = "function" == typeof this.options.placement ? this.options.placement.call(this, a[0],
- this.$element[0]) : this.options.placement;
- b = /in/.test(g);
- a.remove().css({
- top: 0,
- left: 0,
- display: "block"
- }).appendTo(b ? this.$element : document.body);
- d = this.getPosition(b);
- f = a[0].offsetWidth;
- e = a[0].offsetHeight;
- switch (b ? g.split(" ")[1] : g) {
- case "bottom":
- i = {
- top: d.top + d.height,
- left: d.left + d.width / 2 - f / 2
- };
- break;
- case "top":
- i = {
- top: d.top - e,
- left: d.left + d.width / 2 - f / 2
- };
- break;
- case "left":
- i = {
- top: d.top + d.height / 2 - e / 2,
- left: d.left - f
- };
- break;
- case "right":
- i = {
- top: d.top + d.height / 2 - e / 2,
- left: d.left + d.width
- }
- }
- a.css(i).addClass(g).addClass("in")
- }
- },
- isHTML: function (a) {
- return "string" != typeof a || "<" === a.charAt(0) && ">" === a.charAt(a.length - 1) && 3 <= a.length || /^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(a)
- },
- setContent: function () {
- var a = this.tip(),
- b = this.getTitle();
- a.find(".tooltip-inner")[this.isHTML(b) ? "html" : "text"](b);
- a.removeClass("fade in top bottom left right")
- },
- hide: function () {
- function a() {
- var a = setTimeout(function () {
- c.off(b.support.transition.end).remove()
- }, 500);
- c.one(b.support.transition.end, function () {
- clearTimeout(a);
- c.remove()
- })
- }
- var c = this.tip();
- c.removeClass("in");
- b.support.transition && this.$tip.hasClass("fade") ? a() : c.remove()
- },
- fixTitle: function () {
- var a = this.$element;
- if (a.attr("title") || "string" != typeof a.attr("data-original-title")) a.attr("data-original-title", a.attr("title") || "").removeAttr("title")
- },
- hasContent: function () {
- return this.getTitle()
- },
- getPosition: function (a) {
- return b.extend({}, a ? {
- top: 0,
- left: 0
- } : this.$element.offset(), {
- width: this.$element[0].offsetWidth,
- height: this.$element[0].offsetHeight
- })
- },
- getTitle: function () {
- var a = this.$element,
- b = this.options;
- return a.attr("data-original-title") || ("function" == typeof b.title ? b.title.call(a[0]) : b.title)
- },
- tip: function () {
- return this.$tip = this.$tip || b(this.options.template)
- },
- validate: function () {
- if (!this.$element[0].parentNode) this.hide(), this.options = this.$element = null
- },
- enable: function () {
- this.enabled = !0
- },
- disable: function () {
- this.enabled = !1
- },
- toggleEnabled: function () {
- this.enabled = !this.enabled
- },
- toggle: function () {
- this[this.tip().hasClass("in") ? "hide" : "show"]()
- }
- };
- b.fn.tooltip = function (a) {
- return this.each(function () {
- var c =
- b(this),
- d = c.data("tooltip"),
- f = "object" == typeof a && a;
- d || c.data("tooltip", d = new e(this, f));
- if ("string" == typeof a) d[a]()
- })
- };
- b.fn.tooltip.Constructor = e;
- b.fn.tooltip.defaults = {
- animation: !0,
- placement: "top",
- selector: !1,
- template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
- trigger: "hover",
- title: "",
- delay: 0
- }
- })(window.jQuery);
- (function (b) {
- var e = function (a, b) {
- this.init("popover", a, b)
- };
- e.prototype = b.extend({}, b.fn.tooltip.Constructor.prototype, {
- constructor: e,
- setContent: function () {
- var a = this.tip(),
- b = this.getTitle(),
- d = this.getContent();
- a.find(".popover-title")[this.isHTML(b) ? "html" : "text"](b);
- a.find(".popover-content > *")[this.isHTML(d) ? "html" : "text"](d);
- a.removeClass("fade top bottom left right in")
- },
- hasContent: function () {
- return this.getTitle() || this.getContent()
- },
- getContent: function () {
- var a = this.$element,
- b = this.options;
- return a.attr("data-content") || ("function" == typeof b.content ? b.content.call(a[0]) : b.content)
- },
- tip: function () {
- if (!this.$tip) this.$tip = b(this.options.template);
- return this.$tip
- }
- });
- b.fn.popover = function (a) {
- return this.each(function () {
- var c = b(this),
- d = c.data("popover"),
- f = "object" == typeof a && a;
- d || c.data("popover", d = new e(this, f));
- if ("string" == typeof a) d[a]()
- })
- };
- b.fn.popover.Constructor = e;
- b.fn.popover.defaults = b.extend({}, b.fn.tooltip.defaults, {
- placement: "right",
- content: "",
- template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
- })
- })(window.jQuery);
- (function (b) {
- function e(a, c) {
- var d = b.proxy(this.process, this),
- f = b(a).is("body") ? b(window) : b(a),
- e;
- this.options = b.extend({}, b.fn.scrollspy.defaults, c);
- this.$scrollElement = f.on("scroll.scroll.data-api", d);
- this.selector = (this.options.target || (e = b(a).attr("href")) && e.replace(/.*(?=#[^\s]+$)/, "") || "") + " .nav li > a";
- this.$body = b("body");
- this.refresh();
- this.process()
- }
- e.prototype = {
- constructor: e,
- refresh: function () {
- var a = this;
- this.offsets = b([]);
- this.targets = b([]);
- this.$body.find(this.selector).map(function () {
- var a =
- b(this),
- a = a.data("target") || a.attr("href"),
- d = /^#\w/.test(a) && b(a);
- return d && a.length && [
- [d.position().top, a]
- ] || null
- }).sort(function (a, b) {
- return a[0] - b[0]
- }).each(function () {
- a.offsets.push(this[0]);
- a.targets.push(this[1])
- })
- },
- process: function () {
- var a = this.$scrollElement.scrollTop() + this.options.offset,
- b = (this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight) - this.$scrollElement.height(),
- d = this.offsets,
- f = this.targets,
- e = this.activeTarget,
- g;
- if (a >= b) return e != (g = f.last()[0]) && this.activate(g);
- for (g =
- d.length; g--;) e != f[g] && a >= d[g] && (!d[g + 1] || a <= d[g + 1]) && this.activate(f[g])
- },
- activate: function (a) {
- this.activeTarget = a;
- b(this.selector).parent(".active").removeClass("active");
- a = b(this.selector + '[data-target="' + a + '"],' + this.selector + '[href="' + a + '"]').parent("li").addClass("active");
- a.parent(".dropdown-menu") && (a = a.closest("li.dropdown").addClass("active"));
- a.trigger("activate")
- }
- };
- b.fn.scrollspy = function (a) {
- return this.each(function () {
- var c = b(this),
- d = c.data("scrollspy"),
- f = "object" == typeof a && a;
- d || c.data("scrollspy",
- d = new e(this, f));
- if ("string" == typeof a) d[a]()
- })
- };
- b.fn.scrollspy.Constructor = e;
- b.fn.scrollspy.defaults = {
- offset: 10
- };
- b(function () {
- b('[data-spy="scroll"]').each(function () {
- var a = b(this);
- a.scrollspy(a.data())
- })
- })
- })(window.jQuery);
- (function (b) {
- var e = function (a) {
- this.element = b(a)
- };
- e.prototype = {
- constructor: e,
- show: function () {
- var a = this.element,
- c = a.closest("ul:not(.dropdown-menu)"),
- d = a.attr("data-target"),
- f, e;
- d || (d = (d = a.attr("href")) && d.replace(/.*(?=#[^\s]*$)/, ""));
- a.parent("li").hasClass("active") || (f = c.find(".active a").last()[0], e = b.Event("show", {
- relatedTarget: f
- }), a.trigger(e), e.isDefaultPrevented() || (d = b(d), this.activate(a.parent("li"), c), this.activate(d, d.parent(), function () {
- a.trigger({
- type: "shown",
- relatedTarget: f
- })
- })))
- },
- activate: function (a, c, d) {
- function f() {
- e.removeClass("active").find("> .dropdown-menu > .active").removeClass("active");
- a.addClass("active");
- g ? a.addClass("in") : a.removeClass("fade");
- a.parent(".dropdown-menu") && a.closest("li.dropdown").addClass("active");
- d && d()
- }
- var e = c.find("> .active"),
- g = d && b.support.transition && e.hasClass("fade");
- g ? e.one(b.support.transition.end, f) : f();
- e.removeClass("in")
- }
- };
- b.fn.tab = function (a) {
- return this.each(function () {
- var c = b(this),
- d = c.data("tab");
- d || c.data("tab", d = new e(this));
- if ("string" == typeof a) d[a]()
- })
- };
- b.fn.tab.Constructor = e;
- b(function () {
- b("body").on("click.tab.data-api", '[data-toggle="tab"], [data-toggle="pill"]', function (a) {
- a.preventDefault();
- b(this).tab("show")
- })
- })
- })(window.jQuery);
- (function (b) {
- var e = function (a, c) {
- this.$element = b(a);
- this.options = b.extend({}, b.fn.typeahead.defaults, c);
- this.matcher = this.options.matcher || this.matcher;
- this.sorter = this.options.sorter || this.sorter;
- this.highlighter = this.options.highlighter || this.highlighter;
- this.updater = this.options.updater || this.updater;
- this.$menu = b(this.options.menu).appendTo("body");
- this.source = this.options.source;
- this.shown = !1;
- this.listen()
- };
- e.prototype = {
- constructor: e,
- select: function () {
- this.$element.val(this.updater(this.$menu.find(".active").attr("data-value"))).change();
- return this.hide()
- },
- updater: function (a) {
- return a
- },
- show: function () {
- var a = b.extend({}, this.$element.offset(), {
- height: this.$element[0].offsetHeight
- });
- this.$menu.css({
- top: a.top + a.height,
- left: a.left
- });
- this.$menu.show();
- this.shown = !0;
- return this
- },
- hide: function () {
- this.$menu.hide();
- this.shown = !1;
- return this
- },
- lookup: function () {
- var a = this,
- c;
- this.query = this.$element.val();
- if (!this.query) return this.shown ? this.hide() : this;
- c = b.grep(this.source, function (b) {
- return a.matcher(b)
- });
- c = this.sorter(c);
- return !c.length ?
- this.shown ? this.hide() : this : this.render(c.slice(0, this.options.items)).show()
- },
- matcher: function (a) {
- return ~a.toLowerCase().indexOf(this.query.toLowerCase())
- },
- sorter: function (a) {
- for (var b = [], d = [], e = [], h; h = a.shift();) h.toLowerCase().indexOf(this.query.toLowerCase()) ? ~h.indexOf(this.query) ? d.push(h) : e.push(h) : b.push(h);
- return b.concat(d, e)
- },
- highlighter: function (a) {
- var b = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
- return a.replace(RegExp("(" + b + ")", "ig"), function (a, b) {
- return "<strong>" + b + "</strong>"
- })
- },
- render: function (a) {
- var c = this,
- a = b(a).map(function (a, e) {
- a = b(c.options.item).attr("data-value", e);
- a.find("a").html(c.highlighter(e));
- return a[0]
- });
- a.first().addClass("active");
- this.$menu.html(a);
- return this
- },
- next: function () {
- var a = this.$menu.find(".active").removeClass("active").next();
- a.length || (a = b(this.$menu.find("li")[0]));
- a.addClass("active")
- },
- prev: function () {
- var a = this.$menu.find(".active").removeClass("active").prev();
- a.length || (a = this.$menu.find("li").last());
- a.addClass("active")
- },
- listen: function () {
- this.$element.on("blur",
- b.proxy(this.blur, this)).on("keypress", b.proxy(this.keypress, this)).on("keyup", b.proxy(this.keyup, this));
- if (b.browser.webkit || b.browser.msie) this.$element.on("keydown", b.proxy(this.keypress, this));
- this.$menu.on("click", b.proxy(this.click, this)).on("mouseenter", "li", b.proxy(this.mouseenter, this))
- },
- keyup: function (a) {
- switch (a.keyCode) {
- case 40:
- case 38:
- break;
- case 9:
- case 13:
- if (!this.shown) return;
- this.select();
- break;
- case 27:
- if (!this.shown) return;
- this.hide();
- break;
- default:
- this.lookup()
- }
- a.stopPropagation();
- a.preventDefault()
- },
- keypress: function (a) {
- if (this.shown) {
- switch (a.keyCode) {
- case 9:
- case 13:
- case 27:
- a.preventDefault();
- break;
- case 38:
- if ("keydown" != a.type) break;
- a.preventDefault();
- this.prev();
- break;
- case 40:
- if ("keydown" != a.type) break;
- a.preventDefault();
- this.next()
- }
- a.stopPropagation()
- }
- },
- blur: function () {
- var a = this;
- setTimeout(function () {
- a.hide()
- }, 150)
- },
- click: function (a) {
- a.stopPropagation();
- a.preventDefault();
- this.select()
- },
- mouseenter: function (a) {
- this.$menu.find(".active").removeClass("active");
- b(a.currentTarget).addClass("active")
- }
- };
- b.fn.typeahead = function (a) {
- return this.each(function () {
- var c = b(this),
- d = c.data("typeahead"),
- f = "object" == typeof a && a;
- d || c.data("typeahead", d = new e(this, f));
- if ("string" == typeof a) d[a]()
- })
- };
- b.fn.typeahead.defaults = {
- source: [],
- items: 8,
- menu: '<ul class="typeahead dropdown-menu"></ul>',
- item: '<li><a href="#"></a></li>'
- };
- b.fn.typeahead.Constructor = e;
- b(function () {
- b("body").on("focus.typeahead.data-api", '[data-provide="typeahead"]', function (a) {
- var c = b(this);
- c.data("typeahead") || (a.preventDefault(), c.typeahead(c.data()))
- })
- })
- })(window.jQuery);
- var topSpacer = 0,
- updateMapContainerHeight = function () {
- var a = jQuery(window).height() - topSpacer;
- jQuery(".mapMainContainer").height(a);
- jQuery(".mapContainer").height(a);
- jQuery(".rightContainer").height(a)
- };
- jQuery(document).ready(function () {
- topSpacer = (jQuery("#header-nav").hasClass("fixed") ? jQuery("#header-nav").height() : jQuery("#ign-header").height()) + jQuery(".breadcrumb-inverted").height();
- updateMapContainerHeight();
- jQuery(window).resize(function () {
- updateMapContainerHeight()
- });
- jQuery(".embed-link").click(function (a) {
- var b = jQuery(this).data("popup");
- jQuery("#" + b).show();
- a.preventDefault();
- a.stopPropagation()
- });
- jQuery("#close-comment-link").click(function (a) {
- jQuery(".comment-overlay").hide();
- a.preventDefault();
- a.stopPropagation()
- });
- jQuery(".show-comments").click(function (a) {
- jQuery(".comment-overlay").show();
- a.preventDefault();
- a.stopPropagation()
- });
- jQuery(".close-button").click(function (a) {
- jQuery(this).parent(".share-popup").hide();
- a.preventDefault();
- a.stopPropagation()
- });
- jQuery("#comment-socialLogin").click(function () {
- jQuery(".comment-overlay").hide()
- });
- jQuery(".expandable-container a.toggle").click(function (a) {
- var b = jQuery(this).next(".expandable-list");
- b.is(":visible") ? (b.stop().slideUp("fast"), jQuery(this).removeClass("contract")) :
- (b.stop().slideDown("fast"), jQuery(this).addClass("contract"));
- a.preventDefault();
- a.stopPropagation()
- });
- jQuery(".map-embed-code").click(function () {
- jQuery(this).focus();
- jQuery(this).select()
- })
- });
- (function () {
- L.MarkerClusterGroup = L.FeatureGroup.extend({
- options: {
- maxClusterRadius: 80,
- iconCreateFunction: null,
- spiderfyOnMaxZoom: !0,
- showCoverageOnHover: !0,
- zoomToBoundsOnClick: !0,
- singleMarkerMode: !1,
- disableClusteringAtZoom: null,
- skipDuplicateAddTesting: !1,
- animateAddingMarkers: !1,
- polygonOptions: {}
- },
- initialize: function (a) {
- L.Util.setOptions(this, a);
- if (!this.options.iconCreateFunction) this.options.iconCreateFunction = this._defaultIconCreateFunction;
- L.FeatureGroup.prototype.initialize.call(this, []);
- this._inZoomAnimation =
- 0;
- this._needsClustering = [];
- this._currentShownBounds = null
- },
- addLayer: function (a) {
- if (a instanceof L.LayerGroup) {
- for (var b in a._layers) a._layers.hasOwnProperty(b) && this.addLayer(a._layers[b]);
- return this
- }
- if (this.options.singleMarkerMode) a.options.icon = this.options.iconCreateFunction({
- getChildCount: function () {
- return 1
- },
- getAllChildMarkers: function () {
- return [a]
- }
- });
- if (!this._map) return this._needsClustering.push(a), this;
- if (!this.options.skipDuplicateAddTesting && this.hasLayer(a)) return this;
- this._unspiderfy &&
- this._unspiderfy();
- this._addLayer(a, this._maxZoom);
- b = a;
- var d = this._map.getZoom();
- if (a.__parent)
- for (; b.__parent._zoom >= d;) b = b.__parent;
- this._currentShownBounds.contains(b.getLatLng()) && (this.options.animateAddingMarkers ? this._animationAddLayer(a, b) : this._animationAddLayerNonAnimated(a, b));
- return this
- },
- removeLayer: function (a) {
- if (!this._map) return this._arraySplice(this._needsClustering, a), this;
- if (!a.__parent) return this;
- this._unspiderfy && (this._unspiderfy(), this._unspiderfyLayer(a));
- this._removeLayer(a, !0);
- a._icon && (L.FeatureGroup.prototype.removeLayer.call(this, a), a.setOpacity(1));
- return this
- },
- clearLayers: function () {
- if (!this._map) return this._needsClustering = [], this;
- this._unspiderfy && this._unspiderfy();
- for (var a in this._layers) this._layers.hasOwnProperty(a) && L.FeatureGroup.prototype.removeLayer.call(this, this._layers[a]);
- this._generateInitialClusters();
- return this
- },
- hasLayer: function (a) {
- var b = !1;
- this._topClusterLevel._recursively(new L.LatLngBounds([a.getLatLng()]), 0, this._map.getMaxZoom() + 1, function (d) {
- for (var e =
- d._markers.length - 1; 0 <= e && !b; e--) d._markers[e] === a && (b = !0)
- }, null);
- return b
- },
- zoomToShowLayer: function (a, b) {
- var d = function () {
- if ((a._icon || a.__parent._icon) && !this._inZoomAnimation)
- if (this._map.off("moveend", d, this), this.off("animationend", d, this), a._icon) b();
- else if (a.__parent._icon) {
- var e = function () {
- this.off("spiderfied", e, this);
- b()
- };
- this.on("spiderfied", e, this);
- a.__parent.spiderfy()
- }
- };
- a._icon ? b() : a.__parent._zoom < this._map.getZoom() ? (this._map.on("moveend", d, this), a._icon || this._map.panTo(a.getLatLng())) :
- (this._map.on("moveend", d, this), this.on("animationend", d, this), this._map.setView(a.getLatLng(), a.__parent._zoom + 1), a.__parent.zoomToBounds())
- },
- onAdd: function (a) {
- L.FeatureGroup.prototype.onAdd.call(this, a);
- this._gridClusters || this._generateInitialClusters();
- for (var a = 0, b = this._needsClustering.length; a < b; a++) this._addLayer(this._needsClustering[a], this._maxZoom);
- this._needsClustering = [];
- this._map.on("zoomend", this._zoomEnd, this);
- this._map.on("moveend", this._moveEnd, this);
- this._spiderfierOnAdd && this._spiderfierOnAdd();
- this._bindEvents();
- this._zoom = this._map.getZoom();
- this._currentShownBounds = this._getExpandedVisibleBounds();
- this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds)
- },
- onRemove: function (a) {
- this._map.off("zoomend", this._zoomEnd, this);
- this._map.off("moveend", this._moveEnd, this);
- this._map._mapPane.className = this._map._mapPane.className.replace(" leaflet-cluster-anim", "");
- this._spiderfierOnRemove && this._spiderfierOnRemove();
- L.FeatureGroup.prototype.onRemove.call(this,
- a)
- },
- _arraySplice: function (a, b) {
- for (var d = a.length - 1; 0 <= d; d--)
- if (a[d] === b) {
- a.splice(d, 1);
- break
- }
- },
- _removeLayer: function (a, b) {
- var d = this._gridClusters,
- e = this._gridUnclustered,
- g = this._map;
- if (b)
- for (var c = this._maxZoom; 0 <= c && e[c].removeObject(a, g.project(a.getLatLng(), c)); c--);
- var c = a.__parent,
- f;
- for (this._arraySplice(c._markers, a); c;) {
- c._childCount--;
- if (0 > c._zoom) break;
- else b && 1 >= c._childCount ? (f = c._markers[0] === a ? c._markers[1] : c._markers[0], d[c._zoom].removeObject(c, g.project(c._cLatLng, c._zoom)), e[c._zoom].addObject(f,
- g.project(f.getLatLng(), c._zoom)), this._arraySplice(c.__parent._childClusters, c), c.__parent._markers.push(f), f.__parent = c.__parent, c._icon && (L.FeatureGroup.prototype.removeLayer.call(this, c), L.FeatureGroup.prototype.addLayer.call(this, f))) : (c._recalculateBounds(), c._updateIcon());
- c = c.__parent
- }
- },
- _propagateEvent: function (a) {
- if (a.target instanceof L.MarkerCluster) a.type = "cluster" + a.type;
- L.FeatureGroup.prototype._propagateEvent.call(this, a)
- },
- _defaultIconCreateFunction: function (a) {
- var a = a.getChildCount(),
- b = " marker-cluster-";
- return new L.DivIcon({
- html: "<div><span>" + a + "</span></div>",
- className: "marker-cluster" + (10 > a ? b + "small" : 100 > a ? b + "medium" : b + "large"),
- iconSize: new L.Point(40, 40)
- })
- },
- _bindEvents: function () {
- var a = null,
- b = this._map,
- d = this.options.spiderfyOnMaxZoom,
- e = this.options.showCoverageOnHover,
- g = this.options.zoomToBoundsOnClick;
- if (d || g) this.on("clusterclick", function (a) {
- b.getMaxZoom() === b.getZoom() ? d && a.layer.spiderfy() : g && a.layer.zoomToBounds()
- }, this);
- e && (this.on("clustermouseover", function (c) {
- this._inZoomAnimation ||
- (a && b.removeLayer(a), 2 < c.layer.getChildCount() && (a = new L.Polygon(c.layer.getConvexHull(), this.options.polygonOptions), b.addLayer(a)))
- }, this), this.on("clustermouseout", function () {
- a && (b.removeLayer(a), a = null)
- }, this), b.on("zoomend", function () {
- a && (b.removeLayer(a), a = null)
- }, this), b.on("layerremove", function (c) {
- a && c.layer === this && (b.removeLayer(a), a = null)
- }, this))
- },
- _zoomEnd: function () {
- if (this._map) this._mergeSplitClusters(), this._zoom = this._map._zoom, this._currentShownBounds = this._getExpandedVisibleBounds()
- },
- _moveEnd: function () {
- if (!this._inZoomAnimation) {
- var a = this._getExpandedVisibleBounds();
- this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, this._zoom, a);
- this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, a);
- this._currentShownBounds = a
- }
- },
- _generateInitialClusters: function () {
- var a = this._map.getMaxZoom(),
- b = this.options.maxClusterRadius;
- this.options.disableClusteringAtZoom && (a = this.options.disableClusteringAtZoom - 1);
- this._maxZoom = a;
- this._gridClusters = {};
- for (this._gridUnclustered = {}; 0 <= a; a--) this._gridClusters[a] = new L.DistanceGrid(b), this._gridUnclustered[a] = new L.DistanceGrid(b);
- this._topClusterLevel = new L.MarkerCluster(this, -1)
- },
- _addLayer: function (a, b) {
- for (var d = this._gridClusters, e = this._gridUnclustered, g, c; 0 <= b; b--) {
- g = this._map.project(a.getLatLng(), b);
- var f = d[b].getNearObject(g);
- if (f) {
- f._addChild(a);
- a.__parent = f;
- return
- }
- if (f = e[b].getNearObject(g)) {
- f.__parent && this._removeLayer(f, !1);
- g = f.__parent;
- c = new L.MarkerCluster(this, b, f, a);
- d[b].addObject(c, this._map.project(c._cLatLng,
- b));
- f.__parent = c;
- var h = a.__parent = c;
- for (c = b - 1; c > g._zoom; c--) h = new L.MarkerCluster(this, c, h), d[c].addObject(h, this._map.project(f.getLatLng(), c));
- g._addChild(h);
- for (c = b; 0 <= c && e[c].removeObject(f, this._map.project(f.getLatLng(), c)); c--);
- return
- }
- e[b].addObject(a, g)
- }
- this._topClusterLevel._addChild(a);
- a.__parent = this._topClusterLevel
- },
- _mergeSplitClusters: function () {
- this._zoom < this._map._zoom ? (this._animationStart(), this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, this._zoom,
- this._getExpandedVisibleBounds()), this._animationZoomIn(this._zoom, this._map._zoom)) : this._zoom > this._map._zoom ? (this._animationStart(), this._animationZoomOut(this._zoom, this._map._zoom)) : this._moveEnd()
- },
- _getExpandedVisibleBounds: function () {
- var a = this._map,
- b = a.getPixelBounds(),
- d = L.Browser.mobile ? 0 : Math.abs(b.max.x - b.min.x),
- e = L.Browser.mobile ? 0 : Math.abs(b.max.y - b.min.y),
- g = a.unproject(new L.Point(b.min.x - d, b.min.y - e)),
- a = a.unproject(new L.Point(b.max.x + d, b.max.y + e));
- return new L.LatLngBounds(g, a)
- },
- _animationAddLayerNonAnimated: function (a, b) {
- if (b === a) L.FeatureGroup.prototype.addLayer.call(this, a);
- else if (2 === b._childCount) {
- b._addToMap();
- var d = b.getAllChildMarkers();
- L.FeatureGroup.prototype.removeLayer.call(this, d[0]);
- L.FeatureGroup.prototype.removeLayer.call(this, d[1])
- } else b._updateIcon()
- }
- });
- L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
- _animationStart: function () {},
- _animationZoomIn: function (a, b) {
- this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, a);
- this._topClusterLevel._recursivelyAddChildrenToMap(null,
- b, this._getExpandedVisibleBounds())
- },
- _animationZoomOut: function (a, b) {
- this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, a);
- this._topClusterLevel._recursivelyAddChildrenToMap(null, b, this._getExpandedVisibleBounds())
- },
- _animationAddLayer: function (a, b) {
- this._animationAddLayerNonAnimated(a, b)
- }
- } : {
- _animationStart: function () {
- this._map._mapPane.className += " leaflet-cluster-anim";
- this._inZoomAnimation++
- },
- _animationEnd: function () {
- if (this._map) this._map._mapPane.className = this._map._mapPane.className.replace(" leaflet-cluster-anim",
- "");
- this._inZoomAnimation--;
- this.fire("animationend")
- },
- _animationZoomIn: function (a, b) {
- var d = this,
- e = this._getExpandedVisibleBounds(),
- g;
- this._topClusterLevel._recursively(e, a, 0, function (c) {
- var f = c._latlng,
- i = c._markers;
- c._isSingleParent() && a + 1 === b ? (L.FeatureGroup.prototype.removeLayer.call(d, c), c._recursivelyAddChildrenToMap(null, b, e)) : (c.setOpacity(0), c._recursivelyAddChildrenToMap(f, b, e));
- for (g = i.length - 1; 0 <= g; g--) c = i[g], e.contains(c._latlng) || L.FeatureGroup.prototype.removeLayer.call(d, c)
- });
- this._forceLayout();
- var c, f;
- d._topClusterLevel._recursivelyBecomeVisible(e, b);
- for (c in d._layers) d._layers.hasOwnProperty(c) && (f = d._layers[c], !(f instanceof L.MarkerCluster) && f._icon && f.setOpacity(1));
- d._topClusterLevel._recursively(e, a, b, function (a) {
- a._recursivelyRestoreChildPositions(b)
- });
- setTimeout(function () {
- d._topClusterLevel._recursively(e, a, 0, function (a) {
- L.FeatureGroup.prototype.removeLayer.call(d, a);
- a.setOpacity(1)
- });
- d._animationEnd()
- }, 250)
- },
- _animationZoomOut: function (a, b) {
- this._animationZoomOutSingle(this._topClusterLevel,
- a - 1, b);
- this._topClusterLevel._recursivelyAddChildrenToMap(null, b, this._getExpandedVisibleBounds());
- this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, a, this._getExpandedVisibleBounds())
- },
- _animationZoomOutSingle: function (a, b, d) {
- var e = this._getExpandedVisibleBounds();
- a._recursivelyAnimateChildrenInAndAddSelfToMap(e, b + 1, d);
- var g = this;
- this._forceLayout();
- a._recursivelyBecomeVisible(e, d);
- setTimeout(function () {
- if (1 === a._childCount) {
- var c = a._markers[0];
- c.setLatLng(c.getLatLng());
- c.setOpacity(1)
- } else a._recursively(e, d, 0, function (a) {
- a._recursivelyRemoveChildrenFromMap(e, b + 1)
- }), g._animationEnd()
- }, 250)
- },
- _animationAddLayer: function (a, b) {
- var d = this;
- L.FeatureGroup.prototype.addLayer.call(this, a);
- b !== a && (2 < b._childCount ? (b._updateIcon(), this._forceLayout(), this._animationStart(), a._setPos(this._map.latLngToLayerPoint(b.getLatLng())), a.setOpacity(0), setTimeout(function () {
- L.FeatureGroup.prototype.removeLayer.call(d, a);
- a.setOpacity(1);
- d._animationEnd()
- }, 250)) : (this._forceLayout(),
- d._animationStart(), d._animationZoomOutSingle(b, this._map.getMaxZoom(), this._map.getZoom())))
- },
- _forceLayout: function () {
- L.Util.falseFn(document.body.offsetWidth)
- }
- });
- L.MarkerCluster = L.Marker.extend({
- initialize: function (a, b, d, e) {
- L.Marker.prototype.initialize.call(this, d ? d._cLatLng || d.getLatLng() : new L.LatLng(0, 0), {
- icon: this
- });
- this._group = a;
- this._zoom = b;
- this._markers = [];
- this._childClusters = [];
- this._childCount = 0;
- this._iconNeedsUpdate = !0;
- this._bounds = new L.LatLngBounds;
- d && this._addChild(d);
- e && this._addChild(e)
- },
- getAllChildMarkers: function (a) {
- for (var a = a || [], b = this._childClusters.length - 1; 0 <= b; b--) this._childClusters[b].getAllChildMarkers(a);
- for (b = this._markers.length - 1; 0 <= b; b--) a.push(this._markers[b]);
- return a
- },
- getChildCount: function () {
- return this._childCount
- },
- zoomToBounds: function () {
- this._group._map.fitBounds(this._bounds)
- },
- _updateIcon: function () {
- this._iconNeedsUpdate = !0;
- this._icon && this.setIcon(this)
- },
- createIcon: function () {
- if (this._iconNeedsUpdate) this._iconObj = this._group.options.iconCreateFunction(this),
- this._iconNeedsUpdate = !1;
- return this._iconObj.createIcon()
- },
- createShadow: function () {
- return this._iconObj.createShadow()
- },
- _addChild: function (a, b) {
- this._iconNeedsUpdate = !0;
- this._expandBounds(a);
- if (a instanceof L.MarkerCluster) {
- if (!b) this._childClusters.push(a), a.__parent = this;
- this._childCount += a._childCount
- } else b || this._markers.push(a), this._childCount++;
- this.__parent && this.__parent._addChild(a, !0)
- },
- _expandBounds: function (a) {
- var b, d = a._wLatLng || a._latlng;
- a instanceof L.MarkerCluster ? (this._bounds.extend(a._bounds),
- b = a._childCount) : (this._bounds.extend(d), b = 1);
- if (!this._cLatLng) this._cLatLng = a._cLatLng || d;
- a = this._childCount + b;
- this._wLatLng ? (this._wLatLng.lat = (d.lat * b + this._wLatLng.lat * this._childCount) / a, this._wLatLng.lng = (d.lng * b + this._wLatLng.lng * this._childCount) / a) : this._latlng = this._wLatLng = new L.LatLng(d.lat, d.lng)
- },
- _addToMap: function (a) {
- if (a) this._backupLatlng = this._latlng, this.setLatLng(a);
- L.FeatureGroup.prototype.addLayer.call(this._group, this)
- },
- _recursivelyAnimateChildrenIn: function (a, b, d) {
- this._recursively(a,
- 0, d - 1,
- function (a) {
- var a = a._markers,
- d, c;
- for (d = a.length - 1; 0 <= d; d--) c = a[d], c._icon && (c._setPos(b), c.setOpacity(0))
- },
- function (a) {
- var a = a._childClusters,
- d, c;
- for (d = a.length - 1; 0 <= d; d--) c = a[d], c._icon && (c._setPos(b), c.setOpacity(0))
- })
- },
- _recursivelyAnimateChildrenInAndAddSelfToMap: function (a, b, d) {
- this._recursively(a, d, 0, function (e) {
- e._recursivelyAnimateChildrenIn(a, e._group._map.latLngToLayerPoint(e.getLatLng()).round(), b);
- e._isSingleParent() && b - 1 === d ? (e.setOpacity(1), e._recursivelyRemoveChildrenFromMap(a,
- b)) : e.setOpacity(0);
- e._addToMap()
- })
- },
- _recursivelyBecomeVisible: function (a, b) {
- this._recursively(a, 0, b, null, function (a) {
- a.setOpacity(1)
- })
- },
- _recursivelyAddChildrenToMap: function (a, b, d) {
- this._recursively(d, -1, b, function (e) {
- if (b !== e._zoom)
- for (var g = e._markers.length - 1; 0 <= g; g--) {
- var c = e._markers[g];
- if (d.contains(c._latlng)) {
- if (a) c._backupLatlng = c.getLatLng(), c.setLatLng(a), c.setOpacity(0);
- L.FeatureGroup.prototype.addLayer.call(e._group, c)
- }
- }
- }, function (b) {
- b._addToMap(a)
- })
- },
- _recursivelyRestoreChildPositions: function (a) {
- for (var b =
- this._markers.length - 1; 0 <= b; b--) {
- var d = this._markers[b];
- d._backupLatlng && (d.setLatLng(d._backupLatlng), delete d._backupLatlng)
- }
- if (a - 1 === this._zoom)
- for (a = this._childClusters.length - 1; 0 <= a; a--) this._childClusters[a]._restorePosition();
- else
- for (b = this._childClusters.length - 1; 0 <= b; b--) this._childClusters[b]._recursivelyRestoreChildPositions(a)
- },
- _restorePosition: function () {
- this._backupLatlng && (this.setLatLng(this._backupLatlng), delete this._backupLatlng)
- },
- _recursivelyRemoveChildrenFromMap: function (a, b,
- d) {
- var e, g;
- this._recursively(a, -1, b - 1, function (a) {
- for (g = a._markers.length - 1; 0 <= g; g--)
- if (e = a._markers[g], !d || !d.contains(e._latlng)) L.FeatureGroup.prototype.removeLayer.call(a._group, e), e.setOpacity(1)
- }, function (a) {
- for (g = a._childClusters.length - 1; 0 <= g; g--)
- if (e = a._childClusters[g], !d || !d.contains(e._latlng)) L.FeatureGroup.prototype.removeLayer.call(a._group, e), e.setOpacity(1)
- })
- },
- _recursively: function (a, b, d, e, g) {
- var c = this._childClusters,
- f = this._zoom,
- h;
- if (b > f)
- for (f = c.length - 1; 0 <= f; f--) h = c[f], a.intersects(h._bounds) &&
- h._recursively(a, b, d, e, g);
- else if (e && e(this), g && this._zoom === d && g(this), d > f)
- for (f = c.length - 1; 0 <= f; f--) h = c[f], a.intersects(h._bounds) && h._recursively(a, b, d, e, g)
- },
- _recalculateBounds: function () {
- var a = this._markers,
- b = this._childClusters,
- d;
- this._bounds = new L.LatLngBounds;
- delete this._wLatLng;
- for (d = a.length - 1; 0 <= d; d--) this._expandBounds(a[d]);
- for (d = b.length - 1; 0 <= d; d--) this._expandBounds(b[d])
- },
- _isSingleParent: function () {
- return 0 < this._childClusters.length && this._childClusters[0]._childCount === this._childCount
- }
- });
- L.DistanceGrid = function (a) {
- this._cellSize = a;
- this._sqCellSize = a * a;
- this._grid = {};
- this._objectPoint = {}
- };
- L.DistanceGrid.prototype = {
- addObject: function (a, b) {
- var d = this._getCoord(b.x),
- e = this._getCoord(b.y),
- g = this._grid,
- e = g[e] = g[e] || {},
- d = e[d] = e[d] || [];
- this._objectPoint[L.Util.stamp(a)] = b;
- d.push(a)
- },
- updateObject: function (a, b) {
- this.removeObject(a);
- this.addObject(a, b)
- },
- removeObject: function (a, b) {
- var d = this._getCoord(b.x),
- e = this._getCoord(b.y),
- g = this._grid,
- e = g[e] = g[e] || {},
- g = e[d] = e[d] || [],
- c, f;
- delete this._objectPoint[L.Util.stamp(a)];
- for (c = 0, f = g.length; c < f; c++)
- if (g[c] === a) return g.splice(c, 1), 1 === f && delete e[d], !0
- },
- eachObject: function (a, b) {
- var d, e, g, c, f, h, j, i = this._grid;
- for (d in i)
- if (i.hasOwnProperty(d))
- for (e in f = i[d], f)
- if (f.hasOwnProperty(e)) {
- h = f[e];
- for (g = 0, c = h.length; g < c; g++)
- if (j = a.call(b, h[g])) g--, c--
- }
- },
- getNearObject: function (a) {
- var b = this._getCoord(a.x),
- d = this._getCoord(a.y),
- e, g, c, f, h, j, i, k, n = this._objectPoint,
- l = this._sqCellSize,
- m = null;
- for (e = d - 1; e <= d + 1; e++)
- if (f = this._grid[e])
- for (g = b - 1; g <= b + 1; g++)
- if (h = f[g])
- for (c = 0, j = h.length; c <
- j; c++) i = h[c], k = this._sqDist(n[L.Util.stamp(i)], a), k < l && (l = k, m = i);
- return m
- },
- _getCoord: function (a) {
- return Math.floor(a / this._cellSize)
- },
- _sqDist: function (a, b) {
- var d = b.x - a.x,
- e = b.y - a.y;
- return d * d + e * e
- }
- };
- (function () {
- L.QuickHull = {
- getDistant: function (a, b) {
- return (b[0].lng - b[1].lng) * (a.lat - b[0].lat) + (b[1].lat - b[0].lat) * (a.lng - b[0].lng)
- },
- findMostDistantPointFromBaseLine: function (a, b) {
- var d = 0,
- e = null,
- g = [],
- c, f, h;
- for (c = b.length - 1; 0 <= c; c--) f = b[c], h = this.getDistant(f, a), 0 < h && (g.push(f), h > d && (d = h, e = f));
- return {
- maxPoint: e,
- newPoints: g
- }
- },
- buildConvexHull: function (a, b) {
- var d = [],
- e = this.findMostDistantPointFromBaseLine(a, b);
- return e.maxPoint ? (d = d.concat(this.buildConvexHull([a[0], e.maxPoint], e.newPoints)), d = d.concat(this.buildConvexHull([e.maxPoint, a[1]], e.newPoints))) : [a]
- },
- getConvexHull: function (a) {
- var b = !1,
- d = !1,
- e = null,
- g = null,
- c;
- for (c = a.length - 1; 0 <= c; c--) {
- var f = a[c];
- if (!1 === b || f.lat > b) e = f, b = f.lat;
- if (!1 === d || f.lat < d) g = f, d = f.lat
- }
- return [].concat(this.buildConvexHull([g, e], a), this.buildConvexHull([e, g], a))
- }
- }
- })();
- L.MarkerCluster.include({
- getConvexHull: function () {
- var a =
- this.getAllChildMarkers(),
- b = [],
- d = [],
- e, g;
- for (g = a.length - 1; 0 <= g; g--) e = a[g].getLatLng(), b.push(e);
- a = L.QuickHull.getConvexHull(b);
- for (g = a.length - 1; 0 <= g; g--) d.push(a[g][0]);
- return d
- }
- });
- L.MarkerCluster.include({
- _2PI: 2 * Math.PI,
- _circleFootSeparation: 25,
- _circleStartAngle: Math.PI / 6,
- _spiralFootSeparation: 28,
- _spiralLengthStart: 11,
- _spiralLengthFactor: 5,
- _circleSpiralSwitchover: 9,
- spiderfy: function () {
- if (!(this._group._spiderfied === this || this._group._inZoomAnimation)) {
- var a = this.getAllChildMarkers(),
- b = this._group._map.latLngToLayerPoint(this._latlng);
- this._group._unspiderfy();
- this._group._spiderfied = this;
- a.length >= this._circleSpiralSwitchover ? b = this._generatePointsSpiral(a.length, b) : (b.y += 10, b = this._generatePointsCircle(a.length, b));
- this._animationSpiderfy(a, b)
- }
- },
- unspiderfy: function (a) {
- if (!this._group._inZoomAnimation) this._animationUnspiderfy(a), this._group._spiderfied = null
- },
- _generatePointsCircle: function (a, b) {
- var d = this._circleFootSeparation * (2 + a) / this._2PI,
- e = this._2PI / a,
- g = [],
- c, f;
- g.length = a;
- for (c = a - 1; 0 <= c; c--) f = this._circleStartAngle + c * e, g[c] =
- (new L.Point(b.x + d * Math.cos(f), b.y + d * Math.sin(f)))._round();
- return g
- },
- _generatePointsSpiral: function (a, b) {
- var d = this._spiralLengthStart,
- e = 0,
- g = [],
- c;
- g.length = a;
- for (c = a - 1; 0 <= c; c--) e += this._spiralFootSeparation / d + 5.0E-4 * c, g[c] = (new L.Point(b.x + d * Math.cos(e), b.y + d * Math.sin(e)))._round(), d += this._2PI * this._spiralLengthFactor / e;
- return g
- }
- });
- L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
- _animationSpiderfy: function (a, b) {
- var d = this._group,
- e = d._map,
- g, c, f;
- for (g = a.length - 1; 0 <= g; g--) f = e.layerPointToLatLng(b[g]),
- c = a[g], c._preSpiderfyLatlng = c._latlng, c.setLatLng(f), c.setZIndexOffset(1E6), L.FeatureGroup.prototype.addLayer.call(d, c), f = new L.Polyline([this._latlng, f], {
- weight: 1.5,
- color: "#222"
- }), e.addLayer(f), c._spiderLeg = f;
- this.setOpacity(0.3);
- d.fire("spiderfied")
- },
- _animationUnspiderfy: function () {
- var a = this._group,
- b = a._map,
- d = this.getAllChildMarkers(),
- e, g;
- this.setOpacity(1);
- for (g = d.length - 1; 0 <= g; g--) e = d[g], L.FeatureGroup.prototype.removeLayer.call(a, e), e.setLatLng(e._preSpiderfyLatlng), delete e._preSpiderfyLatlng,
- e.setZIndexOffset(0), b.removeLayer(e._spiderLeg), delete e._spiderLeg
- }
- } : {
- _animationSpiderfy: function (a, b) {
- var d = this._group,
- e = d._map,
- g = e.latLngToLayerPoint(this._latlng),
- c, f, h;
- for (c = a.length - 1; 0 <= c; c--) f = a[c], f.setZIndexOffset(1E6), f.setOpacity(0), L.FeatureGroup.prototype.addLayer.call(d, f), f._setPos(g);
- d._forceLayout();
- d._animationStart();
- var g = L.Path.SVG ? 0 : 0.3,
- j = L.Path.SVG_NS;
- for (c = a.length - 1; 0 <= c; c--)
- if (h = e.layerPointToLatLng(b[c]), f = a[c], f._preSpiderfyLatlng = f._latlng, f.setLatLng(h), f.setOpacity(1),
- h = new L.Polyline([this._latlng, h], {
- weight: 1.5,
- color: "#222",
- opacity: g
- }), e.addLayer(h), f._spiderLeg = h, L.Path.SVG) {
- f = h._path.getTotalLength();
- h._path.setAttribute("stroke-dasharray", f + "," + f);
- var i = document.createElementNS(j, "animate");
- i.setAttribute("attributeName", "stroke-dashoffset");
- i.setAttribute("begin", "indefinite");
- i.setAttribute("from", f);
- i.setAttribute("to", 0);
- i.setAttribute("dur", 0.25);
- h._path.appendChild(i);
- i.beginElement();
- i = document.createElementNS(j, "animate");
- i.setAttribute("attributeName",
- "stroke-opacity");
- i.setAttribute("attributeName", "stroke-opacity");
- i.setAttribute("begin", "indefinite");
- i.setAttribute("from", 0);
- i.setAttribute("to", 0.5);
- i.setAttribute("dur", 0.25);
- h._path.appendChild(i);
- i.beginElement()
- }
- this.setOpacity(0.3);
- if (L.Path.SVG) {
- this._group._forceLayout();
- for (c = a.length - 1; 0 <= c; c--) f = a[c]._spiderLeg, f.options.opacity = 0.5, f._path.setAttribute("stroke-opacity", 0.5)
- }
- setTimeout(function () {
- d._animationEnd();
- d.fire("spiderfied")
- }, 250)
- },
- _animationUnspiderfy: function (a) {
- var b = this._group,
- d = b._map,
- a = a ? d._latLngToNewLayerPoint(this._latlng, a.zoom, a.center) : d.latLngToLayerPoint(this._latlng),
- e = this.getAllChildMarkers(),
- g = L.Path.SVG,
- c, f, h;
- b._animationStart();
- this.setOpacity(1);
- for (f = e.length - 1; 0 <= f; f--) c = e[f], c.setLatLng(c._preSpiderfyLatlng), delete c._preSpiderfyLatlng, c._setPos(a), c.setOpacity(0), g && (h = c._spiderLeg._path.childNodes[0], h.setAttribute("to", h.getAttribute("from")), h.setAttribute("from", 0), h.beginElement(), h = c._spiderLeg._path.childNodes[1], h.setAttribute("from", 0.5), h.setAttribute("to",
- 0), h.setAttribute("stroke-opacity", 0), h.beginElement(), c._spiderLeg._path.setAttribute("stroke-opacity", 0));
- setTimeout(function () {
- var a = 0;
- for (f = e.length - 1; 0 <= f; f--) c = e[f], c._spiderLeg && a++;
- for (f = e.length - 1; 0 <= f; f--) c = e[f], c._spiderLeg && (c.setOpacity(1), c.setZIndexOffset(0), 1 < a && L.FeatureGroup.prototype.removeLayer.call(b, c), d.removeLayer(c._spiderLeg), delete c._spiderLeg);
- b._animationEnd()
- }, 250)
- }
- });
- L.MarkerClusterGroup.include({
- _spiderfied: null,
- _spiderfierOnAdd: function () {
- this._map.on("click", this._unspiderfyWrapper,
- this);
- if (this._map.options.zoomAnimation) this._map.on("zoomstart", this._unspiderfyZoomStart, this);
- else this._map.on("zoomend", this._unspiderfyWrapper, this);
- L.Path.SVG && !L.Browser.touch && this._map._initPathRoot()
- },
- _spiderfierOnRemove: function () {
- this._map.off("click", this._unspiderfyWrapper, this);
- this._map.off("zoomstart", this._unspiderfyZoomStart, this);
- this._map.off("zoomanim", this._unspiderfyZoomAnim, this);
- this._unspiderfy()
- },
- _unspiderfyZoomStart: function () {
- if (this._map) this._map.on("zoomanim", this._unspiderfyZoomAnim,
- this)
- },
- _unspiderfyZoomAnim: function (a) {
- L.DomUtil.hasClass(this._map._mapPane, "leaflet-touching") || (this._map.off("zoomanim", this._unspiderfyZoomAnim, this), this._unspiderfy(a))
- },
- _unspiderfyWrapper: function () {
- this._unspiderfy()
- },
- _unspiderfy: function (a) {
- this._spiderfied && this._spiderfied.unspiderfy(a)
- },
- _unspiderfyLayer: function (a) {
- a._spiderLeg && (L.FeatureGroup.prototype.removeLayer.call(this, a), a.setOpacity(1), a.setZIndexOffset(0), this._map.removeLayer(a._spiderLeg), delete a._spiderLeg)
- }
- })
- })(this);
- (function (c) {
- c.fn.hasScrollBar = function () {
- return this.get(0).scrollHeight > this.height()
- };
- c.fn.lionbars = function (h) {
- function S(a) {
- var b = c(a);
- if (i || j) b.find(".lb-wrap").on("scroll", function () {
- b.find(".lb-v-scrollbar-slider").css({
- top: -c(this).scrollTop() / b.attr("vratio")
- });
- b.find(".lb-h-scrollbar-slider").css({
- left: -c(this).scrollLeft() / b.attr("hratio")
- });
- if (b.find(".lb-v-scrollbar").height() == parseInt(b.find(".lb-v-scrollbar-slider").css("top")) + b.find(".lb-v-scrollbar-slider").height() && "function" ==
- typeof h.reachedBottom && !L) {
- L = !0;
- var a = c(this);
- h.reachedBottom.apply(c(this).children(".lb-content"), [function () {
- r(c(a).parent(), {
- height: c(a).children(".lb-content").get(0).scrollHeight,
- width: c(a).children(".lb-content").get(0).scrollWidth
- });
- y(c(a).parent());
- z(c(a).parent());
- A(c(a).parent());
- B();
- L = !1
- }])
- }
- b.find(".lb-h-scrollbar").width() == parseInt(b.find(".lb-h-scrollbar-slider").css("left")) + b.find(".lb-h-scrollbar-slider").width() && "function" == typeof h.reachedRight && !M && (M = !0, a = c(this), h.reachedRight.apply(c(this).children(".lb-content"), [function () {
- r(c(a).parent(), {
- height: c(a).children(".lb-content").get(0).scrollHeight,
- width: c(a).children(".lb-content").get(0).scrollWidth
- });
- y(c(a).parent());
- z(c(a).parent());
- A(c(a).parent());
- B();
- M = !1
- }]))
- });
- i && (b.find(".lb-v-scrollbar-slider").mousedown(function (a) {
- T = a.pageY;
- o = !0;
- C = c(this);
- f = b.find(".lb-wrap");
- D = f.parent().attr("vratio");
- E = C.position().top;
- return !1
- }), b.find(".lb-v-scrollbar").mousedown(function (a) {
- c(a.target).hasClass("lb-v-scrollbar-slider") || b.find(".lb-wrap").scrollTop((a.pageY -
- c(this).offset().top) * Math.abs(b.attr("vratio")) - c(this).find(".lb-v-scrollbar-slider").height() / 2);
- return !1
- }));
- j && (b.find(".lb-h-scrollbar-slider").mousedown(function (a) {
- U = a.pageX;
- p = !0;
- C = c(this);
- f = b.find(".lb-wrap");
- D = f.parent().attr("hratio");
- E = C.position().left;
- return !1
- }), b.find(".lb-h-scrollbar").mousedown(function (a) {
- c(a.target).hasClass("lb-h-scrollbar-slider") || b.find(".lb-wrap").scrollLeft((a.pageX - c(this).offset().left) * Math.abs(b.attr("hratio")) - c(this).find(".lb-h-scrollbar-slider").width() /
- 2);
- return !1
- }));
- if ((i || j) && autohide) b.find(".lb-v-scrollbar, .lb-h-scrollbar").hide(), b.hover(function () {
- c(this).data("hover", !0);
- b.find(".lb-v-scrollbar, .lb-h-scrollbar").fadeIn(150)
- }, function () {
- c(this).data("hover", !1);
- b.find(".lb-v-scrollbar, .lb-h-scrollbar").fadeOut(150)
- })
- }
- function A(a) {
- V = (k - c(a).find(".lb-wrap").get(0).scrollHeight - F - G) / (s - l);
- W = (m - c(a).find(".lb-wrap").get(0).scrollWidth - H - I) / (t - n);
- a = c(a);
- a.attr("vratio", V);
- a.attr("hratio", W)
- }
- function z(a) {
- var a = c(a),
- b, d;
- 0 != a.find(".lb-v-scrollbar").length &&
- (b = 20, d = k - a.find(".lb-v-scrollbar").height(), d = k - d - b, l = Math.round(k * d / J), l = l < b ? b : l);
- 0 != a.find(".lb-h-scrollbar").length && (b = 20, d = m - a.find(".lb-h-scrollbar").width(), d = m - d - b, n = Math.round(m * d / N), n = n < b ? b : n);
- a.find(".lb-v-scrollbar-slider").css({
- height: l
- });
- a.find(".lb-h-scrollbar-slider").css({
- width: n
- })
- }
- function B() {
- O = P = 0;
- i = j = !1;
- t = s = n = l = K = Q = k = m = N = J = I = G = H = F = u = v = w = x = 0
- }
- function y(a) {
- a = c(a);
- i && j ? (s = a.height() - 12, t = a.width() - 12) : (s = a.height() - 4, t = a.width() - 4);
- a.find(".lb-v-scrollbar").css({
- height: s
- });
- a.find(".lb-h-scrollbar").css({
- width: t
- })
- }
- function X(a, b, d) {
- a = c(a);
- if (b || d) a.css({
- overflow: "hidden"
- }), d = a.find(".lb-wrap"), b = c(a), d = c(d), b.css({
- padding: 0
- }), d.css({
- "padding-top": x + "px",
- "padding-left": w + "px",
- "padding-bottom": v + "px",
- "padding-right": u + "px"
- }), b = c(a), b.css({
- width: b.width() + w + u,
- height: b.height() + x + v
- }), b = a.find(".lb-wrap"), a = c(a), b = c(b), a.css({
- position: "relative"
- }), b.css({
- width: a.width() + P - w - u,
- height: a.height() + O - x - v
- })
- }
- function R(a) {
- a = c(a);
- j = i = !1;
- if (a.find(".lb-v-scrollbar-slider").length) return !1;
- var b = c(a);
- x = parseInt(b.css("padding-top").replace("px",
- ""));
- w = parseInt(b.css("padding-left").replace("px", ""));
- v = parseInt(b.css("padding-bottom").replace("px", ""));
- u = parseInt(b.css("padding-right").replace("px", ""));
- b = c(a);
- F = parseInt(b.css("border-top-width").replace("px", ""));
- I = parseInt(b.css("border-right-width").replace("px", ""));
- G = parseInt(b.css("border-bottom-width").replace("px", ""));
- H = parseInt(b.css("border-left-width").replace("px", ""));
- var b = a.css("overflow-y"),
- d = a.css("overflow-x");
- a.css({
- overflow: "hidden"
- });
- "hidden" != b && a.get(0).scrollHeight >
- a.get(0).clientHeight && (i = !0);
- "hidden" != d && a.get(0).scrollWidth > a.get(0).clientWidth && (j = !0);
- a.css({
- overflow: "auto"
- });
- if (i || j) return !0
- }
- function r(a, b, d) {
- var e = c(a).get(0);
- d && (e = c(e).find(".lb-wrap").get(0));
- J = "undefined" != typeof b && !1 != b ? b.height : e.scrollHeight;
- N = "undefined" != typeof b && !1 != b ? b.width : e.scrollWidth;
- K = e.clientHeight;
- Q = e.clientWidth;
- k = e.offsetHeight;
- m = e.offsetWidth;
- b = c(a);
- b = c(b);
- b.css({
- overflow: "auto"
- });
- P = m - Q - H - I;
- b.css({
- overflow: "hidden"
- });
- a = c(a);
- a = c(a);
- a.css({
- overflow: "auto"
- });
- O = k - K -
- F - G;
- a.css({
- overflow: "hidden"
- })
- }
- h = h || {};
- autohide = h.autohide;
- var p = !1,
- o = !1,
- C = 0,
- f = 0,
- U, T, Y, Z, D, E, L = !1,
- M = !1,
- g = c(this),
- q = 0,
- P = 0,
- O = 0,
- j = !1,
- i = !1,
- x = 0,
- w = 0,
- v = 0,
- u = 0,
- F = 0,
- I = 0,
- G = 0,
- H = 0,
- J = 0,
- N = 0,
- m = 0,
- k = 0,
- Q = 0,
- K = 0,
- V = 0,
- W = 0,
- l = 0,
- n = 0,
- s = 0,
- t = 0;
- this.mainLoop = function () {
- for (var a = 0; void 0 !== g[a]; a++)
- if (R(g[a]) && !c(g[a]).hasClass("nolionbars")) {
- target = g[a];
- r(target);
- var b = i,
- d = j,
- e = c(target),
- f = e.attr("id"),
- h = 0;
- void 0 !== f ? (e.wrapInner('<div class="lb-wrap" id="lb-wrap-' + q + "-" + f + '"></div>'), h = c("#lb-wrap-" + q + "-" + f)) : (e.wrapInner('<div class="lb-wrap" id="lb-wrap-' +
- q + '"></div>'), h = c("#lb-wrap-" + q));
- h.wrapInner('<div class="lb-content"></div>');
- b && (e.prepend('<div class="lb-v-scrollbar"></div>'), e.find(".lb-v-scrollbar").append('<div class="lb-v-scrollbar-slider"></div>'));
- d && (e.prepend('<div class="lb-h-scrollbar"></div>'), e.find(".lb-h-scrollbar").append('<div class="lb-h-scrollbar-slider"></div>'));
- q += 1;
- X(target, i, j);
- y(target);
- z(target);
- A(target);
- S(target);
- B()
- }
- };
- this.mainLoop();
- this.Update = function () {
- for (var a = 0; void 0 !== g[a]; a++) R(g[a]) && !c(g[a]).hasClass("nolionbars") &&
- (target = g[a], r(target, !1, !0), X(target, i, j), y(target), z(target), A(target), S(target), B())
- };
- this.scrollToBottom = function () {
- for (var a = 0; void 0 !== g[a]; a++)
- if (R(g[a]) && !c(g[a]).hasClass("nolionbars")) {
- target = g[a];
- r(target, !1, !0);
- var b = c(target).find(".lb-wrap"),
- d = b.parent().attr("vratio"),
- d = (J - K) * Math.abs(d);
- b.scrollTop(d)
- }
- };
- c(document).mousemove(function (a) {
- if (p || o) {
- f.parent().find(".lb-v-scrollbar, .lb-h-scrollbar").show();
- if (o) Z = a.pageY, f.scrollTop((E + Z - T) * Math.abs(D));
- if (p) Y = a.pageX, f.scrollLeft((E +
- Y - U) * Math.abs(D))
- }
- });
- c(document).mouseup(function () {
- if (p || o) f.parent().find(".lb-v-scrollbar, .lb-h-scrollbar").fadeOut(150), o && (o = !1), p && (p = !1)
- });
- return this.each(function () {})
- }
- })(jQuery);
- if (!IGN) var IGN = {};
- if (!IGN.Mixins) IGN.Mixins = {};
- IGN.Mixins.MapsAPI = {
- API: {
- ENDPOINT: {
- TYPES: {
- action: "get_marker_types",
- method: "GET",
- dataType: "jsonp",
- path: "api"
- },
- MAPS: {
- action: "get_maps",
- method: "GET",
- dataType: "jsonp",
- path: "api"
- },
- MARKERS: {
- GET: {
- action: "get_markers",
- method: "GET",
- dataType: "jsonp",
- path: "api"
- },
- PUT: {
- action: "update_marker",
- method: "GET",
- dataType: "jsonp",
- path: "api"
- },
- POST: {
- action: "create_marker",
- method: "GET",
- dataType: "jsonp",
- path: "api"
- },
- DELETE: {
- action: "delete_marker",
- method: "GET",
- dataType: "jsonp",
- path: "api"
- },
- PENDING: {
- GET: {
- action: "pending_markers",
- method: "GET",
- dataType: "jsonp",
- path: "api"
- },
- DECLINE: {
- action: "decline_pending_marker",
- method: "GET",
- dataType: "jsonp",
- path: "api"
- },
- ACCEPT: {
- action: "accept_pending_marker",
- method: "GET",
- dataType: "jsonp",
- path: "api"
- }
- }
- },
- WIKI: {
- action: "get_wiki_content",
- method: "GET",
- dataType: "jsonp",
- path: "wikiapi"
- },
- WIKI_PAGE: {
- action: "search_wiki_pages",
- method: "GET",
- dataType: "jsonp",
- path: "wikilookup"
- },
- SEARCH: {
- action: "search",
- method: "GET",
- dataType: "jsonp",
- path: "api"
- }
- }
- },
- proxyUrl : "http://www.ign.com/maps/",
- callApi: function (b, a, c) {
- var url;
- a["do"] = b.action;
- if (!a.objectSlug) a.objectSlug = this.metadata.objectSlug;
- if (!a.mapSlug) a.mapSlug = this.metadata.mapSlug;
- if(b.action == 'get_markers') {
- url = 'http://tv.duowan.com/s/ignmap/maker/'+this.metadata.mapSlug+'.js'
- jQuery.ajax({
- type: b.method,
- dataType: b.dataType,
- jsonpCallback: 'jsonpMapMarkerCallback',
- url: url,
- data: a,
- success: function (a) {
- c.call(this, a)
- },
- error: function (a, b, c) {
- console.log(a);
- console.log(b);
- console.log(c)
- }
- })
- } else {
- url = this._proxyUrl() + b.path;
- jQuery.ajax({
- type: b.method,
- dataType: b.dataType,
- url: url,
- data: a,
- success: function (a) {
- c.call(this, a)
- },
- error: function (a, b, c) {
- console.log(a);
- console.log(b);
- console.log(c)
- }
- })
- }
- },
- _proxyUrl: function () {
- return this.proxyUrl ? this.proxyUrl : "ign.com".indexOf(window.location.hostname) ? this.proxyUrl = "http://" + window.location.hostname.replace("widgets.", "www.").replace(".docs.", ".") + "/maps/" : "http://www.ign.com/maps/"
- }
- };
- if (!IGN) var IGN = {};
- if (!IGN.Mixins) IGN.Mixins = {};
- IGN.Mixins.Icons = {
- createMarkerIcon: function (a) {
- var b = "",
- c;
- a && (a.badges && (b = '<span class="badge">' + a.badges + "</span>"), a.iconUrl && (c = {
- iconSize: a.iconSize,
- iconAnchor: a.iconAnchor,
- popupAnchor: a.popupAnchor,
- html: b + '<img src="' + a.iconUrl + '" width="' + a.iconSize[0] + '" height="' + a.iconSize[1] + '" />'
- }));
- a = {
- iconSize: [36, 46],
- iconAnchor: [18, 42],
- className: "single-div-icon",
- html: b + '<img src="http://oyster.ignimgs.com/ignmedia/wikimaps/resources/pin-default.png" />',
- popupAnchor: [0, -42]
- };
- L.Util.extend(a, c);
- return new L.DivIcon(a)
- },
- createDefaultClusterIcon: function (a) {
- return new L.DivIcon({
- className: a && a.retina ? "cluster-div-icon-retina" : "cluster-div-icon",
- iconSize: [36, 47],
- iconAnchor: [18, 42]
- })
- }
- };
- if (!IGN) var IGN = {};
- if (!IGN.Mixins) IGN.Mixins = {};
- IGN.Mixins.Types = {
- _bindTypesEvents: function () {
- this.on("loadtypes", function (d) {
- this.loadMarkersForTypes(d)
- })
- },
- initTypes: function (d) {
- this._bindTypesEvents();
- var a = this,
- e = {
- retina: this.options.retina,
- clusters: {
- enabled: this.options.clusters.enabled,
- clusterRadius: this.options.clusters.clusterRadius,
- disableClusteringAtZoom: this.options.minZoom
- }
- },
- c;
- this.markers = {};
- this.types = {};
- jQuery.each(d, function (d, b) {
- if (b.parentTypeSlug) b.parentType = a.types[b.parentTypeSlug];
- if (b.markerCounts && b.markerCounts[a.metadata.mapSlug]) b.markerCount =
- b.markerCounts[a.metadata.mapSlug];
- c = new IGN.Type(b, e);
- c.hasParent() && a.types[c.parentTypeSlug].addChild(c);
- a.types[c.typeSlug] = c
- });
- a.fireEvent("typesloaded")
- },
- loadMarkersForTypes: function (d) {
- var a = [],
- e = {},
- c = this,
- f, b;
- f = d.filterEvent ? d.filterEvent : "filter";
- jQuery.each(d.types, function (c, b) {
- if (1 == d.types.length || "korok-seed" != b.typeSlug) a.push(b.typeSlug), b.loaded = !0
- });
- this.callApi(this.API.ENDPOINT.MARKERS.GET, {
- types: a.join(",")
- }, function (a) {
- jQuery.each(a.data, function (d, a) {
- a.type = c.types[a.metadata.typeSlug];
- if (c.options.moderator) a.displayBadgeCount = !0;
- b = new IGN.Marker([a.location.lat, a.location.lng], a);
- if(c.types[a.metadata.typeSlug]) {
- c.types[a.metadata.typeSlug].addMarker(b);
- c.markers[a.metadata.markerSlug] = b;
- c.overlayFilter.addMarker(b)
- }
- });
- if (d.parentType) e.type = d.parentType;
- c.fireEvent(f, e)
- })
- }
- };
- if (!IGN) var IGN = {};
- if (!IGN.Mixins) IGN.Mixins = {};
- IGN.Mixins.Maps = {
- relatedMaps: function (a) {
- if (this.options.madeAdditionalMapsCall) a.call(this, this._maps);
- else {
- var b = this;
- this._maps = [];
- this.options.madeAdditionalMapsCall = !1;
- this.callApi(this.API.ENDPOINT.MAPS, {}, function (c) {
- b._maps = c.data;
- b.options.madeAdditionalMapsCall = !0;
- a && a.call(this, b._maps)
- })
- }
- }
- };
- if (!IGN) var IGN = {};
- if (!IGN.Mixins) IGN.Mixins = {};
- IGN.Mixins.Markers = {
- activateMarker: function (a) {
- var b = this,
- c;
- this.markers[a.metadata.markerSlug] && this.markers[a.metadata.markerSlug]._map ? this.markers[a.metadata.markerSlug].fireEvent("click") : loadingInterval = setInterval(function () {
- if (b.markers[a.metadata.markerSlug]) b.markers[a.metadata.markerSlug]._map ? (b.markers[a.metadata.markerSlug].fireEvent("click"), clearInterval(loadingInterval)) : (c = b.markers[a.metadata.markerSlug].location, b.setView([c.lat, c.lng], b.getZoom()))
- }, 100)
- }
- };
- if (!IGN) var IGN = {};
- IGN.Type = L.Class.extend({
- includes: IGN.Mixins.Icons,
- initialize: function (a, b) {
- this.children = [];
- this.loaded = !1;
- this._layerGroup = new L.LayerGroup;
- if (!a.markerCount) a.markerCount = 0;
- L.Util.extend(this, a);
- if (b && b.retina && this.legend && this.legend.retinaUrl) this.legend.url = this.legend.retinaUrl;
- if (b && b.retina && this.markerIcon && this.markerIcon.retinaUrl) this.markerIcon.url = this.markerIcon.retinaUrl;
- this.setTopLevelMarkerIcon()
- },
- hasChildren: function () {
- return 0 < this.children.length ? !0 : !1
- },
- hasParent: function () {
- return this.hasOwnProperty("parentTypeSlug") ?
- !0 : !1
- },
- addChild: function (a) {
- this.children.push(a)
- },
- allChildren: function (a) {
- jQuery.each(this.children, function (b, c) {
- 0 < c.children.length && c.allChildren(a);
- a.call(this, c)
- })
- },
- eachChild: function (a) {
- jQuery.each(this.children, function (b, c) {
- a.call(this, c)
- })
- },
- eachParent: function (a) {
- this.parentType && (a.call(this, this.parentType), this.parentType.eachParent(a))
- },
- setTopLevelMarkerIcon: function () {
- if (!(this.markerIcon && null != this.markerIcon.url)) {
- var a = this;
- this.hasParent() && this.eachParent(function (b) {
- if (b.markerIcon &&
- null != b.markerIcon.url) a.markerIcon = b.markerIcon
- })
- }
- },
- addMarker: function (a) {
- this._layerGroup.addLayer(a);
- this.markerCount++;
- this.eachParent(function () {
- this.markerCount++
- })
- },
- removeMarker: function (a) {
- this._layerGroup.removeLayer(a);
- this.markerCount--;
- this.eachParent(function () {
- this.markerCount--
- })
- },
- createIcon: function (a) {
- var b = {};
- if (this.markerIcon) b.iconUrl = this.markerIcon.url, b.iconSize = [this.markerIcon.width, this.markerIcon.height], b.iconAnchor = [this.markerIcon.anchorX, this.markerIcon.anchorY], b.popupAnchor = [0, -this.markerIcon.anchorY];
- if (a && 0 != a) b.badges = a;
- return this.createMarkerIcon(b)
- },
- legendUrl: function () {
- var a;
- this.legend ? a = this.legend.url : this.eachParent(function (b) {
- if (b.legend) a = b.legend.url
- });
- return a
- }
- });
- if (!IGN) var IGN = {};
- IGN.Marker = L.Marker.extend({
- options: {
- exists: !0,
- displayBageCount: !1
- },
- includes: IGN.Mixins.MapsAPI,
- initialize: function (a, b) {
- if (!b.metadata) b.metadata = {};
- if (!b.location) b.location = {
- lat: a.lat,
- lng: a.lng
- };
- L.Util.extend(this, b);
- L.Marker.prototype.initialize.call(this, a, b);
- this.updateIcon();
- this._createStatics();
- this._bindEvents();
- this.state = this.STATES.NORMAL
- },
- updateIcon: function () {
- var a = this.metadata.pendingCount,
- a = this.displayBadgeCount ? a : 0;
- try{
- this.setIcon(this.type.createIcon(a))
- } catch(e) {}
- },
- enableDragging: function () {
- this.dragging.enable()
- },
- disableDragging: function () {
- this.dragging.disable()
- },
- enableEditing: function () {
- this._replicate();
- this.state = this.STATES.EDIT;
- this.closePopup();
- this.enableDragging();
- this.fireEvent("click")
- },
- disableEditing: function () {
- this.state = this.STATES.NORMAL;
- this.closePopup();
- this._restoreFromReplicate();
- this.options.exists && (this.updateIcon(), this.setLatLng([this.location.lat, this.location.lng]), this.disableDragging(), this.fireEvent("click"))
- },
- setType: function (a) {
- this.type = a;
- this.metadata.typeSlug = a.typeSlug;
- this.updateIcon(a.createIcon())
- },
- duplicate: function () {
- var a = {
- metadata: {
- markerName: this.metadata.markerName,
- objectSlug: this.metadata.objectSlug,
- mapSlug: this.metadata.mapSlug,
- typeSlug: this.metadata.typeSlug,
- wikiPage: this.metadata.wikiPage
- },
- location: {
- lat: this.getLatLng().lat,
- lng: this.getLatLng().lng
- },
- type: this.type,
- exists: !1
- };
- return new IGN.Marker(new L.LatLng(this.getLatLng().lat, this.getLatLng().lng), a)
- },
- serviceCallSave: function () {
- var a = this._map,
- b, c;
- c = this.options.exists ? this.API.ENDPOINT.MARKERS.PUT : this.API.ENDPOINT.MARKERS.POST;
- b = {
- objectSlug: this.metadata.objectSlug,
- markerSlug: this.metadata.markerSlug,
- lat: this.getLatLng().lat,
- lng: this.getLatLng().lng,
- wikiPage: this.metadata.wikiPage,
- typeSlug: this.metadata.typeSlug,
- createdBy: this.metadata.createdBy,
- updatedBy: this.metadata.updatedBy,
- markerName: this.metadata.markerName,
- mapref: this.metadata.mapRef
- };
- this.callApi(c, b, function () {});
- this.options.exists ? a.fireEvent("markerupdate", this) : a.fireEvent("markercreate", this);
- a.overlayFilter && a.overlayFilter.removeMarker(this);
- this.type.removeMarker(this);
- this.type = a.types[this.metadata.typeSlug];
- this.closePopup();
- this.state = this.STATES.NORMAL;
- this.type.addMarker(this);
- this.disableDragging();
- a.overlayFilter.addMarker(this);
- a.fireEvent("changefilter", this.type);
- this.options.exists = !0
- },
- serviceCallDelete: function () {
- var a = this._map;
- a.fireEvent("markerdelete", this);
- this._removeFromMap();
- a.fireEvent("redraw");
- this.callApi(this.API.ENDPOINT.MARKERS.DELETE, {
- markerSlug: this.metadata.markerSlug
- }, function () {})
- },
- _createStatics: function () {
- this.STATES = {
- NORMAL: 1,
- EDIT: 2,
- PENDING: 3,
- CLUSTER: 4
- }
- },
- _removeFromMap: function () {
- var a =
- this._map;
- this.type.removeMarker(this);
- a.overlayFilter.removeMarker(this)
- },
- _bindEvents: function () {
- var a, b, c;
- if ("undefined" !== typeof IGN.PopupContent) this.on("click", function () {
- var d = !1;
- switch (this.state) {
- case this.STATES.EDIT:
- c = IGN.PopupContent.editContent;
- d = !1;
- break;
- default:
- c = IGN.PopupContent.content, d = !0
- }
- this._map.panTo(this.getLatLng());
- this.bindPopup(c(this), {
- autoPanPadding: new L.Point(5, 100),
- autoPan: !0
- }).openPopup();
- if (this.wikiContent) IGN.PopupContent.updateWikiContent(this, this.wikiContent);
- else if (d && "undefined" != typeof this.metadata.wikiPage) {
- a = this;
- a.metadata.wikiPage = a.metadata.wikiPage.replace("edit/", "").replace("empty/", "");
- b = {
- wiki: a.metadata.objectSlug,
- page: a.metadata.wikiPage
- };
- if (a.metadata.createdBy) b.createdBy = a.metadata.createdBy;
- if (a.metadata.updatedBy) b.updatedBy = a.metadata.updatedBy;
- // this.callApi(this.API.ENDPOINT.WIKI, b, function (b) {
- // a.wikiContent = IGN.PopupContent.wikiContent(a, b);
- // a._popup._update()
- // })
- a.wikiContent = IGN.PopupContent.wikiContent(a, b);
- a._popup._update()
- } else this.wikiContent = IGN.PopupContent.wikiContent(this, "");
- this._map.fireEvent("markerclick", {
- marker: this
- });
- this._popup._update()
- })
- },
- _replicate: function () {
- if (this.options.exists) this._replicaMarkerName = this.metadata.markerName, this._replicaWikiPage = this.metadata.wikiPage, this._replicaLat = this.getLatLng().lat, this._replicaLng = this.getLatLng().lng, this._replicaTypeSlug = this.metadata.typeSlug
- },
- _restoreFromReplicate: function () {
- if (this.options.exists) this.metadata.markerName = this._replicaMarkerName, this.metadata.wikiPage = this._replicaWikiPage, this.location.lat = this._replicaLat, this.location.lng =
- this._replicaLng, this.metadata.typeSlug = this._replicaTypeSlug, this.type = this._map.types[this.metadata.typeSlug]
- }
- });
- if (!IGN) var IGN = {};
- IGN.PendingMarker = IGN.Marker.extend({
- include: IGN.Mixins.API,
- options: {
- pendingAction: "edit"
- },
- initialize: function (a, b) {
- L.Util.extend(this.options, b);
- IGN.Marker.prototype.initialize.call(this, a, b)
- },
- compareTo: function (a) {
- var b = {};
- if (this.metadata.markerName != a.metadata.markerName) b.markerName = a.metadata.markerName;
- if (this.metadata.wikiPage != a.metadata.wikiPage) b.wikiPage = a.metadata.wikiPage;
- if (this.metadata.typeSlug != a.metadata.typeSlug) b.typeSlug = a.metadata.typeSlug;
- if (this.metadata.mapRef != a.metadata.mapRef) b.mapRef =
- a.metadata.mapRef ? a.metadata.mapRef : "None";
- if (this.location.lat != a.location.lat || this.location.lng != a.location.lng) b.location = a.location;
- return b
- },
- decline: function () {
- var a = this._map;
- a.removeLayer(this);
- this._originalMarker && (this._originalMarker.metadata.pendingCount--, this._originalMarker.updateIcon());
- this.serviceCallDecline();
- this._finalizeAcceptOrDecline(a)
- },
- accept: function () {
- var a = this._map;
- this.options.pendingAction == this.PENDING_STATES.EDIT ? this._acceptEdit() : this.options.pendingAction == this.PENDING_STATES.CREATE ?
- this._acceptCreate() : this.options.pendingAction == this.PENDING_STATES.DELETE && this._acceptDelete();
- this._finalizeAcceptOrDecline(a)
- },
- serviceCallDecline: function () {
- this.callApi(this.API.ENDPOINT.MARKERS.PENDING.DECLINE, {
- pendingUUID: this.pendingMarkerUUID
- }, function () {})
- },
- _createStatics: function () {
- this.PENDING_STATES = {
- CREATE: "create",
- EDIT: "edit",
- DELETE: "delete"
- };
- IGN.Marker.prototype._createStatics.call(this)
- },
- _bindEvents: function () {
- var a;
- this.on("click", function () {
- a = this.options.pendingAction == this.PENDING_STATES.DELETE ?
- IGN.PopupContent.pendingDelete : IGN.PopupContent.editContent;
- if (this._originalMarker) this._differences = this.compareTo(this._originalMarker);
- this.bindPopup(a(this)).openPopup();
- this._map.fireEvent("markerclick", {
- marker: this
- })
- })
- },
- _acceptEdit: function () {
- this._originalMarker.metadata.markerName = this.metadata.markerName;
- this._originalMarker.metadata.wikiPage = this.metadata.wikiPage;
- this._originalMarker.metadata.typeSlug = this.metadata.typeSlug;
- this._originalMarker.type = this.type;
- this._originalMarker.metadata.mapRef =
- this.metadata.mapRef;
- this._originalMarker.metadata.updatedBy = this.metadata.updatedBy;
- this._originalMarker.setLatLng(this.getLatLng());
- this._originalMarker.serviceCallSave();
- this._originalMarker.metadata.pendingCount--;
- this._originalMarker.updateIcon();
- this._originalMarker.state = this._originalMarker.STATES.NORMAL;
- this.serviceCallDecline()
- },
- _acceptCreate: function () {
- var a = {
- exists: !1
- },
- b = this._map;
- a.type = this.type;
- a.metadata = this.metadata;
- a.metadata.pendingCount = 0;
- a.metadata.createdBy = this.metadata.createdBy;
- a.location = this.location;
- a = new IGN.Marker(this.getLatLng(), a);
- b.addLayer(a);
- a.serviceCallSave();
- this.serviceCallDecline()
- },
- _acceptDelete: function () {
- var a = this._map;
- this._originalMarker.serviceCallDelete();
- this.serviceCallDelete();
- a.fireEvent("disablemoderation")
- },
- _finalizeAcceptOrDecline: function (a) {
- this._originalMarker && 0 >= this._originalMarker.metadata.pendingCount && (a.fireEvent("changefilter", this._originalMarker.type), a.fireEvent("disablemoderation"), a.fireEvent("redraw"));
- this._moderationListLink &&
- jQuery(this._moderationListLink).slideUp("fast");
- a.removeLayer(this)
- }
- });
- if (!IGN) var IGN = {};
- IGN.MarkerClusterGroup = L.MarkerClusterGroup.extend({
- includes: IGN.Mixins.Icons,
- initialize: function (a) {
- var c = this,
- b = {
- zoomToBoundsOnClick: !1,
- showCoverageOnHover: !1,
- spiderfyOnMaxZoom: !1,
- disableClusteringAtZoom: 3,
- maxClusterRadius: 80,
- animateAddingMarkers: !1,
- iconCreateFunction: function () {
- return new c.createDefaultClusterIcon(c.options)
- }
- };
- L.Util.extend(b, a);
- L.Util.extend(this, b);
- L.MarkerClusterGroup.prototype.initialize.call(this, b)
- },
- removeLayer: function (a) {
- if (!a.__parent) return this;
- this._unspiderfy && (this._unspiderfy(),
- this._unspiderfyLayer(a));
- this._removeLayer(a, !0);
- a._icon && (L.FeatureGroup.prototype.removeLayer.call(this, a), a.setOpacity(1));
- return this
- }
- });
- if (!IGN) var IGN = {};
- if (!IGN.PopupContent) IGN.PopupContent = {};
- IGN.PopupContent.clusterContent = function (b) {
- var i = 0,
- c, j, k, d, a, e, f, l, g, h;
- e = b.layer;
- f = e._map;
- a = e.getAllChildMarkers();
- b = L.DomUtil.create("div", "cluster-popup-holder");
- c = L.DomUtil.create("h3", "cluster-headline", b);
- l = a[0].type.legendUrl();
- g = {
- count: a.length,
- data: []
- };
- jQuery.each(a, function (a, b) {
- g.data.push({
- metadata: b.metadata
- })
- });
- h = escape(JSON.stringify(g));
- jQuery(c).html('<img src="' + l + '" class="legend-icon"><a href="mapsIphoneClusterJson://' + h + '" class="leaflet-popup-iphone-more"></a><span class="cluster-title">' +
- a.length + ' markers at this location:</span><span class="cluster-title-ios"><a href="mapsIphoneClusterJson://' + h + '">' + a.length + " markers at this location</span>");
- j = L.DomUtil.create("ul", "marker-list", b);
- jQuery.each(a, function (a, b) {
- k = L.DomUtil.create("li", null, j);
- d = L.DomUtil.create("a", null, k);
- jQuery(d).html(b.metadata.markerName);
- jQuery(d).data("marker", b);
- jQuery(d).click(function (a) {
- var b = jQuery(this).data("marker");
- f.fireEvent("changefilter", b.type);
- f.fireEvent("activatemarker", f.markers[b.metadata.markerSlug]);
- a.stopPropagation();
- a.preventDefault()
- });
- i++;
- if (3 <= i) return !1
- });
- a = a.length - 3;
- 0 < a && (c = L.DomUtil.create("div", "cluster-desc", b), jQuery(c).html("\u2026and " + a + " others."));
- c = L.DomUtil.create("a", "btn btn-inverse zoom-in-btn", b);
- jQuery(c).html("Zoom In");
- a = L.DomUtil.create("span", "see-all-markers", b);
- jQuery(a).html(" to see all markers.");
- jQuery(c).click(function (a) {
- e.zoomToBounds();
- a.stopPropagation();
- a.preventDefault()
- });
- return b
- };
- if (!IGN) var IGN = {};
- if (!IGN.PopupContent) IGN.PopupContent = {};
- IGN.PopupContent.content = function (b) {
- var cur = b.metadata.markerSlug;
- var mdata = b._map.markers;
- var curData = mdata[cur] || {};
- var d = b._map,
- a, c, e, f;
- e = "http://www.ign.com/wikis/" + b.metadata.objectSlug + "/" + b.metadata.wikiPage;
- a = L.DomUtil.create("div", "popup-holder");
- b._map.options.editable && IGN.PopupContent._editButtons(a, b);
- c = L.DomUtil.create("span", "headline", a);
-
- wikicontent = L.DomUtil.create("div", b.metadata.markerSlug + "-wikicontent interactivemap-wikicontent", a);
- var ltitle = curData.metadata.title || b.metadata.markerName;
- f = b.type.legendUrl();
- jQuery(c).html('<img src="' + f + '" class="legend-icon"><a href="' + e + '" class="leaflet-popup-iphone-more"></a><div style="color: #FFF!important;font-size: 14px;font-weight: bold;margin-bottom: 25px;text-transform: uppercase;">' + ltitle + "</div>");
- L.DomUtil.create("div", "interactivemap-popupLoading", wikicontent);
- b.metadata.mapRef;
- d.options.moderator && (duplicateButton = L.DomUtil.create("a", "duplicate-button", a), jQuery(duplicateButton).html('<i class="icon icon-white icon-plus-sign"></i> Duplicate this marker'),
- jQuery(duplicateButton).on("click", function (a) {
- var c = b.duplicate();
- c.addTo(d);
- c.enableEditing();
- a.preventDefault();
- a.stopPropagation()
- }));
- L.DomUtil.create("div", "clearfix", a);
- return a
- };
- IGN.PopupContent._editButtons = function (b, d) {
- var a;
- a = L.DomUtil.create("div", "edit-controls", b);
- a = L.DomUtil.create("a", "button-edit", a);
- L.DomUtil.create("i", "icon icon-white icon-edit", a);
- jQuery(a).attr("title", "Edit").tooltip({
- placement: "top"
- });
- jQuery(a).click(function (a) {
- d.enableEditing();
- jQuery(this).tooltip("hide");
- a.preventDefault();
- a.stopPropagation()
- })
- };
- if (!IGN) var IGN = {};
- if (!IGN.PopupContent) IGN.PopupContent = {};
- IGN.PopupContent.editContent = function (d) {
- var a, e;
- a = L.DomUtil.create("div", "popup-holder");
- e = L.DomUtil.create("h5", "editing-headline", a);
- d.state == d.STATES.PENDING ? (headlineContent = "Pending " + d.options.pendingAction, "create" == d.options.pendingAction && "undefined" != typeof d.createdBy.name ? headlineContent += " by " + d.createdBy.name : "edit" == d.options.pendingAction && "undefined" != typeof d.updatedBy.name && (headlineContent += " by " + d.updatedBy.name), jQuery(e).html(headlineContent)) : d.metadata && d.metadata.markerName ?
- jQuery(e).html("Editing: " + d.metadata.markerName) : jQuery(e).html("新的标记");
- IGN.PopupContent._editForm(a, d);
- return a
- };
- IGN.PopupContent._editForm = function (d, a) {
- var e = a._map,
- c, f, b, j, h, l, g, i, m, q, n, o, k, p;
- c = L.DomUtil.create("form", "edit-form", d);
- f = jQuery('<input type="text" placeholder="输入标记名称">');
- jQuery(f).appendTo(c);
- a.metadata && a.metadata.markerName && jQuery(f).val(a.metadata.markerName);
- a.state == a.STATES.PENDING && a._differences && a._differences.markerName && (h = L.DomUtil.create("span", "help-block marker-difference-label", c), jQuery(h).html('Was "' + a._differences.markerName + '"'));
- h = L.DomUtil.create("label", "label-with-module-selector",
- c);
- jQuery(h).html("选择标记分类");
- p = L.DomUtil.create("div", "category-selector", c);
- h = L.DomUtil.create("div", "ign-leaflet-module", p);
- b = L.DomUtil.create("a", "category-button main-selector", h);
- jQuery(b).html(a.type.typeName);
- L.DomUtil.create("span", "red-arrow", b);
- k = L.DomUtil.create("ul", "dropdown-menu general-dropdown-menu category-field-list", p);
- IGN.PopupContent._typeSelector(b, k, k, e.types, a);
- jQuery(b).click(function (a) {
- jQuery(k).is(":visible") ? jQuery(k).hide() : jQuery(k).show();
- a.preventDefault();
- a.stopPropagation()
- });
- a.state == a.STATES.PENDING && a._differences && a._differences.typeSlug && (b = L.DomUtil.create("span", "help-block marker-difference-label", c), jQuery(b).html('Was "' + a._differences.typeSlug + '"'));
- // b = L.DomUtil.create("label", "label-with-module-selector wiki-label", c);
- // jQuery(b).html("Wiki Page");
- // j = jQuery('<input type="text" class="right-aligned">');
- // jQuery(j).appendTo(c);
- a.metadata && a.metadata.wikiPage && jQuery(j).val(a.metadata.wikiPage);
- a.state == a.STATES.PENDING && a._differences && a._differences.wikiPage && (wikiDifference =
- L.DomUtil.create("span", "help-block marker-difference-label", c), jQuery(wikiDifference).html('Was "' + a._differences.wikiPage + '"'));
- g = L.DomUtil.create("div", "dropdown-menu url-dropdown-menu general-dropdown-menu related-wiki-page-dropdown", d);
- jQuery(j).keyup(function () {
- clearTimeout(i);
- m = jQuery(this).val();
- a.metadata.wikiPage = m;
- q = {
- objectSlug: e.metadata.objectSlug,
- mapSlug: e.metadata.mapSlug,
- lookup: m
- };
- i = setTimeout(function () {
- IGN.Mixins.MapsAPI.callApi(IGN.Mixins.MapsAPI.API.ENDPOINT.WIKI_PAGE, q, function (b) {
- jQuery(g).empty();
- b && b.query && b.query.allpages && (jQuery.each(b.query.allpages, function (b, c) {
- n = L.DomUtil.create("a", null, g);
- jQuery(n).html(c.title);
- jQuery(n).click(function (b) {
- jQuery(j).val(c.title);
- a.metadata.wikiPage = c.title;
- jQuery(g).hide();
- b.preventDefault();
- b.stopPropagation()
- })
- }), o = L.DomUtil.create("a", null, g), jQuery(o).html('<i class="icon icon-white icon-remove"></i> Cancel'), jQuery(o).click(function (a) {
- jQuery(g).hide();
- a.preventDefault();
- a.stopPropagation()
- }), jQuery(g).show())
- })
- }, 200)
- });
- // b = L.DomUtil.create("label",
- // "map-label", c);
- // jQuery(b).html("External map");
- // l = L.DomUtil.create("select", null, c);
- e.relatedMaps(function (b) {
- IGN.PopupContent._mapSelector(l, b, a)
- });
- a.state == a.STATES.PENDING && a._differences && a._differences.mapRef && (b = L.DomUtil.create("span", "help-block marker-difference-label", c), jQuery(b).html('Was "' + a._differences.mapRef + '"'));
- a.state == a.STATES.PENDING && a._differences && a._differences.location && (b = L.DomUtil.create("span", "help-block marker-difference-label", c), jQuery(b).html("Location was lat:" +
- a._differences.location.lat + ", lng:" + a._differences.location.lng + ""));
- L.DomUtil.create("div", "clearfix mb30", c);
- jQuery(f).change(function () {
- a.metadata.markerName = jQuery(this).val()
- });
- jQuery(j).change(function () {
- a.metadata.wikiPage = jQuery(this).val()
- });
- jQuery(h).change(function () {
- a.metadata.typeSlug = jQuery(this).val()
- });
- jQuery(l).change(function () {
- a.metadata.mapRef = jQuery(this).val()
- });
- a.state == a.STATES.EDIT ? (f = L.DomUtil.create("a", "btn", c), jQuery(f).html("取消"), jQuery(f).click(function (b) {
- a.disableEditing();
- a.options.exists || e.removeLayer(a);
- b.preventDefault();
- b.stopPropagation()
- }), a.options.exists && (f = L.DomUtil.create("a", "btn btn-inverse btn-delete", c), jQuery(f).html('<i class="icon icon-white icon-trash"></i>'), jQuery(f).click(function (b) {
- confirm("Are you sure you want to delete this marker?") && a.serviceCallDelete();
- b.preventDefault();
- b.stopPropagation()
- })), f = L.DomUtil.create("a", "btn btn-primary pull-right gray-btn-right-arrow", c), jQuery(f).html(" 保存点标 "), jQuery(f).click(function (b) {
- a.serviceCallSave();
- a.wikiContent = !1;
- b.preventDefault();
- b.stopPropagation()
- })) : a.state == a.STATES.PENDING && (f = L.DomUtil.create("a", "btn btn-danger", c), jQuery(f).html("Decline"), jQuery(f).click(function (b) {
- a.decline();
- b.preventDefault();
- b.stopPropagation()
- }), f = L.DomUtil.create("a", "btn btn-primary pull-right", c), jQuery(f).html("Accept"), jQuery(f).click(function (b) {
- a.accept();
- b.preventDefault();
- b.stopPropagation()
- }));
- jQuery(c).on("submit", function (a) {
- a.preventDefault();
- a.stopPropagation()
- })
- };
- IGN.PopupContent._mapSelector = function (d, a, e) {
- var c;
- c = L.DomUtil.create("option", null, d);
- jQuery(c).html("None");
- "undefined" !== typeof a && jQuery.each(a, function (a, b) {
- if (!b.metadata.status || "published" != b.metadata.status) return !0;
- b.metadata.mapSlug != e.metadata.mapSlug && (jQuery('<option value="' + b.metadata.mapSlug + '">' + b.metadata.mapName + "</option>").appendTo(d), e.metadata.mapRef && e.metadata.mapRef == b.metadata.mapSlug && jQuery(d).val(e.metadata.mapRef))
- })
- };
- IGN.PopupContent._typeSelector = function (d, a, e, c, f) {
- var b;
- b = function (c, h) {
- var e, g, i;
- e = jQuery("<li></li>");
- g = jQuery("<a>" + h.typeName + "</a>");
- f.type.typeSlug == h.typeSlug && (jQuery("a", a).removeClass("active"), g.addClass("active"));
- h.legend && h.legend.url ? (jQuery('<img src="' + h.legend.url + '" />').prependTo(g), g.addClass("icon")) : g.addClass("no-icon");
- h.hasChildren() && jQuery('<span class="icon icon-white icon-chevron-right pull-right"></span>').appendTo(g);
- jQuery('<span class="clearfix"></span>').appendTo(g);
- g.appendTo(e);
- g.data("type", h);
- i = jQuery('<ul class="children"></ul>');
- jQuery(i).appendTo(e);
- h.eachChild(function (a) {
- jQuery(b(i, a)).appendTo(i)
- });
- e.appendTo(c);
- g.click(function (b) {
- var c = jQuery(this).data("type");
- if (c.hasChildren()) {
- var c = jQuery(".children:first", e),
- h = jQuery(".icon:first", g);
- c.is(":visible") ? (c.hide(), h.removeClass("icon-chevron-down").addClass("icon-chevron-right")) : (c.show(), h.removeClass("icon-chevron-right").addClass("icon-chevron-down"))
- } else jQuery("a", a).removeClass("active"),
- g.addClass("active"), jQuery(a).hide(), f.setType(c), f.enableDragging(), jQuery(d).html(c.typeName), L.DomUtil.create("span", "red-arrow", d);
- b.preventDefault();
- b.stopPropagation()
- })
- };
- jQuery.each(c, function (a, c) {
- c.hasParent() || b(e, c)
- })
- };
- if (!IGN) var IGN = {};
- if (!IGN.PopupContent) IGN.PopupContent = {};
- IGN.PopupContent.wikiContent = function (e, a) {
- var cur = e.metadata.markerSlug;
- var mdata = e._map.markers;
- var curData = mdata[cur] || {};
- var f = 0,
- h = 0,
- b, i, c, d, j, k, g;
- c = L.DomUtil.create("div", "internal-container");
- jQuery(c).html('<p>' + (curData.metadata.content ? curData.metadata.content : '') + '</p><img style="width:100%;display:block;margin-bottom:20px;" src="'+ (curData.metadata.pic ? curData.metadata.pic : '') +'"/><div id="video1"></div>');
- if(curData.metadata.vid) {
- var vmap = {};
- vmap[curData.metadata.vid] = {
- place : '#video1',
- tpl : '<div><video id="mainPlayer" width="340" height="191" controls preload="meta" poster="{video_cover}"></video></div>',
- playerOptions : {
- loop : false,
- autoplay : false,
- pauseOtherPlayers : true
- },
- onFinish : function(context){
- }
- }
- new VhuyaPlayerPlacer(vmap);
- }
- // b = L.DomUtil.create("div", "interactivemap-popupDescription", c);
- // jQuery(b).html(a.description);
- // if (0 < a.images || 0 < a.ignVideos || 0 < a.youtubeVideos) L.DomUtil.create("ul", "interactivemap-assetList", c), 0 < a.ignVideos ? (b = L.DomUtil.create("div", "interactivemap-popupVideoContent", c), jQuery('<iframe width="340" height="190" src="http://widgets.ign.com/video/embed/player.html?videoSlug=' + a.ignVideoList[0] +
- // '" scrolling="no" frameborder="0" allowfullscreen=""></iframe>').appendTo(b)) : 0 < a.youtubeVideos ? (b = L.DomUtil.create("div", "interactivemap-popupVideoContent", c), jQuery('<iframe width="340" height="190" src="' + a.youtubeVideoList[0] + '" scrolling="no" frameborder="0" allowfullscreen=""></iframe>').appendTo(b)) : (i = L.DomUtil.create("div", "interactivemap-popupImageContent", c), href = "http://www.ign.com/wikis/" + e.metadata.objectSlug + "/" + e.metadata.wikiPage, jQuery.each(a.imageList, function (a, b) {
- // f++;
- // if (1 >= f) jQuery('<a href="' +
- // href + '" class="interactivemap-popupImage" style="background: #000 url(\'' + b.thumburl + '\') no-repeat center;" target="_top"></a>').appendTo(i);
- // else return !1
- // }));
- // a.relatedPages && 0 < a.relatedPages.length && (b = L.DomUtil.create("strong", "other-pages-headline", c), jQuery(b).html("Related Pages"), j = L.DomUtil.create("ul", "other-pages-list", c), jQuery.each(a.relatedPages, function (b) {
- // k = L.DomUtil.create("li", null, j);
- // g = L.DomUtil.create("a", null, k);
- // jQuery(g).attr("href", "/wikis/" + e.metadata.objectSlug + "/" + a.relatedPages[b]);
- // jQuery(g).html(a.relatedPages[b]);
- // h++;
- // if (6 <= h) return !1
- // }));
- // // b = L.DomUtil.create("div", "social-holder", c);
- // a.createdBy
- // a.updatedBy && (b = L.DomUtil.create("span", "by-user-label", b), jQuery(b).html("Last updated by"), b = L.DomUtil.create("a", "by-user-link", b), jQuery(b).html(a.updatedBy.name),
- // jQuery(b).attr("href", a.updatedBy.url), jQuery(b).attr("target", "_top"));
- IGN.PopupContent.updateWikiContent(e, c);
- return c
- };
- IGN.PopupContent.updateWikiContent = function (e, a) {
- var f = jQuery("." + e.metadata.markerSlug + "-wikicontent");
- 0 < f.length && jQuery(f).empty().append(a)
- };
- if (!IGN) var IGN = {};
- if (!IGN.PopupContent) IGN.PopupContent = {};
- IGN.PopupContent.pendingDelete = function (b) {
- var a, c;
- a = L.DomUtil.create("div", "popup-holder");
- c = L.DomUtil.create("h5", "editing-headline pending-delete", a);
- headlineContent = "Pending delete";
- "undefined" != typeof b.updatedBy.name && (headlineContent += " by " + b.updatedBy.name);
- jQuery(c).html(headlineContent);
- c = L.DomUtil.create("span", "pending-delete-marker-title", a);
- jQuery(c).html(b.metadata.markerName);
- cancelButton = L.DomUtil.create("a", "btn btn-large btn-danger", a);
- jQuery(cancelButton).html("Decline");
- jQuery(cancelButton).click(function (a) {
- b.decline();
- a.preventDefault();
- a.stopPropagation()
- });
- applyButton = L.DomUtil.create("a", "btn btn-primary btn-large pull-right", a);
- jQuery(applyButton).html("Accept");
- jQuery(applyButton).click(function (a) {
- b.accept();
- a.preventDefault();
- a.stopPropagation()
- });
- return a
- };
- if (!IGN) var IGN = {};
- IGN.Map = L.Map.extend({
- includes: IGN.Mixins.MapsAPI,
- initialize: function (c, b, a) {
- var d = {},
- e = this;
- L.Util.extend(this, b);
- this.maxBounds = new L.LatLngBounds(new L.LatLng(0, 0), new L.LatLng(-b.mapInfo.height, b.mapInfo.width));
- d = {
- zoom: 2,
- minZoom: 1,
- maxZoom: b.mapInfo.maxZoom,
- scrollWheelZoom: !0,
- zoomControl: !1,
- center: new L.LatLng(-b.mapInfo.height / 2, b.mapInfo.width / 2),
- crs: L.Util.extend({}, L.CRS, {
- code: "simple",
- projection: L.Projection.LonLat,
- transformation: new L.Transformation(1, 0, -1, 0)
- }),
- worldCopyJump: !1,
- unloadInvisibleTiles: a.unloadInvisibleTiles,
- trackResize: !0,
- attributionControl: !1,
- closePopupOnClick: !1,
- retina: a.retina,
- editable: a.editable,
- moderator: a.moderator,
- filter: a.filter,
- externalLink: a.externalLink,
- clusters: {
- enabled: a.clusters.enabled,
- clusterRadius: a.clusters.clusterRadius,
- disableClusteringAtZoom: a.clusters.disableClusteringAtZoom
- },
- controls: {
- title: a.controls.title,
- fullscreen: a.controls.fullscreen,
- slidingview: a.controls.slidingview,
- search: a.controls.search,
- filters: a.controls.filters,
- addMarker: a.controls.addMarker
- }
- };
- L.Map.prototype.initialize.call(this,
- c, d);
- (new L.Control.Zoom({
- position: "topright"
- })).addTo(this);
- L.tileLayer(b.mapInfo.tilesets[0], {
- continuousWorld: !1,
- noWrap: !0
- }).addTo(this);
- this.on("moveend", function () {
- this._checkBounds()
- });
- jQuery(document).ready(function () {
- jQuery(window).resize(function () {
- e.fireEvent("resize")
- })
- })
- },
- _checkBounds: function () {
- if (!this.maxBounds.contains(this.getCenter())) {
- var c = this.getCenter(),
- b = c.lng,
- c = c.lat,
- a = this.maxBounds.getNorthEast().lng,
- d = this.maxBounds.getNorthEast().lat,
- e = this.maxBounds.getSouthWest().lng,
- f = this.maxBounds.getSouthWest().lat;
- b < e && (b = e);
- b > a && (b = a);
- c < f && (c = f);
- c > d && (c = d);
- this.setView(new L.LatLng(c, b), this.getZoom())
- }
- }
- });
- if (!IGN) var IGN = {};
- IGN.InteractiveMap = IGN.Map.extend({
- includes: IGN.Mixins.Types,
- initialize: function (a, b, c) {
- IGN.Map.prototype.initialize.call(this, a, b, c);
- this._bindEvents();
- this._addControls()
- },
- _bindEvents: function () {
- var a = this;
- this.on("load", this.initTypes(this.mapInfo.types));
- this.on("activatemarker", function (b) {
- a.activateMarker(b)
- });
- this.on("typesloaded", this._zoomIn(mapOptions.zoomIn))
- },
- _addControls: function () {
- var a = {
- display: !0,
- retina: this.options.retina,
- clusters: this.options.clusters
- };
- if (!this.options.controls.filters) a.display = !1;
- this.overlayFilter = new IGN.Control.OverlayFilter(this.types, a);
- this.addControl(this.overlayFilter);
- this.options.controls.fullscreen && this.addControl(new IGN.Control.FullscreenToggle({
- position: "topright"
- }));
- this.options.controls.title && this.addControl(new IGN.Control.MapTitle(this.metadata.mapName));
- this.persistentFilter = new IGN.Control.Persistence;
- this.addControl(this.persistentFilter);
- // 添加是否能加点标权限
- this.addControl(new IGN.Control.MarkerAdder);
- this.options.controls.slidingview &&
- (this.addControl(new IGN.Control.SlidingView), this.on("filter", function (a) {
- this.fireEvent("slidingview", {
- type: a.type
- })
- }));
- this.addControl(new IGN.Control.LoadingIndicator);
- this.fireEvent("hideloadingindicator");
- this.options.controls.search && this.addControl(new IGN.Control.SearchBar);
- if (this.options.moderator) this.moderation = new IGN.Control.Moderation, this.addControl(this.moderation);
- this.options.filter && this.types[this.options.filter] && this.fireEvent("changefilter", this.types[this.options.filter]);
- this.addControl(new IGN.Control.EventTracker);
- if (this.options.externalLink) this.externalLink = new IGN.Control.ExternalLink({
- linkTo: "http://www.ign.com/maps/" + this.metadata.objectSlug + "/" + this.metadata.mapSlug,
- text: "View on IGN"
- }), this.addControl(this.externalLink);
- this.fireEvent("controlsloaded")
- },
- _zoomIn: function (a) {
- !0 == a && this.zoomIn()
- }
- });
- IGN.InteractiveMap.include(IGN.Mixins.Maps);
- IGN.InteractiveMap.include(IGN.Mixins.Markers);
- if (!IGN) var IGN = {};
- if (!IGN.Control) IGN.Control = {};
- IGN.Control.FullscreenToggle = L.Control.extend({
- statics: {
- DISPLAY: {
- NORMALSTATE: 1,
- FULLSTATE: 2
- }
- },
- options: {
- position: "bottomright"
- },
- initialize: function (b) {
- L.Util.setOptions(this, b);
- this.displayState = IGN.Control.FullscreenToggle.DISPLAY.NORMALSTATE
- },
- onAdd: function (b) {
- var a = this,
- c;
- c = L.DomUtil.create("a", "fullscreen-container btn");
- L.DomUtil.create("span", "fullscreen-icon go-fullscreen", c);
- this.containerId = b._container.id;
- this.parentElement = jQuery(b._container).parent();
- this.originalClientSize = {
- width: b._container.clientWidth,
- height: b._container.clientHeight
- };
- jQuery(c).live("click", function (c) {
- a.displayState == IGN.Control.FullscreenToggle.DISPLAY.NORMALSTATE ? (b.fireEvent("enablefullscreen"), a.displayState = IGN.Control.FullscreenToggle.DISPLAY.FULLSTATE, jQuery(".fullscreen-icon", a.container).removeClass("go-fullscreen").addClass("go-normal")) : (b.fireEvent("disablefullscreen"), a.displayState = IGN.Control.FullscreenToggle.DISPLAY.NORMALSTATE, jQuery(".fullscreen-icon", a.container).removeClass("go-normal").addClass("go-fullscreen"));
- b.fireEvent("resize");
- c.stopPropagation();
- c.preventDefault()
- });
- b.on("enablefullscreen", function () {
- jQuery("body > :not(#" + a.containerId + ", .tooltip)").hide();
- jQuery("#" + a.containerId).appendTo("body").css({
- position: "absolute",
- top: 0,
- left: 0,
- right: 0,
- bottom: 0,
- height: "100%",
- "z-index": 100
- });
- a._map.invalidateSize()
- });
- b.on("disablefullscreen", function () {
- jQuery("body > :not(#" + a.containerId + ",#sugarad-stitial-overlay)").show();
- jQuery("#stitialV2").hide();
- jQuery("#" + a.containerId).prependTo(a.parentElement).css({
- position: "relative",
- height: a.originalClientSize.height + "px",
- "z-index": "auto"
- });
- a._map.invalidateSize()
- });
- return c
- }
- });
- if (!IGN) var IGN = {};
- if (!IGN.Control) IGN.Control = {};
- IGN.Control.SlidingView = L.Control.extend({
- options: {
- position: "bottomleft"
- },
- initialize: function (a) {
- L.Util.setOptions(this, a)
- },
- onAdd: function (a) {
- var e = this,
- c = L.DomUtil.create("div", "sliding-menu");
- if (L.Browser.touch) L.DomEvent.on(c, "click", L.DomEvent.stopPropagation);
- else L.DomEvent.disableClickPropagation(c);
- jQuery(c).width(a._container.clientWidth);
- a.on("hideslidingview", function () {
- jQuery(c).slideUp("fast")
- });
- a.on("showslidingview", function () {
- jQuery(c).slideDown("fast")
- });
- a.on("showall", function () {
- a.fireEvent("hideslidingview");
- if ("the-legend-of-zelda-breath-of-the-wild" == e._map.metadata.objectSlug && !1 == mapOptions.filter) this.showKorokButton = L.DomUtil.create("a", "btn btn-success show-korok-seeds", c), jQuery(this.showKorokButton).html("Show Korok Seeds"), jQuery(this.showKorokButton).click(function (b) {
- a.fireEvent("loadandshowkorokseeds");
- b.stopPropagation();
- b.preventDefault()
- }), a.fireEvent("showslidingview")
- });
- a.on("slidingview", function (b) {
- var d = new String;
- b.message ? d += b.message : b.type && b.totalMarkers ? d += "当前正在显示:" + b.type.typeName +
- " 的标记 " : b.type && (d += "当前正在显示:" + b.type.typeName + " 的标记 ");
- jQuery(c).html(d);
- if ("undefined" === typeof b.displayShowAllButton || "true" === b.displayShowAllButton) this.showAllButton = L.DomUtil.create("a", "btn btn-primary show-all-wm-categories", c), jQuery(this.showAllButton).html("查看全部"), jQuery(this.showAllButton).click(function (b) {
- a.fireEvent("loadandshowall");
- a.fireEvent("hideslidingview");
- b.stopPropagation();
- b.preventDefault()
- });
- a.fireEvent("showslidingview")
- });
- a.on("resize", function () {
- jQuery(c).width(a._container.clientWidth)
- });
- return c
- }
- });
- if (!IGN) var IGN = {};
- if (!IGN.Control) IGN.Control = {};
- IGN.Control.MapTitle = L.Control.extend({
- options: {
- position: "topright"
- },
- initialize: function (d, a) {
- this.mapName = d;
- L.Util.setOptions(this, a)
- },
- onAdd: function (d) {
- var a, e, b, f;
- a = L.DomUtil.create("div", "leaflet-map-title");
- e = L.DomUtil.create("a", "title", a);
- jQuery(e).html(this.mapName);
- L.DomUtil.create("i", "icon icon-chevron-down icon-white", e);
- b = L.DomUtil.create("div", "inline-dropdown", a);
- jQuery(e).click(function (a) {
- jQuery(b).is(":visible") ? jQuery(b).slideUp("fast") : (jQuery(b).empty(), d.relatedMaps(function (a) {
- jQuery.each(a,
- function (a, c) {
- if (c.metadata.mapSlug == d.metadata.mapSlug || !c.metadata.status || "published" != c.metadata.status) return !0;
- f = L.DomUtil.create("a", "external-map-link", b);
- jQuery(f).html(c.metadata.mapName);
- jQuery(f).attr("href", "http://www.ign.com/maps/" + c.metadata.objectSlug + "/" + c.metadata.mapSlug);
- jQuery(f).attr("target", "_top")
- });
- jQuery(b).slideDown("fast")
- }), a.stopPropagation(), a.preventDefault())
- });
- return a
- }
- });
- if (!IGN) var IGN = {};
- if (!IGN.Control) IGN.Control = {};
- IGN.Control.LoadingIndicator = L.Control.extend({
- options: {
- position: "bottomleft",
- overlay: !0,
- height: 300,
- width: 300
- },
- initialize: function (c) {
- L.Util.setOptions(this, c)
- },
- onAdd: function (c) {
- this._map = c;
- var a = this;
- this.container = L.DomUtil.create("div", "leaflet-control-loading-indicator");
- this.overlay = L.DomUtil.create("div", "loading-overlay", this.container);
- this.progressHolder = L.DomUtil.create("div", "progress-holder", this.overlay);
- this.progressText = L.DomUtil.create("span", "progress-text", this.progressHolder);
- jQuery(this.progressText).html("Loading\u2026");
- this.progress = L.DomUtil.create("div", "progress progress-striped", this.progressHolder);
- this.progressBar = L.DomUtil.create("div", "bar", this.progress);
- this._reset();
- this._map.on("updateloadingindicator", function (b) {
- b.text && jQuery(a.progressText).html(b.text);
- b.percent && jQuery(a.progressBar).css({
- width: b.percent + "%"
- });
- a._map.fireEvent("showprogressindicator")
- });
- this._map.on("hideloadingindicator", function () {
- jQuery(a.container).hide()
- });
- this._map.on("showloadingindicator",
- function () {
- jQuery(a.container).show()
- });
- return this.container
- },
- _reset: function () {
- jQuery(this.overlay).css({
- width: this._map._container.clientWidth,
- height: this._map._container.clientHeight
- });
- jQuery(this.progressHolder).css({
- width: this.options.width,
- height: this.options.height,
- "padding-top": this._map._container.clientHeight - this.options.height
- });
- jQuery(this.progressBar).css({
- width: "50%"
- })
- }
- });
- if (!IGN) var IGN = {};
- if (!IGN.Control) IGN.Control = {};
- IGN.Control.SearchBar = L.Control.extend({
- options: {
- position: "topleft",
- overlay: !0,
- width: 300,
- responseDelay: 200,
- minimumSearchChars: 3,
- maxMarkerResults: 10
- },
- initialize: function (b) {
- L.Util.setOptions(this, b)
- },
- onAdd: function () {
- this._initStatics();
- this._bindEvents();
- this.container = L.DomUtil.create("form", "leaflet-control ign-leaflet-module leaflet-control-search");
- L.DomUtil.create("span", "search-icon", this.container);
- if (L.Browser.touch) L.DomEvent.on(this.container, "click", L.DomEvent.stopPropagation);
- else L.DomEvent.disableClickPropagation(this.container);
- this.input = jQuery('<input type="text" class="leaflet-control-search-input" placeholder="搜索">').appendTo(this.container);
- this.dropdown = L.DomUtil.create("ul", "dropdown-menu general-dropdown-menu", this.container);
- this.listen();
- L.DomEvent.on(this.container, "mousewheel", L.DomEvent.stopPropagation);
- jQuery(this.dropdown).lionbars(!1);
- return this.container
- },
- listen: function () {
- var b = this;
- this._map.on("search", function (a) {
- b._search(a.terms)
- });
- jQuery(this.input).click(function () {
- b.activate()
- });
- jQuery(this.container).click(function () {
- b.activate()
- });
- jQuery(this.input).keyup(function (a) {
- b._arrowKeyNavigation(a);
- clearTimeout(b.inputTimer);
- b.inputTimer = setTimeout(function () {
- b._search(jQuery(b.input).val())
- }, b.options.responseDelay)
- });
- jQuery(this.container).submit(function (a) {
- a.stopPropagation();
- a.preventDefault()
- });
- jQuery(this.container).hover(function () {
- jQuery(b.container).addClass("interact")
- }, function () {
- jQuery(b.container).removeClass("interact")
- })
- },
- activate: function () {
- jQuery(this.container).addClass("active");
- jQuery(this.input).focus();
- jQuery(this.input).stop().animate({
- width: this.inputWidth.active
- })
- },
- deactivate: function () {
- jQuery(this.container).removeClass("active");
- jQuery(this.input).blur();
- jQuery(this.input).val("").stop().animate({
- width: this.inputWidth.regular
- });
- jQuery(this.dropdown).hide();
- this.lastSearchTerms = ""
- },
- _bindEvents: function () {
- var b = this;
- this._map.on("click", function () {
- jQuery(b.input).val() || b.deactivate()
- });
- this._map.on("move", function () {
- b.deactivate()
- });
- this._map.on("popupopen", function () {
- b.deactivate()
- })
- },
- _initStatics: function () {
- this.inputWidth = {
- regular: 75,
- active: 280
- }
- },
- _arrowKeyNavigation: function (b) {
- var a;
- if (jQuery(this.dropdown).is(":visible")) switch (a = jQuery(this.dropdown).find("li.active"), b.keyCode) {
- case 40:
- 0 == a.length ? a = jQuery(this.dropdown).find("li.search-result:first") : (a.removeClass("active"), a = a.next(), a.is(".general-headline") && (a = a.next()));
- a.addClass("active");
- break;
- case 38:
- 0 == a.length ? a = jQuery(this.dropdown).find("li.search-result:last") : (a.removeClass("active"), a = a.prev(), a.is(".general-headline") && (a = a.prev()));
- a.addClass("active");
- break;
- case 13:
- if (0 < a.length) {
- if (b = a.data("marker")) this._map.fireEvent("changefilter",
- this._map.types[b.typeSlug]), this._map.fireEvent("activatemarker", b), this.lastSearchTerms = b.markerName, jQuery(this.input).val(b.markerName), jQuery(this.dropdown).hide();
- else if (type = a.data("type")) this._map.fireEvent("changefilter", this._map.types[type.typeSlug]), this.lastSearchTerms = type.typeName, jQuery(this.input).val(type.typeName), jQuery(this.dropdown).hide();
- this.deactivate()
- }
- }
- },
- _search: function (b) {
- if (0 == b.length) jQuery(this.dropdown).hide(), jQuery(this.container).removeClass("withoutBottomRadius"),
- this.lastSearchTerms = "";
- // if (!(b.length < this.options.minimumSearchChars || b == this.lastSearchTerms)) {
- if (b != this.lastSearchTerms) {
- var a = this;
- this.terms = b;
- var markers = a._map.markers;
- var result = {
- count : 0,
- data : {
- markers : [],
- types : []
- }
- }
- for(var i in markers) {
- var comdata = markers[i].metadata;
- if(comdata.title && comdata.title.match(b)) {
- result.data.markers.push({
- mapSlug : comdata.mapSlug,
- markerName : comdata.title,
- markerSlug : comdata.markerSlug,
- typeSlug : comdata.typeSlug,
- metadata : {
- markerSlug : comdata.markerSlug
- }
- });
- }
- }
- result.count = result.data.markers.length;
- // console.log(result);
- a.lastSearchTerms = b;
- a._formatResults(result);
- jQuery(a.container).addClass("withoutBottomRadius")
-
- // this.callApi(this.API.ENDPOINT.SEARCH, {
- // terms: b,
- // objectSlug: a._map.metadata.objectSlug,
- // mapSlug: a._map.metadata.mapSlug
- // }, function (g) {
- // console.log(g);
- // a.lastSearchTerms = b;
- // a._formatResults(g);
- // jQuery(a.container).addClass("withoutBottomRadius")
- // })
- }
- },
- _formatResults: function (b) {
- var a = this,
- g = 0,
- d, e, f, h, i;
- jQuery(this.dropdown).empty();
- 0 == b.count && (d = L.DomUtil.create("li", "general-headline", this.dropdown), jQuery(d).html("No search results."));
- 0 < b.data.types.length && (d = L.DomUtil.create("li", "general-headline", this.dropdown), jQuery(d).html("Types"), jQuery.each(b.data.types, function (b, c) {
- d = L.DomUtil.create("li", "search-result", a.dropdown);
- e = L.DomUtil.create("a", null, d);
- jQuery(e).html(c.typeName);
- jQuery(d).data("type", c);
- a._map.types[c.typeSlug].legend ? f = a._map.types[c.typeSlug].legend.url : a._map.types[c.typeSlug].eachParent(function (a) {
- if (a.legend && a.legend.url) return f = a.legend.url, !1
- });
- f && jQuery('<img src="' + f + '" />').prependTo(e);
- jQuery(e).on("click",
- function (b) {
- a._map.fireEvent("changefilter", a._map.types[c.typeSlug]);
- jQuery(a.container).removeClass("withoutBottomRadius");
- a.deactivate();
- b.preventDefault();
- b.stopPropagation()
- })
- }));
- 0 < b.data.markers.length && (d = L.DomUtil.create("li", "general-headline", this.dropdown), jQuery(d).html("Markers"), jQuery.each(b.data.markers, function (b, c) {
- g++;
- if (g > a.options.maxMarkerResults) return !1;
- c.metadata = {
- markerSlug: c.markerSlug
- };
- d = L.DomUtil.create("li", "search-result", a.dropdown);
- e = L.DomUtil.create("a", null, d);
- jQuery(e).html(c.markerName);
- jQuery(d).data("marker", c);
- if (a._map.types[c.typeSlug].markerIcon) f = a._map.types[c.typeSlug].markerIcon.url, h = a._map.types[c.typeSlug].markerIcon.width, i = a._map.types[c.typeSlug].markerIcon.height, jQuery('<img src="' + f + '" style="width: ' + h + "px; height: " + i + 'px;" />').prependTo(e);
- jQuery(e).on("click", function (b) {
- a._map.fireEvent("changefilter", a._map.types[c.typeSlug]);
- a._map.fireEvent("activatemarker", c);
- jQuery(a.container).removeClass("withoutBottomRadius");
- a.deactivate();
- b.preventDefault();
- b.stopPropagation()
- })
- }));
- jQuery(this.dropdown).show()
- }
- });
- IGN.Control.SearchBar.include(IGN.Mixins.MapsAPI);
- if (!IGN) var IGN = {};
- if (!IGN.Control) IGN.Control = {};
- IGN.Control.OverlayFilter = L.Control.extend({
- options: {
- position: "topleft"
- },
- initialize: function (a, b) {
- this.types = a;
- L.Util.setOptions(this, b);
- this._initStatics();
- this._initLayerGroup()
- },
- onAdd: function () {
- var a = this,
- b, c;
- this._bindEvents();
- if (this.options.display) {
- c = this.container = L.DomUtil.create("div", "leaflet-control-filter ign-leaflet-module");
- this.button = L.DomUtil.create("a", "main-button-with-arrow", this.container);
- jQuery(this.button).attr("data-toggle", "dropdown").html("过滤标记 ");
- jQuery(this.button).hover(function () {
- jQuery(c).addClass("interact")
- },
- function () {
- jQuery(c).removeClass("interact")
- });
- L.DomUtil.create("span", "down-arrow", this.button);
- b = this.dropdown = L.DomUtil.create("ul", "dropdown-menu general-dropdown-menu", this.container);
- this._topLevelList();
- jQuery(this.button).click(function () {
- jQuery(b).is(":hidden") ? a.activate() : a.deactivate()
- });
- this._map.on("click", function () {
- jQuery(b).is(":visible") && a.deactivate()
- });
- if (L.Browser.touch) L.DomEvent.on(this.container, "click", L.DomEvent.stopPropagation);
- else L.DomEvent.disableClickPropagation(this.container);
- L.DomEvent.on(this.container, "mousewheel", L.DomEvent.stopPropagation);
- jQuery(b).lionbars({
- autohide: !0
- })
- } else c = this.container = L.DomUtil.create("div", "leaflet-control-filter no-display");
- return this.container
- },
- activate: function () {
- jQuery(this.container).addClass("active");
- jQuery(this.dropdown).show()
- },
- deactivate: function () {
- jQuery(this.container).removeClass("active");
- jQuery(this.dropdown).hide()
- },
- clearActiveType: function () {
- jQuery(".active", this.dropdown).each(function () {
- jQuery(this).removeClass("active")
- })
- },
- addMarker: function (a) {
- this._layerGroup.addLayer(a)
- },
- removeMarker: function (a) {
- this._map.hasLayer(this._layerGroup) ? this._layerGroup.removeLayer(a) : (this._map.addLayer(this._layerGroup), this._layerGroup.removeLayer(a), this._map.removeLayer(this._layerGroup))
- },
- _initStatics: function () {
- this.buttonType = {
- REGULAR: 1,
- PARENT: 2,
- BACK: 3
- }
- },
- _initLayerGroup: function () {
- this._layerGroup = new IGN.MarkerClusterGroup({
- disableClusteringAtZoom: this.options.clusters.enabled ? this.options.clusters.disableClusteringAtZoom : 1,
- maxClusterRadius: this.options.clusters.clusterRadius,
- retina: this.options.retina
- });
- this._layerGroup.on("clusterclick", function (a) {
- a.layer._map.panTo(a.layer.getLatLng());
- a.layer.bindPopup(IGN.PopupContent.clusterContent(a), {
- autoPanPadding: new L.Point(5, 100),
- autoPan: !0,
- offset: new L.Point(0, -35)
- }).openPopup();
- a.layer._popup._update()
- })
- },
- _bindEvents: function () {
- var a = this;
- this._map.on("changefilter", function (b) {
- a._changeFilter(b)
- });
- this._map.on("filter", function (b) {
- a._filter(b)
- });
- this._map.on("showall",
- function () {
- a._showAll()
- });
- this._map.on("hideall", function () {
- a._filter()
- });
- this._map.on("loadandshowall", function () {
- a._loadAndShowAll()
- });
- this._map.on("loadandshowkorokseeds", function () {
- a._loadAndShowKorokSeeds()
- });
- this._map.on("redraw", function () {
- a._changeFilter(a.lastFilteredType)
- });
- this._map.on("move", function () {
- a.deactivate()
- });
- this._map.on("popupopen", function () {
- a.deactivate()
- });
- this._map.on("lastfilteredtype", function () {
- return a.lastFilteredType ? a.lastFilteredType : null
- })
- },
- _topLevelList: function () {
- var a =
- this;
- jQuery(a.dropdown).empty();
- jQuery(a._allButton()).appendTo(a.dropdown);
- jQuery.each(this.types, function (b, c) {
- !c.hasParent() && 0 < c.markerCount && jQuery(a._listElementForType(c, a.buttonType.REGULAR)).appendTo(a.dropdown)
- });
- jQuery(a._noneButton()).appendTo(a.dropdown)
- },
- _list: function (a) {
- var b = this;
- jQuery(b.dropdown).empty();
- jQuery(b._listElementForType(a, b.buttonType.BACK)).appendTo(b.dropdown);
- jQuery(b._listElementForType(a, b.buttonType.PARENT)).appendTo(b.dropdown);
- a.eachChild(function (a) {
- 0 < a.markerCount &&
- jQuery(b._listElementForType(a, b.buttonType.REGULAR)).appendTo(b.dropdown)
- })
- },
- _listElementForType: function (a, b) {
- var c = this,
- d, e, g, f;
- d = jQuery("<li></li>");
- switch (b) {
- case this.buttonType.PARENT:
- f = "All " + a.typeName;
- break;
- case this.buttonType.BACK:
- f = a.hasParent() ? c.types[a.parentTypeSlug].typeName : "All Categories";
- break;
- default:
- f = a.typeName
- }
- e = jQuery('<a href="#">' + f + "</a>");
- b == this.buttonType.BACK && jQuery('<span class="icon icon-chevron-left pull-left"></span>').appendTo(e);
- b != c.buttonType.BACK && a.legend &&
- a.legend.url ? (jQuery('<img src="' + a.legend.url + '" />').prependTo(e), e.addClass("icon")) : e.addClass("no-icon");
- a.hasChildren() && b == c.buttonType.REGULAR && jQuery('<span class="icon icon-white icon-chevron-right pull-right"></span>').appendTo(e);
- jQuery('<span class="clearfix"></span>').appendTo(e);
- e.appendTo(d);
- g = jQuery('<ul class="children"></ul>');
- jQuery(g).appendTo(d);
- e.data("type", a);
- e.data("action", b);
- a.eachChild(function (a) {
- 0 < a.markerCount && jQuery(c._listElementForType(a, c.buttonType.REGULAR)).appendTo(g)
- });
- jQuery(e).click(function (a) {
- var b, d;
- b = jQuery(this).data("type");
- jQuery(this).data("action");
- d = jQuery(this).parent();
- d = jQuery(".children:first", d);
- jQuery(d).is(":visible") ? (jQuery(".icon", e).removeClass("icon-chevron-down").addClass("icon-chevron-right"), jQuery(d).hide()) : (jQuery(".icon", e).removeClass("icon-chevron-right").addClass("icon-chevron-down"), jQuery(d).show());
- c._map.fireEvent("changefilter", b);
- c.clearActiveType();
- jQuery(e).addClass("active");
- a.stopPropagation();
- a.preventDefault()
- });
- return d
- },
- _allButton: function () {
- var a = this,
- b, c, a = this;
- b = jQuery("<li></li>");
- c = jQuery('<a href="#">全部显示</a>');
- c.appendTo(b);
- jQuery(c).click(function (b) {
- a._loadAndShowAll();
- a.clearActiveType();
- jQuery(c).addClass("active");
- b.stopPropagation();
- b.preventDefault()
- });
- return b
- },
- _noneButton: function () {
- var a = this,
- b, c, a = this;
- b = jQuery("<li></li>");
- c = jQuery('<a href="#">不显示</a>');
- c.appendTo(b);
- jQuery(c).click(function (b) {
- a._filter();
- a._map.fireEvent("hideall");
- a._map.fireEvent("slidingview", {
- message: "To see markers, enter a search term or select a filter above",
- displayShowAllButton: "false"
- });
- a.clearActiveType();
- jQuery(c).addClass("active");
- b.stopPropagation();
- b.preventDefault()
- });
- return b
- },
- _changeFilter: function (a) {
- loadTypes = this._notLoaded(a);
- 0 < loadTypes.length ? this._map.fireEvent("loadtypes", {
- types: loadTypes,
- parentType: a
- }) : this._map.fireEvent("filter", {
- type: a
- })
- },
- _notLoaded: function (a) {
- var b = [];
- a ? (a = this.types[a.typeSlug], (!a || !a.loaded) && b.push(a), a.allChildren(function (a) {
- a.loaded || b.push(a)
- })) : jQuery.each(this.types, function (a, d) {
- d.loaded || b.push(d)
- });
- return b
- },
- _filter: function (a) {
- var b = this,
- c;
- b._map.removeLayer(b._layerGroup);
- jQuery.each(b._map.types, function (a, c) {
- b._map.removeLayer(c._layerGroup)
- });
- a && a.type ? (c = b.types[a.type.typeSlug], b._map.addLayer(c._layerGroup), c.allChildren(function (a) {
- b._map.addLayer(a._layerGroup)
- }), this.lastFilteredType = a.type) : this.lastFilteredType = null;
- b._map.fireEvent("filterchanged", c)
- },
- _showAll: function () {
- this._filter();
- this._map.addLayer(this._layerGroup)
- },
- _loadAndShowAll: function () {
- loadTypes = this._notLoaded();
- 0 < loadTypes.length ? this._map.fireEvent("loadtypes", {
- types: loadTypes,
- filterEvent: "showall"
- }) : this._map.fireEvent("showall")
- },
- _loadAndShowKorokSeeds: function () {
- this._changeFilter(this._map.types["korok-seed"])
- }
- });
- if (!IGN) var IGN = {};
- if (!IGN.Control) IGN.Control = {};
- IGN.Control.ContextMenu = L.Control.extend({
- options: {
- position: "topleft"
- },
- initialize: function (a) {
- L.Util.setOptions(this, a)
- },
- onAdd: function (a) {
- var d = this,
- b, c;
- this.container = L.DomUtil.create("div", "leaflet-context-menu");
- b = L.DomUtil.create("ul", "unstyled", this.container);
- b = L.DomUtil.create("li", null, b);
- c = jQuery('<a href="#">Create Marker</a>');
- c.appendTo(b);
- c.click(function () {
- var b = {
- exists: !1
- },
- c;
- jQuery.each(a.types, function (c, d) {
- b.type = d;
- b.metadata = {
- typeSlug: d.typeSlug,
- mapSlug: a.metadata.mapSlug,
- objectSlug: a.metadata.objectSlug
- };
- return !1
- });
- c = new IGN.Marker(d.contextLatLng, b);
- c.addTo(a);
- c.enableEditing()
- });
- this._hide();
- this._bindEvents();
- return this.container
- },
- _bindEvents: function () {
- var a = this;
- this._map.on("contextmenu", function (d) {
- a.contextLatLng = d.latlng;
- a._show(d)
- });
- this._map.on("click", function () {
- a._hide()
- });
- this._map.on("dragstart", function () {
- a._hide()
- })
- },
- _show: function (a) {
- jQuery(this.container).css({
- top: a.containerPoint.y,
- left: a.containerPoint.x
- }).show()
- },
- _hide: function () {
- jQuery(this.container).hide()
- }
- });
- if (!IGN) var IGN = {};
- if (!IGN.Control) IGN.Control = {};
- IGN.Control.Persistence = L.Control.extend({
- options: {
- days: 30,
- cookieName: "IGNMapFilter"
- },
- initialize: function (a) {
- L.Util.setOptions(this, a)
- },
- onAdd: function (a) {
- var d = this,
- c;
- a.metadata && (this.options.cookieName += a.metadata.objectSlug + "-" + a.metadata.mapSlug);
- c = L.DomUtil.create("div", "ign-control-persistence");
- jQuery(c).hide();
- // a.on("filter", function (b) {
- // b.type && b.type.typeSlug && d.setFilterCookie(b.type.typeSlug)
- // });
- if (!this._map.options.filter) a.on("controlsloaded", function () {
- (filter = d.getFilterCookie()) && "all" ==
- filter ? a.fireEvent("loadandshowall") : filter && "none" != filter ? a.fireEvent("changefilter", this.types[filter]) : a.fireEvent("loadandshowall")
- });
- a.on("showall", function () {
- d.setFilterCookie("all")
- });
- a.on("hideall", function () {
- d.setFilterCookie("none")
- });
- a.on("getcookie", function (b) {
- var a = d._readCookie(b.name);
- b.callback && b.callback(a)
- });
- a.on("setcookie", function (a) {
- days = a.days ? a.days : d.options.days;
- d._createCookie(a.name, a.value, days)
- });
- return c
- },
- getFilterCookie: function () {
- return this._readCookie(this.options.cookieName)
- },
- setFilterCookie: function (a) {
- this._createCookie(this.options.cookieName, a, this.options.days)
- },
- _createCookie: function (a, d, c) {
- if (c) {
- var b = new Date;
- b.setTime(b.getTime() + 864E5 * c);
- c = "; expires=" + b.toGMTString()
- } else c = "";
- document.cookie = a + "=" + d + c + "; path=/"
- },
- _readCookie: function (a) {
- for (var a = a + "=", d = document.cookie.split(";"), c = 0; c < d.length; c++) {
- for (var b = d[c];
- " " == b.charAt(0);) b = b.substring(1, b.length);
- if (0 == b.indexOf(a)) return b.substring(a.length, b.length)
- }
- return null
- }
- });
- if (!IGN) var IGN = {};
- if (!IGN.Control) IGN.Control = {};
- IGN.Control.Moderation = L.Control.extend({
- options: {
- position: "topleft",
- listWidth: "300px"
- },
- initialize: function (a) {
- L.Util.setOptions(this, a)
- },
- onAdd: function (a) {
- this._layerGroup = new L.LayerGroup;
- a.addLayer(this._layerGroup);
- this._createdLayerGroup = new L.LayerGroup;
- a.addLayer(this._createdLayerGroup);
- this._polylineGroup = new L.LayerGroup;
- a.addLayer(this._polylineGroup);
- a = L.DomUtil.create("div", "leaflet-moderation");
- this.contentList = L.DomUtil.create("div", "leaflet-moderation-content-list", a);
- jQuery(this.contentList).css({
- opacity: 0
- });
- L.DomEvent.on(this.contentList, "click", L.DomEvent.stopPropagation);
- this._loadCreatedMarkers();
- this._bindEvents();
- return a
- },
- _bindEvents: function () {
- var a = this;
- this._map.on("markerclick", function (b) {
- a._markerClick(b)
- });
- this._map.on("showmoderationlist", function () {
- a._showContentList()
- });
- this._map.on("hidemoderationlist", function () {
- a._hideContentList()
- });
- this._map.on("disablemoderation", function () {
- a._disableModeration()
- });
- this._map.on("changefilter", function () {
- a._disableModeration()
- });
- this._map.on("showall",
- function () {
- a._disableModeration()
- });
- this._map.on("hideall", function () {
- a._disableModeration()
- });
- this._map.on("removemarkerfrommoderationlayers", function (b) {
- a._removeMarkerFromLayers(b)
- })
- },
- _loadCreatedMarkers: function () {
- var a = this,
- b = {},
- c, d;
- b.objectSlug = a._map.metadata.objectSlug;
- b.mapSlug = a._map.metadata.mapSlug;
- b.pendingAction = "create";
- this.callApi(this.API.ENDPOINT.MARKERS.PENDING.GET, b, function (b) {
- b && !(b.count && 0 >= b.count) && jQuery.each(b.data, function (e, i) {
- c = i.marker[0];
- c.type = a._map.types[c.metadata.typeSlug];
- c.metadata.pendingCount = 1;
- c.pendingAction = "create";
- c.displayBadgeCount = !0;
- d = new IGN.PendingMarker([c.location.lat, c.location.lng], c);
- a._createdLayerGroup.addLayer(d);
- d.enableDragging();
- d.state = d.STATES.PENDING;
- d.createdBy = b.createdBy
- })
- })
- },
- _markerClick: function (a) {
- var b = this,
- c = a.marker,
- a = {},
- d = [],
- f, e;
- if (!(!c.metadata.hasOwnProperty("pendingCount") || 0 >= c.metadata.pendingCount || c.options.pendingAction && "create" == c.options.pendingAction)) this._map.fireEvent("hideall"), this._clearContentList(), this._layerGroup.clearLayers(),
- this._layerGroup.addLayer(c), this._polylineGroup.clearLayers(), a.objectSlug = b._map.metadata.objectSlug, a.mapSlug = b._map.metadata.mapSlug, a.markerSlug = c.metadata.markerSlug, this.callApi(this.API.ENDPOINT.MARKERS.PENDING.GET, a, function (a) {
- a.data && jQuery.each(a.data, function (j, h) {
- f = h.action;
- d = [];
- jQuery.each(h.marker, function (j, g) {
- g.type = b._map.types[g.metadata.typeSlug];
- g.metadata.typeSlug = g.type.typeSlug;
- g.pendingAction = f;
- e = new IGN.PendingMarker([g.location.lat, g.location.lng], g);
- e._originalMarker =
- c;
- b._layerGroup.addLayer(e);
- e.enableDragging();
- e.state = e.STATES.PENDING;
- e.updatedBy = a.updatedBy;
- d.push(e);
- polyline = new L.Polyline([e.getLatLng(), c.getLatLng()], {
- color: "red"
- });
- b._polylineGroup.addLayer(polyline)
- });
- b._addPendingMarkersToContentList(f, d);
- b._addCancelButtonToContentList();
- b._showContentList()
- })
- })
- },
- _addPendingMarkersToContentList: function (a, b) {
- var c = this,
- d, f, e;
- d = L.DomUtil.create("h3", "action-headline", this.contentList);
- jQuery(d).html(a + "s");
- L.DomUtil.create("hr", null, this.contentList);
- jQuery.each(b, function (a, b) {
- f = L.DomUtil.create("a", "pending-marker-link", c.contentList);
- jQuery(f).html(b.metadata.markerName);
- L.DomUtil.create("i", "icon icon-chevron-right pull-right", f);
- if (c._map.types[b.metadata.typeSlug].markerIcon) e = c._map.types[b.metadata.typeSlug].markerIcon.url, jQuery('<img src="' + e + '" />').prependTo(f);
- b._moderationListLink = f;
- jQuery(f).on("click", function (a) {
- b.fireEvent("click");
- a.preventDefault();
- a.stopPropagation()
- })
- })
- },
- _addCancelButtonToContentList: function () {
- var a = this,
- b;
- b = L.DomUtil.create("a", "btn btn-large btn-cancel-moderation", this.contentList);
- jQuery(b).html("Cancel Moderation");
- jQuery(b).click(function (b) {
- a._disableModeration();
- b.stopPropagation();
- b.preventDefault()
- })
- },
- _removeMarkerFromLayers: function (a) {
- this._layerGroup.removeLayer(a);
- this._createdLayerGroup.removeLayer(a)
- },
- _clearContentList: function () {
- jQuery(this.contentList).html("")
- },
- _showContentList: function () {
- jQuery(this.contentList).stop().animate({
- width: this.options.listWidth,
- opacity: 1
- })
- },
- _hideContentList: function () {
- jQuery(this.contentList).stop().animate({
- width: 0,
- opacity: 0
- })
- },
- _disableModeration: function () {
- this._hideContentList();
- this._layerGroup.clearLayers();
- this._polylineGroup.clearLayers()
- }
- });
- IGN.Control.Moderation.include(IGN.Mixins.MapsAPI);
- if (!IGN) var IGN = {};
- if (!IGN.Control) IGN.Control = {};
- IGN.Control.EventTracker = L.Control.extend({
- options: {},
- initialize: function (a) {
- L.Util.setOptions(this, a)
- },
- onAdd: function () {
- this._bindEvents();
- return L.DomUtil.create("div", "leaflet-control-event-tracker")
- },
- _bindEvents: function () {
- var a = this;
- this._map.on("markerclick", function (b) {
- a._markerClick(b)
- });
- this._map.on("markercreate", function (b) {
- a._markerCreate(b)
- });
- this._map.on("markerupdate", function (b) {
- a._markerUpdate(b)
- });
- this._map.on("markerdelete", function (b) {
- a._markerDelete(b)
- })
- },
- _markerClick: function (a) {
- a.metadata &&
- a.metadata.markerName && a.metadata.wikiPage && this._igndrones("Maps:Marker Click", a.metadata.markerName + " | " + a.metadata.wikiPage)
- },
- _markerCreate: function (a) {
- this._igndrones("Maps:Marker Create", a.metadata.markerName);
- window.IGN_UA.trackEvent("community-wikiMapsMarkerCreate")
- },
- _markerUpdate: function (a) {
- this._igndrones("Maps:Marker Update", a.metadata.markerName);
- window.IGN_UA.trackEvent("community-wikiMapsMarkerUpdate")
- },
- _markerDelete: function (a) {
- this._igndrones("Maps:Marker Delete", a.metadata.markerName);
- window.IGN_UA.trackEvent("community-wikiMapsMarkerDelete")
- },
- _igndrones: function (a, b) {
- if ("undefined" != typeof igndrones) {
- var c = this;
- igndrones.async.push(function () {
- igndrones.fireEvent(a, "Map:" + c._map.metadata.objectSlug + ":" + c._map.metadata.mapSlug, b)
- })
- }
- }
- });
- if (!IGN) var IGN = {};
- if (!IGN.Control) IGN.Control = {};
- IGN.Control.ExternalLink = L.Control.extend({
- options: {
- position: "bottomright",
- linkTo: "#",
- text: "View on IGN"
- },
- initialize: function (a) {
- L.Util.setOptions(this, a)
- },
- onAdd: function () {
- var a, b;
- a = L.DomUtil.create("div", "external-button-holder");
- b = L.DomUtil.create("a", "btn", a);
- jQuery(b).html(this.options.text);
- jQuery(b).attr("href", this.options.linkTo);
- jQuery(b).attr("target", "_top");
- return a
- }
- });
- if (!IGN) var IGN = {};
- if (!IGN.Control) IGN.Control = {};
- IGN.Control.MarkerAdder = L.Control.extend({
- statics: {
- DISPLAY: {
- NORMALSTATE: 1,
- FULLSTATE: 2
- }
- },
- options: {
- position: "topright"
- },
- initialize: function (a) {
- L.Util.setOptions(this, a)
- },
- _initStatics: function () {
- this.popupStatus = {
- statusNormal: "normal",
- statusClosed: "closed"
- };
- this.cookieName = "igncontrolmarkeradder"
- },
- onAdd: function (a) {
- var b = this,
- c;
- this._map = a;
- this._initStatics();
- a = L.DomUtil.create("div", "add-marker-container");
- c = L.DomUtil.create("a", "btn", a);
- L.DomUtil.create("span", "add-marker-icon", c);
- this.popup = L.DomUtil.create("div",
- "add-marker-popup-container", a);
- this.popupCloseButton = L.DomUtil.create("a", "add-marker-popup-close", this.popup);
- jQuery(this.popupCloseButton).html("x");
- this.popupMessage = L.DomUtil.create("span", "add-marker-popup-message", this.popup);
- jQuery(this.popupMessage).html('<strong>You can contribute to this map!</strong><span>Click the icon to create a new map marker and place it on the map.</span><a href="http://www.ign.com/wikis/how-to/empty/How_to_Edit_Interactive_Maps" class="learn-more-button">Learn More</a>');
- L.DomUtil.create("div", "add-marker-popup-arrow", this.popup);
- jQuery(c).click(function () {
- b.addMarker()
- });
- jQuery(this.popupCloseButton).click(function () {
- b.popupClose()
- });
- this._map.on("controlsloaded", function () {
- // b._map.fireEvent("getcookie", {
- // name: b.cookieName,
- // callback: function (a) {
- // if (!a || a != b.popupStatus.statusClosed) jQuery(b.popup).fadeIn("fast"), setTimeout(function () {
- // b.popupClose()
- // }, 2E4)
- // }
- // })
- });
- return a
- },
- addMarker: function () {
- this.popupClose();
- var a = {
- exists: !1
- },
- b = this._map,
- c;
- b.overlayFilter && b.overlayFilter.lastFilteredType &&
- b.overlayFilter.lastFilteredType.typeSlug ? c = b.types[b.overlayFilter.lastFilteredType.typeSlug] : jQuery.each(b.types, function (b, a) {
- c = a;
- return !1
- });
- a.type = c;
- a.metadata = {
- typeSlug: c.typeSlug,
- mapSlug: b.metadata.mapSlug,
- objectSlug: b.metadata.objectSlug
- };
- a = new IGN.Marker(b.getCenter(), a);
- a.addTo(b);
- a.enableEditing()
- },
- popupClose: function () {
- jQuery(this.popup).fadeOut("fast");
- this._map.fireEvent("setcookie", {
- name: this.cookieName,
- value: this.popupStatus.statusClosed
- })
- }
- });
- if (!IGN) var IGN = {};
- if (!IGN.Interface) IGN.Interface = {};
- IGN.Interface.InteractiveMapInterface = {
- setMap: function (a) {
- this.map = a
- },
- filter: function (a) {
- (a = this.map.types[a]) && this.map.fireEvent("changefilter", a)
- },
- showAll: function () {
- this.map.fireEvent("showall")
- },
- hideAll: function () {
- this.map.fireEvent("hideall")
- },
- activateMarker: function (a) {
- (a = this.map.markers[a]) && this.map.fireEvent("activatemarker", a)
- },
- center: function (a) {
- var b = new L.LatLng(-this.map.mapInfo.width / 2, this.map.mapInfo.height / 2);
- this.map.setView(b, a ? a : 2)
- },
- lastFilteredTypeSlug: function () {
- return this.map.overlayFilter &&
- this.map.overlayFilter.lastFilteredType ? this.map.overlayFilter.lastFilteredType.typeSlug : "undefined"
- },
- zoomIn: function () {
- this.map.zoomIn()
- },
- zoomOut: function () {
- this.map.zoomOut()
- },
- filterAndActivate: function (a, b) {
- var d = this,
- c, e;
- this.map.fireEvent("changefilter", this.map.types[a]);
- (c = this.map.markers[b]) ? this.map.fireEvent("activatemarker", c): (e = function () {
- (c = d.map.markers[b]) && d.map.fireEvent("activatemarker", c);
- d.map.off("filterchanged", e)
- }, this.map.on("filterchanged", e))
- }
- };
- jQuery(document).ready(function () {
- var a = jQuery("#ignFooter-container .emailInput");
- a.val("Enter Email...");
- a.focusin(function () {
- "Enter Email..." === jQuery(this).val() && jQuery(this).val("")
- });
- a.focusout(function () {
- "" === jQuery(this).val() && jQuery(this).val("Enter Email...")
- });
- jQuery("#ignFooter-container .emailSubmit").click(function () {
- if ("Enter Email..." === a.val()) return !1
- })
- });
- var IGN = IGN || {};
- // IGN.External = IGN.External || {};
- // IGN.External.Optimizely = function () {
- // return {
- // _settings: {},
- // init: function () {
- // var b = "",
- // a = document.getElementById("ign-optimizely");
- // "undefined" !== typeof a && "SCRIPT" != a.nodeName && "undefined" !== typeof a.getAttribute("data-project-id") && (b = a.getAttribute("data-project-id"));
- // if ("" !== b) {
- // var c = "https:" == document.location.protocol ? "https://" : "http://",
- // a = document.createElement("script");
- // a.type = "text/javascript";
- // a.async = !0;
- // a.src = c + "cdn.optimizely.com/js/" + b + ".js";
- // b = document.getElementsByTagName("script")[0];
- // b.parentNode.insertBefore(a,
- // b)
- // }
- // }
- // }
- // }();
- // window.addEventListener("load", function () {
- // IGN.External.Optimizely.init()
- // });
- (function (a) {
- function e(a) {
- a.stopPropagation();
- a.stopImmediatePropagation();
- a.preventDefault();
- b.hasClass("col-2") || b.hasClass("col-3") ? (c.html("more shows"), c.removeClass("icon-pointy-before icon-back").addClass("icon-pointy"), b.removeClass("col-2 col-3")) : (c.html("fewer shows"), c.removeClass("icon-pointy").addClass("icon-pointy-before icon-back"), 0 < d[2].length ? b.addClass("col-3") : b.addClass("col-2"))
- }
- function f(b) {
- a.ajax({
- url: (b ? "https://s.ign.com/widgets/" : "http://" + GlobalHeaderOptions.renderDomain +
- "/") + "social/shared/evousertools.jsonp?enable_ssl=" + b + "&globalheader=true&callback=?",
- dataType: "jsonp",
- jsonpCallback: "socialSharedGlobalHeaderUsertoolsCallback",
- cache: !0,
- success: function (b) {
- $toolsContainer = a("#user-tools-container");
- $toolsContainer.html(b);
- b = $toolsContainer.find(".user-tools");
- b.fadeIn("fast");
- b.delegate(".authReturnUrl", "click", function () {
- var b = escape(location.href),
- c = a(this).attr("href");
- a(this).attr("href", c + "?r=" + b)
- })
- }
- })
- }
- var b, d, c;
- a(document).ready(function () {
- b = a("#ign-shows .ign-shows-list-container");
- a("#ign-shows .more-shows");
- c = a("#ign-shows .more-shows a");
- d = [a("#ign-shows .show-column-0"), a("#ign-shows .show-column-1"), a("#ign-shows .show-column-2")];
- d[1].length && c.click(e);
- f(GlobalHeaderOptions.enable_ssl);
- a("#header-container").removeClass("hidden-opacity")
- })
- })(jQuery);
- (function (a) {
- var l, q, g, h, m, i, r;
- function w() {
- n = a("header#ign-header");
- a("#header-container");
- b = a("#header-nav");
- a("#search-input");
- s = a("#ign-shows");
- e = !0;
- // o = a("#spine-container").height() || b.offset().top;
- o = a("#spine-container").height();
- j = a(".trending");
- c = a(".dpad-container").addClass("hidden");
- d && (d.appendTo(c), c.css("background-image", "none"));
- a("#search-container");
- l = a("#search-input");
- q = a("#search-button");
- g = a(".promoted .content");
- h = a(".promoted .image");
- m = a(".promoted .tile.promo");
- i = "collapsed";
- r = 0 !== a(".promoted.expandable").length ?
- !0 : !1;
- j = a(".trending");
- x();
- a("body").bind("sidekickStateChange", y);
- b.hasClass("spine") || b.hasClass("watchread") ? (k(a(this).scrollTop()), a(window).scroll(function () {
- k(a(this).scrollTop())
- })) : (c.removeClass("hidden"), d && t())
- }
- function y(p, b) {
- b.action && "expand" === b.action ? (window.scrollTo(0, 0), n.addClass("fixed"), k(0), e = !1) : b.action && "collapse" === b.action && setTimeout(function () {
- n.removeClass("fixed");
- e = !0;
- k(a(window).scrollTop())
- }, 2500)
- }
- function k(p) {
- e && p > o && !b.hasClass("fixed") ? (f && console.log("set sticky state"),
- b.addClass("fixed"), a("#chaos").addClass("chaosf"), c.hasClass("hidden") && (c.removeClass("hidden"), d && t())) : e && p <= o && b.hasClass("fixed") && (f && console.log("remove sticky state"), b.removeClass("fixed"), a("#chaos").removeClass("chaosf"), c.addClass("hidden"))
- }
- function t() {
- d[0].pauseAnimations();
- d[0].setCurrentTime(0);
- d[0].unpauseAnimations()
- }
- function z(a) {
- 13 === a.keyCode && u()
- }
- function u() {
- var a = l.val();
- "" === a || "Search" === a ? alert("Please type in your search query.") : document.location = "http://" + window.document.domain +
- "/search?q=" + encodeURIComponent(a)
- }
- function v(a) {
- a.preventDefault();
- switch (i) {
- case "collapsed":
- m.removeClass("hidden");
- g.addClass("hidden");
- h.addClass("expanded");
- j.addClass("hidden");
- i = "expanded";
- f && console.log("expanding promoted content");
- break;
- case "expanded":
- m.addClass("hidden"), g.removeClass("hidden"), h.removeClass("expanded"), j.removeClass("hidden"), i = "collapsed", f && console.log("collapsing promoted content")
- }
- }
- function x() {
- s.on("mouseover", function () {
- var b, c;
- a("#ign-shows .ign-show").each(function () {
- b =
- a(this).find(".ign-show-image");
- b.attr("src", b.data("image"));
- c = a(this).find(".ign-show-branding");
- c.attr("src", c.data("image"))
- })
- })
- }
- var f = !1,
- d = a("<svg version='1.1' baseProfile='tiny' id='svg-dpad' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' width='40px' height='40px' viewBox='0 0 40 40' xml:space='preserve' fill='#d3222a'><g transform='translate(20, 20)'><path d='M-6.618-4.354c0.594-0.899,1.365-1.671,2.264-2.264c0.13-1.182,0.307-2.261,0.525-3.214 C-6.573-8.76-8.76-6.573-9.833-3.829C-8.878-4.047-7.799-4.224-6.618-4.354z'><animateTransform attributeName='transform' type='scale' values='0;1.5;1.2;1' dur='0.25s' repeatCount='\u00cf'/><animate attributeName='opacity' values='0;1' dur='0.25s'/></path><path d='M4.347-6.644C4.35-6.636,4.35-6.628,4.351-6.62c0.9,0.594,1.672,1.366,2.267,2.266 c1.181,0.13,2.26,0.306,3.214,0.524c-1.075-2.751-3.27-4.941-6.024-6.01C4.028-8.891,4.211-7.819,4.347-6.644z'><animateTransform attributeName='transform' type='scale' values='0;1.5;1.2;1' dur='0.25s' repeatCount='1'/><animate attributeName='opacity' values='0;1' dur='0.25s'/></path><path d='M-4.354,6.617c-0.9-0.594-1.672-1.366-2.265-2.266c-0.009-0.002-0.017-0.002-0.026-0.004 c-1.19-0.14-2.255-0.32-3.193-0.537c1.07,2.752,3.259,4.946,6.009,6.02C-4.047,8.878-4.224,7.8-4.354,6.617z'><animateTransform attributeName='transform' type='scale' values='0;1.6;1.2;1' dur='0.25s' repeatCount='1'/><animate attributeName='opacity' values='0;1' dur='0.25s'/></path><path d='M6.645,4.348C6.635,4.35,6.628,4.35,6.619,4.352C6.025,5.253,5.252,6.025,4.351,6.62 C4.349,6.629,4.349,6.637,4.347,6.646C4.21,7.821,4.028,8.892,3.807,9.84c2.759-1.071,4.957-3.269,6.03-6.027 C8.899,4.03,7.833,4.209,6.645,4.348z'><animateTransform attributeName='transform' type='scale' values='0;1.2;1.1;1' dur='0.25s' repeatCount='1'/><animate attributeName='opacity' values='0;1' dur='0.25s'/></path><path d='M-1.961-12h3.9c0.853,1.845,1.195,4.594,1.302,5.522c0.042,0.224,0.063,0.432,0.063,0.635L0-2.887 l-3.303-2.956c0-0.169,0.016-0.349,0.05-0.547C-3.152-7.34-2.826-10.136-1.961-12z'><animateTransform attributeName='transform' type='scale' values='0;1.5;1.2;1;1;1;1' dur='0.25s' repeatCount='1'/></path><path d='M-3.303,5.843c0,0.17,0.016,0.35,0.05,0.548c0.102,0.95,0.428,3.745,1.292,5.609h3.9 c0.853-1.844,1.195-4.594,1.302-5.522c0.042-0.224,0.063-0.433,0.063-0.635L0,2.887L-3.303,5.843z'><animateTransform attributeName='transform' type='scale' values='0;1.2;1.1;1;1' dur='0.25s' repeatCount='1'/></path><path d='M-5.842-3.304c-0.171,0-0.349,0.017-0.549,0.05c-0.95,0.101-3.745,0.429-5.61,1.292v3.9 c1.845,0.854,4.595,1.194,5.523,1.302c0.223,0.042,0.433,0.062,0.636,0.062l2.955-3.303L-5.842-3.304z'><animateTransform attributeName='transform' type='scale' values='0;1.3;1.2;1;1' dur='0.25s' repeatCount='1'/></path><path d='M12-1.962c-1.864-0.863-4.66-1.19-5.61-1.291c-0.198-0.034-0.377-0.05-0.548-0.05L2.888,0l2.956,3.303 c0.203,0,0.412-0.02,0.636-0.062c0.928-0.108,3.677-0.449,5.522-1.301v-3.902H12z'><animateTransform attributeName='transform' type='scale' values='0;1.4;1.1;1' dur='0.25s' repeatCount='1'/></path></g></svg>"),
- c, n, b, s, o, j, e;
- f && console.log("IGN Global Header 2014");
- a(document).ready(function () {
- w();
- l.keypress(z);
- q.click(u);
- r && (h.click(v), g.click(v))
- })
- })(IGN.jQuery);
|