From 889c00f3b3074d0b25cf2dbd60ef9f8d5ab8d2e7 Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Wed, 2 Dec 2009 21:22:03 +0000 Subject: [PATCH] Adding some code to the ajax watch/unwatch to alter tooltips on ajax update. Bug #21538 --- includes/DefaultSettings.php | 2 +- includes/Skin.php | 3 ++- skins/common/ajaxwatch.js | 13 +++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 4cf93e4893..0dd99c6b78 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1618,7 +1618,7 @@ $wgCacheEpoch = '20030516000000'; * to ensure that client-side caches do not keep obsolete copies of global * styles. */ -$wgStyleVersion = '255'; +$wgStyleVersion = '256'; # Server-side caching: diff --git a/includes/Skin.php b/includes/Skin.php index 79f2125c74..4dc62df45f 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -440,7 +440,8 @@ class Skin extends Linker { if ( $wgOut->isArticleRelated() && $wgUseAjax && $wgAjaxWatch && $wgUser->isLoggedIn() ) { $msgs = (object)array(); - foreach ( array( 'watch', 'unwatch', 'watching', 'unwatching' ) as $msgName ) { + foreach ( array( 'watch', 'unwatch', 'watching', 'unwatching', + 'tooltip-ca-watch', 'tooltip-ca-unwatch' ) as $msgName ) { $msgs->{$msgName . 'Msg'} = wfMsg( $msgName ); } $vars['wgAjaxWatch'] = $msgs; diff --git a/skins/common/ajaxwatch.js b/skins/common/ajaxwatch.js index 9dddb1f4ba..2f694e05b2 100644 --- a/skins/common/ajaxwatch.js +++ b/skins/common/ajaxwatch.js @@ -12,7 +12,9 @@ if(typeof wgAjaxWatch === "undefined" || !wgAjaxWatch) { watchMsg: "Watch", unwatchMsg: "Unwatch", watchingMsg: "Watching...", - unwatchingMsg: "Unwatching..." + unwatchingMsg: "Unwatching...", + 'tooltip-ca-watchMsg': "Add this page to your watchlist", + 'tooltip-ca-unwatchMsg': "Remove this page from your watchlist" }; } @@ -31,7 +33,14 @@ wgAjaxWatch.setLinkText = function( newText ) { if ( newText == wgAjaxWatch.watchingMsg || newText == wgAjaxWatch.unwatchingMsg ) { wgAjaxWatch.watchLinks[i].className += ' loading'; } else if ( newText == wgAjaxWatch.watchMsg || newText == wgAjaxWatch.unwatchMsg ) { - wgAjaxWatch.watchLinks[i].className = wgAjaxWatch.watchLinks[i].className.replace( /loading/i, '' ); + wgAjaxWatch.watchLinks[i].className = + wgAjaxWatch.watchLinks[i].className.replace( /loading/i, '' ); + // update the title text on the link + var keyCommand = wgAjaxWatch.watchLinks[i].title.match( /\[.*\]/ ) ? + wgAjaxWatch.watchLinks[i].title.match( /\[.*\]/ )[0] : ""; + wgAjaxWatch.watchLinks[i].title = ( newText == wgAjaxWatch.watchMsg ? + wgAjaxWatch['tooltip-ca-watchMsg'] : wgAjaxWatch['tooltip-ca-unwatchMsg'] ) + + " " + keyCommand; } } } else { -- 2.20.1