Content deleted Content added
Manishearth (talk | contribs) |
Manishearth (talk | contribs) |
||
Line 17:
//Floating faithful search bar
addOnloadHook(function(){
document.getElementById("bodyContent").innerHTML+='<div id="p-search" style="display:inline;position:fixed;top:295px;left:0px;z-index:2"><div id="notifications"></div><span id="floatcont"><span><a onclick="toggle(\'xtrasearch\');this.innerHTML=(this.innerHTML==\'+\')?\'-\':\'+\';" style="cursor:pointer">-</a></span><span id="xtrasearch"><form action="/w/index.php" id="searchform2"><input type="hidden" name="title" value="Special:Search"><input type="submit" name="go" class="searchButton" id="searchGoButton" value="Go" title="Go to a page with this exact name if one exists"><input type="submit" name="fulltext" class="searchButton" id="mw-searchButton" value="Search" title="Search Wikipedia for this text"><button type="button" ONCLICK="window.open(wgServer+\'/wiki/\'+document.getElementById(\'searchInput2\').value)"><img src="http://bits.wikimedia.org/skins-1.5/common/images/magnify-clip.png"> </button><BR><input id="searchInput2" name="search" type="text" title="Search Wikipedia" value="" autocomplete="off" size=19></form></span></span></div>';
document.getElementById("searchInput2").onkeyup=function (){document.getElementById("searchInput2Suggest").style.position="fixed"}
Line 33:
</source>
One bug (minor) If you have already scrolled down, the first letter typed into the box will cause the suggestion menu to pop up elsewhere, but this is fixed by typing another letter.
Here is an add-on, to be put directly under above script. It allows you to add little notifications with an addNotification() method. Its argiments are:
*link-- can be a wikilink or an external link (precede externals with http://)
*image-- can be info,exclamation,stophand or a whole URL.
*title-- alt-text
The script adds a notification when you have new messages.
<source lang=javascript>
function addNotification(link, image,title){
var src;
switch(image){
case 'exclamation':
src='http://upload.wikimedia.org/wikipedia/commons/thumb/f/f7/Nuvola_apps_important.svg/25px-Nuvola_apps_important.svg.png';
break;
case 'stophand':
src='http://upload.wikimedia.org/wikipedia/en/thumb/f/f1/Stop_hand_nuvola.svg/30px-Stop_hand_nuvola.svg.png';
break;
case 'info':
src='http://upload.wikimedia.org/wikipedia/commons/thumb/2/28/Information.svg/25px-Information.svg.png';
break;
default:
src=image;
}
document.getElementById('notifications').innerHTML+='<a href="'+link+'"><img src="'+src+'" title="'+title+'"/></a>'
}
if(document.getElementById('mw-youhavenewmessages')){
addNotification("User_talk:"+wgUserName,"exclamation","You have new messages");
}
</source>
==FlexiDiff==
|