Advertisement
Guest User

vfl.ru(2)

a guest
Jan 18th, 2021
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name     vfl.ru ctrl+arrows
  3. // @version  1
  4. // @grant    none
  5. // @include  http*://vfl.ru/fotos/tag/*.html
  6. // @include  http*://vfl.ru/fotos/camera/*.html
  7. // ==/UserScript==
  8.  
  9. let currentPage = 1;
  10. let locFull = document.location.href;
  11. let loc = locFull.substr(0, locFull.indexOf("_"));
  12. let idx = locFull.indexOf("_");
  13. if(idx >= 0)
  14. {
  15.   currentPage = Number(locFull.substr(0, locFull.length - 5).substr(idx + 1));
  16. }
  17. else
  18. {
  19.   loc = locFull.substr(0, locFull.indexOf(".html"));
  20. }
  21. document.addEventListener("keydown",
  22.     function(ev)
  23.   {
  24.     if(ev.ctrlKey && (ev.keyCode == 37 || ev.keyCode == 39))
  25.     {
  26.       if(ev.keyCode == 37 && currentPage > 1)
  27.         currentPage--;
  28.       if(ev.keyCode == 39)
  29.         currentPage++;
  30.       document.location=loc+"_"+currentPage+".html";
  31.     }
  32.     }
  33. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement