MediaWiki:Common.js
Jump to navigation
Jump to search
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */
var isViewingMainPage = (/^MediaWiki(\/.+)? - MediaWiki$/.test(document.title));
if (isViewingMainPage) {
document.write('<style type="text/css">/*<![CDATA[*/ #lastmod, #siteSub, h1.firstHeading { display: none !important; } #content { padding-top: 1em; }/*]]>*/</style>');
}
/* Force preview for anons */
/* by Marc Mongenet, 2006, fr.wikipedia */
function forcePreview() {
if (wgUserName != null || wgAction != "edit") return;
saveButton = document.getElementById("wpSave");
if (!saveButton) return;
saveButton.disabled = true;
saveButton.value = "Save page (use preview first)";
saveButton.style.fontWeight = "normal";
document.getElementById("wpPreview").style.fontWeight = "bold";
}
addOnloadHook(forcePreview);
/* End of forcePreview */
/** includePage ************
* force the loading of another JavaScript file
*
* Maintainer: [[Commons:User:Dschwen]]
*/
function includePage( name )
{
document.write('<script type="text/javascript" src="' + wgScript + '?title='
+ name
+ '&action=raw&ctype=text/javascript"><\/script>'
);
}
/* End of includePage */
/* Including extra .js pages */
// switches for scripts
// TODO: migrate to JSConfig
// var load_extratabs = true;
var load_edittools = true;
// extra drop down menu on editing for adding special characters
includePage( 'MediaWiki:Edittools.js' );
/* End of extra pages */
// UNDER CONSTRUCTION LETTERING
$( ".under-construction" ).each(function( index ) {
var originalText = $( this ).text();
var newText = "";
for( var i = 0; i < originalText.length; i++)
{
if (i % 2 === 0)
newText += "<span>" + originalText.charAt(i) + "</span>";
else
newText += originalText.charAt(i);
}
$( this ).html(newText);
});