您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Search with google image again cause fuck google lens, SHIFT + Left click to search
当前为
- // ==UserScript==
- // @name Search with google image fix
- // @namespace http://tampermonkey.net/
- // @version 1.0.1
- // @description Search with google image again cause fuck google lens, SHIFT + Left click to search
- // @author You
- // @require http://code.jquery.com/jquery-3.4.1.min.js
- // @match http://*/*
- // @match https://*/*
- // @grant none
- // ==/UserScript==
- (function() {
- function srcHasHostInformation(url) {
- var res = url.match(/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g);
- return (res !== null)
- }
- function addHostInformationIfNeeded(src) {
- if (!srcHasHostInformation(src)) {
- if (src[0] != "/") {
- src = "/" + src ;
- }
- return window.location.hostname + src;
- }
- return src;
- }
- $(document).mousedown(function(event) {
- if ($(event.target).prop("tagName").toUpperCase() == "IMG"){
- if (window.event.shiftKey ){
- var origSrc = addHostInformationIfNeeded($(event.target).attr("src"));
- console.log("orig: " + origSrc);
- var src = "https://www.google.com/searchbyimage?image_url=" + origSrc;
- window.open(src);
- }
- }
- });
- })();