Last active
September 27, 2016 14:39
-
-
Save zessx/872c0b16b14a8274b14ef7973cc94a42 to your computer and use it in GitHub Desktop.
FastPokeMap Helper
This file contains hidden or 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
javascript: (function() %7B | |
var audioContext = new AudioContext(); | |
var history = []; | |
var names = %7B 1: "Bulbizarre", 2: "Herbizarre", 3: "Florizarre", 4: "Salamèche", 5: "Reptincel", 6: "Dracaufeu", 7: "Carapuce", 8: "Carabaffe", 9: "Tortank", 10: "Chenipan", 11: "Chrysacier", 12: "Papilusion", 13: "Aspicot", 14: "Coconfort", 15: "Dardargnan", 16: "Roucool", 17: "Roucoups", 18: "Roucarnage", 19: "Rattata", 20: "Rattatac", 21: "Piafabec", 22: "Rapasdepic", 23: "Abo", 24: "Arbok", 25: "Pikachu", 26: "Raichu", 27: "Sabelette", 28: "Sablaireau", 29: "Nidoran♀", 30: "Nidorina", 31: "Nidoqueen", 32: "Nidoran♂", 33: "Nidorino", 34: "Nidoking", 35: "Mélofée", 36: "Mélodelfe", 37: "Goupix", 38: "Feunard", 39: "Rondoudou", 40: "Grodoudou", 41: "Nosferapti", 42: "Nosferalto", 43: "Mystherbe", 44: "Ortide", 45: "Rafflesia", 46: "Paras", 47: "Parasect", 48: "Mimitoss", 49: "Aéromite", 50: "Taupiqueur", 51: "Triopikeur", 52: "Miaouss", 53: "Persian", 54: "Psykokwak", 55: "Akwakwak", 56: "Férosinge", 57: "Colossinge", 58: "Caninos", 59: "Arcanin", 60: "Ptitard", 61: "Têtarte", 62: "Tartard", 63: "Abra", 64: "Kadabra", 65: "Alakazam", 66: "Machoc", 67: "Machopeur", 68: "Mackogneur", 69: "Chétiflor", 70: "Boustiflor", 71: "Empiflor", 72: "Tentacool", 73: "Tentacruel", 74: "Racaillou", 75: "Gravalanch", 76: "Grolem", 77: "Ponyta", 78: "Galopa", 79: "Ramoloss", 80: "Flagadoss", 81: "Magnéti", 82: "Magnéton", 83: "Canarticho", 84: "Doduo", 85: "Dodrio", 86: "Otaria", 87: "Lamantine", 88: "Tadmorv", 89: "Grotadmorv", 90: "Kokiyas", 91: "Crustabri", 92: "Fantominus", 93: "Spectrum", 94: "Ectoplasma", 95: "Onix", 96: "Soporifik", 97: "Hypnomade", 98: "Krabby", 99: "Krabboss", 100: "Voltorbe", 101: "Électrode", 102: "Noeunoeuf", 103: "Noadkoko", 104: "Osselait", 105: "Ossatueur", 106: "Kicklee", 107: "Tygnon", 108: "Excelangue", 109: "Smogo", 110: "Smogogo", 111: "Rhinocorne", 112: "Rhinoféros", 113: "Leveinard", 114: "Saquedeneu", 115: "Kangourex", 116: "Hypotrempe", 117: "Hypocéan", 118: "Poissirène", 119: "Poissoroy", 120: "Stari", 121: "Staross", 122: "M.Mime", 123: "Insécateur", 124: "Lippoutou", 125: "Élektek", 126: "Magmar", 127: "Scarabrute", 128: "Tauros", 129: "Magicarpe", 130: "Léviator", 131: "Lokhlass", 132: "Métamorph", 133: "Évoli", 134: "Aquali", 135: "Voltali", 136: "Pyroli", 137: "Porygon", 138: "Amonita", 139: "Amonistar", 140: "Kabuto", 141: "Kabutops", 142: "Ptéra", 143: "Ronflex", 144: "Artikodin", 145: "Électhor", 146: "Sulfura", 147: "Minidraco", 148: "Draco", 149: "Dracolosse", 150: "Mewtwo", 151: "Mew" %7D; | |
function to_hex(str) %7B | |
var result = ''; | |
for (var i=0; i<str.length; i++) %7B | |
result += str.charCodeAt(i).toString(16); | |
%7D | |
return result; | |
%7D | |
function clear_favicons() %7B | |
var favicons = document.querySelectorAll("head link[rel=\"icon\"]"); | |
for (i = 0; i < favicons.length; ++i) %7B | |
document.querySelector("head").removeChild(favicons[i]); | |
%7D | |
%7D | |
function change_favicon(img) %7B | |
var favicon = document.querySelector("link[rel=\"shortcut icon\"]"); | |
if (!favicon) %7B | |
favicon = document.createElement("link"); | |
favicon.setAttribute("rel", "shortcut icon"); | |
var head = document.querySelector("head"); | |
head.appendChild(favicon); | |
%7D | |
favicon.setAttribute("type", "image/png"); | |
favicon.setAttribute("href", img); | |
%7D | |
function poke_refresh() %7B | |
document.querySelector("button.scan").click(); | |
var search = document.querySelectorAll(".leaflet-marker-pane .displaypokemon:not(.hidden)"); | |
var found = 0; | |
for (i = 0; i < search.length; ++i) %7B | |
var k = to_hex(search[i].parentNode.getAttribute("style")); | |
if (!history[k]) %7B | |
var name = names[search[i].getAttribute("data-pokeid")]; | |
var date = new Date; | |
console.log("%c " + date.getHours() + ":" + date.getMinutes() + " %c → " + name +" ", "background:#222; color:#0f0", "background:#eee; color:#000"); | |
history[k] = name; | |
found++; | |
clear_favicons(); | |
change_favicon(search[i].querySelector("img").getAttribute("src")); | |
%7D | |
%7D | |
if (found > 0) %7B | |
var note = audioContext.createOscillator(); | |
note.frequency.value = 932; | |
note.detune.value = 0; | |
note.type = "sine"; | |
note.connect(audioContext.destination); | |
note.start(0); | |
window.setTimeout(function() %7B note.stop(); %7D, 500); | |
%7D | |
window.setTimeout(poke_refresh, 60000); | |
%7D | |
console.log("%c PokeRefresh launched ", "background:#222; color:#0f0"); | |
poke_refresh(); | |
%7D)(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment