ambevar-dotfiles/.config/dwb/userscripts/extension_loader.js

107 lines
3.2 KiB
JavaScript
Raw Normal View History

2013-05-30 14:51:44 +02:00
//!javascript
//<adblock_subscriptions___SCRIPT
extensions.load("adblock_subscriptions", {
//<adblock_subscriptions___CONFIG
// Shortcut to subscribe to a filterlist
2014-09-11 15:54:05 +02:00
scSubscribe : null,
2013-05-30 14:51:44 +02:00
// Command to subscribe to a filterlist
2014-09-11 15:54:05 +02:00
cmdSubscribe : "adblock_subscribe",
2013-05-30 14:51:44 +02:00
// Shortcut to unsubscribe from a filterlist
2014-09-11 15:54:05 +02:00
scUnsubscribe : null,
2013-05-30 14:51:44 +02:00
// Command to unsubscribe from a filterlist
cmdUnsubscribe : "adblock_unsubscribe",
// Shortcut to update subscriptions and reload filter rules
// Note that dwb will also update all subscriptions on startup
2014-09-11 15:54:05 +02:00
scUpdate : null,
2013-05-30 14:51:44 +02:00
// Command to update subscriptions and reload filter rules
// Note that dwb will also update all subscriptions on startup
2014-09-11 15:54:05 +02:00
cmdUpdate : "adblock_update",
2013-05-30 14:51:44 +02:00
2014-09-11 15:54:05 +02:00
// Path to the filterlist directory, will be created if it doesn't exist.
filterListDir : "~/.config/dwb/adblock_lists"
2013-05-30 14:51:44 +02:00
//>adblock_subscriptions___CONFIG
});
//>adblock_subscriptions___SCRIPT
2013-08-04 16:07:33 +02:00
//<navtools___SCRIPT
extensions.load("navtools", {
//<navtools___CONFIG
// Shortcut for navigating to the next page
forwardBind : "]]",
// Shortcut for navigating to the previous page
backBind : "[[",
// Go up one directory, e.g. from http://www.example.com/foo/bar to
2013-08-04 16:07:33 +02:00
// http://www.example.com/foo
updirBind : "gu",
2013-08-04 16:07:33 +02:00
// Go to top directory, e.g. from http://www.example.com/foo/bar to
2013-08-04 16:07:33 +02:00
// http://www.example.com
topdirBind : "gU",
2013-08-04 16:07:33 +02:00
// Patterns to match against when searching for "next"-links
nextPatterns : "next,more,>,\u2192,\xbb,\u226b,>>",
// Patterns to match against when searching for "previous"-links
previousPatterns : "prev,previous,back,<,\u2190,\xab,\u226a,<<"
//>navtools___CONFIG
});
//>navtools___SCRIPT
//<contenthandler___SCRIPT
extensions.load("contenthandler", {
//<contenthandler___CONFIG
// The handler can either be a string or a function, if it is a string
// %u will be replaced with the uri of the request, if the handler is a
// function the first parameter of the function will be the uri and the
// function must return the command to execute.
// Handle requests based on filename extension
extension : {
2014-01-06 10:55:10 +01:00
// Note that the extension handler does not always work (e.g. on
// torrenthound). As a workaround transmission can be configured to watch
// for the download path.
"torrent" : "trc -a '%u'"
// "pdf" : "xterm -e 'wget %u --directory-prefix=~/mypdfs'"
},
// Handle requests based on URI scheme
uriScheme : {
2014-01-04 16:21:54 +01:00
// Note: does not work with urxvt.
ftp : function(uri) {
if (uri[uri.length-1] == "/")
return "xterm -e 'ncftp " + uri + "'";
else
return "xterm -e 'ncftpget " + uri + "'";
},
// We need to use 'sh -c' since we need to use a pipe so that xclip can
// read from stdin
mailto : function(uri) {
uri=uri.replace(/mailto:/, "")
uri=uri.replace(/\?/, " ")
return "sh -c ' echo " + uri + " | xclip -i'";
},
// 'trc' is a wrapper script that will launch transmission-daemon if not
// already started.
// magnet: "transmission-remote -a '%u'"
magnet: "trc -a '%u'"
},
// Handle requests based on MIME type
mimeType : {
// "application/pdf" : "xterm -e 'wget %u --directory-prefix=~/mypdfs'"
}
//>contenthandler___CONFIG
});
//>contenthandler___SCRIPT