User:Magnus Manske/sifter.js

/*

To install:

to the page to force-reload the page once to activate the JavaScript) and links to the partner (here: EOL) page, as well as the reviewer page
 * Get account on en.wikipedia.org
 * Go to http://en.wikipedia.org/wiki/Special:Mypage/vector.js
 * Add the line importScript('User:Magnus Manske/sifter.js');
 * Go to (for example) http://en.wikipedia.org/wiki/Gulf_Snapping_Turtle
 * Behold the "Reviews" tab next to "Read" (on the right; you may have
 * Click on the "Reviews" tab to get a list of all reviewed revisions,

Known issues: See http://en.wikipedia.org/wiki/User:Magnus Manske/sifter



var sifter_html ; var sifter_old_content ; var sifter_active = false;

$(document).ready( function{ if ( mw.config.get('wgNamespaceNumber') != 0 ) return ; // Nevermind...  var url = "http://toolserver.org/~magnus/sifter_api.php?query=wikipage&page=" + mw.config.get('wgPageName') + "&format=json&callback=?" ;  $.getJSON ( url, function (data) { if ( data.length > 0 ) create_sifter_menu ( data ) ; } ) ; }) ;

function create_sifter_menu ( data ) { var html = " Reviews " ; $('#p-views ul').prepend ( html ) ;

sifter_html = " Reviews " ; sifter_html += " Restore page " ; }

function show_sifter_dialog ( mode ) { if ( mode == 1 && !sifter_active ) { sifter_old_content = $('#content').html; $('#content').html(sifter_html); $('#p-views li').removeClass ( 'selected' ) ; $('#sifter_menu').addClass ( 'selected' ) ; sifter_active = true; } if ( mode == 2 ) { $('#content').html(sifter_old_content); $('#sifter_menu').removeClass ( 'selected' ) ; $('#ca-view').addClass ( 'selected' ) ; sifter_active = false; } return false ; }