|
|

楼主 |
发表于 2023-12-13 01:08:47
|
显示全部楼层
// ==UserScript==! E4 P/ Y/ G' A* r; k
// @name Google on baidu
& h% t {; \: N+ S% U// @namespace http://tampermonkey.net/6 k( {( M2 Q8 c4 O0 N+ k( T
// @version 0.1
. p/ ~" D0 \8 y% @1 U// @description Google it!
) L5 Y9 o+ l5 n3 b# x// @author ggg! m. q0 H: W2 T% p6 j* T/ Y
// @match https://www.baidu.com/*7 U+ h+ }, Y4 n$ l
// @grant GM_openInTab6 Q6 @: \: o- C) [* k1 D4 M
// ==/UserScript==# P1 L4 n- o9 u5 z
(function() {
o5 @1 Y. C- Z; l, ] 'use strict'; [2 j2 S5 |. d3 y, H# D f
$('#su').after('<input type="button" id="google" value="Google一下" class="btn self-btn bg s_btn" style="background-color:grey;" />'); E1 l+ ? y# c/ ~* f
$("#google").click(function() {
$ C# G$ b! `) f2 v$ I googleIt();
( `$ f' w( ?3 S) s! w5 S& r4 t0 x& T });
5 o6 j0 Y. Q; V$ [ function googleIt() {
% b" h: R* F) k7 @/ }# |' x var searchText = $('#kw').val();, \0 n. c9 m# G, m- V. j
GM_openInTab(getGoogleUrl(searchText), false);; Z, C2 q/ V, l
}5 b2 y" w3 X3 [! a) i7 z, e2 f
function getGoogleUrl(searchText) {, P R) C7 g; @4 k
return 'https://www.google.com/search?q=' + searchText;( C7 r7 F4 j# H- t( l
}/ o: Y5 G; `. t$ l$ T6 m) B! B! }
})(); |
|