main.js 358 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818
  1. /* 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]*/
  2. (function (k, i, l) {
  3. var b, o;
  4. typeof exports !== l + "" ? b = exports : (o = k.L, b = {
  5. noConflict: function () {
  6. k.L = o;
  7. return this
  8. }
  9. }, k.L = b);
  10. b.version = "0.5.1";
  11. b.Util = {
  12. extend: function (a) {
  13. var c = Array.prototype.slice.call(arguments, 1),
  14. b, d, f, g;
  15. for (d = 0, f = c.length; d < f; d++)
  16. for (b in g = c[d] || {}, g) g.hasOwnProperty(b) && (a[b] = g[b]);
  17. return a
  18. },
  19. bind: function (a, c) {
  20. var b = 2 < arguments.length ? Array.prototype.slice.call(arguments, 2) : null;
  21. return function () {
  22. return a.apply(c, b || arguments)
  23. }
  24. },
  25. stamp: function () {
  26. var a = 0;
  27. return function (c) {
  28. c._leaflet_id =
  29. c._leaflet_id || ++a;
  30. return c._leaflet_id
  31. }
  32. }(),
  33. limitExecByInterval: function (a, c, b) {
  34. var d, f;
  35. return function h() {
  36. var j = arguments;
  37. d ? f = !0 : (d = !0, setTimeout(function () {
  38. d = !1;
  39. f && (h.apply(b, j), f = !1)
  40. }, c), a.apply(b, j))
  41. }
  42. },
  43. falseFn: function () {
  44. return !1
  45. },
  46. formatNum: function (a, c) {
  47. var b = Math.pow(10, c || 5);
  48. return Math.round(a * b) / b
  49. },
  50. splitWords: function (a) {
  51. return a.replace(/^\s+|\s+$/g, "").split(/\s+/)
  52. },
  53. setOptions: function (a, c) {
  54. a.options = b.extend({}, a.options, c);
  55. return a.options
  56. },
  57. getParamString: function (a, c) {
  58. var b = [],
  59. d;
  60. for (d in a) a.hasOwnProperty(d) &&
  61. b.push(d + "=" + a[d]);
  62. return (!c || -1 === c.indexOf("?") ? "?" : "&") + b.join("&")
  63. },
  64. template: function (a, c) {
  65. return a.replace(/\{ *([\w_]+) *\}/g, function (a, b) {
  66. var f = c[b];
  67. if (!c.hasOwnProperty(b)) throw Error("No value provided for variable " + a);
  68. return f
  69. })
  70. },
  71. isArray: function (a) {
  72. return "[object Array]" === Object.prototype.toString.call(a)
  73. },
  74. emptyImageUrl: "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="
  75. };
  76. (function () {
  77. function a(a) {
  78. var c, b, e = ["webkit", "moz", "o", "ms"];
  79. for (c = 0; c < e.length && !b; c++) b = k[e[c] + a];
  80. return b
  81. }
  82. function c(a) {
  83. var c = +new Date,
  84. b = Math.max(0, 16 - (c - e));
  85. e = c + b;
  86. return k.setTimeout(a, b)
  87. }
  88. var e = 0,
  89. d = k.requestAnimationFrame || a("RequestAnimationFrame") || c,
  90. f = k.cancelAnimationFrame || a("CancelAnimationFrame") || a("CancelRequestAnimationFrame") || function (a) {
  91. k.clearTimeout(a)
  92. };
  93. b.Util.requestAnimFrame = function (a, e, f, i) {
  94. a = b.bind(a, e);
  95. if (f && d === c) a();
  96. else return d.call(k, a, i)
  97. };
  98. b.Util.cancelAnimFrame = function (a) {
  99. a && f.call(k, a)
  100. }
  101. })();
  102. b.extend = b.Util.extend;
  103. b.bind = b.Util.bind;
  104. b.stamp = b.Util.stamp;
  105. b.setOptions = b.Util.setOptions;
  106. b.Class = function () {};
  107. b.Class.extend = function (a) {
  108. var c = function () {
  109. this.initialize && this.initialize.apply(this, arguments);
  110. this._initHooks && this.callInitHooks()
  111. },
  112. e = function () {};
  113. e.prototype = this.prototype;
  114. var d = new e;
  115. d.constructor = c;
  116. c.prototype = d;
  117. for (var f in this) this.hasOwnProperty(f) && "prototype" !== f && (c[f] = this[f]);
  118. a.statics && (b.extend(c, a.statics), delete a.statics);
  119. a.includes && (b.Util.extend.apply(null, [d].concat(a.includes)), delete a.includes);
  120. if (a.options && d.options) a.options = b.extend({}, d.options,
  121. a.options);
  122. b.extend(d, a);
  123. d._initHooks = [];
  124. var g = this;
  125. d.callInitHooks = function () {
  126. if (!this._initHooksCalled) {
  127. g.prototype.callInitHooks && g.prototype.callInitHooks.call(this);
  128. this._initHooksCalled = !0;
  129. for (var a = 0, c = d._initHooks.length; a < c; a++) d._initHooks[a].call(this)
  130. }
  131. };
  132. return c
  133. };
  134. b.Class.include = function (a) {
  135. b.extend(this.prototype, a)
  136. };
  137. b.Class.mergeOptions = function (a) {
  138. b.extend(this.prototype.options, a)
  139. };
  140. b.Class.addInitHook = function (a) {
  141. var c = Array.prototype.slice.call(arguments, 1),
  142. b;
  143. this.prototype._initHooks =
  144. this.prototype._initHooks || [];
  145. this.prototype._initHooks.push("function" === typeof a ? a : function () {
  146. this[a].apply(this, c)
  147. })
  148. };
  149. b.Mixin = {};
  150. b.Mixin.Events = {
  151. addEventListener: function (a, c, e) {
  152. var d = this._leaflet_events = this._leaflet_events || {},
  153. f, g;
  154. if ("object" === typeof a) {
  155. for (f in a) a.hasOwnProperty(f) && this.addEventListener(f, a[f], c);
  156. return this
  157. }
  158. a = b.Util.splitWords(a);
  159. for (f = 0, g = a.length; f < g; f++) d[a[f]] = d[a[f]] || [], d[a[f]].push({
  160. action: c,
  161. context: e || this
  162. });
  163. return this
  164. },
  165. hasEventListeners: function (a) {
  166. return "_leaflet_events" in
  167. this && a in this._leaflet_events && 0 < this._leaflet_events[a].length
  168. },
  169. removeEventListener: function (a, c, e) {
  170. var d = this._leaflet_events,
  171. f, g, h, j;
  172. if ("object" === typeof a) {
  173. for (f in a) a.hasOwnProperty(f) && this.removeEventListener(f, a[f], c);
  174. return this
  175. }
  176. a = b.Util.splitWords(a);
  177. for (f = 0, g = a.length; f < g; f++)
  178. if (this.hasEventListeners(a[f])) {
  179. h = d[a[f]];
  180. for (j = h.length - 1; 0 <= j; j--)(!c || h[j].action === c) && (!e || h[j].context === e) && h.splice(j, 1)
  181. }
  182. return this
  183. },
  184. fireEvent: function (a, c) {
  185. if (!this.hasEventListeners(a)) return this;
  186. for (var e =
  187. b.extend({
  188. type: a,
  189. target: this
  190. }, c), d = this._leaflet_events[a].slice(), f = 0, g = d.length; f < g; f++) d[f].action.call(d[f].context || this, e);
  191. return this
  192. }
  193. };
  194. b.Mixin.Events.on = b.Mixin.Events.addEventListener;
  195. b.Mixin.Events.off = b.Mixin.Events.removeEventListener;
  196. b.Mixin.Events.fire = b.Mixin.Events.fireEvent;
  197. (function () {
  198. var a = !!k.ActiveXObject,
  199. c = a && !k.XMLHttpRequest,
  200. e = a && !i.querySelector,
  201. d = navigator.userAgent.toLowerCase(),
  202. f = -1 !== d.indexOf("webkit"),
  203. g = -1 !== d.indexOf("chrome"),
  204. h = -1 !== d.indexOf("android"),
  205. d = -1 !== d.search("android [23]"),
  206. j = typeof orientation !== l + "",
  207. q = k.navigator && k.navigator.msPointerEnabled && k.navigator.msMaxTouchPoints,
  208. t = "devicePixelRatio" in k && 1 < k.devicePixelRatio || "matchMedia" in k && k.matchMedia("(min-resolution:144dpi)") && k.matchMedia("(min-resolution:144dpi)").matches,
  209. m = i.documentElement,
  210. n = a && "transition" in m.style,
  211. p = "WebKitCSSMatrix" in k && "m11" in new k.WebKitCSSMatrix,
  212. r = "MozPerspective" in m.style,
  213. s = "OTransition" in m.style,
  214. o = !k.L_DISABLE_3D && (n || p || r || s),
  215. u = !k.L_NO_TOUCH && function () {
  216. if (q || "ontouchstart" in m) return !0;
  217. var a = i.createElement("div"),
  218. c = !1;
  219. if (!a.setAttribute) return !1;
  220. a.setAttribute("ontouchstart", "return;");
  221. "function" === typeof a.ontouchstart && (c = !0);
  222. a.removeAttribute("ontouchstart");
  223. return c
  224. }();
  225. b.Browser = {
  226. ie: a,
  227. ie6: c,
  228. ie7: e,
  229. webkit: f,
  230. android: h,
  231. android23: d,
  232. chrome: g,
  233. ie3d: n,
  234. webkit3d: p,
  235. gecko3d: r,
  236. opera3d: s,
  237. any3d: o,
  238. mobile: j,
  239. mobileWebkit: j && f,
  240. mobileWebkit3d: j && p,
  241. mobileOpera: j && k.opera,
  242. touch: u,
  243. msTouch: q,
  244. retina: t
  245. }
  246. })();
  247. b.Point = function (a, c, b) {
  248. this.x = b ? Math.round(a) : a;
  249. this.y = b ? Math.round(c) : c
  250. };
  251. b.Point.prototype = {
  252. clone: function () {
  253. return new b.Point(this.x, this.y)
  254. },
  255. add: function (a) {
  256. return this.clone()._add(b.point(a))
  257. },
  258. _add: function (a) {
  259. this.x += a.x;
  260. this.y += a.y;
  261. return this
  262. },
  263. subtract: function (a) {
  264. return this.clone()._subtract(b.point(a))
  265. },
  266. _subtract: function (a) {
  267. this.x -= a.x;
  268. this.y -= a.y;
  269. return this
  270. },
  271. divideBy: function (a) {
  272. return this.clone()._divideBy(a)
  273. },
  274. _divideBy: function (a) {
  275. this.x /= a;
  276. this.y /= a;
  277. return this
  278. },
  279. multiplyBy: function (a) {
  280. return this.clone()._multiplyBy(a)
  281. },
  282. _multiplyBy: function (a) {
  283. this.x *= a;
  284. this.y *= a;
  285. return this
  286. },
  287. round: function () {
  288. return this.clone()._round()
  289. },
  290. _round: function () {
  291. this.x = Math.round(this.x);
  292. this.y = Math.round(this.y);
  293. return this
  294. },
  295. floor: function () {
  296. return this.clone()._floor()
  297. },
  298. _floor: function () {
  299. this.x = Math.floor(this.x);
  300. this.y = Math.floor(this.y);
  301. return this
  302. },
  303. distanceTo: function (a) {
  304. var a = b.point(a),
  305. c = a.x - this.x,
  306. a = a.y - this.y;
  307. return Math.sqrt(c * c + a * a)
  308. },
  309. equals: function (a) {
  310. return a.x === this.x && a.y === this.y
  311. },
  312. toString: function () {
  313. return "Point(" + b.Util.formatNum(this.x) + ", " + b.Util.formatNum(this.y) + ")"
  314. }
  315. };
  316. b.point = function (a, c, e) {
  317. 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)
  318. };
  319. b.Bounds = function (a, c) {
  320. if (a)
  321. for (var b = c ? [a, c] : a, d = 0, f = b.length; d < f; d++) this.extend(b[d])
  322. };
  323. b.Bounds.prototype = {
  324. extend: function (a) {
  325. a = b.point(a);
  326. !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));
  327. return this
  328. },
  329. getCenter: function (a) {
  330. return new b.Point((this.min.x +
  331. this.max.x) / 2, (this.min.y + this.max.y) / 2, a)
  332. },
  333. getBottomLeft: function () {
  334. return new b.Point(this.min.x, this.max.y)
  335. },
  336. getTopRight: function () {
  337. return new b.Point(this.max.x, this.min.y)
  338. },
  339. getSize: function () {
  340. return this.max.subtract(this.min)
  341. },
  342. contains: function (a) {
  343. var c, a = "number" === typeof a[0] || a instanceof b.Point ? b.point(a) : b.bounds(a);
  344. a instanceof b.Bounds ? (c = a.min, a = a.max) : c = a;
  345. return c.x >= this.min.x && a.x <= this.max.x && c.y >= this.min.y && a.y <= this.max.y
  346. },
  347. intersects: function (a) {
  348. var a = b.bounds(a),
  349. c = this.min,
  350. e = this.max,
  351. d = a.min,
  352. a = a.max,
  353. f = a.y >= c.y && d.y <= e.y;
  354. return a.x >= c.x && d.x <= e.x && f
  355. },
  356. isValid: function () {
  357. return !(!this.min || !this.max)
  358. }
  359. };
  360. b.bounds = function (a, c) {
  361. return !a || a instanceof b.Bounds ? a : new b.Bounds(a, c)
  362. };
  363. b.Transformation = function (a, c, b, d) {
  364. this._a = a;
  365. this._b = c;
  366. this._c = b;
  367. this._d = d
  368. };
  369. b.Transformation.prototype = {
  370. transform: function (a, c) {
  371. return this._transform(a.clone(), c)
  372. },
  373. _transform: function (a, c) {
  374. c = c || 1;
  375. a.x = c * (this._a * a.x + this._b);
  376. a.y = c * (this._c * a.y + this._d);
  377. return a
  378. },
  379. untransform: function (a, c) {
  380. c = c || 1;
  381. return new b.Point((a.x / c - this._b) / this._a, (a.y / c - this._d) / this._c)
  382. }
  383. };
  384. b.DomUtil = {
  385. get: function (a) {
  386. return "string" === typeof a ? i.getElementById(a) : a
  387. },
  388. getStyle: function (a, c) {
  389. var b = a.style[c];
  390. !b && a.currentStyle && (b = a.currentStyle[c]);
  391. if ((!b || "auto" === b) && i.defaultView) b = (b = i.defaultView.getComputedStyle(a, null)) ? b[c] : null;
  392. return "auto" === b ? null : b
  393. },
  394. getViewportOffset: function (a) {
  395. var c = 0,
  396. e = 0,
  397. d = a,
  398. f = i.body,
  399. g, h = b.Browser.ie7;
  400. do {
  401. c += d.offsetTop || 0;
  402. e += d.offsetLeft || 0;
  403. c += parseInt(b.DomUtil.getStyle(d, "borderTopWidth"),
  404. 10) || 0;
  405. e += parseInt(b.DomUtil.getStyle(d, "borderLeftWidth"), 10) || 0;
  406. g = b.DomUtil.getStyle(d, "position");
  407. if (d.offsetParent === f && "absolute" === g) break;
  408. if ("fixed" === g) {
  409. c += f.scrollTop || 0;
  410. e += f.scrollLeft || 0;
  411. break
  412. }
  413. d = d.offsetParent
  414. } while (d);
  415. d = a;
  416. do {
  417. if (d === f) break;
  418. c -= d.scrollTop || 0;
  419. e -= d.scrollLeft || 0;
  420. 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);
  421. d = d.parentNode
  422. } while (d);
  423. return new b.Point(e,
  424. c)
  425. },
  426. documentIsLtr: function () {
  427. if (!b.DomUtil._docIsLtrCached) b.DomUtil._docIsLtrCached = !0, b.DomUtil._docIsLtr = "ltr" === b.DomUtil.getStyle(i.body, "direction");
  428. return b.DomUtil._docIsLtr
  429. },
  430. create: function (a, c, b) {
  431. a = i.createElement(a);
  432. a.className = c;
  433. b && b.appendChild(a);
  434. return a
  435. },
  436. disableTextSelection: function () {
  437. i.selection && i.selection.empty && i.selection.empty();
  438. if (!this._onselectstart) this._onselectstart = i.onselectstart || null, i.onselectstart = b.Util.falseFn
  439. },
  440. enableTextSelection: function () {
  441. if (i.onselectstart ===
  442. b.Util.falseFn) i.onselectstart = this._onselectstart, this._onselectstart = null
  443. },
  444. hasClass: function (a, c) {
  445. return 0 < a.className.length && RegExp("(^|\\s)" + c + "(\\s|$)").test(a.className)
  446. },
  447. addClass: function (a, c) {
  448. b.DomUtil.hasClass(a, c) || (a.className += (a.className ? " " : "") + c)
  449. },
  450. removeClass: function (a, c) {
  451. a.className = a.className.replace(/(\S+)\s*/g, function (a, b) {
  452. return b === c ? "" : a
  453. }).replace(/(^\s+|\s+$)/, "")
  454. },
  455. setOpacity: function (a, c) {
  456. if ("opacity" in a.style) a.style.opacity = c;
  457. else if ("filter" in a.style) {
  458. var b = !1;
  459. try {
  460. b =
  461. a.filters.item("DXImageTransform.Microsoft.Alpha")
  462. } catch (d) {}
  463. c = Math.round(100 * c);
  464. b ? (b.Enabled = 100 !== c, b.Opacity = c) : a.style.filter += " progid:DXImageTransform.Microsoft.Alpha(opacity=" + c + ")"
  465. }
  466. },
  467. testProp: function (a) {
  468. for (var c = i.documentElement.style, b = 0; b < a.length; b++)
  469. if (a[b] in c) return a[b];
  470. return !1
  471. },
  472. getTranslateString: function (a) {
  473. var c = b.Browser.webkit3d;
  474. return "translate" + (c ? "3d" : "") + "(" + a.x + "px," + a.y + "px" + ((c ? ",0" : "") + ")")
  475. },
  476. getScaleString: function (a, c) {
  477. return b.DomUtil.getTranslateString(c.add(c.multiplyBy(-1 *
  478. a))) + (" scale(" + a + ") ")
  479. },
  480. setPosition: function (a, c, e) {
  481. a._leaflet_pos = c;
  482. if (!e && b.Browser.any3d) {
  483. if (a.style[b.DomUtil.TRANSFORM] = b.DomUtil.getTranslateString(c), b.Browser.mobileWebkit3d) a.style.WebkitBackfaceVisibility = "hidden"
  484. } else a.style.left = c.x + "px", a.style.top = c.y + "px"
  485. },
  486. getPosition: function (a) {
  487. return a._leaflet_pos
  488. }
  489. };
  490. b.DomUtil.TRANSFORM = b.DomUtil.testProp(["transform", "WebkitTransform", "OTransform", "MozTransform", "msTransform"]);
  491. b.DomUtil.TRANSITION = b.DomUtil.testProp(["webkitTransition", "transition",
  492. "OTransition", "MozTransition", "msTransition"
  493. ]);
  494. b.DomUtil.TRANSITION_END = "webkitTransition" === b.DomUtil.TRANSITION || "OTransition" === b.DomUtil.TRANSITION ? b.DomUtil.TRANSITION + "End" : "transitionend";
  495. b.LatLng = function (a, c) {
  496. var b = parseFloat(a),
  497. d = parseFloat(c);
  498. if (isNaN(b) || isNaN(d)) throw Error("Invalid LatLng object: (" + a + ", " + c + ")");
  499. this.lat = b;
  500. this.lng = d
  501. };
  502. b.extend(b.LatLng, {
  503. DEG_TO_RAD: Math.PI / 180,
  504. RAD_TO_DEG: 180 / Math.PI,
  505. MAX_MARGIN: 1.0E-9
  506. });
  507. b.LatLng.prototype = {
  508. equals: function (a) {
  509. if (!a) return !1;
  510. a = b.latLng(a);
  511. return Math.max(Math.abs(this.lat - a.lat), Math.abs(this.lng - a.lng)) <= b.LatLng.MAX_MARGIN
  512. },
  513. toString: function (a) {
  514. return "LatLng(" + b.Util.formatNum(this.lat, a) + ", " + b.Util.formatNum(this.lng, a) + ")"
  515. },
  516. distanceTo: function (a) {
  517. var a = b.latLng(a),
  518. c = b.LatLng.DEG_TO_RAD,
  519. e = (a.lng - this.lng) * c,
  520. d = this.lat * c,
  521. f = a.lat * c,
  522. a = Math.sin((a.lat - this.lat) * c / 2),
  523. e = Math.sin(e / 2),
  524. d = a * a + e * e * Math.cos(d) * Math.cos(f);
  525. return 12756274 * Math.atan2(Math.sqrt(d), Math.sqrt(1 - d))
  526. },
  527. wrap: function (a, c) {
  528. var e = this.lng,
  529. a = a || -180,
  530. c = c || 180;
  531. return new b.LatLng(this.lat,
  532. (e + c) % (c - a) + (e < a || e === c ? c : a))
  533. }
  534. };
  535. b.latLng = function (a, c) {
  536. 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)
  537. };
  538. b.LatLngBounds = function (a, c) {
  539. if (a)
  540. for (var b = c ? [a, c] : a, d = 0, f = b.length; d < f; d++) this.extend(b[d])
  541. };
  542. b.LatLngBounds.prototype = {
  543. extend: function (a) {
  544. a = "number" === typeof a[0] || "string" === typeof a[0] || a instanceof b.LatLng ? b.latLng(a) : b.latLngBounds(a);
  545. a instanceof b.LatLng ? !this._southWest && !this._northEast ? (this._southWest = new b.LatLng(a.lat, a.lng),
  546. 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));
  547. return this
  548. },
  549. pad: function (a) {
  550. var c = this._southWest,
  551. e = this._northEast,
  552. d = Math.abs(c.lat - e.lat) * a,
  553. a = Math.abs(c.lng - e.lng) * a;
  554. return new b.LatLngBounds(new b.LatLng(c.lat -
  555. d, c.lng - a), new b.LatLng(e.lat + d, e.lng + a))
  556. },
  557. getCenter: function () {
  558. return new b.LatLng((this._southWest.lat + this._northEast.lat) / 2, (this._southWest.lng + this._northEast.lng) / 2)
  559. },
  560. getSouthWest: function () {
  561. return this._southWest
  562. },
  563. getNorthEast: function () {
  564. return this._northEast
  565. },
  566. getNorthWest: function () {
  567. return new b.LatLng(this._northEast.lat, this._southWest.lng)
  568. },
  569. getSouthEast: function () {
  570. return new b.LatLng(this._southWest.lat, this._northEast.lng)
  571. },
  572. contains: function (a) {
  573. var a = "number" === typeof a[0] || a instanceof
  574. b.LatLng ? b.latLng(a) : b.latLngBounds(a), c = this._southWest, e = this._northEast, d;
  575. a instanceof b.LatLngBounds ? (d = a.getSouthWest(), a = a.getNorthEast()) : d = a;
  576. return d.lat >= c.lat && a.lat <= e.lat && d.lng >= c.lng && a.lng <= e.lng
  577. },
  578. intersects: function (a) {
  579. var a = b.latLngBounds(a),
  580. c = this._southWest,
  581. e = this._northEast,
  582. d = a.getSouthWest(),
  583. a = a.getNorthEast(),
  584. f = a.lng >= c.lng && d.lng <= e.lng;
  585. return a.lat >= c.lat && d.lat <= e.lat && f
  586. },
  587. toBBoxString: function () {
  588. var a = this._southWest,
  589. c = this._northEast;
  590. return [a.lng, a.lat, c.lng, c.lat].join()
  591. },
  592. equals: function (a) {
  593. if (!a) return !1;
  594. a = b.latLngBounds(a);
  595. return this._southWest.equals(a.getSouthWest()) && this._northEast.equals(a.getNorthEast())
  596. },
  597. isValid: function () {
  598. return !(!this._southWest || !this._northEast)
  599. }
  600. };
  601. b.latLngBounds = function (a, c) {
  602. return !a || a instanceof b.LatLngBounds ? a : new b.LatLngBounds(a, c)
  603. };
  604. b.Projection = {};
  605. b.Projection.SphericalMercator = {
  606. MAX_LATITUDE: 85.0511287798,
  607. project: function (a) {
  608. var c = b.LatLng.DEG_TO_RAD,
  609. e = this.MAX_LATITUDE,
  610. e = Math.max(Math.min(e, a.lat), -e),
  611. a = a.lng * c,
  612. c = Math.log(Math.tan(Math.PI /
  613. 4 + e * c / 2));
  614. return new b.Point(a, c)
  615. },
  616. unproject: function (a) {
  617. var c = b.LatLng.RAD_TO_DEG,
  618. e = a.x * c,
  619. a = (2 * Math.atan(Math.exp(a.y)) - Math.PI / 2) * c;
  620. return new b.LatLng(a, e)
  621. }
  622. };
  623. b.Projection.LonLat = {
  624. project: function (a) {
  625. return new b.Point(a.lng, a.lat)
  626. },
  627. unproject: function (a) {
  628. return new b.LatLng(a.y, a.x)
  629. }
  630. };
  631. b.CRS = {
  632. latLngToPoint: function (a, c) {
  633. var b = this.projection.project(a),
  634. d = this.scale(c);
  635. return this.transformation._transform(b, d)
  636. },
  637. pointToLatLng: function (a, c) {
  638. var b = this.scale(c);
  639. return this.projection.unproject(this.transformation.untransform(a,
  640. b))
  641. },
  642. project: function (a) {
  643. return this.projection.project(a)
  644. },
  645. scale: function (a) {
  646. return 256 * Math.pow(2, a)
  647. }
  648. };
  649. b.CRS.Simple = b.extend({}, b.CRS, {
  650. projection: b.Projection.LonLat,
  651. transformation: new b.Transformation(1, 0, -1, 0),
  652. scale: function (a) {
  653. return Math.pow(2, a)
  654. }
  655. });
  656. b.CRS.EPSG3857 = b.extend({}, b.CRS, {
  657. code: "EPSG:3857",
  658. projection: b.Projection.SphericalMercator,
  659. transformation: new b.Transformation(0.5 / Math.PI, 0.5, -0.5 / Math.PI, 0.5),
  660. project: function (a) {
  661. return this.projection.project(a).multiplyBy(6378137)
  662. }
  663. });
  664. b.CRS.EPSG900913 =
  665. b.extend({}, b.CRS.EPSG3857, {
  666. code: "EPSG:900913"
  667. });
  668. b.CRS.EPSG4326 = b.extend({}, b.CRS, {
  669. code: "EPSG:4326",
  670. projection: b.Projection.LonLat,
  671. transformation: new b.Transformation(1 / 360, 0.5, -1 / 360, 0.5)
  672. });
  673. b.Map = b.Class.extend({
  674. includes: b.Mixin.Events,
  675. options: {
  676. crs: b.CRS.EPSG3857,
  677. fadeAnimation: b.DomUtil.TRANSITION && !b.Browser.android23,
  678. trackResize: !0,
  679. markerZoomAnimation: b.DomUtil.TRANSITION && b.Browser.any3d
  680. },
  681. initialize: function (a, c) {
  682. c = b.setOptions(this, c);
  683. this._initContainer(a);
  684. this._initLayout();
  685. this.callInitHooks();
  686. this._initEvents();
  687. c.maxBounds && this.setMaxBounds(c.maxBounds);
  688. c.center && c.zoom !== l && this.setView(b.latLng(c.center), c.zoom, !0);
  689. this._initLayers(c.layers)
  690. },
  691. setView: function (a, c) {
  692. this._resetView(b.latLng(a), this._limitZoom(c));
  693. return this
  694. },
  695. setZoom: function (a) {
  696. return this.setView(this.getCenter(), a)
  697. },
  698. zoomIn: function (a) {
  699. return this.setZoom(this._zoom + (a || 1))
  700. },
  701. zoomOut: function (a) {
  702. return this.setZoom(this._zoom - (a || 1))
  703. },
  704. fitBounds: function (a) {
  705. var c = this.getBoundsZoom(a);
  706. return this.setView(b.latLngBounds(a).getCenter(),
  707. c)
  708. },
  709. fitWorld: function () {
  710. var a = new b.LatLng(-60, -170),
  711. c = new b.LatLng(85, 179);
  712. return this.fitBounds(new b.LatLngBounds(a, c))
  713. },
  714. panTo: function (a) {
  715. return this.setView(a, this._zoom)
  716. },
  717. panBy: function (a) {
  718. this.fire("movestart");
  719. this._rawPanBy(b.point(a));
  720. this.fire("move");
  721. return this.fire("moveend")
  722. },
  723. setMaxBounds: function (a) {
  724. a = b.latLngBounds(a);
  725. this.options.maxBounds = a;
  726. if (!a) return this._boundsMinZoom = null, this;
  727. var c = this.getBoundsZoom(a, !0);
  728. this._boundsMinZoom = c;
  729. this._loaded && (this._zoom < c ? this.setView(a.getCenter(),
  730. c) : this.panInsideBounds(a));
  731. return this
  732. },
  733. panInsideBounds: function (a) {
  734. var a = b.latLngBounds(a),
  735. c = this.getBounds(),
  736. e = this.project(c.getSouthWest()),
  737. c = this.project(c.getNorthEast()),
  738. d = this.project(a.getSouthWest()),
  739. a = this.project(a.getNorthEast()),
  740. f = 0,
  741. g = 0;
  742. c.y < a.y && (g = a.y - c.y);
  743. c.x > a.x && (f = a.x - c.x);
  744. e.y > d.y && (g = d.y - e.y);
  745. e.x < d.x && (f = d.x - e.x);
  746. return this.panBy(new b.Point(f, g, !0))
  747. },
  748. addLayer: function (a) {
  749. var c = b.stamp(a);
  750. if (this._layers[c]) return this;
  751. this._layers[c] = a;
  752. if (a.options && (!isNaN(a.options.maxZoom) ||
  753. !isNaN(a.options.minZoom))) this._zoomBoundLayers[c] = a, this._updateZoomLevels();
  754. this.options.zoomAnimation && b.TileLayer && a instanceof b.TileLayer && (this._tileLayersNum++, this._tileLayersToLoad++, a.on("load", this._onTileLayerLoad, this));
  755. this.whenReady(function () {
  756. a.onAdd(this);
  757. this.fire("layeradd", {
  758. layer: a
  759. })
  760. }, this);
  761. return this
  762. },
  763. removeLayer: function (a) {
  764. var c = b.stamp(a);
  765. if (this._layers[c]) return a.onRemove(this), delete this._layers[c], this._zoomBoundLayers[c] && (delete this._zoomBoundLayers[c], this._updateZoomLevels()),
  766. this.options.zoomAnimation && b.TileLayer && a instanceof b.TileLayer && (this._tileLayersNum--, this._tileLayersToLoad--, a.off("load", this._onTileLayerLoad, this)), this.fire("layerremove", {
  767. layer: a
  768. })
  769. },
  770. hasLayer: function (a) {
  771. return this._layers.hasOwnProperty(b.stamp(a))
  772. },
  773. invalidateSize: function (a) {
  774. var c = this.getSize();
  775. this._sizeChanged = !0;
  776. this.options.maxBounds && this.setMaxBounds(this.options.maxBounds);
  777. if (!this._loaded) return this;
  778. c = c._subtract(this.getSize())._divideBy(2)._round();
  779. !0 === a ? this.panBy(c) : (this._rawPanBy(c),
  780. this.fire("move"), clearTimeout(this._sizeTimer), this._sizeTimer = setTimeout(b.bind(this.fire, this, "moveend"), 200));
  781. return this
  782. },
  783. addHandler: function (a, c) {
  784. if (c) return this[a] = new c(this), this.options[a] && this[a].enable(), this
  785. },
  786. getCenter: function () {
  787. return this.layerPointToLatLng(this._getCenterLayerPoint())
  788. },
  789. getZoom: function () {
  790. return this._zoom
  791. },
  792. getBounds: function () {
  793. var a = this.getPixelBounds(),
  794. c = this.unproject(a.getBottomLeft()),
  795. a = this.unproject(a.getTopRight());
  796. return new b.LatLngBounds(c, a)
  797. },
  798. getMinZoom: function () {
  799. return Math.max(this.options.minZoom ||
  800. 0, this._layersMinZoom || 0, this._boundsMinZoom || 0)
  801. },
  802. getMaxZoom: function () {
  803. return Math.min(this.options.maxZoom === l ? Infinity : this.options.maxZoom, this._layersMaxZoom === l ? Infinity : this._layersMaxZoom)
  804. },
  805. getBoundsZoom: function (a, c) {
  806. var a = b.latLngBounds(a),
  807. e = this.getSize(),
  808. d = this.options.minZoom || 0,
  809. f = this.getMaxZoom(),
  810. g = a.getNorthEast(),
  811. h = a.getSouthWest(),
  812. j, i;
  813. j = !0;
  814. c && d--;
  815. 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 <=
  816. e.y; while (j && d <= f);
  817. return j && c ? null : c ? d : d - 1
  818. },
  819. getSize: function () {
  820. if (!this._size || this._sizeChanged) this._size = new b.Point(this._container.clientWidth, this._container.clientHeight), this._sizeChanged = !1;
  821. return this._size.clone()
  822. },
  823. getPixelBounds: function () {
  824. var a = this._getTopLeftPoint();
  825. return new b.Bounds(a, a.add(this.getSize()))
  826. },
  827. getPixelOrigin: function () {
  828. return this._initialTopLeftPoint
  829. },
  830. getPanes: function () {
  831. return this._panes
  832. },
  833. getContainer: function () {
  834. return this._container
  835. },
  836. getZoomScale: function (a) {
  837. var c =
  838. this.options.crs;
  839. return c.scale(a) / c.scale(this._zoom)
  840. },
  841. getScaleZoom: function (a) {
  842. return this._zoom + Math.log(a) / Math.LN2
  843. },
  844. project: function (a, c) {
  845. c = c === l ? this._zoom : c;
  846. return this.options.crs.latLngToPoint(b.latLng(a), c)
  847. },
  848. unproject: function (a, c) {
  849. c = c === l ? this._zoom : c;
  850. return this.options.crs.pointToLatLng(b.point(a), c)
  851. },
  852. layerPointToLatLng: function (a) {
  853. return this.unproject(b.point(a).add(this._initialTopLeftPoint))
  854. },
  855. latLngToLayerPoint: function (a) {
  856. return this.project(b.latLng(a))._round()._subtract(this._initialTopLeftPoint)
  857. },
  858. containerPointToLayerPoint: function (a) {
  859. return b.point(a).subtract(this._getMapPanePos())
  860. },
  861. layerPointToContainerPoint: function (a) {
  862. return b.point(a).add(this._getMapPanePos())
  863. },
  864. containerPointToLatLng: function (a) {
  865. return this.layerPointToLatLng(this.containerPointToLayerPoint(b.point(a)))
  866. },
  867. latLngToContainerPoint: function (a) {
  868. return this.layerPointToContainerPoint(this.latLngToLayerPoint(b.latLng(a)))
  869. },
  870. mouseEventToContainerPoint: function (a) {
  871. return b.DomEvent.getMousePosition(a, this._container)
  872. },
  873. mouseEventToLayerPoint: function (a) {
  874. return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(a))
  875. },
  876. mouseEventToLatLng: function (a) {
  877. return this.layerPointToLatLng(this.mouseEventToLayerPoint(a))
  878. },
  879. _initContainer: function (a) {
  880. a = this._container = b.DomUtil.get(a);
  881. if (a._leaflet) throw Error("Map container is already initialized.");
  882. a._leaflet = !0
  883. },
  884. _initLayout: function () {
  885. var a = this._container;
  886. b.DomUtil.addClass(a, "leaflet-container");
  887. b.Browser.touch && b.DomUtil.addClass(a, "leaflet-touch");
  888. this.options.fadeAnimation && b.DomUtil.addClass(a, "leaflet-fade-anim");
  889. var c = b.DomUtil.getStyle(a, "position");
  890. if ("absolute" !==
  891. c && "relative" !== c && "fixed" !== c) a.style.position = "relative";
  892. this._initPanes();
  893. this._initControlPos && this._initControlPos()
  894. },
  895. _initPanes: function () {
  896. var a = this._panes = {};
  897. this._mapPane = a.mapPane = this._createPane("leaflet-map-pane", this._container);
  898. this._tilePane = a.tilePane = this._createPane("leaflet-tile-pane", this._mapPane);
  899. a.objectsPane = this._createPane("leaflet-objects-pane", this._mapPane);
  900. a.shadowPane = this._createPane("leaflet-shadow-pane");
  901. a.overlayPane = this._createPane("leaflet-overlay-pane");
  902. a.markerPane =
  903. this._createPane("leaflet-marker-pane");
  904. a.popupPane = this._createPane("leaflet-popup-pane");
  905. 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"))
  906. },
  907. _createPane: function (a, c) {
  908. return b.DomUtil.create("div", a, c || this._panes.objectsPane)
  909. },
  910. _initLayers: function (a) {
  911. a = a ? b.Util.isArray(a) ? a : [a] : [];
  912. this._layers = {};
  913. this._zoomBoundLayers = {};
  914. this._tileLayersNum = 0;
  915. var c, e;
  916. for (c = 0, e = a.length; c < e; c++) this.addLayer(a[c])
  917. },
  918. _resetView: function (a, c, e, d) {
  919. var f = this._zoom !== c;
  920. d || (this.fire("movestart"), f && this.fire("zoomstart"));
  921. this._zoom = c;
  922. this._initialTopLeftPoint = this._getNewTopLeftPoint(a);
  923. e ? this._initialTopLeftPoint._add(this._getMapPanePos()) : b.DomUtil.setPosition(this._mapPane, new b.Point(0, 0));
  924. this._tileLayersToLoad = this._tileLayersNum;
  925. a = !this._loaded;
  926. this._loaded = !0;
  927. this.fire("viewreset", {
  928. hard: !e
  929. });
  930. this.fire("move");
  931. (f || d) && this.fire("zoomend");
  932. this.fire("moveend", {
  933. hard: !e
  934. });
  935. a && this.fire("load")
  936. },
  937. _rawPanBy: function (a) {
  938. b.DomUtil.setPosition(this._mapPane, this._getMapPanePos().subtract(a))
  939. },
  940. _updateZoomLevels: function () {
  941. var a, c = Infinity,
  942. b = -Infinity;
  943. for (a in this._zoomBoundLayers)
  944. if (this._zoomBoundLayers.hasOwnProperty(a)) {
  945. var d = this._zoomBoundLayers[a];
  946. isNaN(d.options.minZoom) || (c = Math.min(c, d.options.minZoom));
  947. isNaN(d.options.maxZoom) || (b = Math.max(b, d.options.maxZoom))
  948. }
  949. a === l ? this._layersMaxZoom = this._layersMinZoom = l : (this._layersMaxZoom = b, this._layersMinZoom =
  950. c)
  951. },
  952. _initEvents: function () {
  953. if (b.DomEvent) {
  954. b.DomEvent.on(this._container, "click", this._onMouseClick, this);
  955. var a = "dblclick,mousedown,mouseup,mouseenter,mouseleave,mousemove,contextmenu".split(","),
  956. c, e;
  957. for (c = 0, e = a.length; c < e; c++) b.DomEvent.on(this._container, a[c], this._fireMouseEvent, this);
  958. if (this.options.trackResize) b.DomEvent.on(k, "resize", this._onResize, this)
  959. }
  960. },
  961. _onResize: function () {
  962. b.Util.cancelAnimFrame(this._resizeRequest);
  963. this._resizeRequest = b.Util.requestAnimFrame(this.invalidateSize, this, !1,
  964. this._container)
  965. },
  966. _onMouseClick: function (a) {
  967. if (this._loaded && (!this.dragging || !this.dragging.moved())) this.fire("preclick"), this._fireMouseEvent(a)
  968. },
  969. _fireMouseEvent: function (a) {
  970. if (this._loaded) {
  971. var c = a.type,
  972. c = "mouseenter" === c ? "mouseover" : "mouseleave" === c ? "mouseout" : c;
  973. if (this.hasEventListeners(c)) {
  974. "contextmenu" === c && b.DomEvent.preventDefault(a);
  975. var e = this.mouseEventToContainerPoint(a),
  976. d = this.containerPointToLayerPoint(e),
  977. f = this.layerPointToLatLng(d);
  978. this.fire(c, {
  979. latlng: f,
  980. layerPoint: d,
  981. containerPoint: e,
  982. originalEvent: a
  983. })
  984. }
  985. }
  986. },
  987. _onTileLayerLoad: function () {
  988. this._tileLayersToLoad--;
  989. if (this._tileLayersNum && !this._tileLayersToLoad && this._tileBg) clearTimeout(this._clearTileBgTimer), this._clearTileBgTimer = setTimeout(b.bind(this._clearTileBg, this), 500)
  990. },
  991. whenReady: function (a, c) {
  992. if (this._loaded) a.call(c || this, this);
  993. else this.on("load", a, c);
  994. return this
  995. },
  996. _getMapPanePos: function () {
  997. return b.DomUtil.getPosition(this._mapPane)
  998. },
  999. _getTopLeftPoint: function () {
  1000. if (!this._loaded) throw Error("Set map center and zoom first.");
  1001. return this._initialTopLeftPoint.subtract(this._getMapPanePos())
  1002. },
  1003. _getNewTopLeftPoint: function (a, c) {
  1004. var b = this.getSize()._divideBy(2);
  1005. return this.project(a, c)._subtract(b)._round()
  1006. },
  1007. _latLngToNewLayerPoint: function (a, c, b) {
  1008. b = this._getNewTopLeftPoint(b, c).add(this._getMapPanePos());
  1009. return this.project(a, c)._subtract(b)
  1010. },
  1011. _getCenterLayerPoint: function () {
  1012. return this.containerPointToLayerPoint(this.getSize()._divideBy(2))
  1013. },
  1014. _getCenterOffset: function (a) {
  1015. return this.latLngToLayerPoint(a).subtract(this._getCenterLayerPoint())
  1016. },
  1017. _limitZoom: function (a) {
  1018. var c = this.getMinZoom(),
  1019. b = this.getMaxZoom();
  1020. return Math.max(c, Math.min(b, a))
  1021. }
  1022. });
  1023. b.map = function (a, c) {
  1024. return new b.Map(a, c)
  1025. };
  1026. b.Projection.Mercator = {
  1027. MAX_LATITUDE: 85.0840591556,
  1028. R_MINOR: 6356752.3142,
  1029. R_MAJOR: 6378137,
  1030. project: function (a) {
  1031. var c = b.LatLng.DEG_TO_RAD,
  1032. e = this.MAX_LATITUDE,
  1033. d = Math.max(Math.min(e, a.lat), -e),
  1034. f = this.R_MAJOR,
  1035. e = this.R_MINOR,
  1036. a = a.lng * c * f,
  1037. c = d * c,
  1038. f = e / f,
  1039. f = Math.sqrt(1 - f * f),
  1040. d = f * Math.sin(c),
  1041. d = Math.pow((1 - d) / (1 + d), 0.5 * f),
  1042. c = Math.tan(0.5 * (0.5 * Math.PI - c)) / d,
  1043. c = -e * Math.log(c);
  1044. return new b.Point(a, c)
  1045. },
  1046. unproject: function (a) {
  1047. 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;
  1048. return new b.LatLng(d * c, f)
  1049. }
  1050. };
  1051. b.CRS.EPSG3395 = b.extend({}, b.CRS, {
  1052. code: "EPSG:3395",
  1053. projection: b.Projection.Mercator,
  1054. transformation: function () {
  1055. var a = b.Projection.Mercator;
  1056. return new b.Transformation(0.5 /
  1057. (Math.PI * a.R_MAJOR), 0.5, -0.5 / (Math.PI * a.R_MINOR), 0.5)
  1058. }()
  1059. });
  1060. b.TileLayer = b.Class.extend({
  1061. includes: b.Mixin.Events,
  1062. options: {
  1063. minZoom: 0,
  1064. maxZoom: 18,
  1065. tileSize: 256,
  1066. subdomains: "abc",
  1067. errorTileUrl: "",
  1068. attribution: "",
  1069. zoomOffset: 0,
  1070. opacity: 1,
  1071. unloadInvisibleTiles: b.Browser.mobile,
  1072. updateWhenIdle: b.Browser.mobile
  1073. },
  1074. initialize: function (a, c) {
  1075. c = b.setOptions(this, c);
  1076. 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--;
  1077. this._url =
  1078. a;
  1079. var e = this.options.subdomains;
  1080. if ("string" === typeof e) this.options.subdomains = e.split("")
  1081. },
  1082. onAdd: function (a) {
  1083. this._map = a;
  1084. this._initContainer();
  1085. this._createTileProto();
  1086. a.on({
  1087. viewreset: this._resetCallback,
  1088. moveend: this._update
  1089. }, this);
  1090. if (!this.options.updateWhenIdle) this._limitedUpdate = b.Util.limitExecByInterval(this._update, 150, this), a.on("move", this._limitedUpdate, this);
  1091. this._reset();
  1092. this._update()
  1093. },
  1094. addTo: function (a) {
  1095. a.addLayer(this);
  1096. return this
  1097. },
  1098. onRemove: function (a) {
  1099. this._container.parentNode.removeChild(this._container);
  1100. a.off({
  1101. viewreset: this._resetCallback,
  1102. moveend: this._update
  1103. }, this);
  1104. this.options.updateWhenIdle || a.off("move", this._limitedUpdate, this);
  1105. this._map = this._container = null
  1106. },
  1107. bringToFront: function () {
  1108. var a = this._map._panes.tilePane;
  1109. this._container && (a.appendChild(this._container), this._setAutoZIndex(a, Math.max));
  1110. return this
  1111. },
  1112. bringToBack: function () {
  1113. var a = this._map._panes.tilePane;
  1114. this._container && (a.insertBefore(this._container, a.firstChild), this._setAutoZIndex(a, Math.min));
  1115. return this
  1116. },
  1117. getAttribution: function () {
  1118. return this.options.attribution
  1119. },
  1120. setOpacity: function (a) {
  1121. this.options.opacity = a;
  1122. this._map && this._updateOpacity();
  1123. return this
  1124. },
  1125. setZIndex: function (a) {
  1126. this.options.zIndex = a;
  1127. this._updateZIndex();
  1128. return this
  1129. },
  1130. setUrl: function (a, c) {
  1131. this._url = a;
  1132. c || this.redraw();
  1133. return this
  1134. },
  1135. redraw: function () {
  1136. if (this._map) this._map._panes.tilePane.empty = !1, this._reset(!0), this._update();
  1137. return this
  1138. },
  1139. _updateZIndex: function () {
  1140. if (this._container && this.options.zIndex !== l) this._container.style.zIndex = this.options.zIndex
  1141. },
  1142. _setAutoZIndex: function (a, c) {
  1143. var b = a.children,
  1144. d = -c(Infinity, -Infinity),
  1145. f, g, h;
  1146. 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)));
  1147. this.options.zIndex = this._container.style.zIndex = (isFinite(d) ? d : 0) + c(1, -1)
  1148. },
  1149. _updateOpacity: function () {
  1150. b.DomUtil.setOpacity(this._container, this.options.opacity);
  1151. var a, c = this._tiles;
  1152. if (b.Browser.webkit)
  1153. for (a in c) c.hasOwnProperty(a) && (c[a].style.webkitTransform += " translate(0,0)")
  1154. },
  1155. _initContainer: function () {
  1156. var a = this._map._panes.tilePane;
  1157. if (!this._container || a.empty) this._container =
  1158. b.DomUtil.create("div", "leaflet-layer"), this._updateZIndex(), a.appendChild(this._container), 1 > this.options.opacity && this._updateOpacity()
  1159. },
  1160. _resetCallback: function (a) {
  1161. this._reset(a.hard)
  1162. },
  1163. _reset: function (a) {
  1164. var c = this._tiles,
  1165. b;
  1166. for (b in c) c.hasOwnProperty(b) && this.fire("tileunload", {
  1167. tile: c[b]
  1168. });
  1169. this._tiles = {};
  1170. this._tilesToLoad = 0;
  1171. if (this.options.reuseTiles) this._unusedTiles = [];
  1172. if (a && this._container) this._container.innerHTML = "";
  1173. this._initContainer()
  1174. },
  1175. _update: function () {
  1176. if (this._map) {
  1177. var a = this._map.getPixelBounds(),
  1178. c = this._map.getZoom(),
  1179. e = this.options.tileSize;
  1180. 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))
  1181. }
  1182. },
  1183. _addTilesFromCenterOut: function (a) {
  1184. var c = [],
  1185. e = a.getCenter(),
  1186. d, f, g;
  1187. for (d = a.min.y; d <= a.max.y; d++)
  1188. for (f = a.min.x; f <= a.max.x; f++) g = new b.Point(f, d), this._tileShouldBeLoaded(g) &&
  1189. c.push(g);
  1190. a = c.length;
  1191. if (0 !== a) {
  1192. c.sort(function (a, c) {
  1193. return a.distanceTo(e) - c.distanceTo(e)
  1194. });
  1195. d = i.createDocumentFragment();
  1196. this._tilesToLoad || this.fire("loading");
  1197. this._tilesToLoad += a;
  1198. for (f = 0; f < a; f++) this._addTile(c[f], d);
  1199. this._container.appendChild(d)
  1200. }
  1201. },
  1202. _tileShouldBeLoaded: function (a) {
  1203. if (a.x + ":" + a.y in this._tiles) return !1;
  1204. if (!this.options.continuousWorld) {
  1205. var c = this._getWrapTileNum();
  1206. if (this.options.noWrap && (0 > a.x || a.x >= c) || 0 > a.y || a.y >= c) return !1
  1207. }
  1208. return !0
  1209. },
  1210. _removeOtherTiles: function (a) {
  1211. var c, b, d;
  1212. 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))
  1213. },
  1214. _removeTile: function (a) {
  1215. var c = this._tiles[a];
  1216. this.fire("tileunload", {
  1217. tile: c,
  1218. url: c.src
  1219. });
  1220. this.options.reuseTiles ? (b.DomUtil.removeClass(c, "leaflet-tile-loaded"), this._unusedTiles.push(c)) : c.parentNode === this._container && this._container.removeChild(c);
  1221. if (!b.Browser.android) c.src = b.Util.emptyImageUrl;
  1222. delete this._tiles[a]
  1223. },
  1224. _addTile: function (a,
  1225. c) {
  1226. var e = this._getTilePos(a),
  1227. d = this._getTile();
  1228. b.DomUtil.setPosition(d, e, b.Browser.chrome || b.Browser.android23);
  1229. this._tiles[a.x + ":" + a.y] = d;
  1230. this._loadTile(d, a);
  1231. d.parentNode !== this._container && c.appendChild(d)
  1232. },
  1233. _getZoomForUrl: function () {
  1234. var a = this.options,
  1235. c = this._map.getZoom();
  1236. a.zoomReverse && (c = a.maxZoom - c);
  1237. return c + a.zoomOffset
  1238. },
  1239. _getTilePos: function (a) {
  1240. var c = this._map.getPixelOrigin();
  1241. return a.multiplyBy(this.options.tileSize).subtract(c)
  1242. },
  1243. getTileUrl: function (a) {
  1244. this._adjustTilePoint(a);
  1245. return b.Util.template(this._url,
  1246. b.extend({
  1247. s: this._getSubdomain(a),
  1248. z: this._getZoomForUrl(),
  1249. x: a.x,
  1250. y: a.y
  1251. }, this.options))
  1252. },
  1253. _getWrapTileNum: function () {
  1254. return Math.pow(2, this._getZoomForUrl())
  1255. },
  1256. _adjustTilePoint: function (a) {
  1257. var c = this._getWrapTileNum();
  1258. if (!this.options.continuousWorld && !this.options.noWrap) a.x = (a.x % c + c) % c;
  1259. if (this.options.tms) a.y = c - a.y - 1
  1260. },
  1261. _getSubdomain: function (a) {
  1262. return this.options.subdomains[(a.x + a.y) % this.options.subdomains.length]
  1263. },
  1264. _createTileProto: function () {
  1265. var a = this._tileImg = b.DomUtil.create("img", "leaflet-tile");
  1266. a.style.width = a.style.height = this.options.tileSize + "px";
  1267. a.galleryimg = "no"
  1268. },
  1269. _getTile: function () {
  1270. if (this.options.reuseTiles && 0 < this._unusedTiles.length) {
  1271. var a = this._unusedTiles.pop();
  1272. this._resetTile(a);
  1273. return a
  1274. }
  1275. return this._createTile()
  1276. },
  1277. _resetTile: function () {},
  1278. _createTile: function () {
  1279. var a = this._tileImg.cloneNode(!1);
  1280. a.onselectstart = a.onmousemove = b.Util.falseFn;
  1281. return a
  1282. },
  1283. _loadTile: function (a, c) {
  1284. a._layer = this;
  1285. a.onload = this._tileOnLoad;
  1286. a.onerror = this._tileOnError;
  1287. a.src = this.getTileUrl(c)
  1288. },
  1289. _tileLoaded: function () {
  1290. this._tilesToLoad--;
  1291. this._tilesToLoad || this.fire("load")
  1292. },
  1293. _tileOnLoad: function () {
  1294. var a = this._layer;
  1295. this.src !== b.Util.emptyImageUrl && (b.DomUtil.addClass(this, "leaflet-tile-loaded"), a.fire("tileload", {
  1296. tile: this,
  1297. url: this.src
  1298. }));
  1299. a._tileLoaded()
  1300. },
  1301. _tileOnError: function () {
  1302. var a = this._layer;
  1303. a.fire("tileerror", {
  1304. tile: this,
  1305. url: this.src
  1306. });
  1307. var c = a.options.errorTileUrl;
  1308. if (c) this.src = c;
  1309. a._tileLoaded()
  1310. }
  1311. });
  1312. b.tileLayer = function (a, c) {
  1313. return new b.TileLayer(a, c)
  1314. };
  1315. b.TileLayer.WMS = b.TileLayer.extend({
  1316. defaultWmsParams: {
  1317. service: "WMS",
  1318. request: "GetMap",
  1319. version: "1.1.1",
  1320. layers: "",
  1321. styles: "",
  1322. format: "image/jpeg",
  1323. transparent: !1
  1324. },
  1325. initialize: function (a, c) {
  1326. this._url = a;
  1327. var e = b.extend({}, this.defaultWmsParams);
  1328. e.width = c.detectRetina && b.Browser.retina ? e.height = 2 * this.options.tileSize : e.height = this.options.tileSize;
  1329. for (var d in c) this.options.hasOwnProperty(d) || (e[d] = c[d]);
  1330. this.wmsParams = e;
  1331. b.setOptions(this, c)
  1332. },
  1333. onAdd: function (a) {
  1334. this.wmsParams[1.3 <= parseFloat(this.wmsParams.version) ? "crs" : "srs"] = a.options.crs.code;
  1335. b.TileLayer.prototype.onAdd.call(this, a)
  1336. },
  1337. getTileUrl: function (a,
  1338. c) {
  1339. this._adjustTilePoint(a);
  1340. var e = this._map,
  1341. d = e.options.crs,
  1342. f = this.options.tileSize,
  1343. g = a.multiplyBy(f),
  1344. f = g.add(new b.Point(f, f)),
  1345. g = d.project(e.unproject(g, c)),
  1346. e = d.project(e.unproject(f, c)),
  1347. e = [g.x, e.y, e.x, g.y].join(),
  1348. d = b.Util.template(this._url, {
  1349. s: this._getSubdomain(a)
  1350. });
  1351. return d + b.Util.getParamString(this.wmsParams, d) + "&bbox=" + e
  1352. },
  1353. setParams: function (a, c) {
  1354. b.extend(this.wmsParams, a);
  1355. c || this.redraw();
  1356. return this
  1357. }
  1358. });
  1359. b.tileLayer.wms = function (a, c) {
  1360. return new b.TileLayer.WMS(a, c)
  1361. };
  1362. b.TileLayer.Canvas = b.TileLayer.extend({
  1363. options: {
  1364. async: !1
  1365. },
  1366. initialize: function (a) {
  1367. b.setOptions(this, a)
  1368. },
  1369. redraw: function () {
  1370. var a = this._tiles,
  1371. c;
  1372. for (c in a) a.hasOwnProperty(c) && this._redrawTile(a[c])
  1373. },
  1374. _redrawTile: function (a) {
  1375. this.drawTile(a, a._tilePoint, this._map._zoom)
  1376. },
  1377. _createTileProto: function () {
  1378. var a = this._canvasProto = b.DomUtil.create("canvas", "leaflet-tile");
  1379. a.width = a.height = this.options.tileSize
  1380. },
  1381. _createTile: function () {
  1382. var a = this._canvasProto.cloneNode(!1);
  1383. a.onselectstart = a.onmousemove = b.Util.falseFn;
  1384. return a
  1385. },
  1386. _loadTile: function (a, c) {
  1387. a._layer = this;
  1388. a._tilePoint =
  1389. c;
  1390. this._redrawTile(a);
  1391. this.options.async || this.tileDrawn(a)
  1392. },
  1393. drawTile: function () {},
  1394. tileDrawn: function (a) {
  1395. this._tileOnLoad.call(a)
  1396. }
  1397. });
  1398. b.tileLayer.canvas = function (a) {
  1399. return new b.TileLayer.Canvas(a)
  1400. };
  1401. b.ImageOverlay = b.Class.extend({
  1402. includes: b.Mixin.Events,
  1403. options: {
  1404. opacity: 1
  1405. },
  1406. initialize: function (a, c, e) {
  1407. this._url = a;
  1408. this._bounds = b.latLngBounds(c);
  1409. b.setOptions(this, e)
  1410. },
  1411. onAdd: function (a) {
  1412. this._map = a;
  1413. this._image || this._initImage();
  1414. a._panes.overlayPane.appendChild(this._image);
  1415. a.on("viewreset", this._reset,
  1416. this);
  1417. if (a.options.zoomAnimation && b.Browser.any3d) a.on("zoomanim", this._animateZoom, this);
  1418. this._reset()
  1419. },
  1420. onRemove: function (a) {
  1421. a.getPanes().overlayPane.removeChild(this._image);
  1422. a.off("viewreset", this._reset, this);
  1423. a.options.zoomAnimation && a.off("zoomanim", this._animateZoom, this)
  1424. },
  1425. addTo: function (a) {
  1426. a.addLayer(this);
  1427. return this
  1428. },
  1429. setOpacity: function (a) {
  1430. this.options.opacity = a;
  1431. this._updateOpacity();
  1432. return this
  1433. },
  1434. bringToFront: function () {
  1435. this._image && this._map._panes.overlayPane.appendChild(this._image);
  1436. return this
  1437. },
  1438. bringToBack: function () {
  1439. var a = this._map._panes.overlayPane;
  1440. this._image && a.insertBefore(this._image, a.firstChild);
  1441. return this
  1442. },
  1443. _initImage: function () {
  1444. this._image = b.DomUtil.create("img", "leaflet-image-layer");
  1445. this._map.options.zoomAnimation && b.Browser.any3d ? b.DomUtil.addClass(this._image, "leaflet-zoom-animated") : b.DomUtil.addClass(this._image, "leaflet-zoom-hide");
  1446. this._updateOpacity();
  1447. b.extend(this._image, {
  1448. galleryimg: "no",
  1449. onselectstart: b.Util.falseFn,
  1450. onmousemove: b.Util.falseFn,
  1451. onload: b.bind(this._onImageLoad,
  1452. this),
  1453. src: this._url
  1454. })
  1455. },
  1456. _animateZoom: function (a) {
  1457. var c = this._map,
  1458. e = this._image,
  1459. d = c.getZoomScale(a.zoom),
  1460. f = this._bounds.getNorthWest(),
  1461. g = this._bounds.getSouthEast(),
  1462. f = c._latLngToNewLayerPoint(f, a.zoom, a.center),
  1463. a = c._latLngToNewLayerPoint(g, a.zoom, a.center)._subtract(f),
  1464. a = f._add(a._multiplyBy(0.5 * (1 - 1 / d)));
  1465. e.style[b.DomUtil.TRANSFORM] = b.DomUtil.getTranslateString(a) + " scale(" + d + ") "
  1466. },
  1467. _reset: function () {
  1468. var a = this._image,
  1469. c = this._map.latLngToLayerPoint(this._bounds.getNorthWest()),
  1470. e = this._map.latLngToLayerPoint(this._bounds.getSouthEast())._subtract(c);
  1471. b.DomUtil.setPosition(a, c);
  1472. a.style.width = e.x + "px";
  1473. a.style.height = e.y + "px"
  1474. },
  1475. _onImageLoad: function () {
  1476. this.fire("load")
  1477. },
  1478. _updateOpacity: function () {
  1479. b.DomUtil.setOpacity(this._image, this.options.opacity)
  1480. }
  1481. });
  1482. b.imageOverlay = function (a, c, e) {
  1483. return new b.ImageOverlay(a, c, e)
  1484. };
  1485. b.Icon = b.Class.extend({
  1486. options: {
  1487. className: ""
  1488. },
  1489. initialize: function (a) {
  1490. b.setOptions(this, a)
  1491. },
  1492. createIcon: function () {
  1493. return this._createIcon("icon")
  1494. },
  1495. createShadow: function () {
  1496. return this._createIcon("shadow")
  1497. },
  1498. _createIcon: function (a) {
  1499. var c =
  1500. this._getIconUrl(a);
  1501. if (!c) {
  1502. if ("icon" === a) throw Error("iconUrl not set in Icon options (see the docs).");
  1503. return null
  1504. }
  1505. c = this._createImg(c);
  1506. this._setIconStyles(c, a);
  1507. return c
  1508. },
  1509. _setIconStyles: function (a, c) {
  1510. var e = this.options,
  1511. d = b.point(e[c + "Size"]),
  1512. f;
  1513. f = "shadow" === c ? b.point(e.shadowAnchor || e.iconAnchor) : b.point(e.iconAnchor);
  1514. !f && d && (f = d.divideBy(2, !0));
  1515. a.className = "leaflet-marker-" + c + " " + e.className;
  1516. if (f) a.style.marginLeft = -f.x + "px", a.style.marginTop = -f.y + "px";
  1517. if (d) a.style.width = d.x + "px", a.style.height =
  1518. d.y + "px"
  1519. },
  1520. _createImg: function (a) {
  1521. var c;
  1522. b.Browser.ie6 ? (c = i.createElement("div"), c.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + a + '")') : (c = i.createElement("img"), c.src = a);
  1523. return c
  1524. },
  1525. _getIconUrl: function (a) {
  1526. return b.Browser.retina && this.options[a + "RetinaUrl"] ? this.options[a + "RetinaUrl"] : this.options[a + "Url"]
  1527. }
  1528. });
  1529. b.icon = function (a) {
  1530. return new b.Icon(a)
  1531. };
  1532. b.Icon.Default = b.Icon.extend({
  1533. options: {
  1534. iconSize: new b.Point(25, 41),
  1535. iconAnchor: new b.Point(12, 41),
  1536. popupAnchor: new b.Point(1, -34),
  1537. shadowSize: new b.Point(41, 41)
  1538. },
  1539. _getIconUrl: function (a) {
  1540. var c = a + "Url";
  1541. if (this.options[c]) return this.options[c];
  1542. b.Browser.retina && "icon" === a && (a += "@2x");
  1543. c = b.Icon.Default.imagePath;
  1544. if (!c) throw Error("Couldn't autodetect L.Icon.Default.imagePath, set it manually.");
  1545. return c + "/marker-" + a + ".png"
  1546. }
  1547. });
  1548. b.Icon.Default.imagePath = function () {
  1549. var a = i.getElementsByTagName("script"),
  1550. c = /\/?leaflet[\-\._]?([\w\-\._]*)\.js\??/,
  1551. b, d, f, g;
  1552. for (b = 0, d = a.length; b < d; b++)
  1553. if (f = a[b].src, g = f.match(c)) return f.split(c)[0] + "/images"
  1554. }();
  1555. b.Marker = b.Class.extend({
  1556. includes: b.Mixin.Events,
  1557. options: {
  1558. icon: new b.Icon.Default,
  1559. title: "",
  1560. clickable: !0,
  1561. draggable: !1,
  1562. zIndexOffset: 0,
  1563. opacity: 1,
  1564. riseOnHover: !1,
  1565. riseOffset: 250
  1566. },
  1567. initialize: function (a, c) {
  1568. b.setOptions(this, c);
  1569. this._latlng = b.latLng(a)
  1570. },
  1571. onAdd: function (a) {
  1572. this._map = a;
  1573. a.on("viewreset", this.update, this);
  1574. this._initIcon();
  1575. this.update();
  1576. if (a.options.zoomAnimation && a.options.markerZoomAnimation) a.on("zoomanim", this._animateZoom, this)
  1577. },
  1578. addTo: function (a) {
  1579. a.addLayer(this);
  1580. return this
  1581. },
  1582. onRemove: function (a) {
  1583. this._removeIcon();
  1584. this.fire("remove");
  1585. a.off({
  1586. viewreset: this.update,
  1587. zoomanim: this._animateZoom
  1588. }, this);
  1589. this._map = null
  1590. },
  1591. getLatLng: function () {
  1592. return this._latlng
  1593. },
  1594. setLatLng: function (a) {
  1595. this._latlng = b.latLng(a);
  1596. this.update();
  1597. return this.fire("move", {
  1598. latlng: this._latlng
  1599. })
  1600. },
  1601. setZIndexOffset: function (a) {
  1602. this.options.zIndexOffset = a;
  1603. this.update();
  1604. return this
  1605. },
  1606. setIcon: function (a) {
  1607. this._map && this._removeIcon();
  1608. this.options.icon = a;
  1609. this._map && (this._initIcon(), this.update());
  1610. return this
  1611. },
  1612. update: function () {
  1613. this._icon && this._setPos(this._map.latLngToLayerPoint(this._latlng).round());
  1614. return this
  1615. },
  1616. _initIcon: function () {
  1617. var a = this.options,
  1618. c = this._map,
  1619. c = c.options.zoomAnimation && c.options.markerZoomAnimation ? "leaflet-zoom-animated" : "leaflet-zoom-hide",
  1620. e = !1;
  1621. if (!this._icon) {
  1622. this._icon = a.icon.createIcon();
  1623. if (a.title) this._icon.title = a.title;
  1624. this._initInteraction();
  1625. e = 1 > this.options.opacity;
  1626. b.DomUtil.addClass(this._icon, c);
  1627. if (a.riseOnHover) b.DomEvent.on(this._icon, "mouseover", this._bringToFront, this).on(this._icon, "mouseout", this._resetZIndex, this)
  1628. }
  1629. if (!this._shadow && (this._shadow = a.icon.createShadow())) b.DomUtil.addClass(this._shadow,
  1630. c), e = 1 > this.options.opacity;
  1631. e && this._updateOpacity();
  1632. a = this._map._panes;
  1633. a.markerPane.appendChild(this._icon);
  1634. this._shadow && a.shadowPane.appendChild(this._shadow)
  1635. },
  1636. _removeIcon: function () {
  1637. var a = this._map._panes;
  1638. this.options.riseOnHover && b.DomEvent.off(this._icon, "mouseover", this._bringToFront).off(this._icon, "mouseout", this._resetZIndex);
  1639. a.markerPane.removeChild(this._icon);
  1640. this._shadow && a.shadowPane.removeChild(this._shadow);
  1641. this._icon = this._shadow = null
  1642. },
  1643. _setPos: function (a) {
  1644. b.DomUtil.setPosition(this._icon,
  1645. a);
  1646. this._shadow && b.DomUtil.setPosition(this._shadow, a);
  1647. this._zIndex = a.y + this.options.zIndexOffset;
  1648. this._resetZIndex()
  1649. },
  1650. _updateZIndex: function (a) {
  1651. this._icon.style.zIndex = this._zIndex + a
  1652. },
  1653. _animateZoom: function (a) {
  1654. this._setPos(this._map._latLngToNewLayerPoint(this._latlng, a.zoom, a.center))
  1655. },
  1656. _initInteraction: function () {
  1657. if (this.options.clickable) {
  1658. var a = this._icon,
  1659. c = ["dblclick", "mousedown", "mouseover", "mouseout", "contextmenu"];
  1660. b.DomUtil.addClass(a, "leaflet-clickable");
  1661. b.DomEvent.on(a, "click", this._onMouseClick,
  1662. this);
  1663. for (var e = 0; e < c.length; e++) b.DomEvent.on(a, c[e], this._fireMouseEvent, this);
  1664. if (b.Handler.MarkerDrag) this.dragging = new b.Handler.MarkerDrag(this), this.options.draggable && this.dragging.enable()
  1665. }
  1666. },
  1667. _onMouseClick: function (a) {
  1668. var c = this.dragging && this.dragging.moved();
  1669. (this.hasEventListeners(a.type) || c) && b.DomEvent.stopPropagation(a);
  1670. c || (!this.dragging || !this.dragging._enabled) && this._map.dragging && this._map.dragging.moved() || this.fire(a.type, {
  1671. originalEvent: a
  1672. })
  1673. },
  1674. _fireMouseEvent: function (a) {
  1675. this.fire(a.type, {
  1676. originalEvent: a
  1677. });
  1678. "contextmenu" === a.type && this.hasEventListeners(a.type) && b.DomEvent.preventDefault(a);
  1679. "mousedown" !== a.type && b.DomEvent.stopPropagation(a)
  1680. },
  1681. setOpacity: function (a) {
  1682. this.options.opacity = a;
  1683. this._map && this._updateOpacity()
  1684. },
  1685. _updateOpacity: function () {
  1686. b.DomUtil.setOpacity(this._icon, this.options.opacity);
  1687. this._shadow && b.DomUtil.setOpacity(this._shadow, this.options.opacity)
  1688. },
  1689. _bringToFront: function () {
  1690. this._updateZIndex(this.options.riseOffset)
  1691. },
  1692. _resetZIndex: function () {
  1693. this._updateZIndex(0)
  1694. }
  1695. });
  1696. b.marker = function (a, c) {
  1697. return new b.Marker(a, c)
  1698. };
  1699. b.DivIcon = b.Icon.extend({
  1700. options: {
  1701. iconSize: new b.Point(12, 12),
  1702. className: "leaflet-div-icon"
  1703. },
  1704. createIcon: function () {
  1705. var a = i.createElement("div"),
  1706. c = this.options;
  1707. if (c.html) a.innerHTML = c.html;
  1708. if (c.bgPos) a.style.backgroundPosition = -c.bgPos.x + "px " + -c.bgPos.y + "px";
  1709. this._setIconStyles(a, "icon");
  1710. return a
  1711. },
  1712. createShadow: function () {
  1713. return null
  1714. }
  1715. });
  1716. b.divIcon = function (a) {
  1717. return new b.DivIcon(a)
  1718. };
  1719. b.Map.mergeOptions({
  1720. closePopupOnClick: !0
  1721. });
  1722. b.Popup = b.Class.extend({
  1723. includes: b.Mixin.Events,
  1724. options: {
  1725. minWidth: 50,
  1726. maxWidth: 300,
  1727. maxHeight: null,
  1728. autoPan: !0,
  1729. closeButton: !0,
  1730. offset: new b.Point(0, 6),
  1731. autoPanPadding: new b.Point(5, 5),
  1732. className: "",
  1733. zoomAnimation: !0
  1734. },
  1735. initialize: function (a, c) {
  1736. b.setOptions(this, a);
  1737. this._source = c;
  1738. this._animated = b.Browser.any3d && this.options.zoomAnimation
  1739. },
  1740. onAdd: function (a) {
  1741. this._map = a;
  1742. this._container || this._initLayout();
  1743. this._updateContent();
  1744. var c = a.options.fadeAnimation;
  1745. c && b.DomUtil.setOpacity(this._container, 0);
  1746. a._panes.popupPane.appendChild(this._container);
  1747. a.on("viewreset",
  1748. this._updatePosition, this);
  1749. if (this._animated) a.on("zoomanim", this._zoomAnimation, this);
  1750. if (a.options.closePopupOnClick) a.on("preclick", this._close, this);
  1751. this._update();
  1752. c && b.DomUtil.setOpacity(this._container, 1)
  1753. },
  1754. addTo: function (a) {
  1755. a.addLayer(this);
  1756. return this
  1757. },
  1758. openOn: function (a) {
  1759. a.openPopup(this);
  1760. return this
  1761. },
  1762. onRemove: function (a) {
  1763. a._panes.popupPane.removeChild(this._container);
  1764. b.Util.falseFn(this._container.offsetWidth);
  1765. a.off({
  1766. viewreset: this._updatePosition,
  1767. preclick: this._close,
  1768. zoomanim: this._zoomAnimation
  1769. },
  1770. this);
  1771. a.options.fadeAnimation && b.DomUtil.setOpacity(this._container, 0);
  1772. this._map = null
  1773. },
  1774. setLatLng: function (a) {
  1775. this._latlng = b.latLng(a);
  1776. this._update();
  1777. return this
  1778. },
  1779. setContent: function (a) {
  1780. this._content = a;
  1781. this._update();
  1782. return this
  1783. },
  1784. _close: function () {
  1785. var a = this._map;
  1786. if (a) a._popup = null, a.removeLayer(this).fire("popupclose", {
  1787. popup: this
  1788. })
  1789. },
  1790. _initLayout: function () {
  1791. var a = this._container = b.DomUtil.create("div", "leaflet-popup " + this.options.className + " leaflet-zoom-" + (this._animated ? "animated" : "hide")),
  1792. c;
  1793. if (this.options.closeButton) c =
  1794. this._closeButton = b.DomUtil.create("a", "leaflet-popup-close-button", a), c.href = "#close", c.innerHTML = "&#215;", b.DomEvent.on(c, "click", this._onCloseButtonClick, this);
  1795. c = this._wrapper = b.DomUtil.create("div", "leaflet-popup-content-wrapper", a);
  1796. b.DomEvent.disableClickPropagation(c);
  1797. this._contentNode = b.DomUtil.create("div", "leaflet-popup-content", c);
  1798. b.DomEvent.on(this._contentNode, "mousewheel", b.DomEvent.stopPropagation);
  1799. this._tipContainer = b.DomUtil.create("div", "leaflet-popup-tip-container", a);
  1800. this._tip =
  1801. b.DomUtil.create("div", "leaflet-popup-tip", this._tipContainer)
  1802. },
  1803. _update: function () {
  1804. if (this._map) this._container.style.visibility = "hidden", this._updateContent(), this._updateLayout(), this._updatePosition(), this._container.style.visibility = "", this._adjustPan()
  1805. },
  1806. _updateContent: function () {
  1807. if (this._content) {
  1808. if ("string" === typeof this._content) this._contentNode.innerHTML = this._content;
  1809. else {
  1810. for (; this._contentNode.hasChildNodes();) this._contentNode.removeChild(this._contentNode.firstChild);
  1811. this._contentNode.appendChild(this._content)
  1812. }
  1813. this.fire("contentupdate")
  1814. }
  1815. },
  1816. _updateLayout: function () {
  1817. var a = this._contentNode,
  1818. c = a.style;
  1819. c.width = "";
  1820. c.whiteSpace = "nowrap";
  1821. var e = a.offsetWidth,
  1822. e = Math.min(e, this.options.maxWidth),
  1823. e = Math.max(e, this.options.minWidth);
  1824. c.width = e + 1 + "px";
  1825. c.whiteSpace = "";
  1826. c.height = "";
  1827. var e = a.offsetHeight,
  1828. d = this.options.maxHeight;
  1829. d && e > d ? (c.height = d + "px", b.DomUtil.addClass(a, "leaflet-popup-scrolled")) : b.DomUtil.removeClass(a, "leaflet-popup-scrolled");
  1830. this._containerWidth = this._container.offsetWidth
  1831. },
  1832. _updatePosition: function () {
  1833. if (this._map) {
  1834. var a = this._map.latLngToLayerPoint(this._latlng),
  1835. c = this._animated,
  1836. e = this.options.offset;
  1837. c && b.DomUtil.setPosition(this._container, a);
  1838. this._containerBottom = -e.y - (c ? 0 : a.y);
  1839. this._containerLeft = -Math.round(this._containerWidth / 2) + e.x + (c ? 0 : a.x);
  1840. this._container.style.bottom = this._containerBottom + "px";
  1841. this._container.style.left = this._containerLeft + "px"
  1842. }
  1843. },
  1844. _zoomAnimation: function (a) {
  1845. a = this._map._latLngToNewLayerPoint(this._latlng, a.zoom, a.center);
  1846. b.DomUtil.setPosition(this._container, a)
  1847. },
  1848. _adjustPan: function () {
  1849. if (this.options.autoPan) {
  1850. var a = this._map,
  1851. c = this._container.offsetHeight,
  1852. e = this._containerWidth,
  1853. d = new b.Point(this._containerLeft, -c - this._containerBottom);
  1854. this._animated && d._add(b.DomUtil.getPosition(this._container));
  1855. var d = a.layerPointToContainerPoint(d),
  1856. f = this.options.autoPanPadding,
  1857. g = a.getSize(),
  1858. h = 0,
  1859. j = 0;
  1860. 0 > d.x && (h = d.x - f.x);
  1861. d.x + e > g.x && (h = d.x + e - g.x + f.x);
  1862. 0 > d.y && (j = d.y - f.y);
  1863. d.y + c > g.y && (j = d.y + c - g.y + f.y);
  1864. (h || j) && a.panBy(new b.Point(h, j))
  1865. }
  1866. },
  1867. _onCloseButtonClick: function (a) {
  1868. this._close();
  1869. b.DomEvent.stop(a)
  1870. }
  1871. });
  1872. b.popup = function (a, c) {
  1873. return new b.Popup(a, c)
  1874. };
  1875. b.Marker.include({
  1876. openPopup: function () {
  1877. this._popup &&
  1878. this._map && (this._popup.setLatLng(this._latlng), this._map.openPopup(this._popup));
  1879. return this
  1880. },
  1881. closePopup: function () {
  1882. this._popup && this._popup._close();
  1883. return this
  1884. },
  1885. bindPopup: function (a, c) {
  1886. var e = b.point(this.options.icon.options.popupAnchor) || new b.Point(0, 0),
  1887. e = e.add(b.Popup.prototype.options.offset);
  1888. c && c.offset && (e = e.add(c.offset));
  1889. c = b.extend({
  1890. offset: e
  1891. }, c);
  1892. if (!this._popup) this.on("click", this.openPopup, this).on("remove", this.closePopup, this).on("move", this._movePopup, this);
  1893. this._popup = (new b.Popup(c,
  1894. this)).setContent(a);
  1895. return this
  1896. },
  1897. unbindPopup: function () {
  1898. if (this._popup) this._popup = null, this.off("click", this.openPopup).off("remove", this.closePopup).off("move", this._movePopup);
  1899. return this
  1900. },
  1901. _movePopup: function (a) {
  1902. this._popup.setLatLng(a.latlng)
  1903. }
  1904. });
  1905. b.Map.include({
  1906. openPopup: function (a) {
  1907. this.closePopup();
  1908. this._popup = a;
  1909. return this.addLayer(a).fire("popupopen", {
  1910. popup: this._popup
  1911. })
  1912. },
  1913. closePopup: function () {
  1914. this._popup && this._popup._close();
  1915. return this
  1916. }
  1917. });
  1918. b.LayerGroup = b.Class.extend({
  1919. initialize: function (a) {
  1920. this._layers = {};
  1921. var c, b;
  1922. if (a)
  1923. for (c = 0, b = a.length; c < b; c++) this.addLayer(a[c])
  1924. },
  1925. addLayer: function (a) {
  1926. this._layers[b.stamp(a)] = a;
  1927. this._map && this._map.addLayer(a);
  1928. return this
  1929. },
  1930. removeLayer: function (a) {
  1931. delete this._layers[b.stamp(a)];
  1932. this._map && this._map.removeLayer(a);
  1933. return this
  1934. },
  1935. clearLayers: function () {
  1936. this.eachLayer(this.removeLayer, this);
  1937. return this
  1938. },
  1939. invoke: function (a) {
  1940. var c = Array.prototype.slice.call(arguments, 1),
  1941. b, d;
  1942. for (b in this._layers) this._layers.hasOwnProperty(b) && (d = this._layers[b], d[a] && d[a].apply(d, c));
  1943. return this
  1944. },
  1945. onAdd: function (a) {
  1946. this._map = a;
  1947. this.eachLayer(a.addLayer, a)
  1948. },
  1949. onRemove: function (a) {
  1950. this.eachLayer(a.removeLayer, a);
  1951. this._map = null
  1952. },
  1953. addTo: function (a) {
  1954. a.addLayer(this);
  1955. return this
  1956. },
  1957. eachLayer: function (a, c) {
  1958. for (var b in this._layers) this._layers.hasOwnProperty(b) && a.call(c, this._layers[b])
  1959. },
  1960. setZIndex: function (a) {
  1961. return this.invoke("setZIndex", a)
  1962. }
  1963. });
  1964. b.layerGroup = function (a) {
  1965. return new b.LayerGroup(a)
  1966. };
  1967. b.FeatureGroup = b.LayerGroup.extend({
  1968. includes: b.Mixin.Events,
  1969. statics: {
  1970. EVENTS: "click dblclick mouseover mouseout mousemove contextmenu"
  1971. },
  1972. addLayer: function (a) {
  1973. if (this._layers[b.stamp(a)]) return this;
  1974. a.on(b.FeatureGroup.EVENTS, this._propagateEvent, this);
  1975. b.LayerGroup.prototype.addLayer.call(this, a);
  1976. this._popupContent && a.bindPopup && a.bindPopup(this._popupContent, this._popupOptions);
  1977. return this.fire("layeradd", {
  1978. layer: a
  1979. })
  1980. },
  1981. removeLayer: function (a) {
  1982. a.off(b.FeatureGroup.EVENTS, this._propagateEvent, this);
  1983. b.LayerGroup.prototype.removeLayer.call(this, a);
  1984. this._popupContent && this.invoke("unbindPopup");
  1985. return this.fire("layerremove", {
  1986. layer: a
  1987. })
  1988. },
  1989. bindPopup: function (a, c) {
  1990. this._popupContent = a;
  1991. this._popupOptions = c;
  1992. return this.invoke("bindPopup", a, c)
  1993. },
  1994. setStyle: function (a) {
  1995. return this.invoke("setStyle", a)
  1996. },
  1997. bringToFront: function () {
  1998. return this.invoke("bringToFront")
  1999. },
  2000. bringToBack: function () {
  2001. return this.invoke("bringToBack")
  2002. },
  2003. getBounds: function () {
  2004. var a = new b.LatLngBounds;
  2005. this.eachLayer(function (c) {
  2006. a.extend(c instanceof b.Marker ? c.getLatLng() : c.getBounds())
  2007. });
  2008. return a
  2009. },
  2010. _propagateEvent: function (a) {
  2011. a.layer = a.target;
  2012. a.target = this;
  2013. this.fire(a.type, a)
  2014. }
  2015. });
  2016. b.featureGroup = function (a) {
  2017. return new b.FeatureGroup(a)
  2018. };
  2019. b.Path = b.Class.extend({
  2020. includes: [b.Mixin.Events],
  2021. statics: {
  2022. CLIP_PADDING: b.Browser.mobile ? Math.max(0, Math.min(0.5, (1280 / Math.max(k.innerWidth, k.innerHeight) - 1) / 2)) : 0.5
  2023. },
  2024. options: {
  2025. stroke: !0,
  2026. color: "#0033ff",
  2027. dashArray: null,
  2028. weight: 5,
  2029. opacity: 0.5,
  2030. fill: !1,
  2031. fillColor: null,
  2032. fillOpacity: 0.2,
  2033. clickable: !0
  2034. },
  2035. initialize: function (a) {
  2036. b.setOptions(this, a)
  2037. },
  2038. onAdd: function (a) {
  2039. this._map = a;
  2040. this._container || (this._initElements(), this._initEvents());
  2041. this.projectLatlngs();
  2042. this._updatePath();
  2043. this._container && this._map._pathRoot.appendChild(this._container);
  2044. this.fire("add");
  2045. a.on({
  2046. viewreset: this.projectLatlngs,
  2047. moveend: this._updatePath
  2048. }, this)
  2049. },
  2050. addTo: function (a) {
  2051. a.addLayer(this);
  2052. return this
  2053. },
  2054. onRemove: function (a) {
  2055. a._pathRoot.removeChild(this._container);
  2056. this.fire("remove");
  2057. this._map = null;
  2058. if (b.Browser.vml) this._fill = this._stroke = this._container = null;
  2059. a.off({
  2060. viewreset: this.projectLatlngs,
  2061. moveend: this._updatePath
  2062. }, this)
  2063. },
  2064. projectLatlngs: function () {},
  2065. setStyle: function (a) {
  2066. b.setOptions(this,
  2067. a);
  2068. this._container && this._updateStyle();
  2069. return this
  2070. },
  2071. redraw: function () {
  2072. this._map && (this.projectLatlngs(), this._updatePath());
  2073. return this
  2074. }
  2075. });
  2076. b.Map.include({
  2077. _updatePathViewport: function () {
  2078. var a = b.Path.CLIP_PADDING,
  2079. c = this.getSize(),
  2080. e = b.DomUtil.getPosition(this._mapPane).multiplyBy(-1)._subtract(c.multiplyBy(a)._round()),
  2081. a = e.add(c.multiplyBy(1 + 2 * a)._round());
  2082. this._pathViewport = new b.Bounds(e, a)
  2083. }
  2084. });
  2085. b.Path.SVG_NS = "http://www.w3.org/2000/svg";
  2086. b.Browser.svg = !(!i.createElementNS || !i.createElementNS(b.Path.SVG_NS,
  2087. "svg").createSVGRect);
  2088. b.Path = b.Path.extend({
  2089. statics: {
  2090. SVG: b.Browser.svg
  2091. },
  2092. bringToFront: function () {
  2093. var a = this._map._pathRoot,
  2094. c = this._container;
  2095. c && a.lastChild !== c && a.appendChild(c);
  2096. return this
  2097. },
  2098. bringToBack: function () {
  2099. var a = this._map._pathRoot,
  2100. c = this._container,
  2101. b = a.firstChild;
  2102. c && b !== c && a.insertBefore(c, b);
  2103. return this
  2104. },
  2105. getPathString: function () {},
  2106. _createElement: function (a) {
  2107. return i.createElementNS(b.Path.SVG_NS, a)
  2108. },
  2109. _initElements: function () {
  2110. this._map._initPathRoot();
  2111. this._initPath();
  2112. this._initStyle()
  2113. },
  2114. _initPath: function () {
  2115. this._container =
  2116. this._createElement("g");
  2117. this._path = this._createElement("path");
  2118. this._container.appendChild(this._path)
  2119. },
  2120. _initStyle: function () {
  2121. this.options.stroke && (this._path.setAttribute("stroke-linejoin", "round"), this._path.setAttribute("stroke-linecap", "round"));
  2122. this.options.fill && this._path.setAttribute("fill-rule", "evenodd");
  2123. this._updateStyle()
  2124. },
  2125. _updateStyle: function () {
  2126. this.options.stroke ? (this._path.setAttribute("stroke", this.options.color), this._path.setAttribute("stroke-opacity", this.options.opacity), this._path.setAttribute("stroke-width",
  2127. this.options.weight), this.options.dashArray ? this._path.setAttribute("stroke-dasharray", this.options.dashArray) : this._path.removeAttribute("stroke-dasharray")) : this._path.setAttribute("stroke", "none");
  2128. 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")
  2129. },
  2130. _updatePath: function () {
  2131. var a = this.getPathString();
  2132. a || (a = "M0 0");
  2133. this._path.setAttribute("d", a)
  2134. },
  2135. _initEvents: function () {
  2136. if (this.options.clickable) {
  2137. (b.Browser.svg ||
  2138. !b.Browser.vml) && this._path.setAttribute("class", "leaflet-clickable");
  2139. b.DomEvent.on(this._container, "click", this._onMouseClick, this);
  2140. 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)
  2141. }
  2142. },
  2143. _onMouseClick: function (a) {
  2144. (!this._map.dragging || !this._map.dragging.moved()) && this._fireMouseEvent(a)
  2145. },
  2146. _fireMouseEvent: function (a) {
  2147. if (this.hasEventListeners(a.type)) {
  2148. var c = this._map,
  2149. e = c.mouseEventToContainerPoint(a),
  2150. d = c.containerPointToLayerPoint(e),
  2151. c = c.layerPointToLatLng(d);
  2152. this.fire(a.type, {
  2153. latlng: c,
  2154. layerPoint: d,
  2155. containerPoint: e,
  2156. originalEvent: a
  2157. });
  2158. "contextmenu" === a.type && b.DomEvent.preventDefault(a);
  2159. "mousemove" !== a.type && b.DomEvent.stopPropagation(a)
  2160. }
  2161. }
  2162. });
  2163. b.Map.include({
  2164. _initPathRoot: function () {
  2165. 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"),
  2166. this.on({
  2167. zoomanim: this._animatePathZoom,
  2168. zoomend: this._endPathZoom
  2169. })) : this._pathRoot.setAttribute("class", " leaflet-zoom-hide"), this.on("moveend", this._updateSvgViewport), this._updateSvgViewport()
  2170. },
  2171. _animatePathZoom: function (a) {
  2172. var c = this.getZoomScale(a.zoom),
  2173. a = this._getCenterOffset(a.center)._multiplyBy(-c)._add(this._pathViewport.min);
  2174. this._pathRoot.style[b.DomUtil.TRANSFORM] = b.DomUtil.getTranslateString(a) + " scale(" + c + ") ";
  2175. this._pathZooming = !0
  2176. },
  2177. _endPathZoom: function () {
  2178. this._pathZooming = !1
  2179. },
  2180. _updateSvgViewport: function () {
  2181. if (!this._pathZooming) {
  2182. this._updatePathViewport();
  2183. var a = this._pathViewport,
  2184. c = a.min,
  2185. e = a.max,
  2186. a = e.x - c.x,
  2187. e = e.y - c.y,
  2188. d = this._pathRoot,
  2189. f = this._panes.overlayPane;
  2190. b.Browser.mobileWebkit && f.removeChild(d);
  2191. b.DomUtil.setPosition(d, c);
  2192. d.setAttribute("width", a);
  2193. d.setAttribute("height", e);
  2194. d.setAttribute("viewBox", [c.x, c.y, a, e].join(" "));
  2195. b.Browser.mobileWebkit && f.appendChild(d)
  2196. }
  2197. }
  2198. });
  2199. b.Path.include({
  2200. bindPopup: function (a, c) {
  2201. if (!this._popup || c) this._popup = new b.Popup(c, this);
  2202. this._popup.setContent(a);
  2203. if (!this._popupHandlersAdded) this.on("click", this._openPopup, this).on("remove",
  2204. this.closePopup, this), this._popupHandlersAdded = !0;
  2205. return this
  2206. },
  2207. unbindPopup: function () {
  2208. if (this._popup) this._popup = null, this.off("click", this._openPopup).off("remove", this.closePopup), this._popupHandlersAdded = !1;
  2209. return this
  2210. },
  2211. openPopup: function (a) {
  2212. this._popup && (a = a || this._latlng || this._latlngs[Math.floor(this._latlngs.length / 2)], this._openPopup({
  2213. latlng: a
  2214. }));
  2215. return this
  2216. },
  2217. closePopup: function () {
  2218. this._popup && this._popup._close();
  2219. return this
  2220. },
  2221. _openPopup: function (a) {
  2222. this._popup.setLatLng(a.latlng);
  2223. this._map.openPopup(this._popup)
  2224. }
  2225. });
  2226. b.Browser.vml = !b.Browser.svg && function () {
  2227. try {
  2228. var a = i.createElement("div");
  2229. a.innerHTML = '<v:shape adj="1"/>';
  2230. var c = a.firstChild;
  2231. c.style.behavior = "url(#default#VML)";
  2232. return c && "object" === typeof c.adj
  2233. } catch (b) {
  2234. return !1
  2235. }
  2236. }();
  2237. b.Path = b.Browser.svg || !b.Browser.vml ? b.Path : b.Path.extend({
  2238. statics: {
  2239. VML: !0,
  2240. CLIP_PADDING: 0.02
  2241. },
  2242. _createElement: function () {
  2243. try {
  2244. return i.namespaces.add("lvml", "urn:schemas-microsoft-com:vml"),
  2245. function (a) {
  2246. return i.createElement("<lvml:" + a + ' class="lvml">')
  2247. }
  2248. } catch (a) {
  2249. return function (a) {
  2250. return i.createElement("<" +
  2251. a + ' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')
  2252. }
  2253. }
  2254. }(),
  2255. _initPath: function () {
  2256. var a = this._container = this._createElement("shape");
  2257. b.DomUtil.addClass(a, "leaflet-vml-shape");
  2258. this.options.clickable && b.DomUtil.addClass(a, "leaflet-clickable");
  2259. a.coordsize = "1 1";
  2260. this._path = this._createElement("path");
  2261. a.appendChild(this._path);
  2262. this._map._pathRoot.appendChild(a)
  2263. },
  2264. _initStyle: function () {
  2265. this._updateStyle()
  2266. },
  2267. _updateStyle: function () {
  2268. var a = this._stroke,
  2269. c = this._fill,
  2270. b = this.options,
  2271. d = this._container;
  2272. d.stroked =
  2273. b.stroke;
  2274. d.filled = b.fill;
  2275. if (b.stroke) {
  2276. if (!a) a = this._stroke = this._createElement("stroke"), a.endcap = "round", d.appendChild(a);
  2277. a.weight = b.weight + "px";
  2278. a.color = b.color;
  2279. a.opacity = b.opacity;
  2280. a.dashStyle = b.dashArray ? b.dashArray instanceof Array ? b.dashArray.join(" ") : b.dashArray.replace(/ *, */g, " ") : ""
  2281. } else if (a) d.removeChild(a), this._stroke = null;
  2282. if (b.fill) {
  2283. if (!c) c = this._fill = this._createElement("fill"), d.appendChild(c);
  2284. c.color = b.fillColor || b.color;
  2285. c.opacity = b.fillOpacity
  2286. } else if (c) d.removeChild(c), this._fill =
  2287. null
  2288. },
  2289. _updatePath: function () {
  2290. var a = this._container.style;
  2291. a.display = "none";
  2292. this._path.v = this.getPathString() + " ";
  2293. a.display = ""
  2294. }
  2295. });
  2296. b.Map.include(b.Browser.svg || !b.Browser.vml ? {} : {
  2297. _initPathRoot: function () {
  2298. if (!this._pathRoot) {
  2299. var a = this._pathRoot = i.createElement("div");
  2300. a.className = "leaflet-vml-container";
  2301. this._panes.overlayPane.appendChild(a);
  2302. this.on("moveend", this._updatePathViewport);
  2303. this._updatePathViewport()
  2304. }
  2305. }
  2306. });
  2307. b.Browser.canvas = !!i.createElement("canvas").getContext;
  2308. b.Path = b.Path.SVG && !k.L_PREFER_CANVAS ||
  2309. !b.Browser.canvas ? b.Path : b.Path.extend({
  2310. statics: {
  2311. CANVAS: !0,
  2312. SVG: !1
  2313. },
  2314. redraw: function () {
  2315. this._map && (this.projectLatlngs(), this._requestUpdate());
  2316. return this
  2317. },
  2318. setStyle: function (a) {
  2319. b.setOptions(this, a);
  2320. this._map && (this._updateStyle(), this._requestUpdate());
  2321. return this
  2322. },
  2323. onRemove: function (a) {
  2324. a.off("viewreset", this.projectLatlngs, this).off("moveend", this._updatePath, this);
  2325. this.options.clickable && this._map.off("click", this._onClick, this);
  2326. this._requestUpdate();
  2327. this._map = null
  2328. },
  2329. _requestUpdate: function () {
  2330. if (this._map &&
  2331. !b.Path._updateRequest) b.Path._updateRequest = b.Util.requestAnimFrame(this._fireMapMoveEnd, this._map)
  2332. },
  2333. _fireMapMoveEnd: function () {
  2334. b.Path._updateRequest = null;
  2335. this.fire("moveend")
  2336. },
  2337. _initElements: function () {
  2338. this._map._initPathRoot();
  2339. this._ctx = this._map._canvasCtx
  2340. },
  2341. _updateStyle: function () {
  2342. var a = this.options;
  2343. if (a.stroke) this._ctx.lineWidth = a.weight, this._ctx.strokeStyle = a.color;
  2344. if (a.fill) this._ctx.fillStyle = a.fillColor || a.color
  2345. },
  2346. _drawPath: function () {
  2347. var a, c, e, d, f, g;
  2348. this._ctx.beginPath();
  2349. for (a = 0, e = this._parts.length; a <
  2350. e; a++) {
  2351. 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);
  2352. this instanceof b.Polygon && this._ctx.closePath()
  2353. }
  2354. },
  2355. _checkIfEmpty: function () {
  2356. return !this._parts.length
  2357. },
  2358. _updatePath: function () {
  2359. if (!this._checkIfEmpty()) {
  2360. var a = this._ctx,
  2361. c = this.options;
  2362. this._drawPath();
  2363. a.save();
  2364. this._updateStyle();
  2365. if (c.fill) a.globalAlpha = c.fillOpacity, a.fill();
  2366. if (c.stroke) a.globalAlpha = c.opacity, a.stroke();
  2367. a.restore()
  2368. }
  2369. },
  2370. _initEvents: function () {
  2371. if (this.options.clickable) this._map.on("click",
  2372. this._onClick, this)
  2373. },
  2374. _onClick: function (a) {
  2375. this._containsPoint(a.layerPoint) && this.fire("click", {
  2376. latlng: a.latlng,
  2377. layerPoint: a.layerPoint,
  2378. containerPoint: a.containerPoint,
  2379. originalEvent: a
  2380. })
  2381. }
  2382. });
  2383. b.Map.include(b.Path.SVG && !k.L_PREFER_CANVAS || !b.Browser.canvas ? {} : {
  2384. _initPathRoot: function () {
  2385. var a = this._pathRoot,
  2386. c;
  2387. if (!a) {
  2388. a = this._pathRoot = i.createElement("canvas");
  2389. a.style.position = "absolute";
  2390. c = this._canvasCtx = a.getContext("2d");
  2391. c.lineCap = "round";
  2392. c.lineJoin = "round";
  2393. this._panes.overlayPane.appendChild(a);
  2394. if (this.options.zoomAnimation) this._pathRoot.className =
  2395. "leaflet-zoom-animated", this.on("zoomanim", this._animatePathZoom), this.on("zoomend", this._endPathZoom);
  2396. this.on("moveend", this._updateCanvasViewport);
  2397. this._updateCanvasViewport()
  2398. }
  2399. },
  2400. _updateCanvasViewport: function () {
  2401. if (!this._pathZooming) {
  2402. this._updatePathViewport();
  2403. var a = this._pathViewport,
  2404. c = a.min,
  2405. a = a.max.subtract(c),
  2406. e = this._pathRoot;
  2407. b.DomUtil.setPosition(e, c);
  2408. e.width = a.x;
  2409. e.height = a.y;
  2410. e.getContext("2d").translate(-c.x, -c.y)
  2411. }
  2412. }
  2413. });
  2414. b.LineUtil = {
  2415. simplify: function (a, c) {
  2416. if (!c || !a.length) return a.slice();
  2417. var b =
  2418. c * c,
  2419. a = this._reducePoints(a, b);
  2420. return a = this._simplifyDP(a, b)
  2421. },
  2422. pointToSegmentDistance: function (a, c, b) {
  2423. return Math.sqrt(this._sqClosestPointOnSegment(a, c, b, !0))
  2424. },
  2425. closestPointOnSegment: function (a, c, b) {
  2426. return this._sqClosestPointOnSegment(a, c, b)
  2427. },
  2428. _simplifyDP: function (a, c) {
  2429. var b = a.length,
  2430. d = new(typeof Uint8Array !== l + "" ? Uint8Array : Array)(b);
  2431. d[0] = d[b - 1] = 1;
  2432. this._simplifyDPStep(a, d, c, 0, b - 1);
  2433. var f, g = [];
  2434. for (f = 0; f < b; f++) d[f] && g.push(a[f]);
  2435. return g
  2436. },
  2437. _simplifyDPStep: function (a, c, b, d, f) {
  2438. var g = 0,
  2439. h, j, i;
  2440. for (j = d + 1; j <=
  2441. f - 1; j++) i = this._sqClosestPointOnSegment(a[j], a[d], a[f], !0), i > g && (h = j, g = i);
  2442. g > b && (c[h] = 1, this._simplifyDPStep(a, c, b, d, h), this._simplifyDPStep(a, c, b, h, f))
  2443. },
  2444. _reducePoints: function (a, c) {
  2445. 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);
  2446. f < g - 1 && b.push(a[g - 1]);
  2447. return b
  2448. },
  2449. clipSegment: function (a, c, b, d) {
  2450. var d = d ? this._lastCode : this._getBitCode(a, b),
  2451. f = this._getBitCode(c, b),
  2452. g, h, j;
  2453. for (this._lastCode = f;;)
  2454. if (d | f) {
  2455. if (d & f) return !1;
  2456. g = d || f;
  2457. h = this._getEdgeIntersection(a, c, g, b);
  2458. j =
  2459. this._getBitCode(h, b);
  2460. g === d ? (a = h, d = j) : (c = h, f = j)
  2461. } else return [a, c]
  2462. },
  2463. _getEdgeIntersection: function (a, c, e, d) {
  2464. var f = c.x - a.x,
  2465. c = c.y - a.y,
  2466. g = d.min,
  2467. d = d.max;
  2468. if (e & 8) return new b.Point(a.x + f * (d.y - a.y) / c, d.y);
  2469. if (e & 4) return new b.Point(a.x + f * (g.y - a.y) / c, g.y);
  2470. if (e & 2) return new b.Point(d.x, a.y + c * (d.x - a.x) / f);
  2471. if (e & 1) return new b.Point(g.x, a.y + c * (g.x - a.x) / f)
  2472. },
  2473. _getBitCode: function (a, c) {
  2474. var b = 0;
  2475. a.x < c.min.x ? b |= 1 : a.x > c.max.x && (b |= 2);
  2476. a.y < c.min.y ? b |= 4 : a.y > c.max.y && (b |= 8);
  2477. return b
  2478. },
  2479. _sqDist: function (a, c) {
  2480. var b = c.x - a.x,
  2481. d = c.y -
  2482. a.y;
  2483. return b * b + d * d
  2484. },
  2485. _sqClosestPointOnSegment: function (a, c, e, d) {
  2486. var f = c.x,
  2487. c = c.y,
  2488. g = e.x - f,
  2489. h = e.y - c,
  2490. j = g * g + h * h;
  2491. 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);
  2492. g = a.x - f;
  2493. h = a.y - c;
  2494. return d ? g * g + h * h : new b.Point(f, c)
  2495. }
  2496. };
  2497. b.Polyline = b.Path.extend({
  2498. initialize: function (a, c) {
  2499. b.Path.prototype.initialize.call(this, c);
  2500. this._latlngs = this._convertLatLngs(a)
  2501. },
  2502. options: {
  2503. smoothFactor: 1,
  2504. noClip: !1
  2505. },
  2506. projectLatlngs: function () {
  2507. this._originalPoints = [];
  2508. for (var a = 0, c = this._latlngs.length; a < c; a++) this._originalPoints[a] =
  2509. this._map.latLngToLayerPoint(this._latlngs[a])
  2510. },
  2511. getPathString: function () {
  2512. for (var a = 0, c = this._parts.length, b = ""; a < c; a++) b += this._getPathPartStr(this._parts[a]);
  2513. return b
  2514. },
  2515. getLatLngs: function () {
  2516. return this._latlngs
  2517. },
  2518. setLatLngs: function (a) {
  2519. this._latlngs = this._convertLatLngs(a);
  2520. return this.redraw()
  2521. },
  2522. addLatLng: function (a) {
  2523. this._latlngs.push(b.latLng(a));
  2524. return this.redraw()
  2525. },
  2526. spliceLatLngs: function () {
  2527. var a = [].splice.apply(this._latlngs, arguments);
  2528. this._convertLatLngs(this._latlngs);
  2529. this.redraw();
  2530. return a
  2531. },
  2532. closestLayerPoint: function (a) {
  2533. for (var c = Infinity, e = this._parts, d, f, g = null, h = 0, j = e.length; h < j; h++)
  2534. for (var i = e[h], k = 1, m = i.length; k < m; k++) {
  2535. d = i[k - 1];
  2536. f = i[k];
  2537. var l = b.LineUtil._sqClosestPointOnSegment(a, d, f, !0);
  2538. l < c && (c = l, g = b.LineUtil._sqClosestPointOnSegment(a, d, f))
  2539. }
  2540. if (g) g.distance = Math.sqrt(c);
  2541. return g
  2542. },
  2543. getBounds: function () {
  2544. var a = new b.LatLngBounds,
  2545. c = this.getLatLngs(),
  2546. e, d;
  2547. for (e = 0, d = c.length; e < d; e++) a.extend(c[e]);
  2548. return a
  2549. },
  2550. _convertLatLngs: function (a) {
  2551. var c, e;
  2552. for (c = 0, e = a.length; c < e; c++) {
  2553. if (b.Util.isArray(a[c]) &&
  2554. "number" !== typeof a[c][0]) return;
  2555. a[c] = b.latLng(a[c])
  2556. }
  2557. return a
  2558. },
  2559. _initEvents: function () {
  2560. b.Path.prototype._initEvents.call(this)
  2561. },
  2562. _getPathPartStr: function (a) {
  2563. 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;
  2564. return f
  2565. },
  2566. _clipPoints: function () {
  2567. var a = this._originalPoints,
  2568. c = a.length,
  2569. e, d, f;
  2570. if (this.options.noClip) this._parts = [a];
  2571. else {
  2572. var g = this._parts = [],
  2573. h = this._map._pathViewport,
  2574. j = b.LineUtil;
  2575. for (e = 0, d = 0; e < c - 1; e++)
  2576. if (f = j.clipSegment(a[e], a[e + 1], h, e))
  2577. if (g[d] =
  2578. g[d] || [], g[d].push(f[0]), f[1] !== a[e + 1] || e === c - 2) g[d].push(f[1]), d++
  2579. }
  2580. },
  2581. _simplifyPoints: function () {
  2582. 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)
  2583. },
  2584. _updatePath: function () {
  2585. this._map && (this._clipPoints(), this._simplifyPoints(), b.Path.prototype._updatePath.call(this))
  2586. }
  2587. });
  2588. b.polyline = function (a, c) {
  2589. return new b.Polyline(a, c)
  2590. };
  2591. b.PolyUtil = {};
  2592. b.PolyUtil.clipPolygon = function (a, c) {
  2593. var e, d = [1, 4, 2, 8],
  2594. f, g, h, j, i, k, m = b.LineUtil;
  2595. for (f = 0, i = a.length; f < i; f++) a[f]._code =
  2596. m._getBitCode(a[f], c);
  2597. for (h = 0; 4 > h; h++) {
  2598. k = d[h];
  2599. e = [];
  2600. for (f = 0, i = a.length, g = i - 1; f < i; g = f++)
  2601. if (j = a[f], g = a[g], j._code & k) {
  2602. if (!(g._code & k)) g = m._getEdgeIntersection(g, j, k, c), g._code = m._getBitCode(g, c), e.push(g)
  2603. } else {
  2604. if (g._code & k) g = m._getEdgeIntersection(g, j, k, c), g._code = m._getBitCode(g, c), e.push(g);
  2605. e.push(j)
  2606. }
  2607. a = e
  2608. }
  2609. return a
  2610. };
  2611. b.Polygon = b.Polyline.extend({
  2612. options: {
  2613. fill: !0
  2614. },
  2615. initialize: function (a, c) {
  2616. b.Polyline.prototype.initialize.call(this, a, c);
  2617. if (a && b.Util.isArray(a[0]) && "number" !== typeof a[0][0]) this._latlngs =
  2618. this._convertLatLngs(a[0]), this._holes = a.slice(1)
  2619. },
  2620. projectLatlngs: function () {
  2621. b.Polyline.prototype.projectLatlngs.call(this);
  2622. this._holePoints = [];
  2623. if (this._holes) {
  2624. var a, c, e, d;
  2625. for (a = 0, e = this._holes.length; a < e; a++) {
  2626. this._holePoints[a] = [];
  2627. for (c = 0, d = this._holes[a].length; c < d; c++) this._holePoints[a][c] = this._map.latLngToLayerPoint(this._holes[a][c])
  2628. }
  2629. }
  2630. },
  2631. _clipPoints: function () {
  2632. var a = [];
  2633. this._parts = [this._originalPoints].concat(this._holePoints);
  2634. if (!this.options.noClip) {
  2635. for (var c = 0, e = this._parts.length; c < e; c++) {
  2636. var d =
  2637. b.PolyUtil.clipPolygon(this._parts[c], this._map._pathViewport);
  2638. d.length && a.push(d)
  2639. }
  2640. this._parts = a
  2641. }
  2642. },
  2643. _getPathPartStr: function (a) {
  2644. return b.Polyline.prototype._getPathPartStr.call(this, a) + (b.Browser.svg ? "z" : "x")
  2645. }
  2646. });
  2647. b.polygon = function (a, c) {
  2648. return new b.Polygon(a, c)
  2649. };
  2650. (function () {
  2651. function a(a) {
  2652. return b.FeatureGroup.extend({
  2653. initialize: function (a, c) {
  2654. this._layers = {};
  2655. this._options = c;
  2656. this.setLatLngs(a)
  2657. },
  2658. setLatLngs: function (b) {
  2659. var d = 0,
  2660. f = b.length;
  2661. for (this.eachLayer(function (a) {
  2662. d < f ? a.setLatLngs(b[d++]) : this.removeLayer(a)
  2663. },
  2664. this); d < f;) this.addLayer(new a(b[d++], this._options));
  2665. return this
  2666. }
  2667. })
  2668. }
  2669. b.MultiPolyline = a(b.Polyline);
  2670. b.MultiPolygon = a(b.Polygon);
  2671. b.multiPolyline = function (a, e) {
  2672. return new b.MultiPolyline(a, e)
  2673. };
  2674. b.multiPolygon = function (a, e) {
  2675. return new b.MultiPolygon(a, e)
  2676. }
  2677. })();
  2678. b.Rectangle = b.Polygon.extend({
  2679. initialize: function (a, c) {
  2680. b.Polygon.prototype.initialize.call(this, this._boundsToLatLngs(a), c)
  2681. },
  2682. setBounds: function (a) {
  2683. this.setLatLngs(this._boundsToLatLngs(a))
  2684. },
  2685. _boundsToLatLngs: function (a) {
  2686. a = b.latLngBounds(a);
  2687. return [a.getSouthWest(),
  2688. a.getNorthWest(), a.getNorthEast(), a.getSouthEast()
  2689. ]
  2690. }
  2691. });
  2692. b.rectangle = function (a, c) {
  2693. return new b.Rectangle(a, c)
  2694. };
  2695. b.Circle = b.Path.extend({
  2696. initialize: function (a, c, e) {
  2697. b.Path.prototype.initialize.call(this, e);
  2698. this._latlng = b.latLng(a);
  2699. this._mRadius = c
  2700. },
  2701. options: {
  2702. fill: !0
  2703. },
  2704. setLatLng: function (a) {
  2705. this._latlng = b.latLng(a);
  2706. return this.redraw()
  2707. },
  2708. setRadius: function (a) {
  2709. this._mRadius = a;
  2710. return this.redraw()
  2711. },
  2712. projectLatlngs: function () {
  2713. var a = this._getLngRadius(),
  2714. a = this._map.latLngToLayerPoint(new b.LatLng(this._latlng.lat,
  2715. this._latlng.lng - a));
  2716. this._point = this._map.latLngToLayerPoint(this._latlng);
  2717. this._radius = Math.max(Math.round(this._point.x - a.x), 1)
  2718. },
  2719. getBounds: function () {
  2720. var a = this._getLngRadius(),
  2721. c = 360 * (this._mRadius / 40075017),
  2722. e = this._latlng,
  2723. d = new b.LatLng(e.lat - c, e.lng - a),
  2724. a = new b.LatLng(e.lat + c, e.lng + a);
  2725. return new b.LatLngBounds(d, a)
  2726. },
  2727. getLatLng: function () {
  2728. return this._latlng
  2729. },
  2730. getPathString: function () {
  2731. var a = this._point,
  2732. c = this._radius;
  2733. if (this._checkIfEmpty()) return "";
  2734. if (b.Browser.svg) return "M" + a.x + "," + (a.y - c) + "A" +
  2735. c + "," + c + ",0,1,1," + (a.x - 0.1) + "," + (a.y - c) + " z";
  2736. a._round();
  2737. c = Math.round(c);
  2738. return "AL " + a.x + "," + a.y + " " + c + "," + c + " 0,23592600"
  2739. },
  2740. getRadius: function () {
  2741. return this._mRadius
  2742. },
  2743. _getLatRadius: function () {
  2744. return 360 * (this._mRadius / 40075017)
  2745. },
  2746. _getLngRadius: function () {
  2747. return this._getLatRadius() / Math.cos(b.LatLng.DEG_TO_RAD * this._latlng.lat)
  2748. },
  2749. _checkIfEmpty: function () {
  2750. if (!this._map) return !1;
  2751. var a = this._map._pathViewport,
  2752. c = this._radius,
  2753. b = this._point;
  2754. 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
  2755. }
  2756. });
  2757. b.circle = function (a, c, e) {
  2758. return new b.Circle(a, c, e)
  2759. };
  2760. b.CircleMarker = b.Circle.extend({
  2761. options: {
  2762. radius: 10,
  2763. weight: 2
  2764. },
  2765. initialize: function (a, c) {
  2766. b.Circle.prototype.initialize.call(this, a, null, c);
  2767. this._radius = this.options.radius
  2768. },
  2769. projectLatlngs: function () {
  2770. this._point = this._map.latLngToLayerPoint(this._latlng)
  2771. },
  2772. _updateStyle: function () {
  2773. b.Circle.prototype._updateStyle.call(this);
  2774. this.setRadius(this.options.radius)
  2775. },
  2776. setRadius: function (a) {
  2777. this.options.radius = this._radius = a;
  2778. return this.redraw()
  2779. }
  2780. });
  2781. b.circleMarker =
  2782. function (a, c) {
  2783. return new b.CircleMarker(a, c)
  2784. };
  2785. b.Polyline.include(!b.Path.CANVAS ? {} : {
  2786. _containsPoint: function (a, c) {
  2787. var e, d, f, g, h, j, i = this.options.weight / 2;
  2788. b.Browser.touch && (i += 10);
  2789. for (e = 0, g = this._parts.length; e < g; e++) {
  2790. j = this._parts[e];
  2791. for (d = 0, h = j.length, f = h - 1; d < h; f = d++)
  2792. if (c || 0 !== d)
  2793. if (f = b.LineUtil.pointToSegmentDistance(a, j[f], j[d]), f <= i) return !0
  2794. }
  2795. return !1
  2796. }
  2797. });
  2798. b.Polygon.include(!b.Path.CANVAS ? {} : {
  2799. _containsPoint: function (a) {
  2800. var c = !1,
  2801. e, d, f, g, h, j, i;
  2802. if (b.Polyline.prototype._containsPoint.call(this, a, !0)) return !0;
  2803. for (g = 0, j = this._parts.length; g < j; g++) {
  2804. e = this._parts[g];
  2805. 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)
  2806. }
  2807. return c
  2808. }
  2809. });
  2810. b.Circle.include(!b.Path.CANVAS ? {} : {
  2811. _drawPath: function () {
  2812. var a = this._point;
  2813. this._ctx.beginPath();
  2814. this._ctx.arc(a.x, a.y, this._radius, 0, 2 * Math.PI, !1)
  2815. },
  2816. _containsPoint: function (a) {
  2817. var c = this.options.stroke ? this.options.weight / 2 : 0;
  2818. return a.distanceTo(this._point) <= this._radius + c
  2819. }
  2820. });
  2821. b.GeoJSON = b.FeatureGroup.extend({
  2822. initialize: function (a,
  2823. c) {
  2824. b.setOptions(this, c);
  2825. this._layers = {};
  2826. a && this.addData(a)
  2827. },
  2828. addData: function (a) {
  2829. var c = b.Util.isArray(a) ? a : a.features,
  2830. e;
  2831. if (c) {
  2832. for (a = 0, e = c.length; a < e; a++)(c[a].geometries || c[a].geometry || c[a].features) && this.addData(c[a]);
  2833. return this
  2834. }
  2835. c = this.options;
  2836. if (!c.filter || c.filter(a)) {
  2837. e = b.GeoJSON.geometryToLayer(a, c.pointToLayer);
  2838. e.feature = a;
  2839. e.defaultOptions = e.options;
  2840. this.resetStyle(e);
  2841. if (c.onEachFeature) c.onEachFeature(a, e);
  2842. return this.addLayer(e)
  2843. }
  2844. },
  2845. resetStyle: function (a) {
  2846. var c = this.options.style;
  2847. c && (b.Util.extend(a.options,
  2848. a.defaultOptions), this._setLayerStyle(a, c))
  2849. },
  2850. setStyle: function (a) {
  2851. this.eachLayer(function (c) {
  2852. this._setLayerStyle(c, a)
  2853. }, this)
  2854. },
  2855. _setLayerStyle: function (a, c) {
  2856. "function" === typeof c && (c = c(a.feature));
  2857. a.setStyle && a.setStyle(c)
  2858. }
  2859. });
  2860. b.extend(b.GeoJSON, {
  2861. geometryToLayer: function (a, c) {
  2862. var e = "Feature" === a.type ? a.geometry : a,
  2863. d = e.coordinates,
  2864. f = [],
  2865. g, h, j;
  2866. switch (e.type) {
  2867. case "Point":
  2868. return e = this.coordsToLatLng(d), c ? c(a, e) : new b.Marker(e);
  2869. case "MultiPoint":
  2870. for (g = 0, h = d.length; g < h; g++) e = this.coordsToLatLng(d[g]), j = c ?
  2871. c(a, e) : new b.Marker(e), f.push(j);
  2872. return new b.FeatureGroup(f);
  2873. case "LineString":
  2874. return d = this.coordsToLatLngs(d), new b.Polyline(d);
  2875. case "Polygon":
  2876. return d = this.coordsToLatLngs(d, 1), new b.Polygon(d);
  2877. case "MultiLineString":
  2878. return d = this.coordsToLatLngs(d, 1), new b.MultiPolyline(d);
  2879. case "MultiPolygon":
  2880. return d = this.coordsToLatLngs(d, 2), new b.MultiPolygon(d);
  2881. case "GeometryCollection":
  2882. for (g = 0, h = e.geometries.length; g < h; g++) j = this.geometryToLayer({
  2883. geometry: e.geometries[g],
  2884. type: "Feature",
  2885. properties: a.properties
  2886. },
  2887. c), f.push(j);
  2888. return new b.FeatureGroup(f);
  2889. default:
  2890. throw Error("Invalid GeoJSON object.");
  2891. }
  2892. },
  2893. coordsToLatLng: function (a, c) {
  2894. var e = parseFloat(a[c ? 0 : 1]),
  2895. d = parseFloat(a[c ? 1 : 0]);
  2896. return new b.LatLng(e, d)
  2897. },
  2898. coordsToLatLngs: function (a, c, b) {
  2899. var d, f = [],
  2900. g, h;
  2901. 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);
  2902. return f
  2903. }
  2904. });
  2905. b.geoJson = function (a, c) {
  2906. return new b.GeoJSON(a, c)
  2907. };
  2908. b.DomEvent = {
  2909. addListener: function (a, c, e, d) {
  2910. var f = b.stamp(e),
  2911. g = "_leaflet_" + c + f,
  2912. h, j;
  2913. if (a[g]) return this;
  2914. h = function (c) {
  2915. return e.call(d || a, c || b.DomEvent._getEvent())
  2916. };
  2917. if (b.Browser.msTouch && 0 === c.indexOf("touch")) return this.addMsTouchListener(a, c, h, f);
  2918. b.Browser.touch && "dblclick" === c && this.addDoubleTapListener && this.addDoubleTapListener(a, h, f);
  2919. "addEventListener" in a ? "mousewheel" === c ? (a.addEventListener("DOMMouseScroll", h, !1), a.addEventListener(c, h, !1)) : "mouseenter" === c || "mouseleave" === c ? (j = h, h = function (c) {
  2920. return !b.DomEvent._checkMouse(a, c) ? void 0 : j(c)
  2921. }, a.addEventListener("mouseenter" === c ? "mouseover" : "mouseout",
  2922. h, !1)) : a.addEventListener(c, h, !1) : "attachEvent" in a && a.attachEvent("on" + c, h);
  2923. a[g] = h;
  2924. return this
  2925. },
  2926. removeListener: function (a, c, e) {
  2927. var e = b.stamp(e),
  2928. d = "_leaflet_" + c + e,
  2929. f = a[d];
  2930. 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" ===
  2931. 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
  2932. },
  2933. stopPropagation: function (a) {
  2934. a.stopPropagation ? a.stopPropagation() : a.cancelBubble = !0;
  2935. return this
  2936. },
  2937. disableClickPropagation: function (a) {
  2938. for (var c = b.DomEvent.stopPropagation, e = b.Draggable.START.length - 1; 0 <= e; e--) b.DomEvent.addListener(a, b.Draggable.START[e], c);
  2939. return b.DomEvent.addListener(a, "click", c).addListener(a, "dblclick", c)
  2940. },
  2941. preventDefault: function (a) {
  2942. a.preventDefault ?
  2943. a.preventDefault() : a.returnValue = !1;
  2944. return this
  2945. },
  2946. stop: function (a) {
  2947. return b.DomEvent.preventDefault(a).stopPropagation(a)
  2948. },
  2949. getMousePosition: function (a, c) {
  2950. var e = i.body,
  2951. d = i.documentElement,
  2952. e = new b.Point(a.pageX ? a.pageX : a.clientX + e.scrollLeft + d.scrollLeft, a.pageY ? a.pageY : a.clientY + e.scrollTop + d.scrollTop);
  2953. return c ? e._subtract(b.DomUtil.getViewportOffset(c)) : e
  2954. },
  2955. getWheelDelta: function (a) {
  2956. var c = 0;
  2957. a.wheelDelta && (c = a.wheelDelta / 120);
  2958. a.detail && (c = -a.detail / 3);
  2959. return c
  2960. },
  2961. _checkMouse: function (a, c) {
  2962. var b = c.relatedTarget;
  2963. if (!b) return !0;
  2964. try {
  2965. for (; b && b !== a;) b = b.parentNode
  2966. } catch (d) {
  2967. return !1
  2968. }
  2969. return b !== a
  2970. },
  2971. _getEvent: function () {
  2972. var a = k.event;
  2973. if (!a)
  2974. for (var c = arguments.callee.caller; c && !((a = c.arguments[0]) && k.Event === a.constructor);) c = c.caller;
  2975. return a
  2976. }
  2977. };
  2978. b.DomEvent.on = b.DomEvent.addListener;
  2979. b.DomEvent.off = b.DomEvent.removeListener;
  2980. b.Draggable = b.Class.extend({
  2981. includes: b.Mixin.Events,
  2982. statics: {
  2983. START: b.Browser.touch ? ["touchstart", "mousedown"] : ["mousedown"],
  2984. END: {
  2985. mousedown: "mouseup",
  2986. touchstart: "touchend",
  2987. MSPointerDown: "touchend"
  2988. },
  2989. MOVE: {
  2990. mousedown: "mousemove",
  2991. touchstart: "touchmove",
  2992. MSPointerDown: "touchmove"
  2993. },
  2994. TAP_TOLERANCE: 15
  2995. },
  2996. initialize: function (a, c, e) {
  2997. this._element = a;
  2998. this._dragStartTarget = c || a;
  2999. this._longPress = e && !b.Browser.msTouch
  3000. },
  3001. enable: function () {
  3002. if (!this._enabled) {
  3003. for (var a = b.Draggable.START.length - 1; 0 <= a; a--) b.DomEvent.on(this._dragStartTarget, b.Draggable.START[a], this._onDown, this);
  3004. this._enabled = !0
  3005. }
  3006. },
  3007. disable: function () {
  3008. if (this._enabled) {
  3009. for (var a = b.Draggable.START.length - 1; 0 <= a; a--) b.DomEvent.off(this._dragStartTarget,
  3010. b.Draggable.START[a], this._onDown, this);
  3011. this._moved = this._enabled = !1
  3012. }
  3013. },
  3014. _onDown: function (a) {
  3015. if (!(!b.Browser.touch && a.shiftKey || 1 !== a.which && 1 !== a.button && !a.touches))
  3016. if (b.DomEvent.preventDefault(a), b.DomEvent.stopPropagation(a), !b.Draggable._disabled)
  3017. if (this._simulateClick = !0, a.touches && 1 < a.touches.length) this._simulateClick = !1, clearTimeout(this._longPressTimeout);
  3018. else {
  3019. var c = a.touches && 1 === a.touches.length ? a.touches[0] : a,
  3020. e = c.target;
  3021. b.Browser.touch && "a" === e.tagName.toLowerCase() && b.DomUtil.addClass(e,
  3022. "leaflet-active");
  3023. this._moved = !1;
  3024. if (!this._moving) {
  3025. this._startPoint = new b.Point(c.clientX, c.clientY);
  3026. this._startPos = this._newPos = b.DomUtil.getPosition(this._element);
  3027. if (a.touches && 1 === a.touches.length && b.Browser.touch && this._longPress) this._longPressTimeout = setTimeout(b.bind(function () {
  3028. if ((this._newPos && this._newPos.distanceTo(this._startPos) || 0) < b.Draggable.TAP_TOLERANCE) this._simulateClick = !1, this._onUp(), this._simulateEvent("contextmenu", c)
  3029. }, this), 1E3);
  3030. b.DomEvent.on(i, b.Draggable.MOVE[a.type],
  3031. this._onMove, this);
  3032. b.DomEvent.on(i, b.Draggable.END[a.type], this._onUp, this)
  3033. }
  3034. }
  3035. },
  3036. _onMove: function (a) {
  3037. if (!(a.touches && 1 < a.touches.length)) {
  3038. var c = a.touches && 1 === a.touches.length ? a.touches[0] : a,
  3039. c = (new b.Point(c.clientX, c.clientY)).subtract(this._startPoint);
  3040. if (c.x || c.y) {
  3041. b.DomEvent.preventDefault(a);
  3042. 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());
  3043. this._newPos =
  3044. this._startPos.add(c);
  3045. this._moving = !0;
  3046. b.Util.cancelAnimFrame(this._animRequest);
  3047. this._animRequest = b.Util.requestAnimFrame(this._updatePosition, this, !0, this._dragStartTarget)
  3048. }
  3049. }
  3050. },
  3051. _updatePosition: function () {
  3052. this.fire("predrag");
  3053. b.DomUtil.setPosition(this._element, this._newPos);
  3054. this.fire("drag")
  3055. },
  3056. _onUp: function (a) {
  3057. var c;
  3058. clearTimeout(this._longPressTimeout);
  3059. if (this._simulateClick && a.changedTouches) {
  3060. var a = a.changedTouches[0],
  3061. e = a.target,
  3062. d = this._newPos && this._newPos.distanceTo(this._startPos) || 0;
  3063. "a" === e.tagName.toLowerCase() &&
  3064. b.DomUtil.removeClass(e, "leaflet-active");
  3065. d < b.Draggable.TAP_TOLERANCE && (c = a)
  3066. }
  3067. b.Browser.touch || (b.DomUtil.enableTextSelection(), this._restoreCursor());
  3068. 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));
  3069. this._moved && (b.Util.cancelAnimFrame(this._animRequest), this.fire("dragend"));
  3070. this._moving = !1;
  3071. if (c) this._moved = !1, this._simulateEvent("click", c)
  3072. },
  3073. _setMovingCursor: function () {
  3074. b.DomUtil.addClass(i.body,
  3075. "leaflet-dragging")
  3076. },
  3077. _restoreCursor: function () {
  3078. b.DomUtil.removeClass(i.body, "leaflet-dragging")
  3079. },
  3080. _simulateEvent: function (a, c) {
  3081. var b = i.createEvent("MouseEvents");
  3082. b.initMouseEvent(a, !0, !0, k, 1, c.screenX, c.screenY, c.clientX, c.clientY, !1, !1, !1, !1, 0, null);
  3083. c.target.dispatchEvent(b)
  3084. }
  3085. });
  3086. b.Handler = b.Class.extend({
  3087. initialize: function (a) {
  3088. this._map = a
  3089. },
  3090. enable: function () {
  3091. if (!this._enabled) this._enabled = !0, this.addHooks()
  3092. },
  3093. disable: function () {
  3094. if (this._enabled) this._enabled = !1, this.removeHooks()
  3095. },
  3096. enabled: function () {
  3097. return !!this._enabled
  3098. }
  3099. });
  3100. b.Map.mergeOptions({
  3101. dragging: !0,
  3102. inertia: !b.Browser.android23,
  3103. inertiaDeceleration: 3400,
  3104. inertiaMaxSpeed: Infinity,
  3105. inertiaThreshold: b.Browser.touch ? 32 : 18,
  3106. easeLinearity: 0.25,
  3107. longPress: !0,
  3108. worldCopyJump: !1
  3109. });
  3110. b.Map.Drag = b.Handler.extend({
  3111. addHooks: function () {
  3112. if (!this._draggable) {
  3113. var a = this._map;
  3114. this._draggable = new b.Draggable(a._mapPane, a._container, a.options.longPress);
  3115. this._draggable.on({
  3116. dragstart: this._onDragStart,
  3117. drag: this._onDrag,
  3118. dragend: this._onDragEnd
  3119. }, this);
  3120. a.options.worldCopyJump && (this._draggable.on("predrag",
  3121. this._onPreDrag, this), a.on("viewreset", this._onViewReset, this))
  3122. }
  3123. this._draggable.enable()
  3124. },
  3125. removeHooks: function () {
  3126. this._draggable.disable()
  3127. },
  3128. moved: function () {
  3129. return this._draggable && this._draggable._moved
  3130. },
  3131. _onDragStart: function () {
  3132. var a = this._map;
  3133. a._panAnim && a._panAnim.stop();
  3134. a.fire("movestart").fire("dragstart");
  3135. if (a.options.inertia) this._positions = [], this._times = []
  3136. },
  3137. _onDrag: function () {
  3138. if (this._map.options.inertia) {
  3139. var a = this._lastTime = +new Date;
  3140. this._positions.push(this._lastPos = this._draggable._newPos);
  3141. this._times.push(a);
  3142. 200 < a - this._times[0] && (this._positions.shift(), this._times.shift())
  3143. }
  3144. this._map.fire("move").fire("drag")
  3145. },
  3146. _onViewReset: function () {
  3147. var a = this._map.getSize()._divideBy(2);
  3148. this._initialWorldOffset = this._map.latLngToLayerPoint(new b.LatLng(0, 0)).subtract(a).x;
  3149. this._worldWidth = this._map.project(new b.LatLng(0, 180)).x
  3150. },
  3151. _onPreDrag: function () {
  3152. var a = this._worldWidth,
  3153. c = Math.round(a / 2),
  3154. b = this._initialWorldOffset,
  3155. d = this._draggable._newPos.x,
  3156. f = (d - c + b) % a + c - b,
  3157. a = (d + c + b) % a - c - b;
  3158. this._draggable._newPos.x =
  3159. Math.abs(f + b) < Math.abs(a + b) ? f : a
  3160. },
  3161. _onDragEnd: function () {
  3162. var a = this._map,
  3163. c = a.options,
  3164. e = +new Date - this._lastTime;
  3165. if (!c.inertia || e > c.inertiaThreshold || !this._positions[0]) a.fire("moveend");
  3166. else {
  3167. var d = this._lastPos.subtract(this._positions[0]),
  3168. f = c.easeLinearity,
  3169. d = d.multiplyBy(f / ((this._lastTime + e - this._times[0]) / 1E3)),
  3170. g = d.distanceTo(new b.Point(0, 0)),
  3171. e = Math.min(c.inertiaMaxSpeed, g),
  3172. d = d.multiplyBy(e / g),
  3173. h = e / (c.inertiaDeceleration * f),
  3174. j = d.multiplyBy(-h / 2).round();
  3175. b.Util.requestAnimFrame(function () {
  3176. a.panBy(j,
  3177. h, f)
  3178. })
  3179. }
  3180. a.fire("dragend");
  3181. c.maxBounds && b.Util.requestAnimFrame(this._panInsideMaxBounds, a, !0, a._container)
  3182. },
  3183. _panInsideMaxBounds: function () {
  3184. this.panInsideBounds(this.options.maxBounds)
  3185. }
  3186. });
  3187. b.Map.addInitHook("addHandler", "dragging", b.Map.Drag);
  3188. b.Map.mergeOptions({
  3189. doubleClickZoom: !0
  3190. });
  3191. b.Map.DoubleClickZoom = b.Handler.extend({
  3192. addHooks: function () {
  3193. this._map.on("dblclick", this._onDoubleClick)
  3194. },
  3195. removeHooks: function () {
  3196. this._map.off("dblclick", this._onDoubleClick)
  3197. },
  3198. _onDoubleClick: function (a) {
  3199. this.setView(a.latlng,
  3200. this._zoom + 1)
  3201. }
  3202. });
  3203. b.Map.addInitHook("addHandler", "doubleClickZoom", b.Map.DoubleClickZoom);
  3204. b.Map.mergeOptions({
  3205. scrollWheelZoom: !0
  3206. });
  3207. b.Map.ScrollWheelZoom = b.Handler.extend({
  3208. addHooks: function () {
  3209. b.DomEvent.on(this._map._container, "mousewheel", this._onWheelScroll, this);
  3210. this._delta = 0
  3211. },
  3212. removeHooks: function () {
  3213. b.DomEvent.off(this._map._container, "mousewheel", this._onWheelScroll)
  3214. },
  3215. _onWheelScroll: function (a) {
  3216. this._delta += b.DomEvent.getWheelDelta(a);
  3217. this._lastMousePos = this._map.mouseEventToContainerPoint(a);
  3218. if (!this._startTime) this._startTime = +new Date;
  3219. var c = Math.max(40 - (+new Date - this._startTime), 0);
  3220. clearTimeout(this._timer);
  3221. this._timer = setTimeout(b.bind(this._performZoom, this), c);
  3222. b.DomEvent.preventDefault(a);
  3223. b.DomEvent.stopPropagation(a)
  3224. },
  3225. _performZoom: function () {
  3226. var a = this._map,
  3227. c = this._delta,
  3228. b = a.getZoom(),
  3229. c = 0 < c ? Math.ceil(c) : Math.round(c),
  3230. c = Math.max(Math.min(c, 4), -4),
  3231. c = a._limitZoom(b + c) - b;
  3232. this._delta = 0;
  3233. this._startTime = null;
  3234. c && (c = b + c, b = this._getCenterForScrollWheelZoom(c), a.setView(b, c))
  3235. },
  3236. _getCenterForScrollWheelZoom: function (a) {
  3237. var c =
  3238. this._map,
  3239. b = c.getZoomScale(a),
  3240. a = c.getSize()._divideBy(2),
  3241. b = this._lastMousePos._subtract(a)._multiplyBy(1 - 1 / b),
  3242. a = c._getTopLeftPoint()._add(a)._add(b);
  3243. return c.unproject(a)
  3244. }
  3245. });
  3246. b.Map.addInitHook("addHandler", "scrollWheelZoom", b.Map.ScrollWheelZoom);
  3247. b.extend(b.DomEvent, {
  3248. _touchstart: b.Browser.msTouch ? "MSPointerDown" : "touchstart",
  3249. _touchend: b.Browser.msTouch ? "MSPointerUp" : "touchend",
  3250. addDoubleTapListener: function (a, c, e) {
  3251. function d(a) {
  3252. var c;
  3253. b.Browser.msTouch ? (n.push(a.pointerId), c = n.length) : c = a.touches.length;
  3254. if (!(1 < c)) {
  3255. c = Date.now();
  3256. var e = c - (g || c);
  3257. k = a.touches ? a.touches[0] : a;
  3258. h = 0 < e && e <= j;
  3259. g = c
  3260. }
  3261. }
  3262. function f(a) {
  3263. if (b.Browser.msTouch) {
  3264. a = n.indexOf(a.pointerId);
  3265. if (-1 === a) return;
  3266. n.splice(a, 1)
  3267. }
  3268. if (h) {
  3269. if (b.Browser.msTouch) {
  3270. var a = {},
  3271. e, d;
  3272. for (d in k) e = k[d], a[d] = "function" === typeof e ? e.bind(k) : e;
  3273. k = a
  3274. }
  3275. k.type = "dblclick";
  3276. c(k);
  3277. g = null
  3278. }
  3279. }
  3280. var g, h = !1,
  3281. j = 250,
  3282. k, l = this._touchstart,
  3283. m = this._touchend,
  3284. n = [];
  3285. a["_leaflet_" + l + e] = d;
  3286. a["_leaflet_" + m + e] = f;
  3287. e = b.Browser.msTouch ? i.documentElement : a;
  3288. a.addEventListener(l, d, !1);
  3289. e.addEventListener(m, f, !1);
  3290. b.Browser.msTouch && e.addEventListener("MSPointerCancel", f, !1);
  3291. return this
  3292. },
  3293. removeDoubleTapListener: function (a, c) {
  3294. a.removeEventListener(this._touchstart, a["_leaflet_" + this._touchstart + c], !1);
  3295. (b.Browser.msTouch ? i.documentElement : a).removeEventListener(this._touchend, a["_leaflet_" + this._touchend + c], !1);
  3296. b.Browser.msTouch && i.documentElement.removeEventListener("MSPointerCancel", a["_leaflet_" + this._touchend + c], !1);
  3297. return this
  3298. }
  3299. });
  3300. b.extend(b.DomEvent, {
  3301. _msTouches: [],
  3302. _msDocumentListener: !1,
  3303. addMsTouchListener: function (a,
  3304. c, b, d) {
  3305. switch (c) {
  3306. case "touchstart":
  3307. return this.addMsTouchListenerStart(a, c, b, d);
  3308. case "touchend":
  3309. return this.addMsTouchListenerEnd(a, c, b, d);
  3310. case "touchmove":
  3311. return this.addMsTouchListenerMove(a, c, b, d);
  3312. default:
  3313. throw "Unknown touch event type";
  3314. }
  3315. },
  3316. addMsTouchListenerStart: function (a, c, b, d) {
  3317. var f = this._msTouches,
  3318. c = function (a) {
  3319. for (var c = !1, d = 0; d < f.length; d++)
  3320. if (f[d].pointerId === a.pointerId) {
  3321. c = !0;
  3322. break
  3323. }
  3324. c || f.push(a);
  3325. a.touches = f.slice();
  3326. a.changedTouches = [a];
  3327. b(a)
  3328. };
  3329. a["_leaflet_touchstart" + d] = c;
  3330. a.addEventListener("MSPointerDown",
  3331. c, !1);
  3332. if (!this._msDocumentListener) a = function (a) {
  3333. for (var c = 0; c < f.length; c++)
  3334. if (f[c].pointerId === a.pointerId) {
  3335. f.splice(c, 1);
  3336. break
  3337. }
  3338. }, i.documentElement.addEventListener("MSPointerUp", a, !1), i.documentElement.addEventListener("MSPointerCancel", a, !1), this._msDocumentListener = !0;
  3339. return this
  3340. },
  3341. addMsTouchListenerMove: function (a, c, b, d) {
  3342. function f(a) {
  3343. if (!(a.pointerType === a.MSPOINTER_TYPE_MOUSE && 0 === a.buttons)) {
  3344. for (var c = 0; c < g.length; c++)
  3345. if (g[c].pointerId === a.pointerId) {
  3346. g[c] = a;
  3347. break
  3348. }
  3349. a.touches = g.slice();
  3350. a.changedTouches = [a];
  3351. b(a)
  3352. }
  3353. }
  3354. var g = this._msTouches;
  3355. a["_leaflet_touchmove" + d] = f;
  3356. a.addEventListener("MSPointerMove", f, !1);
  3357. return this
  3358. },
  3359. addMsTouchListenerEnd: function (a, c, b, d) {
  3360. var f = this._msTouches,
  3361. c = function (a) {
  3362. for (var c = 0; c < f.length; c++)
  3363. if (f[c].pointerId === a.pointerId) {
  3364. f.splice(c, 1);
  3365. break
  3366. }
  3367. a.touches = f.slice();
  3368. a.changedTouches = [a];
  3369. b(a)
  3370. };
  3371. a["_leaflet_touchend" + d] = c;
  3372. a.addEventListener("MSPointerUp", c, !1);
  3373. a.addEventListener("MSPointerCancel", c, !1);
  3374. return this
  3375. },
  3376. removeMsTouchListener: function (a, c, b) {
  3377. b = a["_leaflet_" + c + b];
  3378. switch (c) {
  3379. case "touchstart":
  3380. a.removeEventListener("MSPointerDown",
  3381. b, !1);
  3382. break;
  3383. case "touchmove":
  3384. a.removeEventListener("MSPointerMove", b, !1);
  3385. break;
  3386. case "touchend":
  3387. a.removeEventListener("MSPointerUp", b, !1), a.removeEventListener("MSPointerCancel", b, !1)
  3388. }
  3389. return this
  3390. }
  3391. });
  3392. b.Map.mergeOptions({
  3393. touchZoom: b.Browser.touch && !b.Browser.android23
  3394. });
  3395. b.Map.TouchZoom = b.Handler.extend({
  3396. addHooks: function () {
  3397. b.DomEvent.on(this._map._container, "touchstart", this._onTouchStart, this)
  3398. },
  3399. removeHooks: function () {
  3400. b.DomEvent.off(this._map._container, "touchstart", this._onTouchStart, this)
  3401. },
  3402. _onTouchStart: function (a) {
  3403. var c =
  3404. this._map;
  3405. if (a.touches && !(2 !== a.touches.length || c._animatingZoom || this._zooming)) {
  3406. var e = c.mouseEventToLayerPoint(a.touches[0]),
  3407. d = c.mouseEventToLayerPoint(a.touches[1]),
  3408. f = c._getCenterLayerPoint();
  3409. this._startCenter = e.add(d)._divideBy(2);
  3410. this._startDist = e.distanceTo(d);
  3411. this._moved = !1;
  3412. this._zooming = !0;
  3413. this._centerOffset = f.subtract(this._startCenter);
  3414. c._panAnim && c._panAnim.stop();
  3415. b.DomEvent.on(i, "touchmove", this._onTouchMove, this).on(i, "touchend", this._onTouchEnd, this);
  3416. b.DomEvent.preventDefault(a)
  3417. }
  3418. },
  3419. _onTouchMove: function (a) {
  3420. if (a.touches &&
  3421. 2 === a.touches.length) {
  3422. var c = this._map,
  3423. e = c.mouseEventToLayerPoint(a.touches[0]),
  3424. d = c.mouseEventToLayerPoint(a.touches[1]);
  3425. this._scale = e.distanceTo(d) / this._startDist;
  3426. this._delta = e._add(d)._divideBy(2)._subtract(this._startCenter);
  3427. if (1 !== this._scale) {
  3428. if (!this._moved) b.DomUtil.addClass(c._mapPane, "leaflet-zoom-anim leaflet-touching"), c.fire("movestart").fire("zoomstart")._prepareTileBg(), this._moved = !0;
  3429. b.Util.cancelAnimFrame(this._animRequest);
  3430. this._animRequest = b.Util.requestAnimFrame(this._updateOnMove,
  3431. this, !0, this._map._container);
  3432. b.DomEvent.preventDefault(a)
  3433. }
  3434. }
  3435. },
  3436. _updateOnMove: function () {
  3437. var a = this._map,
  3438. c = this._getScaleOrigin(),
  3439. c = a.layerPointToLatLng(c);
  3440. a.fire("zoomanim", {
  3441. center: c,
  3442. zoom: a.getScaleZoom(this._scale)
  3443. });
  3444. a._tileBg.style[b.DomUtil.TRANSFORM] = b.DomUtil.getTranslateString(this._delta) + " " + b.DomUtil.getScaleString(this._scale, this._startCenter)
  3445. },
  3446. _onTouchEnd: function () {
  3447. if (this._moved && this._zooming) {
  3448. var a = this._map;
  3449. this._zooming = !1;
  3450. b.DomUtil.removeClass(a._mapPane, "leaflet-touching");
  3451. b.DomEvent.off(i,
  3452. "touchmove", this._onTouchMove).off(i, "touchend", this._onTouchEnd);
  3453. var c = this._getScaleOrigin(),
  3454. e = a.layerPointToLatLng(c),
  3455. d = a.getZoom(),
  3456. f = a.getScaleZoom(this._scale) - d,
  3457. f = 0 < f ? Math.ceil(f) : Math.floor(f),
  3458. d = a._limitZoom(d + f);
  3459. a.fire("zoomanim", {
  3460. center: e,
  3461. zoom: d
  3462. });
  3463. a._runAnimation(e, d, a.getZoomScale(d) / this._scale, c, !0)
  3464. }
  3465. },
  3466. _getScaleOrigin: function () {
  3467. return this._startCenter.add(this._centerOffset.subtract(this._delta).divideBy(this._scale))
  3468. }
  3469. });
  3470. b.Map.addInitHook("addHandler", "touchZoom", b.Map.TouchZoom);
  3471. b.Map.mergeOptions({
  3472. boxZoom: !0
  3473. });
  3474. b.Map.BoxZoom = b.Handler.extend({
  3475. initialize: function (a) {
  3476. this._map = a;
  3477. this._container = a._container;
  3478. this._pane = a._panes.overlayPane
  3479. },
  3480. addHooks: function () {
  3481. b.DomEvent.on(this._container, "mousedown", this._onMouseDown, this)
  3482. },
  3483. removeHooks: function () {
  3484. b.DomEvent.off(this._container, "mousedown", this._onMouseDown)
  3485. },
  3486. _onMouseDown: function (a) {
  3487. if (!a.shiftKey || 1 !== a.which && 1 !== a.button) return !1;
  3488. b.DomUtil.disableTextSelection();
  3489. this._startLayerPoint = this._map.mouseEventToLayerPoint(a);
  3490. this._box = b.DomUtil.create("div",
  3491. "leaflet-zoom-box", this._pane);
  3492. b.DomUtil.setPosition(this._box, this._startLayerPoint);
  3493. this._container.style.cursor = "crosshair";
  3494. b.DomEvent.on(i, "mousemove", this._onMouseMove, this).on(i, "mouseup", this._onMouseUp, this).preventDefault(a);
  3495. this._map.fire("boxzoomstart")
  3496. },
  3497. _onMouseMove: function (a) {
  3498. var c = this._startLayerPoint,
  3499. e = this._box,
  3500. d = this._map.mouseEventToLayerPoint(a),
  3501. a = d.subtract(c),
  3502. c = new b.Point(Math.min(d.x, c.x), Math.min(d.y, c.y));
  3503. b.DomUtil.setPosition(e, c);
  3504. e.style.width = Math.max(0, Math.abs(a.x) -
  3505. 4) + "px";
  3506. e.style.height = Math.max(0, Math.abs(a.y) - 4) + "px"
  3507. },
  3508. _onMouseUp: function (a) {
  3509. this._pane.removeChild(this._box);
  3510. this._container.style.cursor = "";
  3511. b.DomUtil.enableTextSelection();
  3512. b.DomEvent.off(i, "mousemove", this._onMouseMove).off(i, "mouseup", this._onMouseUp);
  3513. var c = this._map,
  3514. a = c.mouseEventToLayerPoint(a);
  3515. this._startLayerPoint.equals(a) || (a = new b.LatLngBounds(c.layerPointToLatLng(this._startLayerPoint), c.layerPointToLatLng(a)), c.fitBounds(a), c.fire("boxzoomend", {
  3516. boxZoomBounds: a
  3517. }))
  3518. }
  3519. });
  3520. b.Map.addInitHook("addHandler",
  3521. "boxZoom", b.Map.BoxZoom);
  3522. b.Map.mergeOptions({
  3523. keyboard: !0,
  3524. keyboardPanOffset: 80,
  3525. keyboardZoomOffset: 1
  3526. });
  3527. b.Map.Keyboard = b.Handler.extend({
  3528. keyCodes: {
  3529. left: [37],
  3530. right: [39],
  3531. down: [40],
  3532. up: [38],
  3533. zoomIn: [187, 107, 61],
  3534. zoomOut: [189, 109, 173]
  3535. },
  3536. initialize: function (a) {
  3537. this._map = a;
  3538. this._setPanOffset(a.options.keyboardPanOffset);
  3539. this._setZoomOffset(a.options.keyboardZoomOffset)
  3540. },
  3541. addHooks: function () {
  3542. var a = this._map._container;
  3543. if (-1 === a.tabIndex) a.tabIndex = "0";
  3544. b.DomEvent.on(a, "focus", this._onFocus, this).on(a, "blur", this._onBlur,
  3545. this).on(a, "mousedown", this._onMouseDown, this);
  3546. this._map.on("focus", this._addHooks, this).on("blur", this._removeHooks, this)
  3547. },
  3548. removeHooks: function () {
  3549. this._removeHooks();
  3550. var a = this._map._container;
  3551. b.DomEvent.off(a, "focus", this._onFocus, this).off(a, "blur", this._onBlur, this).off(a, "mousedown", this._onMouseDown, this);
  3552. this._map.off("focus", this._addHooks, this).off("blur", this._removeHooks, this)
  3553. },
  3554. _onMouseDown: function () {
  3555. this._focused || this._map._container.focus()
  3556. },
  3557. _onFocus: function () {
  3558. this._focused = !0;
  3559. this._map.fire("focus")
  3560. },
  3561. _onBlur: function () {
  3562. this._focused = !1;
  3563. this._map.fire("blur")
  3564. },
  3565. _setPanOffset: function (a) {
  3566. var c = this._panKeys = {},
  3567. b = this.keyCodes,
  3568. d, f;
  3569. for (d = 0, f = b.left.length; d < f; d++) c[b.left[d]] = [-1 * a, 0];
  3570. for (d = 0, f = b.right.length; d < f; d++) c[b.right[d]] = [a, 0];
  3571. for (d = 0, f = b.down.length; d < f; d++) c[b.down[d]] = [0, a];
  3572. for (d = 0, f = b.up.length; d < f; d++) c[b.up[d]] = [0, -1 * a]
  3573. },
  3574. _setZoomOffset: function (a) {
  3575. var c = this._zoomKeys = {},
  3576. b = this.keyCodes,
  3577. d, f;
  3578. for (d = 0, f = b.zoomIn.length; d < f; d++) c[b.zoomIn[d]] = a;
  3579. for (d = 0, f = b.zoomOut.length; d < f; d++) c[b.zoomOut[d]] = -a
  3580. },
  3581. _addHooks: function () {
  3582. b.DomEvent.on(i, "keydown", this._onKeyDown, this)
  3583. },
  3584. _removeHooks: function () {
  3585. b.DomEvent.off(i, "keydown", this._onKeyDown, this)
  3586. },
  3587. _onKeyDown: function (a) {
  3588. var c = a.keyCode,
  3589. e = this._map;
  3590. if (this._panKeys.hasOwnProperty(c)) e.panBy(this._panKeys[c]), e.options.maxBounds && e.panInsideBounds(e.options.maxBounds);
  3591. else if (this._zoomKeys.hasOwnProperty(c)) e.setZoom(e.getZoom() + this._zoomKeys[c]);
  3592. else return;
  3593. b.DomEvent.stop(a)
  3594. }
  3595. });
  3596. b.Map.addInitHook("addHandler", "keyboard", b.Map.Keyboard);
  3597. b.Handler.MarkerDrag =
  3598. b.Handler.extend({
  3599. initialize: function (a) {
  3600. this._marker = a
  3601. },
  3602. addHooks: function () {
  3603. var a = this._marker._icon;
  3604. 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);
  3605. this._draggable.enable()
  3606. },
  3607. removeHooks: function () {
  3608. this._draggable.disable()
  3609. },
  3610. moved: function () {
  3611. return this._draggable && this._draggable._moved
  3612. },
  3613. _onDragStart: function () {
  3614. this._marker.closePopup().fire("movestart").fire("dragstart")
  3615. },
  3616. _onDrag: function () {
  3617. var a =
  3618. this._marker,
  3619. c = a._shadow,
  3620. e = b.DomUtil.getPosition(a._icon),
  3621. d = a._map.layerPointToLatLng(e);
  3622. c && b.DomUtil.setPosition(c, e);
  3623. a._latlng = d;
  3624. a.fire("move", {
  3625. latlng: d
  3626. }).fire("drag")
  3627. },
  3628. _onDragEnd: function () {
  3629. this._marker.fire("moveend").fire("dragend")
  3630. }
  3631. });
  3632. b.Handler.PolyEdit = b.Handler.extend({
  3633. options: {
  3634. icon: new b.DivIcon({
  3635. iconSize: new b.Point(8, 8),
  3636. className: "leaflet-div-icon leaflet-editing-icon"
  3637. })
  3638. },
  3639. initialize: function (a, c) {
  3640. this._poly = a;
  3641. b.setOptions(this, c)
  3642. },
  3643. addHooks: function () {
  3644. this._poly._map && (this._markerGroup ||
  3645. this._initMarkers(), this._poly._map.addLayer(this._markerGroup))
  3646. },
  3647. removeHooks: function () {
  3648. this._poly._map && (this._poly._map.removeLayer(this._markerGroup), delete this._markerGroup, delete this._markers)
  3649. },
  3650. updateMarkers: function () {
  3651. this._markerGroup.clearLayers();
  3652. this._initMarkers()
  3653. },
  3654. _initMarkers: function () {
  3655. if (!this._markerGroup) this._markerGroup = new b.LayerGroup;
  3656. this._markers = [];
  3657. var a = this._poly._latlngs,
  3658. c, e, d;
  3659. for (c = 0, e = a.length; c < e; c++) d = this._createMarker(a[c], c), d.on("click", this._onMarkerClick, this),
  3660. this._markers.push(d);
  3661. for (c = 0, a = e - 1; c < e; a = c++)
  3662. 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)
  3663. },
  3664. _createMarker: function (a, c) {
  3665. var e = new b.Marker(a, {
  3666. draggable: !0,
  3667. icon: this.options.icon
  3668. });
  3669. e._origLatLng = a;
  3670. e._index = c;
  3671. e.on("drag", this._onMarkerDrag, this);
  3672. e.on("dragend", this._fireEdit, this);
  3673. this._markerGroup.addLayer(e);
  3674. return e
  3675. },
  3676. _fireEdit: function () {
  3677. this._poly.fire("edit")
  3678. },
  3679. _onMarkerDrag: function (a) {
  3680. a = a.target;
  3681. b.extend(a._origLatLng, a._latlng);
  3682. a._middleLeft && a._middleLeft.setLatLng(this._getMiddleLatLng(a._prev, a));
  3683. a._middleRight && a._middleRight.setLatLng(this._getMiddleLatLng(a, a._next));
  3684. this._poly.redraw()
  3685. },
  3686. _onMarkerClick: function (a) {
  3687. if (!(3 > this._poly._latlngs.length)) {
  3688. var a = a.target,
  3689. c = a._index;
  3690. this._markerGroup.removeLayer(a);
  3691. this._markers.splice(c, 1);
  3692. this._poly.spliceLatLngs(c, 1);
  3693. this._updateIndexes(c, -1);
  3694. this._updatePrevNext(a._prev, a._next);
  3695. a._middleLeft && this._markerGroup.removeLayer(a._middleLeft);
  3696. a._middleRight && this._markerGroup.removeLayer(a._middleRight);
  3697. if (a._prev && a._next) this._createMiddleMarker(a._prev, a._next);
  3698. else if (a._prev) {
  3699. if (!a._next) a._prev._middleRight = null
  3700. } else a._next._middleLeft = null;
  3701. this._poly.fire("edit")
  3702. }
  3703. },
  3704. _updateIndexes: function (a, c) {
  3705. this._markerGroup.eachLayer(function (b) {
  3706. b._index > a && (b._index += c)
  3707. })
  3708. },
  3709. _createMiddleMarker: function (a, c) {
  3710. var b = this._getMiddleLatLng(a, c),
  3711. d = this._createMarker(b),
  3712. f, g, h;
  3713. d.setOpacity(0.6);
  3714. a._middleRight = c._middleLeft = d;
  3715. g = function () {
  3716. var g = c._index;
  3717. d._index = g;
  3718. d.off("click", f).on("click", this._onMarkerClick, this);
  3719. b.lat = d.getLatLng().lat;
  3720. b.lng = d.getLatLng().lng;
  3721. this._poly.spliceLatLngs(g, 0, b);
  3722. this._markers.splice(g, 0, d);
  3723. d.setOpacity(1);
  3724. this._updateIndexes(g, 1);
  3725. c._index++;
  3726. this._updatePrevNext(a, d);
  3727. this._updatePrevNext(d, c)
  3728. };
  3729. h = function () {
  3730. d.off("dragstart", g, this);
  3731. d.off("dragend", h, this);
  3732. this._createMiddleMarker(a, d);
  3733. this._createMiddleMarker(d, c)
  3734. };
  3735. f = function () {
  3736. g.call(this);
  3737. h.call(this);
  3738. this._poly.fire("edit")
  3739. };
  3740. d.on("click", f, this).on("dragstart",
  3741. g, this).on("dragend", h, this);
  3742. this._markerGroup.addLayer(d)
  3743. },
  3744. _updatePrevNext: function (a, c) {
  3745. if (a) a._next = c;
  3746. if (c) c._prev = a
  3747. },
  3748. _getMiddleLatLng: function (a, c) {
  3749. var b = this._poly._map,
  3750. d = b.latLngToLayerPoint(a.getLatLng()),
  3751. f = b.latLngToLayerPoint(c.getLatLng());
  3752. return b.layerPointToLatLng(d._add(f)._divideBy(2))
  3753. }
  3754. });
  3755. b.Polyline.addInitHook(function () {
  3756. if (b.Handler.PolyEdit) this.editing = new b.Handler.PolyEdit(this), this.options.editable && this.editing.enable();
  3757. this.on("add", function () {
  3758. this.editing && this.editing.enabled() &&
  3759. this.editing.addHooks()
  3760. });
  3761. this.on("remove", function () {
  3762. this.editing && this.editing.enabled() && this.editing.removeHooks()
  3763. })
  3764. });
  3765. b.Control = b.Class.extend({
  3766. options: {
  3767. position: "topright"
  3768. },
  3769. initialize: function (a) {
  3770. b.setOptions(this, a)
  3771. },
  3772. getPosition: function () {
  3773. return this.options.position
  3774. },
  3775. setPosition: function (a) {
  3776. var c = this._map;
  3777. c && c.removeControl(this);
  3778. this.options.position = a;
  3779. c && c.addControl(this);
  3780. return this
  3781. },
  3782. addTo: function (a) {
  3783. this._map = a;
  3784. var c = this._container = this.onAdd(a),
  3785. e = this.getPosition(),
  3786. a = a._controlCorners[e];
  3787. b.DomUtil.addClass(c, "leaflet-control"); - 1 !== e.indexOf("bottom") ? a.insertBefore(c, a.firstChild) : a.appendChild(c);
  3788. return this
  3789. },
  3790. removeFrom: function (a) {
  3791. var c = this.getPosition();
  3792. a._controlCorners[c].removeChild(this._container);
  3793. this._map = null;
  3794. if (this.onRemove) this.onRemove(a);
  3795. return this
  3796. }
  3797. });
  3798. b.control = function (a) {
  3799. return new b.Control(a)
  3800. };
  3801. b.Map.include({
  3802. addControl: function (a) {
  3803. a.addTo(this);
  3804. return this
  3805. },
  3806. removeControl: function (a) {
  3807. a.removeFrom(this);
  3808. return this
  3809. },
  3810. _initControlPos: function () {
  3811. function a(a, g) {
  3812. c[a +
  3813. g] = b.DomUtil.create("div", e + a + " " + e + g, d)
  3814. }
  3815. var c = this._controlCorners = {},
  3816. e = "leaflet-",
  3817. d = this._controlContainer = b.DomUtil.create("div", e + "control-container", this._container);
  3818. a("top", "left");
  3819. a("top", "right");
  3820. a("bottom", "left");
  3821. a("bottom", "right")
  3822. }
  3823. });
  3824. b.Control.Zoom = b.Control.extend({
  3825. options: {
  3826. position: "topleft"
  3827. },
  3828. onAdd: function (a) {
  3829. var c = b.DomUtil.create("div", "leaflet-control-zoom leaflet-bar");
  3830. this._map = a;
  3831. this._zoomInButton = this._createButton("+", "Zoom in", "leaflet-control-zoom-in leaflet-bar-part leaflet-bar-part-top",
  3832. c, this._zoomIn, this);
  3833. this._zoomOutButton = this._createButton("-", "Zoom out", "leaflet-control-zoom-out leaflet-bar-part leaflet-bar-part-bottom", c, this._zoomOut, this);
  3834. a.on("zoomend", this._updateDisabled, this);
  3835. return c
  3836. },
  3837. onRemove: function (a) {
  3838. a.off("zoomend", this._updateDisabled, this)
  3839. },
  3840. _zoomIn: function (a) {
  3841. this._map.zoomIn(a.shiftKey ? 3 : 1)
  3842. },
  3843. _zoomOut: function (a) {
  3844. this._map.zoomOut(a.shiftKey ? 3 : 1)
  3845. },
  3846. _createButton: function (a, c, e, d, f, g) {
  3847. e = b.DomUtil.create("a", e, d);
  3848. e.innerHTML = a;
  3849. e.href = "#";
  3850. e.title = c;
  3851. a = b.DomEvent.stopPropagation;
  3852. 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);
  3853. return e
  3854. },
  3855. _updateDisabled: function () {
  3856. var a = this._map;
  3857. b.DomUtil.removeClass(this._zoomInButton, "leaflet-control-zoom-disabled");
  3858. b.DomUtil.removeClass(this._zoomOutButton, "leaflet-control-zoom-disabled");
  3859. a._zoom === a.getMinZoom() && b.DomUtil.addClass(this._zoomOutButton, "leaflet-control-zoom-disabled");
  3860. a._zoom === a.getMaxZoom() && b.DomUtil.addClass(this._zoomInButton, "leaflet-control-zoom-disabled")
  3861. }
  3862. });
  3863. b.Map.mergeOptions({
  3864. zoomControl: !0
  3865. });
  3866. b.Map.addInitHook(function () {
  3867. if (this.options.zoomControl) this.zoomControl = new b.Control.Zoom, this.addControl(this.zoomControl)
  3868. });
  3869. b.control.zoom = function (a) {
  3870. return new b.Control.Zoom(a)
  3871. };
  3872. b.Control.Attribution = b.Control.extend({
  3873. options: {
  3874. position: "bottomright",
  3875. prefix: 'Powered by <a href="http://leafletjs.com">Leaflet</a>'
  3876. },
  3877. initialize: function (a) {
  3878. b.setOptions(this, a);
  3879. this._attributions = {}
  3880. },
  3881. onAdd: function (a) {
  3882. this._container = b.DomUtil.create("div", "leaflet-control-attribution");
  3883. b.DomEvent.disableClickPropagation(this._container);
  3884. a.on("layeradd", this._onLayerAdd, this).on("layerremove", this._onLayerRemove, this);
  3885. this._update();
  3886. return this._container
  3887. },
  3888. onRemove: function (a) {
  3889. a.off("layeradd", this._onLayerAdd).off("layerremove", this._onLayerRemove)
  3890. },
  3891. setPrefix: function (a) {
  3892. this.options.prefix = a;
  3893. this._update();
  3894. return this
  3895. },
  3896. addAttribution: function (a) {
  3897. if (a) return this._attributions[a] || (this._attributions[a] = 0), this._attributions[a]++, this._update(), this
  3898. },
  3899. removeAttribution: function (a) {
  3900. if (a) return this._attributions[a]--,
  3901. this._update(), this
  3902. },
  3903. _update: function () {
  3904. if (this._map) {
  3905. var a = [],
  3906. c;
  3907. for (c in this._attributions) this._attributions.hasOwnProperty(c) && this._attributions[c] && a.push(c);
  3908. c = [];
  3909. this.options.prefix && c.push(this.options.prefix);
  3910. a.length && c.push(a.join(", "));
  3911. this._container.innerHTML = c.join(" &#8212; ")
  3912. }
  3913. },
  3914. _onLayerAdd: function (a) {
  3915. a.layer.getAttribution && this.addAttribution(a.layer.getAttribution())
  3916. },
  3917. _onLayerRemove: function (a) {
  3918. a.layer.getAttribution && this.removeAttribution(a.layer.getAttribution())
  3919. }
  3920. });
  3921. b.Map.mergeOptions({
  3922. attributionControl: !0
  3923. });
  3924. b.Map.addInitHook(function () {
  3925. if (this.options.attributionControl) this.attributionControl = (new b.Control.Attribution).addTo(this)
  3926. });
  3927. b.control.attribution = function (a) {
  3928. return new b.Control.Attribution(a)
  3929. };
  3930. b.Control.Scale = b.Control.extend({
  3931. options: {
  3932. position: "bottomleft",
  3933. maxWidth: 100,
  3934. metric: !0,
  3935. imperial: !0,
  3936. updateWhenIdle: !1
  3937. },
  3938. onAdd: function (a) {
  3939. this._map = a;
  3940. var c = b.DomUtil.create("div", "leaflet-control-scale"),
  3941. e = this.options;
  3942. this._addScales(e, "leaflet-control-scale", c);
  3943. a.on(e.updateWhenIdle ? "moveend" : "move",
  3944. this._update, this);
  3945. a.whenReady(this._update, this);
  3946. return c
  3947. },
  3948. onRemove: function (a) {
  3949. a.off(this.options.updateWhenIdle ? "moveend" : "move", this._update, this)
  3950. },
  3951. _addScales: function (a, c, e) {
  3952. if (a.metric) this._mScale = b.DomUtil.create("div", c + "-line", e);
  3953. if (a.imperial) this._iScale = b.DomUtil.create("div", c + "-line", e)
  3954. },
  3955. _update: function () {
  3956. var a = this._map.getBounds(),
  3957. c = a.getCenter().lat,
  3958. a = 6378137 * Math.PI * Math.cos(c * Math.PI / 180) * (a.getNorthEast().lng - a.getSouthWest().lng) / 180,
  3959. c = this._map.getSize(),
  3960. b = this.options,
  3961. d = 0;
  3962. 0 < c.x && (d = a * (b.maxWidth / c.x));
  3963. this._updateScales(b, d)
  3964. },
  3965. _updateScales: function (a, c) {
  3966. a.metric && c && this._updateMetric(c);
  3967. a.imperial && c && this._updateImperial(c)
  3968. },
  3969. _updateMetric: function (a) {
  3970. var c = this._getRoundNum(a);
  3971. this._mScale.style.width = this._getScaleWidth(c / a) + "px";
  3972. this._mScale.innerHTML = 1E3 > c ? c + " m" : c / 1E3 + " km"
  3973. },
  3974. _updateImperial: function (a) {
  3975. var c = 3.2808399 * a,
  3976. a = this._iScale,
  3977. b;
  3978. 5280 < c ? (c /= 5280, b = this._getRoundNum(c), a.style.width = this._getScaleWidth(b / c) + "px", a.innerHTML = b + " mi") : (b = this._getRoundNum(c),
  3979. a.style.width = this._getScaleWidth(b / c) + "px", a.innerHTML = b + " ft")
  3980. },
  3981. _getScaleWidth: function (a) {
  3982. return Math.round(this.options.maxWidth * a) - 10
  3983. },
  3984. _getRoundNum: function (a) {
  3985. var b = Math.pow(10, (Math.floor(a) + "").length - 1),
  3986. a = a / b;
  3987. return b * (10 <= a ? 10 : 5 <= a ? 5 : 3 <= a ? 3 : 2 <= a ? 2 : 1)
  3988. }
  3989. });
  3990. b.control.scale = function (a) {
  3991. return new b.Control.Scale(a)
  3992. };
  3993. b.Control.Layers = b.Control.extend({
  3994. options: {
  3995. collapsed: !0,
  3996. position: "topright",
  3997. autoZIndex: !0
  3998. },
  3999. initialize: function (a, c, e) {
  4000. b.setOptions(this, e);
  4001. this._layers = {};
  4002. this._lastZIndex = 0;
  4003. this._handlingClick = !1;
  4004. for (var d in a) a.hasOwnProperty(d) && this._addLayer(a[d], d);
  4005. for (d in c) c.hasOwnProperty(d) && this._addLayer(c[d], d, !0)
  4006. },
  4007. onAdd: function (a) {
  4008. this._initLayout();
  4009. this._update();
  4010. a.on("layeradd", this._onLayerChange, this).on("layerremove", this._onLayerChange, this);
  4011. return this._container
  4012. },
  4013. onRemove: function (a) {
  4014. a.off("layeradd", this._onLayerChange).off("layerremove", this._onLayerChange)
  4015. },
  4016. addBaseLayer: function (a, b) {
  4017. this._addLayer(a, b);
  4018. this._update();
  4019. return this
  4020. },
  4021. addOverlay: function (a, b) {
  4022. this._addLayer(a, b, !0);
  4023. this._update();
  4024. return this
  4025. },
  4026. removeLayer: function (a) {
  4027. delete this._layers[b.stamp(a)];
  4028. this._update();
  4029. return this
  4030. },
  4031. _initLayout: function () {
  4032. var a = this._container = b.DomUtil.create("div", "leaflet-control-layers");
  4033. if (b.Browser.touch) b.DomEvent.on(a, "click", b.DomEvent.stopPropagation);
  4034. else b.DomEvent.disableClickPropagation(a), b.DomEvent.on(a, "mousewheel", b.DomEvent.stopPropagation);
  4035. var c = this._form = b.DomUtil.create("form", "leaflet-control-layers-list");
  4036. if (this.options.collapsed) {
  4037. b.DomEvent.on(a, "mouseover",
  4038. this._expand, this).on(a, "mouseout", this._collapse, this);
  4039. var e = this._layersLink = b.DomUtil.create("a", "leaflet-control-layers-toggle", a);
  4040. e.href = "#";
  4041. e.title = "Layers";
  4042. if (b.Browser.touch) b.DomEvent.on(e, "click", b.DomEvent.stopPropagation).on(e, "click", b.DomEvent.preventDefault).on(e, "click", this._expand, this);
  4043. else b.DomEvent.on(e, "focus", this._expand, this);
  4044. this._map.on("movestart", this._collapse, this)
  4045. } else this._expand();
  4046. this._baseLayersList = b.DomUtil.create("div", "leaflet-control-layers-base", c);
  4047. this._separator =
  4048. b.DomUtil.create("div", "leaflet-control-layers-separator", c);
  4049. this._overlaysList = b.DomUtil.create("div", "leaflet-control-layers-overlays", c);
  4050. a.appendChild(c)
  4051. },
  4052. _addLayer: function (a, c, e) {
  4053. this._layers[b.stamp(a)] = {
  4054. layer: a,
  4055. name: c,
  4056. overlay: e
  4057. };
  4058. this.options.autoZIndex && a.setZIndex && (this._lastZIndex++, a.setZIndex(this._lastZIndex))
  4059. },
  4060. _update: function () {
  4061. if (this._container) {
  4062. this._baseLayersList.innerHTML = "";
  4063. this._overlaysList.innerHTML = "";
  4064. var a = !1,
  4065. b = !1,
  4066. e;
  4067. for (e in this._layers)
  4068. if (this._layers.hasOwnProperty(e)) {
  4069. var d =
  4070. this._layers[e];
  4071. this._addItem(d);
  4072. b = b || d.overlay;
  4073. a = a || !d.overlay
  4074. }
  4075. this._separator.style.display = b && a ? "" : "none"
  4076. }
  4077. },
  4078. _onLayerChange: function (a) {
  4079. this._layers[b.stamp(a.layer)] && !this._handlingClick && this._update()
  4080. },
  4081. _createRadioElement: function (a, b) {
  4082. var e = '<input type="radio" class="leaflet-control-layers-selector" name="' + a + '"';
  4083. b && (e += ' checked="checked"');
  4084. var e = e + "/>",
  4085. d = i.createElement("div");
  4086. d.innerHTML = e;
  4087. return d.firstChild
  4088. },
  4089. _addItem: function (a) {
  4090. var c = i.createElement("label"),
  4091. e, d = this._map.hasLayer(a.layer);
  4092. 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);
  4093. e.layerId = b.stamp(a.layer);
  4094. b.DomEvent.on(e, "click", this._onInputClick, this);
  4095. d = i.createElement("span");
  4096. d.innerHTML = " " + a.name;
  4097. c.appendChild(e);
  4098. c.appendChild(d);
  4099. (a.overlay ? this._overlaysList : this._baseLayersList).appendChild(c);
  4100. return c
  4101. },
  4102. _onInputClick: function () {
  4103. var a, b, e, d = this._form.getElementsByTagName("input"),
  4104. f = d.length,
  4105. g;
  4106. this._handlingClick = !0;
  4107. for (a = 0; a < f; a++)
  4108. if (b = d[a], e = this._layers[b.layerId], b.checked && !this._map.hasLayer(e.layer)) {
  4109. if (this._map.addLayer(e.layer), !e.overlay) g = e.layer
  4110. } else !b.checked && this._map.hasLayer(e.layer) && this._map.removeLayer(e.layer);
  4111. g && (this._map.setZoom(this._map.getZoom()), this._map.fire("baselayerchange", {
  4112. layer: g
  4113. }));
  4114. this._handlingClick = !1
  4115. },
  4116. _expand: function () {
  4117. b.DomUtil.addClass(this._container, "leaflet-control-layers-expanded")
  4118. },
  4119. _collapse: function () {
  4120. this._container.className = this._container.className.replace(" leaflet-control-layers-expanded",
  4121. "")
  4122. }
  4123. });
  4124. b.control.layers = function (a, c, e) {
  4125. return new b.Control.Layers(a, c, e)
  4126. };
  4127. b.PosAnimation = b.Class.extend({
  4128. includes: b.Mixin.Events,
  4129. run: function (a, c, e, d) {
  4130. this.stop();
  4131. this._el = a;
  4132. this._inProgress = !0;
  4133. this.fire("start");
  4134. a.style[b.DomUtil.TRANSITION] = "all " + (e || 0.25) + "s cubic-bezier(0,0," + (d || 0.5) + ",1)";
  4135. b.DomEvent.on(a, b.DomUtil.TRANSITION_END, this._onTransitionEnd, this);
  4136. b.DomUtil.setPosition(a, c);
  4137. b.Util.falseFn(a.offsetWidth);
  4138. this._stepTimer = setInterval(b.bind(this.fire, this, "step"), 50)
  4139. },
  4140. stop: function () {
  4141. this._inProgress &&
  4142. (b.DomUtil.setPosition(this._el, this._getPos()), this._onTransitionEnd(), b.Util.falseFn(this._el.offsetWidth))
  4143. },
  4144. _transformRe: /(-?[\d\.]+), (-?[\d\.]+)\)/,
  4145. _getPos: function () {
  4146. var a, c;
  4147. c = k.getComputedStyle(this._el);
  4148. 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));
  4149. console.log(a, c);
  4150. return new b.Point(a, c, !0)
  4151. },
  4152. _onTransitionEnd: function () {
  4153. b.DomEvent.off(this._el, b.DomUtil.TRANSITION_END, this._onTransitionEnd, this);
  4154. if (this._inProgress) this._inProgress = !1, this._el.style[b.DomUtil.TRANSITION] = "", clearInterval(this._stepTimer), this.fire("step").fire("end")
  4155. }
  4156. });
  4157. b.Map.include({
  4158. setView: function (a, b, e) {
  4159. var b = this._limitZoom(b),
  4160. d = this._zoom !== b;
  4161. 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;
  4162. this._resetView(a, b);
  4163. return this
  4164. },
  4165. panBy: function (a, c, e) {
  4166. a = b.point(a);
  4167. if (!a.x && !a.y) return this;
  4168. if (!this._panAnim) this._panAnim = new b.PosAnimation,
  4169. this._panAnim.on({
  4170. step: this._onPanTransitionStep,
  4171. end: this._onPanTransitionEnd
  4172. }, this);
  4173. this.fire("movestart");
  4174. b.DomUtil.addClass(this._mapPane, "leaflet-pan-anim");
  4175. this._panAnim.run(this._mapPane, b.DomUtil.getPosition(this._mapPane).subtract(a)._round(), c || 0.25, e);
  4176. return this
  4177. },
  4178. _onPanTransitionStep: function () {
  4179. this.fire("move")
  4180. },
  4181. _onPanTransitionEnd: function () {
  4182. b.DomUtil.removeClass(this._mapPane, "leaflet-pan-anim");
  4183. this.fire("moveend")
  4184. },
  4185. _panByIfClose: function (a) {
  4186. a = this._getCenterOffset(a)._floor();
  4187. return this._offsetIsWithinView(a) ?
  4188. (this.panBy(a), !0) : !1
  4189. },
  4190. _offsetIsWithinView: function (a, b) {
  4191. var e = b || 1,
  4192. d = this.getSize();
  4193. return Math.abs(a.x) <= d.x * e && Math.abs(a.y) <= d.y * e
  4194. }
  4195. });
  4196. b.PosAnimation = b.DomUtil.TRANSITION ? b.PosAnimation : b.PosAnimation.extend({
  4197. run: function (a, c, e, d) {
  4198. this.stop();
  4199. this._el = a;
  4200. this._inProgress = !0;
  4201. this._duration = e || 0.25;
  4202. this._easeOutPower = 1 / Math.max(d || 0.5, 0.2);
  4203. this._startPos = b.DomUtil.getPosition(a);
  4204. this._offset = c.subtract(this._startPos);
  4205. this._startTime = +new Date;
  4206. this.fire("start");
  4207. this._animate()
  4208. },
  4209. stop: function () {
  4210. this._inProgress &&
  4211. (this._step(), this._complete())
  4212. },
  4213. _animate: function () {
  4214. this._animId = b.Util.requestAnimFrame(this._animate, this);
  4215. this._step()
  4216. },
  4217. _step: function () {
  4218. var a = +new Date - this._startTime,
  4219. b = 1E3 * this._duration;
  4220. a < b ? this._runFrame(this._easeOut(a / b)) : (this._runFrame(1), this._complete())
  4221. },
  4222. _runFrame: function (a) {
  4223. a = this._startPos.add(this._offset.multiplyBy(a));
  4224. b.DomUtil.setPosition(this._el, a);
  4225. this.fire("step")
  4226. },
  4227. _complete: function () {
  4228. b.Util.cancelAnimFrame(this._animId);
  4229. this._inProgress = !1;
  4230. this.fire("end")
  4231. },
  4232. _easeOut: function (a) {
  4233. return 1 -
  4234. Math.pow(1 - a, this._easeOutPower)
  4235. }
  4236. });
  4237. b.Map.mergeOptions({
  4238. zoomAnimation: b.DomUtil.TRANSITION && !b.Browser.android23 && !b.Browser.mobileOpera
  4239. });
  4240. b.DomUtil.TRANSITION && b.Map.addInitHook(function () {
  4241. b.DomEvent.on(this._mapPane, b.DomUtil.TRANSITION_END, this._catchTransitionEnd, this)
  4242. });
  4243. b.Map.include(!b.DomUtil.TRANSITION ? {} : {
  4244. _zoomToIfClose: function (a, c) {
  4245. if (this._animatingZoom) return !0;
  4246. if (!this.options.zoomAnimation) return !1;
  4247. var e = this.getZoomScale(c),
  4248. d = this._getCenterOffset(a)._divideBy(1 - 1 / e);
  4249. if (!this._offsetIsWithinView(d,
  4250. 1)) return !1;
  4251. b.DomUtil.addClass(this._mapPane, "leaflet-zoom-anim");
  4252. this.fire("movestart").fire("zoomstart");
  4253. this.fire("zoomanim", {
  4254. center: a,
  4255. zoom: c
  4256. });
  4257. d = this._getCenterLayerPoint().add(d);
  4258. this._prepareTileBg();
  4259. this._runAnimation(a, c, e, d);
  4260. return !0
  4261. },
  4262. _catchTransitionEnd: function () {
  4263. this._animatingZoom && this._onZoomTransitionEnd()
  4264. },
  4265. _runAnimation: function (a, c, e, d, f) {
  4266. this._animateToCenter = a;
  4267. this._animateToZoom = c;
  4268. this._animatingZoom = !0;
  4269. if (b.Draggable) b.Draggable._disabled = !0;
  4270. a = b.DomUtil.TRANSFORM;
  4271. c = this._tileBg;
  4272. clearTimeout(this._clearTileBgTimer);
  4273. b.Util.falseFn(c.offsetWidth);
  4274. e = b.DomUtil.getScaleString(e, d);
  4275. d = c.style[a];
  4276. c.style[a] = f ? d + " " + e : e + " " + d
  4277. },
  4278. _prepareTileBg: function () {
  4279. var a = this._tilePane,
  4280. c = this._tileBg;
  4281. if (c && 0.5 < this._getLoadedTilesPercentage(c) && 0.5 > this._getLoadedTilesPercentage(a)) a.style.visibility = "hidden", a.empty = !0;
  4282. else {
  4283. if (!c) c = this._tileBg = this._createPane("leaflet-tile-pane", this._mapPane), c.style.zIndex = 1;
  4284. c.style[b.DomUtil.TRANSFORM] = "";
  4285. c.style.visibility = "hidden";
  4286. c.empty = !0;
  4287. a.empty = !1;
  4288. this._tilePane = this._panes.tilePane = c;
  4289. a = this._tileBg = a;
  4290. b.DomUtil.addClass(a, "leaflet-zoom-animated")
  4291. }
  4292. this._stopLoadingImages(a)
  4293. },
  4294. _getLoadedTilesPercentage: function (a) {
  4295. var a = a.getElementsByTagName("img"),
  4296. b, e, d = 0;
  4297. for (b = 0, e = a.length; b < e; b++) a[b].complete && d++;
  4298. return d / e
  4299. },
  4300. _stopLoadingImages: function (a) {
  4301. var a = Array.prototype.slice.call(a.getElementsByTagName("img")),
  4302. c, e, d;
  4303. for (c = 0, e = a.length; c < e; c++)
  4304. 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)
  4305. },
  4306. _onZoomTransitionEnd: function () {
  4307. this._restoreTileFront();
  4308. b.DomUtil.removeClass(this._mapPane, "leaflet-zoom-anim");
  4309. b.Util.falseFn(this._tileBg.offsetWidth);
  4310. this._animatingZoom = !1;
  4311. this._resetView(this._animateToCenter, this._animateToZoom, !0, !0);
  4312. if (b.Draggable) b.Draggable._disabled = !1
  4313. },
  4314. _restoreTileFront: function () {
  4315. this._tilePane.innerHTML = "";
  4316. this._tilePane.style.visibility = "";
  4317. this._tilePane.style.zIndex = 2;
  4318. this._tileBg.style.zIndex = 1
  4319. },
  4320. _clearTileBg: function () {
  4321. if (!this._animatingZoom && !this.touchZoom._zooming) this._tileBg.innerHTML =
  4322. ""
  4323. }
  4324. });
  4325. b.Map.include({
  4326. _defaultLocateOptions: {
  4327. watch: !1,
  4328. setView: !1,
  4329. maxZoom: Infinity,
  4330. timeout: 1E4,
  4331. maximumAge: 0,
  4332. enableHighAccuracy: !1
  4333. },
  4334. locate: function (a) {
  4335. a = this._locationOptions = b.extend(this._defaultLocateOptions, a);
  4336. if (!navigator.geolocation) return this._handleGeolocationError({
  4337. code: 0,
  4338. message: "Geolocation not supported."
  4339. }), this;
  4340. var c = b.bind(this._handleGeolocationResponse, this),
  4341. e = b.bind(this._handleGeolocationError, this);
  4342. a.watch ? this._locationWatchId = navigator.geolocation.watchPosition(c, e, a) : navigator.geolocation.getCurrentPosition(c,
  4343. e, a);
  4344. return this
  4345. },
  4346. stopLocate: function () {
  4347. navigator.geolocation && navigator.geolocation.clearWatch(this._locationWatchId);
  4348. return this
  4349. },
  4350. _handleGeolocationError: function (a) {
  4351. var b = a.code,
  4352. a = a.message || (1 === b ? "permission denied" : 2 === b ? "position unavailable" : "timeout");
  4353. this._locationOptions.setView && !this._loaded && this.fitWorld();
  4354. this.fire("locationerror", {
  4355. code: b,
  4356. message: "Geolocation error: " + a + "."
  4357. })
  4358. },
  4359. _handleGeolocationResponse: function (a) {
  4360. var c = 180 * a.coords.accuracy / 4E7,
  4361. e = 2 * c,
  4362. d = a.coords.latitude,
  4363. f = a.coords.longitude,
  4364. g = new b.LatLng(d, f),
  4365. h = new b.LatLng(d - c, f - e),
  4366. c = new b.LatLng(d + c, f + e),
  4367. h = new b.LatLngBounds(h, c),
  4368. c = this._locationOptions;
  4369. c.setView && (c = Math.min(this.getBoundsZoom(h), c.maxZoom), this.setView(g, c));
  4370. this.fire("locationfound", {
  4371. latlng: g,
  4372. bounds: h,
  4373. accuracy: a.coords.accuracy
  4374. })
  4375. }
  4376. })
  4377. })(this, document);
  4378. (function (b) {
  4379. b(function () {
  4380. var e = b.support,
  4381. a;
  4382. a: {
  4383. a = document.createElement("bootstrap");
  4384. var c = {
  4385. WebkitTransition: "webkitTransitionEnd",
  4386. MozTransition: "transitionend",
  4387. OTransition: "oTransitionEnd",
  4388. msTransition: "MSTransitionEnd",
  4389. transition: "transitionend"
  4390. },
  4391. d;
  4392. for (d in c)
  4393. if (void 0 !== a.style[d]) {
  4394. a = c[d];
  4395. break a
  4396. }
  4397. a = void 0
  4398. }
  4399. e.transition = a && {
  4400. end: a
  4401. }
  4402. })
  4403. })(window.jQuery);
  4404. (function (b) {
  4405. var e = function (a) {
  4406. b(a).on("click", '[data-dismiss="alert"]', this.close)
  4407. };
  4408. e.prototype.close = function (a) {
  4409. function c() {
  4410. e.trigger("closed").remove()
  4411. }
  4412. var d = b(this),
  4413. f = d.attr("data-target"),
  4414. e;
  4415. f || (f = (f = d.attr("href")) && f.replace(/.*(?=#[^\s]*$)/, ""));
  4416. e = b(f);
  4417. a && a.preventDefault();
  4418. e.length || (e = d.hasClass("alert") ? d : d.parent());
  4419. e.trigger(a = b.Event("close"));
  4420. a.isDefaultPrevented() || (e.removeClass("in"), b.support.transition && e.hasClass("fade") ? e.on(b.support.transition.end, c) : c())
  4421. };
  4422. b.fn.alert = function (a) {
  4423. return this.each(function () {
  4424. var c =
  4425. b(this),
  4426. d = c.data("alert");
  4427. d || c.data("alert", d = new e(this));
  4428. "string" == typeof a && d[a].call(c)
  4429. })
  4430. };
  4431. b.fn.alert.Constructor = e;
  4432. b(function () {
  4433. b("body").on("click.alert.data-api", '[data-dismiss="alert"]', e.prototype.close)
  4434. })
  4435. })(window.jQuery);
  4436. (function (b) {
  4437. var e = function (a, c) {
  4438. this.$element = b(a);
  4439. this.options = b.extend({}, b.fn.button.defaults, c)
  4440. };
  4441. e.prototype.setState = function (a) {
  4442. var b = this.$element,
  4443. d = b.data(),
  4444. f = b.is("input") ? "val" : "html",
  4445. a = a + "Text";
  4446. d.resetText || b.data("resetText", b[f]());
  4447. b[f](d[a] || this.options[a]);
  4448. setTimeout(function () {
  4449. "loadingText" == a ? b.addClass("disabled").attr("disabled", "disabled") : b.removeClass("disabled").removeAttr("disabled")
  4450. }, 0)
  4451. };
  4452. e.prototype.toggle = function () {
  4453. var a = this.$element.parent('[data-toggle="buttons-radio"]');
  4454. a && a.find(".active").removeClass("active");
  4455. this.$element.toggleClass("active")
  4456. };
  4457. b.fn.button = function (a) {
  4458. return this.each(function () {
  4459. var c = b(this),
  4460. d = c.data("button"),
  4461. f = "object" == typeof a && a;
  4462. d || c.data("button", d = new e(this, f));
  4463. "toggle" == a ? d.toggle() : a && d.setState(a)
  4464. })
  4465. };
  4466. b.fn.button.defaults = {
  4467. loadingText: "loading..."
  4468. };
  4469. b.fn.button.Constructor = e;
  4470. b(function () {
  4471. b("body").on("click.button.data-api", "[data-toggle^=button]", function (a) {
  4472. a = b(a.target);
  4473. a.hasClass("btn") || (a = a.closest(".btn"));
  4474. a.button("toggle")
  4475. })
  4476. })
  4477. })(window.jQuery);
  4478. (function (b) {
  4479. var e = function (a, c) {
  4480. this.$element = b(a);
  4481. this.options = c;
  4482. this.options.slide && this.slide(this.options.slide);
  4483. "hover" == this.options.pause && this.$element.on("mouseenter", b.proxy(this.pause, this)).on("mouseleave", b.proxy(this.cycle, this))
  4484. };
  4485. e.prototype = {
  4486. cycle: function (a) {
  4487. if (!a) this.paused = !1;
  4488. this.options.interval && !this.paused && (this.interval = setInterval(b.proxy(this.next, this), this.options.interval));
  4489. return this
  4490. },
  4491. to: function (a) {
  4492. var c = this.$element.find(".active"),
  4493. d = c.parent().children(),
  4494. c = d.index(c),
  4495. f = this;
  4496. if (!(a > d.length - 1 || 0 > a)) return this.sliding ? this.$element.one("slid", function () {
  4497. f.to(a)
  4498. }) : c == a ? this.pause().cycle() : this.slide(a > c ? "next" : "prev", b(d[a]))
  4499. },
  4500. pause: function (a) {
  4501. if (!a) this.paused = !0;
  4502. clearInterval(this.interval);
  4503. this.interval = null;
  4504. return this
  4505. },
  4506. next: function () {
  4507. return this.sliding ? void 0 : this.slide("next")
  4508. },
  4509. prev: function () {
  4510. return this.sliding ? void 0 : this.slide("prev")
  4511. },
  4512. slide: function (a, c) {
  4513. var d = this.$element.find(".active"),
  4514. f = c || d[a](),
  4515. e = this.interval,
  4516. g = "next" == a ? "left" : "right",
  4517. i =
  4518. "next" == a ? "first" : "last",
  4519. k = this,
  4520. j = b.Event("slide");
  4521. this.sliding = !0;
  4522. e && this.pause();
  4523. f = f.length ? f : this.$element.find(".item")[i]();
  4524. if (!f.hasClass("active")) {
  4525. if (b.support.transition && this.$element.hasClass("slide")) {
  4526. this.$element.trigger(j);
  4527. if (j.isDefaultPrevented()) return;
  4528. f.addClass(a);
  4529. d.addClass(g);
  4530. f.addClass(g);
  4531. this.$element.one(b.support.transition.end, function () {
  4532. f.removeClass([a, g].join(" ")).addClass("active");
  4533. d.removeClass(["active", g].join(" "));
  4534. k.sliding = !1;
  4535. setTimeout(function () {
  4536. k.$element.trigger("slid")
  4537. },
  4538. 0)
  4539. })
  4540. } else {
  4541. this.$element.trigger(j);
  4542. if (j.isDefaultPrevented()) return;
  4543. d.removeClass("active");
  4544. f.addClass("active");
  4545. this.sliding = !1;
  4546. this.$element.trigger("slid")
  4547. }
  4548. e && this.cycle();
  4549. return this
  4550. }
  4551. }
  4552. };
  4553. b.fn.carousel = function (a) {
  4554. return this.each(function () {
  4555. var c = b(this),
  4556. d = c.data("carousel"),
  4557. f = b.extend({}, b.fn.carousel.defaults, "object" == typeof a && a);
  4558. d || c.data("carousel", d = new e(this, f));
  4559. if ("number" == typeof a) d.to(a);
  4560. else if ("string" == typeof a || (a = f.slide)) d[a]();
  4561. else f.interval && d.cycle()
  4562. })
  4563. };
  4564. b.fn.carousel.defaults = {
  4565. interval: 5E3,
  4566. pause: "hover"
  4567. };
  4568. b.fn.carousel.Constructor = e;
  4569. b(function () {
  4570. b("body").on("click.carousel.data-api", "[data-slide]", function (a) {
  4571. var c = b(this),
  4572. d, f = b(c.attr("data-target") || (d = c.attr("href")) && d.replace(/.*(?=#[^\s]+$)/, "")),
  4573. c = !f.data("modal") && b.extend({}, f.data(), c.data());
  4574. f.carousel(c);
  4575. a.preventDefault()
  4576. })
  4577. })
  4578. })(window.jQuery);
  4579. (function (b) {
  4580. var e = function (a, c) {
  4581. this.$element = b(a);
  4582. this.options = b.extend({}, b.fn.collapse.defaults, c);
  4583. if (this.options.parent) this.$parent = b(this.options.parent);
  4584. this.options.toggle && this.toggle()
  4585. };
  4586. e.prototype = {
  4587. constructor: e,
  4588. dimension: function () {
  4589. return this.$element.hasClass("width") ? "width" : "height"
  4590. },
  4591. show: function () {
  4592. var a, c, d, f;
  4593. if (!this.transitioning) {
  4594. a = this.dimension();
  4595. c = b.camelCase(["scroll", a].join("-"));
  4596. if ((d = this.$parent && this.$parent.find("> .accordion-group > .in")) && d.length) {
  4597. if ((f = d.data("collapse")) &&
  4598. f.transitioning) return;
  4599. d.collapse("hide");
  4600. f || d.data("collapse", null)
  4601. }
  4602. this.$element[a](0);
  4603. this.transition("addClass", b.Event("show"), "shown");
  4604. this.$element[a](this.$element[0][c])
  4605. }
  4606. },
  4607. hide: function () {
  4608. var a;
  4609. this.transitioning || (a = this.dimension(), this.reset(this.$element[a]()), this.transition("removeClass", b.Event("hide"), "hidden"), this.$element[a](0))
  4610. },
  4611. reset: function (a) {
  4612. var b = this.dimension();
  4613. this.$element.removeClass("collapse")[b](a || "auto");
  4614. this.$element[null !== a ? "addClass" : "removeClass"]("collapse");
  4615. return this
  4616. },
  4617. transition: function (a, c, d) {
  4618. var f = this,
  4619. e = function () {
  4620. "show" == c.type && f.reset();
  4621. f.transitioning = 0;
  4622. f.$element.trigger(d)
  4623. };
  4624. this.$element.trigger(c);
  4625. 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()
  4626. },
  4627. toggle: function () {
  4628. this[this.$element.hasClass("in") ? "hide" : "show"]()
  4629. }
  4630. };
  4631. b.fn.collapse = function (a) {
  4632. return this.each(function () {
  4633. var c = b(this),
  4634. d = c.data("collapse"),
  4635. f = "object" ==
  4636. typeof a && a;
  4637. d || c.data("collapse", d = new e(this, f));
  4638. if ("string" == typeof a) d[a]()
  4639. })
  4640. };
  4641. b.fn.collapse.defaults = {
  4642. toggle: !0
  4643. };
  4644. b.fn.collapse.Constructor = e;
  4645. b(function () {
  4646. b("body").on("click.collapse.data-api", "[data-toggle=collapse]", function (a) {
  4647. var c = b(this),
  4648. d, a = c.attr("data-target") || a.preventDefault() || (d = c.attr("href")) && d.replace(/.*(?=#[^\s]+$)/, ""),
  4649. c = b(a).data("collapse") ? "toggle" : c.data();
  4650. b(a).collapse(c)
  4651. })
  4652. })
  4653. })(window.jQuery);
  4654. (function (b) {
  4655. function e() {
  4656. b(a).parent().removeClass("open")
  4657. }
  4658. var a = '[data-toggle="dropdown"]',
  4659. c = function (a) {
  4660. var c = b(a).on("click.dropdown.data-api", this.toggle);
  4661. b("html").on("click.dropdown.data-api", function () {
  4662. c.parent().removeClass("open")
  4663. })
  4664. };
  4665. c.prototype = {
  4666. constructor: c,
  4667. toggle: function () {
  4668. var a = b(this),
  4669. c;
  4670. 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
  4671. }
  4672. };
  4673. b.fn.dropdown = function (a) {
  4674. return this.each(function () {
  4675. var f = b(this),
  4676. e = f.data("dropdown");
  4677. e || f.data("dropdown", e = new c(this));
  4678. "string" == typeof a && e[a].call(f)
  4679. })
  4680. };
  4681. b.fn.dropdown.Constructor = c;
  4682. b(function () {
  4683. b("html").on("click.dropdown.data-api", e);
  4684. b("body").on("click.dropdown", ".dropdown form", function (a) {
  4685. a.stopPropagation()
  4686. }).on("click.dropdown.data-api", a, c.prototype.toggle)
  4687. })
  4688. })(window.jQuery);
  4689. (function (b) {
  4690. function e() {
  4691. var c = this,
  4692. d = setTimeout(function () {
  4693. c.$element.off(b.support.transition.end);
  4694. a.call(c)
  4695. }, 500);
  4696. this.$element.one(b.support.transition.end, function () {
  4697. clearTimeout(d);
  4698. a.call(c)
  4699. })
  4700. }
  4701. function a() {
  4702. this.$element.hide().trigger("hidden");
  4703. c.call(this)
  4704. }
  4705. function c(a) {
  4706. var c = this.$element.hasClass("fade") ? "fade" : "";
  4707. if (this.isShown && this.options.backdrop) {
  4708. var f = b.support.transition && c;
  4709. this.$backdrop = b('<div class="modal-backdrop ' + c + '" />').appendTo(document.body);
  4710. "static" != this.options.backdrop &&
  4711. this.$backdrop.click(b.proxy(this.hide, this));
  4712. this.$backdrop.addClass("in");
  4713. f ? this.$backdrop.one(b.support.transition.end, a) : a()
  4714. } 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()
  4715. }
  4716. function d() {
  4717. this.$backdrop.remove();
  4718. this.$backdrop = null
  4719. }
  4720. function f() {
  4721. var a = this;
  4722. if (this.isShown && this.options.keyboard) b(document).on("keyup.dismiss.modal", function (b) {
  4723. 27 ==
  4724. b.which && a.hide()
  4725. });
  4726. else this.isShown || b(document).off("keyup.dismiss.modal")
  4727. }
  4728. var h = function (a, c) {
  4729. this.options = c;
  4730. this.$element = b(a).delegate('[data-dismiss="modal"]', "click.dismiss.modal", b.proxy(this.hide, this))
  4731. };
  4732. h.prototype = {
  4733. constructor: h,
  4734. toggle: function () {
  4735. return this[!this.isShown ? "show" : "hide"]()
  4736. },
  4737. show: function () {
  4738. var a = this,
  4739. d = b.Event("show");
  4740. this.$element.trigger(d);
  4741. if (!this.isShown && !d.isDefaultPrevented()) b("body").addClass("modal-open"), this.isShown = !0, f.call(this), c.call(this, function () {
  4742. var c =
  4743. b.support.transition && a.$element.hasClass("fade");
  4744. a.$element.parent().length || a.$element.appendTo(document.body);
  4745. a.$element.show();
  4746. a.$element.addClass("in");
  4747. c ? a.$element.one(b.support.transition.end, function () {
  4748. a.$element.trigger("shown")
  4749. }) : a.$element.trigger("shown")
  4750. })
  4751. },
  4752. hide: function (c) {
  4753. c && c.preventDefault();
  4754. c = b.Event("hide");
  4755. this.$element.trigger(c);
  4756. if (this.isShown && !c.isDefaultPrevented()) this.isShown = !1, b("body").removeClass("modal-open"), f.call(this), this.$element.removeClass("in"), b.support.transition &&
  4757. this.$element.hasClass("fade") ? e.call(this) : a.call(this)
  4758. }
  4759. };
  4760. b.fn.modal = function (a) {
  4761. return this.each(function () {
  4762. var c = b(this),
  4763. d = c.data("modal"),
  4764. f = b.extend({}, b.fn.modal.defaults, c.data(), "object" == typeof a && a);
  4765. d || c.data("modal", d = new h(this, f));
  4766. if ("string" == typeof a) d[a]();
  4767. else f.show && d.show()
  4768. })
  4769. };
  4770. b.fn.modal.defaults = {
  4771. backdrop: !0,
  4772. keyboard: !0,
  4773. show: !0
  4774. };
  4775. b.fn.modal.Constructor = h;
  4776. b(function () {
  4777. b("body").on("click.modal.data-api", '[data-toggle="modal"]', function (a) {
  4778. var c = b(this),
  4779. d, f = b(c.attr("data-target") ||
  4780. (d = c.attr("href")) && d.replace(/.*(?=#[^\s]+$)/, "")),
  4781. c = f.data("modal") ? "toggle" : b.extend({}, f.data(), c.data());
  4782. a.preventDefault();
  4783. f.modal(c)
  4784. })
  4785. })
  4786. })(window.jQuery);
  4787. (function (b) {
  4788. var e = function (a, b) {
  4789. this.init("tooltip", a, b)
  4790. };
  4791. e.prototype = {
  4792. constructor: e,
  4793. init: function (a, c, d) {
  4794. this.type = a;
  4795. this.$element = b(c);
  4796. this.options = this.getOptions(d);
  4797. this.enabled = !0;
  4798. "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)));
  4799. this.options.selector ? this._options = b.extend({},
  4800. this.options, {
  4801. trigger: "manual",
  4802. selector: ""
  4803. }) : this.fixTitle()
  4804. },
  4805. getOptions: function (a) {
  4806. a = b.extend({}, b.fn[this.type].defaults, a, this.$element.data());
  4807. if (a.delay && "number" == typeof a.delay) a.delay = {
  4808. show: a.delay,
  4809. hide: a.delay
  4810. };
  4811. return a
  4812. },
  4813. enter: function (a) {
  4814. var c = b(a.currentTarget)[this.type](this._options).data(this.type);
  4815. if (!c.options.delay || !c.options.delay.show) return c.show();
  4816. clearTimeout(this.timeout);
  4817. c.hoverState = "in";
  4818. this.timeout = setTimeout(function () {
  4819. "in" == c.hoverState && c.show()
  4820. }, c.options.delay.show)
  4821. },
  4822. leave: function (a) {
  4823. var c = b(a.currentTarget)[this.type](this._options).data(this.type);
  4824. if (!c.options.delay || !c.options.delay.hide) return c.hide();
  4825. clearTimeout(this.timeout);
  4826. c.hoverState = "out";
  4827. this.timeout = setTimeout(function () {
  4828. "out" == c.hoverState && c.hide()
  4829. }, c.options.delay.hide)
  4830. },
  4831. show: function () {
  4832. var a, b, d, f, e, g, i;
  4833. if (this.hasContent() && this.enabled) {
  4834. a = this.tip();
  4835. this.setContent();
  4836. this.options.animation && a.addClass("fade");
  4837. g = "function" == typeof this.options.placement ? this.options.placement.call(this, a[0],
  4838. this.$element[0]) : this.options.placement;
  4839. b = /in/.test(g);
  4840. a.remove().css({
  4841. top: 0,
  4842. left: 0,
  4843. display: "block"
  4844. }).appendTo(b ? this.$element : document.body);
  4845. d = this.getPosition(b);
  4846. f = a[0].offsetWidth;
  4847. e = a[0].offsetHeight;
  4848. switch (b ? g.split(" ")[1] : g) {
  4849. case "bottom":
  4850. i = {
  4851. top: d.top + d.height,
  4852. left: d.left + d.width / 2 - f / 2
  4853. };
  4854. break;
  4855. case "top":
  4856. i = {
  4857. top: d.top - e,
  4858. left: d.left + d.width / 2 - f / 2
  4859. };
  4860. break;
  4861. case "left":
  4862. i = {
  4863. top: d.top + d.height / 2 - e / 2,
  4864. left: d.left - f
  4865. };
  4866. break;
  4867. case "right":
  4868. i = {
  4869. top: d.top + d.height / 2 - e / 2,
  4870. left: d.left + d.width
  4871. }
  4872. }
  4873. a.css(i).addClass(g).addClass("in")
  4874. }
  4875. },
  4876. isHTML: function (a) {
  4877. return "string" != typeof a || "<" === a.charAt(0) && ">" === a.charAt(a.length - 1) && 3 <= a.length || /^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(a)
  4878. },
  4879. setContent: function () {
  4880. var a = this.tip(),
  4881. b = this.getTitle();
  4882. a.find(".tooltip-inner")[this.isHTML(b) ? "html" : "text"](b);
  4883. a.removeClass("fade in top bottom left right")
  4884. },
  4885. hide: function () {
  4886. function a() {
  4887. var a = setTimeout(function () {
  4888. c.off(b.support.transition.end).remove()
  4889. }, 500);
  4890. c.one(b.support.transition.end, function () {
  4891. clearTimeout(a);
  4892. c.remove()
  4893. })
  4894. }
  4895. var c = this.tip();
  4896. c.removeClass("in");
  4897. b.support.transition && this.$tip.hasClass("fade") ? a() : c.remove()
  4898. },
  4899. fixTitle: function () {
  4900. var a = this.$element;
  4901. if (a.attr("title") || "string" != typeof a.attr("data-original-title")) a.attr("data-original-title", a.attr("title") || "").removeAttr("title")
  4902. },
  4903. hasContent: function () {
  4904. return this.getTitle()
  4905. },
  4906. getPosition: function (a) {
  4907. return b.extend({}, a ? {
  4908. top: 0,
  4909. left: 0
  4910. } : this.$element.offset(), {
  4911. width: this.$element[0].offsetWidth,
  4912. height: this.$element[0].offsetHeight
  4913. })
  4914. },
  4915. getTitle: function () {
  4916. var a = this.$element,
  4917. b = this.options;
  4918. return a.attr("data-original-title") || ("function" == typeof b.title ? b.title.call(a[0]) : b.title)
  4919. },
  4920. tip: function () {
  4921. return this.$tip = this.$tip || b(this.options.template)
  4922. },
  4923. validate: function () {
  4924. if (!this.$element[0].parentNode) this.hide(), this.options = this.$element = null
  4925. },
  4926. enable: function () {
  4927. this.enabled = !0
  4928. },
  4929. disable: function () {
  4930. this.enabled = !1
  4931. },
  4932. toggleEnabled: function () {
  4933. this.enabled = !this.enabled
  4934. },
  4935. toggle: function () {
  4936. this[this.tip().hasClass("in") ? "hide" : "show"]()
  4937. }
  4938. };
  4939. b.fn.tooltip = function (a) {
  4940. return this.each(function () {
  4941. var c =
  4942. b(this),
  4943. d = c.data("tooltip"),
  4944. f = "object" == typeof a && a;
  4945. d || c.data("tooltip", d = new e(this, f));
  4946. if ("string" == typeof a) d[a]()
  4947. })
  4948. };
  4949. b.fn.tooltip.Constructor = e;
  4950. b.fn.tooltip.defaults = {
  4951. animation: !0,
  4952. placement: "top",
  4953. selector: !1,
  4954. template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
  4955. trigger: "hover",
  4956. title: "",
  4957. delay: 0
  4958. }
  4959. })(window.jQuery);
  4960. (function (b) {
  4961. var e = function (a, b) {
  4962. this.init("popover", a, b)
  4963. };
  4964. e.prototype = b.extend({}, b.fn.tooltip.Constructor.prototype, {
  4965. constructor: e,
  4966. setContent: function () {
  4967. var a = this.tip(),
  4968. b = this.getTitle(),
  4969. d = this.getContent();
  4970. a.find(".popover-title")[this.isHTML(b) ? "html" : "text"](b);
  4971. a.find(".popover-content > *")[this.isHTML(d) ? "html" : "text"](d);
  4972. a.removeClass("fade top bottom left right in")
  4973. },
  4974. hasContent: function () {
  4975. return this.getTitle() || this.getContent()
  4976. },
  4977. getContent: function () {
  4978. var a = this.$element,
  4979. b = this.options;
  4980. return a.attr("data-content") || ("function" == typeof b.content ? b.content.call(a[0]) : b.content)
  4981. },
  4982. tip: function () {
  4983. if (!this.$tip) this.$tip = b(this.options.template);
  4984. return this.$tip
  4985. }
  4986. });
  4987. b.fn.popover = function (a) {
  4988. return this.each(function () {
  4989. var c = b(this),
  4990. d = c.data("popover"),
  4991. f = "object" == typeof a && a;
  4992. d || c.data("popover", d = new e(this, f));
  4993. if ("string" == typeof a) d[a]()
  4994. })
  4995. };
  4996. b.fn.popover.Constructor = e;
  4997. b.fn.popover.defaults = b.extend({}, b.fn.tooltip.defaults, {
  4998. placement: "right",
  4999. content: "",
  5000. 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>'
  5001. })
  5002. })(window.jQuery);
  5003. (function (b) {
  5004. function e(a, c) {
  5005. var d = b.proxy(this.process, this),
  5006. f = b(a).is("body") ? b(window) : b(a),
  5007. e;
  5008. this.options = b.extend({}, b.fn.scrollspy.defaults, c);
  5009. this.$scrollElement = f.on("scroll.scroll.data-api", d);
  5010. this.selector = (this.options.target || (e = b(a).attr("href")) && e.replace(/.*(?=#[^\s]+$)/, "") || "") + " .nav li > a";
  5011. this.$body = b("body");
  5012. this.refresh();
  5013. this.process()
  5014. }
  5015. e.prototype = {
  5016. constructor: e,
  5017. refresh: function () {
  5018. var a = this;
  5019. this.offsets = b([]);
  5020. this.targets = b([]);
  5021. this.$body.find(this.selector).map(function () {
  5022. var a =
  5023. b(this),
  5024. a = a.data("target") || a.attr("href"),
  5025. d = /^#\w/.test(a) && b(a);
  5026. return d && a.length && [
  5027. [d.position().top, a]
  5028. ] || null
  5029. }).sort(function (a, b) {
  5030. return a[0] - b[0]
  5031. }).each(function () {
  5032. a.offsets.push(this[0]);
  5033. a.targets.push(this[1])
  5034. })
  5035. },
  5036. process: function () {
  5037. var a = this.$scrollElement.scrollTop() + this.options.offset,
  5038. b = (this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight) - this.$scrollElement.height(),
  5039. d = this.offsets,
  5040. f = this.targets,
  5041. e = this.activeTarget,
  5042. g;
  5043. if (a >= b) return e != (g = f.last()[0]) && this.activate(g);
  5044. for (g =
  5045. d.length; g--;) e != f[g] && a >= d[g] && (!d[g + 1] || a <= d[g + 1]) && this.activate(f[g])
  5046. },
  5047. activate: function (a) {
  5048. this.activeTarget = a;
  5049. b(this.selector).parent(".active").removeClass("active");
  5050. a = b(this.selector + '[data-target="' + a + '"],' + this.selector + '[href="' + a + '"]').parent("li").addClass("active");
  5051. a.parent(".dropdown-menu") && (a = a.closest("li.dropdown").addClass("active"));
  5052. a.trigger("activate")
  5053. }
  5054. };
  5055. b.fn.scrollspy = function (a) {
  5056. return this.each(function () {
  5057. var c = b(this),
  5058. d = c.data("scrollspy"),
  5059. f = "object" == typeof a && a;
  5060. d || c.data("scrollspy",
  5061. d = new e(this, f));
  5062. if ("string" == typeof a) d[a]()
  5063. })
  5064. };
  5065. b.fn.scrollspy.Constructor = e;
  5066. b.fn.scrollspy.defaults = {
  5067. offset: 10
  5068. };
  5069. b(function () {
  5070. b('[data-spy="scroll"]').each(function () {
  5071. var a = b(this);
  5072. a.scrollspy(a.data())
  5073. })
  5074. })
  5075. })(window.jQuery);
  5076. (function (b) {
  5077. var e = function (a) {
  5078. this.element = b(a)
  5079. };
  5080. e.prototype = {
  5081. constructor: e,
  5082. show: function () {
  5083. var a = this.element,
  5084. c = a.closest("ul:not(.dropdown-menu)"),
  5085. d = a.attr("data-target"),
  5086. f, e;
  5087. d || (d = (d = a.attr("href")) && d.replace(/.*(?=#[^\s]*$)/, ""));
  5088. a.parent("li").hasClass("active") || (f = c.find(".active a").last()[0], e = b.Event("show", {
  5089. relatedTarget: f
  5090. }), a.trigger(e), e.isDefaultPrevented() || (d = b(d), this.activate(a.parent("li"), c), this.activate(d, d.parent(), function () {
  5091. a.trigger({
  5092. type: "shown",
  5093. relatedTarget: f
  5094. })
  5095. })))
  5096. },
  5097. activate: function (a, c, d) {
  5098. function f() {
  5099. e.removeClass("active").find("> .dropdown-menu > .active").removeClass("active");
  5100. a.addClass("active");
  5101. g ? a.addClass("in") : a.removeClass("fade");
  5102. a.parent(".dropdown-menu") && a.closest("li.dropdown").addClass("active");
  5103. d && d()
  5104. }
  5105. var e = c.find("> .active"),
  5106. g = d && b.support.transition && e.hasClass("fade");
  5107. g ? e.one(b.support.transition.end, f) : f();
  5108. e.removeClass("in")
  5109. }
  5110. };
  5111. b.fn.tab = function (a) {
  5112. return this.each(function () {
  5113. var c = b(this),
  5114. d = c.data("tab");
  5115. d || c.data("tab", d = new e(this));
  5116. if ("string" == typeof a) d[a]()
  5117. })
  5118. };
  5119. b.fn.tab.Constructor = e;
  5120. b(function () {
  5121. b("body").on("click.tab.data-api", '[data-toggle="tab"], [data-toggle="pill"]', function (a) {
  5122. a.preventDefault();
  5123. b(this).tab("show")
  5124. })
  5125. })
  5126. })(window.jQuery);
  5127. (function (b) {
  5128. var e = function (a, c) {
  5129. this.$element = b(a);
  5130. this.options = b.extend({}, b.fn.typeahead.defaults, c);
  5131. this.matcher = this.options.matcher || this.matcher;
  5132. this.sorter = this.options.sorter || this.sorter;
  5133. this.highlighter = this.options.highlighter || this.highlighter;
  5134. this.updater = this.options.updater || this.updater;
  5135. this.$menu = b(this.options.menu).appendTo("body");
  5136. this.source = this.options.source;
  5137. this.shown = !1;
  5138. this.listen()
  5139. };
  5140. e.prototype = {
  5141. constructor: e,
  5142. select: function () {
  5143. this.$element.val(this.updater(this.$menu.find(".active").attr("data-value"))).change();
  5144. return this.hide()
  5145. },
  5146. updater: function (a) {
  5147. return a
  5148. },
  5149. show: function () {
  5150. var a = b.extend({}, this.$element.offset(), {
  5151. height: this.$element[0].offsetHeight
  5152. });
  5153. this.$menu.css({
  5154. top: a.top + a.height,
  5155. left: a.left
  5156. });
  5157. this.$menu.show();
  5158. this.shown = !0;
  5159. return this
  5160. },
  5161. hide: function () {
  5162. this.$menu.hide();
  5163. this.shown = !1;
  5164. return this
  5165. },
  5166. lookup: function () {
  5167. var a = this,
  5168. c;
  5169. this.query = this.$element.val();
  5170. if (!this.query) return this.shown ? this.hide() : this;
  5171. c = b.grep(this.source, function (b) {
  5172. return a.matcher(b)
  5173. });
  5174. c = this.sorter(c);
  5175. return !c.length ?
  5176. this.shown ? this.hide() : this : this.render(c.slice(0, this.options.items)).show()
  5177. },
  5178. matcher: function (a) {
  5179. return ~a.toLowerCase().indexOf(this.query.toLowerCase())
  5180. },
  5181. sorter: function (a) {
  5182. 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);
  5183. return b.concat(d, e)
  5184. },
  5185. highlighter: function (a) {
  5186. var b = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
  5187. return a.replace(RegExp("(" + b + ")", "ig"), function (a, b) {
  5188. return "<strong>" + b + "</strong>"
  5189. })
  5190. },
  5191. render: function (a) {
  5192. var c = this,
  5193. a = b(a).map(function (a, e) {
  5194. a = b(c.options.item).attr("data-value", e);
  5195. a.find("a").html(c.highlighter(e));
  5196. return a[0]
  5197. });
  5198. a.first().addClass("active");
  5199. this.$menu.html(a);
  5200. return this
  5201. },
  5202. next: function () {
  5203. var a = this.$menu.find(".active").removeClass("active").next();
  5204. a.length || (a = b(this.$menu.find("li")[0]));
  5205. a.addClass("active")
  5206. },
  5207. prev: function () {
  5208. var a = this.$menu.find(".active").removeClass("active").prev();
  5209. a.length || (a = this.$menu.find("li").last());
  5210. a.addClass("active")
  5211. },
  5212. listen: function () {
  5213. this.$element.on("blur",
  5214. b.proxy(this.blur, this)).on("keypress", b.proxy(this.keypress, this)).on("keyup", b.proxy(this.keyup, this));
  5215. if (b.browser.webkit || b.browser.msie) this.$element.on("keydown", b.proxy(this.keypress, this));
  5216. this.$menu.on("click", b.proxy(this.click, this)).on("mouseenter", "li", b.proxy(this.mouseenter, this))
  5217. },
  5218. keyup: function (a) {
  5219. switch (a.keyCode) {
  5220. case 40:
  5221. case 38:
  5222. break;
  5223. case 9:
  5224. case 13:
  5225. if (!this.shown) return;
  5226. this.select();
  5227. break;
  5228. case 27:
  5229. if (!this.shown) return;
  5230. this.hide();
  5231. break;
  5232. default:
  5233. this.lookup()
  5234. }
  5235. a.stopPropagation();
  5236. a.preventDefault()
  5237. },
  5238. keypress: function (a) {
  5239. if (this.shown) {
  5240. switch (a.keyCode) {
  5241. case 9:
  5242. case 13:
  5243. case 27:
  5244. a.preventDefault();
  5245. break;
  5246. case 38:
  5247. if ("keydown" != a.type) break;
  5248. a.preventDefault();
  5249. this.prev();
  5250. break;
  5251. case 40:
  5252. if ("keydown" != a.type) break;
  5253. a.preventDefault();
  5254. this.next()
  5255. }
  5256. a.stopPropagation()
  5257. }
  5258. },
  5259. blur: function () {
  5260. var a = this;
  5261. setTimeout(function () {
  5262. a.hide()
  5263. }, 150)
  5264. },
  5265. click: function (a) {
  5266. a.stopPropagation();
  5267. a.preventDefault();
  5268. this.select()
  5269. },
  5270. mouseenter: function (a) {
  5271. this.$menu.find(".active").removeClass("active");
  5272. b(a.currentTarget).addClass("active")
  5273. }
  5274. };
  5275. b.fn.typeahead = function (a) {
  5276. return this.each(function () {
  5277. var c = b(this),
  5278. d = c.data("typeahead"),
  5279. f = "object" == typeof a && a;
  5280. d || c.data("typeahead", d = new e(this, f));
  5281. if ("string" == typeof a) d[a]()
  5282. })
  5283. };
  5284. b.fn.typeahead.defaults = {
  5285. source: [],
  5286. items: 8,
  5287. menu: '<ul class="typeahead dropdown-menu"></ul>',
  5288. item: '<li><a href="#"></a></li>'
  5289. };
  5290. b.fn.typeahead.Constructor = e;
  5291. b(function () {
  5292. b("body").on("focus.typeahead.data-api", '[data-provide="typeahead"]', function (a) {
  5293. var c = b(this);
  5294. c.data("typeahead") || (a.preventDefault(), c.typeahead(c.data()))
  5295. })
  5296. })
  5297. })(window.jQuery);
  5298. var topSpacer = 0,
  5299. updateMapContainerHeight = function () {
  5300. var a = jQuery(window).height() - topSpacer;
  5301. jQuery(".mapMainContainer").height(a);
  5302. jQuery(".mapContainer").height(a);
  5303. jQuery(".rightContainer").height(a)
  5304. };
  5305. jQuery(document).ready(function () {
  5306. topSpacer = (jQuery("#header-nav").hasClass("fixed") ? jQuery("#header-nav").height() : jQuery("#ign-header").height()) + jQuery(".breadcrumb-inverted").height();
  5307. updateMapContainerHeight();
  5308. jQuery(window).resize(function () {
  5309. updateMapContainerHeight()
  5310. });
  5311. jQuery(".embed-link").click(function (a) {
  5312. var b = jQuery(this).data("popup");
  5313. jQuery("#" + b).show();
  5314. a.preventDefault();
  5315. a.stopPropagation()
  5316. });
  5317. jQuery("#close-comment-link").click(function (a) {
  5318. jQuery(".comment-overlay").hide();
  5319. a.preventDefault();
  5320. a.stopPropagation()
  5321. });
  5322. jQuery(".show-comments").click(function (a) {
  5323. jQuery(".comment-overlay").show();
  5324. a.preventDefault();
  5325. a.stopPropagation()
  5326. });
  5327. jQuery(".close-button").click(function (a) {
  5328. jQuery(this).parent(".share-popup").hide();
  5329. a.preventDefault();
  5330. a.stopPropagation()
  5331. });
  5332. jQuery("#comment-socialLogin").click(function () {
  5333. jQuery(".comment-overlay").hide()
  5334. });
  5335. jQuery(".expandable-container a.toggle").click(function (a) {
  5336. var b = jQuery(this).next(".expandable-list");
  5337. b.is(":visible") ? (b.stop().slideUp("fast"), jQuery(this).removeClass("contract")) :
  5338. (b.stop().slideDown("fast"), jQuery(this).addClass("contract"));
  5339. a.preventDefault();
  5340. a.stopPropagation()
  5341. });
  5342. jQuery(".map-embed-code").click(function () {
  5343. jQuery(this).focus();
  5344. jQuery(this).select()
  5345. })
  5346. });
  5347. (function () {
  5348. L.MarkerClusterGroup = L.FeatureGroup.extend({
  5349. options: {
  5350. maxClusterRadius: 80,
  5351. iconCreateFunction: null,
  5352. spiderfyOnMaxZoom: !0,
  5353. showCoverageOnHover: !0,
  5354. zoomToBoundsOnClick: !0,
  5355. singleMarkerMode: !1,
  5356. disableClusteringAtZoom: null,
  5357. skipDuplicateAddTesting: !1,
  5358. animateAddingMarkers: !1,
  5359. polygonOptions: {}
  5360. },
  5361. initialize: function (a) {
  5362. L.Util.setOptions(this, a);
  5363. if (!this.options.iconCreateFunction) this.options.iconCreateFunction = this._defaultIconCreateFunction;
  5364. L.FeatureGroup.prototype.initialize.call(this, []);
  5365. this._inZoomAnimation =
  5366. 0;
  5367. this._needsClustering = [];
  5368. this._currentShownBounds = null
  5369. },
  5370. addLayer: function (a) {
  5371. if (a instanceof L.LayerGroup) {
  5372. for (var b in a._layers) a._layers.hasOwnProperty(b) && this.addLayer(a._layers[b]);
  5373. return this
  5374. }
  5375. if (this.options.singleMarkerMode) a.options.icon = this.options.iconCreateFunction({
  5376. getChildCount: function () {
  5377. return 1
  5378. },
  5379. getAllChildMarkers: function () {
  5380. return [a]
  5381. }
  5382. });
  5383. if (!this._map) return this._needsClustering.push(a), this;
  5384. if (!this.options.skipDuplicateAddTesting && this.hasLayer(a)) return this;
  5385. this._unspiderfy &&
  5386. this._unspiderfy();
  5387. this._addLayer(a, this._maxZoom);
  5388. b = a;
  5389. var d = this._map.getZoom();
  5390. if (a.__parent)
  5391. for (; b.__parent._zoom >= d;) b = b.__parent;
  5392. this._currentShownBounds.contains(b.getLatLng()) && (this.options.animateAddingMarkers ? this._animationAddLayer(a, b) : this._animationAddLayerNonAnimated(a, b));
  5393. return this
  5394. },
  5395. removeLayer: function (a) {
  5396. if (!this._map) return this._arraySplice(this._needsClustering, a), this;
  5397. if (!a.__parent) return this;
  5398. this._unspiderfy && (this._unspiderfy(), this._unspiderfyLayer(a));
  5399. this._removeLayer(a, !0);
  5400. a._icon && (L.FeatureGroup.prototype.removeLayer.call(this, a), a.setOpacity(1));
  5401. return this
  5402. },
  5403. clearLayers: function () {
  5404. if (!this._map) return this._needsClustering = [], this;
  5405. this._unspiderfy && this._unspiderfy();
  5406. for (var a in this._layers) this._layers.hasOwnProperty(a) && L.FeatureGroup.prototype.removeLayer.call(this, this._layers[a]);
  5407. this._generateInitialClusters();
  5408. return this
  5409. },
  5410. hasLayer: function (a) {
  5411. var b = !1;
  5412. this._topClusterLevel._recursively(new L.LatLngBounds([a.getLatLng()]), 0, this._map.getMaxZoom() + 1, function (d) {
  5413. for (var e =
  5414. d._markers.length - 1; 0 <= e && !b; e--) d._markers[e] === a && (b = !0)
  5415. }, null);
  5416. return b
  5417. },
  5418. zoomToShowLayer: function (a, b) {
  5419. var d = function () {
  5420. if ((a._icon || a.__parent._icon) && !this._inZoomAnimation)
  5421. if (this._map.off("moveend", d, this), this.off("animationend", d, this), a._icon) b();
  5422. else if (a.__parent._icon) {
  5423. var e = function () {
  5424. this.off("spiderfied", e, this);
  5425. b()
  5426. };
  5427. this.on("spiderfied", e, this);
  5428. a.__parent.spiderfy()
  5429. }
  5430. };
  5431. a._icon ? b() : a.__parent._zoom < this._map.getZoom() ? (this._map.on("moveend", d, this), a._icon || this._map.panTo(a.getLatLng())) :
  5432. (this._map.on("moveend", d, this), this.on("animationend", d, this), this._map.setView(a.getLatLng(), a.__parent._zoom + 1), a.__parent.zoomToBounds())
  5433. },
  5434. onAdd: function (a) {
  5435. L.FeatureGroup.prototype.onAdd.call(this, a);
  5436. this._gridClusters || this._generateInitialClusters();
  5437. for (var a = 0, b = this._needsClustering.length; a < b; a++) this._addLayer(this._needsClustering[a], this._maxZoom);
  5438. this._needsClustering = [];
  5439. this._map.on("zoomend", this._zoomEnd, this);
  5440. this._map.on("moveend", this._moveEnd, this);
  5441. this._spiderfierOnAdd && this._spiderfierOnAdd();
  5442. this._bindEvents();
  5443. this._zoom = this._map.getZoom();
  5444. this._currentShownBounds = this._getExpandedVisibleBounds();
  5445. this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds)
  5446. },
  5447. onRemove: function (a) {
  5448. this._map.off("zoomend", this._zoomEnd, this);
  5449. this._map.off("moveend", this._moveEnd, this);
  5450. this._map._mapPane.className = this._map._mapPane.className.replace(" leaflet-cluster-anim", "");
  5451. this._spiderfierOnRemove && this._spiderfierOnRemove();
  5452. L.FeatureGroup.prototype.onRemove.call(this,
  5453. a)
  5454. },
  5455. _arraySplice: function (a, b) {
  5456. for (var d = a.length - 1; 0 <= d; d--)
  5457. if (a[d] === b) {
  5458. a.splice(d, 1);
  5459. break
  5460. }
  5461. },
  5462. _removeLayer: function (a, b) {
  5463. var d = this._gridClusters,
  5464. e = this._gridUnclustered,
  5465. g = this._map;
  5466. if (b)
  5467. for (var c = this._maxZoom; 0 <= c && e[c].removeObject(a, g.project(a.getLatLng(), c)); c--);
  5468. var c = a.__parent,
  5469. f;
  5470. for (this._arraySplice(c._markers, a); c;) {
  5471. c._childCount--;
  5472. if (0 > c._zoom) break;
  5473. 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,
  5474. 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());
  5475. c = c.__parent
  5476. }
  5477. },
  5478. _propagateEvent: function (a) {
  5479. if (a.target instanceof L.MarkerCluster) a.type = "cluster" + a.type;
  5480. L.FeatureGroup.prototype._propagateEvent.call(this, a)
  5481. },
  5482. _defaultIconCreateFunction: function (a) {
  5483. var a = a.getChildCount(),
  5484. b = " marker-cluster-";
  5485. return new L.DivIcon({
  5486. html: "<div><span>" + a + "</span></div>",
  5487. className: "marker-cluster" + (10 > a ? b + "small" : 100 > a ? b + "medium" : b + "large"),
  5488. iconSize: new L.Point(40, 40)
  5489. })
  5490. },
  5491. _bindEvents: function () {
  5492. var a = null,
  5493. b = this._map,
  5494. d = this.options.spiderfyOnMaxZoom,
  5495. e = this.options.showCoverageOnHover,
  5496. g = this.options.zoomToBoundsOnClick;
  5497. if (d || g) this.on("clusterclick", function (a) {
  5498. b.getMaxZoom() === b.getZoom() ? d && a.layer.spiderfy() : g && a.layer.zoomToBounds()
  5499. }, this);
  5500. e && (this.on("clustermouseover", function (c) {
  5501. this._inZoomAnimation ||
  5502. (a && b.removeLayer(a), 2 < c.layer.getChildCount() && (a = new L.Polygon(c.layer.getConvexHull(), this.options.polygonOptions), b.addLayer(a)))
  5503. }, this), this.on("clustermouseout", function () {
  5504. a && (b.removeLayer(a), a = null)
  5505. }, this), b.on("zoomend", function () {
  5506. a && (b.removeLayer(a), a = null)
  5507. }, this), b.on("layerremove", function (c) {
  5508. a && c.layer === this && (b.removeLayer(a), a = null)
  5509. }, this))
  5510. },
  5511. _zoomEnd: function () {
  5512. if (this._map) this._mergeSplitClusters(), this._zoom = this._map._zoom, this._currentShownBounds = this._getExpandedVisibleBounds()
  5513. },
  5514. _moveEnd: function () {
  5515. if (!this._inZoomAnimation) {
  5516. var a = this._getExpandedVisibleBounds();
  5517. this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, this._zoom, a);
  5518. this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, a);
  5519. this._currentShownBounds = a
  5520. }
  5521. },
  5522. _generateInitialClusters: function () {
  5523. var a = this._map.getMaxZoom(),
  5524. b = this.options.maxClusterRadius;
  5525. this.options.disableClusteringAtZoom && (a = this.options.disableClusteringAtZoom - 1);
  5526. this._maxZoom = a;
  5527. this._gridClusters = {};
  5528. for (this._gridUnclustered = {}; 0 <= a; a--) this._gridClusters[a] = new L.DistanceGrid(b), this._gridUnclustered[a] = new L.DistanceGrid(b);
  5529. this._topClusterLevel = new L.MarkerCluster(this, -1)
  5530. },
  5531. _addLayer: function (a, b) {
  5532. for (var d = this._gridClusters, e = this._gridUnclustered, g, c; 0 <= b; b--) {
  5533. g = this._map.project(a.getLatLng(), b);
  5534. var f = d[b].getNearObject(g);
  5535. if (f) {
  5536. f._addChild(a);
  5537. a.__parent = f;
  5538. return
  5539. }
  5540. if (f = e[b].getNearObject(g)) {
  5541. f.__parent && this._removeLayer(f, !1);
  5542. g = f.__parent;
  5543. c = new L.MarkerCluster(this, b, f, a);
  5544. d[b].addObject(c, this._map.project(c._cLatLng,
  5545. b));
  5546. f.__parent = c;
  5547. var h = a.__parent = c;
  5548. 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));
  5549. g._addChild(h);
  5550. for (c = b; 0 <= c && e[c].removeObject(f, this._map.project(f.getLatLng(), c)); c--);
  5551. return
  5552. }
  5553. e[b].addObject(a, g)
  5554. }
  5555. this._topClusterLevel._addChild(a);
  5556. a.__parent = this._topClusterLevel
  5557. },
  5558. _mergeSplitClusters: function () {
  5559. this._zoom < this._map._zoom ? (this._animationStart(), this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, this._zoom,
  5560. 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()
  5561. },
  5562. _getExpandedVisibleBounds: function () {
  5563. var a = this._map,
  5564. b = a.getPixelBounds(),
  5565. d = L.Browser.mobile ? 0 : Math.abs(b.max.x - b.min.x),
  5566. e = L.Browser.mobile ? 0 : Math.abs(b.max.y - b.min.y),
  5567. g = a.unproject(new L.Point(b.min.x - d, b.min.y - e)),
  5568. a = a.unproject(new L.Point(b.max.x + d, b.max.y + e));
  5569. return new L.LatLngBounds(g, a)
  5570. },
  5571. _animationAddLayerNonAnimated: function (a, b) {
  5572. if (b === a) L.FeatureGroup.prototype.addLayer.call(this, a);
  5573. else if (2 === b._childCount) {
  5574. b._addToMap();
  5575. var d = b.getAllChildMarkers();
  5576. L.FeatureGroup.prototype.removeLayer.call(this, d[0]);
  5577. L.FeatureGroup.prototype.removeLayer.call(this, d[1])
  5578. } else b._updateIcon()
  5579. }
  5580. });
  5581. L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
  5582. _animationStart: function () {},
  5583. _animationZoomIn: function (a, b) {
  5584. this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, a);
  5585. this._topClusterLevel._recursivelyAddChildrenToMap(null,
  5586. b, this._getExpandedVisibleBounds())
  5587. },
  5588. _animationZoomOut: function (a, b) {
  5589. this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, a);
  5590. this._topClusterLevel._recursivelyAddChildrenToMap(null, b, this._getExpandedVisibleBounds())
  5591. },
  5592. _animationAddLayer: function (a, b) {
  5593. this._animationAddLayerNonAnimated(a, b)
  5594. }
  5595. } : {
  5596. _animationStart: function () {
  5597. this._map._mapPane.className += " leaflet-cluster-anim";
  5598. this._inZoomAnimation++
  5599. },
  5600. _animationEnd: function () {
  5601. if (this._map) this._map._mapPane.className = this._map._mapPane.className.replace(" leaflet-cluster-anim",
  5602. "");
  5603. this._inZoomAnimation--;
  5604. this.fire("animationend")
  5605. },
  5606. _animationZoomIn: function (a, b) {
  5607. var d = this,
  5608. e = this._getExpandedVisibleBounds(),
  5609. g;
  5610. this._topClusterLevel._recursively(e, a, 0, function (c) {
  5611. var f = c._latlng,
  5612. i = c._markers;
  5613. 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));
  5614. for (g = i.length - 1; 0 <= g; g--) c = i[g], e.contains(c._latlng) || L.FeatureGroup.prototype.removeLayer.call(d, c)
  5615. });
  5616. this._forceLayout();
  5617. var c, f;
  5618. d._topClusterLevel._recursivelyBecomeVisible(e, b);
  5619. for (c in d._layers) d._layers.hasOwnProperty(c) && (f = d._layers[c], !(f instanceof L.MarkerCluster) && f._icon && f.setOpacity(1));
  5620. d._topClusterLevel._recursively(e, a, b, function (a) {
  5621. a._recursivelyRestoreChildPositions(b)
  5622. });
  5623. setTimeout(function () {
  5624. d._topClusterLevel._recursively(e, a, 0, function (a) {
  5625. L.FeatureGroup.prototype.removeLayer.call(d, a);
  5626. a.setOpacity(1)
  5627. });
  5628. d._animationEnd()
  5629. }, 250)
  5630. },
  5631. _animationZoomOut: function (a, b) {
  5632. this._animationZoomOutSingle(this._topClusterLevel,
  5633. a - 1, b);
  5634. this._topClusterLevel._recursivelyAddChildrenToMap(null, b, this._getExpandedVisibleBounds());
  5635. this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, a, this._getExpandedVisibleBounds())
  5636. },
  5637. _animationZoomOutSingle: function (a, b, d) {
  5638. var e = this._getExpandedVisibleBounds();
  5639. a._recursivelyAnimateChildrenInAndAddSelfToMap(e, b + 1, d);
  5640. var g = this;
  5641. this._forceLayout();
  5642. a._recursivelyBecomeVisible(e, d);
  5643. setTimeout(function () {
  5644. if (1 === a._childCount) {
  5645. var c = a._markers[0];
  5646. c.setLatLng(c.getLatLng());
  5647. c.setOpacity(1)
  5648. } else a._recursively(e, d, 0, function (a) {
  5649. a._recursivelyRemoveChildrenFromMap(e, b + 1)
  5650. }), g._animationEnd()
  5651. }, 250)
  5652. },
  5653. _animationAddLayer: function (a, b) {
  5654. var d = this;
  5655. L.FeatureGroup.prototype.addLayer.call(this, a);
  5656. b !== a && (2 < b._childCount ? (b._updateIcon(), this._forceLayout(), this._animationStart(), a._setPos(this._map.latLngToLayerPoint(b.getLatLng())), a.setOpacity(0), setTimeout(function () {
  5657. L.FeatureGroup.prototype.removeLayer.call(d, a);
  5658. a.setOpacity(1);
  5659. d._animationEnd()
  5660. }, 250)) : (this._forceLayout(),
  5661. d._animationStart(), d._animationZoomOutSingle(b, this._map.getMaxZoom(), this._map.getZoom())))
  5662. },
  5663. _forceLayout: function () {
  5664. L.Util.falseFn(document.body.offsetWidth)
  5665. }
  5666. });
  5667. L.MarkerCluster = L.Marker.extend({
  5668. initialize: function (a, b, d, e) {
  5669. L.Marker.prototype.initialize.call(this, d ? d._cLatLng || d.getLatLng() : new L.LatLng(0, 0), {
  5670. icon: this
  5671. });
  5672. this._group = a;
  5673. this._zoom = b;
  5674. this._markers = [];
  5675. this._childClusters = [];
  5676. this._childCount = 0;
  5677. this._iconNeedsUpdate = !0;
  5678. this._bounds = new L.LatLngBounds;
  5679. d && this._addChild(d);
  5680. e && this._addChild(e)
  5681. },
  5682. getAllChildMarkers: function (a) {
  5683. for (var a = a || [], b = this._childClusters.length - 1; 0 <= b; b--) this._childClusters[b].getAllChildMarkers(a);
  5684. for (b = this._markers.length - 1; 0 <= b; b--) a.push(this._markers[b]);
  5685. return a
  5686. },
  5687. getChildCount: function () {
  5688. return this._childCount
  5689. },
  5690. zoomToBounds: function () {
  5691. this._group._map.fitBounds(this._bounds)
  5692. },
  5693. _updateIcon: function () {
  5694. this._iconNeedsUpdate = !0;
  5695. this._icon && this.setIcon(this)
  5696. },
  5697. createIcon: function () {
  5698. if (this._iconNeedsUpdate) this._iconObj = this._group.options.iconCreateFunction(this),
  5699. this._iconNeedsUpdate = !1;
  5700. return this._iconObj.createIcon()
  5701. },
  5702. createShadow: function () {
  5703. return this._iconObj.createShadow()
  5704. },
  5705. _addChild: function (a, b) {
  5706. this._iconNeedsUpdate = !0;
  5707. this._expandBounds(a);
  5708. if (a instanceof L.MarkerCluster) {
  5709. if (!b) this._childClusters.push(a), a.__parent = this;
  5710. this._childCount += a._childCount
  5711. } else b || this._markers.push(a), this._childCount++;
  5712. this.__parent && this.__parent._addChild(a, !0)
  5713. },
  5714. _expandBounds: function (a) {
  5715. var b, d = a._wLatLng || a._latlng;
  5716. a instanceof L.MarkerCluster ? (this._bounds.extend(a._bounds),
  5717. b = a._childCount) : (this._bounds.extend(d), b = 1);
  5718. if (!this._cLatLng) this._cLatLng = a._cLatLng || d;
  5719. a = this._childCount + b;
  5720. 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)
  5721. },
  5722. _addToMap: function (a) {
  5723. if (a) this._backupLatlng = this._latlng, this.setLatLng(a);
  5724. L.FeatureGroup.prototype.addLayer.call(this._group, this)
  5725. },
  5726. _recursivelyAnimateChildrenIn: function (a, b, d) {
  5727. this._recursively(a,
  5728. 0, d - 1,
  5729. function (a) {
  5730. var a = a._markers,
  5731. d, c;
  5732. for (d = a.length - 1; 0 <= d; d--) c = a[d], c._icon && (c._setPos(b), c.setOpacity(0))
  5733. },
  5734. function (a) {
  5735. var a = a._childClusters,
  5736. d, c;
  5737. for (d = a.length - 1; 0 <= d; d--) c = a[d], c._icon && (c._setPos(b), c.setOpacity(0))
  5738. })
  5739. },
  5740. _recursivelyAnimateChildrenInAndAddSelfToMap: function (a, b, d) {
  5741. this._recursively(a, d, 0, function (e) {
  5742. e._recursivelyAnimateChildrenIn(a, e._group._map.latLngToLayerPoint(e.getLatLng()).round(), b);
  5743. e._isSingleParent() && b - 1 === d ? (e.setOpacity(1), e._recursivelyRemoveChildrenFromMap(a,
  5744. b)) : e.setOpacity(0);
  5745. e._addToMap()
  5746. })
  5747. },
  5748. _recursivelyBecomeVisible: function (a, b) {
  5749. this._recursively(a, 0, b, null, function (a) {
  5750. a.setOpacity(1)
  5751. })
  5752. },
  5753. _recursivelyAddChildrenToMap: function (a, b, d) {
  5754. this._recursively(d, -1, b, function (e) {
  5755. if (b !== e._zoom)
  5756. for (var g = e._markers.length - 1; 0 <= g; g--) {
  5757. var c = e._markers[g];
  5758. if (d.contains(c._latlng)) {
  5759. if (a) c._backupLatlng = c.getLatLng(), c.setLatLng(a), c.setOpacity(0);
  5760. L.FeatureGroup.prototype.addLayer.call(e._group, c)
  5761. }
  5762. }
  5763. }, function (b) {
  5764. b._addToMap(a)
  5765. })
  5766. },
  5767. _recursivelyRestoreChildPositions: function (a) {
  5768. for (var b =
  5769. this._markers.length - 1; 0 <= b; b--) {
  5770. var d = this._markers[b];
  5771. d._backupLatlng && (d.setLatLng(d._backupLatlng), delete d._backupLatlng)
  5772. }
  5773. if (a - 1 === this._zoom)
  5774. for (a = this._childClusters.length - 1; 0 <= a; a--) this._childClusters[a]._restorePosition();
  5775. else
  5776. for (b = this._childClusters.length - 1; 0 <= b; b--) this._childClusters[b]._recursivelyRestoreChildPositions(a)
  5777. },
  5778. _restorePosition: function () {
  5779. this._backupLatlng && (this.setLatLng(this._backupLatlng), delete this._backupLatlng)
  5780. },
  5781. _recursivelyRemoveChildrenFromMap: function (a, b,
  5782. d) {
  5783. var e, g;
  5784. this._recursively(a, -1, b - 1, function (a) {
  5785. for (g = a._markers.length - 1; 0 <= g; g--)
  5786. if (e = a._markers[g], !d || !d.contains(e._latlng)) L.FeatureGroup.prototype.removeLayer.call(a._group, e), e.setOpacity(1)
  5787. }, function (a) {
  5788. for (g = a._childClusters.length - 1; 0 <= g; g--)
  5789. if (e = a._childClusters[g], !d || !d.contains(e._latlng)) L.FeatureGroup.prototype.removeLayer.call(a._group, e), e.setOpacity(1)
  5790. })
  5791. },
  5792. _recursively: function (a, b, d, e, g) {
  5793. var c = this._childClusters,
  5794. f = this._zoom,
  5795. h;
  5796. if (b > f)
  5797. for (f = c.length - 1; 0 <= f; f--) h = c[f], a.intersects(h._bounds) &&
  5798. h._recursively(a, b, d, e, g);
  5799. else if (e && e(this), g && this._zoom === d && g(this), d > f)
  5800. for (f = c.length - 1; 0 <= f; f--) h = c[f], a.intersects(h._bounds) && h._recursively(a, b, d, e, g)
  5801. },
  5802. _recalculateBounds: function () {
  5803. var a = this._markers,
  5804. b = this._childClusters,
  5805. d;
  5806. this._bounds = new L.LatLngBounds;
  5807. delete this._wLatLng;
  5808. for (d = a.length - 1; 0 <= d; d--) this._expandBounds(a[d]);
  5809. for (d = b.length - 1; 0 <= d; d--) this._expandBounds(b[d])
  5810. },
  5811. _isSingleParent: function () {
  5812. return 0 < this._childClusters.length && this._childClusters[0]._childCount === this._childCount
  5813. }
  5814. });
  5815. L.DistanceGrid = function (a) {
  5816. this._cellSize = a;
  5817. this._sqCellSize = a * a;
  5818. this._grid = {};
  5819. this._objectPoint = {}
  5820. };
  5821. L.DistanceGrid.prototype = {
  5822. addObject: function (a, b) {
  5823. var d = this._getCoord(b.x),
  5824. e = this._getCoord(b.y),
  5825. g = this._grid,
  5826. e = g[e] = g[e] || {},
  5827. d = e[d] = e[d] || [];
  5828. this._objectPoint[L.Util.stamp(a)] = b;
  5829. d.push(a)
  5830. },
  5831. updateObject: function (a, b) {
  5832. this.removeObject(a);
  5833. this.addObject(a, b)
  5834. },
  5835. removeObject: function (a, b) {
  5836. var d = this._getCoord(b.x),
  5837. e = this._getCoord(b.y),
  5838. g = this._grid,
  5839. e = g[e] = g[e] || {},
  5840. g = e[d] = e[d] || [],
  5841. c, f;
  5842. delete this._objectPoint[L.Util.stamp(a)];
  5843. for (c = 0, f = g.length; c < f; c++)
  5844. if (g[c] === a) return g.splice(c, 1), 1 === f && delete e[d], !0
  5845. },
  5846. eachObject: function (a, b) {
  5847. var d, e, g, c, f, h, j, i = this._grid;
  5848. for (d in i)
  5849. if (i.hasOwnProperty(d))
  5850. for (e in f = i[d], f)
  5851. if (f.hasOwnProperty(e)) {
  5852. h = f[e];
  5853. for (g = 0, c = h.length; g < c; g++)
  5854. if (j = a.call(b, h[g])) g--, c--
  5855. }
  5856. },
  5857. getNearObject: function (a) {
  5858. var b = this._getCoord(a.x),
  5859. d = this._getCoord(a.y),
  5860. e, g, c, f, h, j, i, k, n = this._objectPoint,
  5861. l = this._sqCellSize,
  5862. m = null;
  5863. for (e = d - 1; e <= d + 1; e++)
  5864. if (f = this._grid[e])
  5865. for (g = b - 1; g <= b + 1; g++)
  5866. if (h = f[g])
  5867. for (c = 0, j = h.length; c <
  5868. j; c++) i = h[c], k = this._sqDist(n[L.Util.stamp(i)], a), k < l && (l = k, m = i);
  5869. return m
  5870. },
  5871. _getCoord: function (a) {
  5872. return Math.floor(a / this._cellSize)
  5873. },
  5874. _sqDist: function (a, b) {
  5875. var d = b.x - a.x,
  5876. e = b.y - a.y;
  5877. return d * d + e * e
  5878. }
  5879. };
  5880. (function () {
  5881. L.QuickHull = {
  5882. getDistant: function (a, b) {
  5883. return (b[0].lng - b[1].lng) * (a.lat - b[0].lat) + (b[1].lat - b[0].lat) * (a.lng - b[0].lng)
  5884. },
  5885. findMostDistantPointFromBaseLine: function (a, b) {
  5886. var d = 0,
  5887. e = null,
  5888. g = [],
  5889. c, f, h;
  5890. 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));
  5891. return {
  5892. maxPoint: e,
  5893. newPoints: g
  5894. }
  5895. },
  5896. buildConvexHull: function (a, b) {
  5897. var d = [],
  5898. e = this.findMostDistantPointFromBaseLine(a, b);
  5899. 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]
  5900. },
  5901. getConvexHull: function (a) {
  5902. var b = !1,
  5903. d = !1,
  5904. e = null,
  5905. g = null,
  5906. c;
  5907. for (c = a.length - 1; 0 <= c; c--) {
  5908. var f = a[c];
  5909. if (!1 === b || f.lat > b) e = f, b = f.lat;
  5910. if (!1 === d || f.lat < d) g = f, d = f.lat
  5911. }
  5912. return [].concat(this.buildConvexHull([g, e], a), this.buildConvexHull([e, g], a))
  5913. }
  5914. }
  5915. })();
  5916. L.MarkerCluster.include({
  5917. getConvexHull: function () {
  5918. var a =
  5919. this.getAllChildMarkers(),
  5920. b = [],
  5921. d = [],
  5922. e, g;
  5923. for (g = a.length - 1; 0 <= g; g--) e = a[g].getLatLng(), b.push(e);
  5924. a = L.QuickHull.getConvexHull(b);
  5925. for (g = a.length - 1; 0 <= g; g--) d.push(a[g][0]);
  5926. return d
  5927. }
  5928. });
  5929. L.MarkerCluster.include({
  5930. _2PI: 2 * Math.PI,
  5931. _circleFootSeparation: 25,
  5932. _circleStartAngle: Math.PI / 6,
  5933. _spiralFootSeparation: 28,
  5934. _spiralLengthStart: 11,
  5935. _spiralLengthFactor: 5,
  5936. _circleSpiralSwitchover: 9,
  5937. spiderfy: function () {
  5938. if (!(this._group._spiderfied === this || this._group._inZoomAnimation)) {
  5939. var a = this.getAllChildMarkers(),
  5940. b = this._group._map.latLngToLayerPoint(this._latlng);
  5941. this._group._unspiderfy();
  5942. this._group._spiderfied = this;
  5943. a.length >= this._circleSpiralSwitchover ? b = this._generatePointsSpiral(a.length, b) : (b.y += 10, b = this._generatePointsCircle(a.length, b));
  5944. this._animationSpiderfy(a, b)
  5945. }
  5946. },
  5947. unspiderfy: function (a) {
  5948. if (!this._group._inZoomAnimation) this._animationUnspiderfy(a), this._group._spiderfied = null
  5949. },
  5950. _generatePointsCircle: function (a, b) {
  5951. var d = this._circleFootSeparation * (2 + a) / this._2PI,
  5952. e = this._2PI / a,
  5953. g = [],
  5954. c, f;
  5955. g.length = a;
  5956. for (c = a - 1; 0 <= c; c--) f = this._circleStartAngle + c * e, g[c] =
  5957. (new L.Point(b.x + d * Math.cos(f), b.y + d * Math.sin(f)))._round();
  5958. return g
  5959. },
  5960. _generatePointsSpiral: function (a, b) {
  5961. var d = this._spiralLengthStart,
  5962. e = 0,
  5963. g = [],
  5964. c;
  5965. g.length = a;
  5966. 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;
  5967. return g
  5968. }
  5969. });
  5970. L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
  5971. _animationSpiderfy: function (a, b) {
  5972. var d = this._group,
  5973. e = d._map,
  5974. g, c, f;
  5975. for (g = a.length - 1; 0 <= g; g--) f = e.layerPointToLatLng(b[g]),
  5976. 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], {
  5977. weight: 1.5,
  5978. color: "#222"
  5979. }), e.addLayer(f), c._spiderLeg = f;
  5980. this.setOpacity(0.3);
  5981. d.fire("spiderfied")
  5982. },
  5983. _animationUnspiderfy: function () {
  5984. var a = this._group,
  5985. b = a._map,
  5986. d = this.getAllChildMarkers(),
  5987. e, g;
  5988. this.setOpacity(1);
  5989. 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,
  5990. e.setZIndexOffset(0), b.removeLayer(e._spiderLeg), delete e._spiderLeg
  5991. }
  5992. } : {
  5993. _animationSpiderfy: function (a, b) {
  5994. var d = this._group,
  5995. e = d._map,
  5996. g = e.latLngToLayerPoint(this._latlng),
  5997. c, f, h;
  5998. 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);
  5999. d._forceLayout();
  6000. d._animationStart();
  6001. var g = L.Path.SVG ? 0 : 0.3,
  6002. j = L.Path.SVG_NS;
  6003. for (c = a.length - 1; 0 <= c; c--)
  6004. if (h = e.layerPointToLatLng(b[c]), f = a[c], f._preSpiderfyLatlng = f._latlng, f.setLatLng(h), f.setOpacity(1),
  6005. h = new L.Polyline([this._latlng, h], {
  6006. weight: 1.5,
  6007. color: "#222",
  6008. opacity: g
  6009. }), e.addLayer(h), f._spiderLeg = h, L.Path.SVG) {
  6010. f = h._path.getTotalLength();
  6011. h._path.setAttribute("stroke-dasharray", f + "," + f);
  6012. var i = document.createElementNS(j, "animate");
  6013. i.setAttribute("attributeName", "stroke-dashoffset");
  6014. i.setAttribute("begin", "indefinite");
  6015. i.setAttribute("from", f);
  6016. i.setAttribute("to", 0);
  6017. i.setAttribute("dur", 0.25);
  6018. h._path.appendChild(i);
  6019. i.beginElement();
  6020. i = document.createElementNS(j, "animate");
  6021. i.setAttribute("attributeName",
  6022. "stroke-opacity");
  6023. i.setAttribute("attributeName", "stroke-opacity");
  6024. i.setAttribute("begin", "indefinite");
  6025. i.setAttribute("from", 0);
  6026. i.setAttribute("to", 0.5);
  6027. i.setAttribute("dur", 0.25);
  6028. h._path.appendChild(i);
  6029. i.beginElement()
  6030. }
  6031. this.setOpacity(0.3);
  6032. if (L.Path.SVG) {
  6033. this._group._forceLayout();
  6034. for (c = a.length - 1; 0 <= c; c--) f = a[c]._spiderLeg, f.options.opacity = 0.5, f._path.setAttribute("stroke-opacity", 0.5)
  6035. }
  6036. setTimeout(function () {
  6037. d._animationEnd();
  6038. d.fire("spiderfied")
  6039. }, 250)
  6040. },
  6041. _animationUnspiderfy: function (a) {
  6042. var b = this._group,
  6043. d = b._map,
  6044. a = a ? d._latLngToNewLayerPoint(this._latlng, a.zoom, a.center) : d.latLngToLayerPoint(this._latlng),
  6045. e = this.getAllChildMarkers(),
  6046. g = L.Path.SVG,
  6047. c, f, h;
  6048. b._animationStart();
  6049. this.setOpacity(1);
  6050. 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",
  6051. 0), h.setAttribute("stroke-opacity", 0), h.beginElement(), c._spiderLeg._path.setAttribute("stroke-opacity", 0));
  6052. setTimeout(function () {
  6053. var a = 0;
  6054. for (f = e.length - 1; 0 <= f; f--) c = e[f], c._spiderLeg && a++;
  6055. 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);
  6056. b._animationEnd()
  6057. }, 250)
  6058. }
  6059. });
  6060. L.MarkerClusterGroup.include({
  6061. _spiderfied: null,
  6062. _spiderfierOnAdd: function () {
  6063. this._map.on("click", this._unspiderfyWrapper,
  6064. this);
  6065. if (this._map.options.zoomAnimation) this._map.on("zoomstart", this._unspiderfyZoomStart, this);
  6066. else this._map.on("zoomend", this._unspiderfyWrapper, this);
  6067. L.Path.SVG && !L.Browser.touch && this._map._initPathRoot()
  6068. },
  6069. _spiderfierOnRemove: function () {
  6070. this._map.off("click", this._unspiderfyWrapper, this);
  6071. this._map.off("zoomstart", this._unspiderfyZoomStart, this);
  6072. this._map.off("zoomanim", this._unspiderfyZoomAnim, this);
  6073. this._unspiderfy()
  6074. },
  6075. _unspiderfyZoomStart: function () {
  6076. if (this._map) this._map.on("zoomanim", this._unspiderfyZoomAnim,
  6077. this)
  6078. },
  6079. _unspiderfyZoomAnim: function (a) {
  6080. L.DomUtil.hasClass(this._map._mapPane, "leaflet-touching") || (this._map.off("zoomanim", this._unspiderfyZoomAnim, this), this._unspiderfy(a))
  6081. },
  6082. _unspiderfyWrapper: function () {
  6083. this._unspiderfy()
  6084. },
  6085. _unspiderfy: function (a) {
  6086. this._spiderfied && this._spiderfied.unspiderfy(a)
  6087. },
  6088. _unspiderfyLayer: function (a) {
  6089. a._spiderLeg && (L.FeatureGroup.prototype.removeLayer.call(this, a), a.setOpacity(1), a.setZIndexOffset(0), this._map.removeLayer(a._spiderLeg), delete a._spiderLeg)
  6090. }
  6091. })
  6092. })(this);
  6093. (function (c) {
  6094. c.fn.hasScrollBar = function () {
  6095. return this.get(0).scrollHeight > this.height()
  6096. };
  6097. c.fn.lionbars = function (h) {
  6098. function S(a) {
  6099. var b = c(a);
  6100. if (i || j) b.find(".lb-wrap").on("scroll", function () {
  6101. b.find(".lb-v-scrollbar-slider").css({
  6102. top: -c(this).scrollTop() / b.attr("vratio")
  6103. });
  6104. b.find(".lb-h-scrollbar-slider").css({
  6105. left: -c(this).scrollLeft() / b.attr("hratio")
  6106. });
  6107. if (b.find(".lb-v-scrollbar").height() == parseInt(b.find(".lb-v-scrollbar-slider").css("top")) + b.find(".lb-v-scrollbar-slider").height() && "function" ==
  6108. typeof h.reachedBottom && !L) {
  6109. L = !0;
  6110. var a = c(this);
  6111. h.reachedBottom.apply(c(this).children(".lb-content"), [function () {
  6112. r(c(a).parent(), {
  6113. height: c(a).children(".lb-content").get(0).scrollHeight,
  6114. width: c(a).children(".lb-content").get(0).scrollWidth
  6115. });
  6116. y(c(a).parent());
  6117. z(c(a).parent());
  6118. A(c(a).parent());
  6119. B();
  6120. L = !1
  6121. }])
  6122. }
  6123. 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 () {
  6124. r(c(a).parent(), {
  6125. height: c(a).children(".lb-content").get(0).scrollHeight,
  6126. width: c(a).children(".lb-content").get(0).scrollWidth
  6127. });
  6128. y(c(a).parent());
  6129. z(c(a).parent());
  6130. A(c(a).parent());
  6131. B();
  6132. M = !1
  6133. }]))
  6134. });
  6135. i && (b.find(".lb-v-scrollbar-slider").mousedown(function (a) {
  6136. T = a.pageY;
  6137. o = !0;
  6138. C = c(this);
  6139. f = b.find(".lb-wrap");
  6140. D = f.parent().attr("vratio");
  6141. E = C.position().top;
  6142. return !1
  6143. }), b.find(".lb-v-scrollbar").mousedown(function (a) {
  6144. c(a.target).hasClass("lb-v-scrollbar-slider") || b.find(".lb-wrap").scrollTop((a.pageY -
  6145. c(this).offset().top) * Math.abs(b.attr("vratio")) - c(this).find(".lb-v-scrollbar-slider").height() / 2);
  6146. return !1
  6147. }));
  6148. j && (b.find(".lb-h-scrollbar-slider").mousedown(function (a) {
  6149. U = a.pageX;
  6150. p = !0;
  6151. C = c(this);
  6152. f = b.find(".lb-wrap");
  6153. D = f.parent().attr("hratio");
  6154. E = C.position().left;
  6155. return !1
  6156. }), b.find(".lb-h-scrollbar").mousedown(function (a) {
  6157. 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() /
  6158. 2);
  6159. return !1
  6160. }));
  6161. if ((i || j) && autohide) b.find(".lb-v-scrollbar, .lb-h-scrollbar").hide(), b.hover(function () {
  6162. c(this).data("hover", !0);
  6163. b.find(".lb-v-scrollbar, .lb-h-scrollbar").fadeIn(150)
  6164. }, function () {
  6165. c(this).data("hover", !1);
  6166. b.find(".lb-v-scrollbar, .lb-h-scrollbar").fadeOut(150)
  6167. })
  6168. }
  6169. function A(a) {
  6170. V = (k - c(a).find(".lb-wrap").get(0).scrollHeight - F - G) / (s - l);
  6171. W = (m - c(a).find(".lb-wrap").get(0).scrollWidth - H - I) / (t - n);
  6172. a = c(a);
  6173. a.attr("vratio", V);
  6174. a.attr("hratio", W)
  6175. }
  6176. function z(a) {
  6177. var a = c(a),
  6178. b, d;
  6179. 0 != a.find(".lb-v-scrollbar").length &&
  6180. (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);
  6181. 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);
  6182. a.find(".lb-v-scrollbar-slider").css({
  6183. height: l
  6184. });
  6185. a.find(".lb-h-scrollbar-slider").css({
  6186. width: n
  6187. })
  6188. }
  6189. function B() {
  6190. O = P = 0;
  6191. i = j = !1;
  6192. t = s = n = l = K = Q = k = m = N = J = I = G = H = F = u = v = w = x = 0
  6193. }
  6194. function y(a) {
  6195. a = c(a);
  6196. i && j ? (s = a.height() - 12, t = a.width() - 12) : (s = a.height() - 4, t = a.width() - 4);
  6197. a.find(".lb-v-scrollbar").css({
  6198. height: s
  6199. });
  6200. a.find(".lb-h-scrollbar").css({
  6201. width: t
  6202. })
  6203. }
  6204. function X(a, b, d) {
  6205. a = c(a);
  6206. if (b || d) a.css({
  6207. overflow: "hidden"
  6208. }), d = a.find(".lb-wrap"), b = c(a), d = c(d), b.css({
  6209. padding: 0
  6210. }), d.css({
  6211. "padding-top": x + "px",
  6212. "padding-left": w + "px",
  6213. "padding-bottom": v + "px",
  6214. "padding-right": u + "px"
  6215. }), b = c(a), b.css({
  6216. width: b.width() + w + u,
  6217. height: b.height() + x + v
  6218. }), b = a.find(".lb-wrap"), a = c(a), b = c(b), a.css({
  6219. position: "relative"
  6220. }), b.css({
  6221. width: a.width() + P - w - u,
  6222. height: a.height() + O - x - v
  6223. })
  6224. }
  6225. function R(a) {
  6226. a = c(a);
  6227. j = i = !1;
  6228. if (a.find(".lb-v-scrollbar-slider").length) return !1;
  6229. var b = c(a);
  6230. x = parseInt(b.css("padding-top").replace("px",
  6231. ""));
  6232. w = parseInt(b.css("padding-left").replace("px", ""));
  6233. v = parseInt(b.css("padding-bottom").replace("px", ""));
  6234. u = parseInt(b.css("padding-right").replace("px", ""));
  6235. b = c(a);
  6236. F = parseInt(b.css("border-top-width").replace("px", ""));
  6237. I = parseInt(b.css("border-right-width").replace("px", ""));
  6238. G = parseInt(b.css("border-bottom-width").replace("px", ""));
  6239. H = parseInt(b.css("border-left-width").replace("px", ""));
  6240. var b = a.css("overflow-y"),
  6241. d = a.css("overflow-x");
  6242. a.css({
  6243. overflow: "hidden"
  6244. });
  6245. "hidden" != b && a.get(0).scrollHeight >
  6246. a.get(0).clientHeight && (i = !0);
  6247. "hidden" != d && a.get(0).scrollWidth > a.get(0).clientWidth && (j = !0);
  6248. a.css({
  6249. overflow: "auto"
  6250. });
  6251. if (i || j) return !0
  6252. }
  6253. function r(a, b, d) {
  6254. var e = c(a).get(0);
  6255. d && (e = c(e).find(".lb-wrap").get(0));
  6256. J = "undefined" != typeof b && !1 != b ? b.height : e.scrollHeight;
  6257. N = "undefined" != typeof b && !1 != b ? b.width : e.scrollWidth;
  6258. K = e.clientHeight;
  6259. Q = e.clientWidth;
  6260. k = e.offsetHeight;
  6261. m = e.offsetWidth;
  6262. b = c(a);
  6263. b = c(b);
  6264. b.css({
  6265. overflow: "auto"
  6266. });
  6267. P = m - Q - H - I;
  6268. b.css({
  6269. overflow: "hidden"
  6270. });
  6271. a = c(a);
  6272. a = c(a);
  6273. a.css({
  6274. overflow: "auto"
  6275. });
  6276. O = k - K -
  6277. F - G;
  6278. a.css({
  6279. overflow: "hidden"
  6280. })
  6281. }
  6282. h = h || {};
  6283. autohide = h.autohide;
  6284. var p = !1,
  6285. o = !1,
  6286. C = 0,
  6287. f = 0,
  6288. U, T, Y, Z, D, E, L = !1,
  6289. M = !1,
  6290. g = c(this),
  6291. q = 0,
  6292. P = 0,
  6293. O = 0,
  6294. j = !1,
  6295. i = !1,
  6296. x = 0,
  6297. w = 0,
  6298. v = 0,
  6299. u = 0,
  6300. F = 0,
  6301. I = 0,
  6302. G = 0,
  6303. H = 0,
  6304. J = 0,
  6305. N = 0,
  6306. m = 0,
  6307. k = 0,
  6308. Q = 0,
  6309. K = 0,
  6310. V = 0,
  6311. W = 0,
  6312. l = 0,
  6313. n = 0,
  6314. s = 0,
  6315. t = 0;
  6316. this.mainLoop = function () {
  6317. for (var a = 0; void 0 !== g[a]; a++)
  6318. if (R(g[a]) && !c(g[a]).hasClass("nolionbars")) {
  6319. target = g[a];
  6320. r(target);
  6321. var b = i,
  6322. d = j,
  6323. e = c(target),
  6324. f = e.attr("id"),
  6325. h = 0;
  6326. 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-' +
  6327. q + '"></div>'), h = c("#lb-wrap-" + q));
  6328. h.wrapInner('<div class="lb-content"></div>');
  6329. b && (e.prepend('<div class="lb-v-scrollbar"></div>'), e.find(".lb-v-scrollbar").append('<div class="lb-v-scrollbar-slider"></div>'));
  6330. d && (e.prepend('<div class="lb-h-scrollbar"></div>'), e.find(".lb-h-scrollbar").append('<div class="lb-h-scrollbar-slider"></div>'));
  6331. q += 1;
  6332. X(target, i, j);
  6333. y(target);
  6334. z(target);
  6335. A(target);
  6336. S(target);
  6337. B()
  6338. }
  6339. };
  6340. this.mainLoop();
  6341. this.Update = function () {
  6342. for (var a = 0; void 0 !== g[a]; a++) R(g[a]) && !c(g[a]).hasClass("nolionbars") &&
  6343. (target = g[a], r(target, !1, !0), X(target, i, j), y(target), z(target), A(target), S(target), B())
  6344. };
  6345. this.scrollToBottom = function () {
  6346. for (var a = 0; void 0 !== g[a]; a++)
  6347. if (R(g[a]) && !c(g[a]).hasClass("nolionbars")) {
  6348. target = g[a];
  6349. r(target, !1, !0);
  6350. var b = c(target).find(".lb-wrap"),
  6351. d = b.parent().attr("vratio"),
  6352. d = (J - K) * Math.abs(d);
  6353. b.scrollTop(d)
  6354. }
  6355. };
  6356. c(document).mousemove(function (a) {
  6357. if (p || o) {
  6358. f.parent().find(".lb-v-scrollbar, .lb-h-scrollbar").show();
  6359. if (o) Z = a.pageY, f.scrollTop((E + Z - T) * Math.abs(D));
  6360. if (p) Y = a.pageX, f.scrollLeft((E +
  6361. Y - U) * Math.abs(D))
  6362. }
  6363. });
  6364. c(document).mouseup(function () {
  6365. if (p || o) f.parent().find(".lb-v-scrollbar, .lb-h-scrollbar").fadeOut(150), o && (o = !1), p && (p = !1)
  6366. });
  6367. return this.each(function () {})
  6368. }
  6369. })(jQuery);
  6370. if (!IGN) var IGN = {};
  6371. if (!IGN.Mixins) IGN.Mixins = {};
  6372. IGN.Mixins.MapsAPI = {
  6373. API: {
  6374. ENDPOINT: {
  6375. TYPES: {
  6376. action: "get_marker_types",
  6377. method: "GET",
  6378. dataType: "jsonp",
  6379. path: "api"
  6380. },
  6381. MAPS: {
  6382. action: "get_maps",
  6383. method: "GET",
  6384. dataType: "jsonp",
  6385. path: "api"
  6386. },
  6387. MARKERS: {
  6388. GET: {
  6389. action: "get_markers",
  6390. method: "GET",
  6391. dataType: "jsonp",
  6392. path: "api"
  6393. },
  6394. PUT: {
  6395. action: "update_marker",
  6396. method: "GET",
  6397. dataType: "jsonp",
  6398. path: "api"
  6399. },
  6400. POST: {
  6401. action: "create_marker",
  6402. method: "GET",
  6403. dataType: "jsonp",
  6404. path: "api"
  6405. },
  6406. DELETE: {
  6407. action: "delete_marker",
  6408. method: "GET",
  6409. dataType: "jsonp",
  6410. path: "api"
  6411. },
  6412. PENDING: {
  6413. GET: {
  6414. action: "pending_markers",
  6415. method: "GET",
  6416. dataType: "jsonp",
  6417. path: "api"
  6418. },
  6419. DECLINE: {
  6420. action: "decline_pending_marker",
  6421. method: "GET",
  6422. dataType: "jsonp",
  6423. path: "api"
  6424. },
  6425. ACCEPT: {
  6426. action: "accept_pending_marker",
  6427. method: "GET",
  6428. dataType: "jsonp",
  6429. path: "api"
  6430. }
  6431. }
  6432. },
  6433. WIKI: {
  6434. action: "get_wiki_content",
  6435. method: "GET",
  6436. dataType: "jsonp",
  6437. path: "wikiapi"
  6438. },
  6439. WIKI_PAGE: {
  6440. action: "search_wiki_pages",
  6441. method: "GET",
  6442. dataType: "jsonp",
  6443. path: "wikilookup"
  6444. },
  6445. SEARCH: {
  6446. action: "search",
  6447. method: "GET",
  6448. dataType: "jsonp",
  6449. path: "api"
  6450. }
  6451. }
  6452. },
  6453. proxyUrl : "http://www.ign.com/maps/",
  6454. callApi: function (b, a, c) {
  6455. var url;
  6456. a["do"] = b.action;
  6457. if (!a.objectSlug) a.objectSlug = this.metadata.objectSlug;
  6458. if (!a.mapSlug) a.mapSlug = this.metadata.mapSlug;
  6459. if(b.action == 'get_markers') {
  6460. url = 'http://tv.duowan.com/s/ignmap/maker/'+this.metadata.mapSlug+'.js'
  6461. jQuery.ajax({
  6462. type: b.method,
  6463. dataType: b.dataType,
  6464. jsonpCallback: 'jsonpMapMarkerCallback',
  6465. url: url,
  6466. data: a,
  6467. success: function (a) {
  6468. c.call(this, a)
  6469. },
  6470. error: function (a, b, c) {
  6471. console.log(a);
  6472. console.log(b);
  6473. console.log(c)
  6474. }
  6475. })
  6476. } else {
  6477. url = this._proxyUrl() + b.path;
  6478. jQuery.ajax({
  6479. type: b.method,
  6480. dataType: b.dataType,
  6481. url: url,
  6482. data: a,
  6483. success: function (a) {
  6484. c.call(this, a)
  6485. },
  6486. error: function (a, b, c) {
  6487. console.log(a);
  6488. console.log(b);
  6489. console.log(c)
  6490. }
  6491. })
  6492. }
  6493. },
  6494. _proxyUrl: function () {
  6495. 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/"
  6496. }
  6497. };
  6498. if (!IGN) var IGN = {};
  6499. if (!IGN.Mixins) IGN.Mixins = {};
  6500. IGN.Mixins.Icons = {
  6501. createMarkerIcon: function (a) {
  6502. var b = "",
  6503. c;
  6504. a && (a.badges && (b = '<span class="badge">' + a.badges + "</span>"), a.iconUrl && (c = {
  6505. iconSize: a.iconSize,
  6506. iconAnchor: a.iconAnchor,
  6507. popupAnchor: a.popupAnchor,
  6508. html: b + '<img src="' + a.iconUrl + '" width="' + a.iconSize[0] + '" height="' + a.iconSize[1] + '" />'
  6509. }));
  6510. a = {
  6511. iconSize: [36, 46],
  6512. iconAnchor: [18, 42],
  6513. className: "single-div-icon",
  6514. html: b + '<img src="http://oyster.ignimgs.com/ignmedia/wikimaps/resources/pin-default.png" />',
  6515. popupAnchor: [0, -42]
  6516. };
  6517. L.Util.extend(a, c);
  6518. return new L.DivIcon(a)
  6519. },
  6520. createDefaultClusterIcon: function (a) {
  6521. return new L.DivIcon({
  6522. className: a && a.retina ? "cluster-div-icon-retina" : "cluster-div-icon",
  6523. iconSize: [36, 47],
  6524. iconAnchor: [18, 42]
  6525. })
  6526. }
  6527. };
  6528. if (!IGN) var IGN = {};
  6529. if (!IGN.Mixins) IGN.Mixins = {};
  6530. IGN.Mixins.Types = {
  6531. _bindTypesEvents: function () {
  6532. this.on("loadtypes", function (d) {
  6533. this.loadMarkersForTypes(d)
  6534. })
  6535. },
  6536. initTypes: function (d) {
  6537. this._bindTypesEvents();
  6538. var a = this,
  6539. e = {
  6540. retina: this.options.retina,
  6541. clusters: {
  6542. enabled: this.options.clusters.enabled,
  6543. clusterRadius: this.options.clusters.clusterRadius,
  6544. disableClusteringAtZoom: this.options.minZoom
  6545. }
  6546. },
  6547. c;
  6548. this.markers = {};
  6549. this.types = {};
  6550. jQuery.each(d, function (d, b) {
  6551. if (b.parentTypeSlug) b.parentType = a.types[b.parentTypeSlug];
  6552. if (b.markerCounts && b.markerCounts[a.metadata.mapSlug]) b.markerCount =
  6553. b.markerCounts[a.metadata.mapSlug];
  6554. c = new IGN.Type(b, e);
  6555. c.hasParent() && a.types[c.parentTypeSlug].addChild(c);
  6556. a.types[c.typeSlug] = c
  6557. });
  6558. a.fireEvent("typesloaded")
  6559. },
  6560. loadMarkersForTypes: function (d) {
  6561. var a = [],
  6562. e = {},
  6563. c = this,
  6564. f, b;
  6565. f = d.filterEvent ? d.filterEvent : "filter";
  6566. jQuery.each(d.types, function (c, b) {
  6567. if (1 == d.types.length || "korok-seed" != b.typeSlug) a.push(b.typeSlug), b.loaded = !0
  6568. });
  6569. this.callApi(this.API.ENDPOINT.MARKERS.GET, {
  6570. types: a.join(",")
  6571. }, function (a) {
  6572. jQuery.each(a.data, function (d, a) {
  6573. a.type = c.types[a.metadata.typeSlug];
  6574. if (c.options.moderator) a.displayBadgeCount = !0;
  6575. b = new IGN.Marker([a.location.lat, a.location.lng], a);
  6576. if(c.types[a.metadata.typeSlug]) {
  6577. c.types[a.metadata.typeSlug].addMarker(b);
  6578. c.markers[a.metadata.markerSlug] = b;
  6579. c.overlayFilter.addMarker(b)
  6580. }
  6581. });
  6582. if (d.parentType) e.type = d.parentType;
  6583. c.fireEvent(f, e)
  6584. })
  6585. }
  6586. };
  6587. if (!IGN) var IGN = {};
  6588. if (!IGN.Mixins) IGN.Mixins = {};
  6589. IGN.Mixins.Maps = {
  6590. relatedMaps: function (a) {
  6591. if (this.options.madeAdditionalMapsCall) a.call(this, this._maps);
  6592. else {
  6593. var b = this;
  6594. this._maps = [];
  6595. this.options.madeAdditionalMapsCall = !1;
  6596. this.callApi(this.API.ENDPOINT.MAPS, {}, function (c) {
  6597. b._maps = c.data;
  6598. b.options.madeAdditionalMapsCall = !0;
  6599. a && a.call(this, b._maps)
  6600. })
  6601. }
  6602. }
  6603. };
  6604. if (!IGN) var IGN = {};
  6605. if (!IGN.Mixins) IGN.Mixins = {};
  6606. IGN.Mixins.Markers = {
  6607. activateMarker: function (a) {
  6608. var b = this,
  6609. c;
  6610. this.markers[a.metadata.markerSlug] && this.markers[a.metadata.markerSlug]._map ? this.markers[a.metadata.markerSlug].fireEvent("click") : loadingInterval = setInterval(function () {
  6611. 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()))
  6612. }, 100)
  6613. }
  6614. };
  6615. if (!IGN) var IGN = {};
  6616. IGN.Type = L.Class.extend({
  6617. includes: IGN.Mixins.Icons,
  6618. initialize: function (a, b) {
  6619. this.children = [];
  6620. this.loaded = !1;
  6621. this._layerGroup = new L.LayerGroup;
  6622. if (!a.markerCount) a.markerCount = 0;
  6623. L.Util.extend(this, a);
  6624. if (b && b.retina && this.legend && this.legend.retinaUrl) this.legend.url = this.legend.retinaUrl;
  6625. if (b && b.retina && this.markerIcon && this.markerIcon.retinaUrl) this.markerIcon.url = this.markerIcon.retinaUrl;
  6626. this.setTopLevelMarkerIcon()
  6627. },
  6628. hasChildren: function () {
  6629. return 0 < this.children.length ? !0 : !1
  6630. },
  6631. hasParent: function () {
  6632. return this.hasOwnProperty("parentTypeSlug") ?
  6633. !0 : !1
  6634. },
  6635. addChild: function (a) {
  6636. this.children.push(a)
  6637. },
  6638. allChildren: function (a) {
  6639. jQuery.each(this.children, function (b, c) {
  6640. 0 < c.children.length && c.allChildren(a);
  6641. a.call(this, c)
  6642. })
  6643. },
  6644. eachChild: function (a) {
  6645. jQuery.each(this.children, function (b, c) {
  6646. a.call(this, c)
  6647. })
  6648. },
  6649. eachParent: function (a) {
  6650. this.parentType && (a.call(this, this.parentType), this.parentType.eachParent(a))
  6651. },
  6652. setTopLevelMarkerIcon: function () {
  6653. if (!(this.markerIcon && null != this.markerIcon.url)) {
  6654. var a = this;
  6655. this.hasParent() && this.eachParent(function (b) {
  6656. if (b.markerIcon &&
  6657. null != b.markerIcon.url) a.markerIcon = b.markerIcon
  6658. })
  6659. }
  6660. },
  6661. addMarker: function (a) {
  6662. this._layerGroup.addLayer(a);
  6663. this.markerCount++;
  6664. this.eachParent(function () {
  6665. this.markerCount++
  6666. })
  6667. },
  6668. removeMarker: function (a) {
  6669. this._layerGroup.removeLayer(a);
  6670. this.markerCount--;
  6671. this.eachParent(function () {
  6672. this.markerCount--
  6673. })
  6674. },
  6675. createIcon: function (a) {
  6676. var b = {};
  6677. 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];
  6678. if (a && 0 != a) b.badges = a;
  6679. return this.createMarkerIcon(b)
  6680. },
  6681. legendUrl: function () {
  6682. var a;
  6683. this.legend ? a = this.legend.url : this.eachParent(function (b) {
  6684. if (b.legend) a = b.legend.url
  6685. });
  6686. return a
  6687. }
  6688. });
  6689. if (!IGN) var IGN = {};
  6690. IGN.Marker = L.Marker.extend({
  6691. options: {
  6692. exists: !0,
  6693. displayBageCount: !1
  6694. },
  6695. includes: IGN.Mixins.MapsAPI,
  6696. initialize: function (a, b) {
  6697. if (!b.metadata) b.metadata = {};
  6698. if (!b.location) b.location = {
  6699. lat: a.lat,
  6700. lng: a.lng
  6701. };
  6702. L.Util.extend(this, b);
  6703. L.Marker.prototype.initialize.call(this, a, b);
  6704. this.updateIcon();
  6705. this._createStatics();
  6706. this._bindEvents();
  6707. this.state = this.STATES.NORMAL
  6708. },
  6709. updateIcon: function () {
  6710. var a = this.metadata.pendingCount,
  6711. a = this.displayBadgeCount ? a : 0;
  6712. try{
  6713. this.setIcon(this.type.createIcon(a))
  6714. } catch(e) {}
  6715. },
  6716. enableDragging: function () {
  6717. this.dragging.enable()
  6718. },
  6719. disableDragging: function () {
  6720. this.dragging.disable()
  6721. },
  6722. enableEditing: function () {
  6723. this._replicate();
  6724. this.state = this.STATES.EDIT;
  6725. this.closePopup();
  6726. this.enableDragging();
  6727. this.fireEvent("click")
  6728. },
  6729. disableEditing: function () {
  6730. this.state = this.STATES.NORMAL;
  6731. this.closePopup();
  6732. this._restoreFromReplicate();
  6733. this.options.exists && (this.updateIcon(), this.setLatLng([this.location.lat, this.location.lng]), this.disableDragging(), this.fireEvent("click"))
  6734. },
  6735. setType: function (a) {
  6736. this.type = a;
  6737. this.metadata.typeSlug = a.typeSlug;
  6738. this.updateIcon(a.createIcon())
  6739. },
  6740. duplicate: function () {
  6741. var a = {
  6742. metadata: {
  6743. markerName: this.metadata.markerName,
  6744. objectSlug: this.metadata.objectSlug,
  6745. mapSlug: this.metadata.mapSlug,
  6746. typeSlug: this.metadata.typeSlug,
  6747. wikiPage: this.metadata.wikiPage
  6748. },
  6749. location: {
  6750. lat: this.getLatLng().lat,
  6751. lng: this.getLatLng().lng
  6752. },
  6753. type: this.type,
  6754. exists: !1
  6755. };
  6756. return new IGN.Marker(new L.LatLng(this.getLatLng().lat, this.getLatLng().lng), a)
  6757. },
  6758. serviceCallSave: function () {
  6759. var a = this._map,
  6760. b, c;
  6761. c = this.options.exists ? this.API.ENDPOINT.MARKERS.PUT : this.API.ENDPOINT.MARKERS.POST;
  6762. b = {
  6763. objectSlug: this.metadata.objectSlug,
  6764. markerSlug: this.metadata.markerSlug,
  6765. lat: this.getLatLng().lat,
  6766. lng: this.getLatLng().lng,
  6767. wikiPage: this.metadata.wikiPage,
  6768. typeSlug: this.metadata.typeSlug,
  6769. createdBy: this.metadata.createdBy,
  6770. updatedBy: this.metadata.updatedBy,
  6771. markerName: this.metadata.markerName,
  6772. mapref: this.metadata.mapRef
  6773. };
  6774. this.callApi(c, b, function () {});
  6775. this.options.exists ? a.fireEvent("markerupdate", this) : a.fireEvent("markercreate", this);
  6776. a.overlayFilter && a.overlayFilter.removeMarker(this);
  6777. this.type.removeMarker(this);
  6778. this.type = a.types[this.metadata.typeSlug];
  6779. this.closePopup();
  6780. this.state = this.STATES.NORMAL;
  6781. this.type.addMarker(this);
  6782. this.disableDragging();
  6783. a.overlayFilter.addMarker(this);
  6784. a.fireEvent("changefilter", this.type);
  6785. this.options.exists = !0
  6786. },
  6787. serviceCallDelete: function () {
  6788. var a = this._map;
  6789. a.fireEvent("markerdelete", this);
  6790. this._removeFromMap();
  6791. a.fireEvent("redraw");
  6792. this.callApi(this.API.ENDPOINT.MARKERS.DELETE, {
  6793. markerSlug: this.metadata.markerSlug
  6794. }, function () {})
  6795. },
  6796. _createStatics: function () {
  6797. this.STATES = {
  6798. NORMAL: 1,
  6799. EDIT: 2,
  6800. PENDING: 3,
  6801. CLUSTER: 4
  6802. }
  6803. },
  6804. _removeFromMap: function () {
  6805. var a =
  6806. this._map;
  6807. this.type.removeMarker(this);
  6808. a.overlayFilter.removeMarker(this)
  6809. },
  6810. _bindEvents: function () {
  6811. var a, b, c;
  6812. if ("undefined" !== typeof IGN.PopupContent) this.on("click", function () {
  6813. var d = !1;
  6814. switch (this.state) {
  6815. case this.STATES.EDIT:
  6816. c = IGN.PopupContent.editContent;
  6817. d = !1;
  6818. break;
  6819. default:
  6820. c = IGN.PopupContent.content, d = !0
  6821. }
  6822. this._map.panTo(this.getLatLng());
  6823. this.bindPopup(c(this), {
  6824. autoPanPadding: new L.Point(5, 100),
  6825. autoPan: !0
  6826. }).openPopup();
  6827. if (this.wikiContent) IGN.PopupContent.updateWikiContent(this, this.wikiContent);
  6828. else if (d && "undefined" != typeof this.metadata.wikiPage) {
  6829. a = this;
  6830. a.metadata.wikiPage = a.metadata.wikiPage.replace("edit/", "").replace("empty/", "");
  6831. b = {
  6832. wiki: a.metadata.objectSlug,
  6833. page: a.metadata.wikiPage
  6834. };
  6835. if (a.metadata.createdBy) b.createdBy = a.metadata.createdBy;
  6836. if (a.metadata.updatedBy) b.updatedBy = a.metadata.updatedBy;
  6837. // this.callApi(this.API.ENDPOINT.WIKI, b, function (b) {
  6838. // a.wikiContent = IGN.PopupContent.wikiContent(a, b);
  6839. // a._popup._update()
  6840. // })
  6841. a.wikiContent = IGN.PopupContent.wikiContent(a, b);
  6842. a._popup._update()
  6843. } else this.wikiContent = IGN.PopupContent.wikiContent(this, "");
  6844. this._map.fireEvent("markerclick", {
  6845. marker: this
  6846. });
  6847. this._popup._update()
  6848. })
  6849. },
  6850. _replicate: function () {
  6851. 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
  6852. },
  6853. _restoreFromReplicate: function () {
  6854. if (this.options.exists) this.metadata.markerName = this._replicaMarkerName, this.metadata.wikiPage = this._replicaWikiPage, this.location.lat = this._replicaLat, this.location.lng =
  6855. this._replicaLng, this.metadata.typeSlug = this._replicaTypeSlug, this.type = this._map.types[this.metadata.typeSlug]
  6856. }
  6857. });
  6858. if (!IGN) var IGN = {};
  6859. IGN.PendingMarker = IGN.Marker.extend({
  6860. include: IGN.Mixins.API,
  6861. options: {
  6862. pendingAction: "edit"
  6863. },
  6864. initialize: function (a, b) {
  6865. L.Util.extend(this.options, b);
  6866. IGN.Marker.prototype.initialize.call(this, a, b)
  6867. },
  6868. compareTo: function (a) {
  6869. var b = {};
  6870. if (this.metadata.markerName != a.metadata.markerName) b.markerName = a.metadata.markerName;
  6871. if (this.metadata.wikiPage != a.metadata.wikiPage) b.wikiPage = a.metadata.wikiPage;
  6872. if (this.metadata.typeSlug != a.metadata.typeSlug) b.typeSlug = a.metadata.typeSlug;
  6873. if (this.metadata.mapRef != a.metadata.mapRef) b.mapRef =
  6874. a.metadata.mapRef ? a.metadata.mapRef : "None";
  6875. if (this.location.lat != a.location.lat || this.location.lng != a.location.lng) b.location = a.location;
  6876. return b
  6877. },
  6878. decline: function () {
  6879. var a = this._map;
  6880. a.removeLayer(this);
  6881. this._originalMarker && (this._originalMarker.metadata.pendingCount--, this._originalMarker.updateIcon());
  6882. this.serviceCallDecline();
  6883. this._finalizeAcceptOrDecline(a)
  6884. },
  6885. accept: function () {
  6886. var a = this._map;
  6887. this.options.pendingAction == this.PENDING_STATES.EDIT ? this._acceptEdit() : this.options.pendingAction == this.PENDING_STATES.CREATE ?
  6888. this._acceptCreate() : this.options.pendingAction == this.PENDING_STATES.DELETE && this._acceptDelete();
  6889. this._finalizeAcceptOrDecline(a)
  6890. },
  6891. serviceCallDecline: function () {
  6892. this.callApi(this.API.ENDPOINT.MARKERS.PENDING.DECLINE, {
  6893. pendingUUID: this.pendingMarkerUUID
  6894. }, function () {})
  6895. },
  6896. _createStatics: function () {
  6897. this.PENDING_STATES = {
  6898. CREATE: "create",
  6899. EDIT: "edit",
  6900. DELETE: "delete"
  6901. };
  6902. IGN.Marker.prototype._createStatics.call(this)
  6903. },
  6904. _bindEvents: function () {
  6905. var a;
  6906. this.on("click", function () {
  6907. a = this.options.pendingAction == this.PENDING_STATES.DELETE ?
  6908. IGN.PopupContent.pendingDelete : IGN.PopupContent.editContent;
  6909. if (this._originalMarker) this._differences = this.compareTo(this._originalMarker);
  6910. this.bindPopup(a(this)).openPopup();
  6911. this._map.fireEvent("markerclick", {
  6912. marker: this
  6913. })
  6914. })
  6915. },
  6916. _acceptEdit: function () {
  6917. this._originalMarker.metadata.markerName = this.metadata.markerName;
  6918. this._originalMarker.metadata.wikiPage = this.metadata.wikiPage;
  6919. this._originalMarker.metadata.typeSlug = this.metadata.typeSlug;
  6920. this._originalMarker.type = this.type;
  6921. this._originalMarker.metadata.mapRef =
  6922. this.metadata.mapRef;
  6923. this._originalMarker.metadata.updatedBy = this.metadata.updatedBy;
  6924. this._originalMarker.setLatLng(this.getLatLng());
  6925. this._originalMarker.serviceCallSave();
  6926. this._originalMarker.metadata.pendingCount--;
  6927. this._originalMarker.updateIcon();
  6928. this._originalMarker.state = this._originalMarker.STATES.NORMAL;
  6929. this.serviceCallDecline()
  6930. },
  6931. _acceptCreate: function () {
  6932. var a = {
  6933. exists: !1
  6934. },
  6935. b = this._map;
  6936. a.type = this.type;
  6937. a.metadata = this.metadata;
  6938. a.metadata.pendingCount = 0;
  6939. a.metadata.createdBy = this.metadata.createdBy;
  6940. a.location = this.location;
  6941. a = new IGN.Marker(this.getLatLng(), a);
  6942. b.addLayer(a);
  6943. a.serviceCallSave();
  6944. this.serviceCallDecline()
  6945. },
  6946. _acceptDelete: function () {
  6947. var a = this._map;
  6948. this._originalMarker.serviceCallDelete();
  6949. this.serviceCallDelete();
  6950. a.fireEvent("disablemoderation")
  6951. },
  6952. _finalizeAcceptOrDecline: function (a) {
  6953. this._originalMarker && 0 >= this._originalMarker.metadata.pendingCount && (a.fireEvent("changefilter", this._originalMarker.type), a.fireEvent("disablemoderation"), a.fireEvent("redraw"));
  6954. this._moderationListLink &&
  6955. jQuery(this._moderationListLink).slideUp("fast");
  6956. a.removeLayer(this)
  6957. }
  6958. });
  6959. if (!IGN) var IGN = {};
  6960. IGN.MarkerClusterGroup = L.MarkerClusterGroup.extend({
  6961. includes: IGN.Mixins.Icons,
  6962. initialize: function (a) {
  6963. var c = this,
  6964. b = {
  6965. zoomToBoundsOnClick: !1,
  6966. showCoverageOnHover: !1,
  6967. spiderfyOnMaxZoom: !1,
  6968. disableClusteringAtZoom: 3,
  6969. maxClusterRadius: 80,
  6970. animateAddingMarkers: !1,
  6971. iconCreateFunction: function () {
  6972. return new c.createDefaultClusterIcon(c.options)
  6973. }
  6974. };
  6975. L.Util.extend(b, a);
  6976. L.Util.extend(this, b);
  6977. L.MarkerClusterGroup.prototype.initialize.call(this, b)
  6978. },
  6979. removeLayer: function (a) {
  6980. if (!a.__parent) return this;
  6981. this._unspiderfy && (this._unspiderfy(),
  6982. this._unspiderfyLayer(a));
  6983. this._removeLayer(a, !0);
  6984. a._icon && (L.FeatureGroup.prototype.removeLayer.call(this, a), a.setOpacity(1));
  6985. return this
  6986. }
  6987. });
  6988. if (!IGN) var IGN = {};
  6989. if (!IGN.PopupContent) IGN.PopupContent = {};
  6990. IGN.PopupContent.clusterContent = function (b) {
  6991. var i = 0,
  6992. c, j, k, d, a, e, f, l, g, h;
  6993. e = b.layer;
  6994. f = e._map;
  6995. a = e.getAllChildMarkers();
  6996. b = L.DomUtil.create("div", "cluster-popup-holder");
  6997. c = L.DomUtil.create("h3", "cluster-headline", b);
  6998. l = a[0].type.legendUrl();
  6999. g = {
  7000. count: a.length,
  7001. data: []
  7002. };
  7003. jQuery.each(a, function (a, b) {
  7004. g.data.push({
  7005. metadata: b.metadata
  7006. })
  7007. });
  7008. h = escape(JSON.stringify(g));
  7009. jQuery(c).html('<img src="' + l + '" class="legend-icon"><a href="mapsIphoneClusterJson://' + h + '" class="leaflet-popup-iphone-more"></a><span class="cluster-title">' +
  7010. a.length + ' markers at this location:</span><span class="cluster-title-ios"><a href="mapsIphoneClusterJson://' + h + '">' + a.length + " markers at this location</span>");
  7011. j = L.DomUtil.create("ul", "marker-list", b);
  7012. jQuery.each(a, function (a, b) {
  7013. k = L.DomUtil.create("li", null, j);
  7014. d = L.DomUtil.create("a", null, k);
  7015. jQuery(d).html(b.metadata.markerName);
  7016. jQuery(d).data("marker", b);
  7017. jQuery(d).click(function (a) {
  7018. var b = jQuery(this).data("marker");
  7019. f.fireEvent("changefilter", b.type);
  7020. f.fireEvent("activatemarker", f.markers[b.metadata.markerSlug]);
  7021. a.stopPropagation();
  7022. a.preventDefault()
  7023. });
  7024. i++;
  7025. if (3 <= i) return !1
  7026. });
  7027. a = a.length - 3;
  7028. 0 < a && (c = L.DomUtil.create("div", "cluster-desc", b), jQuery(c).html("\u2026and " + a + " others."));
  7029. c = L.DomUtil.create("a", "btn btn-inverse zoom-in-btn", b);
  7030. jQuery(c).html("Zoom In");
  7031. a = L.DomUtil.create("span", "see-all-markers", b);
  7032. jQuery(a).html(" to see all markers.");
  7033. jQuery(c).click(function (a) {
  7034. e.zoomToBounds();
  7035. a.stopPropagation();
  7036. a.preventDefault()
  7037. });
  7038. return b
  7039. };
  7040. if (!IGN) var IGN = {};
  7041. if (!IGN.PopupContent) IGN.PopupContent = {};
  7042. IGN.PopupContent.content = function (b) {
  7043. var cur = b.metadata.markerSlug;
  7044. var mdata = b._map.markers;
  7045. var curData = mdata[cur] || {};
  7046. var d = b._map,
  7047. a, c, e, f;
  7048. e = "http://www.ign.com/wikis/" + b.metadata.objectSlug + "/" + b.metadata.wikiPage;
  7049. a = L.DomUtil.create("div", "popup-holder");
  7050. b._map.options.editable && IGN.PopupContent._editButtons(a, b);
  7051. c = L.DomUtil.create("span", "headline", a);
  7052. wikicontent = L.DomUtil.create("div", b.metadata.markerSlug + "-wikicontent interactivemap-wikicontent", a);
  7053. var ltitle = curData.metadata.title || b.metadata.markerName;
  7054. f = b.type.legendUrl();
  7055. 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>");
  7056. L.DomUtil.create("div", "interactivemap-popupLoading", wikicontent);
  7057. b.metadata.mapRef;
  7058. 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'),
  7059. jQuery(duplicateButton).on("click", function (a) {
  7060. var c = b.duplicate();
  7061. c.addTo(d);
  7062. c.enableEditing();
  7063. a.preventDefault();
  7064. a.stopPropagation()
  7065. }));
  7066. L.DomUtil.create("div", "clearfix", a);
  7067. return a
  7068. };
  7069. IGN.PopupContent._editButtons = function (b, d) {
  7070. var a;
  7071. a = L.DomUtil.create("div", "edit-controls", b);
  7072. a = L.DomUtil.create("a", "button-edit", a);
  7073. L.DomUtil.create("i", "icon icon-white icon-edit", a);
  7074. jQuery(a).attr("title", "Edit").tooltip({
  7075. placement: "top"
  7076. });
  7077. jQuery(a).click(function (a) {
  7078. d.enableEditing();
  7079. jQuery(this).tooltip("hide");
  7080. a.preventDefault();
  7081. a.stopPropagation()
  7082. })
  7083. };
  7084. if (!IGN) var IGN = {};
  7085. if (!IGN.PopupContent) IGN.PopupContent = {};
  7086. IGN.PopupContent.editContent = function (d) {
  7087. var a, e;
  7088. a = L.DomUtil.create("div", "popup-holder");
  7089. e = L.DomUtil.create("h5", "editing-headline", a);
  7090. 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 ?
  7091. jQuery(e).html("Editing: " + d.metadata.markerName) : jQuery(e).html("新的标记");
  7092. IGN.PopupContent._editForm(a, d);
  7093. return a
  7094. };
  7095. IGN.PopupContent._editForm = function (d, a) {
  7096. var e = a._map,
  7097. c, f, b, j, h, l, g, i, m, q, n, o, k, p;
  7098. c = L.DomUtil.create("form", "edit-form", d);
  7099. f = jQuery('<input type="text" placeholder="输入标记名称">');
  7100. jQuery(f).appendTo(c);
  7101. a.metadata && a.metadata.markerName && jQuery(f).val(a.metadata.markerName);
  7102. 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 + '"'));
  7103. h = L.DomUtil.create("label", "label-with-module-selector",
  7104. c);
  7105. jQuery(h).html("选择标记分类");
  7106. p = L.DomUtil.create("div", "category-selector", c);
  7107. h = L.DomUtil.create("div", "ign-leaflet-module", p);
  7108. b = L.DomUtil.create("a", "category-button main-selector", h);
  7109. jQuery(b).html(a.type.typeName);
  7110. L.DomUtil.create("span", "red-arrow", b);
  7111. k = L.DomUtil.create("ul", "dropdown-menu general-dropdown-menu category-field-list", p);
  7112. IGN.PopupContent._typeSelector(b, k, k, e.types, a);
  7113. jQuery(b).click(function (a) {
  7114. jQuery(k).is(":visible") ? jQuery(k).hide() : jQuery(k).show();
  7115. a.preventDefault();
  7116. a.stopPropagation()
  7117. });
  7118. 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 + '"'));
  7119. // b = L.DomUtil.create("label", "label-with-module-selector wiki-label", c);
  7120. // jQuery(b).html("Wiki Page");
  7121. // j = jQuery('<input type="text" class="right-aligned">');
  7122. // jQuery(j).appendTo(c);
  7123. a.metadata && a.metadata.wikiPage && jQuery(j).val(a.metadata.wikiPage);
  7124. a.state == a.STATES.PENDING && a._differences && a._differences.wikiPage && (wikiDifference =
  7125. L.DomUtil.create("span", "help-block marker-difference-label", c), jQuery(wikiDifference).html('Was "' + a._differences.wikiPage + '"'));
  7126. g = L.DomUtil.create("div", "dropdown-menu url-dropdown-menu general-dropdown-menu related-wiki-page-dropdown", d);
  7127. jQuery(j).keyup(function () {
  7128. clearTimeout(i);
  7129. m = jQuery(this).val();
  7130. a.metadata.wikiPage = m;
  7131. q = {
  7132. objectSlug: e.metadata.objectSlug,
  7133. mapSlug: e.metadata.mapSlug,
  7134. lookup: m
  7135. };
  7136. i = setTimeout(function () {
  7137. IGN.Mixins.MapsAPI.callApi(IGN.Mixins.MapsAPI.API.ENDPOINT.WIKI_PAGE, q, function (b) {
  7138. jQuery(g).empty();
  7139. b && b.query && b.query.allpages && (jQuery.each(b.query.allpages, function (b, c) {
  7140. n = L.DomUtil.create("a", null, g);
  7141. jQuery(n).html(c.title);
  7142. jQuery(n).click(function (b) {
  7143. jQuery(j).val(c.title);
  7144. a.metadata.wikiPage = c.title;
  7145. jQuery(g).hide();
  7146. b.preventDefault();
  7147. b.stopPropagation()
  7148. })
  7149. }), o = L.DomUtil.create("a", null, g), jQuery(o).html('<i class="icon icon-white icon-remove"></i> Cancel'), jQuery(o).click(function (a) {
  7150. jQuery(g).hide();
  7151. a.preventDefault();
  7152. a.stopPropagation()
  7153. }), jQuery(g).show())
  7154. })
  7155. }, 200)
  7156. });
  7157. // b = L.DomUtil.create("label",
  7158. // "map-label", c);
  7159. // jQuery(b).html("External map");
  7160. // l = L.DomUtil.create("select", null, c);
  7161. e.relatedMaps(function (b) {
  7162. IGN.PopupContent._mapSelector(l, b, a)
  7163. });
  7164. 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 + '"'));
  7165. 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:" +
  7166. a._differences.location.lat + ", lng:" + a._differences.location.lng + ""));
  7167. L.DomUtil.create("div", "clearfix mb30", c);
  7168. jQuery(f).change(function () {
  7169. a.metadata.markerName = jQuery(this).val()
  7170. });
  7171. jQuery(j).change(function () {
  7172. a.metadata.wikiPage = jQuery(this).val()
  7173. });
  7174. jQuery(h).change(function () {
  7175. a.metadata.typeSlug = jQuery(this).val()
  7176. });
  7177. jQuery(l).change(function () {
  7178. a.metadata.mapRef = jQuery(this).val()
  7179. });
  7180. a.state == a.STATES.EDIT ? (f = L.DomUtil.create("a", "btn", c), jQuery(f).html("取消"), jQuery(f).click(function (b) {
  7181. a.disableEditing();
  7182. a.options.exists || e.removeLayer(a);
  7183. b.preventDefault();
  7184. b.stopPropagation()
  7185. }), 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) {
  7186. confirm("Are you sure you want to delete this marker?") && a.serviceCallDelete();
  7187. b.preventDefault();
  7188. b.stopPropagation()
  7189. })), f = L.DomUtil.create("a", "btn btn-primary pull-right gray-btn-right-arrow", c), jQuery(f).html(" 保存点标 "), jQuery(f).click(function (b) {
  7190. a.serviceCallSave();
  7191. a.wikiContent = !1;
  7192. b.preventDefault();
  7193. b.stopPropagation()
  7194. })) : a.state == a.STATES.PENDING && (f = L.DomUtil.create("a", "btn btn-danger", c), jQuery(f).html("Decline"), jQuery(f).click(function (b) {
  7195. a.decline();
  7196. b.preventDefault();
  7197. b.stopPropagation()
  7198. }), f = L.DomUtil.create("a", "btn btn-primary pull-right", c), jQuery(f).html("Accept"), jQuery(f).click(function (b) {
  7199. a.accept();
  7200. b.preventDefault();
  7201. b.stopPropagation()
  7202. }));
  7203. jQuery(c).on("submit", function (a) {
  7204. a.preventDefault();
  7205. a.stopPropagation()
  7206. })
  7207. };
  7208. IGN.PopupContent._mapSelector = function (d, a, e) {
  7209. var c;
  7210. c = L.DomUtil.create("option", null, d);
  7211. jQuery(c).html("None");
  7212. "undefined" !== typeof a && jQuery.each(a, function (a, b) {
  7213. if (!b.metadata.status || "published" != b.metadata.status) return !0;
  7214. 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))
  7215. })
  7216. };
  7217. IGN.PopupContent._typeSelector = function (d, a, e, c, f) {
  7218. var b;
  7219. b = function (c, h) {
  7220. var e, g, i;
  7221. e = jQuery("<li></li>");
  7222. g = jQuery("<a>" + h.typeName + "</a>");
  7223. f.type.typeSlug == h.typeSlug && (jQuery("a", a).removeClass("active"), g.addClass("active"));
  7224. h.legend && h.legend.url ? (jQuery('<img src="' + h.legend.url + '" />').prependTo(g), g.addClass("icon")) : g.addClass("no-icon");
  7225. h.hasChildren() && jQuery('<span class="icon icon-white icon-chevron-right pull-right"></span>').appendTo(g);
  7226. jQuery('<span class="clearfix"></span>').appendTo(g);
  7227. g.appendTo(e);
  7228. g.data("type", h);
  7229. i = jQuery('<ul class="children"></ul>');
  7230. jQuery(i).appendTo(e);
  7231. h.eachChild(function (a) {
  7232. jQuery(b(i, a)).appendTo(i)
  7233. });
  7234. e.appendTo(c);
  7235. g.click(function (b) {
  7236. var c = jQuery(this).data("type");
  7237. if (c.hasChildren()) {
  7238. var c = jQuery(".children:first", e),
  7239. h = jQuery(".icon:first", g);
  7240. 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"))
  7241. } else jQuery("a", a).removeClass("active"),
  7242. g.addClass("active"), jQuery(a).hide(), f.setType(c), f.enableDragging(), jQuery(d).html(c.typeName), L.DomUtil.create("span", "red-arrow", d);
  7243. b.preventDefault();
  7244. b.stopPropagation()
  7245. })
  7246. };
  7247. jQuery.each(c, function (a, c) {
  7248. c.hasParent() || b(e, c)
  7249. })
  7250. };
  7251. if (!IGN) var IGN = {};
  7252. if (!IGN.PopupContent) IGN.PopupContent = {};
  7253. IGN.PopupContent.wikiContent = function (e, a) {
  7254. var cur = e.metadata.markerSlug;
  7255. var mdata = e._map.markers;
  7256. var curData = mdata[cur] || {};
  7257. var f = 0,
  7258. h = 0,
  7259. b, i, c, d, j, k, g;
  7260. c = L.DomUtil.create("div", "internal-container");
  7261. 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>');
  7262. if(curData.metadata.vid) {
  7263. var vmap = {};
  7264. vmap[curData.metadata.vid] = {
  7265. place : '#video1',
  7266. tpl : '<div><video id="mainPlayer" width="340" height="191" controls preload="meta" poster="{video_cover}"></video></div>',
  7267. playerOptions : {
  7268. loop : false,
  7269. autoplay : false,
  7270. pauseOtherPlayers : true
  7271. },
  7272. onFinish : function(context){
  7273. }
  7274. }
  7275. new VhuyaPlayerPlacer(vmap);
  7276. }
  7277. // b = L.DomUtil.create("div", "interactivemap-popupDescription", c);
  7278. // jQuery(b).html(a.description);
  7279. // 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] +
  7280. // '" 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) {
  7281. // f++;
  7282. // if (1 >= f) jQuery('<a href="' +
  7283. // href + '" class="interactivemap-popupImage" style="background: #000 url(\'' + b.thumburl + '\') no-repeat center;" target="_top"></a>').appendTo(i);
  7284. // else return !1
  7285. // }));
  7286. // 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) {
  7287. // k = L.DomUtil.create("li", null, j);
  7288. // g = L.DomUtil.create("a", null, k);
  7289. // jQuery(g).attr("href", "/wikis/" + e.metadata.objectSlug + "/" + a.relatedPages[b]);
  7290. // jQuery(g).html(a.relatedPages[b]);
  7291. // h++;
  7292. // if (6 <= h) return !1
  7293. // }));
  7294. // // b = L.DomUtil.create("div", "social-holder", c);
  7295. // a.createdBy
  7296. // 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),
  7297. // jQuery(b).attr("href", a.updatedBy.url), jQuery(b).attr("target", "_top"));
  7298. IGN.PopupContent.updateWikiContent(e, c);
  7299. return c
  7300. };
  7301. IGN.PopupContent.updateWikiContent = function (e, a) {
  7302. var f = jQuery("." + e.metadata.markerSlug + "-wikicontent");
  7303. 0 < f.length && jQuery(f).empty().append(a)
  7304. };
  7305. if (!IGN) var IGN = {};
  7306. if (!IGN.PopupContent) IGN.PopupContent = {};
  7307. IGN.PopupContent.pendingDelete = function (b) {
  7308. var a, c;
  7309. a = L.DomUtil.create("div", "popup-holder");
  7310. c = L.DomUtil.create("h5", "editing-headline pending-delete", a);
  7311. headlineContent = "Pending delete";
  7312. "undefined" != typeof b.updatedBy.name && (headlineContent += " by " + b.updatedBy.name);
  7313. jQuery(c).html(headlineContent);
  7314. c = L.DomUtil.create("span", "pending-delete-marker-title", a);
  7315. jQuery(c).html(b.metadata.markerName);
  7316. cancelButton = L.DomUtil.create("a", "btn btn-large btn-danger", a);
  7317. jQuery(cancelButton).html("Decline");
  7318. jQuery(cancelButton).click(function (a) {
  7319. b.decline();
  7320. a.preventDefault();
  7321. a.stopPropagation()
  7322. });
  7323. applyButton = L.DomUtil.create("a", "btn btn-primary btn-large pull-right", a);
  7324. jQuery(applyButton).html("Accept");
  7325. jQuery(applyButton).click(function (a) {
  7326. b.accept();
  7327. a.preventDefault();
  7328. a.stopPropagation()
  7329. });
  7330. return a
  7331. };
  7332. if (!IGN) var IGN = {};
  7333. IGN.Map = L.Map.extend({
  7334. includes: IGN.Mixins.MapsAPI,
  7335. initialize: function (c, b, a) {
  7336. var d = {},
  7337. e = this;
  7338. L.Util.extend(this, b);
  7339. this.maxBounds = new L.LatLngBounds(new L.LatLng(0, 0), new L.LatLng(-b.mapInfo.height, b.mapInfo.width));
  7340. d = {
  7341. zoom: 2,
  7342. minZoom: 1,
  7343. maxZoom: b.mapInfo.maxZoom,
  7344. scrollWheelZoom: !0,
  7345. zoomControl: !1,
  7346. center: new L.LatLng(-b.mapInfo.height / 2, b.mapInfo.width / 2),
  7347. crs: L.Util.extend({}, L.CRS, {
  7348. code: "simple",
  7349. projection: L.Projection.LonLat,
  7350. transformation: new L.Transformation(1, 0, -1, 0)
  7351. }),
  7352. worldCopyJump: !1,
  7353. unloadInvisibleTiles: a.unloadInvisibleTiles,
  7354. trackResize: !0,
  7355. attributionControl: !1,
  7356. closePopupOnClick: !1,
  7357. retina: a.retina,
  7358. editable: a.editable,
  7359. moderator: a.moderator,
  7360. filter: a.filter,
  7361. externalLink: a.externalLink,
  7362. clusters: {
  7363. enabled: a.clusters.enabled,
  7364. clusterRadius: a.clusters.clusterRadius,
  7365. disableClusteringAtZoom: a.clusters.disableClusteringAtZoom
  7366. },
  7367. controls: {
  7368. title: a.controls.title,
  7369. fullscreen: a.controls.fullscreen,
  7370. slidingview: a.controls.slidingview,
  7371. search: a.controls.search,
  7372. filters: a.controls.filters,
  7373. addMarker: a.controls.addMarker
  7374. }
  7375. };
  7376. L.Map.prototype.initialize.call(this,
  7377. c, d);
  7378. (new L.Control.Zoom({
  7379. position: "topright"
  7380. })).addTo(this);
  7381. L.tileLayer(b.mapInfo.tilesets[0], {
  7382. continuousWorld: !1,
  7383. noWrap: !0
  7384. }).addTo(this);
  7385. this.on("moveend", function () {
  7386. this._checkBounds()
  7387. });
  7388. jQuery(document).ready(function () {
  7389. jQuery(window).resize(function () {
  7390. e.fireEvent("resize")
  7391. })
  7392. })
  7393. },
  7394. _checkBounds: function () {
  7395. if (!this.maxBounds.contains(this.getCenter())) {
  7396. var c = this.getCenter(),
  7397. b = c.lng,
  7398. c = c.lat,
  7399. a = this.maxBounds.getNorthEast().lng,
  7400. d = this.maxBounds.getNorthEast().lat,
  7401. e = this.maxBounds.getSouthWest().lng,
  7402. f = this.maxBounds.getSouthWest().lat;
  7403. b < e && (b = e);
  7404. b > a && (b = a);
  7405. c < f && (c = f);
  7406. c > d && (c = d);
  7407. this.setView(new L.LatLng(c, b), this.getZoom())
  7408. }
  7409. }
  7410. });
  7411. if (!IGN) var IGN = {};
  7412. IGN.InteractiveMap = IGN.Map.extend({
  7413. includes: IGN.Mixins.Types,
  7414. initialize: function (a, b, c) {
  7415. IGN.Map.prototype.initialize.call(this, a, b, c);
  7416. this._bindEvents();
  7417. this._addControls()
  7418. },
  7419. _bindEvents: function () {
  7420. var a = this;
  7421. this.on("load", this.initTypes(this.mapInfo.types));
  7422. this.on("activatemarker", function (b) {
  7423. a.activateMarker(b)
  7424. });
  7425. this.on("typesloaded", this._zoomIn(mapOptions.zoomIn))
  7426. },
  7427. _addControls: function () {
  7428. var a = {
  7429. display: !0,
  7430. retina: this.options.retina,
  7431. clusters: this.options.clusters
  7432. };
  7433. if (!this.options.controls.filters) a.display = !1;
  7434. this.overlayFilter = new IGN.Control.OverlayFilter(this.types, a);
  7435. this.addControl(this.overlayFilter);
  7436. this.options.controls.fullscreen && this.addControl(new IGN.Control.FullscreenToggle({
  7437. position: "topright"
  7438. }));
  7439. this.options.controls.title && this.addControl(new IGN.Control.MapTitle(this.metadata.mapName));
  7440. this.persistentFilter = new IGN.Control.Persistence;
  7441. this.addControl(this.persistentFilter);
  7442. // 添加是否能加点标权限
  7443. this.addControl(new IGN.Control.MarkerAdder);
  7444. this.options.controls.slidingview &&
  7445. (this.addControl(new IGN.Control.SlidingView), this.on("filter", function (a) {
  7446. this.fireEvent("slidingview", {
  7447. type: a.type
  7448. })
  7449. }));
  7450. this.addControl(new IGN.Control.LoadingIndicator);
  7451. this.fireEvent("hideloadingindicator");
  7452. this.options.controls.search && this.addControl(new IGN.Control.SearchBar);
  7453. if (this.options.moderator) this.moderation = new IGN.Control.Moderation, this.addControl(this.moderation);
  7454. this.options.filter && this.types[this.options.filter] && this.fireEvent("changefilter", this.types[this.options.filter]);
  7455. this.addControl(new IGN.Control.EventTracker);
  7456. if (this.options.externalLink) this.externalLink = new IGN.Control.ExternalLink({
  7457. linkTo: "http://www.ign.com/maps/" + this.metadata.objectSlug + "/" + this.metadata.mapSlug,
  7458. text: "View on IGN"
  7459. }), this.addControl(this.externalLink);
  7460. this.fireEvent("controlsloaded")
  7461. },
  7462. _zoomIn: function (a) {
  7463. !0 == a && this.zoomIn()
  7464. }
  7465. });
  7466. IGN.InteractiveMap.include(IGN.Mixins.Maps);
  7467. IGN.InteractiveMap.include(IGN.Mixins.Markers);
  7468. if (!IGN) var IGN = {};
  7469. if (!IGN.Control) IGN.Control = {};
  7470. IGN.Control.FullscreenToggle = L.Control.extend({
  7471. statics: {
  7472. DISPLAY: {
  7473. NORMALSTATE: 1,
  7474. FULLSTATE: 2
  7475. }
  7476. },
  7477. options: {
  7478. position: "bottomright"
  7479. },
  7480. initialize: function (b) {
  7481. L.Util.setOptions(this, b);
  7482. this.displayState = IGN.Control.FullscreenToggle.DISPLAY.NORMALSTATE
  7483. },
  7484. onAdd: function (b) {
  7485. var a = this,
  7486. c;
  7487. c = L.DomUtil.create("a", "fullscreen-container btn");
  7488. L.DomUtil.create("span", "fullscreen-icon go-fullscreen", c);
  7489. this.containerId = b._container.id;
  7490. this.parentElement = jQuery(b._container).parent();
  7491. this.originalClientSize = {
  7492. width: b._container.clientWidth,
  7493. height: b._container.clientHeight
  7494. };
  7495. jQuery(c).live("click", function (c) {
  7496. 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"));
  7497. b.fireEvent("resize");
  7498. c.stopPropagation();
  7499. c.preventDefault()
  7500. });
  7501. b.on("enablefullscreen", function () {
  7502. jQuery("body > :not(#" + a.containerId + ", .tooltip)").hide();
  7503. jQuery("#" + a.containerId).appendTo("body").css({
  7504. position: "absolute",
  7505. top: 0,
  7506. left: 0,
  7507. right: 0,
  7508. bottom: 0,
  7509. height: "100%",
  7510. "z-index": 100
  7511. });
  7512. a._map.invalidateSize()
  7513. });
  7514. b.on("disablefullscreen", function () {
  7515. jQuery("body > :not(#" + a.containerId + ",#sugarad-stitial-overlay)").show();
  7516. jQuery("#stitialV2").hide();
  7517. jQuery("#" + a.containerId).prependTo(a.parentElement).css({
  7518. position: "relative",
  7519. height: a.originalClientSize.height + "px",
  7520. "z-index": "auto"
  7521. });
  7522. a._map.invalidateSize()
  7523. });
  7524. return c
  7525. }
  7526. });
  7527. if (!IGN) var IGN = {};
  7528. if (!IGN.Control) IGN.Control = {};
  7529. IGN.Control.SlidingView = L.Control.extend({
  7530. options: {
  7531. position: "bottomleft"
  7532. },
  7533. initialize: function (a) {
  7534. L.Util.setOptions(this, a)
  7535. },
  7536. onAdd: function (a) {
  7537. var e = this,
  7538. c = L.DomUtil.create("div", "sliding-menu");
  7539. if (L.Browser.touch) L.DomEvent.on(c, "click", L.DomEvent.stopPropagation);
  7540. else L.DomEvent.disableClickPropagation(c);
  7541. jQuery(c).width(a._container.clientWidth);
  7542. a.on("hideslidingview", function () {
  7543. jQuery(c).slideUp("fast")
  7544. });
  7545. a.on("showslidingview", function () {
  7546. jQuery(c).slideDown("fast")
  7547. });
  7548. a.on("showall", function () {
  7549. a.fireEvent("hideslidingview");
  7550. 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) {
  7551. a.fireEvent("loadandshowkorokseeds");
  7552. b.stopPropagation();
  7553. b.preventDefault()
  7554. }), a.fireEvent("showslidingview")
  7555. });
  7556. a.on("slidingview", function (b) {
  7557. var d = new String;
  7558. b.message ? d += b.message : b.type && b.totalMarkers ? d += "当前正在显示:" + b.type.typeName +
  7559. " 的标记 " : b.type && (d += "当前正在显示:" + b.type.typeName + " 的标记 ");
  7560. jQuery(c).html(d);
  7561. 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) {
  7562. a.fireEvent("loadandshowall");
  7563. a.fireEvent("hideslidingview");
  7564. b.stopPropagation();
  7565. b.preventDefault()
  7566. });
  7567. a.fireEvent("showslidingview")
  7568. });
  7569. a.on("resize", function () {
  7570. jQuery(c).width(a._container.clientWidth)
  7571. });
  7572. return c
  7573. }
  7574. });
  7575. if (!IGN) var IGN = {};
  7576. if (!IGN.Control) IGN.Control = {};
  7577. IGN.Control.MapTitle = L.Control.extend({
  7578. options: {
  7579. position: "topright"
  7580. },
  7581. initialize: function (d, a) {
  7582. this.mapName = d;
  7583. L.Util.setOptions(this, a)
  7584. },
  7585. onAdd: function (d) {
  7586. var a, e, b, f;
  7587. a = L.DomUtil.create("div", "leaflet-map-title");
  7588. e = L.DomUtil.create("a", "title", a);
  7589. jQuery(e).html(this.mapName);
  7590. L.DomUtil.create("i", "icon icon-chevron-down icon-white", e);
  7591. b = L.DomUtil.create("div", "inline-dropdown", a);
  7592. jQuery(e).click(function (a) {
  7593. jQuery(b).is(":visible") ? jQuery(b).slideUp("fast") : (jQuery(b).empty(), d.relatedMaps(function (a) {
  7594. jQuery.each(a,
  7595. function (a, c) {
  7596. if (c.metadata.mapSlug == d.metadata.mapSlug || !c.metadata.status || "published" != c.metadata.status) return !0;
  7597. f = L.DomUtil.create("a", "external-map-link", b);
  7598. jQuery(f).html(c.metadata.mapName);
  7599. jQuery(f).attr("href", "http://www.ign.com/maps/" + c.metadata.objectSlug + "/" + c.metadata.mapSlug);
  7600. jQuery(f).attr("target", "_top")
  7601. });
  7602. jQuery(b).slideDown("fast")
  7603. }), a.stopPropagation(), a.preventDefault())
  7604. });
  7605. return a
  7606. }
  7607. });
  7608. if (!IGN) var IGN = {};
  7609. if (!IGN.Control) IGN.Control = {};
  7610. IGN.Control.LoadingIndicator = L.Control.extend({
  7611. options: {
  7612. position: "bottomleft",
  7613. overlay: !0,
  7614. height: 300,
  7615. width: 300
  7616. },
  7617. initialize: function (c) {
  7618. L.Util.setOptions(this, c)
  7619. },
  7620. onAdd: function (c) {
  7621. this._map = c;
  7622. var a = this;
  7623. this.container = L.DomUtil.create("div", "leaflet-control-loading-indicator");
  7624. this.overlay = L.DomUtil.create("div", "loading-overlay", this.container);
  7625. this.progressHolder = L.DomUtil.create("div", "progress-holder", this.overlay);
  7626. this.progressText = L.DomUtil.create("span", "progress-text", this.progressHolder);
  7627. jQuery(this.progressText).html("Loading\u2026");
  7628. this.progress = L.DomUtil.create("div", "progress progress-striped", this.progressHolder);
  7629. this.progressBar = L.DomUtil.create("div", "bar", this.progress);
  7630. this._reset();
  7631. this._map.on("updateloadingindicator", function (b) {
  7632. b.text && jQuery(a.progressText).html(b.text);
  7633. b.percent && jQuery(a.progressBar).css({
  7634. width: b.percent + "%"
  7635. });
  7636. a._map.fireEvent("showprogressindicator")
  7637. });
  7638. this._map.on("hideloadingindicator", function () {
  7639. jQuery(a.container).hide()
  7640. });
  7641. this._map.on("showloadingindicator",
  7642. function () {
  7643. jQuery(a.container).show()
  7644. });
  7645. return this.container
  7646. },
  7647. _reset: function () {
  7648. jQuery(this.overlay).css({
  7649. width: this._map._container.clientWidth,
  7650. height: this._map._container.clientHeight
  7651. });
  7652. jQuery(this.progressHolder).css({
  7653. width: this.options.width,
  7654. height: this.options.height,
  7655. "padding-top": this._map._container.clientHeight - this.options.height
  7656. });
  7657. jQuery(this.progressBar).css({
  7658. width: "50%"
  7659. })
  7660. }
  7661. });
  7662. if (!IGN) var IGN = {};
  7663. if (!IGN.Control) IGN.Control = {};
  7664. IGN.Control.SearchBar = L.Control.extend({
  7665. options: {
  7666. position: "topleft",
  7667. overlay: !0,
  7668. width: 300,
  7669. responseDelay: 200,
  7670. minimumSearchChars: 3,
  7671. maxMarkerResults: 10
  7672. },
  7673. initialize: function (b) {
  7674. L.Util.setOptions(this, b)
  7675. },
  7676. onAdd: function () {
  7677. this._initStatics();
  7678. this._bindEvents();
  7679. this.container = L.DomUtil.create("form", "leaflet-control ign-leaflet-module leaflet-control-search");
  7680. L.DomUtil.create("span", "search-icon", this.container);
  7681. if (L.Browser.touch) L.DomEvent.on(this.container, "click", L.DomEvent.stopPropagation);
  7682. else L.DomEvent.disableClickPropagation(this.container);
  7683. this.input = jQuery('<input type="text" class="leaflet-control-search-input" placeholder="搜索">').appendTo(this.container);
  7684. this.dropdown = L.DomUtil.create("ul", "dropdown-menu general-dropdown-menu", this.container);
  7685. this.listen();
  7686. L.DomEvent.on(this.container, "mousewheel", L.DomEvent.stopPropagation);
  7687. jQuery(this.dropdown).lionbars(!1);
  7688. return this.container
  7689. },
  7690. listen: function () {
  7691. var b = this;
  7692. this._map.on("search", function (a) {
  7693. b._search(a.terms)
  7694. });
  7695. jQuery(this.input).click(function () {
  7696. b.activate()
  7697. });
  7698. jQuery(this.container).click(function () {
  7699. b.activate()
  7700. });
  7701. jQuery(this.input).keyup(function (a) {
  7702. b._arrowKeyNavigation(a);
  7703. clearTimeout(b.inputTimer);
  7704. b.inputTimer = setTimeout(function () {
  7705. b._search(jQuery(b.input).val())
  7706. }, b.options.responseDelay)
  7707. });
  7708. jQuery(this.container).submit(function (a) {
  7709. a.stopPropagation();
  7710. a.preventDefault()
  7711. });
  7712. jQuery(this.container).hover(function () {
  7713. jQuery(b.container).addClass("interact")
  7714. }, function () {
  7715. jQuery(b.container).removeClass("interact")
  7716. })
  7717. },
  7718. activate: function () {
  7719. jQuery(this.container).addClass("active");
  7720. jQuery(this.input).focus();
  7721. jQuery(this.input).stop().animate({
  7722. width: this.inputWidth.active
  7723. })
  7724. },
  7725. deactivate: function () {
  7726. jQuery(this.container).removeClass("active");
  7727. jQuery(this.input).blur();
  7728. jQuery(this.input).val("").stop().animate({
  7729. width: this.inputWidth.regular
  7730. });
  7731. jQuery(this.dropdown).hide();
  7732. this.lastSearchTerms = ""
  7733. },
  7734. _bindEvents: function () {
  7735. var b = this;
  7736. this._map.on("click", function () {
  7737. jQuery(b.input).val() || b.deactivate()
  7738. });
  7739. this._map.on("move", function () {
  7740. b.deactivate()
  7741. });
  7742. this._map.on("popupopen", function () {
  7743. b.deactivate()
  7744. })
  7745. },
  7746. _initStatics: function () {
  7747. this.inputWidth = {
  7748. regular: 75,
  7749. active: 280
  7750. }
  7751. },
  7752. _arrowKeyNavigation: function (b) {
  7753. var a;
  7754. if (jQuery(this.dropdown).is(":visible")) switch (a = jQuery(this.dropdown).find("li.active"), b.keyCode) {
  7755. case 40:
  7756. 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()));
  7757. a.addClass("active");
  7758. break;
  7759. case 38:
  7760. 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()));
  7761. a.addClass("active");
  7762. break;
  7763. case 13:
  7764. if (0 < a.length) {
  7765. if (b = a.data("marker")) this._map.fireEvent("changefilter",
  7766. this._map.types[b.typeSlug]), this._map.fireEvent("activatemarker", b), this.lastSearchTerms = b.markerName, jQuery(this.input).val(b.markerName), jQuery(this.dropdown).hide();
  7767. 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();
  7768. this.deactivate()
  7769. }
  7770. }
  7771. },
  7772. _search: function (b) {
  7773. if (0 == b.length) jQuery(this.dropdown).hide(), jQuery(this.container).removeClass("withoutBottomRadius"),
  7774. this.lastSearchTerms = "";
  7775. // if (!(b.length < this.options.minimumSearchChars || b == this.lastSearchTerms)) {
  7776. if (b != this.lastSearchTerms) {
  7777. var a = this;
  7778. this.terms = b;
  7779. var markers = a._map.markers;
  7780. var result = {
  7781. count : 0,
  7782. data : {
  7783. markers : [],
  7784. types : []
  7785. }
  7786. }
  7787. for(var i in markers) {
  7788. var comdata = markers[i].metadata;
  7789. if(comdata.title && comdata.title.match(b)) {
  7790. result.data.markers.push({
  7791. mapSlug : comdata.mapSlug,
  7792. markerName : comdata.title,
  7793. markerSlug : comdata.markerSlug,
  7794. typeSlug : comdata.typeSlug,
  7795. metadata : {
  7796. markerSlug : comdata.markerSlug
  7797. }
  7798. });
  7799. }
  7800. }
  7801. result.count = result.data.markers.length;
  7802. // console.log(result);
  7803. a.lastSearchTerms = b;
  7804. a._formatResults(result);
  7805. jQuery(a.container).addClass("withoutBottomRadius")
  7806. // this.callApi(this.API.ENDPOINT.SEARCH, {
  7807. // terms: b,
  7808. // objectSlug: a._map.metadata.objectSlug,
  7809. // mapSlug: a._map.metadata.mapSlug
  7810. // }, function (g) {
  7811. // console.log(g);
  7812. // a.lastSearchTerms = b;
  7813. // a._formatResults(g);
  7814. // jQuery(a.container).addClass("withoutBottomRadius")
  7815. // })
  7816. }
  7817. },
  7818. _formatResults: function (b) {
  7819. var a = this,
  7820. g = 0,
  7821. d, e, f, h, i;
  7822. jQuery(this.dropdown).empty();
  7823. 0 == b.count && (d = L.DomUtil.create("li", "general-headline", this.dropdown), jQuery(d).html("No search results."));
  7824. 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) {
  7825. d = L.DomUtil.create("li", "search-result", a.dropdown);
  7826. e = L.DomUtil.create("a", null, d);
  7827. jQuery(e).html(c.typeName);
  7828. jQuery(d).data("type", c);
  7829. a._map.types[c.typeSlug].legend ? f = a._map.types[c.typeSlug].legend.url : a._map.types[c.typeSlug].eachParent(function (a) {
  7830. if (a.legend && a.legend.url) return f = a.legend.url, !1
  7831. });
  7832. f && jQuery('<img src="' + f + '" />').prependTo(e);
  7833. jQuery(e).on("click",
  7834. function (b) {
  7835. a._map.fireEvent("changefilter", a._map.types[c.typeSlug]);
  7836. jQuery(a.container).removeClass("withoutBottomRadius");
  7837. a.deactivate();
  7838. b.preventDefault();
  7839. b.stopPropagation()
  7840. })
  7841. }));
  7842. 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) {
  7843. g++;
  7844. if (g > a.options.maxMarkerResults) return !1;
  7845. c.metadata = {
  7846. markerSlug: c.markerSlug
  7847. };
  7848. d = L.DomUtil.create("li", "search-result", a.dropdown);
  7849. e = L.DomUtil.create("a", null, d);
  7850. jQuery(e).html(c.markerName);
  7851. jQuery(d).data("marker", c);
  7852. 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);
  7853. jQuery(e).on("click", function (b) {
  7854. a._map.fireEvent("changefilter", a._map.types[c.typeSlug]);
  7855. a._map.fireEvent("activatemarker", c);
  7856. jQuery(a.container).removeClass("withoutBottomRadius");
  7857. a.deactivate();
  7858. b.preventDefault();
  7859. b.stopPropagation()
  7860. })
  7861. }));
  7862. jQuery(this.dropdown).show()
  7863. }
  7864. });
  7865. IGN.Control.SearchBar.include(IGN.Mixins.MapsAPI);
  7866. if (!IGN) var IGN = {};
  7867. if (!IGN.Control) IGN.Control = {};
  7868. IGN.Control.OverlayFilter = L.Control.extend({
  7869. options: {
  7870. position: "topleft"
  7871. },
  7872. initialize: function (a, b) {
  7873. this.types = a;
  7874. L.Util.setOptions(this, b);
  7875. this._initStatics();
  7876. this._initLayerGroup()
  7877. },
  7878. onAdd: function () {
  7879. var a = this,
  7880. b, c;
  7881. this._bindEvents();
  7882. if (this.options.display) {
  7883. c = this.container = L.DomUtil.create("div", "leaflet-control-filter ign-leaflet-module");
  7884. this.button = L.DomUtil.create("a", "main-button-with-arrow", this.container);
  7885. jQuery(this.button).attr("data-toggle", "dropdown").html("过滤标记 ");
  7886. jQuery(this.button).hover(function () {
  7887. jQuery(c).addClass("interact")
  7888. },
  7889. function () {
  7890. jQuery(c).removeClass("interact")
  7891. });
  7892. L.DomUtil.create("span", "down-arrow", this.button);
  7893. b = this.dropdown = L.DomUtil.create("ul", "dropdown-menu general-dropdown-menu", this.container);
  7894. this._topLevelList();
  7895. jQuery(this.button).click(function () {
  7896. jQuery(b).is(":hidden") ? a.activate() : a.deactivate()
  7897. });
  7898. this._map.on("click", function () {
  7899. jQuery(b).is(":visible") && a.deactivate()
  7900. });
  7901. if (L.Browser.touch) L.DomEvent.on(this.container, "click", L.DomEvent.stopPropagation);
  7902. else L.DomEvent.disableClickPropagation(this.container);
  7903. L.DomEvent.on(this.container, "mousewheel", L.DomEvent.stopPropagation);
  7904. jQuery(b).lionbars({
  7905. autohide: !0
  7906. })
  7907. } else c = this.container = L.DomUtil.create("div", "leaflet-control-filter no-display");
  7908. return this.container
  7909. },
  7910. activate: function () {
  7911. jQuery(this.container).addClass("active");
  7912. jQuery(this.dropdown).show()
  7913. },
  7914. deactivate: function () {
  7915. jQuery(this.container).removeClass("active");
  7916. jQuery(this.dropdown).hide()
  7917. },
  7918. clearActiveType: function () {
  7919. jQuery(".active", this.dropdown).each(function () {
  7920. jQuery(this).removeClass("active")
  7921. })
  7922. },
  7923. addMarker: function (a) {
  7924. this._layerGroup.addLayer(a)
  7925. },
  7926. removeMarker: function (a) {
  7927. this._map.hasLayer(this._layerGroup) ? this._layerGroup.removeLayer(a) : (this._map.addLayer(this._layerGroup), this._layerGroup.removeLayer(a), this._map.removeLayer(this._layerGroup))
  7928. },
  7929. _initStatics: function () {
  7930. this.buttonType = {
  7931. REGULAR: 1,
  7932. PARENT: 2,
  7933. BACK: 3
  7934. }
  7935. },
  7936. _initLayerGroup: function () {
  7937. this._layerGroup = new IGN.MarkerClusterGroup({
  7938. disableClusteringAtZoom: this.options.clusters.enabled ? this.options.clusters.disableClusteringAtZoom : 1,
  7939. maxClusterRadius: this.options.clusters.clusterRadius,
  7940. retina: this.options.retina
  7941. });
  7942. this._layerGroup.on("clusterclick", function (a) {
  7943. a.layer._map.panTo(a.layer.getLatLng());
  7944. a.layer.bindPopup(IGN.PopupContent.clusterContent(a), {
  7945. autoPanPadding: new L.Point(5, 100),
  7946. autoPan: !0,
  7947. offset: new L.Point(0, -35)
  7948. }).openPopup();
  7949. a.layer._popup._update()
  7950. })
  7951. },
  7952. _bindEvents: function () {
  7953. var a = this;
  7954. this._map.on("changefilter", function (b) {
  7955. a._changeFilter(b)
  7956. });
  7957. this._map.on("filter", function (b) {
  7958. a._filter(b)
  7959. });
  7960. this._map.on("showall",
  7961. function () {
  7962. a._showAll()
  7963. });
  7964. this._map.on("hideall", function () {
  7965. a._filter()
  7966. });
  7967. this._map.on("loadandshowall", function () {
  7968. a._loadAndShowAll()
  7969. });
  7970. this._map.on("loadandshowkorokseeds", function () {
  7971. a._loadAndShowKorokSeeds()
  7972. });
  7973. this._map.on("redraw", function () {
  7974. a._changeFilter(a.lastFilteredType)
  7975. });
  7976. this._map.on("move", function () {
  7977. a.deactivate()
  7978. });
  7979. this._map.on("popupopen", function () {
  7980. a.deactivate()
  7981. });
  7982. this._map.on("lastfilteredtype", function () {
  7983. return a.lastFilteredType ? a.lastFilteredType : null
  7984. })
  7985. },
  7986. _topLevelList: function () {
  7987. var a =
  7988. this;
  7989. jQuery(a.dropdown).empty();
  7990. jQuery(a._allButton()).appendTo(a.dropdown);
  7991. jQuery.each(this.types, function (b, c) {
  7992. !c.hasParent() && 0 < c.markerCount && jQuery(a._listElementForType(c, a.buttonType.REGULAR)).appendTo(a.dropdown)
  7993. });
  7994. jQuery(a._noneButton()).appendTo(a.dropdown)
  7995. },
  7996. _list: function (a) {
  7997. var b = this;
  7998. jQuery(b.dropdown).empty();
  7999. jQuery(b._listElementForType(a, b.buttonType.BACK)).appendTo(b.dropdown);
  8000. jQuery(b._listElementForType(a, b.buttonType.PARENT)).appendTo(b.dropdown);
  8001. a.eachChild(function (a) {
  8002. 0 < a.markerCount &&
  8003. jQuery(b._listElementForType(a, b.buttonType.REGULAR)).appendTo(b.dropdown)
  8004. })
  8005. },
  8006. _listElementForType: function (a, b) {
  8007. var c = this,
  8008. d, e, g, f;
  8009. d = jQuery("<li></li>");
  8010. switch (b) {
  8011. case this.buttonType.PARENT:
  8012. f = "All " + a.typeName;
  8013. break;
  8014. case this.buttonType.BACK:
  8015. f = a.hasParent() ? c.types[a.parentTypeSlug].typeName : "All Categories";
  8016. break;
  8017. default:
  8018. f = a.typeName
  8019. }
  8020. e = jQuery('<a href="#">' + f + "</a>");
  8021. b == this.buttonType.BACK && jQuery('<span class="icon icon-chevron-left pull-left"></span>').appendTo(e);
  8022. b != c.buttonType.BACK && a.legend &&
  8023. a.legend.url ? (jQuery('<img src="' + a.legend.url + '" />').prependTo(e), e.addClass("icon")) : e.addClass("no-icon");
  8024. a.hasChildren() && b == c.buttonType.REGULAR && jQuery('<span class="icon icon-white icon-chevron-right pull-right"></span>').appendTo(e);
  8025. jQuery('<span class="clearfix"></span>').appendTo(e);
  8026. e.appendTo(d);
  8027. g = jQuery('<ul class="children"></ul>');
  8028. jQuery(g).appendTo(d);
  8029. e.data("type", a);
  8030. e.data("action", b);
  8031. a.eachChild(function (a) {
  8032. 0 < a.markerCount && jQuery(c._listElementForType(a, c.buttonType.REGULAR)).appendTo(g)
  8033. });
  8034. jQuery(e).click(function (a) {
  8035. var b, d;
  8036. b = jQuery(this).data("type");
  8037. jQuery(this).data("action");
  8038. d = jQuery(this).parent();
  8039. d = jQuery(".children:first", d);
  8040. 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());
  8041. c._map.fireEvent("changefilter", b);
  8042. c.clearActiveType();
  8043. jQuery(e).addClass("active");
  8044. a.stopPropagation();
  8045. a.preventDefault()
  8046. });
  8047. return d
  8048. },
  8049. _allButton: function () {
  8050. var a = this,
  8051. b, c, a = this;
  8052. b = jQuery("<li></li>");
  8053. c = jQuery('<a href="#">全部显示</a>');
  8054. c.appendTo(b);
  8055. jQuery(c).click(function (b) {
  8056. a._loadAndShowAll();
  8057. a.clearActiveType();
  8058. jQuery(c).addClass("active");
  8059. b.stopPropagation();
  8060. b.preventDefault()
  8061. });
  8062. return b
  8063. },
  8064. _noneButton: function () {
  8065. var a = this,
  8066. b, c, a = this;
  8067. b = jQuery("<li></li>");
  8068. c = jQuery('<a href="#">不显示</a>');
  8069. c.appendTo(b);
  8070. jQuery(c).click(function (b) {
  8071. a._filter();
  8072. a._map.fireEvent("hideall");
  8073. a._map.fireEvent("slidingview", {
  8074. message: "To see markers, enter a search term or select a filter above",
  8075. displayShowAllButton: "false"
  8076. });
  8077. a.clearActiveType();
  8078. jQuery(c).addClass("active");
  8079. b.stopPropagation();
  8080. b.preventDefault()
  8081. });
  8082. return b
  8083. },
  8084. _changeFilter: function (a) {
  8085. loadTypes = this._notLoaded(a);
  8086. 0 < loadTypes.length ? this._map.fireEvent("loadtypes", {
  8087. types: loadTypes,
  8088. parentType: a
  8089. }) : this._map.fireEvent("filter", {
  8090. type: a
  8091. })
  8092. },
  8093. _notLoaded: function (a) {
  8094. var b = [];
  8095. a ? (a = this.types[a.typeSlug], (!a || !a.loaded) && b.push(a), a.allChildren(function (a) {
  8096. a.loaded || b.push(a)
  8097. })) : jQuery.each(this.types, function (a, d) {
  8098. d.loaded || b.push(d)
  8099. });
  8100. return b
  8101. },
  8102. _filter: function (a) {
  8103. var b = this,
  8104. c;
  8105. b._map.removeLayer(b._layerGroup);
  8106. jQuery.each(b._map.types, function (a, c) {
  8107. b._map.removeLayer(c._layerGroup)
  8108. });
  8109. a && a.type ? (c = b.types[a.type.typeSlug], b._map.addLayer(c._layerGroup), c.allChildren(function (a) {
  8110. b._map.addLayer(a._layerGroup)
  8111. }), this.lastFilteredType = a.type) : this.lastFilteredType = null;
  8112. b._map.fireEvent("filterchanged", c)
  8113. },
  8114. _showAll: function () {
  8115. this._filter();
  8116. this._map.addLayer(this._layerGroup)
  8117. },
  8118. _loadAndShowAll: function () {
  8119. loadTypes = this._notLoaded();
  8120. 0 < loadTypes.length ? this._map.fireEvent("loadtypes", {
  8121. types: loadTypes,
  8122. filterEvent: "showall"
  8123. }) : this._map.fireEvent("showall")
  8124. },
  8125. _loadAndShowKorokSeeds: function () {
  8126. this._changeFilter(this._map.types["korok-seed"])
  8127. }
  8128. });
  8129. if (!IGN) var IGN = {};
  8130. if (!IGN.Control) IGN.Control = {};
  8131. IGN.Control.ContextMenu = L.Control.extend({
  8132. options: {
  8133. position: "topleft"
  8134. },
  8135. initialize: function (a) {
  8136. L.Util.setOptions(this, a)
  8137. },
  8138. onAdd: function (a) {
  8139. var d = this,
  8140. b, c;
  8141. this.container = L.DomUtil.create("div", "leaflet-context-menu");
  8142. b = L.DomUtil.create("ul", "unstyled", this.container);
  8143. b = L.DomUtil.create("li", null, b);
  8144. c = jQuery('<a href="#">Create Marker</a>');
  8145. c.appendTo(b);
  8146. c.click(function () {
  8147. var b = {
  8148. exists: !1
  8149. },
  8150. c;
  8151. jQuery.each(a.types, function (c, d) {
  8152. b.type = d;
  8153. b.metadata = {
  8154. typeSlug: d.typeSlug,
  8155. mapSlug: a.metadata.mapSlug,
  8156. objectSlug: a.metadata.objectSlug
  8157. };
  8158. return !1
  8159. });
  8160. c = new IGN.Marker(d.contextLatLng, b);
  8161. c.addTo(a);
  8162. c.enableEditing()
  8163. });
  8164. this._hide();
  8165. this._bindEvents();
  8166. return this.container
  8167. },
  8168. _bindEvents: function () {
  8169. var a = this;
  8170. this._map.on("contextmenu", function (d) {
  8171. a.contextLatLng = d.latlng;
  8172. a._show(d)
  8173. });
  8174. this._map.on("click", function () {
  8175. a._hide()
  8176. });
  8177. this._map.on("dragstart", function () {
  8178. a._hide()
  8179. })
  8180. },
  8181. _show: function (a) {
  8182. jQuery(this.container).css({
  8183. top: a.containerPoint.y,
  8184. left: a.containerPoint.x
  8185. }).show()
  8186. },
  8187. _hide: function () {
  8188. jQuery(this.container).hide()
  8189. }
  8190. });
  8191. if (!IGN) var IGN = {};
  8192. if (!IGN.Control) IGN.Control = {};
  8193. IGN.Control.Persistence = L.Control.extend({
  8194. options: {
  8195. days: 30,
  8196. cookieName: "IGNMapFilter"
  8197. },
  8198. initialize: function (a) {
  8199. L.Util.setOptions(this, a)
  8200. },
  8201. onAdd: function (a) {
  8202. var d = this,
  8203. c;
  8204. a.metadata && (this.options.cookieName += a.metadata.objectSlug + "-" + a.metadata.mapSlug);
  8205. c = L.DomUtil.create("div", "ign-control-persistence");
  8206. jQuery(c).hide();
  8207. // a.on("filter", function (b) {
  8208. // b.type && b.type.typeSlug && d.setFilterCookie(b.type.typeSlug)
  8209. // });
  8210. if (!this._map.options.filter) a.on("controlsloaded", function () {
  8211. (filter = d.getFilterCookie()) && "all" ==
  8212. filter ? a.fireEvent("loadandshowall") : filter && "none" != filter ? a.fireEvent("changefilter", this.types[filter]) : a.fireEvent("loadandshowall")
  8213. });
  8214. a.on("showall", function () {
  8215. d.setFilterCookie("all")
  8216. });
  8217. a.on("hideall", function () {
  8218. d.setFilterCookie("none")
  8219. });
  8220. a.on("getcookie", function (b) {
  8221. var a = d._readCookie(b.name);
  8222. b.callback && b.callback(a)
  8223. });
  8224. a.on("setcookie", function (a) {
  8225. days = a.days ? a.days : d.options.days;
  8226. d._createCookie(a.name, a.value, days)
  8227. });
  8228. return c
  8229. },
  8230. getFilterCookie: function () {
  8231. return this._readCookie(this.options.cookieName)
  8232. },
  8233. setFilterCookie: function (a) {
  8234. this._createCookie(this.options.cookieName, a, this.options.days)
  8235. },
  8236. _createCookie: function (a, d, c) {
  8237. if (c) {
  8238. var b = new Date;
  8239. b.setTime(b.getTime() + 864E5 * c);
  8240. c = "; expires=" + b.toGMTString()
  8241. } else c = "";
  8242. document.cookie = a + "=" + d + c + "; path=/"
  8243. },
  8244. _readCookie: function (a) {
  8245. for (var a = a + "=", d = document.cookie.split(";"), c = 0; c < d.length; c++) {
  8246. for (var b = d[c];
  8247. " " == b.charAt(0);) b = b.substring(1, b.length);
  8248. if (0 == b.indexOf(a)) return b.substring(a.length, b.length)
  8249. }
  8250. return null
  8251. }
  8252. });
  8253. if (!IGN) var IGN = {};
  8254. if (!IGN.Control) IGN.Control = {};
  8255. IGN.Control.Moderation = L.Control.extend({
  8256. options: {
  8257. position: "topleft",
  8258. listWidth: "300px"
  8259. },
  8260. initialize: function (a) {
  8261. L.Util.setOptions(this, a)
  8262. },
  8263. onAdd: function (a) {
  8264. this._layerGroup = new L.LayerGroup;
  8265. a.addLayer(this._layerGroup);
  8266. this._createdLayerGroup = new L.LayerGroup;
  8267. a.addLayer(this._createdLayerGroup);
  8268. this._polylineGroup = new L.LayerGroup;
  8269. a.addLayer(this._polylineGroup);
  8270. a = L.DomUtil.create("div", "leaflet-moderation");
  8271. this.contentList = L.DomUtil.create("div", "leaflet-moderation-content-list", a);
  8272. jQuery(this.contentList).css({
  8273. opacity: 0
  8274. });
  8275. L.DomEvent.on(this.contentList, "click", L.DomEvent.stopPropagation);
  8276. this._loadCreatedMarkers();
  8277. this._bindEvents();
  8278. return a
  8279. },
  8280. _bindEvents: function () {
  8281. var a = this;
  8282. this._map.on("markerclick", function (b) {
  8283. a._markerClick(b)
  8284. });
  8285. this._map.on("showmoderationlist", function () {
  8286. a._showContentList()
  8287. });
  8288. this._map.on("hidemoderationlist", function () {
  8289. a._hideContentList()
  8290. });
  8291. this._map.on("disablemoderation", function () {
  8292. a._disableModeration()
  8293. });
  8294. this._map.on("changefilter", function () {
  8295. a._disableModeration()
  8296. });
  8297. this._map.on("showall",
  8298. function () {
  8299. a._disableModeration()
  8300. });
  8301. this._map.on("hideall", function () {
  8302. a._disableModeration()
  8303. });
  8304. this._map.on("removemarkerfrommoderationlayers", function (b) {
  8305. a._removeMarkerFromLayers(b)
  8306. })
  8307. },
  8308. _loadCreatedMarkers: function () {
  8309. var a = this,
  8310. b = {},
  8311. c, d;
  8312. b.objectSlug = a._map.metadata.objectSlug;
  8313. b.mapSlug = a._map.metadata.mapSlug;
  8314. b.pendingAction = "create";
  8315. this.callApi(this.API.ENDPOINT.MARKERS.PENDING.GET, b, function (b) {
  8316. b && !(b.count && 0 >= b.count) && jQuery.each(b.data, function (e, i) {
  8317. c = i.marker[0];
  8318. c.type = a._map.types[c.metadata.typeSlug];
  8319. c.metadata.pendingCount = 1;
  8320. c.pendingAction = "create";
  8321. c.displayBadgeCount = !0;
  8322. d = new IGN.PendingMarker([c.location.lat, c.location.lng], c);
  8323. a._createdLayerGroup.addLayer(d);
  8324. d.enableDragging();
  8325. d.state = d.STATES.PENDING;
  8326. d.createdBy = b.createdBy
  8327. })
  8328. })
  8329. },
  8330. _markerClick: function (a) {
  8331. var b = this,
  8332. c = a.marker,
  8333. a = {},
  8334. d = [],
  8335. f, e;
  8336. 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(),
  8337. 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) {
  8338. a.data && jQuery.each(a.data, function (j, h) {
  8339. f = h.action;
  8340. d = [];
  8341. jQuery.each(h.marker, function (j, g) {
  8342. g.type = b._map.types[g.metadata.typeSlug];
  8343. g.metadata.typeSlug = g.type.typeSlug;
  8344. g.pendingAction = f;
  8345. e = new IGN.PendingMarker([g.location.lat, g.location.lng], g);
  8346. e._originalMarker =
  8347. c;
  8348. b._layerGroup.addLayer(e);
  8349. e.enableDragging();
  8350. e.state = e.STATES.PENDING;
  8351. e.updatedBy = a.updatedBy;
  8352. d.push(e);
  8353. polyline = new L.Polyline([e.getLatLng(), c.getLatLng()], {
  8354. color: "red"
  8355. });
  8356. b._polylineGroup.addLayer(polyline)
  8357. });
  8358. b._addPendingMarkersToContentList(f, d);
  8359. b._addCancelButtonToContentList();
  8360. b._showContentList()
  8361. })
  8362. })
  8363. },
  8364. _addPendingMarkersToContentList: function (a, b) {
  8365. var c = this,
  8366. d, f, e;
  8367. d = L.DomUtil.create("h3", "action-headline", this.contentList);
  8368. jQuery(d).html(a + "s");
  8369. L.DomUtil.create("hr", null, this.contentList);
  8370. jQuery.each(b, function (a, b) {
  8371. f = L.DomUtil.create("a", "pending-marker-link", c.contentList);
  8372. jQuery(f).html(b.metadata.markerName);
  8373. L.DomUtil.create("i", "icon icon-chevron-right pull-right", f);
  8374. if (c._map.types[b.metadata.typeSlug].markerIcon) e = c._map.types[b.metadata.typeSlug].markerIcon.url, jQuery('<img src="' + e + '" />').prependTo(f);
  8375. b._moderationListLink = f;
  8376. jQuery(f).on("click", function (a) {
  8377. b.fireEvent("click");
  8378. a.preventDefault();
  8379. a.stopPropagation()
  8380. })
  8381. })
  8382. },
  8383. _addCancelButtonToContentList: function () {
  8384. var a = this,
  8385. b;
  8386. b = L.DomUtil.create("a", "btn btn-large btn-cancel-moderation", this.contentList);
  8387. jQuery(b).html("Cancel Moderation");
  8388. jQuery(b).click(function (b) {
  8389. a._disableModeration();
  8390. b.stopPropagation();
  8391. b.preventDefault()
  8392. })
  8393. },
  8394. _removeMarkerFromLayers: function (a) {
  8395. this._layerGroup.removeLayer(a);
  8396. this._createdLayerGroup.removeLayer(a)
  8397. },
  8398. _clearContentList: function () {
  8399. jQuery(this.contentList).html("")
  8400. },
  8401. _showContentList: function () {
  8402. jQuery(this.contentList).stop().animate({
  8403. width: this.options.listWidth,
  8404. opacity: 1
  8405. })
  8406. },
  8407. _hideContentList: function () {
  8408. jQuery(this.contentList).stop().animate({
  8409. width: 0,
  8410. opacity: 0
  8411. })
  8412. },
  8413. _disableModeration: function () {
  8414. this._hideContentList();
  8415. this._layerGroup.clearLayers();
  8416. this._polylineGroup.clearLayers()
  8417. }
  8418. });
  8419. IGN.Control.Moderation.include(IGN.Mixins.MapsAPI);
  8420. if (!IGN) var IGN = {};
  8421. if (!IGN.Control) IGN.Control = {};
  8422. IGN.Control.EventTracker = L.Control.extend({
  8423. options: {},
  8424. initialize: function (a) {
  8425. L.Util.setOptions(this, a)
  8426. },
  8427. onAdd: function () {
  8428. this._bindEvents();
  8429. return L.DomUtil.create("div", "leaflet-control-event-tracker")
  8430. },
  8431. _bindEvents: function () {
  8432. var a = this;
  8433. this._map.on("markerclick", function (b) {
  8434. a._markerClick(b)
  8435. });
  8436. this._map.on("markercreate", function (b) {
  8437. a._markerCreate(b)
  8438. });
  8439. this._map.on("markerupdate", function (b) {
  8440. a._markerUpdate(b)
  8441. });
  8442. this._map.on("markerdelete", function (b) {
  8443. a._markerDelete(b)
  8444. })
  8445. },
  8446. _markerClick: function (a) {
  8447. a.metadata &&
  8448. a.metadata.markerName && a.metadata.wikiPage && this._igndrones("Maps:Marker Click", a.metadata.markerName + " | " + a.metadata.wikiPage)
  8449. },
  8450. _markerCreate: function (a) {
  8451. this._igndrones("Maps:Marker Create", a.metadata.markerName);
  8452. window.IGN_UA.trackEvent("community-wikiMapsMarkerCreate")
  8453. },
  8454. _markerUpdate: function (a) {
  8455. this._igndrones("Maps:Marker Update", a.metadata.markerName);
  8456. window.IGN_UA.trackEvent("community-wikiMapsMarkerUpdate")
  8457. },
  8458. _markerDelete: function (a) {
  8459. this._igndrones("Maps:Marker Delete", a.metadata.markerName);
  8460. window.IGN_UA.trackEvent("community-wikiMapsMarkerDelete")
  8461. },
  8462. _igndrones: function (a, b) {
  8463. if ("undefined" != typeof igndrones) {
  8464. var c = this;
  8465. igndrones.async.push(function () {
  8466. igndrones.fireEvent(a, "Map:" + c._map.metadata.objectSlug + ":" + c._map.metadata.mapSlug, b)
  8467. })
  8468. }
  8469. }
  8470. });
  8471. if (!IGN) var IGN = {};
  8472. if (!IGN.Control) IGN.Control = {};
  8473. IGN.Control.ExternalLink = L.Control.extend({
  8474. options: {
  8475. position: "bottomright",
  8476. linkTo: "#",
  8477. text: "View on IGN"
  8478. },
  8479. initialize: function (a) {
  8480. L.Util.setOptions(this, a)
  8481. },
  8482. onAdd: function () {
  8483. var a, b;
  8484. a = L.DomUtil.create("div", "external-button-holder");
  8485. b = L.DomUtil.create("a", "btn", a);
  8486. jQuery(b).html(this.options.text);
  8487. jQuery(b).attr("href", this.options.linkTo);
  8488. jQuery(b).attr("target", "_top");
  8489. return a
  8490. }
  8491. });
  8492. if (!IGN) var IGN = {};
  8493. if (!IGN.Control) IGN.Control = {};
  8494. IGN.Control.MarkerAdder = L.Control.extend({
  8495. statics: {
  8496. DISPLAY: {
  8497. NORMALSTATE: 1,
  8498. FULLSTATE: 2
  8499. }
  8500. },
  8501. options: {
  8502. position: "topright"
  8503. },
  8504. initialize: function (a) {
  8505. L.Util.setOptions(this, a)
  8506. },
  8507. _initStatics: function () {
  8508. this.popupStatus = {
  8509. statusNormal: "normal",
  8510. statusClosed: "closed"
  8511. };
  8512. this.cookieName = "igncontrolmarkeradder"
  8513. },
  8514. onAdd: function (a) {
  8515. var b = this,
  8516. c;
  8517. this._map = a;
  8518. this._initStatics();
  8519. a = L.DomUtil.create("div", "add-marker-container");
  8520. c = L.DomUtil.create("a", "btn", a);
  8521. L.DomUtil.create("span", "add-marker-icon", c);
  8522. this.popup = L.DomUtil.create("div",
  8523. "add-marker-popup-container", a);
  8524. this.popupCloseButton = L.DomUtil.create("a", "add-marker-popup-close", this.popup);
  8525. jQuery(this.popupCloseButton).html("x");
  8526. this.popupMessage = L.DomUtil.create("span", "add-marker-popup-message", this.popup);
  8527. 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>');
  8528. L.DomUtil.create("div", "add-marker-popup-arrow", this.popup);
  8529. jQuery(c).click(function () {
  8530. b.addMarker()
  8531. });
  8532. jQuery(this.popupCloseButton).click(function () {
  8533. b.popupClose()
  8534. });
  8535. this._map.on("controlsloaded", function () {
  8536. // b._map.fireEvent("getcookie", {
  8537. // name: b.cookieName,
  8538. // callback: function (a) {
  8539. // if (!a || a != b.popupStatus.statusClosed) jQuery(b.popup).fadeIn("fast"), setTimeout(function () {
  8540. // b.popupClose()
  8541. // }, 2E4)
  8542. // }
  8543. // })
  8544. });
  8545. return a
  8546. },
  8547. addMarker: function () {
  8548. this.popupClose();
  8549. var a = {
  8550. exists: !1
  8551. },
  8552. b = this._map,
  8553. c;
  8554. b.overlayFilter && b.overlayFilter.lastFilteredType &&
  8555. b.overlayFilter.lastFilteredType.typeSlug ? c = b.types[b.overlayFilter.lastFilteredType.typeSlug] : jQuery.each(b.types, function (b, a) {
  8556. c = a;
  8557. return !1
  8558. });
  8559. a.type = c;
  8560. a.metadata = {
  8561. typeSlug: c.typeSlug,
  8562. mapSlug: b.metadata.mapSlug,
  8563. objectSlug: b.metadata.objectSlug
  8564. };
  8565. a = new IGN.Marker(b.getCenter(), a);
  8566. a.addTo(b);
  8567. a.enableEditing()
  8568. },
  8569. popupClose: function () {
  8570. jQuery(this.popup).fadeOut("fast");
  8571. this._map.fireEvent("setcookie", {
  8572. name: this.cookieName,
  8573. value: this.popupStatus.statusClosed
  8574. })
  8575. }
  8576. });
  8577. if (!IGN) var IGN = {};
  8578. if (!IGN.Interface) IGN.Interface = {};
  8579. IGN.Interface.InteractiveMapInterface = {
  8580. setMap: function (a) {
  8581. this.map = a
  8582. },
  8583. filter: function (a) {
  8584. (a = this.map.types[a]) && this.map.fireEvent("changefilter", a)
  8585. },
  8586. showAll: function () {
  8587. this.map.fireEvent("showall")
  8588. },
  8589. hideAll: function () {
  8590. this.map.fireEvent("hideall")
  8591. },
  8592. activateMarker: function (a) {
  8593. (a = this.map.markers[a]) && this.map.fireEvent("activatemarker", a)
  8594. },
  8595. center: function (a) {
  8596. var b = new L.LatLng(-this.map.mapInfo.width / 2, this.map.mapInfo.height / 2);
  8597. this.map.setView(b, a ? a : 2)
  8598. },
  8599. lastFilteredTypeSlug: function () {
  8600. return this.map.overlayFilter &&
  8601. this.map.overlayFilter.lastFilteredType ? this.map.overlayFilter.lastFilteredType.typeSlug : "undefined"
  8602. },
  8603. zoomIn: function () {
  8604. this.map.zoomIn()
  8605. },
  8606. zoomOut: function () {
  8607. this.map.zoomOut()
  8608. },
  8609. filterAndActivate: function (a, b) {
  8610. var d = this,
  8611. c, e;
  8612. this.map.fireEvent("changefilter", this.map.types[a]);
  8613. (c = this.map.markers[b]) ? this.map.fireEvent("activatemarker", c): (e = function () {
  8614. (c = d.map.markers[b]) && d.map.fireEvent("activatemarker", c);
  8615. d.map.off("filterchanged", e)
  8616. }, this.map.on("filterchanged", e))
  8617. }
  8618. };
  8619. jQuery(document).ready(function () {
  8620. var a = jQuery("#ignFooter-container .emailInput");
  8621. a.val("Enter Email...");
  8622. a.focusin(function () {
  8623. "Enter Email..." === jQuery(this).val() && jQuery(this).val("")
  8624. });
  8625. a.focusout(function () {
  8626. "" === jQuery(this).val() && jQuery(this).val("Enter Email...")
  8627. });
  8628. jQuery("#ignFooter-container .emailSubmit").click(function () {
  8629. if ("Enter Email..." === a.val()) return !1
  8630. })
  8631. });
  8632. var IGN = IGN || {};
  8633. // IGN.External = IGN.External || {};
  8634. // IGN.External.Optimizely = function () {
  8635. // return {
  8636. // _settings: {},
  8637. // init: function () {
  8638. // var b = "",
  8639. // a = document.getElementById("ign-optimizely");
  8640. // "undefined" !== typeof a && "SCRIPT" != a.nodeName && "undefined" !== typeof a.getAttribute("data-project-id") && (b = a.getAttribute("data-project-id"));
  8641. // if ("" !== b) {
  8642. // var c = "https:" == document.location.protocol ? "https://" : "http://",
  8643. // a = document.createElement("script");
  8644. // a.type = "text/javascript";
  8645. // a.async = !0;
  8646. // a.src = c + "cdn.optimizely.com/js/" + b + ".js";
  8647. // b = document.getElementsByTagName("script")[0];
  8648. // b.parentNode.insertBefore(a,
  8649. // b)
  8650. // }
  8651. // }
  8652. // }
  8653. // }();
  8654. // window.addEventListener("load", function () {
  8655. // IGN.External.Optimizely.init()
  8656. // });
  8657. (function (a) {
  8658. function e(a) {
  8659. a.stopPropagation();
  8660. a.stopImmediatePropagation();
  8661. a.preventDefault();
  8662. 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"))
  8663. }
  8664. function f(b) {
  8665. a.ajax({
  8666. url: (b ? "https://s.ign.com/widgets/" : "http://" + GlobalHeaderOptions.renderDomain +
  8667. "/") + "social/shared/evousertools.jsonp?enable_ssl=" + b + "&globalheader=true&callback=?",
  8668. dataType: "jsonp",
  8669. jsonpCallback: "socialSharedGlobalHeaderUsertoolsCallback",
  8670. cache: !0,
  8671. success: function (b) {
  8672. $toolsContainer = a("#user-tools-container");
  8673. $toolsContainer.html(b);
  8674. b = $toolsContainer.find(".user-tools");
  8675. b.fadeIn("fast");
  8676. b.delegate(".authReturnUrl", "click", function () {
  8677. var b = escape(location.href),
  8678. c = a(this).attr("href");
  8679. a(this).attr("href", c + "?r=" + b)
  8680. })
  8681. }
  8682. })
  8683. }
  8684. var b, d, c;
  8685. a(document).ready(function () {
  8686. b = a("#ign-shows .ign-shows-list-container");
  8687. a("#ign-shows .more-shows");
  8688. c = a("#ign-shows .more-shows a");
  8689. d = [a("#ign-shows .show-column-0"), a("#ign-shows .show-column-1"), a("#ign-shows .show-column-2")];
  8690. d[1].length && c.click(e);
  8691. f(GlobalHeaderOptions.enable_ssl);
  8692. a("#header-container").removeClass("hidden-opacity")
  8693. })
  8694. })(jQuery);
  8695. (function (a) {
  8696. var l, q, g, h, m, i, r;
  8697. function w() {
  8698. n = a("header#ign-header");
  8699. a("#header-container");
  8700. b = a("#header-nav");
  8701. a("#search-input");
  8702. s = a("#ign-shows");
  8703. e = !0;
  8704. // o = a("#spine-container").height() || b.offset().top;
  8705. o = a("#spine-container").height();
  8706. j = a(".trending");
  8707. c = a(".dpad-container").addClass("hidden");
  8708. d && (d.appendTo(c), c.css("background-image", "none"));
  8709. a("#search-container");
  8710. l = a("#search-input");
  8711. q = a("#search-button");
  8712. g = a(".promoted .content");
  8713. h = a(".promoted .image");
  8714. m = a(".promoted .tile.promo");
  8715. i = "collapsed";
  8716. r = 0 !== a(".promoted.expandable").length ?
  8717. !0 : !1;
  8718. j = a(".trending");
  8719. x();
  8720. a("body").bind("sidekickStateChange", y);
  8721. b.hasClass("spine") || b.hasClass("watchread") ? (k(a(this).scrollTop()), a(window).scroll(function () {
  8722. k(a(this).scrollTop())
  8723. })) : (c.removeClass("hidden"), d && t())
  8724. }
  8725. function y(p, b) {
  8726. b.action && "expand" === b.action ? (window.scrollTo(0, 0), n.addClass("fixed"), k(0), e = !1) : b.action && "collapse" === b.action && setTimeout(function () {
  8727. n.removeClass("fixed");
  8728. e = !0;
  8729. k(a(window).scrollTop())
  8730. }, 2500)
  8731. }
  8732. function k(p) {
  8733. e && p > o && !b.hasClass("fixed") ? (f && console.log("set sticky state"),
  8734. 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"))
  8735. }
  8736. function t() {
  8737. d[0].pauseAnimations();
  8738. d[0].setCurrentTime(0);
  8739. d[0].unpauseAnimations()
  8740. }
  8741. function z(a) {
  8742. 13 === a.keyCode && u()
  8743. }
  8744. function u() {
  8745. var a = l.val();
  8746. "" === a || "Search" === a ? alert("Please type in your search query.") : document.location = "http://" + window.document.domain +
  8747. "/search?q=" + encodeURIComponent(a)
  8748. }
  8749. function v(a) {
  8750. a.preventDefault();
  8751. switch (i) {
  8752. case "collapsed":
  8753. m.removeClass("hidden");
  8754. g.addClass("hidden");
  8755. h.addClass("expanded");
  8756. j.addClass("hidden");
  8757. i = "expanded";
  8758. f && console.log("expanding promoted content");
  8759. break;
  8760. case "expanded":
  8761. m.addClass("hidden"), g.removeClass("hidden"), h.removeClass("expanded"), j.removeClass("hidden"), i = "collapsed", f && console.log("collapsing promoted content")
  8762. }
  8763. }
  8764. function x() {
  8765. s.on("mouseover", function () {
  8766. var b, c;
  8767. a("#ign-shows .ign-show").each(function () {
  8768. b =
  8769. a(this).find(".ign-show-image");
  8770. b.attr("src", b.data("image"));
  8771. c = a(this).find(".ign-show-branding");
  8772. c.attr("src", c.data("image"))
  8773. })
  8774. })
  8775. }
  8776. var f = !1,
  8777. 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>"),
  8778. c, n, b, s, o, j, e;
  8779. f && console.log("IGN Global Header 2014");
  8780. a(document).ready(function () {
  8781. w();
  8782. l.keypress(z);
  8783. q.click(u);
  8784. r && (h.click(v), g.click(v))
  8785. })
  8786. })(IGN.jQuery);