-
Notifications
You must be signed in to change notification settings - Fork 15
/
travelmap.js.map
1 lines (1 loc) · 9.82 KB
/
travelmap.js.map
1
{"version":3,"sources":["travelmap.js"],"names":["_travelMap","_defaultOptions","stops","currentStop","selector","icon","url","width","height","initialZoom","pastStroke","color","opacity","weight","futureStroke","mapOptions","draggable","scrollwheel","disableDoubleClickZoom","zoomControl","overlay","className","createMap","options","map","settings","_extend","length","pastLines","slice","futureLines","currentLocation","_initStyle","window","GMaps","console","log","div","lat","lng","zoom","setOptions","drawPolyline","path","_toLatLongCollection","strokeColor","strokeOpacity","strokeWeight","i","stop","addMarker","infoWindow","content","info","anchorPoint","x","y","drawOverlay","verticalAlign","horizontalAlign","layer","_toLatLong","collection","push","stopStyle","overlayStyle","style","document","createElement","innerHTML","head","appendChild","base","defaults","extended","key","hasOwnProperty","undefined","exports","module","travelMap","this","define","amd","call"],"mappings":";;;;;CAOC,WAEC,YAGA,IAAIA,MAEAC,GACFC,SACAC,YAAa,EACbC,SAAU,OACVC,MACEC,IAAK,6OACLC,MAAO,EACPC,OAAQ,GAEVC,YAAa,EACbC,YACEC,MAAO,UACPC,QAAS,GACTC,OAAQ,GAEVC,cACEH,MAAO,UACPC,QAAS,GACTC,OAAQ,GAEVE,YACEC,WAAW,EACXC,aAAa,EACbC,wBAAwB,EACxBC,aAAa,GAEfC,SACEC,UAAW,qBAKfrB,GAAWsB,UAAY,SAAUC,GAE/B,GAAIC,GACAC,EAAWC,EAAQH,EAAStB,EAEhC,KAAKwB,EAASvB,OAAkC,GAAzBuB,EAASvB,MAAMyB,OACpC,KAAM,4CAIR,IAAIC,GAAYH,EAASvB,MAAM2B,MAAM,EAAGJ,EAAStB,YAAc,GAC3D2B,EAAcL,EAASvB,MAAM2B,MAAMJ,EAAStB,YAAasB,EAASvB,MAAMyB,QACxEI,EAAkBN,EAASvB,MAAMuB,EAAStB,YAE9C6B,KAG8B,kBAAjBC,QAAOC,OAAwBD,OAAOC,OACjDC,QAAQC,IAAI,8IAGdZ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AIgC,GAAY,8HAGZC,EAAe,6vBAqCfC,EAAQC,SAASC,cAAc,QACnCF,GAAMG,UAAYL,EAAYC,EAC9BE,SAASG,KAAKC,YAAYL,IAGxBxC,EAAU,SAAU8C,EAAMC,GAE5B,GAAIC,GAAWD,CAGf,KAAK,GAAIE,KAAOH,GACVA,EAAKI,eAAeD,IACJE,SAAdL,EAAKG,KACPD,EAASC,GAAOH,EAAKG,GAK3B,OAAOD,GAKc,oBAAZI,UACa,mBAAXC,SAA0BA,OAAOD,UAC1CA,QAAUC,OAAOD,QAAU9E,GAE7B8E,QAAQE,UAAYhF,GAEpBiF,KAAKD,UAAYhF,EAIG,kBAAXkF,SAAyBA,OAAOC,KACzCD,OAAO,eAAiB,WACtB,MAAOlF,OAIXoF,KAAKH","file":"travelmap.js","sourcesContent":["//! travelmap.js\r\n//! version : 1.0.2\r\n//! authors : Shawn Wildermuth\r\n//! license : MIT\r\n//! repo : https://github.com/shawnwildermuth/travelmap\r\n\r\n// Build support for AMD or simple global (borrowed pattern from moment.js)\r\n(function () {\r\n\r\n \"use strict\";\r\n\r\n // travelMap object\r\n var _travelMap = {};\r\n\r\n var _defaultOptions = {\r\n stops: [], // Array of the stops to show (required)\r\n currentStop: 0, // Ordinal Position of current location\r\n selector: \"#map\", // CSS Selector for container for the map\r\n icon: { // Icon details\r\n url: \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAIAAABvrngfAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjExR/NCNwAAAA1JREFUGFdjoDNgYAAAAHIAAejt7scAAAAASUVORK5CYII=\",\r\n width: 3,\r\n height: 3,\r\n },\r\n initialZoom: 4, // Initial Level of Zoom for the Google Map\r\n pastStroke: { // Settings for the lines before the currentStop\r\n color: '#190300', \r\n opacity: 0.5,\r\n weight: 2\r\n },\r\n futureStroke: { // Settings for hte lines after the currentStop\r\n color: '#D30000',\r\n opacity: 0.6,\r\n weight: 2\r\n },\r\n mapOptions: { // Options for map (See GMaps for full list of options)\r\n draggable: true,\r\n scrollwheel: false,\r\n disableDoubleClickZoom: true,\r\n zoomControl: true\r\n },\r\n overlay: {\r\n className: \"travelmap-overlay\"\r\n }\r\n };\r\n\r\n\r\n _travelMap.createMap = function (options) {\r\n\r\n var map;\r\n var settings = _extend(options, _defaultOptions);\r\n\r\n if (!settings.stops || settings.stops.length == 0) {\r\n throw \"You must supply stops when creating a map.\";\r\n }\r\n\r\n // calculate past, future and current stops\r\n var pastLines = settings.stops.slice(0, settings.currentStop + 1);\r\n var futureLines = settings.stops.slice(settings.currentStop, settings.stops.length);\r\n var currentLocation = settings.stops[settings.currentStop];\r\n\r\n _initStyle();\r\n\r\n // Require GMaps and Google Maps API\r\n if (!(typeof window.GMaps === 'function' && window.GMaps)) {\r\n console.log('GMaps (and Google Maps API) is required. Please register the following JavaScript library https://hpneo.github.io/gmaps/documentation.html');\r\n }\r\n\r\n map = new GMaps({\r\n div: settings.selector,\r\n lat: currentLocation.lat,\r\n lng: currentLocation.long,\r\n zoom: settings.initialZoom\r\n });\r\n\r\n map.map.setOptions(settings.mapOptions);\r\n\r\n // Past Lines\r\n map.drawPolyline({\r\n path: _toLatLongCollection(pastLines),\r\n strokeColor: settings.pastStroke.color,\r\n strokeOpacity: settings.pastStroke.opacity,\r\n strokeWeight: settings.pastStroke.weight\r\n });\r\n\r\n // Future Lines\r\n map.drawPolyline({\r\n path: _toLatLongCollection(futureLines),\r\n strokeColor: settings.futureStroke.color,\r\n strokeOpacity: settings.futureStroke.opacity,\r\n strokeWeight: settings.futureStroke.weight\r\n });\r\n\r\n for (var i = 0; i < settings.stops.length; ++i) {\r\n var stop = settings.stops[i];\r\n if (i != settings.currentStop) {\r\n map.addMarker({\r\n lat: stop.lat,\r\n lng: stop.long,\r\n icon: settings.icon.url,\r\n infoWindow: { content: stop.info },\r\n anchorPoint: { x: settings.icon.width/2, y: settings.icon.height/2 }\r\n });\r\n }\r\n }\r\n\r\n map.drawOverlay({\r\n lat: currentLocation.lat,\r\n lng: currentLocation.long,\r\n content: '<div class=\"' + settings.overlay.className + '\">Current Location<br/>' + currentLocation.info + '<div class=\"' + settings.overlay.className + '-arrow ' + settings.overlay.className + '-arrow-above\"></div></div>',\r\n verticalAlign: 'top',\r\n horizontalAlign: 'center',\r\n layer: \"overlayImage\"\r\n });\r\n\r\n return {\r\n map: map,\r\n settings: settings,\r\n currentLocation: currentLocation\r\n };\r\n };\r\n\r\n var _toLatLong = function (stop) {\r\n return [ stop.lat, stop.long ];\r\n };\r\n\r\n var _toLatLongCollection = function (stops) {\r\n var collection = [];\r\n for (var x = 0; x < stops.length; ++x) {\r\n collection.push(_toLatLong(stops[x]));\r\n }\r\n \r\n return collection;\r\n };\r\n\r\n var _initStyle = function () {\r\n\r\n var stopStyle = \".stopName { background: none repeat scroll 0 0 #222; width: 4px; height: 4px; }\" +\r\n \".gm-style-iw{ overflow: hidden !important; }\";\r\n \r\n var overlayStyle = \" .travelmap-overlay{\" +\r\n\" display:block;\" +\r\n\" text-align:center;\" +\r\n\" color:#fff;\" +\r\n\" font-size:12px;\" +\r\n\" line-height:14px;\" +\r\n\" opacity:0.8;\" +\r\n\" background:#4477aa;\" +\r\n\" border:solid 3px #336699;\" +\r\n\" border-radius:4px;\" +\r\n\" box-shadow:2px 2px 10px #333;\" +\r\n\" text-shadow:1px 1px 1px #666;\" +\r\n\" padding:0 4px;\" +\r\n\" margin-top: -24px;\" +\r\n\" white-space: nowrap;\" +\r\n\"}\" +\r\n\r\n\".travelmap-overlay-arrow{\" +\r\n\" left:50%;\" +\r\n\" margin-left:-16px;\" +\r\n\" width:0;\" +\r\n\" height:0;\" +\r\n\" position:absolute;\" +\r\n\"}\" +\r\n\".travelmap-overlay-arrow.travelmap-overlay-arrow-above{\" +\r\n\" bottom:-15px;\" +\r\n\" border-left:16px solid transparent;\" +\r\n\" border-right:16px solid transparent;\" +\r\n\" border-top:16px solid #336699;\" +\r\n\"}\" +\r\n\".travelmap-overlay-arrow.travelmap-overlay-arrow-below{\" +\r\n\" top:-15px;\" +\r\n\" border-left:16px solid transparent;\" +\r\n\" border-right:16px solid transparent;\" +\r\n\" border-bottom:16px solid #336699;\" +\r\n\"}\";\r\n\r\n var style = document.createElement(\"style\");\r\n style.innerHTML = stopStyle + overlayStyle;\r\n document.head.appendChild(style);\r\n };\r\n\r\n var _extend = function (base, defaults) {\r\n\r\n var extended = defaults;\r\n \r\n // Extend options with defaults\r\n for (var key in base) {\r\n if (base.hasOwnProperty(key)) {\r\n if (base[key] !== undefined) {\r\n extended[key] = base[key];\r\n }\r\n }\r\n }\r\n\r\n return extended;\r\n\r\n };\r\n\r\n // Expose it as a public\r\n if (typeof exports !== 'undefined') {\r\n if (typeof module !== 'undefined' && module.exports) {\r\n exports = module.exports = _travelMap;\r\n }\r\n exports.travelMap = _travelMap;\r\n } else {\r\n this.travelMap = _travelMap;\r\n }\r\n\r\n // AMD registration \r\n if (typeof define === 'function' && define.amd) {\r\n define('travelMap', [], function () {\r\n return _travelMap;\r\n });\r\n }\r\n\r\n}.call(this));"],"sourceRoot":"/source/"}