diff --git a/build.py b/build.py index abde15f2..f81f6245 100755 --- a/build.py +++ b/build.py @@ -71,6 +71,13 @@ 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 = '@@BUILDNAME@@'; +plugin_info.dateTimeVersion: '@@DATETIMEVERSION@@'; +plugin_info.pluginId = '@@PLUGINNAME@@'; +//END PLUGIN AUTHORS NOTE + """ pluginWrapperEnd = """ @@ -82,8 +89,8 @@ if(window.iitcLoaded && typeof setup === 'function') setup(); } // wrapper end // inject code into site context var script = document.createElement('script'); -var info = { buildName: '@@BUILDNAME@@', dateTimeVersion: '@@DATETIMEVERSION@@', pluginId: '@@PLUGINNAME@@' }; -if (this.GM_info && this.GM_info.script) info.script = { version: GM_info.script.version, name: GM_info.script.name, description: GM_info.script.description }; +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); diff --git a/code/utils_misc.js b/code/utils_misc.js index 762e5fa1..f41755e5 100644 --- a/code/utils_misc.js +++ b/code/utils_misc.js @@ -18,7 +18,7 @@ window.aboutIITC = function() { var ptext = pname + ' - ' + pvers; if (info.buildName != script_info.buildName) { - ptext += ' ['+info.buildName+']'; + ptext += ' ['+(info.buildName||'non-standard plugin')+']'; } plugins += '
  • '+ptext+'
  • ';