Search Kongregate Forum

Adds Forum & Thread-Specific Searching

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name           Search Kongregate Forum
// @namespace      http://userscripts.org/user100
// @include        http://www.kongregate.com/forums/*
// @version 0.0.1.20160306135440
// @description Adds Forum & Thread-Specific Searching
// ==/UserScript==

addSearchBox();
changeTarget(document.body);
document.addEventListener("DOMNodeInserted",function(e){changeTarget(e.target);},false);

function addSearchBox()
{
	var form=document.createElement("form");
	form.id="search";
	form.method="GET";
	form.target="_blank";
	form.action="http://www.google.com/search";
	form.setAttribute("style","border:1px solid black;padding:1px;");
	form.innerHTML="<dl><dt><input type='text' name='q' tabindex='1' class='hintable' style='font-size:11px;'/><input type='hidden' name='as_q' value='site:"+location.host+location.pathname+"' /><input type='hidden' name='num' value='100'/><input type='hidden' name='newwindow' value='1'/></dt><dd><input type='submit' value='Search' tabindex='2' class='spritesite'/></dd></dl>";
	var el=document.getElementById("sidebar");
	el.insertBefore(form,el.firstChild);
}

function changeTarget(container)
{
	var text=location.host+location.pathname;
	Array.forEach(container.getElementsByTagName("a"),function(l){if (l.href.indexOf(text)!=-1) l.target="_blank";});
}