User:RheingoldRiver/common.js

/* add edit buttons for recent changes & categories */

( function {	'use strict';	var $changeList = $( '.mw-changeslist' );       var $catList = $('.mw-category-generated');	if ( !$changeList.length && !$catList.length) {		return;	}	mw.loader.using( 'mediawiki.util' ).then( function { $changeList.find( '.mw-title' ).each( function {			var title_obj = $( this ).find( '.mw-changeslist-title' )			if ( title_obj ) {				var title = title_obj.attr( 'title' );				$( '' ).addClass( 'rc-editlink' ).attr( { href: mw.util.getUrl( title, { action: 'edit' } ), title: 'Edit this page' } ).text( ' ✎' ).insertAfter( this );				if (title.match(/^User/)) {					$(title_obj).attr('href', $(title_obj).attr('href') + '?profile=no');				}			}		} ); $catList.find('.mw-content-ltr ul li a').each(function {                       var title = $(this).text;                        if (title) {							if ($(this).hasClass("CategoryTreeLabel")) {								title = "Category:" + title;							}							$('').addClass('cat-editlink').attr( { href: mw.util.getUrl(title, { action: 'edit' }), title: 'Edit this page' }).text(' ✎').insertAfter(this);                       }                }); }); } );

/* page values hotkey */ $.when( mw.loader.using( 'mediawiki.util' ), $.ready ).then( function {     mw.util.addPortletLink( 'p-tb', mw.config.get('wgServer') + mw.config.get('wgArticlePath').replace("$1", "index.php?title="+ encodeURI( mw.config.get( 'wgPageName' ) ) + '&action=pagevalues' ), 'Page Values 2', 'pv2','page values','1','#t-cargopagevalueslink'); } );