<commit_before>/*
 *  jquery-boilerplate - v4.0.0
 *  A jump-start for jQuery plugins development.
 *  http://jqueryboilerplate.com
 *
 *  Made by <NAME>
 *  Under MIT License
 */
;( function( $, window, document, undefined ) {

    "use strict";

    // Create the defaults once
    var pluginName = "jqGeojsonField",
        defaults   = {
            inputSelector: "",
            zoom:          13,
            maxzoom:       18,
            lat:           48.856578,
            long:          2.351828,
            polyline:      true,
            polygon:       true,
            marker:        true,
            circle:        false,
            rectangle:     false,
            remove:        true,
            style:         false
        };

    // The actual plugin constructor
    function Plugin ( element, options ) {
        this.element    = element;
        this.settings   = $.extend( {}, defaults, options );
        this._defaults  = defaults;
        this._name      = pluginName;
        this.$input     = $(this.settings.inputSelector);
        this.map        = undefined;
        this.drawnItems = undefined;

        this.init();
    }

    // Avoid Plugin.prototype conflicts
    $.extend( Plugin.prototype, {
        init: function() {
            this.loadSettingsFromDataAttributes();
            this.createMap();
            this.addDrawEditor();

            if (this.settings.style) {
                this.addStyleEditor();
            }
        },
        loadSettingsFromDataAttributes: function() {
            var defaults = $(this.element).data();

            if (defaults.hasOwnProperty('geojsonfieldZoom') )      { this.settings.zoom = defaults.geojsonfieldZoom; }
            if (defaults.hasOwnProperty('geojsonfieldMaxzoom') )   { this.settings.maxzoom = defaults.geojsonfieldMaxzoom; }
            if (defaults.hasOwnProperty('geojsonfieldLat') )       { this.settings.lat = defaults.geojsonfieldLat; }
            if (defaults.hasOwnProperty('geojsonfieldLong') )      { this.settings.long = defaults.geojsonfieldLong; }
            if (defaults.hasOwnProperty('geojsonfieldPolyline') )  { this.settings.polyline = defaults.geojsonfieldPolyline; }
            if (defaults.hasOwnProperty('geojsonfieldPolygon') )   { this.settings.polygon = defaults.geojsonfieldPolygon; }
            if (defaults.hasOwnProperty('geojsonfieldMarker') )    { this.settings.marker = defaults.geojsonfieldMarker; }
            if (defaults.hasOwnProperty('geojsonfieldCircle') )    { this.settings.circle = defaults.geojsonfieldCircle; }
            if (defaults.hasOwnProperty('geojsonfieldRectangle') ) { this.settings.rectangle = defaults.geojsonfieldRectangle; }
            if (defaults.hasOwnProperty('geojsonfieldRemove') )    { this.settings.remove = defaults.geojsonfieldRemove; }
            if (defaults.hasOwnProperty('geojsonfieldStyle') )     { this.settings.style = defaults.geojsonfieldStyle; }
        },
        createMap: function() {<commit_msg>Display tiles on invisible tab<commit_after>/*
 *  jquery-boilerplate - v4.0.0
 *  A jump-start for jQuery plugins development.
 *  http://jqueryboilerplate.com
 *
 *  Made by <NAME>
 *  Under MIT License
 */
;( function( $, window, document, undefined ) {

    "use strict";

    // Create the defaults once
    var pluginName = "jqGeojsonField",
        defaults   = {
            inputSelector: "",
            zoom:          13,
            maxzoom:       18,
            lat:           48.856578,
            long:          2.351828,
            polyline:      true,
            polygon:       true,
            marker:        true,
            circle:        false,
            rectangle:     false,
            remove:        true,
            style:         false
        };

    // The actual plugin constructor
    function Plugin ( element, options ) {
        this.element    = element;
        this.settings   = $.extend( {}, defaults, options );
        this._defaults  = defaults;
        this._name      = pluginName;
        this.$input     = $(this.settings.inputSelector);
        this.map        = undefined;
        this.drawnItems = undefined;

        this.init();
    }

    // Avoid Plugin.prototype conflicts
    $.extend( Plugin.prototype, {
        init: function() {
            this.loadSettingsFromDataAttributes();
            this.createMap();
            this.addDrawEditor();

            if (this.settings.style) {
                this.addStyleEditor();
            }

            this.waitingToShow();
        },
        // Wait until div is visible, to load tiles on every part of the container
        waitingToShow: function() {
            var _this = this;

            if (! $(_this.element).is(':visible') ) {
                window.setTimeout(function(){ _this.waitingToShow(); }, 500);
            } else {
                _this.map.invalidateSize();
            }
        },
        loadSettingsFromDataAttributes: function() {
            var defaults = $(this.element).data();

            if (defaults.hasOwnProperty('geojsonfieldZoom') )      { this.settings.zoom = defaults.geojsonfieldZoom; }
            if (defaults.hasOwnProperty('geojsonfieldMaxzoom') )   { this.settings.maxzoom = defaults.geojsonfieldMaxzoom; }
            if (defaults.hasOwnProperty('geojsonfieldLat') )       { this.settings.lat = defaults.geojsonfieldLat; }
            if (defaults.hasOwnProperty('geojsonfieldLong') )      { this.settings.long = defaults.geojsonfieldLong; }
            if (defaults.hasOwnProperty('geojsonfieldPolyline') )  { this.settings.polyline = defaults.geojsonfieldPolyline; }
            if (defaults.hasOwnProperty('geojsonfieldPolygon') )   { this.settings.polygon = defaults.geojsonfieldPolygon; }
            if (defaults.hasOwnProperty('geojsonfieldMarker') )    { this.settings.marker = defaults.geojsonfieldMarker; }
            if (defaults.hasOwnProperty('geojsonfieldCircle') )    { this.settings.circle = defaults.geojsonfieldCircle; }
            if (defaults.hasOwnProperty('geojsonfieldRectangle') ) { this.settings.rectangle = defaults.geojsonfieldRectangle; }
            if (defaults.hasOwnProperty('geojsonfieldRemove') )    { this.settings.remove = defaults.geojsonfieldRemove; }
            if (defaults.hasOwnProperty('geojsonfieldStyle') )     { this.settings.style = defaults.geojsonfieldStyle; }
        },
        createMap: function() {
{'fraction_non_alphanumeric': 0.11066084788029926, 'fraction_numerical': 0.007325436408977556, 'mean_word_length': 2.0042134831460676, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '1004094', 'n_tokens_mistral': 1707, 'n_tokens_neox': 1674, 'n_words': 315}