<commit_before>var AddressPickerRails = AddressPickerRails || {}

/**
 * Google Maps utilities as a singleton.
 */
AddressPickerRails.GMaps = function () {

    // ---------- singleton --------------------------------------------------------------------------------------------

    if (AddressPickerRails.GMaps.caller != AddressPickerRails.GMaps.instance) {
        throw "AddressPickerRails.GMaps is a singleton, access must be done by AddressPickerRails.GMaps.instance()";
    }

    if (arguments.callee.singleton) {
        return arguments.callee.singleton;
    }

    arguments.callee.singleton = this;

    // ---------- private fields ---------------------------------------------------------------------------------------

    var STATE_NOT_LOADED = "not_loaded";
    var STATE_LOADING = "loading";
    var STATE_LOADED = "loaded";

    var state = STATE_NOT_LOADED;
    var callbacks = new Array();

    // ---------- private methods --------------------------------------------------------------------------------------

    /**
     * Load the Google Maps API.
     * @param callback the function to call when the API is loaded.
     */
    var doLoad = function (callback) {
        //console.debug("Loading GMaps API");

        var script = document.createElement("script");
        script.src = "http://maps.google.com/maps/api/js?sensor=false&callback=AddressPickerRails.GMaps.onLoad";
        script.type = "text/javascript";

        callbacks.push(callback);
        state = STATE_LOADING;

        $("head").append(script);
    };

    /**
     * !!! PRIVATE !!!
     * Call all the defined callback functions.
     */
    this.doCallback = function () {
        for (var i in callbacks) {
            callbacks[i]();
        }
    };
<commit_msg>fix for https support<commit_after>var AddressPickerRails = AddressPickerRails || {}

/**
 * Google Maps utilities as a singleton.
 */
AddressPickerRails.GMaps = function () {

    // ---------- singleton --------------------------------------------------------------------------------------------

    if (AddressPickerRails.GMaps.caller != AddressPickerRails.GMaps.instance) {
        throw "AddressPickerRails.GMaps is a singleton, access must be done by AddressPickerRails.GMaps.instance()";
    }

    if (arguments.callee.singleton) {
        return arguments.callee.singleton;
    }

    arguments.callee.singleton = this;

    // ---------- private fields ---------------------------------------------------------------------------------------

    var STATE_NOT_LOADED = "not_loaded";
    var STATE_LOADING = "loading";
    var STATE_LOADED = "loaded";

    var state = STATE_NOT_LOADED;
    var callbacks = new Array();

    // ---------- private methods --------------------------------------------------------------------------------------

    /**
     * Load the Google Maps API.
     * @param callback the function to call when the API is loaded.
     */
    var doLoad = function (callback) {
        //console.debug("Loading GMaps API");

        var script = document.createElement("script");
        if (window.location.protocol === "https:") {
          script.src = "https://maps.google.com/maps/api/js?sensor=false&callback=AddressPickerRails.GMaps.onLoad";
        } else {
          script.src = "http://maps.google.com/maps/api/js?sensor=false&callback=AddressPickerRails.GMaps.onLoad";
        }

        script.type = "text/javascript";

        callbacks.push(callback);
        state = STATE_LOADING;

        $("head").append(script);
    };

    /**
     * !!! PRIVATE !!!
     * Call all the defined callback functions.
     */
    this.doCallback = function () {
        for (var i in callbacks) {
            callbacks[i]();
        }
    };

{'fraction_non_alphanumeric': 0.2608811748998665, 'fraction_numerical': 0.0, 'mean_word_length': 1.4923486360612108, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, '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': '2973948', 'n_tokens_mistral': 980, 'n_tokens_neox': 921, 'n_words': 211}