Adding some code to the ajax watch/unwatch to alter tooltips on ajax update. Bug...
authorAdam Miller <adam@users.mediawiki.org>
Wed, 2 Dec 2009 21:22:03 +0000 (21:22 +0000)
committerAdam Miller <adam@users.mediawiki.org>
Wed, 2 Dec 2009 21:22:03 +0000 (21:22 +0000)
includes/DefaultSettings.php
includes/Skin.php
skins/common/ajaxwatch.js

index 4cf93e4..0dd99c6 100644 (file)
@@ -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:
index 79f2125..4dc62df 100644 (file)
@@ -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;
index 9dddb1f..2f694e0 100644 (file)
@@ -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 {