MediaWiki

Gadget-sandbox.js

From Dogcraft Wiki

(Created page with "$(document).ready(function() { if (mw.config.get('wgPageName') === 'User:Domino/Sandbox') { mw.loader.using( 'oojs-ui-core' ).done( function () { $( function () {...")
 
(-)
Line 3: Line 3:
if (mw.config.get('wgPageName') === 'User:Domino/Sandbox') {
if (mw.config.get('wgPageName') === 'User:Domino/Sandbox') {
mw.loader.using( 'oojs-ui-core' ).done( function () {
mw.loader.using( ['oojs-ui-core', 'oojs-ui-widgets', 'oojs-ui-windows'] ).done( function () {
$( function () {
$( function () {
var button = new OO.ui.ButtonWidget( {
var button = new OO.ui.ButtonWidget( {
Line 9: Line 9:
});
});
button.on( 'click', function () {
button.on( 'click', function () {
alert( 'You clicked the button!' );
//alert( 'You clicked the button!' );
OO.ui.alert( 'Something happened!' ).done( function () {
    console.log( 'User closed the dialog.' );
});
});
});
$( '#mw-content-text' ).append( button.$element );
$( '#mw-content-text' ).append( button.$element );

Revision as of 22:05, 25 November 2021

$(document).ready(function() {
	
	if (mw.config.get('wgPageName') === 'User:Domino/Sandbox') {
		
		mw.loader.using( ['oojs-ui-core', 'oojs-ui-widgets', 'oojs-ui-windows'] ).done( function () {
			$( function () {
				var button = new OO.ui.ButtonWidget( {
					label: 'Click me!'
				});
				button.on( 'click', function () {
					//alert( 'You clicked the button!' );
					OO.ui.alert( 'Something happened!' ).done( function () {
    					console.log( 'User closed the dialog.' );
					});
				});
				$( '#mw-content-text' ).append( button.$element );
			});
		});
		
	}
	
});
This page was last modified on 25 November 2021, at 22:05. (2 years ago)
Background Takeshi by Edo