2014-08-29 134 views
-2
  1. http://i.stack.imgur.com/P3ZTz.jpg

你們有什麼想法,如果這樣,可以請給我一個例子嗎? (我'是新手)如何更改搜索框中文字的不透明度?

謝謝

幸得Krowe。

// ==UserScript== 
// @name  Tamper with Google Results 
// @namespace http://superuser.com/users/145045/krowe 
// @version 0.1 
// @description This just modifies google results to exclude certain things. 
// @match  http://*.google.com 
// @match  https://*.google.com 
// @copyright 2014+, KRowe 
// ==/UserScript== 


function GM_main() { 
    window.onload = function() { 
     var targ = window.location; 
     if(targ && targ.href && targ.href.match('https?:\/\/www.google.com/.+#q=.+') && targ.href.search("/+-torrent/+-watch/+-download")==-1) { 
     targ.href = targ.href +"+-torrent+-watch+-download"; 
     } 
    }; 
} 

//-- This is a standard-ish utility function: 
function addJS_Node(text, s_URL, funcToRun, runOnLoad) { 
    var D=document, scriptNode = D.createElement('script'); 
    if(runOnLoad) scriptNode.addEventListener("load", runOnLoad, false); 
    scriptNode.type = "text/javascript"; 
    if(text) scriptNode.textContent = text; 
    if(s_URL) scriptNode.src = s_URL; 
    if(funcToRun) scriptNode.textContent = '(' + funcToRun.toString() + ')()'; 
    var targ = D.getElementsByTagName('head')[0] || D.body || D.documentElement; 
    targ.appendChild(scriptNode); 
} 

addJS_Node (null, null, GM_main); 

使用( - )符號,我可以排除不想要的結果,但不希望其他用戶意識到它。如果有人搜索谷歌或其他任何搜索引擎這個短語(-torrent下載手錶)應自動和不可見地添加

edit-我該如何使用css在不需要的文本頂部添加一個空白的白色圖層並在textarea中同步它們?

例如:http://i.stack.imgur.com/uAz0i.jpg

+1

可以粘貼的一些事情的代碼,你嘗試?它是一個開始的好地方。 – 2014-08-29 17:33:49

+1

'yourInput.style.color =「rgba(0,0,0,alpha)」;' – 2014-08-29 17:33:59

+0

你想只在輸入字段中選擇單詞的樣式,就像你的例子中那樣? – 2014-08-29 17:35:21

回答

0

您可以使用color切換到文本的顏色。

color:rgb(255,0,0); //red 
color:rgba(255,0,0,0.5); //half opaque red. 

前三個數字是顏色,第四個是不透明度。

相關問題