User:Technical 13/Scripts/admin eye.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | This user script seems to have a documentation page at User:Technical 13/Scripts/admin eye. |
if( $( ".sysop-show" ).length > 0){
console.info( 'Hidden section found!' );//TRON
$( '#p-logo a' ).css({ 'background-image': 'url(/media/wikipedia/commons/9/9c/Wikipedia-logo-v2-admin.svg)', 'background-size': '135px 155px' });
console.log( 'Changed background image!' );//TRON
var listStyle = mw.util.addPortletLink(
'p-cactions',
'#',
'O.o',
'pt-admin_eye',
'View page as an admin',
null,
null
);
console.log( 'Added toggle link!' );//TRON
$( listStyle ).click( function ( e ) {
console.time('admin-eye');//TRON
e.preventDefault();
/*, 'block' );*/
$( 'div.sysop-show, p.sysop-show' ).css( 'display', function (i, val) {
if(val =="block"){var status = "Re-hid";}else{var status = "Displayed hidden";}//TRON
console.log( '%s div and p sections!', status );//TRON
return val === "block" ? "" : "block";
});
/*, 'inline' );*/
$( 'span.sysop-show, small.sysop-show' ).css( 'display', function (i, val) {
if(val =="inline"){var status = "Re-hid";}else{var status = "Displayed hidden";}//TRON
console.log( '%s span and small sections!', status );//TRON
return val === "inline" ? "" : "inline";
});
/*, 'table' );*/
$( 'table.sysop-show' ).css( 'display', function (i, val) {
if(val =="table"){var status = "Re-hid";}else{var status = "Displayed hidden";}//TRON
console.log( '%s tables!', status );//TRON
return val === "table" ? "" : "table";
});
/*, 'list-item' );*/
$( 'li.sysop-show' ).css( 'display', function (i, val) {
if(val =="list-item"){var status = "Re-hid";}else{var status = "Displayed hidden";}//TRON
console.log( '%s list items!', status );//TRON
return val === "list-item" ? "" : "list-item";
});
/* Toggle the link */
$( 'li#pt-admin_eye a' ).html( function (i, val) {
console.log( 'Updated toggle link from "%s"', val );//TRON
return val === "O.O" ? "o.o" : "O.O";
});
$( 'li#pt-admin_eye a' ).attr( 'title', function (i, val) {
console.log( 'Updated toggle link from "%s"', val );//TRON
return val === "View page as an admin" ? "View page as a user" : "View page as an admin";
});
console.timeEnd('admin-eye');//TRON
});
} else {
console.warn( 'Hidden section NOT found!' );//TRON
}