Google Play app details images scroll arrow keys

assign horizontal arrow keys to scroll app image previews in page and overlay

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name        Google Play app details images scroll arrow keys
// @namespace   Violentmonkey Scripts
// @match       https://play.google.com/store/apps/details*
// @grant       none
// @version     1.3
// @author      You
// @description assign horizontal arrow keys to scroll app image previews in page and overlay
// ==/UserScript==


window.addEventListener("keydown", function (event) {
  if (event.defaultPrevented) {
    return; // Do nothing if the event was already processed
  }

  switch (event.key) {
    case "Left": // IE/Edge specific value
    case "ArrowLeft":
		  var left = document.querySelector('[jsaction="click:E7ORLb"]');
		  if (left != null) {
			left.click()
			break;
		  }
		  var scrollleft = document.querySelector('[jsname="PjUZJf"]')
		  triggerMouseEvent(scrollleft, "mousedown"); triggerMouseEvent(scrollleft, "mouseup");
      break;
    case "Right": // IE/Edge specific value
    case "ArrowRight":
   		  var right = document.querySelector('[jsaction="click:tJiF1e"]');
   		  if (right != null) {
			right.click()
			break;
		  }

		  var scrollright = document.querySelector('[jsname="kZCROc"]')
		  triggerMouseEvent(scrollright, "mousedown"); triggerMouseEvent(scrollright, "mouseup"); 
      break;
    default:
      return; // Quit when this doesn't handle the key event.
  }

  // Cancel the default action to avoid it being handled twice
  event.preventDefault();
}, true);

function triggerMouseEvent (node, eventType) {
    var clickEvent = document.createEvent ('MouseEvents');
    clickEvent.initEvent (eventType, true, true);
    node.dispatchEvent (clickEvent);
}