Guest User

Untitled

a guest
May 20th, 2018
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1.  
  2. (function () {
  3.  
  4. function addLocalMappings(buffer, maps) {
  5. maps.forEach(
  6. function (map) {
  7. let [cmd, action, extra] = map;
  8. let actionFunc = action;
  9. extra || (extra = {});
  10.  
  11. if (typeof action == "string") {
  12. if (action.charAt(0) == ':')
  13. actionFunc = extra.open ? function () commandline.open("", action, modes.EX)
  14. : function () liberator.execute(action);
  15. else
  16. actionFunc = function () events.feedkeys(action, extra.noremap, true);
  17. }
  18. extra.matchingUrls = buffer;
  19. mappings.addUserMap(
  20. [modes.NORMAL],
  21. [cmd],
  22. "Local mapping for " + buffer,
  23. actionFunc,
  24. extra
  25. );
  26. }
  27. );
  28. }
  29.  
  30.  
  31. let (dl = function () AnkPixiv.downloadCurrentImage())
  32. addLocalMappings(
  33. /^http:\/\/www\.pixiv\.net\/member_illust\.php\?mode=medium\&illust_id=/,
  34. [
  35. ['z', function () content.document.changeImageSize(), {}],
  36. ['<Leader>m', 'f\u4f5c\u8005\u3092\u975e\u516c\u958b', {noremap: true}],
  37. ['<Leader>i', 'f\u7d75\u3092\u516c\u958b', {noremap: true}],
  38. [
  39. 'p',
  40. function (count){
  41. if (count > 1)
  42. AnkPixiv.rate(count);
  43. else
  44. dl();
  45. },
  46. {count: true}
  47. ],
  48. ['>', 'f>'],
  49. ['<', 'f<'],
  50. ]
  51. );
  52.  
  53. addLocalMappings(
  54. /^(http:\/\/(es|www).nicovideo.jp\/watch|http:\/\/(jp|www)\.youtube\.com\/watch|http:\/\/(www\.)?vimeo\.com\/(channels\/(hd)?#)?\d+)/,
  55. [
  56. ['<C-g>', ':pageinfo S', ],
  57. ['i', ':pageinfo S', ],
  58. ['p', ':stplay', ],
  59. ['m', ':stmute', ],
  60. ['c', ':stcomment', ],
  61. ['z', ':stlarge', ],
  62. ['r', ':strepeat', ],
  63. ['+', ':stvolume! 10', ],
  64. ['-', ':stvolume! -10', ],
  65. ['h', ':stseek! -10', ],
  66. ['l', ':stseek! 10', ],
  67. ['k', ':stvolume! 10', ],
  68. ['j', ':stvolume! -10', ],
  69. ['s', ':stseek ', {open: true}],
  70. ['S', ':stseek! ', {open: true}],
  71. ['v', ':stvolume ', {open: true}],
  72. ['V', ':stvolume! ', {open: true}],
  73. ['o', ':strelations ', {open: true}],
  74. ['O', ':strelations! ', {open: true}],
  75. ]
  76. );
  77.  
  78. addLocalMappings(
  79. /^https:\/\/mail\.google\.com\/mail\/#buzz/,
  80. [
  81. ['<C-r>', ':xhint o //span[contains(@class,"Fu aB Fv")]/parent::*/span[last()]']
  82. ]
  83. );
  84.  
  85. addLocalMappings(
  86. /^http:\/\/www\.tumblr\.com\/(dashboard|tumblelog|show)/,
  87. [
  88. //['f', ':xh t //*[@class="quote_source"]//a[not(@class="tumblr_blog")]|//*[@class="caption"]//a[not(@class="tumblr_blog")]<CR>']
  89. ]
  90. );
  91.  
  92. })();
Add Comment
Please, Sign In to add comment