From 8c4acfe1fd2dde2d60da1f27a5b4b8f6dbd1a8b9 Mon Sep 17 00:00:00 2001 From: Costaspap Date: Fri, 30 May 2014 00:25:11 +0300 Subject: [PATCH] added first part of dynamic-scoreboard plugin --- plugins/dynamic-scoreboard.user.js | 59 ++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 plugins/dynamic-scoreboard.user.js diff --git a/plugins/dynamic-scoreboard.user.js b/plugins/dynamic-scoreboard.user.js new file mode 100644 index 00000000..62747b44 --- /dev/null +++ b/plugins/dynamic-scoreboard.user.js @@ -0,0 +1,59 @@ +// ==UserScript== +// @id iitc-plugin-Dynamic-Scoreboard@Costaspap +// @name IITC plugin: Create a local scoreboard +// @category Info +// @version 0.1.0.20140524.214738 +// @namespace https://github.com/jonatkins/ingress-intel-total-conversion +// @updateURL https://secure.jonatkins.com/iitc/release/total-conversion-build.meta.js +// @downloadURL https://secure.jonatkins.com/iitc/release/total-conversion-build.user.js +// @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== + + +// A plug in by Costaspap and harisbitsakou +function wrapper(plugin_info) { + // ensure plugin framework is there, even if iitc is not yet loaded + if(typeof window.plugin !== 'function') window.plugin = function() {}; + + //PLUGIN AUTHORS: writing a plugin outside of the IITC build environment? if so, delete these lines!! + //(leaving them in place might break the 'About IITC' page or break update checks) + plugin_info.buildName = 'jonatkins'; + plugin_info.dateTimeVersion = '20140524.214738'; + plugin_info.pluginId = 'Dynamic Scoreboard'; + //END PLUGIN AUTHORS NOTE + + // PLUGIN START // + + + + + var setup = function() { + if(window.useAndroidPanes()) { + android.addPane("plugin-Scoreboard", "Scoreboard", "ic_action_paste"); + addHook("paneChanged", window.plugin.scoreboard.onPaneChanged); + } else { + $('#toolbox').append(' Scoreboard'); + } + + } + + + // PLUGIN END ////////////////////////////////////////////////////////// + + + setup.info = plugin_info; //add the script info data to the function as a property + if(!window.bootPlugins) window.bootPlugins = []; + window.bootPlugins.push(setup); + // if IITC has already booted, immediately run the 'setup' function + if(window.iitcLoaded && typeof setup === 'function') setup(); +} // wrapper end +// inject code into site context +var script = document.createElement('script'); +var info = {}; +if (typeof GM_info !== 'undefined' && GM_info && GM_info.script) info.script = { version: GM_info.script.version, name: GM_info.script.name, description: GM_info.script.description }; +script.appendChild(document.createTextNode('('+ wrapper +')('+JSON.stringify(info)+');')); +(document.body || document.head || document.documentElement).appendChild(script); \ No newline at end of file