Greasy Fork

Greasy Fork is available in English.

Seach All ImageWeb

Easy for myself

目前为 2019-05-07 提交的版本,查看 最新版本

// ==UserScript==
// @name         Seach All ImageWeb
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  Easy for myself
// @author       You
// @match        https://www.google.com/search?*
// @require      https://cdn.staticfile.org/jquery/3.3.1/jquery.min.js
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var styleStr = `
.mybtnWoW{
    height:44px;
    width:64px;
    border-radius: 24px;
    border: 1px solid #dfe1e5;
    text-align:center;
    line-height:44px;
    cursor:pointer;
    float:left;
    margin-top:-46px;
    background:#fff;
    position: relative;
    font-size:15px;
    font-weight: bold;
}
.mybtnWoW:hover{
    box-shadow: 0 1px 6px 0 rgba(32,33,36,0.28);
    border-color: rgba(223,225,229,0);
}
#myJPG{
    left: 650px;
}
#myPNG{
    left: 720px;
}
#myOther{
    left: 790px;
}
    `;
    var style = document.createElement('style');
    style.type = 'text/css';
    style.innerHTML = styleStr;
    document.getElementsByTagName('HEAD').item(0).appendChild(style);

    //$("#sbtc").after("<div class='mybtnWoW' id='myJPG'>JPG</div><div class='mybtnWoW' id='myPNG'>PNG</div><div class='mybtnWoW' id='myOther'>Other</div>");
    //$("#sbtc").after("<div class='mybtnWoW' id='myJPG'>More</div>");
    $("#sbtc").after("<div class='mybtnWoW' id='myJPG'><span style='color:#4285F4'>M</span><span style='color:#EA4335'>o</span><span style='color:#FBBD07'>r</span><span style='color:#34A853'>e</span></div>");
    $('body').on('click','#myJPG',function(){
        var keyword = $('.gLFyf.gsfi').val();
        //console.log(keyword);
        openNewWindow("https://pixabay.com/images/search/"+ keyword +"/");
        openNewWindow("https://www.pexels.com/search/"+ keyword +"/");
        openNewWindow("https://cn.freeimages.com/search/"+ keyword);
        openNewWindow("https://unsplash.com/search/photos/"+ keyword);
        openNewWindow("https://stocksnap.io/search/"+ keyword);
        openNewWindow("https://picjumbo.com/?s="+ keyword);
        openNewWindow("https://visualhunt.com/search/instant/?q="+ keyword);
        openNewWindow("https://www.everypixel.com/search?q="+ keyword +"&stocks_type=free&meaning=&media_type=0&page=1");
        openNewWindow("https://gratisography.com/?s="+ keyword);
        openNewWindow("https://www.lifeofpix.com/search/"+ keyword + "?");
    });
    function openNewWindow(webstr) {
        //var a = $('a')[0];
        let a = $("<a href='"+ webstr +"' target='_blank'>baidu</a>").get(0);
        let e = document.createEvent('MouseEvents');
        e.initEvent( 'click', true, true );
        a.dispatchEvent(e);
    }
})();