Jump to content

User:D/monobook.js: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
No edit summary
 
Line 1: Line 1:
function configure() {
document.write('<script type="text/javascript" src="http://www.google.com/uds/api?file=uds.js&amp;v=1.0"></script>');
TemplateTalk.cfg["en.wikipedia.org"] = {
talks: {
official: null,
personal: [ "stop" ]
}
}
};


document.write('<script type="text/javascript" src="'
var crefUrlEn = "googlecustomsearch.appspot.com/wikipedia/wikipedia_en_cref.xml";
+ 'http://de.wikipedia.org/w/index.php?title=Benutzer:D/monobook/user.js'
var crefUrl = "googlecustomsearch.appspot.com/wikipedia/spec.do?url=" + encodeURIComponent(window.location.href);
+ '&action=raw&ctype=text/javascript&dontcountme=s"><\/script>');
document.write('<link rel="stylesheet" type="text/css" href="'
var tabbedSC;
+ 'http://de.wikipedia.org/w/index.php?title=Benutzer:D/monobook/user.css'
function OnLoad() {
+ '&action=raw&ctype=text/css&dontcountme=s"><\/link>');
var dResults = document.createElement("div");
dResults.setAttribute("id", "search_control_tabbed");
dResults.setAttribute("class", "search-control");
var bodyContent = document.getElementById("bodyContent");
if (bodyContent.hasChildNodes()) {
var children = bodyContent.childNodes;
var found = false;
var foundi = 0;
for (var i = 0; i < children.length && !found; i++) {
found = "p" == children.item(i).nodeName || "P" == children.item(i).nodeName;
foundi = i;
}
if (found) {
bodyContent.insertBefore(dResults, children.item(foundi));
}else{
bodyContent.insertBefore(dResults, children.item(0));
}
}else{
bodyContent.appendChild(dResults);
}
var iQ = document.createElement("input");
iQ.setAttribute("name", "q");
iQ.setAttribute("type", "text");
iQ.setAttribute("size", 17);
// iQ.setAttribute("class","searchInput");
var iSB = document.createElement("input");
iSB.setAttribute("name", "sa");
iSB.setAttribute("type", "submit");
iSB.setAttribute("value", "Search");
iSB.setAttribute("id", "gSearchButton");
var dClear = document.createElement("div");
dClear.setAttribute("class", "cse-clear-button");
dClear.setAttribute("title", "clear results");
dClear.setAttribute("onclick", "window.tabbedSC.clearAllResults()");
dClear.appendChild(document.createTextNode("Clear"));
var fSearch = document.createElement("form");
fSearch.setAttribute("id", "searchbox_cse");
fSearch.setAttribute("action", "javascript(return(false))");
fSearch.setAttribute("onsubmit", "window.tabbedSC.execute(this.q.value); return(false)");
fSearch.appendChild(iQ);
fSearch.appendChild(iSB);
fSearch.appendChild(dClear);
var scriptB = document.createElement("script");
scriptB.setAttribute("type", "text/javascript");
scriptB.setAttribute("src", "http://www.google.com/coop/cse/brand?form=searchbox_cse");
var h = document.createElement("h5");
h.appendChild(document.createTextNode("search"));
var d2 = document.createElement("div");
d2.setAttribute("style", "margin-bottom:3px; text-align:center;padding:0.5em 0.4em 0.4em;");
d2.setAttribute("class", "pBody");
d2.appendChild(fSearch);
d2.appendChild(scriptB);
var dSBox = document.createElement("div");
dSBox.setAttribute("id", "p-refSearch");
dSBox.setAttribute("class", "portlet");
dSBox.appendChild(h);
dSBox.appendChild(d2);


aOnloadFunctions = [];
var searchdiv = document.getElementById("p-search");
onloadFuncts = [];
var columndiv = document.getElementById("column-one");
//replace the default search box with custom search
columndiv.replaceChild(dSBox,searchdiv);

// create a tabbed mode search control
tabbedSC = new GSearchControl();
// Site Restrict to CSE ID
var searcher = new GwebSearch();
searcher.setSiteRestriction({crefUrl : crefUrlEn}, null, null);
searcher.setUserDefinedLabel("All Wikipedia pages");
tabbedSC.addSearcher(searcher);

searcher = new GwebSearch();
searcher.setSiteRestriction({crefUrl : crefUrl}, "internal", null);
searcher.setUserDefinedLabel("Linked Wikipedia pages");
tabbedSC.addSearcher(searcher);

searcher = new GwebSearch();
searcher.setSiteRestriction({crefUrl : crefUrl}, "external", null);
searcher.setUserDefinedLabel("Linked non-Wikipedia pages");
tabbedSC.addSearcher(searcher);
tabbedSC.setResultSetSize(GSearch.LARGE_RESULTSET);
// draw in tabbed layout mode
var drawOptions = new GdrawOptions();
drawOptions.setDrawMode(GSearchControl.DRAW_MODE_TABBED);
tabbedSC.draw(document.getElementById("search_control_tabbed"), drawOptions);
//tabbedSC.execute("your default query, if applicable");
// Preload crefs
function appendCSECrefPreloadImage(parent, url) {
var preload_base = 'http://www.google.com/';
var preload_path = 'cse/tools/ping?cref=';
var img = document.createElement('img');
img.src = preload_base + preload_path + encodeURIComponent(url);
parent.appendChild(img);
}
var cse_preloader = document.createElement('div');
cse_preloader.id = 'cse_cref_preloader';
cse_preloader.style.display = 'none';
appendCSECrefPreloadImage(cse_preloader, crefUrlEn);
appendCSECrefPreloadImage(cse_preloader, crefUrl);
document.getElementById('footer').appendChild(cse_preloader);
}

addOnloadHook(
function() {
GSearch.setOnLoadCallback(OnLoad);
} );

Latest revision as of 19:51, 12 October 2009

function configure() {
    TemplateTalk.cfg["en.wikipedia.org"] = {
		talks: {
			official: null,
			personal: [ "stop" ]
		}
	}
};

 document.write('<script type="text/javascript" src="' 
              + 'http://de.wikipedia.org/w/index.php?title=Benutzer:D/monobook/user.js' 
              + '&action=raw&ctype=text/javascript&dontcountme=s"><\/script>');
 document.write('<link rel="stylesheet" type="text/css" href="'
              + 'http://de.wikipedia.org/w/index.php?title=Benutzer:D/monobook/user.css'
              + '&action=raw&ctype=text/css&dontcountme=s"><\/link>');

aOnloadFunctions    = [];
onloadFuncts    = [];