// ==UserScript== // @name Adds Site Search By Google // @include * // @exclude http://www.google.tld/* // @version 1.01 // ==/UserScript== (function() { if (self.location.href != top.location.href) return; if(document.contentType != 'text/html') return; var GM_infoPanel = document.createElement('div'); with(GM_infoPanel.style) { top = 0; right = 0; padding = '2px'; opacity = 0; fontSize = 'x-small'; color = '#000000'; backgroundColor = '#EEEEEE'; border = '1px solid #C0C0C0'; zIndex = 100; position = 'fixed'; width = '100px'; cursor = 'pointer'; } GM_infoPanel.innerHTML = ' '; GM_infoPanel.addEventListener('mouseover', makeForm, false); GM_infoPanel.addEventListener('mouseout', hideForm, false); document.body.appendChild(GM_infoPanel); function makeForm() { var site = document.domain; var location = document.location.href; var index = location.indexOf("/", location.indexOf(site) + site.length + 1); if(index > 0) site = location.substring(location.indexOf("://") + 3, index); this.style.opacity = ''; this.style.width = ''; this.innerHTML = '
'+ ''; this.removeEventListener('mouseover', makeForm, false); this.addEventListener('mouseover', showForm, false); var button = document.getElementById('delete_site_search__'); with(button.style){ fontSize = '125%'; marginRight = '0.5em'; } button.addEventListener('click', deleteForm, false); } function hideForm() { GM_infoPanel.style.opacity = '0'; } function showForm() { GM_infoPanel.style.opacity = '100'; } function deleteForm() { document.body.removeChild(GM_infoPanel); } })(); /* This code is in the public domain. */