Greasy Fork is available in English.
Easy for myself
当前为
// ==UserScript==
// @name Seach All ImageWeb
// @namespace http://tampermonkey.net/
// @version 0.4
// @description Easy for myself
// @author You
// @match https://www.google.com/search?*
// @require https://cdn.staticfile.org/jquery/3.3.1/jquery.min.js
// @run-at document-end
// @grant none
// ==/UserScript==
(function() {
'use strict';
var styleStr = `
.myK{
margin-left:645px;
}
.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;
}
.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;
}
.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:180px;
background:#fff;
z-index:70;
}
.myxk{
width:90px;
height:180px;
z-index:110;
top: 17px;
left:10px;
position: absolute;
}
`;
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='myK'><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><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'></div></div></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);
}
$.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);
});
});
}
$(".mybtnWoW").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事件
});
})();