Jump to content

User:Twsx/vector.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.
/* START - Extra Navigation Menu */
/* START - Extra Navigation Menu */
/* START - Extra Navigation Menu */
/*
    Links that can be shown the same as their actual link is can be defined simply in quotes, i.e. 'WP:AIV'
    For links that are supposed to show a different text than the actual link (i.e. if the actual link is too long) should be defines such as this: 'Special:NewPages===S:NP'
*/
$(document).ready( function() {
    // Link array
    var mAdm = ['WP:AIV', 'WP:ANI', 'WP:AFD'];
    var mPolicy = ['WP:CSD', 'WP:N', 'WP:NOT'];
    var mMisc = ['WP:WARN', 'Special:NewPages===S:NP', 'Special:PendingChanges===S:PC'];
    var mUser = ['User:Twsx/vector.js===Vector.js'];
    // Headers
    var mHeaders = ['Admin Stuff', 'Policy', 'Misc', 'User'];
    // Put it together
    var mItems   = [mAdm, mPolicy, mMisc, mUser];
    var newHTML = ''+
    '<div class="vectorMenu" id="p-twsx">'+
    '    <h3><span>twsX</span><a href="#"></a></h3>'+
    '    <div class="menu">'+
    '        <ul>'+
    '';
    for (var i = 0; i < mItems.length; i++) {
        newHTML = newHTML + '<li style="white-space: nowrap; font-size: 12px; background-color: #787878; color: #FFFFFF; padding: 4px 6px;">'+mHeaders[i]+'</li>';
        for (var x = 0; x < mItems[i].length; x++) {
            if (mItems[i][x].match(/^(.+)===(.+)$/)) {
                var matches = mItems[i][x].match(/^(.+)===(.+)$/);
                newHTML = newHTML + '<li style="white-space: nowrap;" onmouseover="this.style.background=\'#454545\'; this.style.color=\'#FFFFFF\';" onmouseout="this.style.background=\'#FFFFFF\'; this.style.color=\'#000000\';"><a href="http://en.wikipedia.org/wiki/'+matches[1]+'" title="'+matches[1]+'" style="color: inherit;">'+matches[2]+'</a></li>';
            } else {
                newHTML = newHTML + '<li style="white-space: nowrap;" onmouseover="this.style.background=\'#454545\'; this.style.color=\'#FFFFFF\';" onmouseout="this.style.background=\'#FFFFFF\'; this.style.color=\'#000000\';"><a href="http://en.wikipedia.org/wiki/'+mItems[i][x]+'" title="'+mItems[i][x]+'" style="color: inherit;">'+mItems[i][x]+'</a></li>';
            }
        }
    }
    newHTML = newHTML+
    '        </ul>'+
    '    </div>'+
    '</div>'+
    '';
    $('#p-search').before(newHTML);
});
/* END - Extra Navigation Menu */
/* END - Extra Navigation Menu */
/* END - Extra Navigation Menu */

/* START - Link to Special:ListUsers for users */
/* START - Link to Special:ListUsers for users */
/* START - Link to Special:ListUsers for users */
//$(document).ready( function() {
//var wLoc = window.location + '';
//    if (!wLoc.match(/Special:ListUsers/)) {
//        jQuery('.mw-usertoollinks').each(function( index ) {
//            var userToolLinks = jQuery(this).html();
//            var contName = userToolLinks.match(/\/wiki\/Special\:Contributions\/((.+))" title="Special/);
//            contName = contName[1];
//            console.log(contName);
//            userToolLinks = userToolLinks.replace('contribs</a>)', 'contribs</a> | <a href="/wiki/Special:ListUsers/' + contName + '">perm</a>)');
//            jQuery(this).html(userToolLinks);
//        });
//    }
//});
/* END - Link to Special:ListUsers for users */
/* END - Link to Special:ListUsers for users */
/* END - Link to Special:ListUsers for users */

/* START - Custom Watchlist */
/* START - Custom Watchlist */
/* START - Custom Watchlist */
function showAlternateWatchlist() {
	$('#bodyContent').html('<iframe src="https://x.xxer.org/wpwl.php" frameborder="0" style="border: 0; height: 600px; width: 100%;"></iframe><br/><a href="https://x.xxer.org/wpwl.php" target="_blank">Open Externally</a>');
	$('#firstHeading').html('Extended Watchlist');
	document.title = 'WP WL';
}
$(document).ready( function() {
	$('li#pt-watchlist a').html('WL');
	$('li#pt-watchlist').append(' – (<a href="javascript:showAlternateWatchlist();">Extended</a>)');
});
/* END - Custom Watchlist */
/* END - Custom Watchlist */
/* END - Custom Watchlist */

/*
 *
 * EVERYTHING STARTING FROM HERE IS UNDOCMENTED, FOR TESTING PURPOSES, DANGEROUS, KILLS MUDKIPZ, ETC.
 *
 */

mw.loader.load('https://meta.wikimedia.org/w/index.php?action=raw&ctype=text/javascript&title=MediaWiki:MoreMenu.import.js');