Revert r42514 for now "(bug 16073) * Use onclick handler for expand/collapse in enhan...
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 25 Oct 2008 00:10:07 +0000 (00:10 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 25 Oct 2008 00:10:07 +0000 (00:10 +0000)
A few issues I noted:
* The expand/contract icons no longer have regular link behavior (eg no hand icon, can't be reached by keyboard tabbing)
* It looks like the stuff-to-be-hidden doesn't get hidden until after the </body>, which feels a little sketchy to me. On long lists and slow connections you may see odd behavior with the items being shown expanded, then suddenly hiding when things reach the end. Adding the style immediately in the JS instead of waiting for the body load completion should avoid that
* mw-rc-jshidden class seems to be applied to things that shouldn't have it sincec they are explicitly given display:none?
* Instead of style='display:none' etc, consider using clear classes for expanded and hidden modes, then switch the classes instead of the styles in the JS

RELEASE-NOTES
includes/ChangesList.php
includes/DefaultSettings.php
skins/common/enhancedchanges.js [deleted file]
skins/common/wikibits.js

index 2735a65..1d850d6 100644 (file)
@@ -283,8 +283,6 @@ The following extensions are migrated into MediaWiki 1.14:
 * (bug 14609) User's namespaces to be searched default not updated after adding new namespace
 * Purge form uses valid XHTML and (bug 8992) uses $wgRequest instead of $_SERVER
 * (bug 12764) Special:LonelyPages shows transcluded pages
-* (bug 16073) Enhanced RecentChanges uses onclick handler with better fallback if
-  JavaScript is disabled.
 
 === API changes in 1.14 ===
 
index 6e516d4..41d2039 100644 (file)
@@ -388,23 +388,6 @@ class OldChangesList extends ChangesList {
  * Generate a list of changes using an Enhanced system (use javascript).
  */
 class EnhancedChangesList extends ChangesList {
-
-       /**
-       *  Add the JavaScript file for enhanced changeslist
-       *  @ return string
-       */
-       public function beginRecentChangesList() {
-               global $wgStylePath, $wgStyleVersion;
-               $this->rc_cache = array();
-               $this->rcMoveIndex = 0;
-               $this->rcCacheIndex = 0;
-               $this->lastdate = '';
-               $this->rclistOpen = false;
-               $script = Xml::tags( 'script', array(
-                       'type' => 'text/javascript',
-                       'src' => $wgStylePath . "/common/enhancedchanges.js?$wgStyleVersion" ), '' );
-               return $script;
-       }
        /**
         * Format a line for enhanced recentchange (aka with javascript and block of lines).
         */
@@ -613,12 +596,13 @@ class EnhancedChangesList extends ChangesList {
 
                $users = ' <span class="changedby">[' . implode( $this->message['semicolon-separator'], $users ) . ']</span>';
 
-               # ID for JS visibility toggle
-               $jsid = $this->rcCacheIndex;
-
-               $toggleLink = "onclick='toggleVisibility($jsid)'";
-               $tl  = "<span id='mw-rc-openarrow-$jsid' style='display:inline;' $toggleLink>" . $this->sideArrow() . "</span>";
-               $tl .= "<span id='mw-rc-closearrow-$jsid' style='display:none;' class='mw-rc-jshidden' $toggleLink>" . $this->downArrow() . "</span>";
+               # Arrow
+               $rci = 'RCI'.$this->rcCacheIndex;
+               $rcl = 'RCL'.$this->rcCacheIndex;
+               $rcm = 'RCM'.$this->rcCacheIndex;
+               $toggleLink = "javascript:toggleVisibility('$rci','$rcm','$rcl')";
+               $tl  = '<span id="'.$rcm.'"><a href="'.$toggleLink.'">' . $this->sideArrow() . '</a></span>';
+               $tl .= '<span id="'.$rcl.'" style="display:none"><a href="'.$toggleLink.'">' . $this->downArrow() . '</a></span>';
                $r .= '<td valign="top" style="white-space: nowrap"><tt>'.$tl.'&nbsp;';
 
                # Main line
@@ -696,7 +680,7 @@ class EnhancedChangesList extends ChangesList {
                $r .= "</td></tr></table>\n";
 
                # Sub-entries
-               $r .= '<div id="mw-rc-subentries-'.$jsid.'" class="mw-rc-jshidden"><table cellpadding="0" cellspacing="0"  border="0" style="background: none">';
+               $r .= '<div id="'.$rci.'" style="display:none;"><table cellpadding="0" cellspacing="0"  border="0" style="background: none">';
                foreach( $block as $rcObj ) {
                        # Get rc_xxxx variables
                        // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
index e8b87ef..3278219 100644 (file)
@@ -1385,7 +1385,7 @@ $wgCacheEpoch = '20030516000000';
  * to ensure that client-side caches don't keep obsolete copies of global
  * styles.
  */
-$wgStyleVersion = '183';
+$wgStyleVersion = '182';
 
 
 # Server-side caching:
diff --git a/skins/common/enhancedchanges.js b/skins/common/enhancedchanges.js
deleted file mode 100644 (file)
index 19b5d61..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/* 
-  JavaScript file for enhanced recentchanges
- */
-/*
-  * onload hook to add the CSS to hide parts that should be collapsed
-  *
-  * We do this with JS so everything will be expanded by default
-  * if JS is disabled
- */
-addOnloadHook(function () {
-       var css = ".mw-rc-jshidden { display:none; }";
-       appendCSS(css);
-});
-
-/*
- * Switch an RC line between hidden/shown
- * @param int idNumber : the id number of the RC group
-*/ 
-function toggleVisibility(idNumber) {
-       var openarrow = document.getElementById("mw-rc-openarrow-"+idNumber);
-       var closearrow = document.getElementById("mw-rc-closearrow-"+idNumber);
-       var subentries = document.getElementById("mw-rc-subentries-"+idNumber);
-       if (openarrow.style.display == 'inline') {
-               openarrow.style.display = 'none';
-               closearrow.style.display = 'inline';
-               subentries.style.display = 'block';
-       } else {
-               openarrow.style.display = 'inline';
-               closearrow.style.display = 'none';
-               subentries.style.display = 'none';
-       }
-}
index 62ef574..514714d 100644 (file)
@@ -104,6 +104,22 @@ if (wgBreakFrames) {
        }
 }
 
+// for enhanced RecentChanges
+function toggleVisibility(_levelId, _otherId, _linkId) {
+       var thisLevel = document.getElementById(_levelId);
+       var otherLevel = document.getElementById(_otherId);
+       var linkLevel = document.getElementById(_linkId);
+       if (thisLevel.style.display == 'none') {
+               thisLevel.style.display = 'block';
+               otherLevel.style.display = 'none';
+               linkLevel.style.display = 'inline';
+       } else {
+               thisLevel.style.display = 'none';
+               otherLevel.style.display = 'inline';
+               linkLevel.style.display = 'none';
+       }
+}
+
 function showTocToggle() {
        if (document.createTextNode) {
                // Uses DOM calls to avoid document.write + XHTML issues