Year of the Dragon: Through April 23rd, claim the adventure pack Slice of Life for free! Speak to Xatheral in the Hall of Heroes.
Game mechanics • Newbie guide • In development • DDO Store • Social Media
Challenges • Classes • Collectables • Crafting • Enhancements • Epic Destinies • Favor • Feats
Glossary • Items • Maps • Monsters • Places • Quests • Races • Reincarnation • Skills • Spells
Please create an account or log in to build a reputation and unlock more editing privileges, and then visit DDO wiki's IRC Chat/Discord if you need any help!
User:Technical 13/SandBox/DeOrphaner.js
< User:Technical 13 | SandBox
Jump to navigation
Jump to search
Note: After saving, you may have to bypass your browser's cache to see the changes, you can click here or try one of the methods below..
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl+F5 or Ctrl+r (⌘ Command+r on a Mac)
- Google Chrome: Press Ctrl+⇧ Shift+R (⌘ Command+⇧ Shift+R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl+F5
- Konqueror: Click Reload or press F5
- Opera: Clear the cache in Tools ‣ Preferences
var isBeta = false;
var strGadgetName = 'DeOrphaner';
if ( isBeta ) {
var isUsingGadget = mw.user.options.get( 'gadget-' + strGadgetName );
function setGadget( useGadget = ( mw.user.options.get( 'gadget-' + strGadgetName ) == undefined ? true : false ) ) {
var strNotify, strChange;
if ( useGadget ) {
strChange = 'gadget-' + strGadgetName + '=1';
strNotify = '<p><hr /><br />The gadget has been successfully enabled.</p>';
}
else {
strChange = 'gadget-' + strGadgetName + '=0';
strNotify = '<p><hr /><br />The gadget has been successfully disabled, click <a href="#" onClick="setGadget( true );"><b>undo</b></a> or visit <a href="https://ddowiki.com/page/Special:Preferences#mw-prefsection-gadgets">your gadgets</a> to re-enable it.</p>';
}
( new mw.Api() ).postWithToken( 'options', {
action: 'options',
change: strChange
} ).done( function ( data ) {
if ( data.warnings == undefined ) {
mw.notify( $( strNotify ), { title: strGadgetName + ( useGadget ? ' enabled' : ' disabled' ) + '!', autoHide: false } );
}
else {
strNotify = '<p><hr /><br />Unable to ' + ( useGadget ? 'enable' : 'disable' ) + ' gadget:<br />';
strNotify += '<b style="color: #CC0000;">' + data.warnings.options[ '*' ] + '</b></p>';
mw.notify( $( strNotify ), { title: strGadgetName + ' toggle failed!', autoHide: false } );
}
} );
}
async function getUserSkinJSContent() {
return await ( new mw.Api() ).get( {
action: 'query',
titles: 'User:' + mw.config.get( 'wgUserName' ) + '/' + mw.user.options.get( 'skin' ) + '.js',
prop: 'revisions',
rvprop: 'content',
indexpageids: true
} ).done( function( data ) {
var qry = data.query;
return qry.pages[ qry.pageids[ 0 ] ].revisions[ 0 ][ "*" ];
} );
}
var qryUseBeta = ( isUsingGadget ? confirm( 'This userscript has been turned into a Gadget,\n\tPress [OK] to switch to the gadget or [Cancel] to use the beta script.' ) : false );
if ( qryUseBeta ) {
setGadget( true );
/*
( new mw.Api() ).postWithToken( 'edit', {
action: 'edit',
title: 'User:' + mw.config.get( 'wgUserName' ) + '/' + mw.user.options.get( 'skin' ) + '.js',
summary: 'Commenting out use of ' + + ' beta script.',
minor: true,
bot: true,
nocreate: true,
text: await getUserSkinJSContent().replace( /((?:importScript|mw\.loader\.load)\( *['"](?:(?:http:)?\/\/ddowiki\.com\/index\.php\?title=)U(?:ser):Technical_13\/SandBox\/DeOrphaner.js(?:&action=raw&ctype=text\/javascript)?["'] *\))/gi, '//$1' )
} ).done( function( data ) {
} );//*/
}
else {
setGadget( false );
}
}