From 988f9e5178d009952e6720285e214f9012035628 Mon Sep 17 00:00:00 2001 From: portix Date: Thu, 7 Mar 2013 23:55:34 +0100 Subject: C-Implementation of util.getBody; optional line argument in wv.inject; implementing generateId; debugging messages is userscripts extension --- extensions/userscripts | 58 ++++++++++++++++++++++---------------------------- 1 file changed, 26 insertions(+), 32 deletions(-) (limited to 'extensions/userscripts') diff --git a/extensions/userscripts b/extensions/userscripts index 76709ec3..82a15eb3 100644 --- a/extensions/userscripts +++ b/extensions/userscripts @@ -65,8 +65,6 @@ INFO>*/ var me = "userscripts"; var onStart = []; var onEnd = []; -var sigDocument = -1; -var sigCommitted = -1; /* // 0) { timerStart(item.delay, function() { - frame.inject(item.script, null, item.unwrap); + frame.inject(item.script, null, item.offset, item.unwrap); return false; }); } else - frame.inject(item.script, null, item.unwrap); + frame.inject(item.script, null, item.offset, item.unwrap); } function handle(frame, array, isMainFrame) //{{{ @@ -393,6 +392,7 @@ function parseScript(path) //{{{ if (metaStart == -1 || metaEnd == -1) { userscript.script = curScript; + userscript.offset = 1; userscript.include = [ { regExp : /.*/, isTld : false} ]; onEnd.push(userscript); return; @@ -464,8 +464,9 @@ function parseScript(path) //{{{ userscript.scriptId = userscript.namespace + "::" + userscript.name; userscript.scriptId = userscript.scriptId.replace(/\s+/g, "_"); userscript.script = "var DWB_scriptId = '" + userscript.scriptId + "';" + - util.getBody(GM_compatability) + curScript.substring(0, metaStart) + - curScript.substring(scriptStart); + curScript.substring(0, metaStart) + + curScript.substring(scriptStart) + util.getBody(GM_compatability); + userscript.offset = meta.length + 1; getRequirements(userscript); @@ -488,13 +489,13 @@ function userscriptsStart() if (onStart.length > 0) { onStart.sort(function(a, b) { return b.priority - a.priority; }); - sigCommitted = signals.connect("loadCommitted", loadCommittedCallback); + signals.connect("loadCommitted", loadCommittedCallback); ret = true; } if (onEnd.length > 0) { onEnd.sort(function(a, b) { return b.priority - a.priority; }); - sigDocument = signals.connect("documentLoaded", loadFinishedCallback); + signals.connect("documentLoaded", loadFinishedCallback); ret = true; } //metaData = {}; @@ -540,15 +541,8 @@ var userscripts = { return parseScripts(c ? c.scripts || [] : []); }, end : function () { - if (sigDocument >= 0) { - signals.disconnect(sigDocument); - sigDocument = -1; - } - if (sigCommitted >= 0) { - signals.disconnect(sigCommitted); - sigCommitted = -1; - } - + signals.disconnect(loadFinishedCallback); + signals.disconnect(loadCommittedCallback); } }; -- cgit v1.2.3