Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function () {
- function addLocalMappings(buffer, maps) {
- maps.forEach(
- function (map) {
- let [cmd, action, extra] = map;
- let actionFunc = action;
- extra || (extra = {});
- if (typeof action == "string") {
- if (action.charAt(0) == ':')
- actionFunc = extra.open ? function () commandline.open("", action, modes.EX)
- : function () liberator.execute(action);
- else
- actionFunc = function () events.feedkeys(action, extra.noremap, true);
- }
- extra.matchingUrls = buffer;
- mappings.addUserMap(
- [modes.NORMAL],
- [cmd],
- "Local mapping for " + buffer,
- actionFunc,
- extra
- );
- }
- );
- }
- let (dl = function () AnkPixiv.downloadCurrentImage())
- addLocalMappings(
- /^http:\/\/www\.pixiv\.net\/member_illust\.php\?mode=medium\&illust_id=/,
- [
- ['z', function () content.document.changeImageSize(), {}],
- ['<Leader>m', 'f\u4f5c\u8005\u3092\u975e\u516c\u958b', {noremap: true}],
- ['<Leader>i', 'f\u7d75\u3092\u516c\u958b', {noremap: true}],
- [
- 'p',
- function (count){
- if (count > 1)
- AnkPixiv.rate(count);
- else
- dl();
- },
- {count: true}
- ],
- ['>', 'f>'],
- ['<', 'f<'],
- ]
- );
- addLocalMappings(
- /^(http:\/\/(es|www).nicovideo.jp\/watch|http:\/\/(jp|www)\.youtube\.com\/watch|http:\/\/(www\.)?vimeo\.com\/(channels\/(hd)?#)?\d+)/,
- [
- ['<C-g>', ':pageinfo S', ],
- ['i', ':pageinfo S', ],
- ['p', ':stplay', ],
- ['m', ':stmute', ],
- ['c', ':stcomment', ],
- ['z', ':stlarge', ],
- ['r', ':strepeat', ],
- ['+', ':stvolume! 10', ],
- ['-', ':stvolume! -10', ],
- ['h', ':stseek! -10', ],
- ['l', ':stseek! 10', ],
- ['k', ':stvolume! 10', ],
- ['j', ':stvolume! -10', ],
- ['s', ':stseek ', {open: true}],
- ['S', ':stseek! ', {open: true}],
- ['v', ':stvolume ', {open: true}],
- ['V', ':stvolume! ', {open: true}],
- ['o', ':strelations ', {open: true}],
- ['O', ':strelations! ', {open: true}],
- ]
- );
- addLocalMappings(
- /^https:\/\/mail\.google\.com\/mail\/#buzz/,
- [
- ['<C-r>', ':xhint o //span[contains(@class,"Fu aB Fv")]/parent::*/span[last()]']
- ]
- );
- addLocalMappings(
- /^http:\/\/www\.tumblr\.com\/(dashboard|tumblelog|show)/,
- [
- //['f', ':xh t //*[@class="quote_source"]//a[not(@class="tumblr_blog")]|//*[@class="caption"]//a[not(@class="tumblr_blog")]<CR>']
- ]
- );
- })();
Add Comment
Please, Sign In to add comment