User:Polygnotus/Scripts/MoreBits.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. |
Documentation for this user script can be added at User:Polygnotus/Scripts/MoreBits. |
// <nowiki>
//Used to demonstrate that morebits is loaded, even when Twinkle is not enabled.
//https://en.wikipedia.org/wiki/Wikipedia:Morebits
//The idea was to use morebits to put the {{duplicated citations}} template in the correct place according to [[MOS:ORDER]]
//This doesn't really do anything at the moment.
mw.loader.using(['ext.gadget.morebits'], function() {
// Only run on view pages, not on edit pages or other special pages
if (mw.config.get('wgAction') !== 'view') return;
// Function to demonstrate Morebits status messages
function demonstrateMorebitsStatus() {
// Initialize Morebits status system
Morebits.status.init(document.getElementById('mw-content-text'));
// Create a new overall status
var overallStatus = new Morebits.status('Morebits Status Demo');
// Show an info message
overallStatus.info('Starting', 'Beginning the demonstration');
// Simulate some work and show different status types
setTimeout(function() {
var status1 = new Morebits.status('Step 1');
status1.info('Processing', 'Doing some work...');
setTimeout(function() {
status1.success('Complete', 'Step 1 finished successfully');
var status2 = new Morebits.status('Step 2');
status2.warn('Caution', 'This step might have issues');
setTimeout(function() {
status2.error('Failed', 'Step 2 encountered an error');
var status3 = new Morebits.status('Step 3');
status3.status('In Progress', 'Final step...');
setTimeout(function() {
status3.info('Done', 'Step 3 completed');
overallStatus.success('Complete', 'All steps finished');
}, 2000);
}, 2000);
}, 2000);
}, 2000);
}
// Add a button to trigger the demonstration
$(function() {
var $button = $('<button>')
.text('Demonstrate Morebits Status')
.click(demonstrateMorebitsStatus);
$('#mw-content-text').prepend($button);
});
});
// </nowiki>