Created
October 24, 2013 22:31
-
-
Save andrew-d/7146277 to your computer and use it in GitHub Desktop.
Bookmarklet to strip names on http://escape.alf.nu
Note: not perfect - drops the alt text, for example.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var clear = function(){ | |
var names = {}; | |
var count = 0; | |
var tds = document.querySelectorAll('div#actualscores td'); | |
for( var i in tds ) { | |
var text = tds[i].innerText; | |
if( text !== undefined && !text.match(/^[\d ,]+$/) ) { | |
var newText = text.split(', '). | |
map(function(x) { | |
if( names[x] === undefined ) { | |
count += 1; | |
names[x] = count + ""; | |
} | |
return names[x]; | |
}). | |
join(', '); | |
tds[i].innerText = newText; | |
} | |
} | |
}; | |
clear(); | |
// Bookmarklet to copy; | |
// javascript:(function(){ var names = {}; var count = 0; var tds = document.querySelectorAll('div#actualscores td'); for( var i in tds ) { var text = tds[i].innerText; if( text !== undefined && !text.match(/^[\d ,]+$/) ) { var newText = text.split(', '). map(function(x) { if( names[x] === undefined ) { count += 1; names[x] = count + ""; } return names[x]; }). join(', '); tds[i].innerText = newText; } } })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment