Reverted r42528. Links with href="#" make firefox scroll to the top of the page, regardless of onclick handler.

This commit is contained in:
Tim Starling 2008-10-25 05:52:54 +00:00
parent 746a6d27ce
commit 4fcdceb81a
9 changed files with 44 additions and 86 deletions

View 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 ===

View 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,16 +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;
# onclick handler to toggle hidden/expanded
$toggleLink = "onclick='toggleVisibility($jsid)'";
# Title for <a> tags
$expandTitle = wfMsg('rc-enhanced-expand');
$closeTitle = wfMsg('rc-enhanced-hide');
$tl = "<span id='mw-rc-openarrow-$jsid' class='mw-changeslist-expanded'><a href='#' $toggleLink title='$expandTitle'>" . $this->sideArrow() . "</a></span>";
$tl .= "<span id='mw-rc-closearrow-$jsid' class='mw-changeslist-hidden' style='display:none'><a href='#' $toggleLink title='$closeTitle'>" . $this->downArrow() . "</a></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
@ -700,7 +680,7 @@ class EnhancedChangesList extends ChangesList {
$r .= "</td></tr></table>\n";
# Sub-entries
$r .= '<div id="mw-rc-subentries-'.$jsid.'" class="mw-changeslist-hidden"><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.
@ -779,10 +759,11 @@ class EnhancedChangesList extends ChangesList {
* @param string $alt text
* @return string HTML <img> tag
*/
protected function arrow( $dir ) {
protected function arrow( $dir, $alt='' ) {
global $wgStylePath;
$encUrl = htmlspecialchars( $wgStylePath . '/common/images/Arr_' . $dir . '.png' );
return "<img src=\"$encUrl\" width=\"12\" height=\"12\" />";
$encAlt = htmlspecialchars( $alt );
return "<img src=\"$encUrl\" width=\"12\" height=\"12\" alt=\"$encAlt\" />";
}
/**
@ -793,7 +774,7 @@ class EnhancedChangesList extends ChangesList {
protected function sideArrow() {
global $wgContLang;
$dir = $wgContLang->isRTL() ? 'l' : 'r';
return $this->arrow( $dir );
return $this->arrow( $dir, '+' );
}
/**
@ -802,7 +783,7 @@ class EnhancedChangesList extends ChangesList {
* @return string HTML <img> tag
*/
protected function downArrow() {
return $this->arrow( 'd' );
return $this->arrow( 'd', '-' );
}
/**
@ -810,7 +791,7 @@ class EnhancedChangesList extends ChangesList {
* @return string HTML <img> tag
*/
protected function spacerArrow() {
return $this->arrow( '' );
return $this->arrow( '', ' ' );
}
/**

View 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:

View file

@ -1726,8 +1726,6 @@ please see math/README to configure.',
'rc_categories_any' => 'Any',
'rc-change-size' => '$1', # only translate this message to other languages if you have to change it
'newsectionsummary' => '/* $1 */ new section',
'rc-enhanced-expand' => 'Show details (requires JavaScript)',
'rc-enhanced-hide' => 'Hide details',
# Recent changes linked
'recentchangeslinked' => 'Related changes',

View file

@ -1050,8 +1050,6 @@ $wgMessageStructure = array(
'rc_categories_any',
'rc-change-size',
'newsectionsummary',
'rc-enhanced-expand',
'rc-enhanced-hide',
),
'recentchangeslinked' => array(
'recentchangeslinked',

View file

@ -22,10 +22,16 @@ CREATE TABLE /*$wgDBprefix*/blob_tracking (
-- The CGZ content hash, or null
bt_cgz_hash varbinary(255),
-- The URL this blob is to be moved to
bt_new_url varbinary(255),
-- True if the text table has been updated to point to bt_new_url
bt_moved bool not null default 0,
PRIMARY KEY (bt_rev_id, bt_text_id),
-- Sort by page for easy CGZ recompression
KEY (bt_page, bt_rev_id),
KEY (bt_moved, bt_page, bt_rev_id),
-- For fast orphan searches
KEY (bt_text_id),

View file

@ -6,6 +6,8 @@ require( dirname( __FILE__ ) .'/../commandLine.inc' );
if ( count( $args ) < 1 ) {
echo "Usage: php trackBlobs.php <cluster> [... <cluster>]\n";
echo "Adds blobs from a given ES cluster to the blob_tracking table\n";
echo "Automatically deletes the tracking table and starts from the start again when restarted.\n";
exit( 1 );
}
$tracker = new TrackBlobs( $args );
@ -42,9 +44,11 @@ class TrackBlobs {
function initTrackingTable() {
$dbw = wfGetDB( DB_MASTER );
if ( !$dbw->tableExists( 'blob_tracking' ) ) {
$dbw->sourceFile( dirname( __FILE__ ) . '/blob_tracking.sql' );
if ( $dbw->tableExists( 'blob_tracking' ) ) {
$dbw->query( 'DROP TABLE ' . $dbw->tableName( 'blob_tracking' ) );
$dbw->query( 'DROP TABLE ' . $dbw->tableName( 'blob_orphans' ) );
}
$dbw->sourceFile( dirname( __FILE__ ) . '/blob_tracking.sql' );
}
function getTextClause() {
@ -240,11 +244,7 @@ class TrackBlobs {
return;
}
# Wait until the blob_tracking table is available in the slave
$dbw = wfGetDB( DB_MASTER );
$dbr = wfGetDB( DB_SLAVE );
$pos = $dbw->getMasterPos();
$dbr->masterPosWait( $pos, 100000 );
foreach ( $this->clusters as $cluster ) {
echo "Searching for orphan blobs in $cluster...\n";

View file

@ -1,39 +0,0 @@
/*
JavaScript file for enhanced recentchanges
*/
/*
* 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
*/
appendCSS('.mw-changeslist-hidden {'+
' display:none;'+
'}'+
'div.mw-changeslist-expanded {'+
' display:block;'+
'}'+
'span.mw-changeslist-expanded {'+
' display:inline !important;'+
'}'
);
/*
* 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.className == 'mw-changeslist-expanded') {
openarrow.className = 'mw-changeslist-hidden';
closearrow.className = 'mw-changeslist-expanded';
subentries.className = 'mw-changeslist-expanded';
} else {
openarrow.className = 'mw-changeslist-expanded';
closearrow.className = 'mw-changeslist-hidden';
subentries.className = 'mw-changeslist-hidden';
}
}

View 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