Jump to content

User:Cenarium/common.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Cenarium (talk | contribs) at 05:51, 15 December 2014. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
importScript('User:Cenarium/protect-icon.js')

// custom links
mw.util.addPortletLink(	'p-personal', '/wiki/User:Cenarium/Bugs', 'Bugs', null, null, null, '#pt-preferences');
mw.util.addPortletLink(	'p-personal', '/wiki/User:Cenarium/Rights', 'Rights', null, null, null, '#pt-preferences');
mw.util.addPortletLink(	'p-personal', '/wiki/User:Cenarium/Sandbox', 'Sandbox', null, null, null, '#pt-preferences');

//rename of tabs (except edit)
$( '#ca-nstab-user a' ).text( 'User' );
$( '#ca-talk a' ).text( 'Talk' );
$( '#ca-history a' ).text( 'History' );
$( '#ca-unprotect a' ).text( 'Protect' );

// rename of edit tabs
$( '#ca-edit a' ).text( 'Edit' );
$( '#ca-ve-edit a' ).text( 'VEdit' );

// rename of edit section links
if (wgAction == 'view') {
jQuery( document ).ready( function( $ ) {
$( '.mw-editsection a' ).text( 'Edit' );
$( '.mw-editsection-visualeditor' ).text( 'VEdit' );
} )
}

// interwikis removed
$("#p-lang").remove();

// move interface cleanup

if (wgCanonicalSpecialPageName === "Movepage") {
jQuery( document ).ready( function( $ ) {

if (document.getElementsByClassName('error mw-moveuserpage-warning').length > 0) {
var t=document.getElementsByClassName('error mw-moveuserpage-warning')[0]
t.parentNode.removeChild(t.nextSibling)
t.parentNode.removeChild(t)
}

var z=document.getElementById("mw-content-text").firstChild
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z)

g=document.getElementById("movepagetalktext")
g.parentNode.removeChild(g)

} )
}

// delete interface cleanup

if (wgAction == 'delete') {
jQuery( document ).ready( function( $ ) {
var z=document.getElementById("Deletereason").parentNode

z.parentNode.removeChild(z.previousSibling)
z.parentNode.removeChild(z.previousSibling)
z.parentNode.removeChild(z.previousSibling)
z.parentNode.removeChild(z.previousSibling)
z.parentNode.removeChild(z)

t=document.getElementById("mw-deleteconfirm-table")
t.removeChild(t.childNodes[2])
t.removeChild(t.childNodes[2])
t.removeChild(t.childNodes[2])

g=document.getElementsByClassName("mw-delete-editreasons")[0]
g.parentNode.removeChild(g)

} )
}


// block interface cleanup

if (wgCanonicalSpecialPageName === "Block") {
jQuery( document ).ready( function( $ ) {

var z=document.getElementById("blockiptext")
z.parentNode.removeChild(z)

t=document.getElementById("GovernmentIps")
t.parentNode.removeChild(t)

} )
}

// protect interface cleanup

if (wgAction == 'protect') {
jQuery( document ).ready( function( $ ) {

var z=document.getElementById("protect_text")
z.parentNode.removeChild(z)

t=document.getElementsByClassName("mw-protect-editreasons")[0]
t.parentNode.removeChild(t)

g=document.getElementById("mw-protect-table3").firstChild
g.removeChild(g.childNodes[5])

} )
}

if (wgAction == 'edit'||wgAction == 'submit') {
jQuery( document ).ready( function( $ ) {

var z=document.getElementsByClassName("editnotice-link")[0]
z.parentNode.removeChild(z)

var t=document.getElementsByClassName("editnotice_BLP_editintro")[0]
t.parentNode.removeChild(t)

var g=document.getElementsByClassName("disambig-editintro")[0]
g.parentNode.removeChild(g)

if (wgPageName = "Wikipedia:Education_noticeboard") { $("#editnotice-area").remove() };

} )
}


// WhatLinksHere interface cleanup
// wgCanonicalSpecialPageName === "WhatLinksHere" check doesn't work

if (document.getElementById("mw-whatlinkshere-target") != null ) {
jQuery( document ).ready( function( $ ) {

var z=document.getElementById("mw-whatlinkshere-target").parentNode.parentNode
z.parentNode.removeChild(z.previousSibling)
z.parentNode.removeChild(z.previousSibling)

} )
}

// Contributions interface cleanup

if (wgCanonicalSpecialPageName === "Contributions") {
jQuery( document ).ready( function( $ ) {

var z=document.getElementById("mw-sp-contributions-explain")
z.parentNode.removeChild(z)

var t=document.getElementsByClassName("metadata topicon")[0]
t.parentNode.removeChild(t)

var g=document.getElementById("newbie")
g.parentNode.removeChild(g.nextSibling)
g.parentNode.removeChild(g.nextSibling)
g.parentNode.removeChild(g.nextSibling)
g.parentNode.removeChild(g)

var k=document.getElementsByClassName("mw-contributions-table")[0]

k.parentNode.removeChild(k.nextSibling)
k.parentNode.removeChild(k.nextSibling)

h=k.firstChild.nextSibling.lastChild.previousSibling
h.parentNode.removeChild(h.previousSibling)
h.parentNode.removeChild(h.previousSibling)
h.parentNode.removeChild(h.previousSibling)
h.parentNode.removeChild(h.previousSibling)
h.parentNode.removeChild(h.previousSibling)

} )
}

// Log interface cleanup

if (wgCanonicalSpecialPageName === "Log") {
jQuery( document ).ready( function( $ ) {

var z=document.getElementById("tagfilter").parentNode
z.parentNode.removeChild(z.previousSibling)
z.parentNode.removeChild(z.previousSibling)
z.parentNode.removeChild(z)

var t=document.getElementById("mw-content-text").firstChild

t.parentNode.removeChild(t.nextSibling)
t.parentNode.removeChild(t.nextSibling)
t.parentNode.removeChild(t.nextSibling)
t.parentNode.removeChild(t)

} )
}

// UserRights interface cleanup
// wgCanonicalSpecialPageName === "UserRights" check doesn't work

if (document.getElementById("mw-userrights-form1") != null) {
jQuery( document ).ready( function( $ ) {

document.getElementById("mw-userrights-form1").parentNode.removeChild(document.getElementById("mw-userrights-form1"))

var z=document.getElementsByClassName("mw-usertoollinks")[0]

z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)

} )
}

// Watchlist interface cleanup

if (wgCanonicalSpecialPageName === "Watchlist") {
jQuery( document ).ready( function( $ ) {

var z=document.getElementById("mw-wlheader-showupdated")
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.previousSibling)
z.parentNode.removeChild(z.previousSibling)
z.parentNode.removeChild(z)

var t=document.getElementById("mw-watchlist-form")
t.parentNode.removeChild(t)

} )
}

// AbuseFilter interface cleanup

if (wgCanonicalSpecialPageName === "AbuseFilter") {
jQuery( document ).ready( function( $ ) {

var z=document.getElementsByClassName("mw-abusefilter-status")[0].nextSibling
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)
z.parentNode.removeChild(z.nextSibling)

} )
}

mw.loader.using( 'ext.visualEditor.viewPageTarget.init', function(){
 mw.libs.ve.addPlugin( function() { 
  mw.hook( 've.activationComplete' ).add(function(){
  $('.ve-init-mw-viewPageTarget-toolbar-actions div:nth-child(1) a:nth-child(1) span:nth-child(2)').html('Save window');
  });
 } );
});