User:Technical 13/vector.js

/* Remind me to log out when at school */ importScript( 'User:Technical_13/Scripts/logout.js' );

/* Test for adding links in diffs */ if( $( 'table.diff' ).length != 0 ) { if( $( 'table.diff' ).text.match( /([\d\w\s]*?)\.(jpg|png|jpeg|bmp)/gi ) != null ) { Array.prototype.unique = function( a ) { return function{ return this.filter( a ) } }( function( a, b, c ){ return c.indexOf( a, b+1 ) < 0 } ); var linkedHTML = ''; var linkedText = $('table.diff').text.match(/([\d\w\s:]*?)\.(jpg|png|jpeg|bmp)/gi); console.log('linkedText: %s', linkedText); var linkDestination = $('table.diff').text.match(/([\d\w\s]*?)\.(jpg|png|jpeg|bmp)/gi); console.log('linkDestination: %s', linkDestination); linkedText = linkedText.unique; console.log('unique linkedText: %s', linkedText); linkDestination= linkDestination.unique; console.log('unique linkDestination: %s', linkDestination); for(var i=0; i<linkedText.length; i++){ linkedText[i] = linkedText[i].trim; console.log('linkedText[%d]: %s', i, linkedText[i]); linkedHTML = $('table.diff').html.closest(':contains(linkDestination[i].substr(0, (linkDestination[i].length - 4)))'); console.log('linkedHTML: %s', linkedHTML); linkDestination[i] = linkDestination[i].trim; console.log('linkDestination[%d]: %s', i, linkDestination[i]); //			$('table.diff').html($('table.diff').html.replace(linkedHTML[i], '' + linkedHTML[i] + '')); console.log('.replace: %s ::with: %s', linkedHTML[i], linkDestination[i], linkedText[i], linkedHTML[i]); }	} }

/* QL *//* Testing for Template:Quest list and MediaWiki:Template-Quest list.js */ importScript( 'MediaWiki:Template-Quest list.js' );

/* 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 ); } ); } ); //} ); //