From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- .../mediawiki.action/mediawiki.action.history.js | 52 ++++++++++++++++++++-- 1 file changed, 49 insertions(+), 3 deletions(-) (limited to 'resources/mediawiki.action/mediawiki.action.history.js') diff --git a/resources/mediawiki.action/mediawiki.action.history.js b/resources/mediawiki.action/mediawiki.action.history.js index 66f90b07..1b5b3a00 100644 --- a/resources/mediawiki.action/mediawiki.action.history.js +++ b/resources/mediawiki.action/mediawiki.action.history.js @@ -1,7 +1,53 @@ /* * JavaScript for History action */ +jQuery( function( $ ) { + var $lis = $( 'ul#pagehistory li' ); + var updateDiffRadios = function() { + var diffLi = false, // the li where the diff radio is checked + oldLi = false; // the li where the oldid radio is checked -// Replaces histrowinit -$( '#pagehistory li input[name=diff], #pagehistory li input[name=oldid]' ).click( diffcheck ); -diffcheck(); \ No newline at end of file + if ( !$lis.length ) { + return true; + } + $lis.removeClass( 'selected' ); + $lis.each( function() { + var $this = $(this); + var $inputs = $this.find( 'input[type="radio"]' ); + if ( $inputs.length !== 2 ) { + return true; + } + + // this row has a checked radio button + if ( $inputs.get(0).checked ) { + oldLi = true; + $this.addClass( 'selected' ); + $inputs.eq(0).css( 'visibility', 'visible' ); + $inputs.eq(1).css( 'visibility', 'hidden' ); + } else if ( $inputs.get(1).checked ) { + diffLi = true; + $this.addClass( 'selected' ); + $inputs.eq(0).css( 'visibility', 'hidden' ); + $inputs.eq(1).css( 'visibility', 'visible' ); + } else { + // no radio is checked in this row + if ( diffLi && oldLi ) { + // We're below the selected radios + $inputs.eq(0).css( 'visibility', 'visible' ); + $inputs.eq(1).css( 'visibility', 'hidden' ); + } else if ( diffLi ) { + // We're between the selected radios + $inputs.css( 'visibility', 'visible' ); + } else { + // We're above the selected radios + $inputs.eq(1).css( 'visibility', 'visible' ); + $inputs.eq(0).css( 'visibility', 'hidden' ); + } + } + }); + return true; + }; + + $( '#pagehistory li input[name="diff"], #pagehistory li input[name="oldid"]' ).click( updateDiffRadios ); + updateDiffRadios(); +}); \ No newline at end of file -- cgit v1.2.3-54-g00ecf