<commit_before>/**
 * The Image map layer module.
 *
 * @return ImageLayer class (extends Class).
 */
define([
  'underscore',
  'uri',
  'abstract/layer/OverlayLayerClass',
], function(_, UriTemplate, OverlayLayerClass) {

  'use strict';

  var ImageMaptypeLayerClass = OverlayLayerClass.extend({

    defaults: {
      urlTemplate: ''
    },

    init: function(layer, options, map) {
      _.bindAll(this, '_getUrl');
      this._super(layer, options, map);
      this._setImageMaptype();
    },

    _getLayer: function() {
      var deferred = new $.Deferred();
      deferred.resolve(this._imageMaptype);
      return deferred.promise();
    },

    /**
     * Generates the google.maps.ImageMapType layer.
     */
    _setImageMaptype: function() {
      this._imageMaptype = new google.maps.ImageMapType({
        tileSize: this.tileSize,
        opacity: 1,
        isPng: true,
        name: this.name,
        getTileUrl: this._getUrl
      });
    },

    /**
     * Called whenever the Google Maps API determines that the map needs to
     * display new tiles for the given viewport.
     *
     * @param  {obj}     tile Tile coordenades {x ,y}
     * @param  {integer} zoom Current map zoom
     * @return {string}  url  Tile url
     */
    _getUrl: function(tile, zoom) {
      if (window.location.search.contains('&hres=')) {
        var params_new_url = {};
        var parts = location.search.substring(1).split('&');
        for (var i = 0; i < parts.length; i++) {
          var nv = parts[i].split('=');
          if (!nv[0]) continue;
            params_new_url[nv[0]] = nv[1] || true;
        }
        var params = btoa(JSON.stringify(params_new_url.hres));
      }
      else if (!sessionStorage.getItem('high-resolution')) {
        var params = {
         'color_filter': 'rgb',
         'cloud': '100',
         'mindate': '2000-09-01',
         'maxdate': '2015-09-01'
        }
      } else {
        var params = JSON.parse(atob(sessionStorage.getItem('high-resolution')));
      }
      return new UriTemplate(this.options.urlTemplate).fillFromObject({
        x: tile.x,
        y: tile.y,
        z: zoom,
        sat: params.color_filter,
        cloud: params.cloud,
        mindate: params.mindate,
        maxdate: params.maxdate
      });
    }
  });

  return ImageMaptypeLayerClass;
});<commit_msg>high res read params properly<commit_after>/**
 * The Image map layer module.
 *
 * @return ImageLayer class (extends Class).
 */
define([
  'underscore',
  'uri',
  'abstract/layer/OverlayLayerClass',
], function(_, UriTemplate, OverlayLayerClass) {

  'use strict';

  var ImageMaptypeLayerClass = OverlayLayerClass.extend({

    defaults: {
      urlTemplate: ''
    },

    init: function(layer, options, map) {
      _.bindAll(this, '_getUrl');
      this._super(layer, options, map);
      this._setImageMaptype();
    },

    _getLayer: function() {
      var deferred = new $.Deferred();
      deferred.resolve(this._imageMaptype);
      return deferred.promise();
    },

    /**
     * Generates the google.maps.ImageMapType layer.
     */
    _setImageMaptype: function() {
      this._imageMaptype = new google.maps.ImageMapType({
        tileSize: this.tileSize,
        opacity: 1,
        isPng: true,
        name: this.name,
        getTileUrl: this._getUrl
      });
    },

    /**
     * Called whenever the Google Maps API determines that the map needs to
     * display new tiles for the given viewport.
     *
     * @param  {obj}     tile Tile coordenades {x ,y}
     * @param  {integer} zoom Current map zoom
     * @return {string}  url  Tile url
     */
    _getUrl: function(tile, zoom) {
      if (window.location.search.contains('&hres=')) {
        var params_new_url = {};
        var parts = location.search.substring(1).split('&');
        for (var i = 0; i < parts.length; i++) {
          var nv = parts[i].split('=');
          if (!nv[0]) continue;
            params_new_url[nv[0]] = nv[1] || true;
        }
        var params = JSON.parse(atob(params_new_url.hres));
      }
      else if (!sessionStorage.getItem('high-resolution')) {
        var params = {
         'color_filter': 'rgb',
         'cloud': '100',
         'mindate': '2000-09-01',
         'maxdate': '2015-09-01'
        }
      } else {
        var params = JSON.parse(atob(sessionStorage.getItem('high-resolution')));
      }
      return new UriTemplate(this.options.urlTemplate).fillFromObject({
        x: tile.x,
        y: tile.y,
        z: zoom,
        sat: params.color_filter,
        cloud: params.cloud,
        mindate: params.mindate,
        maxdate: params.maxdate
      });
    }
  });

  return ImageMaptypeLayerClass;
});
{'fraction_non_alphanumeric': 0.13975287601193012, 'fraction_numerical': 0.010651896037494673, 'mean_word_length': 2.2179575051405074, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '6986581', 'n_tokens_mistral': 1512, 'n_tokens_neox': 1465, 'n_words': 334}