MediaWiki
Gadget-sandbox.js
From Dogcraft Wiki
(-) |
m (-) |
||
Line 9: | Line 9: | ||
classes: [ 'confirm-sandbox' ] | classes: [ 'confirm-sandbox' ] | ||
}); | }); | ||
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 () { | /*OO.ui.alert( 'Something happened!' ).done( function () { | ||
console.log( 'User closed the dialog.' ); | console.log( 'User closed the dialog.' ); | ||
});*/ | });*/ | ||
/*OO.ui.confirm( 'Are you sure?' ).done( function ( confirmed ) { | |||
if ( confirmed ) { | |||
console.log( 'User clicked "OK"!' ); | |||
} else { | |||
console.log( 'User clicked "Cancel" or closed the dialog.' ); | |||
} | |||
}); | |||
});*/ | |||
$( '#mw-content-text' ).append( button.$element ); | |||
$( '.page-User_Domino_Sandbox a[href="https://discord.gg/r5xDRcy"]' ).on('click', function () { | |||
OO.ui.confirm( 'Are you sure?' ).done( function ( confirmed ) { | OO.ui.confirm( 'Are you sure?' ).done( function ( confirmed ) { | ||
if ( confirmed ) { | if ( confirmed ) { | ||
console.log( 'User clicked "OK"!' ); | console.log( 'User clicked "OK"!' ); | ||
return true; | |||
} else { | } else { | ||
console.log( 'User clicked "Cancel" or closed the dialog.' ); | console.log( 'User clicked "Cancel" or closed the dialog.' ); | ||
return false; | |||
} | } | ||
}); | }); | ||
}) | }) | ||
}); | }); | ||
}); | }); |
Revision as of 22:38, 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!',
classes: [ 'confirm-sandbox' ]
});
//button.on( 'click', function () {
//alert( 'You clicked the button!' );
/*OO.ui.alert( 'Something happened!' ).done( function () {
console.log( 'User closed the dialog.' );
});*/
/*OO.ui.confirm( 'Are you sure?' ).done( function ( confirmed ) {
if ( confirmed ) {
console.log( 'User clicked "OK"!' );
} else {
console.log( 'User clicked "Cancel" or closed the dialog.' );
}
});
});*/
$( '#mw-content-text' ).append( button.$element );
$( '.page-User_Domino_Sandbox a[href="https://discord.gg/r5xDRcy"]' ).on('click', function () {
OO.ui.confirm( 'Are you sure?' ).done( function ( confirmed ) {
if ( confirmed ) {
console.log( 'User clicked "OK"!' );
return true;
} else {
console.log( 'User clicked "Cancel" or closed the dialog.' );
return false;
}
});
})
});
});
}
});
This page was last modified on 25 November 2021, at 22:38. (2 years ago)