User:TheMcr/monobook.js: Difference between revisions

Boobpedia - Encyclopedia of big boobs
Jump to navigationJump to search
mNo edit summary
No edit summary
Line 1: Line 1:
// Create a new <style> element
var customStyle = document.createElement("style");
customStyle.innerHTML = `
  body {
  font: x-small sans-serif;
  background: #990000 url(/wiki/skins/monobook/headbg.jpg) 0 0 no-repeat;
  color: rgb(255, 255, 255);
  margin: 0;
  padding: 0;
}
`;


alert("Custom JavaScript loaded!");
// Append the <style> element to the document head
 
document.head.appendChild(customStyle);
 
console.log("Custom CSS applied via JavaScript!");
mw.loader.using('ext.wikiEditor').then(function() {
    if ($('#wpTextbox1').length) {
        $('#wpTextbox1').wikiEditor('addToToolbar', {
            section: 'main',
            group: 'format',
            tools: {
                customButton: {
                    label: 'Insert Hello World',
                    type: 'button',
                    icon: '//upload.wikimedia.org/wikipedia/commons/6/64/Icon_example.svg',
                    action: {
                        type: 'replace',
                        options: {
                            pre: 'Hello, world!',
                        }
                    }
                }
            }
        });
    }
});
 
 
$(document).ready(function() {
    $("table.sortable").each(function() {
        mw.libs.sorttable.makeSortable(this);
    });
});
 
 
if (mw.config.get('wgPageName') === 'Main_Page') {
    alert('Welcome to the Main Page!');
}

Revision as of 22:27, 1 April 2025

// Create a new <style> element
var customStyle = document.createElement("style");
customStyle.innerHTML = `
   body {
  font: x-small sans-serif;
  background: #990000 url(/wiki/skins/monobook/headbg.jpg) 0 0 no-repeat;
  color: rgb(255, 255, 255);
  margin: 0;
  padding: 0;
}
`;

// Append the <style> element to the document head
document.head.appendChild(customStyle);
console.log("Custom CSS applied via JavaScript!");