Import default.js userscript from surf configuration - dotfiles - leot's dotfiles
 (HTM) hg clone https://bitbucket.org/iamleot/dotfiles
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) changeset a901a0090c17b35838f3d5285c340311675ed4b8
 (DIR) parent f54d4e2ae0cb31a5f31ae3a6c84a3c649e125b0e
 (HTM) Author: Leonardo Taccari <iamleot@gmail.com>
       Date:   Sun,  9 Jun 2019 16:35:01 
       
       Import default.js userscript from surf configuration
       
       Diffstat:
        config/vimb/config     |   2 -
        config/vimb/scripts.js |  98 ++++++++++++++++++++++++++++++++++++++++++++++++-
        2 files changed, 95 insertions(+), 5 deletions(-)
       ---
       diff -r f54d4e2ae0cb -r a901a0090c17 config/vimb/config
       --- a/config/vimb/config        Sun Jun 09 15:18:18 2019 +0200
       +++ b/config/vimb/config        Sun Jun 09 16:35:01 2019 +0200
       @@ -78,8 +78,6 @@
               au LoadCommitted *://ilmanifesto.it/* set user-agent=Googlebot-News
               au LoadCommitted *://www.haaretz.com/* set user-agent=Googlebot-News
        
       -       au LoadFinished *://bandcamp.com/* eval! userscript_bandcamp();
       -       au LoadFinished *://*.bandcamp.com/* eval! userscript_bandcamp();
               au LoadFinished *://www.ft.com/* eval! userscript_ft();
               au LoadFinished *://www.economist.com/* eval! userscript_economist();
               au LoadFinished *://github.com/* eval! userscript_github();
       diff -r f54d4e2ae0cb -r a901a0090c17 config/vimb/scripts.js
       --- a/config/vimb/scripts.js    Sun Jun 09 15:18:18 2019 +0200
       +++ b/config/vimb/scripts.js    Sun Jun 09 16:35:01 2019 +0200
       @@ -1,9 +1,101 @@
       -function userscript_bandcamp()
       -{
       +/*
       + * Fix "lazy" loaded image.
       + */
       +(function() {
       +
       +       document.querySelectorAll("img[data-thumb]").forEach(function(e) {
       +               e.src = e.getAttribute("data-thumb");
       +       });
       +
       +       document.querySelectorAll("img[data-src]").forEach(function(e) {
       +               e.src = e.getAttribute("data-src");
       +       });
       +
               document.querySelectorAll("img[data-original]").forEach(function(e) {
                       e.src = e.getAttribute("data-original");
               });
       -}
       +
       +})();
       +
       +/*
       + * Add `p' and `n' accesskey-s (previous/next via `Mod1 + p'/`Mod1 + n')
       + */
       +(function() {
       +
       +       previous_selectors = [
       +               'a[rel="prev"]',
       +               'a[aria-label="Pagina precedente"]',    // google.it
       +               'a[aria-label="Previous page"]',        // google.com
       +       ];
       +       previous_res = [
       +               /<</,
       +               /«/,
       +               /←/,
       +       ];
       +
       +       next_selectors = [
       +               'a[rel="next"]',
       +               'a[aria-label="Pagina successiva"]',    // google.it
       +               'a[aria-label="Next page"]',            // google.com
       +       ];
       +       next_res = [
       +               />>/,
       +               /»/,
       +               /→/,
       +       ];
       +
       +       has_prev = false;
       +       has_next = false;
       +
       +       if (document.querySelector('*[accesskey="p"]')) {
       +               has_prev = true;
       +       }
       +       if (document.querySelector('*[accesskey="n"]')) {
       +               has_next = true;
       +       }
       +
       +       if (!has_prev) {
       +               for (p of previous_selectors) {
       +                       if (e = document.querySelector(p)) {
       +                               e.accessKey = "p";
       +                               has_prev = true;
       +                               break;
       +                       }
       +               }
       +       }
       +       if (!has_next) {
       +               for (n of next_selectors) {
       +                       if (e = document.querySelector(n)) {
       +                               e.accessKey = "n";
       +                               has_next = true;
       +                               break;
       +                       }
       +               }
       +       }
       +
       +       for (i = document.links.length - 1; !has_prev && i >= 0; i--) {
       +               for (p of previous_res) {
       +                       if (document.links[i].text &&
       +                           document.links[i].text.match(p)) {
       +                               document.links[i].accessKey = "p";
       +                               has_prev = true;
       +                               break;
       +                       }
       +               }
       +       }
       +       for (i = document.links.length - 1; !has_next && i >= 0; i--) {
       +               for (n of next_res) {
       +                       if (document.links[i].text &&
       +                           document.links[i].text.match(n)) {
       +                               document.links[i].accessKey = "n";
       +                               has_next = true;
       +                               break;
       +                       }
       +               }
       +       }
       +
       +})();
       +
        
        function userscript_ft()
        {