|
|

楼主 |
发表于 2023-12-13 01:08:47
|
显示全部楼层
// ==UserScript==8 b- V0 A, L" I R
// @name Google on baidu
3 K+ n( c( O1 O; O8 @9 ]9 o// @namespace http://tampermonkey.net/% g+ G% @! @1 X4 g: s
// @version 0.1
2 K6 I7 i2 Q; T9 d" i- x7 _; y- Z// @description Google it!% w/ F0 i/ A7 n4 B4 f
// @author ggg
6 F6 n$ C8 @( n7 D: Z5 s) l# @// @match https://www.baidu.com/*# Y/ _) r2 a. x. A- B0 y
// @grant GM_openInTab
# P: Y4 m* L, `// ==/UserScript==
; ?' J- u% `% n" a4 L+ V9 t/ n9 U' w(function() {
: D9 A2 P. f2 A* W+ s* D7 [2 B 'use strict';
; `+ z4 e A6 W% K6 D8 Z( C $('#su').after('<input type="button" id="google" value="Google一下" class="btn self-btn bg s_btn" style="background-color:grey;" />');& p7 m3 G- j5 b- F
$("#google").click(function() {$ G0 `( R( u; A9 N5 J I
googleIt();
- \5 z# K' m( R6 ~1 a% W& m });
4 r* c- w8 z, K" z" t0 K; _- t function googleIt() {& p2 [5 m2 ^5 |- E; D- j5 q
var searchText = $('#kw').val();' _& h0 h* l5 s7 U) U
GM_openInTab(getGoogleUrl(searchText), false);3 B8 b: I# u, L+ `! A
}8 m6 k" |& ^. z, M; J% u0 W
function getGoogleUrl(searchText) {
' b7 [8 \: B; H* D. Q" j: z: p% w- Y return 'https://www.google.com/search?q=' + searchText;: z8 z' Q( X5 w: [& G+ R$ }+ S
}# r' l2 k+ w7 _: I" v3 U! X# d
})(); |
|