mirror of https://github.com/nkoehring/configs.git
updated vimperatorrc and bspwm
parent
8f70970181
commit
2098417689
@ -0,0 +1,23 @@
|
||||
#! /bin/sh
|
||||
|
||||
bspc config border_width 1
|
||||
bspc config window_gap 14
|
||||
|
||||
bspc config split_ratio 0.60
|
||||
bspc config borderless_monocle true
|
||||
bspc config gapless_monocle true
|
||||
bspc config leaf_monocle true
|
||||
bspc config focus_by_distance true
|
||||
bspc config focus_follows_pointer true
|
||||
bspc config auto_alternate true
|
||||
bspc config ignore_ewmh_focus true
|
||||
bspc config remove_disabled_monitors true
|
||||
bspc config remove_unplugged_monitors true
|
||||
|
||||
bspc monitor -d I II III IV V VI VII VIII IX X
|
||||
|
||||
bspc rule -a Firefox desktop=^2
|
||||
bspc rule -a Chromium desktop=^3
|
||||
bspc rule -a Gimp desktop=^5 follow=on floating=on
|
||||
bspc rule -a feh desktop=^9
|
||||
bspc rule -a MPlayer floating=on
|
@ -0,0 +1,35 @@
|
||||
#! /bin/sh
|
||||
|
||||
if [ $(pgrep -cx panel) -gt 1 ] ; then
|
||||
printf "%s\n" "The panel is already running." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
trap 'trap - TERM; kill 0' INT TERM QUIT EXIT
|
||||
|
||||
PANEL_FIFO=/tmp/panel-fifo
|
||||
PANEL_HEIGHT=24
|
||||
PANEL_FONT_FAMILY="-*-lucidatypewriter-medium-*-*-*-26-*-*-*-*-*-*-*"
|
||||
|
||||
[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
|
||||
mkfifo "$PANEL_FIFO"
|
||||
|
||||
bspc config top_padding $PANEL_HEIGHT
|
||||
bspc control --subscribe > "$PANEL_FIFO" &
|
||||
xtitle -sf 'T%s' > "$PANEL_FIFO" &
|
||||
while :; do
|
||||
_state=$(battery -f '%s')
|
||||
state=""
|
||||
[ $_state = "Discharging" ] && state="↓"
|
||||
[ $_state = "Charging" ] && state="↑"
|
||||
echo "SBAT $state$(battery -f '%i')%% $(clock -f '%a, %Y-%m-%d %H:%M')" > "$PANEL_FIFO"
|
||||
sleep 1
|
||||
done &
|
||||
#battery -sf 'Battery %s %i%%' > "$PANEL_FIFO" &
|
||||
#clock -sf '%a, Y-%m-%d %H:%M' > "$PANEL_FIFO" &
|
||||
|
||||
. $HOME/.config/bspwm/panel_colors
|
||||
|
||||
cat "$PANEL_FIFO" | panel_bar | lemonbar -g x$PANEL_HEIGHT -f "$PANEL_FONT_FAMILY" -F "$COLOR_FOREGROUND" -B "$COLOR_BACKGROUND" &
|
||||
|
||||
wait
|
@ -0,0 +1,74 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Example panel for LemonBoy's bar
|
||||
|
||||
. $HOME/.config/bspwm/panel_colors
|
||||
|
||||
num_mon=$(bspc query -M | wc -l)
|
||||
|
||||
while read -r line ; do
|
||||
case $line in
|
||||
S*)
|
||||
# clock output
|
||||
sys_infos="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${line#?} %{B-}%{F-}"
|
||||
;;
|
||||
T*)
|
||||
# xtitle output
|
||||
title="%{F$COLOR_TITLE_FG}%{B$COLOR_TITLE_BG} ${line#?} %{B-}%{F-}"
|
||||
;;
|
||||
W*)
|
||||
# bspwm internal state
|
||||
wm_infos=""
|
||||
IFS=':'
|
||||
set -- ${line#?}
|
||||
while [ $# -gt 0 ] ; do
|
||||
item=$1
|
||||
name=${item#?}
|
||||
case $item in
|
||||
M*)
|
||||
# active monitor
|
||||
if [ $num_mon -gt 1 ] ; then
|
||||
wm_infos="$wm_infos %{F$COLOR_ACTIVE_MONITOR_FG}%{B$COLOR_ACTIVE_MONITOR_BG} ${name} %{B-}%{F-} "
|
||||
fi
|
||||
;;
|
||||
m*)
|
||||
# inactive monitor
|
||||
if [ $num_mon -gt 1 ] ; then
|
||||
wm_infos="$wm_infos %{F$COLOR_INACTIVE_MONITOR_FG}%{B$COLOR_INACTIVE_MONITOR_BG} ${name} %{B-}%{F-} "
|
||||
fi
|
||||
;;
|
||||
O*)
|
||||
# focused occupied desktop
|
||||
wm_infos="${wm_infos}%{F$COLOR_FOCUSED_OCCUPIED_FG}%{B$COLOR_FOCUSED_OCCUPIED_BG}%{U$COLOR_FOREGROUND}%{+u} ${name} %{-u}%{B-}%{F-}"
|
||||
;;
|
||||
F*)
|
||||
# focused free desktop
|
||||
wm_infos="${wm_infos}%{F$COLOR_FOCUSED_FREE_FG}%{B$COLOR_FOCUSED_FREE_BG}%{U$COLOR_FOREGROUND}%{+u} ${name} %{-u}%{B-}%{F-}"
|
||||
;;
|
||||
U*)
|
||||
# focused urgent desktop
|
||||
wm_infos="${wm_infos}%{F$COLOR_FOCUSED_URGENT_FG}%{B$COLOR_FOCUSED_URGENT_BG}%{U$COLOR_FOREGROUND}%{+u} ${name} %{-u}%{B-}%{F-}"
|
||||
;;
|
||||
o*)
|
||||
# occupied desktop
|
||||
wm_infos="${wm_infos}%{F$COLOR_OCCUPIED_FG}%{B$COLOR_OCCUPIED_BG} ${name} %{B-}%{F-}"
|
||||
;;
|
||||
f*)
|
||||
# free desktop
|
||||
wm_infos="${wm_infos}%{F$COLOR_FREE_FG}%{B$COLOR_FREE_BG} ${name} %{B-}%{F-}"
|
||||
;;
|
||||
u*)
|
||||
# urgent desktop
|
||||
wm_infos="${wm_infos}%{F$COLOR_URGENT_FG}%{B$COLOR_URGENT_BG} ${name} %{B-}%{F-}"
|
||||
;;
|
||||
L*)
|
||||
# layout
|
||||
wm_infos="$wm_infos %{F$COLOR_LAYOUT_FG}%{B$COLOR_LAYOUT_BG} ${name} %{B-}%{F-}"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
;;
|
||||
esac
|
||||
printf "%s\n" "%{l}${wm_infos}%{c}${title}%{r}${sys_infos}"
|
||||
done
|
@ -0,0 +1,24 @@
|
||||
COLOR_FOREGROUND='#FFA3A6AB'
|
||||
COLOR_BACKGROUND='#FF34322E'
|
||||
COLOR_ACTIVE_MONITOR_FG='#FF34322E'
|
||||
COLOR_ACTIVE_MONITOR_BG='#FF58C5F1'
|
||||
COLOR_INACTIVE_MONITOR_FG='#FF58C5F1'
|
||||
COLOR_INACTIVE_MONITOR_BG='#FF34322E'
|
||||
COLOR_FOCUSED_OCCUPIED_FG='#FFF6F9FF'
|
||||
COLOR_FOCUSED_OCCUPIED_BG='#FF5C5955'
|
||||
COLOR_FOCUSED_FREE_FG='#FFF6F9FF'
|
||||
COLOR_FOCUSED_FREE_BG='#FF6D561C'
|
||||
COLOR_FOCUSED_URGENT_FG='#FF34322E'
|
||||
COLOR_FOCUSED_URGENT_BG='#FFF9A299'
|
||||
COLOR_OCCUPIED_FG='#FFA3A6AB'
|
||||
COLOR_OCCUPIED_BG='#FF34322E'
|
||||
COLOR_FREE_FG='#FF6F7277'
|
||||
COLOR_FREE_BG='#FF34322E'
|
||||
COLOR_URGENT_FG='#FFF9A299'
|
||||
COLOR_URGENT_BG='#FF34322E'
|
||||
COLOR_LAYOUT_FG='#FFA3A6AB'
|
||||
COLOR_LAYOUT_BG='#FF34322E'
|
||||
COLOR_TITLE_FG='#FFA3A6AB'
|
||||
COLOR_TITLE_BG='#FF34322E'
|
||||
COLOR_STATUS_FG='#FFA3A6AB'
|
||||
COLOR_STATUS_BG='#FF34322E'
|
@ -1,115 +0,0 @@
|
||||
let PLUGIN_INFO =
|
||||
<VimperatorPlugin>
|
||||
<name>appendAnchor</name>
|
||||
<description>append anchors to texts look like url.</description>
|
||||
<description lang="ja">リンク中の URL っぽいテキストにアンカーをつける。</description>
|
||||
<version>0.4.7</version>
|
||||
<author>SAKAI, Kazuaki</author>
|
||||
<minVersion>2.0pre</minVersion>
|
||||
<maxVersion>2.4</maxVersion>
|
||||
<detail><![CDATA[
|
||||
== Commands ==
|
||||
:anc:
|
||||
Append anchors.
|
||||
== GlobalVariables ==
|
||||
g:auto_append_anchor:
|
||||
Execute ":anc" automatically when Vimperator shows the hints.
|
||||
g:auto_append_anchor_once:
|
||||
Just first once.
|
||||
]]></detail>
|
||||
<detail lang="ja"><![CDATA[
|
||||
== Commands ==
|
||||
:anc:
|
||||
アンカーを付加する。
|
||||
== GlobalVariables ==
|
||||
g:auto_append_anchor:
|
||||
Vimperator がヒントを表示するときに自動的に ":anc" する。
|
||||
g:auto_append_anchor_once:
|
||||
最初の一回だけ。
|
||||
]]></detail>
|
||||
</VimperatorPlugin>;
|
||||
|
||||
(function(){
|
||||
|
||||
// settings ---
|
||||
// "ACEILMPRSTXY" is result of below code.
|
||||
// Array.prototype.uniq = function() this.reduceRight( function (a, b) (a[0] === b || a.unshift(b), a), []);
|
||||
// [ 'TITLE', 'STYLE', 'SCRIPT', 'TEXTAREA', 'XMP', 'A', ].join('').split('').sort().uniq().join('');
|
||||
const xpathQueryPlainText = '/descendant::*[not(contains(" TITLE STYLE SCRIPT TEXTAREA XMP A ", concat(" ", translate(local-name(), "aceilmprstxy", "ACEILMPRSTXY"), " ")))]/child::text()';
|
||||
const regexpLikeURL = new RegExp("(h?ttps?|ftp):/+([a-zA-Z0-9][-_.!~*'()a-zA-Z0-9;/?:@&=+$,%#]+[-_~*(a-zA-Z0-9;/?@&=+$%#])");
|
||||
|
||||
// process global variable
|
||||
if (stringToBoolean(liberator.globalVariables.auto_append_anchor, false)) {
|
||||
let originalHintsShow = liberator.modules.hints.show;
|
||||
let once = stringToBoolean(liberator.globalVariables.auto_append_anchor_once, true);
|
||||
hints.show = function () {
|
||||
if (!(once && content.document.anchor_appended)) {
|
||||
content.document.anchor_appended = true;
|
||||
liberator.execute('anc');
|
||||
}
|
||||
originalHintsShow.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
// register command
|
||||
liberator.modules.commands.addUserCommand(['anc'], 'append anchors to texts look like url',
|
||||
function(arg) {
|
||||
function append() {
|
||||
let result = 0;
|
||||
const doc = window.content.document;
|
||||
const range = doc.createRange();
|
||||
|
||||
let nodes = util.evaluateXPath(xpathQueryPlainText);
|
||||
for (let node in nodes) {
|
||||
while (node) {
|
||||
range.selectNode(node)
|
||||
|
||||
// search string like URL
|
||||
let start = range.toString().search(regexpLikeURL);
|
||||
// go to next node when there is nothing look like URL in current node
|
||||
if (!(start > -1)) break;
|
||||
|
||||
result++;
|
||||
|
||||
// build URL
|
||||
let scheme = RegExp.$1, host = RegExp.$2, lastMatch = RegExp.lastMatch;
|
||||
if (/^ttps?$/.test(scheme)) scheme = 'h' + scheme;
|
||||
let href = scheme + '://' + host;
|
||||
|
||||
// reset range
|
||||
range.setStart(node, start);
|
||||
range.setEnd(node, start + lastMatch.length);
|
||||
|
||||
// build anchor element
|
||||
let anchor = doc.createElement('a');
|
||||
anchor.setAttribute('href', href);
|
||||
range.surroundContents(anchor);
|
||||
|
||||
// insert
|
||||
range.insertNode(anchor);
|
||||
|
||||
// iterate
|
||||
node = node.nextSibling.nextSibling.nextSibling;
|
||||
}
|
||||
}
|
||||
range.detach();
|
||||
return result;
|
||||
}
|
||||
for (let i = 0; i < 20 && append(); i++)
|
||||
;
|
||||
},
|
||||
{},
|
||||
true
|
||||
);
|
||||
|
||||
// stuff function
|
||||
function stringToBoolean(str, defaultValue) {
|
||||
if (typeof str === 'number')
|
||||
str = str.toString();
|
||||
return !str ? (defaultValue ? true : false)
|
||||
: str.toLowerCase() === 'false' ? false
|
||||
: /^\d+$/.test(str) ? (parseInt(str) ? true : false)
|
||||
: true;
|
||||
}
|
||||
|
||||
})();
|
@ -1,177 +0,0 @@
|
||||
/* NEW BSD LICENSE {{{
|
||||
Copyright (c) 2008-2010, anekos.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
3. The names of the authors may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
###################################################################################
|
||||
# http://sourceforge.jp/projects/opensource/wiki/licenses%2Fnew_BSD_license #
|
||||
# に参考になる日本語訳がありますが、有効なのは上記英文となります。 #
|
||||
###################################################################################
|
||||
|
||||
}}} */
|
||||
|
||||
// PLUGIN_INFO {{{
|
||||
let PLUGIN_INFO =
|
||||
<VimperatorPlugin>
|
||||
<name>bit.ly</name>
|
||||
<description>Get short alias by bit.ly and j.mp</description>
|
||||
<description lang="ja">bit.ly や j.mp で短縮URLを得る</description>
|
||||
<version>2.1.2</version>
|
||||
<author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author>
|
||||
<license>new BSD License (Please read the source code comments of this plugin)</license>
|
||||
<license lang="ja">修正BSDライセンス (ソースコードのコメントを参照してください)</license>
|
||||
<updateURL>https://github.com/vimpr/vimperator-plugins/raw/master/bitly.js</updateURL>
|
||||
<minVersion>2.0pre</minVersion>
|
||||
<detail><![CDATA[
|
||||
== Commands ==
|
||||
:bitly [<URL>]
|
||||
Copy to clipboard.
|
||||
:jmp [<URL>]
|
||||
Copy to clipboard.
|
||||
== Require ==
|
||||
bit.ly API Key
|
||||
]]></detail>
|
||||
</VimperatorPlugin>;
|
||||
// }}}
|
||||
|
||||
|
||||
(function () {
|
||||
|
||||
const Realm = 'API Key for bit.ly (bitly.js)';
|
||||
const HostName = 'http://api.bit.ly';
|
||||
const ApiUrl = 'http://api.bit.ly/v3';
|
||||
const PasswordManager = Cc['@mozilla.org/login-manager;1'].getService(Ci.nsILoginManager);
|
||||
const LoginInfo =
|
||||
new Components.Constructor(
|
||||
'@mozilla.org/login-manager/loginInfo;1',
|
||||
Ci.nsILoginInfo,
|
||||
'init'
|
||||
);
|
||||
|
||||
function getAuth () {
|
||||
let count = {};
|
||||
let logins = PasswordManager.findLogins(count, HostName, null, Realm);
|
||||
if (logins.length)
|
||||
return logins[0];
|
||||
}
|
||||
|
||||
function setupAuth (callback) {
|
||||
liberator.open('http://bit.ly/a/your_api_key', liberator.NEW_TAB);
|
||||
commandline.input(
|
||||
'Login name for bit.ly: ',
|
||||
function (username) {
|
||||
commandline.input(
|
||||
'API Key: ',
|
||||
function (apiKey) {
|
||||
let login = LoginInfo(HostName, null, Realm, username, apiKey, '', '');
|
||||
PasswordManager.addLogin(login);
|
||||
callback();
|
||||
},
|
||||
{
|
||||
default: let (e = content.document.querySelector('#bitly_api_key')) (e ? e.value : '')
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function shorten (url, domain, command, callback) {
|
||||
function fixResponseText (s)
|
||||
s.trim();
|
||||
|
||||
liberator.log(arguments);
|
||||
function get () {
|
||||
let req = new XMLHttpRequest();
|
||||
req.onreadystatechange = function () {
|
||||
if (req.readyState != 4)
|
||||
return;
|
||||
if (req.status == 200)
|
||||
return callback && callback(fixResponseText(req.responseText), req);
|
||||
else
|
||||
return liberator.echoerr(req.statusText);
|
||||
};
|
||||
let requestUri =
|
||||
ApiUrl + '/' + (command || 'shorten') + '?' +
|
||||
'apiKey=' + auth.password + '&' +
|
||||
'login=' + auth.username + '&' +
|
||||
(command !== 'expand' ? 'uri=' : 'shortUrl=') + encodeURIComponent(url) + '&' +
|
||||
'domain=' + (domain || 'bit.ly') + '&' +
|
||||
'format=txt';
|
||||
req.open('GET', requestUri, callback);
|
||||
req.send(null);
|
||||
return !callback && fixResponseText(req.responseText);
|
||||
}
|
||||
|
||||
if (!url)
|
||||
url = buffer.URL;
|
||||
|
||||
let auth = getAuth();
|
||||
|
||||
if (auth)
|
||||
return get();
|
||||
|
||||
if (callback) {
|
||||
let args = Array.slice(arguments);
|
||||
setupAuth(function () shorten.apply(this, args));
|
||||
} else {
|
||||
liberator.echoerr('Not found API Key!! Try :bitly command, before use.');
|
||||
}
|
||||
}
|
||||
|
||||
[
|
||||
['jmp', 'j.mp'],
|
||||
['bitly', 'bit.ly'],
|
||||
].forEach(function ([name, domain]) {
|
||||
commands.addUserCommand(
|
||||
[name],
|
||||
'Copy ' + domain + ' url',
|
||||
function (args) {
|
||||
let url = args.literalArg ? util.stringToURLArray(args.literalArg)[0] : buffer.URL;
|
||||
let cmd = args['-expand'] ? 'expand' : 'shorten';
|
||||
|
||||
shorten(url, domain, cmd, function (short) {
|
||||
util.copyToClipboard(short);
|
||||
liberator.echo(short + ' <= ' + url);
|
||||
});
|
||||
},
|
||||
{
|
||||
literal: 0,
|
||||
options: [
|
||||
[['-expand', '-e'], commands.OPTION_NOARG]
|
||||
],
|
||||
completer: function (context) {
|
||||
context.completions = [
|
||||
[buffer.URL, 'Current URL']
|
||||
];
|
||||
context.fork('URL', 0, context, completion.url);
|
||||
}
|
||||
},
|
||||
true
|
||||
);
|
||||
__context__[name] = function (url, cmd, callback) shorten(url, domain, cmd, callback);
|
||||
});
|
||||
|
||||
__context__.get = shorten;
|
||||
})();
|
@ -1,123 +0,0 @@
|
||||
/**
|
||||
* bookmarklet wo command ni suru plugin
|
||||
*
|
||||
* @author halt feits <halt.feits@gmail.com>
|
||||
* @version 0.6.4
|
||||
*/
|
||||
|
||||
let PLUGIN_INFO =
|
||||
<VimperatorPlugin>
|
||||
<name>{NAME}</name>
|
||||
<description>convert bookmarklets to commands</description>
|
||||
<description lang="ja">ブックマークレットをコマンドにする</description>
|
||||
<author mail="halt.feits@gmail.com">halt feits</author>
|
||||
<version>0.6.6</version>
|
||||
<minVersion>2.0pre</minVersion>
|
||||
<maxVersion>2.1pre</maxVersion>
|
||||
<updateURL>https://github.com/vimpr/vimperator-plugins/raw/master/commandBookmarklet.js</updateURL>
|
||||
<detail><![CDATA[
|
||||
== SYNOPSIS ==
|
||||
This plugin automatically converts bookmarklets to valid commands for Vimperator.
|
||||
|
||||
== COMMAND ==
|
||||
Nothing built-in command, but each bookmarklets convert to commands that start with "bml".
|
||||
|
||||
== EXAMPLE ==
|
||||
"Hatena-Bookmark" -> bmlhatena-bookmark
|
||||
|
||||
== GLOBAL VARIABLES ==
|
||||
command_bookmarklet_prefix:
|
||||
This variable determines the prefix of a command name.
|
||||
command_bookmarklet_use_sandbox:
|
||||
When this variable is 1, execute the script of bookmarklets in Sandbox.
|
||||
If you use NoScript addon, probably you should enable this option.
|
||||
|
||||
== KNOWN ISSUES ==
|
||||
When title has non-ASCII characters, it converts to unaccountable command.
|
||||
You should rewrite title of bookmarklet to ASCII characters, to escape this issue.
|
||||
|
||||
]]></detail>
|
||||
<detail lang="ja"><![CDATA[
|
||||
== SYNOPSIS ==
|
||||
このプラグインはブックマークレットを Vimperator で実行可能なコマンドに自動的に変換します。
|
||||
|
||||
== COMMAND ==
|
||||
固有のコマンドはありませんが、それぞれのブックマークレットは "bml" ではじまるコマンドに変換されます。
|
||||
|
||||
== EXAMPLE ==
|
||||
"Hatena-Bookmark" -> bmlhatena-bookmark
|
||||
|
||||
== GLOBAL VARIABLES ==
|
||||
command_bookmarklet_prefix:
|
||||
コマンドの先頭に付加される文字列を規定します。
|
||||
デフォルトは "bml"
|
||||
command_bookmarklet_use_sandbox:
|
||||
1 の時、ブックマークレットのスクリプトを sandbox で実行します。
|
||||
NoScript アドオンをつかっている場合は、このオプションを有効にする必要があるでしょう。
|
||||
|
||||
== KNOWN ISSUES ==
|
||||
タイトルに ASCII 文字以外が含まれている場合、わけのわからないコマンドになります。
|
||||
この問題を避けるためにブックマークレットのタイトルを ASCII 文字のみに書き換えることをおすすめします。
|
||||
|
||||
]]></detail>
|
||||
</VimperatorPlugin>;
|
||||
|
||||
( function () {
|
||||
|
||||
let prefix = liberator.globalVariables.command_bookmarklet_prefix;
|
||||
if (prefix === undefined)
|
||||
prefix = 'bml';
|
||||
|
||||
let items = bookmarks.get('javascript:');
|
||||
if (!items.length) {
|
||||
liberator.echoerr('No bookmarks set');
|
||||
return;
|
||||
}
|
||||
|
||||
items.forEach(function (item) {
|
||||
let name = toValidCommandName(item.title);
|
||||
if (commands.get(name))
|
||||
return;
|
||||
commands.addUserCommand(
|
||||
[name],
|
||||
'bookmarklet : ' + item.title,
|
||||
function () evalScript(item.url),
|
||||
{ shortHelp: 'Bookmarklet' },
|
||||
false
|
||||
);
|
||||
});
|
||||
|
||||
function toBoolean (value, def) {
|
||||
switch (typeof value) {
|
||||
case 'undefined':
|
||||
return def;
|
||||
case 'number':
|
||||
return !!value;
|
||||
case 'string':
|
||||
return !/^(\d+|false)$/i.test(value) || parseInt(value);
|
||||
default:
|
||||
return !!value;
|
||||
}
|
||||
}
|
||||
|
||||
function evalInSandbox (str) {
|
||||
let sandbox = new Components.utils.Sandbox("about:blank");
|
||||
sandbox.__proto__ = content.window.wrappedJSObject;
|
||||
return Components.utils.evalInSandbox(str, sandbox);
|
||||
}
|
||||
|
||||
function evalScript (url) {
|
||||
if (toBoolean(liberator.globalVariables.command_bookmarklet_use_sandbox, false)) {
|
||||
evalInSandbox(decodeURIComponent(url.replace(/^\s*javascript:/i, '')));
|
||||
} else {
|
||||
liberator.open(url);
|
||||
}
|
||||
}
|
||||
|
||||
function toValidCommandName(str) {
|
||||
str = prefix + escape(str.replace(/ +/g, '').toLowerCase()).replace(/[^a-zA-Z]+/g,'');
|
||||
return str.substr(0, str.length > 50 ? 50 : str.length);
|
||||
}
|
||||
|
||||
} )();
|
||||
// vim:sw=2 ts=2 et:
|
@ -1,183 +0,0 @@
|
||||
liberator.plugins.cssRules = function () {
|
||||
|
||||
liberator.commands.addUserCommand(
|
||||
["css[rule]"],
|
||||
"Sets CSS rule for current page",
|
||||
function (args, count, special) {
|
||||
// 1 2 3 4
|
||||
var matches = args.match(/^\s*?([:\[\]"'^*~|= #.,a-zA-Z0-9_>+-]+)(\s*([-+^])?=\s*(.*))?\s*$/);
|
||||
var ruleName = matches[1];
|
||||
var setValue = !!matches[2];
|
||||
var operator = matches[3];
|
||||
var ruleValue = matches[4];
|
||||
if (count > 0) count = count - 1; else count = -1;
|
||||
|
||||
var rule = liberator.plugins.cssRules.getRule(ruleName, count);
|
||||
if (!rule) {
|
||||
if (special) {
|
||||
rule = liberator.plugins.cssRules.addRule(ruleName, count);
|
||||
if (!rule) {
|
||||
liberator.echoerr("Failed to add CSS rule '" + ruleName + "'!");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
liberator.echoerr("CSS rule '" + ruleName + "' was not found!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!setValue) {
|
||||
liberator.echo(rule.selectorText + " {\n\t" + rule.style.cssText.replace(/; /g, ";\n\t") + "\n}");
|
||||
} else {
|
||||
liberator.plugins.cssRules.setRule(rule, ruleValue)
|
||||
}
|
||||
}, {}, true
|
||||
);
|
||||
|
||||
liberator.commands.addUserCommand(
|
||||
["rmcss[rule]"],
|
||||
"Remove CSS rule for current page",
|
||||
function (args, count, special) {
|
||||
var args = args.replace(/^\s*/, "").replace(/\s*$/, "");
|
||||
if (args.match(/[^:\[\]"'^*~|= #.,a-zA-Z0-9_>+-]/)) {
|
||||
liberator.echoerr("Not a CSS rule name: '" + args + "'!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (count > 0) count = count - 1; else count = -1;
|
||||
var rule = liberator.plugins.cssRules.getRule(args, count);
|
||||
|
||||
if (!rule) {
|
||||
liberator.echoerr("CSS rule '" + args + "' was not found!");
|
||||
return;
|
||||
}
|
||||
|
||||
liberator.plugins.cssRules.rmRule(rule);
|
||||
}, {}, true
|
||||
);
|
||||
|
||||
liberator.commands.addUserCommand(
|
||||
["cssrules"],
|
||||
"Lists all CSS rules for current page",
|
||||
function (args, count) {
|
||||
|
||||
var ss = liberator.tabs.getTab().linkedBrowser.contentDocument.styleSheets;
|
||||
var list = ":" + (liberator.util.escapeHTML(liberator.commandline.getCommand()) || ":cssrules") + "<br/>" +
|
||||
"<table><tr align=\"left\" class=\"hl-Title\"><th colspan=\"2\">--- CSS rules ---</th></tr>";
|
||||
|
||||
var from = 0;
|
||||
var len = ss.length;
|
||||
|
||||
if (count > 0) {
|
||||
from = count - 1;
|
||||
len = count;
|
||||
}
|
||||
|
||||
for (var i = from; i < len; i++) {
|
||||
var href = ss[i].href;
|
||||
if (href)
|
||||
href = "<a href=\"#\" class=\"hl-URL\">" + liberator.util.escapeHTML(href) + "</a>";
|
||||
else
|
||||
href = "<span class=\"hl-InfoMsg\">Embedded Styles</span>";
|
||||
|
||||
var rules = "";
|
||||
for (var j = 0, lenj = ss[i].cssRules.length; j < lenj; j++) {
|
||||
rules += "<span style=\"font-weight: bold\">" + ss[i].cssRules[j].selectorText + "</span> {";
|
||||
rules += "<div style=\"margin-left: 2em\">" + ss[i].cssRules[j].style.cssText.replace(/; /g, ";<br/>") + "</div>}<br/><br/>";
|
||||
}
|
||||
list += "<tr align=\"left\"><th>" + (i + 1) + ":</th>" + href + "</th></tr>";
|
||||
list += "<tr><td> </td><td>" + rules + "</td></tr>";
|
||||
}
|
||||
list += "</table>";
|
||||
|
||||
liberator.commandline.echo(list, liberator.commandline.HL_NORMAL, liberator.commandline.FORCE_MULTILINE);
|
||||
|
||||
}, {}, true
|
||||
);
|
||||
|
||||
return {
|
||||
|
||||
getRule: function (filter, num) {
|
||||
filter = filter.toLowerCase();
|
||||
var ss = liberator.tabs.getTab().linkedBrowser.contentDocument.styleSheets;
|
||||
|
||||
if (num >= 0) {
|
||||
|
||||
if (num <= ss.length) {
|
||||
var rules = ss[num].cssRules;
|
||||
for (var i = 0, len = rules.length; i < len; i++) {
|
||||
if (rules[i].selectorText == filter) {
|
||||
return rules[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
for (var j = 0, lenj = ss.length; j < lenj; j++) {
|
||||
for (var i = 0, len = ss[j].cssRules.length; i < len; i++) {
|
||||
if (ss[j].cssRules[i].selectorText == filter) {
|
||||
return ss[j].cssRules[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
setRule: function (rule, ruleValue) {
|
||||
var rulesList = ruleValue.split("; ");
|
||||
for (var i = 0; i < rulesList.length; i++) {
|
||||
var data = rulesList[i].match(/^\s*([a-zA-Z-]+)\s*:\s*(.*?)\s*;?$/);
|
||||
if (data) {
|
||||
var important = data[2].match(/!\s*important$/);
|
||||
if (important) data[2] = data[2].substring(0, data[2].length - important.length);
|
||||
rule.style.setProperty(data[1], data[2], important? "important": "");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
addRule: function (name, num, place) {
|
||||
var ss = liberator.tabs.getTab().linkedBrowser.contentDocument.styleSheets;
|
||||
var newPlace;
|
||||
|
||||
if (num >= ss.length) return null;
|
||||
if (num < 0) num = 0;
|
||||
|
||||
if (!place) place = ss[num].cssRules.length;
|
||||
|
||||
try {
|
||||
var newPlace = ss[num].insertRule(name + "{}", place);
|
||||
}
|
||||
catch (e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return ss[num].cssRules[newPlace];
|
||||
},
|
||||
|
||||
rmRule: function (rule) {
|
||||
var ss = rule.parentStyleSheet;
|
||||
var num = -1;
|
||||
for (var i = 0; i < ss.cssRules.length; i++) {
|
||||
if (ss.cssRules[i] == rule) {
|
||||
num = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (num < 0) return false;
|
||||
|
||||
try {
|
||||
ss.deleteRule(num);
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} ();
|
||||
|
@ -1,229 +0,0 @@
|
||||
/* {{{
|
||||
Copyright (c) 2008-2009, anekos.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
3. The names of the authors may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
###################################################################################
|
||||
# http://sourceforge.jp/projects/opensource/wiki/licenses%2Fnew_BSD_license #
|
||||
# に参考になる日本語訳がありますが、有効なのは上記英文となります。 #
|
||||
###################################################################################
|
||||
|
||||
}}} */
|
||||
|
||||
// PLUGIN_INFO {{{
|
||||
let PLUGIN_INFO =
|
||||
<VimperatorPlugin>
|
||||
<name>every.js</name>
|
||||
<description>to run a specified command every time at specified interval.</description>
|
||||
<description lang="ja">指定のコマンドを指定の間隔で実行する。</description>
|
||||
<version>1.3.1</version>
|
||||
<author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author>
|
||||
<license>new BSD License (Please read the source code comments of this plugin)</license>
|
||||
<license lang="ja">修正BSDライセンス (ソースコードのコメントを参照してください)</license>
|
||||
<updateURL>https://github.com/vimpr/vimperator-plugins/raw/master/every.js</updateURL>
|
||||
<minVersion>2.3</minVersion>
|
||||
<maxVersion>2.3</maxVersion>
|
||||
<detail><![CDATA[
|
||||
== Usage ==
|
||||
:[INTERVAL]every [-i[nterval]=INTERVAL] [-init=INITIALIZE_COMMAND] [-from=COUNTER_FORM] [-step=COUNTER_STEP]<COMMAND>:
|
||||
run <COMMAND> every time at [INTERVAL] sec.
|
||||
|
||||
:[INTERVAL]delay [-i[nterval]=INTERVAL] <COMMAND>:
|
||||
run <COMMAND> after [INTERVAL] sec.
|
||||
|
||||
:every! <PROCESS-ID>:
|
||||
kill specified process.
|
||||
|
||||
The default value of [INTERVAL] is 1 sec.
|
||||
While Vimperator's focus is at command-line,
|
||||
these commands does not run.
|
||||
|
||||
== Links ==
|
||||
http://d.hatena.ne.jp/nokturnalmortum/20081102#1225552718
|
||||
]]></detail>
|
||||
<detail lang="ja"><![CDATA[
|
||||
== Usage ==
|
||||
:[INTERVAL]every [-i[nterval]=INTERVAL] [-init=INITIALIZE_COMMAND] [-from=COUNTER_FROM] [-step=COUNTER_STEP]<COMMAND>:
|
||||
[INTERVAL] 間隔で <COMMAND> を走らせる。
|
||||
|
||||
:[INTERVAL]delay [-i[nterval]=INTERVAL] <COMMAND>:
|
||||
[INTERVAL] 秒後に <COMMAND> を走らせる。
|
||||
|
||||
:every! <PROCESS-ID>:
|
||||
指定のプロセスを殺す。
|
||||
|
||||
INTERVAL:
|
||||
INTERVAL のデフォルトは 1秒。
|
||||
オプションでの指定時には、"s[ec]", "m[in]", "h[our]" の単位で指定可能。(e.g. "0.5hour")
|
||||
コマンドラインにいるときには、実行されないようになっている。
|
||||
INITIALIZE_COMMAND:
|
||||
指定すると、:every 実行直後にそれが実行されます。
|
||||
COUNTER_FROM/COUNTER_STEP:
|
||||
何れか一方を指定すると、COMMAND 中の "<counter>" という文字が、カウンター数字に置換されます。
|
||||
この数字は、COUNTER_FROM で初期化され、every での実行毎に COUNTER_STEP ずつ増えます。
|
||||
|
||||
== Links ==
|
||||
http://d.hatena.ne.jp/nokturnalmortum/20081102#1225552718
|
||||
]]></detail>
|
||||
</VimperatorPlugin>;
|
||||
// }}}
|
||||
|
||||
ps = [];
|
||||
|
||||
(function () {
|
||||
|
||||
let (every = liberator.plugins.every) {
|
||||
if (every && every.ps)
|
||||
kill('*');
|
||||
}
|
||||
|
||||
function defined (value)
|
||||
(typeof value !== 'undefined');
|
||||
|
||||
function defaultValue (value, def)
|
||||
(defined(value) ? value : def);
|
||||
|
||||
function run (command, interval, opts) {
|
||||
let process = {
|
||||
handle: null,
|
||||
command: command,
|
||||
options: opts
|
||||
};
|
||||
if (opts.init)
|
||||
liberator.execute(opts.init);
|
||||
let fun = function () {
|
||||
if (liberator.mode == liberator.modules.modes.COMMAND_LINE)
|
||||
return;
|
||||
let cmd = process.command;
|
||||
if (defined(opts.from) || defined(opts.step)) {
|
||||
if (!defined(process.counter))
|
||||
process.counter = defaultValue(opts.from, 1);
|
||||
cmd = cmd.replace(/<counter>/i, process.counter);
|
||||
process.counter += defaultValue(opts.step, 1);
|
||||
}
|
||||
liberator.execute(cmd);
|
||||
};
|
||||
process.handle = setInterval(fun, parseInt(interval, 10));
|
||||
ps.push(process);
|
||||
}
|
||||
|
||||
function kill (index) {
|
||||
if (index == '*') {
|
||||
ps.forEach(function (process) clearInterval(process.handle));
|
||||
liberator.echo(ps.length + ' processes were killed!');
|
||||
ps = [];
|
||||
} else {
|
||||
let process = ps[index];
|
||||
if (process) {
|
||||
clearInterval(process.handle);
|
||||
ps.splice(index, index);
|
||||
liberator.echo('process "' + process.command + '" was killed!');
|
||||
} else {
|
||||
liberator.echoerr('unknown process');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function msec (count) {
|
||||
return (count > 0) ? count * 1000 : 1000;
|
||||
}
|
||||
|
||||
function expandSuffix (s) {
|
||||
const tbl = {
|
||||
'^s(ec)?$': 1,
|
||||
'^m(in)?$': 60,
|
||||
'^h(our)?$': 60 * 60
|
||||
};
|
||||
let [, a, b] = s.match(/^([\d\.]+)(.*)$/);
|
||||
let v = parseFloat(a);
|
||||
for (let e in tbl)
|
||||
if (b.match(e))
|
||||
return v * tbl[e];
|
||||
return v;
|
||||
}
|
||||
|
||||
liberator.modules.commands.addUserCommand(
|
||||
['every', 'ev'],
|
||||
'every',
|
||||
function (args) {
|
||||
if (args.bang) {
|
||||
kill(args.literalArg);
|
||||
} else {
|
||||
let interval = args['-interval'];
|
||||
let opts = {};
|
||||
'from step init'.split(' ').forEach(function (v) (opts[v] = args['-' + v]));
|
||||
run(args.literalArg, msec(interval ? expandSuffix(interval) : args.count), opts);
|
||||
}
|
||||
},
|
||||
{
|
||||
literal: 0,
|
||||
count: true,
|
||||
bang: true,
|
||||
completer: function (context, args) {
|
||||
if (args.bang) {
|
||||
context.title = ['PID', 'every process'];
|
||||
context.completions = [['*', 'kill em all']].concat(ps.map(function (p, i) ([i.toString(), p.command])));
|
||||
} else {
|
||||
liberator.modules.completion.ex(context);
|
||||
}
|
||||
},
|
||||
options: [
|
||||
[['-interval', '-i'], commands.OPTION_ANY],
|
||||
[['-from', '-f'], commands.OPTION_FLOAT],
|
||||
[['-step', '-s'], commands.OPTION_FLOAT],
|
||||
[['-init', '-i'], commands.OPTION_STRING],
|
||||
]
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
|
||||
liberator.modules.commands.addUserCommand(
|
||||
['delay'],
|
||||
'delay',
|
||||
function (args) {
|
||||
let cmd = args.literalArg;
|
||||
let f = function () {
|
||||
if (liberator.mode == liberator.modules.modes.COMMAND_LINE) {
|
||||
setTimeout(f, 500);
|
||||
} else {
|
||||
liberator.execute(cmd);
|
||||
}
|
||||
};
|
||||
let interval = args['-interval'];
|
||||
setTimeout(f, msec(interval ? expandSuffix(interval) : args.count));
|
||||
},
|
||||
{
|
||||
literal: 0,
|
||||
count: true,
|
||||
completer: function (context) liberator.modules.completion.ex(context),
|
||||
options: [
|
||||
[['-interval', '-i'], commands.OPTION_ANY]
|
||||
]
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
})();
|
@ -1,46 +0,0 @@
|
||||
// INFO //
|
||||
var INFO =
|
||||
<plugin name="gmap.js" version="0.1"
|
||||
summary="Get google maps URL of current machine location."
|
||||
href="http://github.com/vimpr/vimperator-plugins/blob/master/gmap.js"
|
||||
xmlns="http://vimperator.org/namespaces/liberator">
|
||||
<author email="mitsugu.oyama@gmail.com">Mitsugu Oyama</author>
|
||||
<license href="http://opensource.org/licenses/mit-license.php">MIT</license>
|
||||
<project name="Vimperator" minVersion="2.3"/>
|
||||
<p>
|
||||
You can get Google Maps URL of current machine location by this plugin.
|
||||
</p>
|
||||
<item>
|
||||
<tags>'GoogleMaps'</tags>
|
||||
<spec>:gmap</spec>
|
||||
<description>
|
||||
<p>You can get Google Maps URL of current machine location by this plugin.</p>
|
||||
<dl>
|
||||
<dt>See.</dt>
|
||||
<dd>
|
||||
<p><link topic="http://mozilla.jp/firefox/features/geolocation/">http://mozilla.jp/firefox/features/geolocation/</link> (Japanese)</p>
|
||||
<p><link topic="https://developer.mozilla.org/Ja/Using_geolocation">https://developer.mozilla.org/Ja/Using_geolocation</link> (Japanese)</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</description>
|
||||
</item>
|
||||
</plugin>;
|
||||
|
||||
(function(){
|
||||
commands.addUserCommand(
|
||||
['gmap'],
|
||||
'Get Google Map URL of current location',
|
||||
function(){
|
||||
let strURL='http://maps.google.com/maps?ie=UTF8&q=';
|
||||
let Cc=Components.classes;
|
||||
let Ci=Components.interfaces;
|
||||
let geolocation=Cc["@mozilla.org/geolocation;1"]
|
||||
.getService(Ci.nsIDOMGeoGeolocation);
|
||||
geolocation.getCurrentPosition(function(position){
|
||||
let strL=position.coords.latitude+','+position.coords.longitude;
|
||||
liberator.echo(strURL+strL);
|
||||
util.copyToClipboard(strURL+strL,true);
|
||||
});
|
||||
}
|
||||
);
|
||||
})();
|
@ -1,89 +0,0 @@
|
||||
// PLUGIN_INFO//{{{
|
||||
var PLUGIN_INFO =
|
||||
<VimperatorPlugin>
|
||||
<name>{NAME}</name>
|
||||
<description>hash of file</description>
|
||||
<author mail="konbu.komuro@gmail.com" homepage="http://d.hatena.ne.jp/hogelog/">hogelog</author>
|
||||
<version>0.2.2</version>
|
||||
<minVersion>2.3</minVersion>
|
||||
<maxVersion>2.3</maxVersion>
|
||||
<updateURL>https://github.com/vimpr/vimperator-plugins/raw/master/hash.js</updateURL>
|
||||
<detail><![CDATA[
|
||||
|
||||
== COMMANDS ==
|
||||
hash:
|
||||
:hash md2|md5|sha1|sha256|sha384|sha512 file-path
|
||||
|
||||
]]></detail>
|
||||
</VimperatorPlugin>;
|
||||
//}}}
|
||||
|
||||
(function() {
|
||||
const PR_UINT_MAX = 0xffffffff;
|
||||
let Crypt = Cc["@mozilla.org/security/hash;1"].createInstance(Ci.nsICryptoHash);
|
||||
let Algos = [
|
||||
["md2", "MD2 Algorithm"],
|
||||
["md5", "MD5 Algorithm"],
|
||||
["sha1", "SHA1 Algorithm"], // SHA-1
|
||||
["sha256", "SHA256 Algorithm"], // SHA-256
|
||||
["sha384", "SHA384 Algorithm"], // SHA-384
|
||||
["sha512", "SHA512 Algorithm"], // SHA-512
|
||||
];
|
||||
|
||||
function getStream(path)
|
||||
{
|
||||
let file = io.File(path);
|
||||
let stream = Cc["@mozilla.org/network/file-input-stream;1"]
|
||||
.createInstance(Ci.nsIFileInputStream);
|
||||
stream.init(file, 0x01, 0444, 0);
|
||||
return stream;
|
||||
}
|
||||
|
||||
// return the two-digit hexadecimal code for a byte
|
||||
function toHexString(charCode)
|
||||
{
|
||||
return ("0" + charCode.toString(16)).slice(-2);
|
||||
}
|
||||
|
||||
|
||||
commands.addUserCommand(["hash"], "hash of file",
|
||||
function(args){
|
||||
if (args.length!=2) {
|
||||
|
||||
liberator.echo("usage \":hash md2|md5|sha1|sha256|sha384|sha512 file-path\"");
|
||||
return false;
|
||||
}
|
||||
let [algo, path] = args;
|
||||
let stream = getStream(path);
|
||||
|
||||
Crypt.initWithString(algo);
|
||||
|
||||
// read the entire stream
|
||||
Crypt.updateFromStream(stream, PR_UINT_MAX);
|
||||
|
||||
stream.close();
|
||||
|
||||
// get base-64 string
|
||||
let hash = Crypt.finish(false);
|
||||
|
||||
// convert the binary hash data to a hex string.
|
||||
let str = [toHexString(hash.charCodeAt(i)) for(i in hash)].join("");
|
||||
util.copyToClipboard(str, true);
|
||||
},
|
||||
{
|
||||
bang: true,
|
||||
completer: function (context, args){
|
||||
if (args.completeArg == 0) {
|
||||
context.title = ["hash", "algorithm"];
|
||||
context.completions = Algos;
|
||||
} else if (args.completeArg == 1) {
|
||||
completion.url(context, "f");
|
||||
}
|
||||
},
|
||||
literal: 1,
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
})();
|
||||
// vim: fdm=marker sw=4 ts=4 et:
|
@ -1,91 +0,0 @@
|
||||
var PLUGIN_INFO =
|
||||
<VimperatorPlugin>
|
||||
<name>{NAME}</name>
|
||||
<description>History search backward like UNIX shell.</description>
|
||||
<description lang="ja">UNIX シェルのような、C-rで履歴検索を行うプラグイン</description>
|
||||
<minVersion>2.0</minVersion>
|
||||
<maxVersion>2.0</maxVersion>
|
||||
<updateURL>https://github.com/vimpr/vimperator-plugins/raw/master/history-search-backward.js</updateURL>
|
||||
<author mail="hotchpotch@gmail.com" homepage="http://d.hatena.ne.jp/secondlife/">Yuichi Tateno</author>
|
||||
<license>MIT</license>
|
||||
<version>0.2</version>
|
||||
<detail><![CDATA[
|
||||
UNIX シェルのように、コマンドラインで C-r でヒストリ検索を行うプラグインです。map の変更設定は以下のように行えます。
|
||||
>||
|
||||
liberator.globalVariables.history_search_backward_map = ['<C-r>'];
|
||||
||<
|
||||
|
||||
]]></detail>
|
||||
</VimperatorPlugin>;
|
||||
|
||||
(function() {
|
||||
let p = function(msg) {
|
||||
Application.console.log(''+msg);
|
||||
}
|
||||
|
||||
let evalWithContext = function(func, context) {
|
||||
let str;
|
||||
let fstr = func.toString();
|
||||
if (fstr.indexOf('function () {') == 0) {
|
||||
str = fstr.replace(/.*?{([\s\S]+)}.*?/m, "$1");
|
||||
} else {
|
||||
str = '(' + fstr + ')()';
|
||||
}
|
||||
return liberator.eval(str, context);
|
||||
}
|
||||
|
||||
let showCompletions = function() {
|
||||
if (!options.get('wildoptions').has('auto')) {
|
||||
evalWithContext(function() {
|
||||
completions.complete(true, false);
|
||||
completions.itemList.show();
|
||||
}, commandline.input);
|
||||
}
|
||||
}
|
||||
|
||||
let next = function() {
|
||||
evalWithContext(function() completions.tab(false), commandline.input);
|
||||
}
|
||||
|
||||
let prev = function() {
|
||||
evalWithContext(function() completions.tab(true), commandline.input);
|
||||
}
|
||||
|
||||
const commandlineWidget = document.getElementById("liberator-commandline");
|
||||
|
||||
mappings.addUserMap([modes.COMMAND_LINE],
|
||||
liberator.globalVariables.history_search_backward_map || ['<C-r>'],
|
||||
'History incremental search backward.',
|
||||
function()
|
||||
{
|
||||
if (evalWithContext(function() completions.itemList.visible(), commandline.input)) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
let command = commandline.command || '';
|
||||
let completionsList = [[key, i] for ([i, key] in storage['history-command'])].
|
||||
filter(function([key, i]) key).reverse();
|
||||
|
||||
commandline.input('bck-i-search: ', function(str) {
|
||||
try {
|
||||
liberator.execute(str);
|
||||
} catch(e) {};
|
||||
modes.pop();
|
||||
return;
|
||||
}, {
|
||||
completer: function(context) {
|
||||
context.title = ['CommandLine History', 'INDEX'];
|
||||
context.completions = completionsList;
|
||||
},
|
||||
onChange: function() {
|
||||
showCompletions();
|
||||
},
|
||||
default: command,
|
||||
});
|
||||
showCompletions();
|
||||
}
|
||||
);
|
||||
})();
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,98 +0,0 @@
|
||||
var PLUGIN_INFO =
|
||||
<VimperatorPlugin>
|
||||
<name>{NAME}</name>
|
||||
<description>Send to your Android Phone</description>
|
||||
<description lang="ja">Android 端末に URL などを送信します</description>
|
||||
<author mail="hotchpotch@gmail.com">Yuichi Tateno</author>
|
||||
<minVersion>2.3</minVersion>
|
||||
<maxVersion>2.3</maxVersion>
|
||||
<updateURL>https://github.com/vimpr/vimperator-plugins/raw/master/vimp_to_android_phone.js</updateURL>
|
||||
</VimperatorPlugin>;
|
||||
|
||||
(function() {
|
||||
|
||||
var apiVersion = '3';
|
||||
var base = 'http://chrometophone.appspot.com';
|
||||
var baseURL = base + '/send?ver=' + apiVersion;
|
||||
var signInURL = base + '/signin?extret=about:blankZ&ver=' + apiVersion;
|
||||
var signOutURL = base + '/signout?extret=about:blankZ&ver=' + apiVersion;
|
||||
// var loginURL = 'https://www.google.com/accounts/ServiceLoginAuth?service=ah&sig=d71ef8b8d6150b23958ad03b3bf546b7';
|
||||
|
||||
var serialize = function(hash) {
|
||||
var res = [];
|
||||
for (var key in hash) {
|
||||
res.push(encodeURIComponent(key) + '=' + encodeURIComponent(hash[key]));
|
||||
}
|
||||
return res.join('&');
|
||||
}
|
||||
|
||||
var sendToPhone = function(requestURL) {
|
||||
requestURL = baseURL + '&' + requestURL;
|
||||
var req = new libly.Request(requestURL, {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'X-Extension': 'true'
|
||||
});
|
||||
req.addEventListener('success', function(res) {
|
||||
var body = res.responseText;
|
||||
if (body.substring(0, 2) == 'OK') {
|
||||
liberator.echo('Send to phone successed.');
|
||||
} else if (body.indexOf('LOGIN_REQUIRED' == 0)) {
|
||||
liberator.echo('Please login first');
|
||||
liberator.open(signInURL, liberator.NEW_TAB);
|
||||
} else if (body.indexOf('DEVICE_NOT_REGISTERED') == 0) {
|
||||
liberator.echo('device not registered');
|
||||
liberator.open(signOutURL, liberator.NEW_TAB);
|
||||
}
|
||||
});
|
||||
req.addEventListener('failure', function(res) {
|
||||
liberator.echoerr('Send to phone failed.');
|
||||
});
|
||||
req.get();
|
||||
}
|
||||
|
||||
liberator.modules.commands.addUserCommand(["sp[hone]"], "Sent to your Android Phone",
|
||||
function(args) {
|
||||
if (args && args['-login']) {
|
||||
liberator.open(signInURL, liberator.NEW_TAB);
|
||||
return;
|
||||
} else if (args && args['-logout']) {
|
||||
liberator.open(signOutURL, liberator.NEW_TAB);
|
||||
return;
|
||||
}
|
||||
|
||||
var req = {
|
||||
sel: libly.$U.getSelectedString()
|
||||
};
|
||||
|
||||
if (args && !args.arguments && !args['-title'])
|
||||
req.url = args[0];
|
||||
else if (args && args.arguments)
|
||||
req.url = args.arguments[0];
|
||||
|
||||
if (args && args['-title'])
|
||||
req.title = args['-title'];
|
||||
else if (!req.url)
|
||||
req.title = content.document.title;
|
||||
|
||||
if (!req.url) req.url = content.location.href;
|
||||
if (!req.title) req.title = req.url;
|
||||
|
||||
if (!req.url || !req.url.match(/^https?/)) {
|
||||
liberator.echoerr('http/https schema only');
|
||||
return;
|
||||
};
|
||||
sendToPhone(serialize(req));
|
||||
}, {
|
||||
options: [
|
||||
[["-title", "-t"], liberator.modules.commands.OPTION_STRING],
|
||||
[["-login"], liberator.modules.commands.OPTION_NOARG],
|
||||
[["-logout"], liberator.modules.commands.OPTION_NOARG],
|
||||
]
|
||||
}, {
|
||||
// replace: true
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
|
||||
|
@ -0,0 +1,91 @@
|
||||
#
|
||||
# bspwm hotkeys
|
||||
#
|
||||
|
||||
super + shift + q
|
||||
bspc quit
|
||||
|
||||
super + q
|
||||
bspc window -c
|
||||
|
||||
super + t
|
||||
bspc desktop -l next
|
||||
|
||||
super + b
|
||||
bspc desktop -B
|
||||
|
||||
super + {s,f}
|
||||
bspc window -t {floating,fullscreen}
|
||||
|
||||
super + {grave,Tab}
|
||||
bspc {window,desktop} -f last
|
||||
|
||||
super + apostrophe
|
||||
bspc window -s last
|
||||
|
||||
super + {o,i}
|
||||
bspc control --record-history off; \
|
||||
bspc window {older,newer} -f; \
|
||||
bspc control --record-history on
|
||||
|
||||
super + y
|
||||
bspc window -w last.manual
|
||||
|
||||
super + m
|
||||
bspc window -s biggest
|
||||
|
||||
super + {_,shift + }{h,j,k,l}
|
||||
bspc window -{f,s} {left,down,up,right}
|
||||
|
||||
super + {_,shift + }c
|
||||
bspc window -f {next,prev}
|
||||
|
||||
super + {comma,period}
|
||||
bspc desktop -C {backward,forward}
|
||||
|
||||
super + bracket{left,right}
|
||||
bspc desktop -f {prev,next}
|
||||
|
||||
super + ctrl + {h,j,k,l}
|
||||
bspc window -p {left,down,up,right}
|
||||
|
||||
super + ctrl + {_,shift + }space
|
||||
bspc {window -p cancel,desktop -c}
|
||||
|
||||
super + alt + {h,j,k,l}
|
||||
bspc window -e {left -10,down +10,up -10,right +10}
|
||||
|
||||
super + alt + shift + {h,j,k,l}
|
||||
bspc window -e {right -10,up +10,down -10,left +10}
|
||||
|
||||
super + ctrl + {1-9}
|
||||
bspc window -r 0.{1-9}
|
||||
|
||||
super + {_,shift + }{1-9,0}
|
||||
bspc {desktop -f,window -d} ^{1-9,10}
|
||||
|
||||
~button1
|
||||
bspc pointer -g focus
|
||||
|
||||
super + button{1-3}
|
||||
bspc pointer -g {move,resize_side,resize_corner}
|
||||
|
||||
super + !button{1-3}
|
||||
bspc pointer -t %i %i
|
||||
|
||||
super + @button{1-3}
|
||||
bspc pointer -u
|
||||
|
||||
#
|
||||
# wm independent hotkeys
|
||||
#
|
||||
|
||||
super + Return
|
||||
urxvt
|
||||
|
||||
super + p
|
||||
rofi -show run
|
||||
|
||||
# make sxhkd reload its configuration files:
|
||||
super + Escape
|
||||
pkill -USR1 -x sxhkd
|
Loading…
Reference in New Issue