PageSourceSearch

https://commuterinfo.net/js/libs/Leaflet.vector-markers.js

js commuterinfo.net collected 2026-09-28 12:49:43 UTC 4,387 bytes, 112 lines download raw bytes

1(function() {
2  (function(window, document, undefined_) {
3    "use strict";
4    L.VectorMarkers = {};
5    L.VectorMarkers.version = "1.0.0";
6    L.VectorMarkers.MAP_PIN = 'M16,1 C7.7146,1 1,7.65636364 1,15.8648485 C1,24.0760606 16,51 16,51 C16,51 31,24.0760606 31,15.8648485 C31,7.65636364 24.2815,1 16,1 L16,1 Z';
7    L.VectorMarkers.Icon = L.Icon.extend({
8      options: {
9        iconSize: [30, 50],
10        iconAnchor: [15, 50],
11        popupAnchor: [2, -40],
12        shadowAnchor: [7, 45],
13        shadowSize: [54, 51],
14        shadow:true,
15        className: "vector-marker",
16        prefix: "fa",
17        spinClass: "fa-spin",
18        extraClasses: "",
19        icon: "home",
20        markerColor: "blue",
21        iconColor: "white",
22        markerShape:"pin"
23      },
24      initialize: function(options) {
25        return options = L.Util.setOptions(this, options);
26      },
27      createIcon: function(oldIcon) {
28        var div, icon, options, pin_path;
29        div = (oldIcon && oldIcon.tagName === "DIV" ? oldIcon : document.createElement("div"));
30        options = this.options;
31        if (options.icon) {
32          icon = this._createInner();
33        }
34        options.shadow = false;
35        options.iconSize = [24,24];
36        options.iconAnchor = [12,12];
37        options.popupAnchor =[12,-40]
38
39        if(options.markerShape === "circle") {
40          options.className = "vector-marker-circle"
41          pin_path = L.VectorMarkers.MAP_CIRCLE;
42          div.innerHTML = '<div style="width: 24px; height: 24px; border-radius: 50%; background:' + options.markerColor + '">' + icon + '</div>';
43
44        }else if(options.markerShape === "pin"){
45          pin_path = L.VectorMarkers.MAP_PIN;
46          div.innerHTML = '<svg width="32px" height="52px" viewBox="0 0 32 52" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' + '<path d="' + pin_path + '" fill="' + options.markerColor + '"></path>' + icon + '</svg>';
47        }
48        this._setIconStyles(div, "icon");
49        this._setIconStyles(div, "icon-" + options.markerColor);
50        return div;
51      },
52      _createInner: function() {
53        var iconClass, iconColorClass, iconColorStyle, iconSpinClass, options;
54        iconClass = void 0;
55        iconSpinClass = "";
56        iconColorClass = "";
57        iconColorStyle = "";
58        options = this.options;
59        if (options.prefix === '' || options.icon.slice(0, options.prefix.length + 1) === options.prefix + "-") {
60          iconClass = options.icon;
61        } else {
62          iconClass = options.prefix + "-" + options.icon;
63        }
64        if (options.spin && typeof options.spinClass === "string") {
65          iconSpinClass = options.spinClass;
66        }
67        if (options.iconColor) {
68          if (options.iconColor === "white" || options.iconColor === "black") {
69            iconColorClass = "icon-" + options.iconColor;
70          } else {
71            iconColorStyle = "style='color: " + options.iconColor + "' ";
72          }
73        }
74        return "<i " + iconColorStyle + "class='" + options.extraClasses + " " + options.prefix + " " + iconClass + " " + iconSpinClass + " " + iconColorClass + "'></i>";
75      },
76      _setIconStyles: function(img, name) {
77        var anchor, options, size;
78        options = this.options;
79        size = L.point(options[(name === "shadow" ? "shadowSize" : "iconSize")]);
80        anchor = void 0;
81        if (name === "shadow") {
82          anchor = L.point(options.shadowAnchor || options.iconAnchor);
83        } else {
84          anchor = L.point(options.iconAnchor);
85        }
86        if (!anchor && size) {
87          anchor = size.divideBy(2, true);
88        }
89        img.className = "vector-marker-" + name + " " + options.className;
90        if (anchor) {
91          img.style.marginLeft = (-anchor.x) + "px";
92          img.style.marginTop = (-anchor.y) + "px";
93        }
94        if (size) {
95          img.style.width = size.x + "px";
96          return img.style.height = size.y + "px";
97        }
98      },
99      createShadow: function() {
100        if(!this.options.shadow) return;
101        var div;
102        div = document.createElement("div");
103        this._setIconStyles(div, "shadow");
104        return div;
105      }
106    });
107    return L.VectorMarkers.icon = function(options) {
108      return new L.VectorMarkers.Icon(options);
109    };
110  })(this, document);
111
112}).call(this);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.