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!
MediaWiki:Gadget-DeOrphaner.js
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
//<nowiki>
if ( mw.config.get( 'wgNamespaceNumber' ) === 0 && mw.config.get( 'wgAction' ) === 'view' &&
$.inArray( 'All orphaned articles', mw.config.get( 'wgCategories' ) ) >= 0 ) {
function deOrphan( backLinks ) {
$( '.loadingAnimation' ).html( $( '.loadingAnimation' ).html() + '<br />Article deOrphaning in progress...' );
( new mw.Api ).get( {
action: 'query',
titles: mw.config.get( 'wgPageName' ),
prop: 'revisions',
rvprop: 'content',
indexpageids: 1,
format: 'json'
} ).done( function( getResponse ) {
var qryResponse = getResponse.query.pages[ getResponse.query.pageids[ 0 ] ];
var deOrphanerContent = qryResponse.revisions[ 0 ][ "*" ];
var oldMIparameter = false;
if ( deOrphanerContent.search( /\| *Orphan *=[\d\w\s\n]*(.*?\}\})/gi ) != -1 ) {
oldMIparameter = true;
}
deOrphanerContent = deOrphanerContent
.replace( /\{\{Orphan(.*?)\}\}[\|\r\n]+/gi, '' )// Parse out {{Orphan}} (not) in multiple issues
.replace( /\| *Orphan *=[\d\w\s\n]*(.*?\}\})/gi, '$1' );// Parse out old style multiple issues orphan parameter
( new mw.Api ).postWithToken( 'edit', {
action: 'edit',
pageid: mw.config.get( 'wgArticleId' ),
text: deOrphanerContent,
summary: 'Article [[MediaWiki:Gadget-DeOrphaner|deOrphaned]]!'
} ).done( function( editResponse ) {
console.log( '%o', editResponse );// Make sure responses are sent to the console until I figure out what errors can occur.
var deOrphanedText = $( '.loadingAnimation' ).html() + '<br />Article deOrphaned! <small>( ';
if ( oldMIparameter ) {
deOrphanedText += '<b style="font-variant: small-caps;">Load</b> ';
}
else {
deOrphanedText += '<a href="#reLoad" onClick="location.reload();" style="font-weight: bold;">reload</a> | ';
}
deOrphanedText += '<a href="https://ddowiki.com/index.php?title=' + encodeURIComponent( mw.config.get( 'wgTitle' ) ) + '&diff=cur&oldid=prev" style="font-weight: bold;">diff</a> )</small>';
$( '.loadingAnimation' ).html( deOrphanedText );
} );
} );
}
$( '#Mbox-Orphan' ).css( 'display', 'none' );
$( '#Mbox-Orphan' ).prev( 'p' ).css( 'display', 'none' );
$( '#Mbox-Orphan' ).next( 'p' ).css( 'display', 'none' );
$( '#firstHeading' ).append( '<br /><span class="loadingAnimation" style="font-size: medium !important; color: #000000 !important; font-family: sans-serif !important;">• • • </span> ' );
var loadingAnimation = window.setInterval( function() { (
$( '.loadingAnimation' ).html() == "• • • " ?
$( '.loadingAnimation' ).html( ' • • • ' ) : (
$( '.loadingAnimation' ).html() == " • • • " ?
$( '.loadingAnimation' ).html( ' • • •' ) : (
$( '.loadingAnimation' ).html() == " • • •" ?
$( '.loadingAnimation' ).html( ' • • • ' ) :
$( '.loadingAnimation' ).html( '• • • ' )
)
)
) }, 250);
( new mw.Api ).get( {
action: 'query',
list: 'backlinks',
format: 'json',
blfilterredir: 'nonredirects',
bllimit: 500,
blnamespace: 0,
bltitle: mw.config.get( 'wgTitle' )
} ).done( function( responseBacklinks ) {
var backLinks = responseBacklinks.query.backlinks.length;
switch ( backLinks ) {
case 0:
var blStatement = 'This page is an <a href="http://enwp.org/WP:Orphan" style="font-weight: bold;">orphan</a> as no <a href="https://ddowiki.com/index.php?title=Special:WhatLinksHere/' + encodeURIComponent( mw.config.get( 'wgTitle' ) ) + '&namespace=0&hideredirs=1&hidetrans=1" style="font-weight: bold;">other articles</a> link to it.';
break;
case 1:
var blStatement = 'There is <b>a link to this page</b> from an <a href="https://ddowiki.com/index.php?title=Special:WhatLinksHere/' + encodeURIComponent( mw.config.get( 'wgTitle' ) ) + '&namespace=0&hideredirs=1&hidetrans=1" style="font-weight: bold;">other article</a>. <small>(<a href="#deOrphan" onClick="deOrphan(' + backLinks + ');" style="font-weight: bold;">deOrphan</a>)</small>';
break;
case 2:
var blStatement = 'There are <b>two links to this page</b> from <a href="https://ddowiki.com/index.php?title=Special:WhatLinksHere/' + encodeURIComponent( mw.config.get( 'wgTitle' ) ) + '&namespace=0&hideredirs=1&hidetrans=1" style="font-weight: bold;">other articles</a>. <small>(<a href="#deOrphan" onClick="deOrphan(' + backLinks + ');" style="font-weight: bold;">deOrphan</a>)</small>';
break;
default:
var blStatement = 'This page is not an <a href="http://enwp.org/WP:Orphan" style="font-weight: bold;">orphan</a> as it meets the "Rule of Three" by having three or more links from <a href="https://ddowiki.com/index.php?title=Special:WhatLinksHere/' + encodeURIComponent( mw.config.get( 'wgTitle' ) ) + '&namespace=0&hideredirs=1&hidetrans=1" style="font-weight: bold;">other articles</a>. <small>(<a href="#deOrphan" onClick="deOrphan(' + backLinks + ');" style="font-weight: bold;">deOrphan</a>)</small>';
// setTimeout( function() { deOrphan( backLinks ); }, 2500 );
break;
}
clearInterval( loadingAnimation );
$( '.loadingAnimation' ).html( blStatement );
} );
}
// </nowiki> [[C:Gadgets]]