<commit_before>(function(context) {
  function glower(map, tj) {
    tilejson = tj;

    var MM = com.modestmaps,
        waxGM = wax.GridManager(tilejson),
        eventoffset = wax.util.eventoffset,
        addEvent = MM.addEvent,
        removeEvent = MM.removeEvent,
        g = {},
        hovertiles = map.parent.appendChild(document.createElement('div')),
        // Active feature
        _af,
        // Down event
        tileGrid, c, ctx;

    // Search through `.tiles` and determine the position,
    // from the top-left of the **document**, and cache that data
    // so that `mousemove` events don't always recalculate.
    function getTileGrid() {
        // TODO: don't build for tiles outside of viewport
        // Touch interaction leads to intermediate
        var zoomLayer = map.createOrGetLayer(Math.round(map.getZoom()));
        // Calculate a tile grid and cache it, by using the `.tiles`
        // element on this map.
        return tileGrid || (tileGrid =
            (function(t) {
                var o = [];
                for (var key in t) {
                    if (t[key].parentNode === zoomLayer) {
                        var offset = wax.util.offset(t[key]);
                        o.push([offset.top, offset.left, t[key]]);
                    }
                }
                return o;
            })(map.tiles));
    }

    // When the map moves, the tile grid is no longer valid.
    function clearTileGrid(map, e) {
        tileGrid = null;
        hovertiles.innerHTML = '';
    }

    function getTile(e) {
        for (var i = 0, grid = getTileGrid(); i < grid.length; i++) {
            if ((grid[i][0] < e.y) &&
               ((grid[i][0] + 256) > e.y) &&
                (grid[i][1] < e.x) &&
               ((grid[i][1] + 256) > e.x)) return grid[i];
        }
        return false;
    }

    // Clear the double-click timeout to prevent double-clicks from
    // triggering popups.
    function killTimeout() {
        if (_clickTimeout) {
            window.clearTimeout(_clickTimeout);
            _clickTimeout = null;
            return true;
        } else {
            return false;
        }
    }

    // Utility functions to deal with key decoding and encoding
    // From Wax. Decode a key into an index.
    var charToIndex = function(key) {
        if (key >= 93) key--;
        if (key >= 35) key--;
        key -= 32;
        return key;
    };

    // Re-encode a key from an index to a key.
    // This will fail at 34 and 92, control
    // characters that are invalid input anyway.
    var indexToChar = function(key) {
        if (key === 34 || key === 92) {
            // console.log('bad key encountered');
        }
        key += 32;
        if (key >= 34) key++;
        if (key >= 92) key++;
        return key;
    };

    var at;

    function drawTile(tile, char, grid) {
      c.width = 256;
      c.style.cssText = tile.style.cssText;
      var gt = grid.grid_tile();
      // ctx.fillRect(0, 0, 256, 256);
      for (var x = 0; x < 64; x++) {
        for (var y = 0; y < 64; y++) {<commit_msg>Optimizing cssText access<commit_after>(function(context) {
  function glower(map, tj) {
    tilejson = tj;

    var MM = com.modestmaps,
        waxGM = wax.GridManager(tilejson),
        eventoffset = wax.util.eventoffset,
        addEvent = MM.addEvent,
        removeEvent = MM.removeEvent,
        g = {},
        hovertiles = map.parent.appendChild(document.createElement('div')),
        // Active feature
        _af,
        _cssText,
        // Down event
        tileGrid, c, ctx;

    // Search through `.tiles` and determine the position,
    // from the top-left of the **document**, and cache that data
    // so that `mousemove` events don't always recalculate.
    function getTileGrid() {
        // TODO: don't build for tiles outside of viewport
        // Touch interaction leads to intermediate
        var zoomLayer = map.createOrGetLayer(Math.round(map.getZoom()));
        // Calculate a tile grid and cache it, by using the `.tiles`
        // element on this map.
        return tileGrid || (tileGrid =
            (function(t) {
                var o = [];
                for (var key in t) {
                    if (t[key].parentNode === zoomLayer) {
                        var offset = wax.util.offset(t[key]);
                        o.push([offset.top, offset.left, t[key]]);
                    }
                }
                return o;
            })(map.tiles));
    }

    // When the map moves, the tile grid is no longer valid.
    function clearTileGrid(map, e) {
        tileGrid = null;
        hovertiles.innerHTML = '';
    }

    function getTile(e) {
        for (var i = 0, grid = getTileGrid(); i < grid.length; i++) {
            if ((grid[i][0] < e.y) &&
               ((grid[i][0] + 256) > e.y) &&
                (grid[i][1] < e.x) &&
               ((grid[i][1] + 256) > e.x)) return grid[i];
        }
        return false;
    }

    // Clear the double-click timeout to prevent double-clicks from
    // triggering popups.
    function killTimeout() {
        if (_clickTimeout) {
            window.clearTimeout(_clickTimeout);
            _clickTimeout = null;
            return true;
        } else {
            return false;
        }
    }

    // Utility functions to deal with key decoding and encoding
    // From Wax. Decode a key into an index.
    var charToIndex = function(key) {
        if (key >= 93) key--;
        if (key >= 35) key--;
        key -= 32;
        return key;
    };

    // Re-encode a key from an index to a key.
    // This will fail at 34 and 92, control
    // characters that are invalid input anyway.
    var indexToChar = function(key) {
        if (key === 34 || key === 92) {
            // console.log('bad key encountered');
        }
        key += 32;
        if (key >= 34) key++;
        if (key >= 92) key++;
        return key;
    };

    var at;

    function drawTile(tile, char, grid) {
      c.width = 256;
      var tcss = tile.style.cssText;
      if (_cssText !== tcss) {
          _cssText = c.style.cssText = tcss;
      }
      var gt = grid.grid_tile();
      // ctx.fillRect(0, 0, 256, 256);
      for (var x = 0; x < 64; x++) {
        for (var y = 0; y < 64; y++) {
{'fraction_non_alphanumeric': 0.12880114631428116, 'fraction_numerical': 0.015284190415538928, 'mean_word_length': 1.580936729663106, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '5233089', 'n_tokens_mistral': 1967, 'n_tokens_neox': 1826, 'n_words': 574}