Google Image Direct Link Patch

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

2022-06-30 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला 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        Google Image Direct Link Patch
// @namespace   GoogleImageDirectLinkPatch
// @version     1.2.8
// @license     AGPL v3
// @author      jcunews
// @description Readd Google Image search result entry's image bottom panel as bottom-right image size information and link it to the direct image resource.
// @website     https://greasyfork.org/en/users/85671-jcunews
// @include     /^https:\/\/www\.google\.(co\.)?[a-z]{2,3}\/search.*tbm=isch/
// @include     /^https:\/\/www\.google\.com(\.[a-z]{2,3})?\/search.*tbm=isch/
// @grant       none
// @run-at      document-start
// ==/UserScript==

((idat, ap, xo) => {
  function processEntries() {
    document.querySelectorAll("div.isv-r[data-ow]:not(.paneled_gidlp)").forEach((e, a, id, d) => {
      e.classList.add("paneled_gidlp");
      e.insertBefore(a = document.createElement("A"), e.firstChild).className = "panel_gidlp";
      a.dataset.ow = e.dataset.ow;
      a.dataset.oh = e.dataset.oh;
      a.rel = "nofollow noopener noreferrer";
      id = e.dataset.id;
      if (!idat.some((d, i) => {
        if (d[7] === id) {
          a.href = d[1][3][0];
          idat.splice(i, 1);
          return true
        }
      })) a.href = 'javascript:void("Image URL is not found")';
    })
  }

  ap = Array.prototype.push;
  Array.prototype.push = function(v) {
    if (!idat && v.key && v.hash && v.sideChannel && v.data && v.data[31]) idat = v.data[31][0][12][2].slice();
    return ap.apply(this, arguments);
  };

  xo = XMLHttpRequest.prototype.open;
  XMLHttpRequest.prototype.open = function(mtd, url) {
    if (/\/_\/VisualFrontendUi\/data\/batchexecute/.test(url)) {
      this.addEventListener("load", (a, z) => {
        if (a = this.responseText.split("\n")[3]) try {
          Array.prototype.push.apply(idat, a = JSON.parse(JSON.parse(a)[0][2])[31][0][12][2]);
console.log(idat);
        } catch(z) {}
      })
    }
    return xo.apply(this, arguments);
  };

  addEventListener("load", (a, mo, ht) => {
    if ((a = document.querySelectorAll(".islrc,.islrh")).length) {
      document.documentElement.appendChild(b = document.createElement("STYLE")).id = "css_gidpl";
      b.innerHTML = `
.isv-r.paneled_gidlp>.panel_gidlp {
 position: absolute; z-index: 1; right: 0; bottom: 3.1em; font-size: 10pt; line-height: normal;
}
.isv-r.paneled_gidlp>.panel_gidlp:before {
  border-radius: .2em; padding: 0 .3ex; background-color: #444; color: #fff; content: attr(data-ow) "x" attr(data-oh);
}`;
      mo = new MutationObserver(recs => {
        clearTimeout(ht);
        ht = setTimeout(processEntries, 500);
      });
      a.forEach(e => mo.observe(e, {childList: true}));
      processEntries();
    }
  });
})();