Greasy Fork镜像 is available in English.

Google Image Direct Link Patch

Make clicking on image bottom panel go directly to the image in a Google Image search result.

目前为 2017-01-13 提交的版本。查看 最新版本

// ==UserScript==
// @name        Google Image Direct Link Patch
// @namespace   GoogleImageDirectLinkPatch
// @description Make clicking on image bottom panel go directly to the image in a Google Image search result.
// @author      jcunews
// @include     /^https:\/\/www.google.(co.)?[a-z]{2}\/search.*tbm=isch/
// @include     /^https:\/\/www.google.com([a-z]{2})?\/search.*tbm=isch/
// @version     1
// @grant       none
// ==/UserScript==

document.addEventListener("click", function(ev) {
  var ele = ev.target.parentNode, url;
  if (ele && ele.parentNode) {
    ele = ele.parentNode;
    if (ele.classList.contains("_aOd") && ele.parentNode) {
      ele = ele.parentNode;
      if (ele) {
        url = ele.search.match(/imgurl=([^&]+)/);
        if (url) {
          url = decodeURIComponent(url[1]);
          if (ev.stopImmediatePropagation) {
            ev.stopImmediatePropagation();
          }
          if (ev.stopPropagation) {
            ev.stopPropagation();
          }
          ev.preventDefault();
          if (ev.shiftKey) {
            window.open(url);
          } else {
            window.location.href = url;
          }
        }
      }
    }
  }
}, true);
长期地址
遇到问题?请前往 GitHub 提 Issues,或加Q群1031348184

赞助商

Fishcpy

广告

Rainyun

注册一下就行

Rainyun

一年攒够 12 元