Wikipedia:WikiProject User scripts/Requests/Fulfilled/Archive 1: Difference between revisions

Content deleted Content added
manually archived "Watchlist a single section of a page"
Line 335:
 
[[Category:Wikipedia scripts|{{PAGENAME}}]]
 
== Adding links to top menu ==
Is there an easy way to add links to one's top menu (Username, my talk, my preferences etc list)? The features I'd be looking for (''ideally'') would be to change the following for any number of additional links: each link's destination, the text displayed for each link, the ___location in the menu where each link is displayed, and each link message (tooltip). I'd code this myself, but I am sorely illiterate in Javascript and CSS. [[User:Nihiltres|Nihiltres]] 04:45, 26 November 2006 (UTC)
 
: This is fairly simple with the addlilink() function:
<pre style="overflow:auto;border:3px ridge black;height:10em;width:90%;background-color:#ffffff;"><nowiki>
addOnloadHook(ppersonal)
function ppersonal() {
//example of changing a p-personal item (title, url).
document.getElementById('pt-mytalk').firstChild.innerHTML = 'talk';
document.getElementById('pt-mytalk').childNodes[0].href = '/index.php?title=User_talk:Splaka&action=history';
 
//example of hiding a p-personal item
document.getElementById('pt-logout').style.display = 'none';
 
//example of adding a p-personal item.
var tb = document.getElementById('p-personal').getElementsByTagName('ul')[0];
addlilink(tb, 'http://www.google.com/', 'google', 'pt-google');
ta['pt-google'] = ['g', 'Google'];
 
akeytt(); //refresh tooltip additions
}
//change existing tool tips (not onload)
ta['pt-mytalk'] = ['', 'my talk page history'];
 
function addlilink(tabs, url, name, id) {
var na = document.createElement('a');
na.href = url;
na.id = id;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.appendChild(na);
tabs.appendChild(li);
return li;
}
</nowiki></pre>
: You can contact me on my talk page if you need specific help on this. --[[User:Splarka|Splarka]] ([[User_talk:Splarka|rant]]) 08:27, 26 November 2006 (UTC)
 
== Tab to save page ==
I would like to add a tab at the top of the page (beside the article tab or watch tab) that when clicking on it, will save the page when in edit mode (same as hitting [alt-shift-c]? Or maybe it could go on the sidebar? [[User:W3stfa11|W3stfa11]]/<sup><small>[[User talk:W3stfa11|Talk to me]]</small></sup> 03:09, 13 March 2007 (UTC)
 
: That sounds like a rather weird request. But try this (below). --[[User:Splarka|Splarka]] ([[User_talk:Splarka|rant]]) 07:16, 13 March 2007 (UTC)
addOnloadHook(addsaveaction);
function addsaveaction() {
if(document.title.indexOf('Editing ') == 0) addPortletLink('p-cactions','javascript:document.getElementById("wpSave").click();','save','Save');
}