Greasy Fork

Greasy Fork is available in English.

Seach All ImageWeb

Easy for Designer

当前为 2019-06-11 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Seach All ImageWeb
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description   Easy for Designer
// @author       You
// @match        https://www.google.com/search?*
// @match        https://cn.bing.com/images/search?*
// @require      https://cdn.staticfile.org/jquery/3.3.1/jquery.min.js
// @run-at       document-end
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var divStr_1 = "<div class=myK><div class=mybtnWoW id=myJPG><span>M</span><span>o</span><span>r</span><span>e</span></div><div class=myck><div class=mysk01></div><div class=mysk02></div><div class=mysk03></div><div class=mysk04></div><div class=mysk05></div><div class=myxk><form action=''><label class='myinput'><input name='";
    var divStr_2 = "</label><label class=myinput><input name=chamber type=checkbox value='' checked=checked>chamber</label><label class=myinput><input name=designerspics type=checkbox value='' checked=checked>designers...</label><label class=myinput><input name=everypixel type=checkbox value='' checked=checked>everypixel</label><label class=myinput><input name=freemagebank type=checkbox value='' checked=checked>freemage...</label><label class=myinput><input name=freeimages type=checkbox value='' checked=checked>freeimages</label><label class=myinput><input name=gratisography type=checkbox value='' checked=checked>gratisogra...</label><label class=myinput><input name=lifeofpix type=checkbox value='' checked=checked>lifeofpix</label><label class=myinput><input name=pexels type=checkbox value='' checked=checked>pexels</label><label class=myinput><input name=picjumbo type=checkbox value='' checked=checked>picjumbo</label><label class=myinput><input name=pixabay type=checkbox value='' checked=checked>pixabay</label><label class=myinput><input name=shopify type=checkbox value='' checked=checked>shopify</label><label class=myinput><input name=stocksnap type=checkbox value='' checked=checked>stocksnap</label><label class=myinput><input name=unsplash type=checkbox value='' checked=checked>unsplash</label><label class=myinput><input name=visualhunt type=checkbox value='' checked=checked>visualhunt</label></form></div></div></div>";

    if(window.location.href.substring(0,30) == "https://www.google.com/search?"){
        GMaddStyle(`
        .myK{
            margin-left:645px;
            position: absolute;
        }
        .mybtnWoW{
            height:44px;
            width:70px;
            border-radius: 24px;
            border: 1px solid #dfe1e5;
            text-align:center;
            line-height:45px;
            cursor:pointer;
            float:left;
            margin-top:-46px;
            background:#fff;
            font-size:16px;
            font-weight: bold;
            position: relative;
            z-index:500;
        }
        .mybtnWoW:hover{
            box-shadow: 0 1px 6px 0 rgba(32,33,36,0.28);
            border-color: rgba(223,225,229,0);
        }
        .myck{
            position: absolute;
            display:none;
        }
        .mysk01{
            position: relative;
            width:58px;
            height:30px;
            border-bottom: 1px solid #dfe1e5;
            border-right: 1px solid #dfe1e5;
            border-radius: 0 0 29px 0;
            margin-top:-24px;
            margin-left:20px;
            z-index:100;
        }
        .mysk02{
            border-radius: 0 30px 0 0;
            border-top: 1px solid #dfe1e5;
            border-right: 1px solid #dfe1e5;
            width:30px;
            height:30px;
            margin-top:-31px;
            margin-left:79px;
            background:#fff;
            z-index:90;
            box-shadow: 4px 5px 4px rgba(32, 33, 36, 0.14);
        }
        .mysk03{
            border-radius:24px 0 0 0;
            border-top: 1px solid #dfe1e5;
            border-left: 1px solid #dfe1e5;
            border-right: 1px solid #dfe1e5;
            width:108px;
            height:24px;
            background:#fff;
            margin-top:-1px;
            z-index:80;
            box-shadow: 2px 5px 6px rgba(32, 33, 36, 0.28);
        }
        .mysk04{
            width:85px;
            height:1px;
            background: #fff;
            top: 6px;
            left:24px;
            position: absolute;
            z-index:75;
        }
        .mysk05{
            border-radius:0 0 24px 24px;
            border-left: 1px solid #dfe1e5;
            border-right: 1px solid #dfe1e5;
            border-bottom: 1px solid #dfe1e5;
            width:108px;
            height:285px;
            background:#fff;
            z-index:70;
            box-shadow: 2px 5px 6px rgba(32, 33, 36, 0.28);
        }
        .myxk{
            width:90px;
            height:180px;
            z-index:110;
            top: 17px;
            left:10px;
            position: absolute;
        }
        .myinput{
            float:left;
            width:90px;
            border-radius:6px;
            color: #3C4043;
        }
        .myinput:hover{
            color: #000;
            background:#eee;
        }
        .mybtnWoW span:nth-child(1){
            color:#4285F4;
        }
        .mybtnWoW span:nth-child(2){
            color:#EA4335;
        }
        .mybtnWoW span:nth-child(3){
            color:#FBBD07;
        }
        .mybtnWoW span:nth-child(4){
            color:#34A853;
        }
        `);
        $("#sbtc").after(divStr_1 + "bing' type='checkbox' value='' checked='checked'/>bing" + divStr_2);
    }else if(window.location.href.substring(0,34) == "https://cn.bing.com/images/search?"){
        GMaddStyle(`
.myK{
    margin-left:765px;
    margin-top:-60px;
    position: absolute;
}
.mybtnWoW{
    height:40px;
    width:70px;
    border-radius: 6px;
    border: 0px solid #eee;
    text-align:center;
    line-height:43px;
    cursor:pointer;
    float:left;
    margin-top:-46px;
    background:#fff;
    font-size:16px;
    font-weight: bold;
    position: relative;
    z-index:500;
    box-shadow: 0 0 0 1px rgba(0,0,0,.1), 0 2px 4px 0 rgba(0,0,0,.16);
}
.mybtnWoW:hover{
    box-shadow: 0 0 0 1px rgba(0,0,0,.1), 0 2px 4px 1px rgba(0,0,0,.18);
}
.myck{
    position: absolute;
    display:none;
    z-index:20;
}
.mysk01{
    position: relative;
    width:58px;
    height:30px;
    border-bottom: 1px solid #dfe1e5;
    border-right: 1px solid #dfe1e5;
    border-radius: 0 0 14px 0;
    margin-top:-28px;
    margin-left:20px;
    z-index:100;
}
.mysk02{
    border-radius: 0 30px 0 0;
    border-top: 1px solid #dfe1e5;
    border-right: 1px solid #dfe1e5;
    width:30px;
    height:30px;
    margin-top:-31px;
    margin-left:79px;
    background:#fff;
    z-index:90;
    box-shadow: 4px 5px 4px rgba(32, 33, 36, 0.14);
}
.mysk03{
    border-radius:6px 0 0 0;
    border-top: 1px solid #dfe1e5;
    border-left: 1px solid #dfe1e5;
    border-right: 1px solid #dfe1e5;
    width:108px;
    height:6px;
    background:#fff;
    margin-top:-1px;
    z-index:80;
    box-shadow: 2px 5px 6px rgba(32, 33, 36, 0.28);
}
.mysk04{
    width:85px;
    height:1px;
    background: #fff;
    top: 2px;
    left:24px;
    position: absolute;
    z-index:75;
}
.mysk05{
    border-radius:0 0 6px 6px;
    border-left: 1px solid #dfe1e5;
    border-right: 1px solid #dfe1e5;
    border-bottom: 1px solid #dfe1e5;
    width:108px;
    height:350px;
    background:#fff;
    z-index:70;
    box-shadow: 2px 5px 6px rgba(32, 33, 36, 0.28);
}
.myxk{
    width:90px;
    height:180px;
    z-index:110;
    top: 17px;
    left:10px;
    position: absolute;
}
.myinput{
    float:left;
    width:90px;
    border-radius:6px;
    color: #3C4043;
}
.myinput:hover{
    color: #000;
    background:#f1f1f1;
}
.mybtnWoW span:nth-child(1){
    color:#00809d;
}
.mybtnWoW span:nth-child(2){
    color:#666666;
}
.mybtnWoW span:nth-child(3){
    color:#de3700;
}
.mybtnWoW span:nth-child(4){
    color:#666666;
}
        `);
        $("#b_header").after(divStr_1 + "google' type='checkbox' value='' checked='checked'/>google" + divStr_2);
    }
    function GMaddStyle(cssText){
        let a = document.createElement('style');
        a.textContent = cssText;
        let doc = document.head || document.documentElement;
        doc.appendChild(a);
    }
    function mySelect(name,keyword){
        switch(name){
            case 'pixabay':
                openNewWindow("https://pixabay.com/images/search/"+ keyword +"/");
                break;
            case 'pexels':
                openNewWindow("https://www.pexels.com/search/"+ keyword +"/");
                break;
            case 'freeimages':
                openNewWindow("https://cn.freeimages.com/search/"+ keyword);
                break;
            case 'unsplash':
                openNewWindow("https://unsplash.com/search/photos/"+ keyword);
                break;
            case 'stocksnap':
                openNewWindow("https://stocksnap.io/search/"+ keyword);
                break;
            case 'picjumbo':
                openNewWindow("https://picjumbo.com/?s="+ keyword);
                break;
            case 'visualhunt':
                openNewWindow("https://visualhunt.com/search/instant/?q="+ keyword);
                break;
            case 'everypixel':
                openNewWindow("https://www.everypixel.com/search?q="+ keyword +"&stocks_type=free&meaning=&media_type=0&page=1");
                break;
            case 'gratisography':
                openNewWindow("https://gratisography.com/?s="+ keyword);
                break;
            case 'lifeofpix':
                openNewWindow("https://www.lifeofpix.com/search/"+ keyword + "?");
                break;
            case 'shopify':
                openNewWindow("https://burst.shopify.com/photos/search?&q="+ keyword);
                break;
            case 'google':
                openNewWindow("https://www.google.com/search?q="+ keyword + "&tbm=isch");
                break;
            case 'bing':
                openNewWindow("https://cn.bing.com/images/search?q="+ keyword);
                break;
            case 'chamber':
                openNewWindow("https://www.chamberofcommerce.org/findaphoto/search?q="+ keyword);
                break;
            case 'freemagebank':
                openNewWindow("http://www.freemagebank.com/?s="+ keyword);
                break;
            case 'designerspics':
                openNewWindow("http://www.designerspics.com/?s="+ keyword);
                break;
        }
    }
    function openNewWindow(webstr) {
        let a = $("<a href='"+ webstr +"' target='_blank'>baidu</a>").get(0);
        let e = document.createEvent('MouseEvents');
        e.initEvent( 'click', true, true );
        a.dispatchEvent(e);
    }
    $.fn.hoverDelay = function(options){
        var defaults = {
            hoverDuring:200,
            outDuring:200,
            hoverEvent:function(){
                $.noop();
            },
            outEvent:function(){
                $.noop();
            }
        };
        var sets = $.extend(defaults,options || {});
        var hoverTimer,outTimer;
        return $(this).each(function(){
            $(this).hover(function(){
                clearTimeout(outTimer);
                hoverTimer = setTimeout(sets.hoverEvent,sets.hoverDuring);
            },function(){
                clearTimeout(hoverTimer);
                outTimer = setTimeout(sets.outEvent,sets.outDuring);
            });
        });
    }
    $('body').on('click','#myJPG',function(){
        if(window.location.href.substring(0,30) == "https://www.google.com/search?"){
            var keyw = $('.gLFyf.gsfi').val();
        }else if(window.location.href.substring(0,34) == "https://cn.bing.com/images/search?"){
            keyw = $('#sb_form_q').val();
        }else{
            return;
        }
        $('.myinput input').each(function(){
            if($(this).prop('checked')==true){
                mySelect($(this).prop('name'),keyw);
            }
        });
    });
    $("#myJPG").hoverDelay({
        hoverDuring:500,
        outDuring:500,
        hoverEvent: function(){
            $('.myck').css('display','inline');
        },
        outEvent: function(){
        }
    });
    $('body').click(function(){
        $('.myck').css('display','none');
    });
    $('body').on('click','.myck',function(){
        return false;//JS阻止事件冒泡,及不触发外面click事件
    });
    $('body').on('click','.myinput',function(){
        if($(this).children('input').prop('checked')==true){
            $(this).children('input').prop('checked',false);
        }else{
            $(this).children('input').prop('checked',true);
        }
    });
    $('.myinput input').hover(function(){
            if($(this).prop('checked')==true){
                $(this).prop('checked',false);
            }else{
                $(this).prop('checked',true);
            }
        },function(){
    });
})();