0
내 문제에 단어를 추가 :자바 스크립트 : 프로그래밍 URL
내가 수동으로 "개"나는 내 검색 결과에 나타나는 "개"를 원하지 않는 Google.I를 사용할 때마다 추가 피곤 해요.
예를 들어: 그것은이
https://www.google.com/search?q=cat+-dog
https://www.google.com/search?q=baseball+-dog
CODE 같이해야한다 : 신용이 krowe 간다.
dog
-torrent-watch-download
// ==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);
로 대체. Google 검색에 직접 입력하는 문제는 onload 이벤트가 발생하지 않는다는 것입니다. 이 스크립트를 Google 검색에서 사용하려면
개선의 여지가 있습니까? 구글은 해시 작업을하기 때문에
감사
내가 프로그래밍에 멍청하다고 말할 때 당혹 스럽네요. 스크립트가 Google 검색에서 작동하는지 확인해 주시겠습니까? 정말로 도움을 주셔서 감사합니다. – nasekt
예, Google에서 Scriptish (GreaseMonkey 포크)로이 사실을 확인했습니다. 그것은 단지 당신의 예제 "-dog"로 하드 코딩되어 있습니다. 표현식의 동적 빌드를 사용하여 필요에 맞게 코드를 수정해야합니다. –