diff options
author | portix <none@none> | 2013-03-23 18:55:55 +0100 |
---|---|---|
committer | portix <none@none> | 2013-03-23 18:55:55 +0100 |
commit | 1b615c247c3e5173678096790534f65e622bc89e (patch) | |
tree | 56b802d63135cfadf7deffbaadfd6cd2495a8e08 /extensions/userscripts | |
parent | 9407a0638770d48f9021d51731c2ae0e41bd6e81 (diff) | |
download | dwb-1b615c247c3e5173678096790534f65e622bc89e.zip |
Free hint-object before a new site is loaded; load userscripts from ~/.config/dwb/greasemonkey
Diffstat (limited to 'extensions/userscripts')
-rw-r--r-- | extensions/userscripts | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/extensions/userscripts b/extensions/userscripts index 9d86d7ca..2f18663a 100644 --- a/extensions/userscripts +++ b/extensions/userscripts @@ -67,8 +67,10 @@ var onStart = []; var onEnd = []; /* //<DEFAULT_CONFIG - // paths to userscripts, this extension will also load all scripts in from - // $XDG_CONFIG_HOME/scripts + // paths to userscripts, this extension will also load all scripts in + // $XDG_CONFIG_HOME/dwb/greasemonkey, it will also load all scripts in + // $XDG_CONFIG_HOME/dwb/scripts but this is deprecated and will be + // disabled in future versions. scripts : [] //>DEFAULT_CONFIG */ @@ -515,24 +517,29 @@ function userscriptsStart() function parseScripts(scripts) //{{{ { var i, path; - var scriptDir = data.configDir + "/scripts"; for (i=0; i<scripts.length; i++) { if (system.fileTest(scripts[i], FileTest.regular | FileTest.symlink)) parseScript(scripts[i]); } - if (system.fileTest(scriptDir, FileTest.dir)) - { - var lines = io.dirNames(scriptDir); - for (i=0; i<lines.length; i++) + [ "scripts", "greasemonkey" ].forEach(function(path) { + var scriptDir = data.configDir + "/" + path; + if (system.fileTest(scriptDir, FileTest.dir)) { - if (lines[i].charAt(0) == ".") - continue; - path = scriptDir + "/" + lines[i]; - if (!(/^\s*$/.test(lines[i])) && system.fileTest(path, FileTest.regular | FileTest.symlink)) - parseScript(path); + if (path == "scripts") + extensions.warning(me, "Using $XDG_CONFIG_HOME/.config/dwb/scripts is deprecated, use $XDG_CONFIG_HOME/.config/dwb/greasemonkey instead"); + var lines = io.dirNames(scriptDir); + for (i=0; i<lines.length; i++) + { + if (lines[i].charAt(0) == ".") + continue; + path = scriptDir + "/" + lines[i]; + if (!(/^\s*$/.test(lines[i])) && system.fileTest(path, FileTest.regular | FileTest.symlink)) + parseScript(path); + } } - } + }); + return userscriptsStart(); }//}}} |