<commit_before>/*
 * Leaflet.ExtraMarkers is a near copy of Leaflet.AwesomeMarkers (c) 2012-2013, <NAME>, https://github.com/lvoogdt
 * Making color changes and adding shapes are what drove me to make this copy and not a fork...
 */

/*global L*/

(function (window, document, undefined) {
    "use strict";

    L.ExtraMarkers = {};

    L.ExtraMarkers.version = '1.0.1';

    L.ExtraMarkers.Icon = L.Icon.extend({
        options: {
            iconSize: [35, 45],
            iconAnchor:   [17, 42],
            popupAnchor: [1, -32],
            shadowAnchor: [10, 12],
            shadowSize: [36, 16],
            className: 'extra-marker',
            prefix: '',
            extraClasses: '',
            shape: 'circle',
            icon: '',
            markerColor: 'red',
            iconColor: '#fff'
        },

        initialize: function (options) {
            options = L.Util.setOptions(this, options);
        },

        createIcon: function () {
            var div = document.createElement('div'),
                options = this.options;

            if (options.icon) {
                div.innerHTML = this._createInner();
            }

            if (options.bgPos) {
                div.style.backgroundPosition =
                    (-options.bgPos.x) + 'px ' + (-options.bgPos.y) + 'px';
            }

            this._setIconStyles(div, options.shape + '-' + options.markerColor);
            return div;
        },

        _createInner: function() {
            var iconClass, iconSpinClass = "", iconColorClass = "", iconColorStyle = "", options = this.options;

            if(options.iconColor) {
                iconColorStyle = "style='color: " + options.iconColor + "' ";
            }

            return "<i " + iconColorStyle + "class='" + options.extraClasses + " " + options.prefix + " " + options.icon + "'></i>";
        },

        _setIconStyles: function (img, name) {
            var options = this.options,
                size = L.point(options[name === 'shadow' ? 'shadowSize' : 'iconSize']),
                anchor;

            if (name === 'shadow') {
                anchor = L.point(options.shadowAnchor || options.iconAnchor);
            } else {
                anchor = L.point(options.iconAnchor);
            }

            if (!anchor && size) {
                anchor = size.divideBy(2, true);
            }

            img.className = 'extra-marker-' + name + ' ' + options.className;

            if (anchor) {
                img.style.marginLeft = (-anchor.x) + 'px';
                img.style.marginTop  = (-anchor.y) + 'px';
            }

            if (size) {
                img.style.width  = size.x + 'px';
                img.style.height = size.y + 'px';
            }
        },

        createShadow: function () {
            var div = document.createElement('div');

            this._setIconStyles(div, 'shadow');
            return div;
        }
    });

    L.ExtraMarkers.icon = function (options) {
        return new L.ExtraMarkers.Icon(options);
    };
<commit_msg>Added leaflet-marker-icon/shadow class<commit_after>/*
 * Leaflet.ExtraMarkers is a near copy of Leaflet.AwesomeMarkers (c) 2012-2013, <NAME>, https://github.com/lvoogdt
 * Making color changes and adding shapes are what drove me to make this copy and not a fork...
 */

/*global L*/

(function (window, document, undefined) {
    "use strict";

    L.ExtraMarkers = {};

    L.ExtraMarkers.version = '1.0.1';

    L.ExtraMarkers.Icon = L.Icon.extend({
        options: {
            iconSize: [35, 45],
            iconAnchor:   [17, 42],
            popupAnchor: [1, -32],
            shadowAnchor: [10, 12],
            shadowSize: [36, 16],
            className: 'extra-marker',
            prefix: '',
            extraClasses: '',
            shape: 'circle',
            icon: '',
            markerColor: 'red',
            iconColor: '#fff'
        },

        initialize: function (options) {
            options = L.Util.setOptions(this, options);
        },

        createIcon: function () {
            var div = document.createElement('div'),
                options = this.options;

            if (options.icon) {
                div.innerHTML = this._createInner();
            }

            if (options.bgPos) {
                div.style.backgroundPosition =
                    (-options.bgPos.x) + 'px ' + (-options.bgPos.y) + 'px';
            }

            this._setIconStyles(div, options.shape + '-' + options.markerColor);
            return div;
        },

        _createInner: function() {
            var iconClass, iconSpinClass = "", iconColorClass = "", iconColorStyle = "", options = this.options;

            if(options.iconColor) {
                iconColorStyle = "style='color: " + options.iconColor + "' ";
            }

            return "<i " + iconColorStyle + "class='" + options.extraClasses + " " + options.prefix + " " + options.icon + "'></i>";
        },

        _setIconStyles: function (img, name) {
            var options = this.options,
                size = L.point(options[name === 'shadow' ? 'shadowSize' : 'iconSize']),
                anchor, leafletName;

            if (name === 'shadow') {
                anchor = L.point(options.shadowAnchor || options.iconAnchor);
                leafletName = 'shadow';
            } else {
                anchor = L.point(options.iconAnchor);
                leafletName = 'icon';
            }

            if (!anchor && size) {
                anchor = size.divideBy(2, true);
            }

            img.className = 'leaflet-marker-' + leafletName + ' extra-marker-' + name + ' ' + options.className;

            if (anchor) {
                img.style.marginLeft = (-anchor.x) + 'px';
                img.style.marginTop  = (-anchor.y) + 'px';
            }

            if (size) {
                img.style.width  = size.x + 'px';
                img.style.height = size.y + 'px';
            }
        },

        createShadow: function () {
            var div = document.createElement('div');

            this._setIconStyles(div, 'shadow');
            return div;
        }
    });

    L.ExtraMarkers.icon = function (options) {
        return new L.ExtraMarkers.Icon(options);
    };

{'fraction_non_alphanumeric': 0.1399203187250996, 'fraction_numerical': 0.009880478087649403, 'mean_word_length': 1.516439454691259, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6691863', 'n_tokens_mistral': 1824, 'n_tokens_neox': 1706, 'n_words': 375}