Index: trunk/phase3/includes/diff/DifferenceEngine.php |
— | — | @@ -30,6 +30,10 @@ |
31 | 31 | var $mCacheHit = false; // Was the diff fetched from cache? |
32 | 32 | var $htmldiff; |
33 | 33 | |
| 34 | + // If true, line X is not displayed when X is 1, for example to increase |
| 35 | + // readability and conserve space with many small diffs. |
| 36 | + protected $mReducedLineNumbers = false; |
| 37 | + |
34 | 38 | protected $unhide = false; |
35 | 39 | /**#@-*/ |
36 | 40 | |
— | — | @@ -80,6 +84,10 @@ |
81 | 85 | $this->unhide = $unhide; |
82 | 86 | } |
83 | 87 | |
| 88 | + function setReducedLineNumbers( $value = true ) { |
| 89 | + $this->mReducedLineNumbers = $value; |
| 90 | + } |
| 91 | + |
84 | 92 | function getTitle() { |
85 | 93 | return $this->mTitle; |
86 | 94 | } |
— | — | @@ -637,10 +645,16 @@ |
638 | 646 | */ |
639 | 647 | function showDiffStyle() { |
640 | 648 | global $wgStylePath, $wgStyleVersion, $wgOut; |
| 649 | + |
| 650 | + static $styleDone = false; |
| 651 | + if ( $styleDone === $wgOut ) return; |
| 652 | + |
641 | 653 | $wgOut->addStyle( 'common/diff.css' ); |
642 | 654 | |
643 | 655 | // JS is needed to detect old versions of Mozilla to work around an annoyance bug. |
644 | 656 | $wgOut->addScript( "<script type=\"text/javascript\" src=\"$wgStylePath/common/diff.js?$wgStyleVersion\"></script>" ); |
| 657 | + |
| 658 | + $styleDone = $wgOut; |
645 | 659 | } |
646 | 660 | |
647 | 661 | /** |
— | — | @@ -842,6 +856,7 @@ |
843 | 857 | |
844 | 858 | function localiseLineNumbersCb( $matches ) { |
845 | 859 | global $wgLang; |
| 860 | + if ( $matches[1] === '1' && $this->mReducedLineNumbers ) return ''; |
846 | 861 | return wfMsgExt( 'lineno', 'escape', $wgLang->formatNum( $matches[1] ) ); |
847 | 862 | } |
848 | 863 | |