Index: trunk/phase3/resources/mediawiki.action/mediawiki.action.history.js |
— | — | @@ -50,15 +50,25 @@ |
51 | 51 | }; |
52 | 52 | |
53 | 53 | var fixCompare = function () { |
54 | | - var $histForm = $( '#mw-history-compare' ), |
55 | | - $diffList = $( '#pagehistory' ), |
56 | | - buttonText = $histForm.find( 'input.historysubmit' ).remove().first().val(), |
57 | | - $compareLink = $( '<a></a>', { |
| 54 | + var $diffList = $( '#pagehistory' ), |
| 55 | + $histForm = $( '#mw-history-compare' ), |
| 56 | + $buttons = $histForm.find( 'input.historysubmit' ); |
| 57 | + |
| 58 | + // There's only one rev, nothing to do here |
| 59 | + if ( !$buttons.length ) { |
| 60 | + return false; |
| 61 | + } |
| 62 | + |
| 63 | + var buttonText = $buttons.remove().first().val(), |
| 64 | + $compareLink = $( '<a></a>', { |
58 | 65 | 'class': 'compare-link', |
59 | 66 | 'text': buttonText |
60 | 67 | }).button(); |
61 | | - $histForm.prepend( $compareLink ) |
62 | | - .append( $compareLink.clone() ); |
| 68 | + $histForm.prepend( $compareLink ); |
| 69 | + if ( $buttons.length == 2 ) { |
| 70 | + $histForm.append( $compareLink.clone() ); |
| 71 | + } |
| 72 | + |
63 | 73 | function updateCompare() { |
64 | 74 | var $radio = $histForm.find( 'input[type=radio]:checked' ); |
65 | 75 | var genLink = mw.config.get( 'wgScript' ) |