// ==UserScript==
// @id             iitc-plugin-fix-bad-version-code@jonatkins
// @name           IITC plugin: Fix bad version codes
// @category       Tweaks
// @version        0.2.1.@@DATETIMEVERSION@@
// @namespace      https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL      @@UPDATEURL@@
// @downloadURL    @@DOWNLOADURL@@
// @description    [@@BUILDNAME@@-@@BUILDDATE@@] Sometimes Niantic deployments break, causing an old version of the gen_dashboard.js to be served. This has an out-of-date version code. This plugin overrides known bad codes with the one that should be current.
// @include        https://www.ingress.com/intel*
// @include        http://www.ingress.com/intel*
// @match          https://www.ingress.com/intel*
// @match          http://www.ingress.com/intel*
// @grant          none
// ==/UserScript==


@@PLUGINSTART@@

// PLUGIN START ////////////////////////////////////////////////////////


// use own namespace for plugin
window.plugin.badVersionCodeFix = function() {};

window.plugin.badVersionCodeFix.setup  = function() {

  var fixes = {
    // 2014-08-02 - broken for 24h+
    '81ad679ab5bc219ef3bcf7ca9b760e917cf0c558': 'afdb91368730a906bae38b2837cc411f880350fa',
  };


  var fixed = fixes[nemesis.dashboard.config.CURRENT_VERSION];

  if (fixed !== undefined) {
    console.warn('IITC VersionCodeFixer: bad nemesis.dashboard.config.CURRENT_VERSION is "'+nemesis.dashboard.config.CURRENT_VERSION+'", should be "'+fixed+'"');
    nemesis.dashboard.config.CURRENT_VERSION = fixed;
  } else {
    console.log('IITC VersionCodeFixer: no known fixes needed, current nemesis.dashboard.config.CURRENT_VERSION is "'+nemesis.dashboard.config.CURRENT_VERSION+'"');
  }


};

var setup =  window.plugin.badVersionCodeFix.setup;

// PLUGIN END //////////////////////////////////////////////////////////

@@PLUGINEND@@

@@ -150,14 +150,15 @@
     
-Tweaks
+Deleted
 %0A// 
@@ -369,247 +369,83 @@
     
-%5B@@BUILDNAME@@-@@BUILDDATE@@%5D Sometimes Niantic deployments break, causing an old version of the gen_dashboard.js to be served. This has an out-of-date version code. This plugin overrides known bad codes with the one that should be current
+Deleted plugin. Not useful for fixing the actual issue with Niantic servers
 .%0A//
@@ -689,1020 +689,4 @@
 =%0A%0A%0A
-@@PLUGINSTART@@%0A%0A// PLUGIN START ////////////////////////////////////////////////////////%0A%0A%0A// use own namespace for plugin%0Awindow.plugin.badVersionCodeFix = function() %7B%7D;%0A%0Awindow.plugin.badVersionCodeFix.setup  = function() %7B%0A%0A  var fixes = %7B%0A    // 2014-08-02 - broken for 24h+%0A    '81ad679ab5bc219ef3bcf7ca9b760e917cf0c558': 'afdb91368730a906bae38b2837cc411f880350fa',%0A  %7D;%0A%0A%0A  var fixed = fixes%5Bnemesis.dashboard.config.CURRENT_VERSION%5D;%0A%0A  if (fixed !== undefined) %7B%0A    console.warn('IITC VersionCodeFixer: bad nemesis.dashboard.config.CURRENT_VERSION is %22'+nemesis.dashboard.config.CURRENT_VERSION+'%22, should be %22'+fixed+'%22');%0A    nemesis.dashboard.config.CURRENT_VERSION = fixed;%0A  %7D else %7B%0A    console.log('IITC VersionCodeFixer: no known fixes needed, current nemesis.dashboard.config.CURRENT_VERSION is %22'+nemesis.dashboard.config.CURRENT_VERSION+'%22');%0A  %7D%0A%0A%0A%7D;%0A%0Avar setup =  window.plugin.badVersionCodeFix.setup;%0A%0A// PLUGIN END //////////////////////////////////////////////////////////%0A%0A@@PLUGINEND@@%0A

mark the plugin as 'deleted' and remove all code will be really deleted before the next release build, but as a fair few probably installed it from the test builds it seems a good idea for this intermediate state