<commit_before>var launchOpenLayers = (function(_opts){
    var scriptsStarted = false, scriptsFinished = false;
    var mapElem;
    var opts;
    var context = {};
    var loadingMessageElement = false;
    var defaultOpts = {
        elem: '#map',
        centroid: {
              lat: 0.000068698255561324,
              lng: 0.000083908685869343
        },
        olImgPath: "/static/openlayers/default/img/",
        tileUrl: "http://tilestream.openmangrove.org:8888/",
        layers: [
            ["Nigeria", "nigeria_base"]
        ],
        overlays: [],
        defaultLayer: 'google',
        layerSwitcher: true,
        loadingElem: false,
        loadingMessage: false,
        zoom: 6,
        maxExtent: [-20037500, -20037500, 20037500, 20037500],
        restrictedExtent: [-4783.9396188051, 463514.13943762, 1707405.4936624, 1625356.9691642]
    }
    var onScriptLoadFns = [];
    function loadScripts() {
        var openlayers = $.ajax({
            url: '/static/js/libs/OpenLayers.js',
            dataType: 'script',
            cache: false
        }).done(function(){
            $.ajax({
                url: '/static/js/libs/wax.ol.min.js',
                dataType: 'script',
                cache: false
                }).done(scriptsAreLoaded);
        });
        function scriptsAreLoaded(){
            if(!!loadingMessageElement) {
                loadingMessageElement.hide();
            }
            OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
            OpenLayers.ImgPath = opts.olImgPath;
            var ob = opts.maxExtent, re = opts.restrictedExtent;
            var options = {
                projection: new OpenLayers.Projection("EPSG:900913"),
                displayProjection: new OpenLayers.Projection("EPSG:4326"),
                units: "m",
                maxResolution: 156543.0339,
                restrictedExtent: new OpenLayers.Bounds(re[0], re[1], re[2], re[3]),
                maxExtent: new OpenLayers.Bounds(ob[0], ob[1], ob[2], ob[3])
              };
            var mapId = mapElem.get(0).id;
            var mapserver = opts.tileUrl;
            var mapLayerArray = [];
            context.mapLayers = {};
            $.each(opts.overlays, function(k, ldata){
                var ml = new OpenLayers.Layer.TMS(ldata[0], [mapserver],
                    {
                        layername: ldata[1],
                        'type': 'png',
                        transparent: "true",
                        isBaseLayer: false
                    });
                mapLayerArray.push(ml);
                context.mapLayers[ldata[1]] = ml;
                });
            $.each(opts.layers, function(k, ldata){
                var ml = new OpenLayers.Layer.TMS(ldata[0], [mapserver],
                    {
                        layername: ldata[1],
                        'type': 'png'
                    });
                mapLayerArray.push(ml);
                context.mapLayers[ldata[1]] = ml;
                });
            context.waxLayerDict = {};
            context.activeWax;
            function ifDefined(str) {
                if(str === "" || str === undefined) {
                    return undefined;
                } else {
                    return str;
                }
            }
//            $.each(opts.layers, function(k, ldata){
//                var layerName = ifDefined(ldata[0]);
//                var layerKey = ifDefined(ldata[1]);
//                var layerViewLevel = ifDefined(ldata[2]);
//                var indicatorSlug = ifDefined(ldata[3]);
//                if (layerViewLevel !== undefined && indicatorSlug !== undefined) {
//                    //log("Adding to waxLayerDict", layerKey);
//                    base_url = mapserver + '1.0.0/' + ldata[1] + '/{z}/{x}/{y}';
//                    context.waxLayerDict[layerKey] = new wax.ol.Interaction({
//                        tilejson: '1.0.0',
//                        scheme: 'tms',
//                        tiles: [base_url + '.png'],
//                        grids: [base_url + '.grid.json'],
//                        formatter: function(options, data) { 
//                            log(options, data);
//                            return JSON.stringify([options, data]); }
//                        });
//                }
//            });
            if(!mapId) {mapId = mapElem.get(0).id= "-openlayers-map-elem"}
            context.map = new OpenLayers.Map(mapId, options);
            var googleSat = new OpenLayers.Layer.Google( "Google", {type: 'satellite'});
            mapLayerArray.push(googleSat);
            context.map.addLayers(mapLayerArray);
            if(opts.defaultLayer==='google') {
                context.map.setBaseLayer(googleSat);
            }
            if(opts.layerSwitcher) {
                context.map.addControl(new OpenLayers.Control.LayerSwitcher());
            }
//            context.map.setCenter(new OpenLayers.LonLat(opts.centroid.lng, opts.centroid.lat), opts.zoom);
            $.each(onScriptLoadFns, function(i, fn){fn.call(context);})
            scriptsFinished = true;
        }
    }
    function loadGoogleMaps() {
        $('body').append($("<script />", {src: "http://maps.google.com/maps/api/js?sensor=false&callback=loadOpenLayers"}));
    }<commit_msg>adding inactive map layer (google roads map)<commit_after>var launchOpenLayers = (function(_opts){
    var scriptsStarted = false, scriptsFinished = false;
    var mapElem;
    var opts;
    var context = {};
    var loadingMessageElement = false;
    var defaultOpts = {
        elem: '#map',
        centroid: {
              lat: 0.000068698255561324,
              lng: 0.000083908685869343
        },
        olImgPath: "/static/openlayers/default/img/",
        tileUrl: "http://tilestream.openmangrove.org:8888/",
        layers: [
            ["Nigeria", "nigeria_base"]
        ],
        overlays: [],
        defaultLayer: 'google',
        layerSwitcher: true,
        loadingElem: false,
        loadingMessage: false,
        zoom: 6,
        maxExtent: [-20037500, -20037500, 20037500, 20037500],
        restrictedExtent: [-4783.9396188051, 463514.13943762, 1707405.4936624, 1625356.9691642]
    }
    var onScriptLoadFns = [];
    function loadScripts() {
        var openlayers = $.ajax({
            url: '/static/js/libs/OpenLayers.js',
            dataType: 'script',
            cache: false
        }).done(function(){
            $.ajax({
                url: '/static/js/libs/wax.ol.min.js',
                dataType: 'script',
                cache: false
                }).done(scriptsAreLoaded);
        });
        function scriptsAreLoaded(){
            if(!!loadingMessageElement) {
                loadingMessageElement.hide();
            }
            OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
            OpenLayers.ImgPath = opts.olImgPath;
            var ob = opts.maxExtent, re = opts.restrictedExtent;
            var options = {
                projection: new OpenLayers.Projection("EPSG:900913"),
                displayProjection: new OpenLayers.Projection("EPSG:4326"),
                units: "m",
                maxResolution: 156543.0339,
                restrictedExtent: new OpenLayers.Bounds(re[0], re[1], re[2], re[3]),
                maxExtent: new OpenLayers.Bounds(ob[0], ob[1], ob[2], ob[3])
              };
            var mapId = mapElem.get(0).id;
            var mapserver = opts.tileUrl;
            var mapLayerArray = [];
            context.mapLayers = {};
            $.each(opts.overlays, function(k, ldata){
                var ml = new OpenLayers.Layer.TMS(ldata[0], [mapserver],
                    {
                        layername: ldata[1],
                        'type': 'png',
                        transparent: "true",
                        isBaseLayer: false
                    });
                mapLayerArray.push(ml);
                context.mapLayers[ldata[1]] = ml;
                });
            $.each(opts.layers, function(k, ldata){
                var ml = new OpenLayers.Layer.TMS(ldata[0], [mapserver],
                    {
                        layername: ldata[1],
                        'type': 'png'
                    });
                mapLayerArray.push(ml);
                context.mapLayers[ldata[1]] = ml;
                });
            context.waxLayerDict = {};
            context.activeWax;
            function ifDefined(str) {
                if(str === "" || str === undefined) {
                    return undefined;
                } else {
                    return str;
                }
            }
//            $.each(opts.layers, function(k, ldata){
//                var layerName = ifDefined(ldata[0]);
//                var layerKey = ifDefined(ldata[1]);
//                var layerViewLevel = ifDefined(ldata[2]);
//                var indicatorSlug = ifDefined(ldata[3]);
//                if (layerViewLevel !== undefined && indicatorSlug !== undefined) {
//                    //log("Adding to waxLayerDict", layerKey);
//                    base_url = mapserver + '1.0.0/' + ldata[1] + '/{z}/{x}/{y}';
//                    context.waxLayerDict[layerKey] = new wax.ol.Interaction({
//                        tilejson: '1.0.0',
//                        scheme: 'tms',
//                        tiles: [base_url + '.png'],
//                        grids: [base_url + '.grid.json'],
//                        formatter: function(options, data) { 
//                            log(options, data);
//                            return JSON.stringify([options, data]); }
//                        });
//                }
//            });
            if(!mapId) {mapId = mapElem.get(0).id= "-openlayers-map-elem"}
            context.map = new OpenLayers.Map(mapId, options);
            window.__map = context.map;
            var googleSat = new OpenLayers.Layer.Google( "Google", {type: 'satellite'});
            var googleMap = new OpenLayers.Layer.Google( "Roads", {type: 'roadmap'});
            //__map.setBaseLayer(_.find(__map.layers, function(m){return m.name==="Roads";}))
            mapLayerArray.push(googleSat, googleMap);
            context.map.addLayers(mapLayerArray);
            if(opts.defaultLayer==='google') {
                context.map.setBaseLayer(googleSat);
            }
            if(opts.layerSwitcher) {
                context.map.addControl(new OpenLayers.Control.LayerSwitcher());
            }
//            context.map.setCenter(new OpenLayers.LonLat(opts.centroid.lng, opts.centroid.lat), opts.zoom);
            $.each(onScriptLoadFns, function(i, fn){fn.call(context);})
            scriptsFinished = true;
        }
    }
    function loadGoogleMaps() {
        $('body').append($("<script />", {src: "http://maps.google.com/maps/api/js?sensor=false&callback=loadOpenLayers"}));
    }
{'fraction_non_alphanumeric': 0.13555269450064375, 'fraction_numerical': 0.03292256759242229, 'mean_word_length': 1.4482215218370103, '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': '4926389', 'n_tokens_mistral': 3382, 'n_tokens_neox': 3039, 'n_words': 527}