User:DDOstream/vector.js

/* UserCSSJS
 * To make it easy to navigate to your own custom CSS and JS pages
 * Special:MyPage/common.css Special:MyPage/common.js
 * Special:MyPage/vector.css Special:MyPage/vector.js

/* RC long dates */ if( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Recentchanges' ){ var arrDaysOfWeek = [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ]; $( 'div.mw-changeslist h4' ).each( function( n, h4date ) {   var strDate = h4date.innerText;    var thisDay = ( new Date( strDate ) ).getDay;    if ( n === 0 ) {      h4date.id = "today";    } else {      h4date.id = arrDaysOfWeek[ thisDay ] + ( Math.floor( n / 7 ) + 1 );    }    h4date.innerText = arrDaysOfWeek[ thisDay ] + ', ' + strDate;  } ); $( 'fieldset.rcoptions' ).html(   $( 'fieldset.rcoptions' ).html      .replace( ' minor edits | ', ' minor | ' )      .replace( ' anonymous users | ', ' IPs | ' )      .replace( ' registered users | ', ' users | ' )      .replace( ' patrolled edits | ', ' patrolled | ' )      .replace( ' my edits', ' mine' )  ); }

/* De-orpahaning script */ mw.loader.load( '/index.php?title=User:Technical_13/SandBox/DeOrphaner.js&action=raw&ctype=text/javascript' );//User:Technical_13/SandBox/DeOrphaner.js

/* NOW LIVE */ mw.loader.load( '/index.php?title=User:DDOstream/LiveStream.js&action=raw&ctype=text/javascript' );//User:DDOstream/LiveStream.js

//mw.loader.load( '/index.php?title=MediaWiki:Gadget-delete.js&action=raw&ctype=text/javascript' );//MediaWiki:Gadget-delete.js

/* BD */// Testing new code for "Better Diffs" $( '.diff-otitle' ).append( ' -' + $( '.diff-deletedline' ).text.length + ' ' ); $( '.diff-ntitle' ).append( ' +' + $( '.diff-addedline' ).text.length + ' ' ); var intDiff = $( '.diff-addedline' ).text.length - $( '.diff-deletedline' ).text.length; $( '.diff-otitle' ).parents( 'tr' ).after( ' Change this edit: = 500 ? 'bold' : 'inherit' ) + ';">' + intDiff + '   '  );

/* fixes for T:Unique enchantment changes */ // $( document ).ready( function { var pageid = mw.config.get( 'wgArticleId' );  var editSummary = 'Modifications for changes in  T:Unique enchantment';  var pageContent = '';  mw.util.addPortletLink( 'p-tb-list', '#',   'Fix Enchantments', 'ca-fix-ue', 'Update for modifications to T:Unique enchantment', null, null ); $( '#ca-fix-ue' ).click( function ( e ) { e.preventDefault; new mw.Api.get( {     action: 'query',      prop: 'revisions|info',      rvprop: 'content',      pageids: pageid,      indexpageids: 1    } ).done( function ( pageResponse ) {      pageContent = pageResponse.query.pages[ pageid ].revisions[ 0 ][ '*' ];      pageContent = pageContent        .replace( /[\s\r\n]*?\{\{Unique[ _]enchantment/gi, '{{Unique enchantment' )        .replace( /[\s\r\n]*?\| *?name *?= *?/g,   '\n  | name   = ' )        .replace( /[\s\r\n]*?\| *?effect *?= *?/g, '\n  | effect = ' )        .replace( /[\s\r\n]*?\| *?found *?= *?/g,  '\n  | found  = ' )        .replace( /[\s\r\n]*?\| *?note *?= *?/g,   '\n  | note   = ' )        .replace( /\[http:\/\/forums\.ddo\.com\/showthread\.php\?t=([\d]*)(.*?)\]/, '{{Forums|$1}}' )        .replace( /={1} */g,                                   '\= ' )        .replace( /[\s\r\n]*?\}\}\{\{/g,                  '\n}}\n', nextTemplateStart + 2 ); founds++; } else { if ( founds > 1 ) { alert( '\t\t|found=\t\t\n\nOkay, I won\'t remove any more "found" line(s)' ); } else { alert( '\t\t|found=\t\t\n\nOkay, I won\'t remove any "found" line(s)' ); }         break; }     }      new mw.Api.postWithToken( 'edit', {        action: 'edit',        pageid: pageid,        text: pageContent,        summary: editSummary      } ).done( function ( tagged ) {         if ( tagged.edit.result === 'Success' ) {          alert( 'Page was updated!' );          location.href = location.href.replace( location.hash, '' ) + ( location.search ? '&' : '?' ) + 'diff=last';       } else {          alert( 'Page was NOT updated!' );        }      } ); // console.log( pageContent ); } ); } ); } ); //