Yandex Image Search Direct Link Patch

Make Yandex Image search result entry's image bottom panel as bottom-right image size information and link it to the direct image resource.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Yandex Image Search Direct Link Patch
// @namespace    https://greasyfork.org/en/users/85671-jcunews
// @version      1.0.4
// @license      AGPL v3
// @author       jcunews
// @description  Make Yandex Image search result entry's image bottom panel as bottom-right image size information and link it to the direct image resource.
// @match        https://yandex.com/images/search*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(() => {
  function updItem(node, a, b, c) {
    if (a = node.querySelector(".serp-item__plates")) {
      (b = document.querySelector("A")).className = a.className;
      b.href = decodeURIComponent((c = node.querySelector(".serp-item__link")).href.match(/img_url=([^&#]+)/)[1]).replace(/^http:/, "https:");
      b.rel = "noopener noreferrer";
      b.innerHTML = a.innerHTML;
      b.firstChild.style.cssText = "display:block";
      c.insertAdjacentHTML("afterend", b.outerHTML);
      a.style.display = "none"
    }
  }
  (new MutationObserver(recs => {
    recs.forEach(rec => {
      rec.addedNodes.forEach(node => {
        if (node.matches) {
          if (node.matches(".serp-item")) {
            updItem(node)
          } else if (node.matches(".serp-controller__content")) node.querySelectorAll(".serp-item").forEach(updItem)
        }
      })
    })
  })).observe(document, {childList: true, subtree: true})
})()