Jump to content

User:David Condrey/bookmarknav.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
$('#p-interaction').clone(true).insertAfter($('#p-interaction')).addClass('mylinks').removeAttr('id').find('h3').text('Quick References');
$('.mylinks li').remove();
$('.mylinks .pBody ul').append('<li><a class="myLinks1"></a></li>');
$('.mylinks .pBody ul').append('<li><a class="myLinks2"></a></li>');
$('.mylinks .pBody ul').append('<li><a class="myLinks3"></a></li>');
$('.mylinks .pBody ul').append('<li><a class="myLinks4"></a></li>');
$('.mylinks .pBody ul').append('<li><a class="myLinks5"></a></li>');
$('.mylinks .pBody ul').append('<li><a class="myLinks6"></a></li>');
$('.mylinks .pBody ul').append('<li><a class="myLinks7"></a></li>');

// Set each new link's text and url
$('.myLinks1').text('Policies').attr('href', 'http://en.wikipedia.org/wiki/Wikipedia:List_of_policies');
$('.myLinks2').text('Guidelines').attr('href', 'http://en.wikipedia.org/wiki/Wikipedia:List_of_guidelines');
$('.myLinks3').text('Main Style').attr('href', 'http://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style/Contents');
$('.myLinks4').text('Wiki Markup').attr('href', 'http://en.wikipedia.org/wiki/Help:Wiki_markup');
$('.myLinks5').text('Template Tagging').attr('href', 'https://en.wikipedia.org/wiki/Wikipedia:Template_messages');
$('.myLinks6').text('Cleanup Tags').attr('href', 'https://en.wikipedia.org/wiki/Wikipedia:Template_messages/Cleanup#General_cleanup');
$('.myLinks7').text('List of InfoBoxes').attr('href', 'https://en.wikipedia.org/wiki/Wikipedia:List_of_infoboxes');

if (mw.config.get('wgNamespaceNumber') != -1) {
	$('#p-tb').clone(true).insertAfter($('#p-tb')).addClass('histtools').removeAttr('id').find('h3').text('History tools');
 	$('.histtools li').remove();
	$('.histtools .pBody ul').append('<li><a class="histTool1"></a></li>');
	$('.histtools .pBody ul').append('<li><a class="histTool2"></a></li>');
	$('.histtools .pBody ul').append('<li><a class="histTool3"></a></li>');
	$('.histtools .pBody ul').append('<li><a class="histTool4"></a></li>');
	$('.histtools .pBody ul').append('<li><a class="histTool5"></a></li>');
	$('.histtools .pBody ul').append('<li><a class="histTool6"></a></li>');
	$('.histtools .pBody ul').append('<li><a class="histTool7"></a></li>');
	$('.histTool1').text('Page logs').attr('href', 'http://en.wikipedia.org/w/index.php?title=Special:Log&page=' + mw.config.get('wgPageName'));
	$('.histTool2').text('Contributors').attr('href', 'http://toolserver.org/~daniel/WikiSense/Contributors.php?wikilang=en&wikifam=.wikipedia.org&grouped=on&page=' + mw.config.get('wgPageName'));
	$('.histTool3').text('User edits').attr('href', 'http://toolserver.org/~snottywong/usersearch.html?page=' + mw.config.get('wgPageName'));
	$('.histTool4').text('Watchers').attr('href', 'http://toolserver.org/~dispenser/cgi-bin/watcher.py?page=' + mw.config.get('wgPageName'));
	$('.histTool5').text('Page view stats').attr('href', 'http://stats.grok.se/en/latest/' + mw.config.get('wgPageName'));
	$('.histTool6').text('History stats').attr('href', 'https://tools.wmflabs.org/xtools/articleinfo/index.php?article=' + mw.config.get('wgPageName') + '&lang=en&wiki=wikipedia');
	$('.histTool7').text('History search').attr('href', 'http://wikipedia.ramselehof.de/wikiblame.php?lang=en&article=' + mw.config.get('wgPageName'));
}

var new_NavTop = [
		{
        		label: "AFI",
        		url: "/wiki/Wikipedia:Today%27s_articles_for_improvement",
        		index: 6
        },
        {
                label: "AFC",
                url: "/wiki/Special:RandomInCategory/Pending_AfC_submissions",
                index: 7
        },
        {
                label: "New pages",
                title: "Feed of recently created pages",
                url: "/wiki/Special:NewPagesFeed",
                index: 8
        },
        {
        		label: "Categories",
        		url: "/wiki/Wikipedia:Reference_desk",
        		index: 9
        }
 ];
var NavTop = document.getElementById("p-personal").getElementsByTagName("ul")[0];

for (var i = 0; i < new_NavTop.length; i++) {
	var newListItem = document.createElement("li");
	var newLink = document.createElement("a");
	newLink.setAttribute("href", new_NavTop[i].url);
	if (new_NavTop[i].hasOwnProperty("title")) {
		newLink.setAttribute("title", new_NavTop[i].title);
	}
	newLink.appendChild(document.createTextNode(new_NavTop[i].label));
	newListItem.appendChild(newLink);

	if (new_NavTop[i].hasOwnProperty("index")) {
		NavTop.insertBefore(newListItem, NavTop.childNodes[new_NavTop[i].index]);
	} else {
		NavTop.appendChild(newListItem);
	}
}