-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathBetter Yandex Image Search.user.js
25 lines (24 loc) · 1.29 KB
/
Better Yandex Image Search.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// ==UserScript==
// @name Better Yandex Image Search
// @namespace https://github.com/derac/Better-Yandex-Image-Search
// @version 0.1
// @description Add fullscreen image scaling and hit down button to start quick slideshow.
// @author derac
// @match *://*yandex.com/images/*
// @grant none
// @downloadURL https://update.greasyfork.org/scripts/412102/Better%20Yandex%20Image%20Search.user.js
// @updateURL https://update.greasyfork.org/scripts/412102/Better%20Yandex%20Image%20Search.meta.js
// ==/UserScript==
(function() {
'use strict';
let playing = false; let TIMEOUT_MS = 1500; let timeout;
let style_sheet = document.createElement('style');
document.getElementsByTagName("html").item(0).appendChild(style_sheet)
style_sheet.innerHTML = `.MMImageContainer {width:100% !important;height:100% !important}
.MMImage-Preview {width:100% !important;height:100% !important;background:black !important;}`
let click_next = () => { document.getElementsByClassName("CircleButton_type_next").item(0).click(); }
document.onkeydown = (e)=>{
if (e.keyCode==38) { playing=!playing;
if (playing) { timeout = setInterval(click_next, TIMEOUT_MS); }
else { window.clearInterval(timeout); } } }
})();