plugin: guess player levels

- code to clear the now obsolete 'level-PLAYER_GUID' keys removed from reset guesses, and moved to plugin startup
- version number bumpped
This commit is contained in:
Jon Atkins 2013-12-01 17:34:49 +00:00
parent 9c5307bba5
commit c77cb56a03

View File

@ -2,7 +2,7 @@
// @id iitc-plugin-guess-player-levels@breunigs // @id iitc-plugin-guess-player-levels@breunigs
// @name IITC plugin: guess player level // @name IITC plugin: guess player level
// @category Info // @category Info
// @version 0.4.9.@@DATETIMEVERSION@@ // @version 0.4.10.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@ // @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@ // @downloadURL @@DOWNLOADURL@@
@ -212,11 +212,6 @@ window.plugin.guessPlayerLevels.guess = function() {
buttons: { buttons: {
'RESET GUESSES': function() { 'RESET GUESSES': function() {
// clear all guessed levels from local storage // clear all guessed levels from local storage
$.each(Object.keys(localStorage), function(ind,key) {// legacy code - should be removed in the future
if(key.lastIndexOf("level-",0)===0) {
localStorage.removeItem(key);
}
});
localStorage.removeItem("plugin-guess-player-levels") localStorage.removeItem("plugin-guess-player-levels")
window.plugin.guessPlayerLevels._nameToLevelCache = {} window.plugin.guessPlayerLevels._nameToLevelCache = {}
// now force all portals through the callback manually // now force all portals through the callback manually
@ -245,6 +240,14 @@ window.plugin.guessPlayerLevels.sort = function(playerHash) {
var setup = function() { var setup = function() {
// we used to sture level guesses as one localStorage key per player, named 'level-PLAYER_GUID'
// they're now stored in a single storage key - 'plugin-guess-player-levels' - so clear these old entries
$.each(Object.keys(localStorage), function(ind,key) {// legacy code - should be removed in the future
if(key.lastIndexOf("level-",0)===0) {
localStorage.removeItem(key);
}
});
window.plugin.guessPlayerLevels.setupCallback(); window.plugin.guessPlayerLevels.setupCallback();
window.plugin.guessPlayerLevels.setupChatNickHelper(); window.plugin.guessPlayerLevels.setupChatNickHelper();
} }