MediaWiki:Vector.js

/* Any JavaScript here will be loaded for users using the Vector skin */

function deleteLogEntry( entryID, delLogReason ) { var reasonDelLog = 'Vandalism only account. Removing '; switch ( delLogReason ) { case 'phone' : reasonDelLog += 'possible phone number '; case 'long' : reasonDelLog += 'long page name '; default : reasonDelLog += 'plausible '; }   reasonDelLog += 'RC spam with DeSpammer.'; ( new mw.Api ).postWithToken( 'delete', {     action: 'revisiondelete',      type: 'logging',      ids: entryID,      hide: 'content',      reason: reasonDelLog    } ).done( function( rdResult ) {      console.log( '%o', rdResult );      $( 'a#logID-' + entryID ).text( 'log cleaned' ).removeAttr( 'onclick' ).removeAttr( 'style' ).removeAttr( 'title' );// Might change this later so the onclick takes you to the log entry to review it.    } ); }

/* ************************************************************** */ /* Allow "Random page" link in Sidebar to work for anon /* readers despite system caching setup. /* /* Author: User:Technical_13 /* Date:  2022/08/04 /* //*/

if ( mw.config.get( 'wgUserName' ) === null ) { ( new mw.Api ).get( {     action : 'query',      list   : 'random',      format : 'json',      rnlimit: 'max'    } ).done( data => {      var titles = [];      data.query.random.forEach( res => { titles.push( res.title.replace( / /g, '_' ) ); } );      $( 'li#n-Random-page > a')[ 0 ].href = 'https://ddowiki.com/page/' + titles[ Math.floor( Math.random * data.query.random.length - 1 ) ];          } ); }