Skip to content

Instantly share code, notes, and snippets.

@jarekb84
Last active November 18, 2017 02:19
Show Gist options
  • Select an option

  • Save jarekb84/9a37b451f599b669f1c5d7180e8769e4 to your computer and use it in GitHub Desktop.

Select an option

Save jarekb84/9a37b451f599b669f1c5d7180e8769e4 to your computer and use it in GitHub Desktop.
(function() {
'use strict';
function addContainer() {
var container = $("<div id='tileHighlighter' style='position: fixed; top:0; right:0; height: 225px; width: 200px; background-color: white; padding-top: 5px' />");
var textArea = $("<textarea id='tileHighlighter__tileData' rows='15' />")
container.append(textArea)
var hilightTilesButton = $("<div><button id='tileHighlighter__process'>Highlight Tiles</button></div>")
container.append(hilightTilesButton);
$('body').append(container);
}
function highlightTiles() {
var tiles = $('#tileHighlighter__tileData').val().split(/\r|\n/);
$.each(tiles, function(index, value) {
var tileId = '#x' + value.replace(' ', '').replace(',', 'y');
var tileElement = $(tileId + ' text tspan');
if (tileElement.length) {
tileElement[0].style['fill'] = 'pink'
}
});
}
function delayedHighlight() {
setTimeout(highlightTiles, 400);
}
addContainer();
$("#tileHighlighter__process").click(highlightTiles);
$('body').on('click', '#MapZoomIn', delayedHighlight);
$('body').on('click', '#MapZoomOut', delayedHighlight);
$('body').on('click', '#map', delayedHighlight);
}
)();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment