Better Yandex Image Search

Add fullscreen image scaling and hit down button to start quick slideshow.

  1. // ==UserScript==
  2. // @name Better Yandex Image Search
  3. // @namespace https://github.com/derac/Better-Yandex-Image-Search
  4. // @version 0.1
  5. // @description Add fullscreen image scaling and hit down button to start quick slideshow.
  6. // @author derac
  7. // @match *yandex.com/images/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13. let playing = false; let TIMEOUT_MS = 1500; let timeout;
  14. let style_sheet = document.createElement('style');
  15. document.getElementsByTagName("html").item(0).appendChild(style_sheet)
  16. style_sheet.innerHTML = `.MMImageContainer {width:100% !important;height:100% !important}
  17. .MMImage-Preview {width:100% !important;height:100% !important;background:black !important;}`
  18. let click_next = () => { document.getElementsByClassName("CircleButton_type_next").item(0).click(); }
  19. document.onkeydown = (e)=>{
  20. if (e.keyCode==38) { playing=!playing;
  21. if (playing) { timeout = setInterval(click_next, TIMEOUT_MS); }
  22. else { window.clearInterval(timeout); } } }
  23. })();