Index: trunk/phase3/skins/common/enhancedchanges.js |
— | — | @@ -0,0 +1,40 @@ |
| 2 | +/* |
| 3 | + JavaScript file for enhanced recentchanges |
| 4 | + */ |
| 5 | + |
| 6 | +/* |
| 7 | + * Add the CSS to hide parts that should be collapsed |
| 8 | + * |
| 9 | + * We do this with JS so everything will be expanded by default |
| 10 | + * if JS is disabled |
| 11 | + */ |
| 12 | +appendCSS('.mw-changeslist-hidden {'+ |
| 13 | + ' display:none;'+ |
| 14 | + '}'+ |
| 15 | + 'div.mw-changeslist-expanded {'+ |
| 16 | + ' display:block;'+ |
| 17 | + '}'+ |
| 18 | + 'span.mw-changeslist-expanded {'+ |
| 19 | + ' display:inline !important;'+ |
| 20 | + ' visibility:visible !important;'+ |
| 21 | + '}' |
| 22 | +); |
| 23 | + |
| 24 | +/* |
| 25 | + * Switch an RC line between hidden/shown |
| 26 | + * @param int idNumber : the id number of the RC group |
| 27 | +*/ |
| 28 | +window.toggleVisibility = function(idNumber) { |
| 29 | + var openarrow = document.getElementById("mw-rc-openarrow-"+idNumber); |
| 30 | + var closearrow = document.getElementById("mw-rc-closearrow-"+idNumber); |
| 31 | + var subentries = document.getElementById("mw-rc-subentries-"+idNumber); |
| 32 | + if (openarrow.className == 'mw-changeslist-expanded') { |
| 33 | + openarrow.className = 'mw-changeslist-hidden'; |
| 34 | + closearrow.className = 'mw-changeslist-expanded'; |
| 35 | + subentries.className = 'mw-changeslist-expanded'; |
| 36 | + } else { |
| 37 | + openarrow.className = 'mw-changeslist-expanded'; |
| 38 | + closearrow.className = 'mw-changeslist-hidden'; |
| 39 | + subentries.className = 'mw-changeslist-hidden'; |
| 40 | + } |
| 41 | +}; |
Property changes on: trunk/phase3/skins/common/enhancedchanges.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 42 | + native |
Index: trunk/phase3/skins/common/shared.css |
— | — | @@ -831,6 +831,18 @@ |
832 | 832 | word-wrap: break-word; |
833 | 833 | } |
834 | 834 | |
| 835 | +table.mw-enhanced-rc { |
| 836 | + background: none; |
| 837 | + border:0; |
| 838 | + border-spacing:0; |
| 839 | +} |
| 840 | +td.mw-enhanced-rc { |
| 841 | + white-space:nowrap; |
| 842 | + padding:0; |
| 843 | + vertical-align:top; |
| 844 | + font-family:monospace |
| 845 | +} |
| 846 | + |
835 | 847 | #mw-addcategory-prompt { |
836 | 848 | display: inline; |
837 | 849 | margin-left: 1em; |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -1617,7 +1617,7 @@ |
1618 | 1618 | $sk = $wgUser->getSkin(); |
1619 | 1619 | |
1620 | 1620 | // Add base resources |
1621 | | - $this->addModules( array( 'mediawiki.legacy.wikibits', 'mediawiki.util', 'skins.common' ) ); |
| 1621 | + $this->addModules( array( 'mediawiki.legacy.wikibits', 'mediawiki.util' ) ); |
1622 | 1622 | |
1623 | 1623 | // Add various resources if required |
1624 | 1624 | if ( $wgUseAjax ) { |
Index: trunk/phase3/includes/ChangesList.php |
— | — | @@ -30,7 +30,7 @@ |
31 | 31 | class ChangesList { |
32 | 32 | public $skin; |
33 | 33 | protected $watchlist = false; |
34 | | - |
| 34 | + |
35 | 35 | /** |
36 | 36 | * Changeslist contructor |
37 | 37 | * @param $skin Skin |
— | — | @@ -81,19 +81,21 @@ |
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
| 85 | + |
85 | 86 | /** |
86 | 87 | * Returns the appropriate flags for new page, minor change and patrolling |
87 | | - * @param $flags Associative array of 'flag' => Bool |
| 88 | + * @param $new Boolean |
| 89 | + * @param $minor Boolean |
| 90 | + * @param $patrolled Boolean |
88 | 91 | * @param $nothing String to use for empty space |
| 92 | + * @param $bot Boolean |
89 | 93 | * @return String |
90 | 94 | */ |
91 | | - protected function recentChangesFlags( $flags, $nothing = ' ' ) { |
92 | | - $f = ''; |
93 | | - foreach( array( 'newpage', 'minor', 'bot', 'unpatrolled' ) as $flag ){ |
94 | | - $f .= isset( $flags[$flag] ) && $flags[$flag] |
95 | | - ? self::flag( $flag ) |
96 | | - : $nothing; |
97 | | - } |
| 95 | + protected function recentChangesFlags( $new, $minor, $patrolled, $nothing = ' ', $bot = false ) { |
| 96 | + $f = $new ? self::flag( 'newpage' ) : $nothing; |
| 97 | + $f .= $minor ? self::flag( 'minor' ) : $nothing; |
| 98 | + $f .= $bot ? self::flag( 'bot' ) : $nothing; |
| 99 | + $f .= $patrolled ? self::flag( 'unpatrolled' ) : $nothing; |
98 | 100 | return $f; |
99 | 101 | } |
100 | 102 | |
— | — | @@ -109,18 +111,22 @@ |
110 | 112 | public static function flag( $key ) { |
111 | 113 | static $messages = null; |
112 | 114 | if ( is_null( $messages ) ) { |
113 | | - $messages = array( |
114 | | - 'newpage' => array( 'newpageletter', 'recentchanges-label-newpage' ), |
115 | | - 'minor' => array( 'minoreditletter', 'recentchanges-label-minor' ), |
116 | | - 'bot' => array( 'boteditletter', 'recentchanges-label-bot' ), |
117 | | - 'unpatrolled' => array( 'unpatrolledletter', 'recentchanges-label-unpatrolled' ), |
118 | | - ); |
119 | | - foreach( $messages as $key => &$value ) { |
120 | | - $value[0] = wfMsgExt( $value[0], 'escapenoentities' ); |
121 | | - $value[1] = wfMsgExt( $value[1], 'escapenoentities' ); |
| 115 | + foreach ( explode( ' ', 'minoreditletter boteditletter newpageletter ' . |
| 116 | + 'unpatrolledletter recentchanges-label-minor recentchanges-label-bot ' . |
| 117 | + 'recentchanges-label-newpage recentchanges-label-unpatrolled' ) as $msg ) { |
| 118 | + $messages[$msg] = wfMsgExt( $msg, 'escapenoentities' ); |
122 | 119 | } |
123 | 120 | } |
124 | | - return "<abbr class='$key' title='" . $messages[$key][1] . "'>" . $messages[$key][0] . '</abbr>'; |
| 121 | + # Inconsistent naming, bleh |
| 122 | + if ( $key == 'newpage' || $key == 'unpatrolled' ) { |
| 123 | + $key2 = $key; |
| 124 | + } else { |
| 125 | + $key2 = $key . 'edit'; |
| 126 | + } |
| 127 | + return "<abbr class=\"$key\" title=\"" |
| 128 | + . $messages["recentchanges-label-$key"] . "\">" |
| 129 | + . $messages["${key2}letter"] |
| 130 | + . '</abbr>'; |
125 | 131 | } |
126 | 132 | |
127 | 133 | /** |
— | — | @@ -501,15 +507,8 @@ |
502 | 508 | } else { |
503 | 509 | $this->insertDiffHist( $s, $rc, $unpatrolled ); |
504 | 510 | # M, N, b and ! (minor, new, bot and unpatrolled) |
505 | | - $s .= $this->recentChangesFlags( |
506 | | - array( |
507 | | - 'new' => $rc->mAttribs['rc_new'], |
508 | | - 'minor' => $rc->mAttribs['rc_minor'], |
509 | | - 'unpatrolled' => $unpatrolled, |
510 | | - 'bot' => $rc->mAttribs['rc_bot'] |
511 | | - ), |
512 | | - '' |
513 | | - ); |
| 511 | + $s .= $this->recentChangesFlags( $rc->mAttribs['rc_new'], $rc->mAttribs['rc_minor'], |
| 512 | + $unpatrolled, '', $rc->mAttribs['rc_bot'] ); |
514 | 513 | $this->insertArticleLink( $s, $rc, $unpatrolled, $watched ); |
515 | 514 | } |
516 | 515 | # Edit/log timestamp |
— | — | @@ -567,7 +566,7 @@ |
568 | 567 | $this->rcCacheIndex = 0; |
569 | 568 | $this->lastdate = ''; |
570 | 569 | $this->rclistOpen = false; |
571 | | - $wgOut->addModuleStyles( 'mediawiki.special.changeslist' ); |
| 570 | + $wgOut->addModules( 'mediawiki.legacy.enhancedchanges' ); |
572 | 571 | return ''; |
573 | 572 | } |
574 | 573 | /** |
— | — | @@ -740,9 +739,9 @@ |
741 | 740 | # Add the namespace and title of the block as part of the class |
742 | 741 | if ( $block[0]->mAttribs['rc_log_type'] ) { |
743 | 742 | # Log entry |
744 | | - $classes = 'collapsible collapsed mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-log-' . $block[0]->mAttribs['rc_log_type'] . '-' . $block[0]->mAttribs['rc_title'] ); |
| 743 | + $classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-log-' . $block[0]->mAttribs['rc_log_type'] . '-' . $block[0]->mAttribs['rc_title'] ); |
745 | 744 | } else { |
746 | | - $classes = 'collapsible collapsed mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-ns' . $block[0]->mAttribs['rc_namespace'] . '-' . $block[0]->mAttribs['rc_title'] ); |
| 745 | + $classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-ns' . $block[0]->mAttribs['rc_namespace'] . '-' . $block[0]->mAttribs['rc_title'] ); |
747 | 746 | } |
748 | 747 | $r = Html::openElement( 'table', array( 'class' => $classes ) ) . |
749 | 748 | Html::openElement( 'tr' ); |
— | — | @@ -805,28 +804,23 @@ |
806 | 805 | $users = ' <span class="changedby">[' . |
807 | 806 | implode( $this->message['semicolon-separator'], $users ) . ']</span>'; |
808 | 807 | |
| 808 | + # ID for JS visibility toggle |
| 809 | + $jsid = $this->rcCacheIndex; |
| 810 | + # onclick handler to toggle hidden/expanded |
| 811 | + $toggleLink = "onclick='toggleVisibility($jsid); return false'"; |
809 | 812 | # Title for <a> tags |
810 | 813 | $expandTitle = htmlspecialchars( wfMsg( 'rc-enhanced-expand' ) ); |
811 | 814 | $closeTitle = htmlspecialchars( wfMsg( 'rc-enhanced-hide' ) ); |
812 | 815 | |
813 | | - $tl = "<span class='collapsible-expander'>" |
814 | | - . "<span class='mw-rc-openarrow'>" |
815 | | - . "<a href='#' title='$expandTitle'>{$this->sideArrow()}</a>" |
816 | | - . "</span><span class='mw-rc-closearrow'>" |
817 | | - . "<a href='#' title='$closeTitle'>{$this->downArrow()}</a>" |
818 | | - . "</span></span>"; |
819 | | - $r .= "<td>$tl</td>"; |
| 816 | + $tl = "<span id='mw-rc-openarrow-$jsid' class='mw-changeslist-expanded' style='visibility:hidden'><a href='#' $toggleLink title='$expandTitle'>" . $this->sideArrow() . "</a></span>"; |
| 817 | + $tl .= "<span id='mw-rc-closearrow-$jsid' class='mw-changeslist-hidden' style='display:none'><a href='#' $toggleLink title='$closeTitle'>" . $this->downArrow() . "</a></span>"; |
| 818 | + $r .= '<td class="mw-enhanced-rc">'.$tl.' '; |
820 | 819 | |
821 | 820 | # Main line |
822 | | - $r .= '<td class="mw-enhanced-rc">' . $this->recentChangesFlags( array( |
823 | | - 'new' => $isnew, |
824 | | - 'minor' => false, |
825 | | - 'unpatrolled' => $unpatrolled, |
826 | | - 'bot' => $bot , |
827 | | - ) ); |
| 821 | + $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, ' ', $bot ); |
828 | 822 | |
829 | 823 | # Timestamp |
830 | | - $r .= ' '.$block[0]->timestamp.' </td><td>'; |
| 824 | + $r .= ' '.$block[0]->timestamp.' </td><td style="padding:0px;">'; |
831 | 825 | |
832 | 826 | # Article link |
833 | 827 | if( $namehidden ) { |
— | — | @@ -914,7 +908,11 @@ |
915 | 909 | $r .= $users; |
916 | 910 | $r .= $this->numberofWatchingusers($block[0]->numberofWatchingusers); |
917 | 911 | |
| 912 | + $r .= "</td></tr></table>\n"; |
| 913 | + |
918 | 914 | # Sub-entries |
| 915 | + $r .= '<div id="mw-rc-subentries-'.$jsid.'" class="mw-changeslist-hidden">'; |
| 916 | + $r .= '<table class="mw-enhanced-rc">'; |
919 | 917 | foreach( $block as $rcObj ) { |
920 | 918 | # Extract fields from DB into the function scope (rc_xxxx variables) |
921 | 919 | // FIXME: Would be good to replace this extract() call with something |
— | — | @@ -924,14 +922,10 @@ |
925 | 923 | extract( $rcObj->mAttribs ); |
926 | 924 | |
927 | 925 | #$r .= '<tr><td valign="top">'.$this->spacerArrow(); |
928 | | - $r .= '<tr><td></td><td class="mw-enhanced-rc">'; |
929 | | - $r .= $this->recentChangesFlags( array( |
930 | | - 'new' => $rc_new, |
931 | | - 'minor' => $rc_minor, |
932 | | - 'unpatrolled' => $rcObj->unpatrolled, |
933 | | - 'bot' => $rc_bot, |
934 | | - ) ); |
935 | | - $r .= ' </td><td class="mw-enhanced-rc-nested"><span class="mw-enhanced-rc-time">'; |
| 926 | + $r .= '<tr><td style="vertical-align:top;font-family:monospace; padding:0px;">'; |
| 927 | + $r .= $this->spacerIndent() . $this->spacerIndent(); |
| 928 | + $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot ); |
| 929 | + $r .= ' </td><td style="vertical-align:top; padding:0px;"><span style="font-family:monospace">'; |
936 | 930 | |
937 | 931 | $params = $queryParams; |
938 | 932 | |
— | — | @@ -989,7 +983,7 @@ |
990 | 984 | |
991 | 985 | $r .= "</td></tr>\n"; |
992 | 986 | } |
993 | | - $r .= "</table>\n"; |
| 987 | + $r .= "</table></div>\n"; |
994 | 988 | |
995 | 989 | $this->rcCacheIndex++; |
996 | 990 | |
— | — | @@ -1042,6 +1036,14 @@ |
1043 | 1037 | } |
1044 | 1038 | |
1045 | 1039 | /** |
| 1040 | + * Add a set of spaces |
| 1041 | + * @return String: HTML <td> tag |
| 1042 | + */ |
| 1043 | + protected function spacerIndent() { |
| 1044 | + return '     '; |
| 1045 | + } |
| 1046 | + |
| 1047 | + /** |
1046 | 1048 | * Enhanced RC ungrouped line. |
1047 | 1049 | * @return String: a HTML formated line (generated using $r) |
1048 | 1050 | */ |
— | — | @@ -1066,19 +1068,14 @@ |
1067 | 1069 | $r = Html::openElement( 'table', array( 'class' => $classes ) ) . |
1068 | 1070 | Html::openElement( 'tr' ); |
1069 | 1071 | |
1070 | | - $r .= '<td class="mw-enhanced-rc">' . $this->spacerArrow(); |
| 1072 | + $r .= '<td class="mw-enhanced-rc">' . $this->spacerArrow() . ' '; |
1071 | 1073 | # Flag and Timestamp |
1072 | 1074 | if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) { |
1073 | 1075 | $r .= '    '; // 4 flags -> 4 spaces |
1074 | 1076 | } else { |
1075 | | - $r .= $this->recentChangesFlags( array( |
1076 | | - 'new' => $rc_type == RC_NEW, |
1077 | | - 'minor' => $rc_minor, |
1078 | | - 'unpatrolled' => $rcObj->unpatrolled, |
1079 | | - 'bot' => $rc_bot |
1080 | | - ) ); |
| 1077 | + $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot ); |
1081 | 1078 | } |
1082 | | - $r .= ' '.$rcObj->timestamp.' </td><td>'; |
| 1079 | + $r .= ' '.$rcObj->timestamp.' </td><td style="padding:0px;">'; |
1083 | 1080 | # Article or log link |
1084 | 1081 | if( $rc_log_type ) { |
1085 | 1082 | $logtitle = Title::newFromText( "Log/$rc_log_type", NS_SPECIAL ); |
Index: trunk/phase3/resources/Resources.php |
— | — | @@ -10,16 +10,6 @@ |
11 | 11 | 'user.options' => array( 'class' => 'ResourceLoaderUserOptionsModule' ), |
12 | 12 | |
13 | 13 | /* Skins */ |
14 | | - |
15 | | - 'skins.common' => array( |
16 | | - 'scripts' => 'resources/skins.common/skins.common.js', |
17 | | - 'styles' => array( |
18 | | - 'resources/skins.common/skins.common.css', |
19 | | - 'resources/skins.common/skins.common.print.css' => array( 'media' => 'print' ) |
20 | | - ), |
21 | | - 'messages' => array( 'hide', 'show' ), |
22 | | - 'dependencies' => array( 'jquery.effects.fade' ), |
23 | | - ), |
24 | 14 | |
25 | 15 | 'skins.vector' => array( |
26 | 16 | 'styles' => array( 'skins/vector/screen.css' => array( 'media' => 'screen' ) ) |
— | — | @@ -308,10 +298,6 @@ |
309 | 299 | 'scripts' => 'resources/jquery.effects/jquery.effects.explode.js', |
310 | 300 | 'dependencies' => 'jquery.effects.core', |
311 | 301 | ), |
312 | | - 'jquery.effects.fade' => array( |
313 | | - 'scripts' => 'resources/jquery.effects/jquery.effects.fade.js', |
314 | | - 'dependencies' => 'jquery.effects.core', |
315 | | - ), |
316 | 302 | 'jquery.effects.fold' => array( |
317 | 303 | 'scripts' => 'resources/jquery.effects/jquery.effects.fold.js', |
318 | 304 | 'dependencies' => 'jquery.effects.core', |
— | — | @@ -368,9 +354,6 @@ |
369 | 355 | 'scripts' => 'resources/mediawiki.special/mediawiki.special.preferences.js', |
370 | 356 | 'styles' => 'resources/mediawiki.special/mediawiki.special.preferences.css', |
371 | 357 | ), |
372 | | - 'mediawiki.special.changeslist' => array( |
373 | | - 'styles' => 'resources/mediawiki.special/mediawiki.special.changeslist.css', |
374 | | - ), |
375 | 358 | 'mediawiki.special.search' => array( |
376 | 359 | 'scripts' => 'resources/mediawiki.special/mediawiki.special.search.js', |
377 | 360 | ), |
— | — | @@ -456,6 +439,10 @@ |
457 | 440 | 'scripts' => 'skins/common/edit.js', |
458 | 441 | 'dependencies' => 'mediawiki.legacy.wikibits', |
459 | 442 | ), |
| 443 | + 'mediawiki.legacy.enhancedchanges' => array( |
| 444 | + 'scripts' => 'skins/common/enhancedchanges.js', |
| 445 | + 'dependencies' => 'mediawiki.legacy.wikibits', |
| 446 | + ), |
460 | 447 | 'mediawiki.legacy.history' => array( |
461 | 448 | 'scripts' => 'skins/common/history.js', |
462 | 449 | 'dependencies' => 'mediawiki.legacy.wikibits', |
Index: trunk/phase3/resources/mediawiki.special/mediawiki.special.changeslist.css |
— | — | @@ -1,40 +0,0 @@ |
2 | | -/** |
3 | | - * Styling for Special:Watchlist and Special:RecentChanges |
4 | | - */ |
5 | | - |
6 | | -table.mw-enhanced-rc { |
7 | | - background: none; |
8 | | - border:0; |
9 | | - border-spacing:0; |
10 | | -} |
11 | | - |
12 | | -table.mw-enhanced-rc th, table.mw-enhanced-rc td { |
13 | | - padding:0; |
14 | | - vertical-align:top; |
15 | | -} |
16 | | - |
17 | | -td.mw-enhanced-rc { |
18 | | - white-space:nowrap; |
19 | | - font-family:monospace; |
20 | | -} |
21 | | - |
22 | | -.mw-enhanced-rc-time { |
23 | | - font-family: monospace; |
24 | | -} |
25 | | - |
26 | | -table.mw-enhanced-rc td.mw-enhanced-rc-nested { |
27 | | - padding-left: 1em; |
28 | | -} |
29 | | - |
30 | | -/* Show/hide arrows in enhanced changeslist */ |
31 | | -.mw-enhanced-rc .collapsible-expander { |
32 | | - float: none; |
33 | | -} |
34 | | - |
35 | | -.mw-rc-openarrow, |
36 | | -.show .mw-rc-closearrow { |
37 | | - display: none; |
38 | | -} |
39 | | -.show .mw-rc-openarrow { |
40 | | - display: inline; |
41 | | -} |
Index: trunk/phase3/resources/jquery.effects/jquery.effects.fade.js |
— | — | @@ -1,32 +0,0 @@ |
2 | | -/* |
3 | | -* jQuery UI Effects Fade @VERSION |
4 | | -* |
5 | | -* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) |
6 | | -* Dual licensed under the MIT or GPL Version 2 licenses. |
7 | | -* http://jquery.org/license |
8 | | -* |
9 | | -* http://docs.jquery.com/UI/Effects/Fade |
10 | | -* |
11 | | -* Depends: |
12 | | -* jquery.effects.core.js |
13 | | -*/ |
14 | | -(function( $, undefined ) { |
15 | | - |
16 | | - $.effects.fade = function(o) { |
17 | | - return this.queue(function() { |
18 | | - var elem = $(this), |
19 | | - mode = $.effects.setMode(elem, o.options.mode || 'hide'); |
20 | | - |
21 | | - elem.animate({ opacity: mode }, { |
22 | | - queue: false, |
23 | | - duration: o.duration, |
24 | | - easing: o.options.easing, |
25 | | - complete: function() { |
26 | | - (o.callback && o.callback.apply(this, arguments)); |
27 | | - elem.dequeue(); |
28 | | - } |
29 | | - }); |
30 | | - }); |
31 | | - }; |
32 | | - |
33 | | -})(jQuery); |
\ No newline at end of file |