User:Happy-melon/vector.js

var CodeReviewScapmap = function ( $ ) { var above = document.forms[0]; // stick above the first form, no IDs on the forms currently! var $tr = $('table.TablePager tr'); if( $tr.size < 2 || $('#overviewmap').size ) { return; }

var overviewPopupData;

var $output = $( ' '); //addHandler( document, 'mousemove', mouseMoveBox ); var vpath = $( '#path' ).val; var totals = {}; $tr.each( function{		var live = 'notlive';		var status = false;

var trc = $(this).attr( 'class' ).split(' '); if( !trc.length ) { return; }		for( var j = 0; j < trc.length; j++ ) { // WMF doesn't use live/not live ATM // if( /mw\-codereview\-(not|)live/.test( trc[j] ) ) // 	live = trc[j].substring( 14 ); if( trc[j].substring( 0, 21 ) == 'mw-codereview-status-' ) { status = trc[j].substring( 21 ); }		}		var $td = $( 'td', $(this) );

var statusname = $td.filter( '.TablePager_col_cr_status' ).text;

if( !statusname || !status || !live ) { return; }

overviewPopupData[i] = {}; overviewPopupData[i]['status'] = status; overviewPopupData[i]['statusname'] = statusname; overviewPopupData[i]['notes'] = $td.filter( '.TablePager_col_comments' ).text; overviewPopupData[i]['author'] = $td.filter( '.TablePager_col_cr_author' ).text;

var rev = $td.filter( '.TablePager_col_cr_id, .TablePager_col_cp_rev_id' ).text; overviewPopupData[i]['rev'] = rev;

var path = $td.filter( '.TablePager_col_cr_path' ).text; if( path && path.indexOf( vpath ) == 0 && path != vpath && vpath != '' ) { path = '\u2026' + path.substring( vpath.length ); }		overviewPopupData[i]['path'] = path;

//overviewPopupData[i]['live'] = live; if( !totals[statusname] ) { totals[statusname] = 0; }		//if( !totals[live] ) { //	totals[live] = 0; //}		totals[statusname]++; //totals[live]++;

$tr.attr( 'id', 'TablePager-row-' + rev );

var top = $( '^' ); $td.filter( '.TablePager_col_cr_id, .TablePager_col_cp_rev_id' ).append( top );

var $box = $( '<a href="#TablePager-row-"' + rev + '" class="box-status-' + status + '" id="box-' + i + '"' );		// box.appendChild( document.createTextNode( live ) );		$output.append( $box );	});

var $summary = $( ' ' ); var sumtext = []; for( var i in totals ) { if( typeof i != 'string' || typeof totals[i] != 'number' ) { continue; }		sumtext.push( i + ': ' + totals[i] ); }	sumtext.sort; $summary.text( 'Total revisions: ' + ( $tr.size - 1 ) + '. [' + sumtext.join(', ') + ']' ); $output.append( $summary );

$output.append( $( ' ' ) );

$( '#contentSub' ).after( $output ); }; jQuery( document ).ready( CodeReviewScapmap );