modify plugin wrapper, so build-script injected macros in the wrapper are in a more obvious place, so 3rd party plugin authors are less likely to make mistakes here when working outside the build.py environment
tweak the about screen to display non-standard plugins using the new interface better
This commit is contained in:
parent
8070f22fba
commit
9dabc33770
11
build.py
11
build.py
@ -71,6 +71,13 @@ function wrapper(plugin_info) {
|
|||||||
// ensure plugin framework is there, even if iitc is not yet loaded
|
// ensure plugin framework is there, even if iitc is not yet loaded
|
||||||
if(typeof window.plugin !== 'function') window.plugin = function() {};
|
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 = """
|
pluginWrapperEnd = """
|
||||||
@ -82,8 +89,8 @@ if(window.iitcLoaded && typeof setup === 'function') setup();
|
|||||||
} // wrapper end
|
} // wrapper end
|
||||||
// inject code into site context
|
// inject code into site context
|
||||||
var script = document.createElement('script');
|
var script = document.createElement('script');
|
||||||
var info = { buildName: '@@BUILDNAME@@', dateTimeVersion: '@@DATETIMEVERSION@@', pluginId: '@@PLUGINNAME@@' };
|
var info = {};
|
||||||
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 };
|
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)+');'));
|
script.appendChild(document.createTextNode('('+ wrapper +')('+JSON.stringify(info)+');'));
|
||||||
(document.body || document.head || document.documentElement).appendChild(script);
|
(document.body || document.head || document.documentElement).appendChild(script);
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ window.aboutIITC = function() {
|
|||||||
|
|
||||||
var ptext = pname + ' - ' + pvers;
|
var ptext = pname + ' - ' + pvers;
|
||||||
if (info.buildName != script_info.buildName) {
|
if (info.buildName != script_info.buildName) {
|
||||||
ptext += ' ['+info.buildName+']';
|
ptext += ' ['+(info.buildName||'<i>non-standard plugin</i>')+']';
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins += '<li>'+ptext+'</li>';
|
plugins += '<li>'+ptext+'</li>';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user