|
|

楼主 |
发表于 2023-12-13 01:08:47
|
显示全部楼层
// ==UserScript==/ t% H4 q. w5 D9 d
// @name Google on baidu: q1 s; p/ T3 v2 l- H9 |/ `
// @namespace http://tampermonkey.net/: v& j' ~9 H0 C6 n2 q& N" Z
// @version 0.1; n) j0 w2 o3 Y
// @description Google it!
2 s, y9 l8 x- D6 [7 n& E# x, J. i// @author ggg( Y" C% n% t+ \' h* V
// @match https://www.baidu.com/*( N& N$ ?- O! o+ @2 e. ?( w0 ~
// @grant GM_openInTab: \+ D7 f) H$ P z- J4 b4 W4 n
// ==/UserScript==7 g. E: @- x( X/ U) A. u1 N2 a
(function() {3 q& S" e _; j0 z- l
'use strict';/ f8 K8 _' R" p& \; q u
$('#su').after('<input type="button" id="google" value="Google一下" class="btn self-btn bg s_btn" style="background-color:grey;" />');
2 F- }+ j3 K2 c) J: f $("#google").click(function() {: L9 X; e2 _) Q9 T, a b
googleIt();
+ ^6 B$ }! o( T });. `, w- R( y E" [ S# C
function googleIt() {# V% q) N1 W4 a5 K2 y1 l
var searchText = $('#kw').val();) h/ e# |. r8 k. A
GM_openInTab(getGoogleUrl(searchText), false);
' F- l- ?3 f) [4 X0 N1 @ }
+ a# r1 S* [& c+ t9 y2 H function getGoogleUrl(searchText) {( `: S& U3 D1 G2 V: Y& k6 e
return 'https://www.google.com/search?q=' + searchText;: O9 v& ]# P3 a# @
}9 x; }4 D7 I/ B, q8 w- R
})(); |
|