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.

目前为 2022-10-08 提交的版本。查看 最新版本

// ==UserScript==
// @name         Yandex Image Search Direct Link Patch
// @namespace    https://gf.qytechs.cn/en/users/85671-jcunews
// @version      1.0.1
// @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==

(() => {
  (new MutationObserver(recs => {
    recs.forEach(rec => {
      rec.addedNodes.forEach((node, a, b, c) => {
        if (node.matches && node.matches(".serp-item") && (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.innerHTML = a.innerHTML;
          b.firstChild.style.cssText = "display:block";
          c.insertAdjacentHTML("afterend", b.outerHTML);
          a.style.display = "none"
        }
      })
    })
  })).observe(document, {childList: true, subtree: true})
})()

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址