MediaWiki:Common.js: Difference between revisions

From Celeste Wiki
swapped => with function(id)
No edit summary
(swapped => with function(id))
(22 intermediate revisions by 2 users not shown)
Line 6:
* By [[User:Sikon|Sikon]], updated by [[User:Bizzeebeever]]
*/
/*
/** Currently deactivated
$j( function() {
var $title = $j( '#title-metameta0' ),
text = $title.text().toLowerCase(),
name = mw.config.get( 'wgPageName' ).replace( /_/g, '' ).toLowerCase();
Line 19 ⟶ 18:
}
} );
 
*/
 
 
/** Logo remover *********************************************************
* Used by [[Template:Nologo]]
* By some idiot, updatedUpdated by [[User:Bizzeebeever]]
*//*
$j( function() {
if ( $j( '#nologo' ).length ) {
Line 31 ⟶ 30:
}
} );
*/
 
 
/** Title remover ********************************************************
* Used by [[Template:Notitle]]
* By some idiot, updatedUpdated by [[User:Bizzeebeever]]
*//*
$j( function () {
if ( $j( '#notitle' ).length ) {
Line 42 ⟶ 41:
}
} );
*/
 
/** Categories remover ***************************************************
* Used by [[Template:Nocategories]]
* By some idiot, updatedUpdated by [[User:Bizzeebeever]]
*//*
$j( function() {
if ( $j( '#nocategories' ).length ) {
Line 52 ⟶ 51:
}
} );
*/
 
/** Show username ********************************************************
* The annoying hack used by [[Template:USERNAME]]!
Line 58 ⟶ 57:
* Originally by [[wikia:User:Splarka|Splarka]], [[User:Spang]]
* New version by [[User:Bizzeebeever]]
*//*
$j( function() {
var name = mw.config.get( 'wgUserName' );
Line 64 ⟶ 63:
$j( 'span.insertusername' ).text( name );
}
} );*/
 
/** Archive edit tab disabling *******************************************
Line 71 ⟶ 70:
* or by typing the edit address manually.
* By [[User:Spang|Spang]], rewritten by [[User:Bizzeebeever]]
*//*
$j( function() {
if ( $j( '#old-forum-warning' ).length && !window.enableOldForumEdit ) {
Line 78 ⟶ 77:
.text( 'No editing' );
}
} );*/
 
/** Add-section tab disabling ********************************************
Line 86 ⟶ 85:
* example: <div id="disableAddSection"></div>
* By [[User:Olipro|Olipro]], updated by [[User:Bizzeebeever]]
*//*
$j( function() {
if ( $j( '#disableAddSection' ).length ) {
$j( '#ca-addsection' ).remove();
}
} );*/
 
// Replaces image
 
if (document.getElementById('replaceImageButton')) {
document.getElementById('replaceImageButton').addEventListener('click', function() {
// Get a reference to the container element by its ID
var container = document.getElementById('containerID');
// Find the image element within the container
var imageElement = container.querySelector('img');
// Replace the image source with a new one
imageElement.src = document.getElementById('newImageURL').innerText;
});
}
 
// Default scroll position for maps
window.addEventListener("load", function() {
console.log("started execution");
const bottom = ["scroll0", "scroll1", "scroll2", "scroll4", "scroll7", "scroll8"]; // ids of maps where we need to push the scrollbar to bottom
bottom.forEach(function(id){
console.log("trying to change scroll position of " + id);
if (document.getElementById(id)) {
// document.getElementById(id).scrollTop = document.getElementById(id).scrollHeight;
document.getElementById(id).scrollTop = 999999;
}
});
});
2,559

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.