// ==UserScript== // @name Seach All Free Image 【一键搜免费商用图】 // @namespace http://tampermonkey.net/ // @version 2.5 // @description for Designer // @author pealpool // @match https://www.google.com/search?* // @match https://www.google.com.*/search?* // @match https://*.bing.com/images/search?* // @require https://cdn.staticfile.org/jquery/3.3.1/jquery.min.js // @run-at document-end // @grant none // @downloadURL none // ==/UserScript== //todo //keyword = run //https://www.iconfont.cn/search/index?searchType=icon&q=run //https://www.flaticon.com/search?word=run //https://www.easyicon.net/iconsearch/run //https://www.iconshock.com/run-icons/ //https://icons8.com/icons/set/run (function() { 'use strict'; var divStr_1 = "
More
Png
Ico
"; var jh = false;//聚合标记 var jhsum = 0;//聚合统计 var eReg = /\s(\(site:).*/; var Reggoogle = /https\:\/\/www\.google\.com.*(\/search?).*(tbm\=isch)/; if(window.location.href.substring(0,30) == "https://www.google.com/search?" || window.location.href.substring(0,33) == "https://www.google.com.hk/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; color:#757575; } .mybtnWoW:hover{ box-shadow: 0 1px 6px 0 rgba(32,33,36,0.28); border-color: rgba(223,225,229,0); } #myPNG{ margin-left:180px; } #myICO{ margin-left:260px; } .mybtnRight{ float:left; width:80px; height:20px; margin-left:76px; margin-top:-32px; } .myinput{ float:left; width:125px; 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; } .myhot{ color:#EA4335; } .lll{ width:1px; height:35px; background-color:#dfe1e5; float:left; margin-top:-40px; margin-left:165px; } .myckPNG{ margin-left:179px; } .myckICO{ margin-left:259px; } .mylk{ border-radius: 24px; border: 1px solid #dfe1e5; background: #fff; z-index: 70; box-shadow: 0 1px 6px 0 rgba(32,33,36,0.28); position:absolute; padding:15px; width: 120px; margin-top:9px; } `); $("#sbtc").after(divStr_1 + "bing' type='checkbox' value='' checked='checked'/>bing" + divStr_2); $('.gLFyf.gsfi').attr('value',$('.gLFyf.gsfi').val().replace(eReg,'')); }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); } #myPNG{ margin-left:180px; } #myICO{ margin-left:260px; } .myinput{ float:left; border-radius:6px; color: #3C4043; width: 125px; } .myinput:hover{ color: #000; background:#f1f1f1; } .mybtnRight{ float:left; width:80px; height:20px; margin-top:-33px; margin-left:75px; } .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; } .myhot{ color:#de3700; } .lll{ width:1px; height:35px; background-color:#d8d8d8; float:left; margin-top:-42px; margin-left:165px; } .myckPNG{ margin-left:179px; } .myckICO{ margin-left:259px; } .mylk{ border-radius:6px; border: 1px solid #dfe1e5; background: #fff; z-index: 70; box-shadow: 2px 5px 6px rgba(32, 33, 36, 0.28); position:absolute; padding:10px; width: 125px; margin-top:5px; } `); $("#b_header").after(divStr_1 + "google' type='checkbox' value='' checked='checked'/>google" + divStr_2); $('#sb_form_q').attr('value',$('#sb_form_q').val().replace(eReg,'')); } 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 '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 '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 '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; case 'freepik': openNewWindow("https://www.freepik.com/search?query="+ keyword + '&selection=1&sort=popular'); break; case 'foter': openNewWindow("https://foter.com/search/instant/?q="+ keyword); break; case 'hippopx': openNewWindow("https://www.hippopx.com/zh/search?q="+ keyword); break; case 'colorhub': openNewWindow("https://colorhub.me/search?tag="+ keyword); break; case 'pxhere': openNewWindow("https://pxhere.com/photos?q="+ keyword); break; } } function juhe(objkeyword,objbuttom){ var w = new Array(); var i = 0; $('.myckJPG .myinput input').each(function(){ if($(this).prop('checked')==true){ i++; switch($(this).prop('name')){ case 'pixabay': var selectWord = "pixabay.com"; break; case 'pexels': selectWord = "www.pexels.com"; break; case 'freeimages': selectWord = "cn.freeimages.com"; break; case 'unsplash': selectWord = "unsplash.com"; break; case 'stocksnap': selectWord = "stocksnap.io"; break; case 'picjumbo': selectWord = "picjumbo.com"; break; case 'visualhunt': selectWord = "visualhunt.com"; break; case 'everypixel': selectWord = "www.everypixel.com"; break; case 'gratisography': selectWord = "gratisography.com"; break; case 'lifeofpix': selectWord = "www.lifeofpix.com"; break; case 'shopify': selectWord = "burst.shopify.com"; break; case 'google': selectWord = "www.google.com"; break; case 'bing': selectWord = "cn.bing.com"; break; case 'chamber': selectWord = "www.chamberofcommerce.org"; break; case 'freemagebank': selectWord = "www.freemagebank.com"; break; case 'designerspics': selectWord = "www.designerspics.com"; break; case 'freepik': selectWord = "www.freepik.com"; break; case 'foter': selectWord = "foter.com"; break; case 'hippopx': selectWord = "www.hippopx.com"; break; case 'colorhub': selectWord = "colorhub.me"; break; case 'pxhere': selectWord = "pxhere.com"; break; } w[i] = selectWord; } }); //清除site w[0] = objkeyword.val().replace(eReg,''); switch(i){ case 1: objkeyword.attr('value',w[0] + ' (site:'+ w[1] +')'); break; case 2: objkeyword.attr('value',w[0] + ' (site:'+ w[1] +' OR site:'+ w[2] +')'); break; case 3: objkeyword.attr('value',w[0] + ' (site:'+ w[1] +' OR site:'+ w[2] +' OR site:'+ w[3] +')'); break; } //$('#sb_form_go')[0].click(); //$('.Tg7LZd')[0].click(); objbuttom[0].click(); } function openNewWindow(webstr) { let a = $("baidu").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?" || window.location.href.substring(0,33) == "https://www.google.com.hk/search?"){ var keyw = $('.gLFyf.gsfi'); var objbuttom = $('.Tg7LZd'); if(keyw != ''){ if(jh == true){ juhe(keyw,objbuttom); }else{ $('.myckJPG .myinput input').each(function(){ if($(this).prop('checked')==true){ mySelect($(this).prop('name'),keyw.val()); } }); } } }else if(window.location.href.substring(0,34) == "https://cn.bing.com/images/search?"){ keyw = $('#sb_form_q'); objbuttom = $('#sb_form_go'); if(keyw != ''){ if(jh == true){ juhe(keyw,objbuttom); }else{ $('.myckJPG .myinput input').each(function(){ if($(this).prop('checked')==true){ mySelect($(this).prop('name'),keyw.val()); } }); } } } }); $("#myJPG").hoverDelay({ hoverDuring:500, outDuring:500, hoverEvent: function(){ $('.myckJPG').css('display','inline'); $('.myckPNG').css('display','none'); $('.myckICO').css('display','none'); }, outEvent: function(){ } }); $("#myPNG").hoverDelay({ hoverDuring:500, outDuring:500, hoverEvent: function(){ $('.myckPNG').css('display','inline'); $('.myckJPG').css('display','none'); $('.myckICO').css('display','none'); }, outEvent: function(){ } }); $("#myICO").hoverDelay({ hoverDuring:500, outDuring:500, hoverEvent: function(){ $('.myckICO').css('display','inline'); $('.myckPNG').css('display','none'); $('.myckJPG').css('display','none'); }, outEvent: function(){ } }); $('body').click(function(){ $('.myckJPG').css('display','none'); $('.myckPNG').css('display','none'); $('.myckICO').css('display','none'); }); $('body').on('click','.myckJPG',function(){ return false;//JS阻止事件冒泡,及不触发外面click事件 }); $('body').on('click','.myckPNG',function(){ return false;//JS阻止事件冒泡,及不触发外面click事件 }); $('body').on('click','.myckICO',function(){ return false;//JS阻止事件冒泡,及不触发外面click事件 }); $('body').on('click','.myinput input',function(){ return false;//JS阻止事件冒泡,及不触发外面click事件 }); $('body').on('click','.myckJPG .myinput',function(){ if($(this).children('input').prop('checked')==true){ $(this).children('input').prop('checked',false); jhsum--; if(jhsum<0){ jhsum = 0; } }else{ if(jh == true){ if(jhsum<3){ $(this).children('input').prop('checked',true); jhsum++; } }else{ $(this).children('input').prop('checked',true); } } }); $('.myckJPG .myinput input').hover(function(){ if($(this).prop('checked')==true){ $(this).prop('checked',false); jhsum--; if(jhsum<0){ jhsum = 0; } }else{ if(jh == true){ if(jhsum<3){ $(this).prop('checked',true); jhsum++; } }else{ $(this).prop('checked',true); } } console.log(jhsum); },function(){ }); $('body').on('click','.mybtnRight',function(){ if($(this).find('input').prop('checked')==true){ jh = true; jhsum = 3; $('.myckJPG .myinput input').prop('checked',false); $('input[name="everypixel"]').prop('checked',true); $('input[name="freepik"]').prop('checked',true); $('input[name="pixabay"]').prop('checked',true); }else{ jh = false; } }); })();