Sztaki mod

By wigy Last update Jan 27, 2009 — Installed 343 times. Daily Installs: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0

There are 3 previous versions of this script.

// ==UserScript==
// @namespace     tag:afafafafafaf@gmail.com,2007-02:userscript
// @name          Sztaki mod
// @description   Modifies a popular Hungarian dictionary site szotar.sztaki.hu that was acquired by Deutsche Telecom early 2008 and polluted with ads.
// @include       *://szotar.sztaki.hu/index.*
// @include       *://szotar.sztaki.hu/dict_search.php?*
// @include       *://dict.sztaki.hu/index.*
// @include       *://dict.sztaki.hu/dict_search.php?*
// ==/UserScript==


// Using the FireBug console for logging if available.
if (unsafeWindow.console)
{
   var GM_log = unsafeWindow.console.log;
}

function addGlobalStyle(css) {
    var head, style;
    head = document.getElementsByTagName('head')[0];
    if (!head) { GM_log("ERROR: <head> element not found."); return; }
    style = document.createElement('style');
    style.setAttribute('wigy', 'on');
    style.type = 'text/css';
    style.innerHTML = css;
    head.appendChild(style);
}

var globalcss =
'#content, #result, #footer { width: auto !important; }' +
'body { background-image: none !important; width: auto !important; margin: 20px !important; }';

var searchboxdiv = document.getElementById('search-box');
var resultdiv = document.getElementById('result');
var contextMenu = document.getElementById('contextMenu');
var marketing = document.getElementById('marketing');

document.body.innerHTML = ''; // keeps all styles and scripts defined in head
if (searchboxdiv)
{
	document.body.appendChild(searchboxdiv);
}
if (resultdiv)
{
	document.body.appendChild(resultdiv);
}
if (contextMenu)
{
	document.body.appendChild(contextMenu);
}
if (marketing)
{
	marketing.parentNode.removeChild(marketing);
}
addGlobalStyle(globalcss);

if (GM_getValue) { // If supported
	var searchform = document.forms[0];
	var pronounce = document.getElementsByName('P')[0];
	var p_index = GM_getValue('p_index', pronounce.selectedIndex);
	pronounce.selectedIndex = p_index;

	searchform.addEventListener('submit', function() {
		var pronounce = document.getElementsByName('P')[0];
		var p_index = pronounce.selectedIndex;
		GM_setValue('p_index', p_index);
	}, false);
}

var searchboxinput = document.getElementById('searchBox');
if (searchboxinput)
{
	searchboxinput.focus();
}