iitc-project / ingress-intel-total-conversion

ingress.com/intel total conversion user script with some new features. Should allow easier extension of the intel map.
http://iitc.jonatkins.com/
ISC License
989 stars 552 forks source link

How to clear keys? #309

Open tb52s7 opened 11 years ago

tb52s7 commented 11 years ago

Previously I have gone through my keys list in the game and entered all my keys into IITC for the desktop. Then I used a bunch of keys, and now I'm in the position where if I go enter all my keys back in the same way I did last time, it won't be accurate because many of the keys I've already entered are still listed in IITC when they shouldn't be, since I already burned them making links. So, how do I clear every key back to zero to start over? I tried but couldn't figure out how to do this in Firefox.

tb52s7 commented 11 years ago

Some sort of batch key management system would be nice as a separate plugin or to incorporate into the existing Keys plugin. Clear keys could be one of its first options.

tb52s7 commented 11 years ago

I really would like to know how to clear keys in firefox. There has to be an easy way to do this. Can anybody tell me how?

segv11 commented 11 years ago

I'd love to see the keys sync database use a Google spreadsheet instead of the opaque file it currently uses. That would give an easy way to do the bulk edits you describe.

kelemvor33 commented 11 years ago

So here's the solution. :) Run the following Javascript command on the Intel map page: localStorage.removeItem('plugin-keys-data')

In Firefox, you can go to the web developer/scratchpad menu which will open a new window. Have the main window to the intel map and enter the command in the other window. Choose Execute and then do a Ctrl+F5 refresh on the map and all the stored keys will be gone.

tb52s7 commented 11 years ago

Ok kelemvor33, thank you very much for trying to help me out, HOWEVER, I was NOT able to clear keys using the following methods in Firefox spanish version 21 with IITC 0.12.0 build may 22:

  1. With intel map in background, open scratchpad, paste "localStorage.removeItem('plugin-keys-data')", 'Execute' (which is 'Ejecutar' in spanish), CTRL+F5 on map ---> OLD KEYS REMAIN ON MAP
  2. Intel map, scratchpad, paste js command, highlight js command, 'Execute', CTRL+F5 on map ---> OLD KEYS REMAIN ON MAP
  3. Intel map, scratchpad, paste js command, add semicolon ; to end of js command, 'Execute', CTRL+F5 on map ---> OLD KEYS REMAIN ON MAP
  4. Perform each of methods 1-3 using 'Reload And Run' instead of 'Execute' ---> OLD KEYS REMAIN ON MAP
  5. Through Google find the following information: "You can delete localStorage items one by one using Firebug", get Firebug, open intel map, launch Firebug, click on 'DOM' tab, scroll down to 'plugin' in green, click plus [+] sign, scroll to 'keys' in green, click plus [+] sign, scroll to 'keys' in black, right click on black 'keys', click 'Delete property' (in spanish 'Eliminar propiedad'), close Firebug, CTRL+F5 on map ---> OLD KEYS REMAIN ON MAP
  6. Back to intel map, back to Firebug, find green 'plugin', click plus [+] sign, find green 'keys', right click on green 'keys', 'Eliminar propiedad', close Firebug, CTRL+F5 on map ---> OLD KEYS REMAIN ON MAP
  7. Search hard drive for some sort of file containing keys so that it can be deleted from the hard drive ---> UNSUCCESSFUL

This is sooooooo fricken frustrating. I'm not a js programmer. I followed the instructions perfectly. I even improvised. WTF am I doing wrong?

tb52s7 commented 11 years ago

Please first see the above post. So, now that you know what did NOT clear my keys, I will tell you what DID clear my keys:

  1. Go to intel map
  2. Click greasemonkey icon dropdown
  3. Click 'Gestor de Scripts(M)' - (not sure what this says in the english version but it manages the greasemonkey scripts)
  4. Find 'IITC Plugin: keys'
  5. Click 'Opciones' ('Options')
  6. Click 'Editar' ('Edit')
  7. On line 29, edit: "window.plugin.keys.LOCAL_STORAGE_KEY = 'plugin-keys-data';" to read: "window.plugin.keys.LOCAL_STORAGE_KEY = 'plugin-keys-data2';"
  8. On line 31, edit: "window.plugin.keys.KEY = {key: 'plugin-keys-data', field: 'keys'};" to read: "window.plugin.keys.KEY = {key: 'plugin-keys-data2', field: 'keys'};"
  9. Close script editor saving changes
  10. CTRL+F5 on map
  11. BAM! Keys gone. Fricken finally.

So there you have it. I cleared my keys off the map. They still exist.... SOMEWHERE..... no idea where that is, but hey as long as my map is now reading a blank plugin-keys-data object then I don't fricken care. Firefox can eat all my old keys, I don't care. Firefox can save all my old keys for posterity, I don't care - as long as I don't have to look at them anymore. And if I ever run out of whatever weird storage this system uses because I have iterated my plugin-keys-data object too many times, then I'll get back on here and ask about the crap again so hopefully next time I don't have to spend another 2 hours explaining how I couldn't figure this bs out, again.

mdroidian commented 11 years ago

I am also having difficulty removing keys in chrome. I've tried; localStorage.removeItem('plugin-keys-data') javascript:localStorage.removeItem('plugin-keys-data')

having this built in would be nice.

billplaysonline commented 7 years ago

How dificult would it be to just cycle through all the keys and set there count to zero.

hayeswise commented 7 years ago

This would not be difficult. The object window.plugin.keys.keys is an associative array keyed by portal guids. That's easy enough to loop through either using the jQuery each() function or pure JavaScript using Object.keys(window.plugin.keys.keys).forEach(...). From there, copy appropriate code from the window.plugin.keys.addKey() function. One possibility ...

Object.keys(window.plugin.keys.keys).forEach(function (guid, i, array) {
    delete plugin.keys.keys[guid];
    plugin.keys.updateQueue[guid] = null;
    plugin.keys.storeLocal(plugin.keys.KEY);
    plugin.keys.storeLocal(plugin.keys.UPDATE_QUEUE);
    plugin.keys.updateDisplayCount();
    window.runHooks('pluginKeysUpdateKey', {guid: guid, count: newCount});
});
plugin.keys.delaySync();

However, there are probably some efficiencies to be gained by move the following out of the loop:

    plugin.keys.storeLocal(plugin.keys.KEY);
    plugin.keys.storeLocal(plugin.keys.UPDATE_QUEUE);
    plugin.keys.updateDisplayCount();

I'm not sure what moving those would do to the window.runHooks('pluginKeysUpdateKey', {guid: guid, count: newCount}).

billplaysonline commented 7 years ago

Another solution for the original problem, Use "portals-list" to view the portals you used the keys on. Scroll to the right and adjust key levels accordingly.